Add other periodic functions as oscillators.

--- src/afterglow/effects/oscillators.clj
+++ src/afterglow/effects/oscillators.clj
@@ -78,3 +78,135 @@
          (- 1.0 (adjust-phase (rhythm/snapshot-bar-phase snapshot bar-ratio) phase)))
        (fn [^afterglow.rhythm.MetronomeSnapshot snapshot]
          (adjust-phase (rhythm/snapshot-bar-phase snapshot bar-ratio) phase))))))
+
+(defn triangle-beat
+  "Returns an oscillator which generates a triangle wave relative to the phase
+  of the current beat. Supplying a beat ratio will run the oscillator at
+  the specified fraction or multiple of a beat, and supplying a phase
+  will offset the oscillator from the underlying metronome phase by that
+  amount."
+  ([]
+   (triangle-beat 1 0.0))
+
+  ([beat-ratio]
+   (triangle-beat beat-ratio 0.0))
+
+  ([beat-ratio ^Double phase]
+   (fn [^afterglow.rhythm.MetronomeSnapshot snapshot]
+     (let [reached (adjust-phase (rhythm/snapshot-beat-phase snapshot beat-ratio) phase)
+           intensity (adjust-phase (rhythm/snapshot-beat-phase snapshot (/ beat-ratio 2)) phase)]
+       (if (< reached 0.5)
+         intensity
+         (- 1.0 intensity))))))
+
+(defn triangle-bar
+  "Returns an oscillator which generates a triangle wave relative to the phase
+  of the current bar. Supplying a bar ratio will run the oscillator at
+  the specified fraction or multiple of a bar, and supplying a phase
+  will offset the oscillator from the underlying metronome phase by that
+  amount."
+  ([]
+   (triangle-bar 1 0.0))
+
+  ([bar-ratio]
+   (triangle-bar bar-ratio 0.0))
+
+  ([bar-ratio ^Double phase]
+   (fn [^afterglow.rhythm.MetronomeSnapshot snapshot]
+     (let [reached (adjust-phase (rhythm/snapshot-bar-phase snapshot bar-ratio) phase)
+           intensity (adjust-phase (rhythm/snapshot-bar-phase snapshot (/ bar-ratio 2)) phase)]
+       (if (< reached 0.5)
+         intensity
+         (- 1.0 intensity))))))
+
+(defn square-beat
+  "Returns an oscillator which generates a square wave relative to the phase
+  of the current beat. Specifying a width adjusts how much of the time the
+  wave is on (high); the default is 0.5, lower values cause it to turn off
+  sooner, larger values later. In any case the width must be greater than
+  0.0 and less than 1.0. Supplying a beat ratio will run the oscillator at
+  the specified fraction or multiple of a beat, and supplying a phase
+  will offset the oscillator from the underlying metronome phase by that
+  amount. "
+  ([]
+   (square-beat 0.5 1 0.0))
+
+  ([^Double width]
+   (square-beat width 1 0.0))
+
+  ([^Double width beat-ratio]
+   (square-beat width beat-ratio 0.0))
+
+  ([^Double width beat-ratio ^Double phase]
+   (when (not (and (> width 0.0) (< width 1.0)))
+     (throw (IllegalArgumentException. "width must fall between 0.0 and 1.0")))
+   (fn [^afterglow.rhythm.MetronomeSnapshot snapshot]
+     (let [reached (adjust-phase (rhythm/snapshot-beat-phase snapshot beat-ratio) phase)]
+       (if (< reached width)
+         1.0
+         0.0)))))
+
+(defn square-bar
+  "Returns an oscillator which generates a square wave relative to the phase
+  of the current bar. Specifying a width adjusts how much of the time the
+  wave is on (high); the default is 0.5, lower values cause it to turn off
+  sooner, larger values later. In any case the width must be greater than
+  0.0 and less than 1.0. Supplying a bar ratio will run the oscillator at
+  the specified fraction or multiple of a bar, and supplying a phase
+  will offset the oscillator from the underlying metronome phase by that
+  amount. "
+  ([]
+   (square-bar 0.5 1 0.0))
+
+  ([^Double width]
+   (square-bar width 1 0.0))
+
+  ([^Double width bar-ratio]
+   (square-bar width bar-ratio 0.0))
+
+  ([^Double width bar-ratio ^Double phase]
+   (when (not (and (> width 0.0) (< width 1.0)))
+     (throw (IllegalArgumentException. "width must fall between 0.0 and 1.0")))
+   (fn [^afterglow.rhythm.MetronomeSnapshot snapshot]
+     (let [reached (adjust-phase (rhythm/snapshot-bar-phase snapshot bar-ratio) phase)]
+       (if (< reached width)
+         1.0
+         0.0)))))
+
+(defn sine-beat
+  "Returns an oscillator which generates a sine wave relative to the phase
+  of the current beat. The wave has value 1.0 at phase 0.0, dropping to 0.0
+  at phase 0.5, and returning to 1.0. Supplying a beat ratio will run the
+  oscillator at the specified fraction or multiple of a beat, and supplying
+  a phase will offset the oscillator from the underlying metronome phase by
+  that amount. "
+  ([]
+   (sine-beat 1 0.0))
+
+  ([beat-ratio]
+   (sine-beat beat-ratio 0.0))
+
+  ([beat-ratio ^Double phase]
+   (let [adjusted-phase (+ phase 0.25)
+         two-pi (* 2.0 Math/PI)]
+     (fn [^afterglow.rhythm.MetronomeSnapshot snapshot]
+       (+ 0.5 (Math/sin (* two-pi (adjust-phase (rhythm/snapshot-beat-phase snapshot beat-ratio) adjusted-phase))))))))
+
+(defn sine-bar
+  "Returns an oscillator which generates a sine wave relative to the phase
+  of the current bar. The wave has value 1.0 at phase 0.0, dropping to 0.0
+  at phase 0.5, and returning to 1.0. Supplying a bar ratio will run the
+  oscillator at the specified fraction or multiple of a bar, and supplying
+  a phase will offset the oscillator from the underlying metronome phase by
+  that amount. "
+  ([]
+   (sine-bar 1 0.0))
+
+  ([bar-ratio]
+   (sine-bar bar-ratio 0.0))
+
+  ([bar-ratio ^Double phase]
+   (let [adjusted-phase (+ phase 0.25)
+         two-pi (* 2.0 Math/PI)]
+     (fn [^afterglow.rhythm.MetronomeSnapshot snapshot]
+       (+ 0.5 (* 0.5 (Math/sin (* two-pi (adjust-phase (rhythm/snapshot-bar-phase snapshot bar-ratio) adjusted-phase)))))))))


fixed keys

fixed keys

--- src/cljs/swarmpit/component/service/create_image.cljs
+++ src/cljs/swarmpit/component/service/create_image.cljs
@@ -232,15 +232,18 @@
   {:primary   (fn [{:keys [name]}] name)
    :status-fn (fn [{:keys [official private]}]
                 [(when official
-                   (comp/tooltip {:title "Official Image"} (icon/verified {})))
+                   (comp/tooltip {:key "official" :title "Official Image"} (icon/verified {})))
                  (when private
-                   (comp/tooltip {:title "Private"} (icon/lock {})))])
+                   (comp/tooltip {:key "private" :title "Private"} (icon/lock {})))])
    :secondary (fn [{:keys [stars pulls description]}]
-                (html [(when (< 0 stars) [(shortint stars) " stars , "])
-                       (when (< 0 pulls) [(shortint pulls) " downloads"])
-                       (when (not (empty? description)) [(comp/hidden {:mdUp true} (html [:br]))
-                                                         (comp/hidden {:smDown true} " - ")
-                                                         description])]))})
+                (html [(when (< 0 stars)
+                         [(shortint stars) " stars , "])
+                       (when (< 0 pulls)
+                         [(shortint pulls) " downloads"])
+                       (when (not (empty? description))
+                         [(comp/hidden {:key "break" :mdUp true} (html [:br]))
+                          (comp/hidden {:key "separator" :smDown true} " - ")
+                          description])]))})

 (rum/defc form-repo < rum/reactive []
   (let [{:keys [repository manual searching? registries registry active]} (state/react state/form-state-cursor)


Implement ordering

Implement ordering

--- src/clojure/clojurewerkz/cassaforte/new_query_api.clj
+++ src/clojure/clojurewerkz/cassaforte/new_query_api.clj
@@ -1,30 +1,36 @@
 (ns clojurewerkz.cassaforte.new-query-api
   "Functions for building dynamic CQL queries, in case you feel
    that `cql` namespace is too limiting for you."
-  (:import [com.datastax.driver.core.querybuilder QueryBuilder Select$Where Clause]
+  (:import [com.datastax.driver.core.querybuilder QueryBuilder
+            Select$Selection Select Select$Where
+
+            Clause]
            [com.datastax.driver.core.querybuilder ]))

+(def select-command-order
+  [QueryBuilder Select$Selection Select Select$Where])

 (defn from
-  [table-name]
-  [2 (fn from-query [builder]
-       (.from builder table-name)
+  [^String table-name]
+  [2 (fn from-query [^Select$Selection query-builder]
+       (.from query-builder (name table-name))
        )])

 (defn all
   []
-  [1 (fn all-query [query-builder] (.all query-builder))])
+  [1 (fn all-query [^Select$Selection query-builder]
+       (.all query-builder))])

 (defn column
   [column]
-  [1 (fn column-query [query-builder]
+  [1 (fn column-query [^Select$Selection query-builder]
        (.column query-builder column))])

 (defn columns
   [columns]
   [1 (fn [^Select$Selection query-builder]
-       (reduce (fn [builder column]
+       (reduce (fn [^Select$Selection builder column]
                  (.column builder column))
                query-builder
                columns))])
@@ -75,8 +81,7 @@
      (fn [^Select$Where builder [query-type column value]]
        (.and builder ((query-type-map query-type) (name column) value)))
      query-builder
-     construct)
-    )
+     construct))
   clojure.lang.IPersistentMap
   (build-where [construct ^Select$Where query-builder]
     (reduce
@@ -87,8 +92,35 @@

 (defn where
   [m]
-  [3 (fn where-query [query-builder]
+  [3 (fn where-query [^Select query-builder]
        (build-where m (.where query-builder)))])
+
+(defn asc
+  [^String column-name]
+  (QueryBuilder/asc column-name))
+
+(defn desc
+  [^String column-name]
+  (QueryBuilder/desc column-name))
+
+(defn order-by
+  [& orderings]
+  [3 (fn order-by-query [^Select query-builder]
+       (.orderBy query-builder orderings))])
+
+(defn limit
+  [m]
+  [3 (fn order-by-query [^Select  query-builder]
+       )])
+
+(defn allow-filtering
+  [m]
+  [3 (fn order-by-query [^Select  query-builder]
+       )])
+   ;; public Select orderBy(Ordering... orderings) {
+   ;;  public Select limit(int limit) {
+   ;;  public Select limit(BindMarker marker) {
+   ;;  public Select allowFiltering() {

 (defn select
   [table-name & statements]
@@ -97,7 +129,7 @@
        ;; (map println)
        (map second)
        (reduce (fn [builder statement]
-                 (println builder statement)
+                 ;; (println builder statement)
                  (statement builder))
                (QueryBuilder/select)
                )
@@ -124,8 +156,7 @@
 ;; String quote(String columnName)
 ;; String token(String columnName)
 ;; String token(String... columnNames)
-;; Ordering asc(String columnName)
-;; Ordering desc(String columnName)
+
 ;; Using timestamp(long timestamp)
 ;; Using timestamp(BindMarker marker)
 ;; Using ttl(int ttl)


Changing expired collections test to avoid failing due to timing issues.

--- int_test/cmr/metadata_db/int_test/concepts/search_test.clj
+++ int_test/cmr/metadata_db/int_test/concepts/search_test.clj
@@ -157,9 +157,9 @@
                                   (util/create-and-save-collection
                                     prov uniq-num num-revisions
                                     {:delete-time (str expire-time)})))
-        ;; Expired 6000 seconds ago.
-        coll1 (make-coll-expiring-in "PROV1" 1 1 -6000)
-        coll2 (make-coll-expiring-in "PROV1" 2 2 -6000)
+        ;; Expired a long time ago.
+        coll1 (make-coll-expiring-in "PROV1" 1 1 -60000)
+        coll2 (make-coll-expiring-in "PROV1" 2 2 -60000)
         ;; Expires in the far future
         coll3 (make-coll-expiring-in "PROV1" 3 1 5000)
         ;; Doesn't have an expiration date


Lisätty standigseihin rank

Lisätty standigseihin rank

--- mtg-pairings-backend/src/mtg_pairings_backend/mtg_util.clj
+++ mtg-pairings-backend/src/mtg_pairings_backend/mtg_util.clj
@@ -44,5 +44,6 @@
         teams-results (map-values calculate-points-pgw grouped-matches)
         results (calculate-omw-ogw teams-results)
         lst (for [[team result] results]
-              (assoc result :team team))]
-    (reverse (sort-by (juxt :points :omw :pgw :ogw) lst))))
+              (assoc result :team team))
+        sorted (reverse (sort-by (juxt :points :omw :pgw :ogw) lst))]
+    (map (fn [idx res] (assoc res :rank idx)) (iterate inc 1) sorted)))


Simplify stats field addition with add-stats-field method

--- src/nhl_score_api/fetchers/nhlstats/game_scores.clj
+++ src/nhl_score_api/fetchers/nhlstats/game_scores.clj
@@ -5,6 +5,9 @@

 (def pre-game-stats-key :pre-game-stats)
 (def current-stats-key :current-stats)
+
+(defn- add-stats-field [game-details stats-key field value]
+  (assoc game-details stats-key (assoc (stats-key game-details) field value)))

 (defn- regular-season-game? [api-game]
   (= "R" (:game-type api-game)))
@@ -313,32 +316,28 @@
   (if (all-star-game? api-game)
     game-details
     (let [records (parse-records api-game team-details teams scores)]
-      (assoc game-details
-        pre-game-stats-key (assoc (pre-game-stats-key game-details) :records (pre-game-stats-key records))
-        current-stats-key (assoc (current-stats-key game-details) :records (current-stats-key records))))))
+      (-> game-details
+          (add-stats-field pre-game-stats-key :records (pre-game-stats-key records))
+          (add-stats-field current-stats-key :records (current-stats-key records))))))

 (defn- add-team-streaks [game-details api-game team-details standings]
   (if (not (regular-season-game? api-game))
     game-details
-    (assoc game-details
-      current-stats-key (assoc (current-stats-key game-details)
-                          :streaks (parse-streaks team-details standings)))))
+    (add-stats-field game-details current-stats-key :streaks (parse-streaks team-details standings))))

 (defn- add-team-standings [game-details api-game team-details standings last-playoff-teams first-teams-out-of-the-playoffs]
   (if (or (not (regular-season-game? api-game)) (nil? last-playoff-teams))
     game-details
-    (assoc game-details
-      current-stats-key (assoc (current-stats-key game-details)
-                          :standings
-                          (parse-standings team-details standings last-playoff-teams first-teams-out-of-the-playoffs)))))
+    (add-stats-field game-details current-stats-key :standings
+                     (parse-standings team-details standings last-playoff-teams first-teams-out-of-the-playoffs))))

 (defn- add-playoff-series-information [game-details api-game]
   (if (non-playoff-game? api-game)
     game-details
     (let [playoff-series-information (parse-playoff-series-information api-game game-details)]
-      (assoc game-details
-        pre-game-stats-key (assoc (pre-game-stats-key game-details) :playoff-series (pre-game-stats-key playoff-series-information))
-        current-stats-key (assoc (current-stats-key game-details) :playoff-series (current-stats-key playoff-series-information))))))
+      (-> game-details
+          (add-stats-field pre-game-stats-key :playoff-series (pre-game-stats-key playoff-series-information))
+          (add-stats-field current-stats-key :playoff-series (current-stats-key playoff-series-information))))))

 (defn- parse-game-details [standings last-playoff-teams first-teams-out-of-the-playoffs api-game]
   (let [team-details (parse-game-team-details api-game)


Add unit tests.

Add unit tests.

--- test/dsbdp/test/local_dpp_self_adaptivity_tests.clj
+++ test/dsbdp/test/local_dpp_self_adaptivity_tests.clj
@@ -260,3 +260,71 @@
     (update-stats self-adaptivity-controller stat-3)
     (is (= expected-mapping-3 @mapping))))

+(deftest self-adaptivity-controller-test-2
+  (let [orig-proc-fns (create-no-op-proc-fns 15)
+        stat-1 {:pipeline {:in 1, :dropped 1},
+                0 {:out 1, :dropped 1},
+                1 {:out 1, :dropped 20},
+                2 {:out 1, :dropped 1}}
+        stat-2 {:pipeline {:in 1, :dropped 1},
+                0 {:out 1, :dropped 1},
+                1 {:out 1, :dropped 20},
+                2 {:out 1, :dropped 1}}
+        stat-3 {:pipeline {:in 1, :dropped 1},
+                0 {:out 1, :dropped 20},
+                1 {:out 1, :dropped 20},
+                2 {:out 1, :dropped 1}}
+        expected-mapping-1 [5 6 4]
+        expected-mapping-2 [5 6 4]
+        expected-mapping-3 [6 5 4]
+        controller-cfg {:inactivity 1 :threshold 10 :repetition 1}
+        mapping (atom [5 5 5])
+        proc-fns (atom (combine-proc-fns-vec @mapping orig-proc-fns))
+        mock-pipeline (fn [_] (fn [& _]))
+        self-adaptivity-controller (create-self-adaptivity-controller
+                                     controller-cfg
+                                     mock-pipeline
+                                     orig-proc-fns
+                                     proc-fns
+                                     mapping)]
+    (update-stats self-adaptivity-controller stat-1)
+    (is (= expected-mapping-1 @mapping))
+    (update-stats self-adaptivity-controller stat-2)
+    (is (= expected-mapping-2 @mapping))
+    (update-stats self-adaptivity-controller stat-3)
+    (is (= expected-mapping-3 @mapping))))
+
+(deftest self-adaptivity-controller-test-3
+  (let [orig-proc-fns (create-no-op-proc-fns 15)
+        stat-1 {:pipeline {:in 1, :dropped 1},
+                0 {:out 1, :dropped 1},
+                1 {:out 1, :dropped 20},
+                2 {:out 1, :dropped 1}}
+        stat-2 {:pipeline {:in 1, :dropped 1},
+                0 {:out 1, :dropped 20},
+                1 {:out 1, :dropped 20},
+                2 {:out 1, :dropped 1}}
+        stat-3 {:pipeline {:in 1, :dropped 1},
+                0 {:out 1, :dropped 20},
+                1 {:out 1, :dropped 20},
+                2 {:out 1, :dropped 1}}
+        expected-mapping-1 [5 6 4]
+        expected-mapping-2 [5 6 4]
+        expected-mapping-3 [5 6 4]
+        controller-cfg {:inactivity 1 :threshold 10 :repetition 1}
+        mapping (atom [5 5 5])
+        proc-fns (atom (combine-proc-fns-vec @mapping orig-proc-fns))
+        mock-pipeline (fn [_] (fn [& _]))
+        self-adaptivity-controller (create-self-adaptivity-controller
+                                     controller-cfg
+                                     mock-pipeline
+                                     orig-proc-fns
+                                     proc-fns
+                                     mapping)]
+    (update-stats self-adaptivity-controller stat-1)
+    (is (= expected-mapping-1 @mapping))
+    (update-stats self-adaptivity-controller stat-2)
+    (is (= expected-mapping-2 @mapping))
+    (update-stats self-adaptivity-controller stat-3)
+    (is (= expected-mapping-3 @mapping))))
+


Make title text of recent threads button more descriptive

--- src/braid/client/ui/views/header.cljs
+++ src/braid/client/ui/views/header.cljs
@@ -65,7 +65,7 @@
          [{:title "Inbox"
            :route-fn routes/inbox-page-path
            :class "inbox"}
-          {:title "Recent"
+          {:title "Recently Closed"
            :route-fn routes/recent-page-path
            :class "recent"}
           {:title "Uploads"


fix sum-xf

fix sum-xf

--- src/cljc/commos/delta/compscribe.cljc
+++ src/cljc/commos/delta/compscribe.cljc
@@ -355,7 +355,7 @@
         ([] (rf))
         ([result] (rf result))
         ([result input]
-         (rf result [(vswap! sum delta/add input) input]))))))
+         (rf result [[:is (vswap! sum delta/add input)] input]))))))

 (def ^:private first-then-second
   (fn [rf]
@@ -377,7 +377,8 @@
               chs {}]
       (let [[msg port] (alts! [subscribe-ch
                                cancel-ch])]
-        (case port
+        #_(println [msg port subscribe-ch cancel-ch])
+        (condp identical? port
           subscribe-ch
           (let [[this identifier target] msg
                 [m :as cache]
@@ -425,15 +426,9 @@

 (defn compscriber
   [service]
-  (let [service (compscribe-service service)
-        service (reify
-                  IStream
-                  (subscribe [this identifier target]
-                    (-> service
-                        (caching this)
-                        (subscribe identifier target)))
-                  (cancel [this target]
-                    (cancel service target)))
+  (let [service (-> service
+                    (compscribe-service)
+                    (hybrid-cache))
         compile-spec (memoize compile-spec)]
     (reify
       IStream


CMR-514: Removed comment block.

CMR-514: Removed comment block.

--- src/cmr/bootstrap/data/bulk_index.clj
+++ src/cmr/bootstrap/data/bulk_index.clj
@@ -57,19 +57,6 @@
   (index-granules-for-provider system provider-id)
   (info "Indexing of provider" provider-id "completed."))

-(comment
-
-
-  (let [system (get-in user/system [:apps :bootstrap])
-        concepts (index-provider system "FIX_PROV1")
-
-        ]
-    (println concepts))
-
-
-  )
-
-
 ;; Background task to handle requests
 (defn handle-bulk-index-requests
   "Handle any requests for copying data from echo catalog rest to metadata db."


Provide :test-var value in :complete report only when available.

This fixes TCHECK-140.

When reporting completion results for tests defined via `defspec`,
it's useful to include the name of the test. This is available
in the *testing-vars* value in the test environment when tests
are composed.

When calling the test function directly, *testing-vars* is not
populated with the test-var. It's not necessary to include the
test-var name as its known: it's the function that is being
directly called.

--- src/main/clojure/clojure/test/check/clojure_test.cljc
+++ src/main/clojure/clojure/test/check/clojure_test.cljc
@@ -31,10 +31,11 @@
   [{:keys [type] :as args}]
   (case type
     :complete
-    (let [params (assoc (select-keys args [:result :num-tests :seed])
-                        :test-var (-> #?(:clj ct/*testing-vars*
-                                         :cljs (:testing-vars ct/*current-env*))
-                                      first meta :name name))]
+    (let [testing-vars #?(:clj ct/*testing-vars*
+                          :cljs (:testing-vars ct/*current-env*))
+          params       (merge (select-keys args [:result :num-tests :seed])
+                              (when (seq testing-vars)
+                                {:test-var (-> testing-vars first meta :name name)}))]
       (ct/report {:type :clojure.test.check.clojure-test/complete
                   :clojure.test.check.clojure-test/property (:property args)
                   :clojure.test.check.clojure-test/complete params}))


more possibilities

more possibilities

--- exercism/clojure/reverse-string/src/reverse_string.clj
+++ exercism/clojure/reverse-string/src/reverse_string.clj
@@ -1,5 +1,22 @@
-(ns reverse-string
-  (:require [clojure.string :as str]))
+(ns reverse-string)

-(defn reverse-string [s]
-  (str/reverse s))
+(defn reverse-string-into [s]
+  (->>
+    s
+    (into nil)
+    (apply str)))
+
+(defn reverse-string-reduce [s]
+  (->>
+    s
+    (reduce conj nil)
+    (apply str)))
+
+(defn reverse-string-recursion [s]
+  (loop [s s
+         l nil]
+    (if (empty? s)
+      (apply str l)
+      (recur (rest s) (conj l (first s))))))
+
+(def reverse-string reverse-string-into)


[#9227] Disable keycard unpairing for v1

--- src/status_im/ui/screens/hardwallet/settings/views.cljs
+++ src/status_im/ui/screens/hardwallet/settings/views.cljs
@@ -121,9 +121,11 @@
              [action-row {:icon     :main-icons/add
                           :label    :t/change-pin
                           :on-press #(re-frame/dispatch [:keycard-settings.ui/change-pin-pressed])}]
-             [action-row {:icon     :main-icons/close
-                          :label    :t/unpair-card
-                          :on-press #(re-frame/dispatch [:keycard-settings.ui/unpair-card-pressed])}]])])]
+             ;; TODO(rasom): uncomment this when unpairing will be enabled
+             ;; https://github.com/status-im/status-react/issues/9227
+             #_[action-row {:icon     :main-icons/close
+                            :label    :t/unpair-card
+                            :on-press #(re-frame/dispatch [:keycard-settings.ui/unpair-card-pressed])}]])])]
       ; NOTE: Reset card is hidden until multiaccount removal will be implemented
       #_(when pairing
           [react/view {:margin-bottom 35


Test fix :wrench:

Test fix :wrench:

--- src/metabase/models/field.clj
+++ src/metabase/models/field.clj
@@ -104,12 +104,12 @@
 (defn qualified-name-components
   "Return the pieces that represent a path to FIELD, of the form `[table-name parent-fields-name* field-name]`."
   [{field-name :name, table-id :table_id, parent-id :parent_id}]
-  (conj (if-let [parent (Field parent-id)]
-          (qualified-name-components parent)
-          (let [{table-name :name, schema :schema} (db/select-one ['Table :name :schema], :id table-id)]
-            (conj (when schema
-                    [schema])
-                  table-name)))
+  (conj (vec (if-let [parent (Field parent-id)]
+               (qualified-name-components parent)
+               (let [{table-name :name, schema :schema} (db/select-one ['Table :name :schema], :id table-id)]
+                 (conj (when schema
+                         [schema])
+                       table-name))))
         field-name))

 (defn qualified-name


DXML-16: Eliminate reflection in function emit-cdata

Signed-off-by: Ryan Senior <f1d27374ad67c65ad142d03675bbdd3b80b82f07@gmail.com>

--- src/main/clojure/clojure/data/xml.clj
+++ src/main/clojure/clojure/data/xml.clj
@@ -53,7 +53,7 @@
   (or (nil? s)
       (= s "")))

-(defn emit-cdata [^String cdata-str writer]
+(defn emit-cdata [^String cdata-str ^javax.xml.stream.XMLStreamWriter writer]
   (when-not (str-empty? cdata-str)
     (let [idx (.indexOf cdata-str "]]>")]
       (if (= idx -1)


hide add contact button when all chats created

--- src/mobile_patient/route_helpers.cljs
+++ src/mobile_patient/route_helpers.cljs
@@ -7,10 +7,15 @@
 ;; NAVIGATION BUTTONS

 (defn add-chat-button [navigation]
-  [ui/touchable-highlight {:on-press #(navigation.navigate "Contacts")
-                           :style {:margin-right 20}
-                           :underlay-color color/grey}
-   [ui/icon {:name "add-circle" :size 36 :color color/pink}]])
+  (let [contacts @(rf/subscribe [:contacts])
+        no-contacts (empty? (:patients-data contacts))]
+    (if no-contacts
+      [ui/view]
+      [ui/touchable-highlight {:on-press #(navigation.navigate "Contacts")
+                              :style {:margin-right 20}
+                              :underlay-color color/grey}
+       [ui/icon {:name "add-circle" :size 36 :color color/pink}]]
+      )))

 ;; NAVIGATION ROUTES


Day 13 part 1 solved

Day 13 part 1 solved

--- src/adventofcode/solutions.clj
+++ src/adventofcode/solutions.clj
@@ -388,7 +388,7 @@
   "Will find first occurence of particular char c which is balanced with it's counterpart ic"
   [input c ic]
   (reduce (fn [a x]
-            (condp = x                                       ;why not use "case"? Because case requires compile-time constants!!!
+            (condp = x                                      ;why not use "case"? Because case requires compile-time constants!!!
               ic (move-on-balance-and-current a inc)
               c (if (pos? (:balance a))
                   (move-on-balance-and-current a dec)
@@ -415,9 +415,42 @@

 (defn day12 [input]
   (reduce #(if %2
-                %2
-                (reduced (reduce
-                           +
-                           (map
-                             (fn [n] (s->int n)) (re-seq #"\-?\d+" %))))) (iterate rm-red-jsobj input)))
-
+            %2
+            (reduced (reduce
+                       +
+                       (map
+                         (fn [n] (s->int n)) (re-seq #"\-?\d+" %))))) (iterate rm-red-jsobj input)))
+
+;day 13
+;part 1
+(defn- d13-single-line-extractor
+  "Extracts data from single line of input for day 13"
+  [line]
+  (let [[who1 _ what how-much _ _ _ _ _ _ who2] (re-seq #"\w+\b" line)
+        amount (s->int how-much)
+        delta (if (= what "gain") amount (- amount))]
+    [[who1 who2] delta]))
+
+(defn- d13-persons
+  "Collects all persons present around the round table :)"
+  [deltas]
+  (reduce #(let [[endpoints _] %2]
+            (conj % (first endpoints) (last endpoints))) #{} deltas))
+
+(defn day13
+  [input]
+  "Solves day 13 part 1"
+  (let [deltas (into {} (map d13-single-line-extractor input))
+        persons (d13-persons deltas)
+        arrangements (permutations persons)
+        happiness (fn [members]
+                    (let [pairs (map vec (partition 2 1 members))]
+                      (reduce
+                        #(+ % (deltas %2))
+                        0
+                        (conj pairs [(ffirst pairs) (last (last pairs))]))))]
+    (reduce
+      #(if (> %2 %) %2 %)
+      (map
+        #(+ (happiness %) (happiness (reverse %)))
+        arrangements))))


Clean duplicate require

Clean duplicate require

--- modules/reitit-frontend/src/reitit/frontend/history.cljs
+++ modules/reitit-frontend/src/reitit/frontend/history.cljs
@@ -1,7 +1,6 @@
 (ns reitit.frontend.history
   ""
   (:require [reitit.core :as reitit]
-            [goog.events :as e]
             [reitit.core :as r]
             [reitit.frontend :as rf]
             [reitit.impl :as impl]
@@ -89,7 +88,7 @@
       (-on-navigate this (-get-path this))
       (assoc this
              :listen-key (gevents/listen js/window goog.events.EventType.POPSTATE handler false)
-             :click-listen-key (e/listen js/document e/EventType.CLICK ignore-anchor-click))))
+             :click-listen-key (gevents/listen js/document goog.events.EventType.CLICK ignore-anchor-click))))
   (-on-navigate [this path]
     (on-navigate (rf/match-by-path router path) this))
   (-stop [this]


add lbas

add lbas

--- src/blog/hashobject/views/common.clj
+++ src/blog/hashobject/views/common.clj
@@ -23,7 +23,8 @@
        [:ul
         [:li [:a {:href "http://hashobject.com"} "Home"]]
         [:li.active [:a {:href "http://blog.hashobject.com"} "Blog"]]
-        [:li [:a {:href "http://os.hashobject.com"} "Open Source"]]]]])
+        [:li [:a {:href "http://os.hashobject.com"} "Open Source"]]
+        [:li [:a {:href "http://labs.hashobject.com"} "Labs"]]]]])

 (defn footer []
   [:footer.row


implemented part 2

implemented part 2


type hint bk formatting

type hint bk formatting

--- src/onyx/state/bookkeeper.clj
+++ src/onyx/state/bookkeeper.clj
@@ -16,7 +16,7 @@

 (defn format-bk-server
   "Delete journal/ledger directories and removes corresponding cookie in Zookeeper"
-  [server-conf zk-conn]
+  [^ServerConfiguration server-conf zk-conn]
   (let [journal-dir (str (.getJournalDirName server-conf))
         ledger-dir (str (first (.getLedgerDirNames server-conf)))
         cookie-path (format "%s/cookies/%s"
@@ -73,12 +73,12 @@
           (throw (ex-info "The Bookie server failed to start because a cookie or
                            ledger already exists for this host. Set
                            :onyx.bookkeeper/delete-server-data? true to format
-                           the Bookie environment on startup."))
+                           the Bookie environment."))
           (throw e)))))
   (stop [{:keys [server server-conf] :as component}]
     (info "Stopping BookKeeper server:")
     (.shutdown ^BookieServer server)
-    (info "Stopped BookKeeper server with exit code:" (.getExitCode server))
+    (info "Stopped BookKeeper server with exit code:" (.getExitCode ^BookieServer server))
     (when (:onyx.bookkeeper/delete-server-data? env-config)
       (format-bk-server server-conf (:conn log)))
     (assoc component :server nil :port nil :journal-dir nil :ledger-dir nil)))


Out of order lifecycles.

Out of order lifecycles.

--- src/onyx_benchmark/submit.clj
+++ src/onyx_benchmark/submit.clj
@@ -25,11 +25,11 @@
    {:lifecycle/task :inc4
     :lifecycle/calls :onyx-benchmark.peer/throughput-calls}
    {:lifecycle/task :no-op
+    :lifecycle/calls :onyx-benchmark.peer/no-op-calls}
+   {:lifecycle/task :no-op
     :lifecycle/calls :onyx.plugin.core-async/writer-calls}
    {:lifecycle/task :no-op
-    :lifecycle/calls :onyx-benchmark.peer/throughput-calls}
-   {:lifecycle/task :no-op
-    :lifecycle/calls :onyx-benchmark.peer/no-op-calls}])
+    :lifecycle/calls :onyx-benchmark.peer/throughput-calls}])

 (def batch-timeout 100)


Finish renaming lifecycle key

Finish renaming lifecycle key

--- src/org/timmc/heim_logger.clj
+++ src/org/timmc/heim_logger.clj
@@ -54,12 +54,12 @@

 (defn react-to
   [{:as session :keys [wc state sender dispatch]}]
-  (while true ;; (not= (:lifecycle @state) :end)
+  (while true ;; (not= (get-in @state [:base :lifecycle]) :end)
     (let [msg (json/parse-string @(s/take! wc) true)]
       (auto-respond session msg dispatch))))

 (def initial-state
-  {:lifecycle :handshake})
+  {:base {:lifecycle :handshake}})

 (defn run
   "Start a session and yield it as a map of:


Fix arg passing. Update docs. Optimize reloading when there are parts

we know we can easily skip.

--- src/prod/clj/com/potetm/tire_iron.clj
+++ src/prod/clj/com/potetm/tire_iron.clj
@@ -210,21 +210,23 @@
   (let [{:keys [::track/unload
                 ::track/load]}
         (swap! tracker remove-disabled disable-unload disable-load)]
-    (prn :rebuilding)
-    ;; build.api does some expensive input checks
-    ;; Once we're here, no checks are needed.
-    (closure/build (apply build/inputs source-dirs)
-                   repl-opts
-                   env/*compiler*)
-    (prn :requesting-reload load)
-    (-refresh refresher {:repl-env repl-env
-                         :analyzer-env analyzer-env
-                         :repl-opts repl-opts
-                         :before before
-                         :after after
-                         :state state
-                         :unload-nss unload
-                         :load-nss load}))
+    (when (seq load)
+      (prn :rebuilding)
+      ;; build.api does some expensive input checks
+      ;; Once we're here, no checks are needed.
+      (closure/build (apply build/inputs source-dirs)
+                     repl-opts
+                     env/*compiler*))
+    (when (or (seq unload) (seq load))
+      (prn :requesting-reload load)
+      (-refresh refresher {:repl-env repl-env
+                           :analyzer-env analyzer-env
+                           :repl-opts repl-opts
+                           :before before
+                           :after after
+                           :state state
+                           :unload-nss unload
+                           :load-nss load})))
   (swap! tracker assoc ::track/load nil ::track/unload nil)
   (println :ok))

@@ -260,7 +262,11 @@
      :after - A symbol corresponding to a zero-arg client-side function that will be called after refreshing
      :state - A symbol corresponding to a client-side var that holds any state you would like to persisent between refreshes

-   All of these values can be overridden in the repl by supplying them to 'refresh.
+   Everything but :source-dirs can be overridden in the repl by supplying them to 'refresh.
+
+   The :state var will not be touched during unloading. However the namespace will
+   be reloaded, so put it in a `defonce`. You must put your repl connection in
+   the state var if you're using a browser repl!

    Refresh happens in the following order:
      1. :before is called
@@ -269,8 +275,13 @@

    Returns a map of the following fns for use in the cljs repl.

-   'refresh: refreshes :source-dirs. Accepts the same args as `special-fns`.
-             Any passed args will override the values passed to `special-fns`."
+   'init    - Must be called prior to refresh.
+   'refresh - refreshes :source-dirs.
+              Any passed args will override the values passed to `special-fns`.
+   'clear   - Clear the tracker state.
+   'disable-unload! - Add a namespace to the disabled unload list.
+   'disable-reload! - Add a namespace to the disabled reload list.
+   'print-disabled  - See the disabled lists."
   [& {:keys [source-dirs
              before
              after
@@ -288,17 +299,19 @@
         disable-load (atom (into #{'cljs.core
                                    'clojure.browser.repl
                                    'clojure.browser.net}
-                                 disable-load))]
+                                 disable-load))
+        closed-settings (select-keys closed-settings
+                                     [:before
+                                      :after
+                                      :state
+                                      :add-all?])]
     {'refresh
      (wrap (fn [repl-env analyzer-env [_ & opts] repl-opts]
-             (let [{:keys [source-dirs
-                           before
-                           after
-                           state
-                           add-all?] :as passed-settings} (apply hash-map opts)]
+             (let [passed-settings (apply hash-map opts)]
                (if-let [r @refresher]
                  (refresh* (merge {:refresher r
                                    :tracker tracker
+                                   :source-dirs source-dirs
                                    :disable-unload @disable-unload
                                    :disable-load @disable-load
                                    :repl-env repl-env


Add transformation core/derive spec [skip ci]

--- backend/specs/akvo/lumen/specs/transformation.clj
+++ backend/specs/akvo/lumen/specs/transformation.clj
@@ -147,6 +147,29 @@
 	    ::transformation.engine/onError
             ::transformation.engine/op]))

+
+(create-ns  'akvo.lumen.specs.transformation.derive)
+(alias 'transformation.derive 'akvo.lumen.specs.transformation.derive)
+
+(s/def ::transformation.derive/newColumnTitle string?) ;; reuse s/def also used in combine
+
+(s/def ::transformation.derive/code string?) ;; improve js validation
+
+(s/def ::transformation.derive/newColumnType #{"number" "text" "date"})
+
+
+(s/def ::transformation.derive/args
+  (s/keys :req-un [::transformation.derive/newColumnTitle
+                   ::transformation.derive/code
+                   ::transformation.derive/newColumnType]))
+
+(defmethod op-spec :core/derive  [_]
+  (s/keys
+   :req-un [::transformation.derive/args
+	    ::transformation.engine/onError
+            ::transformation.engine/op]))
+
+
 (lumen.s/sample ::transformation.engine/op-spec 10)

 (create-ns  'akvo.lumen.specs.dataset-version.transformation)


PCP-24 avoid race condition in on-connect sending

In some configurations we see a race condition between the on-connect
handler firing and calling (send! client associaton-message) and
the future that returns the connection completing and updating the
client's :websocket-connection future atom.

Here we bypass this race by using the session passed to the on-connect
handler to directly send the association message to the remote end
of the websocket session.

--- src/puppetlabs/pcp/client.clj
+++ src/puppetlabs/pcp/client.clj
@@ -95,9 +95,11 @@

 (s/defn ^:always-validate ^:private session-association-message :- Message
   [client :- Client]
-  (-> (message/make-message :message_type "http://puppetlabs.com/associate_request"
-                            :targets ["pcp:///server"])
-      (message/set-expiry 3 :seconds)))
+  (let [{:keys [identity]} client]
+    (-> (message/make-message :message_type "http://puppetlabs.com/associate_request"
+                              :sender identity
+                              :targets ["pcp:///server"])
+        (message/set-expiry 3 :seconds))))

 (defn fallback-handler
   "The handler to use when no handler matches"
@@ -163,7 +165,9 @@
                         :on-connect (fn [session]
                                       (log/debug "WebSocket connected")
                                       (reset! state :open)
-                                      (send! client (session-association-message client))
+                                      (let [message (session-association-message client)
+                                            buffer  (ByteBuffer/wrap (message/encode message))]
+                                        (.. session (getRemote) (sendBytes buffer)))
                                       (log/debug "sent associate session request"))
                         :on-error (fn [error]
                                     (log/error error "WebSocket error"))


comment out unused imports

comment out unused imports

--- channel-monitor/src/cljs/systems/casemgr/utils/channel_monitor/channel_monitor.cljs
+++ channel-monitor/src/cljs/systems/casemgr/utils/channel_monitor/channel_monitor.cljs
@@ -4,7 +4,7 @@
             [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]
             [clojure.string :as str]
-            [bootstrap-cljs.core :as bs :include-macros true]
+            ;[bootstrap-cljs.core :as bs :include-macros true]
             )
   )


minor refactor of test case for clarity

minor refactor of test case for clarity

--- test/puppetlabs/master/certificate_authority_test.clj
+++ test/puppetlabs/master/certificate_authority_test.clj
@@ -38,37 +38,40 @@
     (is (nil? (get-certificate-request "not-there" csrdir)))))

 (deftest autosign-certificate-request!-test
-  (testing "requests are autosigned and saved to disk"
-    (let [subject            "test-agent"
-          request-stream     (-> csrdir
-                                 (path-to-cert-request subject)
-                                 io/input-stream)
-          expected-cert-path (path-to-cert certdir subject)
-          now                (DateTime/now)
-          ttl                (-> 6
-                                 Period/days
-                                 .toStandardSeconds
-                                 .getSeconds)]
-      (try
-        (let [expiration (autosign-certificate-request! subject
-                                                        request-stream
-                                                        {:ca-name "test ca"
-                                                         :cakey cakey
-                                                         :certdir certdir
-                                                         :ca-ttl ttl})]
+  (let [subject            "test-agent"
+        request-stream     (-> csrdir
+                               (path-to-cert-request subject)
+                               io/input-stream)
+        expected-cert-path (path-to-cert certdir subject)
+        now                (DateTime/now)
+        ttl                (-> 6
+                               Period/days
+                               .toStandardSeconds
+                               .getSeconds)
+        ca-settings        {:ca-name "test ca"
+                            :cakey cakey
+                            :certdir certdir
+                            :ca-ttl ttl}]
+    (try
+      (let [expiration (autosign-certificate-request!
+                         subject request-stream ca-settings)]
+
+        (testing "requests are autosigned and saved to disk"
+          (is (fs/exists? expected-cert-path))
+          (let [signed-cert (-> expected-cert-path
+                                utils/pem->certs
+                                first)
+                expected-subject "CN=test-agent"
+                expected-issuer "CN=test ca"]
+            (is (= expected-subject (-> signed-cert .getSubjectX500Principal .getName)))
+            (is (= expected-issuer (-> signed-cert .getIssuerX500Principal .getName)))))
+
+        (testing "cert expiration is correct based on Puppet's ca_ttl setting"
           (let [duration (Period. now expiration)]
-            (is (= 6 (.getDays duration))
-                "Cert expiration was incorrect")))
-        (is (fs/exists? expected-cert-path))
-        (let [signed-cert      (-> expected-cert-path
-                                   utils/pem->certs
-                                   first)
-              expected-subject "CN=test-agent"
-              expected-issuer  "CN=test ca"]
-          (is (= expected-subject (-> signed-cert .getSubjectX500Principal .getName)))
-          (is (= expected-issuer (-> signed-cert .getIssuerX500Principal .getName))))
-        (finally
-          (fs/delete expected-cert-path))))))
+            (is (= 6 (.getDays duration))))))
+
+      (finally
+        (fs/delete expected-cert-path)))))

 (deftest get-certificate-revocation-list-test
   (testing "`get-certificate-revocation-list` returns a path to valid CRL file."


fix indentation in some tests

fix indentation in some tests

--- src/test/compassus/tests.cljc
+++ src/test/compassus/tests.cljc
@@ -308,7 +308,7 @@
     (is (= (-> (p {:state (-> r :config :state)} (om/get-query (c/root-class app)))
                (get ::c/route-data))
            {:id 0
-           :name "some item"})))
+            :name "some item"})))
   (let [app-parser (om/parser {:read ident-parser-read})
         app (c/application
               {:routes {:index Home
@@ -388,12 +388,12 @@
                   '[(other/stuff!)] [:remote])))))

 (defmethod app-mutate 'some/action!
-   [{:keys [state]} _ _]
-   {:value {:some-value 42}
-    :action #(swap! state update-in [:some/action]  (fnil inc 0))})
+  [{:keys [state]} _ _]
+  {:value {:some-value 42}
+   :action #(swap! state update-in [:some/action]  (fnil inc 0))})

 (defmethod app-mutate 'some/error!
-   [{:keys [state]} _ _]
+  [{:keys [state]} _ _]
   {:action #(throw #?(:clj  (Exception. "'some/action error")
                       :cljs (js.Error. "'some/action error")))})


comment out "'s" for now

comment out "'s" for now

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1405,10 +1405,11 @@
           :synsem {:cat :verb
                    :sem {:pred :run}}}

-   "s" {:synsem {:cat :det
-                 :def :genitive
-                 :subcat {:1 {:cat :noun
-                              :subcat '()}}}}
+;   "s" {:synsem {:cat :det
+;                 :def :genitive
+;                 :subcat {:1 {:cat :noun
+;                              :pronoun false
+;                              :subcat '()}}}}

    "say" {:english {:past "said"}
           :synsem {:cat :verb


add some beverages: espresso, water, wine

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -622,6 +622,9 @@

    "escape" {:synsem {:cat :verb
                       :sem {:pred :escape}}}
+
+   "espresso" {:synsem {:cat :noun
+                        :sem {:pred :espresso}}}

    "exist" {:synsem {:cat :verb
                      :sem {:pred :exist}
@@ -2049,7 +2052,10 @@
                 :sem {:pred :waste}}}

    "watch" {:synsem {:cat :verb
-                    :sem {:pred :watch}}}
+                     :sem {:pred :watch}}}
+
+   "water" {:synsem {:cat :noun
+                     :sem {:pred :acqua}}}
    "we"
    [{:english {:note "♀"}
      :synsem {:cat :noun
@@ -2088,6 +2094,9 @@
                     :sem {:pred :win}}
            :english {:past "won"
                      :participle "winning"}}
+
+   "wine" {:synsem {:cat :noun
+                    :sem {:pred :vino}}}

    "with" {:synsem {:cat :prep
                     :subcat {:1 {:cat :noun}}


whitespace

whitespace

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1358,7 +1358,6 @@

    "organize" {:synsem {:cat :verb
                 :sem {:pred :organize}}}
-
    "our"
    (map #(unify %
                 {:synsem {:cat :det


Add refocus to my site. *crosses fingers*

--- src/benjaminwarfield/views.clj
+++ src/benjaminwarfield/views.clj
@@ -10,7 +10,9 @@
     (include-css "/stylesheets/shCore.css")
     (include-css "/stylesheets/shThemeDefault.css")
     (include-js "/javascripts/analytics.js")
-    (include-js "/javascripts/shCore.js")])
+    (include-js "/javascripts/shCore.js")
+    (include-js "/javascripts/refocus.js")
+    (include-js "/javascripts/refocusConfig.js"])

 (defhtml page-header []
   [:div.header


implement access-denied-exception? for smb-fs

note that we also handle NT_STATUS_NO_SUCH_FILE errors like access
denied errors.

depending on the rights set on our samba server I get "no such file"
errors when the samba user does not have permissions to list a directory

--- src/brainbot/nozzle/smb_fs.clj
+++ src/brainbot/nozzle/smb_fs.clj
@@ -5,7 +5,7 @@
   (:require [brainbot.nozzle.vfs :as vfs]
             [brainbot.nozzle.inihelper :as inihelper]
             [brainbot.nozzle.misc :as misc])
-  (:import [jcifs.smb SmbFile NtlmPasswordAuthentication SID ACE]))
+  (:import [jcifs.smb SmbException SmbFile NtlmPasswordAuthentication SID ACE]))

 (def ^:private group-like-types
   #{SID/SID_TYPE_ALIAS SID/SID_TYPE_DOM_GRP SID/SID_TYPE_WKN_GRP})
@@ -37,11 +37,22 @@
       {:allow is-allow,
        :sid (convert-sid sid)})))

+; depending on the rights set on our samba server I get "no such file"
+; errors when the samba user does not have permissions to list a
+; directory
+(let [access-denied-error-codes #{SmbException/NT_STATUS_NO_SUCH_FILE
+                                  SmbException/NT_STATUS_ACCESS_DENIED}]
+  (defn access-denied-exception*?
+    [err]
+    (and (instance? SmbException err)
+         (contains? access-denied-error-codes (.getNtStatus err)))))
+
+;; (access-denied-exception*? (SmbException. SmbException/NT_STATUS_NO_SUCH_FILE false))

 (defrecord SmbFilesystem [root auth]
   vfs/Filesystem
   (access-denied-exception? [fs err]
-    false) ; XXX
+    (access-denied-exception*? err))

   (extract-content [fs entry]
     (let [smb-file (smb-file-for-entry fs entry)]


changed names for clarity

changed names for clarity

--- test/forma/classify/logistic_test.clj
+++ test/forma/classify/logistic_test.clj
@@ -88,9 +88,9 @@
   "returns a vector of coefficients that is accepted within the
   framework of cascalog."
   [tuples]
-  (let [y (vec (flatten (map first tuples)))
-        X (vec (map second tuples))]
-    [[(vec (logistic-beta-vector y X 1e-8 1e-6 250))]]))
+  (let [label-seq (vec (flatten (map first tuples)))
+        feature-mat (vec (map second tuples))]
+    [[(vec (logistic-beta-vector label-seq feature-mat 1e-8 1e-6 250))]]))

 (defn show-beta-vector
   "generate a separate coefficient vector for each ecoregion, and
@@ -106,11 +106,11 @@
   [n]
   (let [src (create-sample-tap n)
         beta-gen (<- [?eco ?beta]
-                     (src ?eco ?y ?feat-training)
-                     (logistic-beta-wrap ?y ?feat-training :> ?beta))]
+                     (src ?eco ?labels ?feat-training)
+                     (logistic-beta-wrap ?labels ?feat-training :> ?beta))]
     (?<- (stdout)
          [?eco ?prob]
-         (src ?eco ?y ?feat-update)
+         (src ?eco ?labels ?feat-update)
          (= ?eco "eco1")
          (beta-gen ?eco ?beta)
          (logistic-prob ?beta ?feat-update :> ?prob))))


Remove site list

Remove site list

--- src/clj/comic_reader/sites.clj
+++ src/clj/comic_reader/sites.clj
@@ -1,9 +1,6 @@
 (ns comic-reader.sites
   (:refer-clojure :exclude [list])
-  (:require [comic-reader.sites.manga-fox    :refer [manga-fox]]
-            [comic-reader.sites.manga-reader :refer [manga-reader]]
-            [comic-reader.sites.manga-here   :refer [manga-here]]
-            [comic-reader.util :refer [safe-read-string]]
+  (:require [comic-reader.util :refer [safe-read-string]]
             [clojure.string :as s]))

 (defn gen-link->map [process-name process-url]
@@ -170,8 +167,3 @@
 (defn image-data [site page-url]
   ((get-data-fn site :image-data)
    page-url))
-
-(def site-list
-  [{:manga-fox    manga-fox
-    :manga-reader manga-reader
-    :manga-here   manga-here}])


Fix how underscores are displayed in the directory pane

--- src/clj/nightcode/projects.clj
+++ src/clj/nightcode/projects.clj
@@ -57,6 +57,7 @@
                                               (.setPreserveRatio true)))
                                       (.setContentDisplay ContentDisplay/TOP)))
                         (Button. (.getName file)))
+                  (.setMnemonicParsing false)
                   (.setPrefWidth 150)
                   (.setPrefHeight 150)
                   (.setOnAction (reify EventHandler


start fleshing out the commodities account show

--- src/clj_money/web/accounts.clj
+++ src/clj_money/web/accounts.clj
@@ -14,6 +14,7 @@
             [clj-money.validation :as validation]
             [clj-money.models.accounts :as accounts]
             [clj-money.models.transactions :as transactions]
+            [clj-money.models.lots :as lots]
             [clj-money.web.money-shared :refer [grouped-options-for-accounts
                                                 budget-monitors]])
   (:use [clj-money.web.shared :refer :all]))
@@ -187,9 +188,21 @@
     :title "Click here to return to the list of accounts."}
    "Back"])

+(defn- commodity-row
+  [lot]
+  [:tr
+   [:td (:commodity-id lot)]])
+
 (defmethod show-account :commodities
   [account params]
-  "This is an investment account")
+  [:table.table.table-striped.table-hover
+   [:tr
+    [:th "Symbol"]
+    [:th "Shares"]
+    [:th "Price"]
+    [:th "Value"]]
+   (map commodity-row
+        (lots/search (env :db) {:account-id (:id account)}))])

 (defn show
   "Renders account details, including transactions"


Fixed link's onclick event handling for Mithril routing

--- src/cljs/modern_cljs/core.cljs
+++ src/cljs/modern_cljs/core.cljs
@@ -150,7 +150,10 @@
     (if stop
       (m "span" nil
        [(m "a"
-           {:onclick #(setpage next) :href "#"}
+           {:onclick (fn [e]
+                       (.preventDefault e)
+                       (setpage next))
+            :href ""}
            (str "Items: " pagenum "-" end))])
       nil)))


WIP: Continue implementing load-balancer

--- src/clojure/fault/patterns.clj
+++ src/clojure/fault/patterns.clj
@@ -4,17 +4,25 @@

 (set! *warn-on-reflection* true)

-(defn- next-service [last-idx current]
+(defn- next-idx [last-idx current]
   (if (<= last-idx current)
     0
     (inc current)))

+(defn- next-service-seq [next-fn current]
+  (lazy-seq
+    (cons current
+          (next-service-seq next-fn (next-fn current)))))
+
 (defn load-balancer [key->service]
-  (let [next-fn (partial next-service (dec (count key->service)))
+  (let [next-fn (partial next-idx (dec (count key->service)))
         state (atom -1)
         key-service-tuples (vec key->service)]
     (fn []
-      (nth key-service-tuples (swap! state next-fn)))))
+      (let [start-idx (swap! state next-fn)]
+        (map #(nth key-service-tuples %) (take (count key->service)
+                                               (next-service-seq next-fn
+                                                                 start-idx)))))))

 (defn submit-load-balanced-action [load-balancer key->fn timeout-millis]
   (let [[key {:keys [service]}] (load-balancer)]


Experimental mod binds state directly to DOM nodes without need for element-state-lookup and node-id.

--- src/clojure/freactive/dom.cljs
+++ src/clojure/freactive/dom.cljs
@@ -28,8 +28,10 @@

 (defn- get-element-state [x]
   ;;(get element-state-lookup x)
-  (when-let [node-id (get-node-id x)]
-    (aget element-state-lookup node-id)))
+  ;(when-let [node-id (get-node-id x)]
+  ;  (aget element-state-lookup node-id))
+  (.-freactive-state x)
+  )

 (extend-protocol IElementSpec
   boolean
@@ -88,7 +90,8 @@
     (set! auto-node-id (inc auto-node-id))
     (set-attr! dom-node "data-freactive-id" node-id)
     (init-element-meta! state element-spec tag attrs)
-    (aset element-state-lookup node-id state)
+    ;(aset element-state-lookup node-id state)
+    (set! (.-freactive-state dom-node) state)
     state))

 (defn- register-with-parent-state [parent-state child-key state]
@@ -112,7 +115,9 @@
   ([dom-node]
    ;(println "disposing" dom-node)
    (when-let [node-id (get-node-id dom-node)]
-     (when-let [state (aget element-state-lookup node-id)]
+     (when-let [state                                       ;;(aget element-state-lookup node-id)
+                (.-freactive-state dom-node)
+                ]
        (dispose-node node-id state)
        (when-let [parent-state (.-parent-state state)]
          (when-let [child-states (.-child-states parent-state)]
@@ -124,7 +129,7 @@
      (when-let [disposed-callback (.-disposed-callback state)]
        (disposed-callback))
      (when-not (identical? (aget child-key 0) "-")
-       (js-delete element-state-lookup child-key)
+       ;(js-delete element-state-lookup child-key)
        (goog.object/forEach (.-child-states state)
                             (fn [state child-key _]
                               (dispose-node child-key state)))))))


fixed bug

fixed bug

--- src/complex/turtle/render.cljc
+++ src/complex/turtle/render.cljc
@@ -2,6 +2,7 @@
   (:require
    [complex.number :as n
     :refer [mult div add sub minus recip infinity zero one i coords arg length conjugate]]
+   [complex.turtle :as turtle]
    [complex.geometry :as g]
    #?(:clj
       [clojure.core.match :refer [match]]


Applied patch from Stuart Sierra to fix session clearing

--- src/compojure/http/session.clj
+++ src/compojure/http/session.clj
@@ -201,7 +201,9 @@
                                  (assoc-session repo)
                                  (assoc-flash))
             response (handler request)
-            session  (or (:session response) (:session request))]
+            session  (if (contains? response :session)
+                       (:session response)
+                       (:session request))]
         (when response
           (save-handler-session repo request response session)
           (set-session-cookie   repo request response session))))))
@@ -215,7 +217,7 @@

 (defn clear-session
   "Set the session to nil."
-  [session]
+  []
   (set-session nil))

 (defn alter-session


Reimplement function interface of incomplete exploration

to avoid defnk

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/fca/exploration.clj
+++ src/conexp/fca/exploration.clj
@@ -146,7 +146,7 @@
     [possible-ctx certain-ctx known impl]
     (dh possible-ctx certain-ctx known impl)))

-(defnk explore-attributes-with-incomplete-counterexamples
+(defn explore-attributes-with-incomplete-counterexamples
   "EXPERIMENTAL and LARGLY UNTESTED — USE WITH CARE

   Performs attribute exploration in given contexts of possible («possible-ctx») and
@@ -183,8 +183,10 @@
   to construct a special handler using the «make-handler»
   function. See the corresponding documentation of «make-handler»."
   [possible-ctx, certain-ctx,
-   :background-knowledge #{},
-   :handler default-handler-for-incomplete-counterexamples]
+   & {:keys [background-knowledge handler]
+      :or   {:background-knowledge #{},
+             :handler default-handler-for-incomplete-counterexamples}}]
+  (println background-knowledge handler)
   (assert (set? background-knowledge))
   (assert (= (attributes certain-ctx)
              (attributes possible-ctx))
@@ -218,7 +220,7 @@
              (= counterexamples :abort)
              (recur implications nil possible-ctx certain-ctx) ; abort exploration
              ;;
-             counterexamples            ; add counterexample
+             counterexamples         ; add counterexample
              (let [new-objs (map first counterexamples)]
                ;; check that new names are not there already
                (when (exists [g new-objs] (contains? (objects possible-ctx) g))
@@ -230,9 +232,9 @@
                       (make-context (into (objects possible-ctx) new-objs)
                                     (attributes possible-ctx)
                                     (union (incidence possible-ctx)
-                                           (set-of [g m] | [g _ neg] counterexamples
-                                                           m (difference (attributes possible-ctx)
-                                                                         (set neg)))))
+                                           (set-of [g m] [[g _ neg] counterexamples,
+                                                          m (difference (attributes possible-ctx)
+                                                                        (set neg))])))
                       ;; certain incidence, i.e. the one given by the expert
                       (make-context (into (objects certain-ctx) new-objs)
                                     (attributes certain-ctx)
@@ -240,7 +242,7 @@
                                            (set-of [g m] [[g pos _] counterexamples,
                                                           m pos])))))
              ;;
-             true                       ; add implication
+             true                    ; add implication
              (let [new-implications (conj implications new-impl)]
                (recur new-implications
                       (next-closed-set (attributes possible-ctx)
@@ -249,10 +251,10 @@
                       possible-ctx
                       (make-context (objects certain-ctx)
                                     (attributes certain-ctx)
-                                    (set-of [g m] | g (objects certain-ctx)
-                                                    m (close-under-implications
-                                                       new-implications
-                                                       (oprime certain-ctx #{g})))))))))))))
+                                    (set-of [g m] [g (objects certain-ctx),
+                                                   m (close-under-implications
+                                                      new-implications
+                                                      (oprime certain-ctx #{g}))])))))))))))

 ;;;


Add fn to make ajax request and switch view

--- src/discuss/communication.cljs
+++ src/discuss/communication.cljs
@@ -30,7 +30,6 @@
 (defn ajax-get
   "Make ajax call to dialogue based argumentation system."
   ([url headers handler]
-   (debug/update-debug :last-api url)
    (lib/no-error!)
    (GET (make-url url)
         {:handler       handler
@@ -41,6 +40,12 @@
    (ajax-get url headers lib/update-all-states!))
   ([url]
    (ajax-get url {})))
+
+(defn ajax-get-and-change-view
+    "Make ajax call to jump right into the discussion and change to discussion view."
+    [url view]
+    (ajax-get url)
+    (lib/change-view! view))

 (defn success-handler
   "Generic success handler, which sets error handling and returns a cljs-compatible response."


adding the code to consume twitter streaming api. sending the websocket clients the bacon lover data

--- src/clj/baconator/server/handler.clj
+++ src/clj/baconator/server/handler.clj
@@ -1,25 +1,66 @@
 (ns baconator.server.handler
   (:use compojure.core
         ring.util.response
-        org.httpkit.server)
+        org.httpkit.server
+        twitter.callbacks
+        twitter.callbacks.handlers)
   (:require [compojure.handler :as handler]
             [compojure.route :as route]
             [ring.middleware.reload :as reload]
             [cheshire.core :refer :all]
-            [org.httpkit.client :as http]))
+            [clojure.edn :as edn]
+            [org.httpkit.client :as http]
+            [twitter.oauth :as oauth]
+            [twitter.api.streaming :as api])
+  (:import (twitter.callbacks.protocols AsyncStreamingCallback)))
+
+(declare send-checkin)
+
+;; Twitter streaming api
+
+(def twitter-config (edn/read-string (slurp "config/twitter.edn")))
+(def twitter-creds (oauth/make-oauth-creds (:consumer-key twitter-config)
+                                           (:consumer-secret twitter-config)
+                                           (:token twitter-config)
+                                           (:token-secret twitter-config)))
+
+(def ^:dynamic *callback*
+  (AsyncStreamingCallback.
+   (fn [_resp payload]
+      (let [tweet (parse-string (str payload) true)
+            lower (.toLowerCase (:text tweet))]
+        (when (:coordinates tweet)
+          (println (:text tweet))
+          (let [coordinates (:coordinates (:coordinates tweet))
+                user (:screen_name (:user tweet))]
+            (send-checkin {:user user
+                           :text (:text tweet)
+                           :lat (nth coordinates 1)
+                           :lon (nth coordinates 0)})))))
+   (fn [_resp]
+      (println "Error connecting to twitter streaming API"))
+   (fn [_resp excp]
+      (.printStackTrace excp))))
+
+(api/statuses-filter :params {:track "bacon"}
+                     :oauth-creds twitter-creds
+                     :callbacks *callback*)
+
+;; Handle the checkins websocket

 (def checkins-clients (atom {}))
+
 (defn checkins [req]
   (with-channel req con
     (swap! checkins-clients assoc con true)
     (on-close con (fn [status]
                      (swap! checkins-clients dissoc con)))))

-(future (loop []
-          (doseq [client @checkins-clients]
-            (send! (key client) (pr-str {:lat (rand 40) :lon (rand 5)}) false))
-          (Thread/sleep 2000)
-          (recur)))
+(defn send-checkin [msg]
+  (doseq [client @checkins-clients]
+    (send! (key client) (pr-str msg) false)))
+
+;; Basic ring/compojure code

 (defroutes app-routes
   (GET "/checkins" [] checkins)


cleaned up postprocess.output namespace, removing unused functions

--- src/clj/forma/postprocess/output.clj
+++ src/clj/forma/postprocess/output.clj
@@ -6,86 +6,43 @@
         [forma.utils :only (moving-average average)]
         [clojure.math.numeric-tower :only (round)]))

-(defn get-val
-  [out-m & k]
-  (map out-m k))
-
-(defn get-series
-  [out-m]
-  ((comp vector :series :prob-series) out-m))
-
-(defn convert-to-latlon
-  [out-m]
-  (vec (apply modis->latlon
-              (get-val out-m :sres :modh :modv :sample :line))))
-
-(defn csv-ify
-  [& args]
-  (apply str (interpose "," (apply flatten [args]))))
-
-(defn float->str-10
-  [val]
-  (format "%011.10f" val))
-
-(defn not-nil?
-  [val]
-  (not (nil? val)))
-
-(defn vec-ify
-  [series]
-  (vector (vec series)))
-
 (defn backward-looking-mavg
   "Moving average calculated up to a given element (i.e. looking backwards),
-   rather than starting with a given element. Ensures that only information up
-   to and including given element is incorporated in the moving average.
+  rather than starting with a given element. Ensures that only
+  information up to and including given element is incorporated in the
+  moving average.

-   Expanded timeseries includes pre-pended nils. So moving average is actually
-   forward looking, but starting with non-existing (and filtered out) 'prior'
-   nil values.
+  Expanded timeseries includes pre-pended nils. So moving average is
+  actually forward looking, but starting with non-existing (and
+  filtered out) 'prior' nil values.

-   Ex. (backward-looking-mavg 3 [1 2 3 4]) expands to [nil nil 1 2 3 4]. Nils are
-   filtered out, so the output is effectively:
-    [(average [1]) (average [1 2]) (average [1 2 3]) (average 2 3 4)]"
+  For example,
+
+    (backward-looking-mavg 3 [1 2 3 4])
+
+  expands to
+
+    [nil nil 1 2 3 4]
+
+  where the nils are filtered out, so the output is effectively:
+
+    [(average [1]) (average [1 2]) (average [1 2 3]) (average 2 3 4)]
+
+  Example usage:
+    (backward-looking-mavg 3 [1 2 3 4]) => '(1.0 1.5 2.0 3.0)"
   [window series]
   (let [expanded-ts (concat (repeat (dec window) nil) (flatten series))]
     (map (comp float average (partial filter not-nil?))
                   (partition window 1 expanded-ts))))

-(defn mono-inc
-  "Make a series of numbers monotonically increasing. Useful for retaining the maximum probability for a pixel over time.
-
-(mono-inc [3 4 34 34 23 1 34 13 35 35 ])
-==> (3 4 34 34 34 34 34 34 35 35)"
-  [series]
-  (cons (first series) (rest (reductions max series))))
-
 (defn clean-probs
-  "Smooth the probabilities with a backward-looking moving average, make the
-  series monotonically increasing, and finally make each probability 0->1 an
-  integer 0->100"
-  [coll]
+  "Accepts a timeseries of probabilities, and returns a 'cleaned' time
+  series.  Specifically, the cleaned timeseries Smooth the
+  probabilities with a backward-looking moving average, make the
+  series monotonically increasing, and finally make each probability
+  0->1 an integer 0->100"
+  [ts]
   (let [window 3]
-    [(vec (->> (backward-looking-mavg window coll)
-               (mono-inc)
+    [(vec (->> (backward-looking-mavg window ts)
+               (reductions max)
                (map #(round (* % 100)))))]))
-
-(defn date-no-sep
-  [date-str]
-  (reduce str (split date-str #"-")))
-
-(defn mk-date-header
-  "(mk-date-header \"16\" \"p\" (s/timeseries-value 827 (range 141)))
-    63
-   => (\"p20051219\" \"p20060101\" \"p20060117\" ... \"p20120117\")"
-  [tres prefix ts]
-  (map (comp (partial str prefix)
-             date-no-sep
-             (partial period->datetime tres))
-       (range (:start-idx ts) (inc (:end-idx ts)))))
-
-(defn mk-header
-  [tres date-prefix ts & args]
-  (let [dates (mk-date-header tres date-prefix ts)
-        header (csv-ify args)]
-    (csv-ify header dates)))


Use destructuring to simplify some code

Use destructuring to simplify some code

Knowledge picked up while working on this project =)

Signed-off-by: Pang Yan Han <22594c345857f664c61cd411f607c4d40a9d4af9@gmail.com>

--- src/cljs/cljs_nusmods/timetable.cljs
+++ src/cljs/cljs_nusmods/timetable.cljs
@@ -916,30 +916,25 @@

         ; similar to `moduleLessonGroupsMap`, but includes missing lesson types
         moduleLessonGroupsMapFinal
-        (reduce (fn [lgMapFinal moduleCode]
-                  (let [missingLessonTypes
-                        (get missingModuleLessonTypes moduleCode)]
-                    (reduce
-                      (fn [lgMap lessonType]
-                        (assoc-in lgMap [moduleCode lessonType]
-                                  (get-first-lesson-group-for-module-lesson-type
-                                    moduleCode lessonType)))
-                      lgMapFinal
-                      missingLessonTypes)))
+        (reduce (fn [lgMapFinal [moduleCode missingLessonTypes]]
+                  (reduce
+                    (fn [lgMap lessonType]
+                      (assoc-in lgMap [moduleCode lessonType]
+                                (get-first-lesson-group-for-module-lesson-type
+                                  moduleCode lessonType)))
+                    lgMapFinal
+                    missingLessonTypes))
                 moduleLessonGroupsMap
-                (keys missingModuleLessonTypes))]
+                missingModuleLessonTypes)]

     ; Produce the final module info sequence
     (flatten
       (map (fn [moduleCode]
-             (let [lessonTypesMap
-                   (get moduleLessonGroupsMapFinal moduleCode)]
-               (map (fn [lessonType]
-                      (let [lessonGroup (get lessonTypesMap lessonType)]
-                        {:moduleCode  moduleCode
-                         :lessonType  lessonType
-                         :lessonGroup lessonGroup}))
-                    (keys lessonTypesMap))))
+             (map (fn [[lessonType lessonGroup]]
+                    {:moduleCode  moduleCode
+                     :lessonType  lessonType
+                     :lessonGroup lessonGroup})
+                  (get moduleLessonGroupsMapFinal moduleCode)))
            moduleCodesSeq))))

 (defn add-module-lesson-groups-from-url-hash!


CMR-663: Refactored in response to pull request comments.

--- src/cmr/common/services/messages.clj
+++ src/cmr/common/services/messages.clj
@@ -2,8 +2,7 @@
   "This namespace provides functions to generate messages used for error reporting, logging, etc.
   Messages used in more than one project should be placed here."
   (:require [clojure.string :as str]
-            [cmr.common.services.errors :as errors]
-            [camel-snake-kebab :as csk]))
+            [cmr.common.services.errors :as errors]))

 (defn data-error [error-type msg-fn & args]
   "Utility method that uses throw-service-error to generate a response with a specific status code
@@ -35,40 +34,4 @@
   [input-str]
   (format (str "[%s] is not of the form 'value', 'min-value,max-value', 'min-value,', or ',max-value'"
                " where value, min-value, and max-value are optional date-time values.")
-          input-str))
-
-(defn invalid-ignore-case-opt-setting-msg
-  "Creates a message saying which parameters would not allow ignore case option setting."
-  [params-set]
-  (let [params (reduce (fn [params param] (conj params param)) '() (seq params-set))]
-    (format "Ignore case option setting disallowed on these parameters: %s" params)))
-
-(defn invalid-pattern-opt-setting-msg
-  "Creates a message saying which parameters would not allow pattern option setting."
-  [params-set]
-  (let [params (reduce (fn [params param] (conj params param)) '() (seq params-set))]
-    (format "Pattern option setting disallowed on these parameters: %s" params)))
-
-(defn invalid-exclude-param-msg
-  "Creates a message saying supplied parameter(s) are not in exclude params set."
-  [params-set]
-  (format "Parameter(s) [%s] can not be used with exclude." (str/join ", " (map name params-set))))
-
-(defn invalid-or-opt-setting-msg
-  "Creates a message saying which parameter is not allowed to use the 'or' option."
-  [param]
-  (format "'or' option is not valid for parameter [%s]" param))
-
-(defn invalid-opt-for-param
-  "Creates a message saying supplied option is not allowed for parameter."
-  [param option]
-  (str "Option [" (csk/->snake_case_string option)
-       "] is not supported for param [" (csk/->snake_case_string param) "]"))
-
-(defn mixed-arity-parameter-msg
-  "Creates a message saying the given parameter should not appear as both a single value and
-  a multivalue."
-  [param]
-  (str "Parameter ["
-       (csk/->snake_case_string param)
-       "] may be either single valued or multivalued, but not both."))+          input-str))


minors

minors

--- src/hashobject/views/index.clj
+++ src/hashobject/views/index.clj
@@ -28,22 +28,22 @@
        [:div {:class "details"}
         [:strong {:class "uppercase"}
          [:a {:href "https://twitter.com/podviaznikov"} "Anton Podviaznikov"] ]
-        [:br] "\n            Full-stack developer\n          "] ]
+        [:br] "Full-stack developer"] ]
       [:div {:id "maryna"}
        [:img {:src "/images/maryna.png"}]
        [:div {:class "details"}
         [:strong {:class "uppercase"}
          [:a {:href "https://twitter.com/m_aleksandrova"} "Maryna Aleksandrova"] ]
-        [:br] ] ] ]
+        [:br] "Designer"] ] ]
      [:p "We are still trying to figure out what to put on our website,"
-      [:br] "\n      so ... better check out our blog at "
+      [:br] "so ... better check out our blog at "
       [:a {:href "http://blog.hashobject.com/"} "blog.hashobject.com"]
-      [:br] "\n        or "
+      [:br] "or "
       [:a {:href "http://code.hashobject.com/"} "open source corner"] " with Clojure libraries."
-      [:br] "\n      or start following us on "
+      [:br] "or start following us on "
       [:span {:class "uppercase"} "Twitter"] " or "
       [:span {:class "uppercase"} "GitHub"] "."
-      [:br] "\n      If you need help with design or development send us and "
+      [:br] "If you need help with design or development send us and "
       [:a {:href "mailto:team@hashobject.com"} "email"]]
      [:div {:class "button-group"}
       [:a {:class "twitter big button", :href "https://twitter.com/hashobject"}]


(maint) Shorten test line by using re-pattern

--- test/puppetlabs/trapperkeeper/authorization/rules_test.clj
+++ test/puppetlabs/trapperkeeper/authorization/rules_test.clj
@@ -148,11 +148,11 @@
           (is (= (:message rules-allowed)
                  (str "Forbidden request: /stairway/to/heaven (method :get)."
                       " Please see the server logs for details.")))
-          ;; TODO: this and the test below are ridiculously long.
-          ;; Unfortunately, there does not seem to be a good way to improve
-          ;; these until we can upgrade TK versions and use a newer version of
-          ;; the logging testutils.
-          (is (logged? #"Forbidden request: www.test.org\(192.168.1.23\) access to /stairway/to/heaven \(method :get\) \(authenticated: true\) denied by rule 'test rule'." :error))))
+          (is (logged?
+               (re-pattern (str "Forbidden request: www.test.org\\(192.168.1.23\\)"
+                                " access to /stairway/to/heaven \\(method :get\\)"
+                                " \\(authenticated: true\\) denied by rule 'test rule'."))
+               :error))))
       (testing "tagged rule not allowing "
         (let [rules (map #(rules/tag-rule %1 "file.txt" 23)
                          (build-rules ["/path/to/resource" "*.domain.org"]
@@ -163,7 +163,11 @@
           (is (= (:message rules-allowed)
                  (str "Forbidden request: /stairway/to/heaven (method :get)."
                       " Please see the server logs for details.")))
-          (is (logged? #"Forbidden request: www.test.org\(192.168.1.23\) access to /stairway/to/heaven \(method :get\) at file.txt:23 \(authenticated: true\) denied by rule 'test rule'.")))))))
+          (is (logged?
+               (re-pattern (str "Forbidden request: www.test.org\\(192.168.1.23\\)"
+                                " access to /stairway/to/heaven \\(method :get\\)"
+                                " at file.txt:23 \\(authenticated: true\\)"
+                                " denied by rule 'test rule'.")))))))))

 (deftest test-rule-sorting
   (testing "rules checked in order of sort-order not order of appearance"


Updated table component to have a toggle modifier

--- src/css-guide/styles/components.cljs
+++ src/css-guide/styles/components.cljs
@@ -912,7 +912,7 @@
                          :className  (str "c-button c-button--small " (when (= kind "stacked") "is-active"))}
           (dom/svg #js {:xmlns "http://www.w3.org/2000/svg" :width "24" :height "24" :className "c-icon" :viewBox "0 0 24 24"}
             (dom/path #js {:d "M4 18h17v-6H4v6zM4 5v6h17V5H4z"}))))
-      (dom/table #js {:className (str "c-table c-table--" kind)}
+      (dom/table #js {:className (str "c-table c-table--toggle c-table--" kind)}
                  (dom/thead #js {}
                             (dom/tr #js {}
                                     (dom/th #js {:scope "col"})


Add pull request message validation.

Add pull request message validation.

--- src/cljs/hatnik/web/client/form/github_pull_request.cljs
+++ src/cljs/hatnik/web/client/form/github_pull_request.cljs
@@ -116,7 +116,13 @@
   (reify
     om/IInitState
     (init-state [this]
-      {:form-status "has-success"})
+      {:form-status "has-success"
+       :body-status (if (s/check schm/TemplateBody (:value (:pull-body data)))
+                      "has-error"
+                      "has-success")
+       :title-status (if (s/check schm/TemplateTitle (:value (:pull-title data)))
+                       "has-error"
+                       "has-success")})

     om/IRenderState
     (render-state [this state]
@@ -149,22 +155,30 @@
                          (dom/div #js {:className "panel-collapse collapse"
                                        :id "github-pull-req-text-body"}
                                   (dom/div #js {:className "panel-body"}
-                                           (dom/div #js {:className "form-group"}
+                                           (dom/div #js {:className (str "form-group " (:title-status state))}
                                                     (dom/label nil "Title")
                                                     (dom/input #js {:type "text"
                                                                     :value (:value (:pull-title data))
                                                                     :onChange
-                                                                    #((:handler (:pull-title data))
-                                                                      (.. % -target -value))
+                                                                    #(do
+                                                                       ((:handler (:pull-title data))
+                                                                        (.. % -target -value))
+                                                                       (if (s/check schm/TemplateTitle (.. % -target -value))
+                                                                         (om/set-state! owner :title-status "has-error")
+                                                                         (om/set-state! owner :title-status "has-success")))
                                                                     :className "form-control"}))

-                                           (dom/div #js {:className "form-group"}
+                                           (dom/div #js {:className (str "form-group " (:body-status state))}
                                                     (dom/label nil "Body")
                                                     (dom/textarea #js {:cols "40"
                                                                        :value (:value (:pull-body data))
                                                                        :onChange
-                                                                       #((:handler (:pull-body data))
-                                                                         (.. % -target -value))
+                                                                       #(do
+                                                                          ((:handler (:pull-body data))
+                                                                           (.. % -target -value))
+                                                                          (if (s/check schm/TemplateBody (.. % -target -value))
+                                                                            (om/set-state! owner :body-status "has-error")
+                                                                            (om/set-state! owner :body-status "has-success")))
                                                                        :className "form-control"}))))))

                (dom/div #js {:className "form-group"}


Function insert-test-waive

Function insert-test-waive

--- src/emender_jenkins/db_interface.clj
+++ src/emender_jenkins/db_interface.clj
@@ -109,9 +109,50 @@
             (do (insert-test-name test-suite-id test-name)
                 (select-test-id test-suite-id test-name))))

+(defn select-guide-id
+    [version-id guide-name]
+    (log/info "select-guide-id" version-id guide-name)
+    (->
+        (jdbc/query db-spec/emender-jenkins-db
+           ["select id from guides where prod_ver_id=? and name=?" version-id guide-name])
+           first
+           :id))
+
+(defn insert-guide-name
+    [version-id guide-name]
+    (log/info "insert-guide-name" version-id guide-name)
+    (jdbc/insert! db-spec/emender-jenkins-db
+        :guides {:prod_ver_id version-id
+                 :name   guide-name}))
+
+(defn select-guide-id-or-insert
+    [version-id guide-name]
+    (if-let [guide-id (select-guide-id version-id guide-name)]
+            guide-id
+            (do (insert-guide-name version-id guide-name)
+                (select-guide-id version-id guide-name))))
+
 (defn insert-test-waive
     [waive-data]
-    (println waive-data)
+    (let [product-id    (select-product-id-or-insert                 (:product    waive-data))
+          version-id    (select-product-version-or-insert product-id (:version    waive-data))
+          guide-id      (select-guide-id-or-insert        version-id (:guide      waive-data))
+          test-suite-id (select-test-suite-id-or-insert              (:test_suite waive-data))
+          test-id       (select-test-id-or-insert  test-suite-id     (:test_name  waive-data))]
+         (jdbc/insert! db-spec/emender-jenkins-db
+             :waives {:guide_id guide-id
+                      :test_id  test-id
+                      :cause    (:cause waive-data)
+                      }
+         ))
 )

+;(insert-test-waive {
+;    :product    "Product name"
+;    :version    "Version number"
+;    :guide      "Guide name"
+;    :test_suite "Test suite name"
+;    :test_name  "Test name"
+;    :cause      "Cause"
+;})


make output value class and model optional parameters

--- src/main/java/org/dada/demo/core.clj
+++ src/main/java/org/dada/demo/core.clj
@@ -71,9 +71,6 @@
 			       array))
 			 properties))))))

-;; select t0.f0
-
-;;
 ;; fields => [model field]

 (import org.dada.core.Getter)
@@ -191,8 +188,11 @@
 	     (apply expand-property src-class src-type prop)))
        props))

-(defn select [src-model tgt-class-name tgt-model-name key-name version-name props]
-  (let [src-metadata (. src-model getMetadata)
+(defn select [src-model key-name version-name props & pvec]
+  (let [pmap (apply array-map pvec)
+	tgt-class-name (or (pmap :class) (.toString (gensym "org.dada.tmp.OutputValue")))
+	tgt-model-name (or (pmap :model) (.toString (gensym "OutputModel")))
+	src-metadata (. src-model getMetadata)
 	src-class (. src-metadata getValueClass)
 	src-types (. src-metadata getAttributeTypes)
 	src-names (. src-metadata getAttributeNames)
@@ -250,26 +250,15 @@
   (def view
        (select
 	input-model
-	"org.dada.core.tmp.OutputItem"
-	"OutputModel"
 	"key"
 	"version"
-	(list ["id" :name "key"] ["version"] ["amount" :name "money"])
-	))
+	(list ["id" :name "key"] ["version"] ["amount" :name "money"])))
   (insert metamodel view)

   (def item5 (make-instance input-class 3 2 2 6.0))
   (insert input-model item5)

-  (def view2
-       (select
-	view
-	"org.dada.core.tmp.OutputItem2"
-	"OutputModel2"
-	"key"
-	"version"
-	(list ["key"] ["version"] ["money" :name "amount"])
-	))
+  (def view2 (select view "key" "version" (list ["key"] ["version"] ["money" :name "amount"])))

   )


[#10784] Fix kk multiacc creation after closing app

--- src/status_im/hardwallet/common.cljs
+++ src/status_im/hardwallet/common.cljs
@@ -373,9 +373,11 @@
 (fx/defn get-application-info
   {:events [:hardwallet/get-application-info]}
   [{:keys [db]} pairing on-card-read]
-  (let [key-uid  (get-in
-                  db [:hardwallet :application-info :key-uid]
-                  (get-in db [:multiaccounts/login :key-uid]))
+  (let [key-uid
+        (when-not (:intro-wizard db)
+          (get-in
+           db [:hardwallet :application-info :key-uid]
+           (get-in db [:multiaccounts/login :key-uid])))
         pairing' (or pairing (some->> key-uid (get-pairing db)))]
     (log/debug "[hardwallet] get-application-info"
                "pairing" pairing')


fix /integration/random broken due to processing nil q

--- src/wb_es/web/integration.clj
+++ src/wb_es/web/integration.clj
@@ -46,8 +46,9 @@
                                        (Integer.)
                                        (dec)
                                        (* page-size))
-                            :q (clojure.string/replace raw_q #"\*" "")
-                            :autocomplete (if (re-matches #".+\*" raw_q)
+                            :q (if raw_q (clojure.string/replace raw_q #"\*" ""))
+                            :autocomplete (if (and raw_q
+                                                   (re-matches #".+\*" raw_q))
                                             true)
                             :type (get params :type (:class params))
                             :species (:species params)


Add debug logging for OAuth2 response

Add debug logging for OAuth2 response

--- src/wombats/handlers/auth.clj
+++ src/wombats/handlers/auth.clj
@@ -119,21 +119,15 @@
      (let [{:keys [client-id
                    client-secret
                    signing-secret]} (get-github-settings context)
-           {:keys [code referer state]} (:query-params request)
+           {:keys [code referer state error_description]} (:query-params request)
            create-or-update-user (dao/get-fn :create-or-update-user context)
            get-user-by-github-id (dao/get-fn :get-user-by-github-id context)
            failed-redirect #(redirect-home context (str referer "?login-error=" (url-encode %)))
            {signing-secret-check :signing-secret
             access-key-key :access-key} (read-string (url-decode state))]

-       (log/error (str "github-settings: "
-                       (get-github-settings context)))
-
-       (log/error (str "request-params: "
-                       (:query-params request)))
-
-       (log/error (str "state-decode: "
-                       (read-string (url-decode state))))
+       (when error_description
+         (log/error "GitHub Callback Error: " error_description))

        ;; Check to see if the request is originating from the correct user
        (if (= signing-secret-check signing-secret)


Add :environment to client docstring

Add :environment to client docstring

Slightly reformat docstring.

--- src/yeller/clojure/client.clj
+++ src/yeller/clojure/client.clj
@@ -91,24 +91,26 @@
     (.setApplicationPackages client (make-app-package-array (default-application-packages)))))

 (defn ^YellerClient client
-  "creates a new client from a map of configuration settings Required settings:
+  "Creates a new client from a map of configuration settings. Required settings:
   {:token \"YOUR API KEY HERE\"}

   other settings:
-  :application-packages [\"myapp\"] (optional)
-  A seq of strings of package names. Used to mark stacktrace frames as coming from the application or not. Defaults to a name read from the application's project.clj
-  :auth-error-handler (fn [backend error] (println \"Yeller: an authentication error occurred whilst talking to yeller:\" backend error))
-  a function for reporting authentication errors when communicating with
-  yeller's servers. You might want this to print out to a log file (by default
-  it prints to stderr). Takes a String for the hostname of the api server it
-  was talking to during the error, and a Throwable for whatever exception
-  ocurred.
-  :io-error-handler (fn [backend error] (println \"Yeller: an io error occurred whilst talking to yeller:\" backend error))
-  a function for reporting io errors when communicating with
-  yeller's servers. You might want this to print out to a log file (by default
-  it prints to stderr). Takes a String for the hostname of the api server it
-  was talking to during the error, and a Throwable for whatever exception
-  ocurred."
+  * :environment \"production\" The environment the application is deployed into.
+  * :application-packages [\"myapp\"] (optional)
+    A seq of strings of package names. Used to mark stacktrace frames as coming from the application or not.
+    Defaults to a name read from the application's project.clj
+  * :auth-error-handler (fn [backend error] (println \"Yeller: an authentication error occurred whilst talking to yeller:\" backend error))
+    A function for reporting authentication errors when communicating with
+    yeller's servers. You might want this to print out to a log file (by default
+    it prints to stderr). Takes a String for the hostname of the api server it
+    was talking to during the error, and a Throwable for whatever exception
+    ocurred.
+  * :io-error-handler (fn [backend error] (println \"Yeller: an io error occurred whilst talking to yeller:\" backend error))
+    A function for reporting io errors when communicating with
+    yeller's servers. You might want this to print out to a log file (by default
+    it prints to stderr). Takes a String for the hostname of the api server it
+    was talking to during the error, and a Throwable for whatever exception
+    ocurred."
   [options]
   (assert (string? (:token options)) (str "Yeller client must be passed your api key as a string under :token, but got " (pr-str (:token options)) " from (:token options)"))
   (assert (and (sequential? (:application-packages options []))


get states from dfa

get states from dfa

--- stuf/src/sandbox/4clojure.clj
+++ stuf/src/sandbox/4clojure.clj
@@ -1444,3 +1444,10 @@

 (defn accepted? [symb dfa]
   (symb (:accepts dfa)))
+
+(defn states [current-state dfa]
+  (let [next-states (map second (get-next current-state dfa))]
+    (if (empty? next-states)
+      (vector current-state)
+      (mapcat #(cons current-state (states % dfa)) next-states))))
+


proper stereo checkbox value checking

proper stereo checkbox value checking

--- src/mars_ogler/views/index.clj
+++ src/mars_ogler/views/index.clj
@@ -18,9 +18,9 @@
 (defn filter-pics
   [{:keys [cams min-size sorting stereo thumbs]}]
   (let [cam-pred (fn [img] (-> img :cam cams))
-        stereo-pred (case stereo
-                      :yes (constantly true)
-                      :only :stereo?)]
+        stereo-pred (if (= stereo :on)
+                      :stereo?
+                      (constantly true))]
     (filter (every-pred cam-pred stereo-pred (min-size->pred min-size))
             (get @images/sorted-images sorting ()))))


Forward port ZK fix.

Forward port ZK fix.

--- src/onyx/peer/virtual_peer.clj
+++ src/onyx/peer/virtual_peer.clj
@@ -54,6 +54,9 @@
               (recur (send-to-outbox new-state reactions)))
             (when (:lifecycle state)
               (component/stop @(:lifecycle state)))))))
+    (catch org.apache.zookeeper.KeeperException$ConnectionLossException e
+        ;; ZooKeeper connection dropped, close out cleanly.
+        )
     (catch Exception e
       (taoensso.timbre/fatal e))
     (finally


Nested defs are evil, ban them!

Nested defs are evil, ban them!

--- src/oxcart/passes/warnings.clj
+++ src/oxcart/passes/warnings.clj
@@ -137,7 +137,7 @@
 (def banned-ops
   "AST operations which are banned due to their violation of Oxcart's
   static assumptions."
-  #{})
+  #{:def})

 (def dangerous-ops


Upgrade karma to 5.0.2

Upgrade karma to 5.0.2

--- examples/todomvc/src/deps.cljs
+++ examples/todomvc/src/deps.cljs
@@ -1,5 +1,5 @@
 {:npm-dev-deps {"shadow-cljs"           "2.8.104"
-                "karma"                 "4.4.1"
+                "karma"                 "5.0.2"
                 "karma-chrome-launcher" "3.1.0"
                 "karma-cljs-test"       "0.1.0"
                 "karma-junit-reporter"  "2.0.1"}}


Make size configurable

Make size configurable

also force canvas paint on mount & update

--- src/sierpinski_sieve/core.cljs
+++ src/sierpinski_sieve/core.cljs
@@ -7,7 +7,7 @@
 (enable-console-print!)
 (defn log [& args] (.log js/console args))

-(defonce app-state (atom {}))
+(defonce app-state (atom {:size 1000}))

 (defn next-row [modulus row]
   (let [size (inc (alength row))
@@ -40,23 +40,37 @@
         (doseq [[y row] (map-indexed vector sieve)]
           (paint-row ctx y row size))))))

-(defn render-canvas [size]
-  (fn []
+(defn render-canvas []
+  (let [size (:size @app-state)]
     [:center
      [:h1 "Sierpinski Triangle"]
      [:canvas {:width size :height size :id "canvas"}]
+     [:div
+      [:label "Size"
+       [:input {:type "range" :min 100 :max 1200 :step 100 :value size
+                :on-change (fn [e]
+                             (let [value (int (.-target.value e))]
+                               (log value)
+                               (swap! app-state assoc :size value)))}]
+       size]]
      [:p
       "© 2017 Charles L.G. Comstock "
       [:a {:href "https://github.com/dgtized/sierpinski-sieve"} "(github)"]]]))

-(defn main [size]
-  (reagent/render [(render-canvas size)]
-                  (. js/document (getElementById "app")))
+(defn paint-canvas []
   (time
-   (let [triangle (time (doall (take size (sieve '(1) 2))))]
+   (let [size (:size @app-state)
+         triangle (time (doall (take size (sieve '(1) 2))))]
      (time (paint "canvas" size triangle)))))

-(main 1000)
+(defn ui-component []
+  (reagent/create-class
+   {:reagent-render render-canvas
+    :component-did-mount paint-canvas
+    :component-did-update paint-canvas}))
+
+(reagent/render [ui-component]
+                (. js/document (getElementById "app")))

 (defn on-js-reload []
   ;; optionally touch your app-state to force rerendering depending on


simplification (sometimes one should look at docs)

--- src/statuses/configuration.clj
+++ src/statuses/configuration.clj
@@ -13,7 +13,7 @@
   (if path
     (try
       (println "Initializing configuration from" path ":")
-      (swap! config-holder #(merge % (read-string (slurp path))))
+      (swap! config-holder merge (read-string (slurp path)))
       (catch java.io.FileNotFoundException e
         (println "Configuration not found, exiting.")
         (System/exit -1)))


names corrected for dresses

names corrected for dresses

--- src/turbo_eureka/ios/core.cljs
+++ src/turbo_eureka/ios/core.cljs
@@ -114,8 +114,8 @@
     (>! c/action-channel
         [:async/loaded-products
            (take 100
-              (cycle [{:name "Active Dress" :option-name "option1" :id "3212344" :description "The most active of all the dresses" :img (js/require "./images/Active_Dress_1.jpg")}
-                      {:name "Floral Dress" :option-name "option2" :id "3212345" :description "Pritty pritty flowers, i like flowers." :img (js/require "./images/Floral_Dress_1.jpg")}
+              (cycle [{:name "Active Dress" :option-name "option2" :id "3212344" :description "The most active of all the dresses" :img (js/require "./images/Active_Dress_1.jpg")}
+                      {:name "Floral Dress" :option-name "option1" :id "3212345" :description "Pritty pritty flowers, i like flowers." :img (js/require "./images/Floral_Dress_1.jpg")}
                       {:name "Pattern Shirt" :option-name "option3" :id "3212346" :description "Cool design bro... much like." :img (js/require "./images/Pattern_Shirt_1.jpg")}
                       {:name "Cotton Top" :option-name "option4" :id "3212347" :description "Cotton... Mostly." :img (js/require "./images/Cotton_Top_1.jpg")}]))]))


Fixed minor typo in challenge 3-4

Fixed minor typo in challenge 3-4

--- src/workshop/challenge_3_4.clj
+++ src/workshop/challenge_3_4.clj
@@ -36,7 +36,7 @@

 ;;; Functions ;;;

-;; <<< BEGIN FILL ME IN PART 1 >>>
+;; <<< BEGIN FILL ME IN PART 2 >>>

 ;; <<< END FILL ME IN PART 2 >>>

@@ -71,4 +71,4 @@

    {:lifecycle/task :write-segments
     :lifecycle/calls :onyx.plugin.core-async/writer-calls
-    :onyx/doc "core.async plugin base lifecycle"}])+    :onyx/doc "core.async plugin base lifecycle"}])


[#3158] Fix test

[#3158] Fix test

--- backend/test/akvo/lumen/lib/data_group_test.clj
+++ backend/test/akvo/lumen/lib/data_group_test.clj
@@ -44,4 +44,4 @@

 (deftest ^:unit data-groups-view
   (let [expected "CREATE TEMP VIEW foo AS SELECT * FROM bar"]
-    (is (= expected (data-group/data-groups-view "foo" true "SELECT * FROM bar")))))
+    (is (= expected (data-group/data-groups-view "foo" true false "SELECT * FROM bar")))))