Fix typo

Fix typo

--- src/graphito/core.cljs
+++ src/graphito/core.cljs
@@ -166,11 +166,11 @@
                 project-opacity
                 project-label-opacity]} (projectors-for-state state)
         transition (fn [selection]
-                     (.onNext animation-subject :start-animation)
+                     (.onNext animation-subject :animation-start)
                      (-> selection
                          .transition
                          (.duration 500)
-                         (.each "end" #(.onNext animation-subject :end-animation))))
+                         (.each "end" #(.onNext animation-subject :animation-end))))
         maybe-transition (if animate? transition identity)
         positions (mapv (fn [node]
                           (view-position state


Bold label on selected node, fix tapping to zoom

--- src/graphito/core.cljs
+++ src/graphito/core.cljs
@@ -256,6 +256,8 @@
           maybe-transition
           (.attr "opacity" (fn [node]
                              (project-label-opacity (distance-for-node node))))
+          (.attr "font-weight" (fn [node]
+                                 (if (= node selected-node) "bold" "normal")))
           (.text #(:title %))))
     (.classed detail-button "invisible" (or (nil? selected-node)
                                             (= projection :zoom-out)))
@@ -604,10 +606,7 @@
         svg-y (.-top svg-box)]
     (v/create (- center-x svg-x) (- center-y svg-y))))

-;; Gestures - tap on node
-
 (defn closest-node
-  "Returns the node closest to the given position and its distance"
   [state pos]
   (let [closest-node (atom nil)
         closest-distance-sq (atom js/Infinity)
@@ -621,7 +620,8 @@
                        (when (< distance-sq @closest-distance-sq)
                          (reset! closest-distance-sq distance-sq)
                          (reset! closest-node node)))))))
-    {:node @closest-node
+    {:pos pos
+     :node @closest-node
      :distance (js/Math.sqrt @closest-distance-sq)}))

 (defn zoom-and-select-on-tap! [manager current-state animation-observable]
@@ -631,7 +631,7 @@
             (.map #(closest-node @current-state %))
             (.partition #(< (:distance %) (/ hitbox-size 2))))
         node-taps (aget partitions 0)
-        space-taps (aget partitions 1)]
+        space-taps (.map (aget partitions 1) #(:pos %))]
         (.subscribe node-taps
                     (fn [{:keys [node]}]
                         (select-and-zoom-to-node! current-state node)))


add diffs for =

add diffs for =

--- src/matcha.clj
+++ src/matcha.clj
@@ -8,7 +8,8 @@
   (:require [clojure.string :as string]
             [clojure.core :as core]
             [clojure.test :as test]
-            [clojure.data :as data]))
+            [clojure.data :as data]
+            [clojure.pprint :as pprint]))
 ;; Matcher
 ;; Match
 ;;
@@ -29,15 +30,18 @@
 (defn standard-describe-mismatch [x]
   (pr-str x))

+(defn pp [x]
+  (with-out-str (pprint/pprint x)))
+
 (defn describe-class-mismatch [x]
-  (str (pr-str x)
+  (str (pp x)
        (if (clojure.core/nil? x)
          ""
          (str " <" (class x) ">"))))

-
 (defn describe-mismatch-feature [x feature-name feature-mismatch]
   (str (standard-describe-mismatch x) " with " feature-name " " feature-mismatch))
+

 (defn on
   "combinator. Passes if the (f the-value) matches the matcher"
@@ -79,8 +83,12 @@
    (fn [x]
      (let [[things-in-a things-in-x things-in-both] (data/diff a x)]
        (str (describe-class-mismatch x)
-         "\n+" (pr-str things-in-a)
-         "\n-" (pr-str things-in-x))))})
+            (if (not= things-in-a things-in-x)
+              (str
+
+                "\n    diff:"
+                "\n       +: " (pp things-in-a)
+                "\n       -: " (pp things-in-x))))))})

 (defn <=
   "matches based if the value given is greater-than or equal to


tempo and repeat

tempo and repeat

--- src/temperaments/core.clj
+++ src/temperaments/core.clj
@@ -14,6 +14,10 @@
 (def tonic (atom :a3))

 (def tuning (atom :equalTemperament))
+
+(def tempo (atom 120))
+
+(def repetition (atom false))

 (def twelfth6 (sqrt 2))
 (def twelfth3 (sqrt twelfth6))
@@ -240,9 +244,6 @@
 ; setup a sound for our metronome to use
 (def kick syn/ticker)

-; setup a tempo for our metronome to use
-(def one-twenty-bpm (o/metronome 120))
-
 ; this function will play our sound at whatever tempo we've set our metronome to
 (defn looper [nome sound]
     (let [beat (nome)]
@@ -295,13 +296,14 @@

 (defn play
   ([metronome inst score {midiq :midi}]
-     (play metronome (metronome) inst score {:midi midiq}))
+   (play metronome (metronome) inst score {:midi midiq}))
   ([metronome beat instrument score {midiq :midi}]
-     (let [cur-note (first score)]
-       (when cur-note
-         (let [next-beat (play-one metronome beat instrument cur-note {:midi midiq})]
-           (o/apply-at (metronome next-beat) play metronome next-beat instrument
-             (next score) {:midi midiq} []))))))
+   (let [cur-note (first score)]
+     (if cur-note
+       (let [next-beat (play-one metronome beat instrument cur-note {:midi midiq})]
+         (o/apply-at (metronome next-beat)
+                     play metronome next-beat instrument
+                     (next score) {:midi midiq} []))))))

 (def a-scale ["A" "B\u266D" "B" "C" "C\u266F" "D"
               "E\u266D" "E" "F" "F\u266F" "G" "G\u266F"] )
@@ -448,21 +450,24 @@
             notes (map str->midi melodyseq)
             part (cons thisinstr (map vector notes rhythm))]
         (swap! score conj part)))
-    @score))
-
-
-
+    [@score, totaltime]))
+
 (defn play-melody [e]
-  (let [score (or @melody
-                  (make-score))]
+  (let [[score len] (if @melody
+                      [@melody 20]
+                      (make-score))
+        metro (o/metronome @tempo)
+        endseq (atom '())]
     (doseq [[instr & part] score]
-      (play one-twenty-bpm (str->instr instr) part {:midi true}))))
+      (play metro (str->instr instr) part {:midi true}))
+    (o/apply-at (metro len) #(if @repetition (play-melody nil)))
+    ))

 (defn play-solo [id e]
   (let [[mel rhy _ instr] (make-part id)
         notes (map str->midi mel)
         part (map vector notes rhy)]
-    (play one-twenty-bpm (str->instr instr) part {:midi true})))
+    (play (o/metronome @tempo) (str->instr instr) part {:midi true})))

 (defn remove-circle [id kw]
   (let [len (get-in @melody-map [id kw])
@@ -560,7 +565,7 @@
         mellist (map #(keyword (s/join [melprefix (str %)])) (range mellen))
         rhylist (map #(keyword (s/join [rhyprefix (str %)])) (range rhylen))
         idlist (vec (concat mellist rhylist))
-        circhash (atom '())]
+        circhash (atom {})]
     (doseq [k idlist]
       (let [w (select panel [k])]
         (swap! circhash assoc k (value w))))
@@ -599,10 +604,23 @@
       (let [val {:panhash (dissoc v :root),
                  :circhash (make-circles-hash k)}]
         (swap! dump assoc k val)))
+    (swap! dump assoc :tempo @tempo)
     @dump))

+;; create slider used to adjust tempo
+(def tempo-slider
+  (slider :orientation :horizontal
+          ;:value 120
+          :min 20
+          :max 360
+          :snap-to-ticks? false
+          :paint-labels? true
+          :major-tick-spacing 100
+          :minor-tick-spacing 20))
+
 (defn restore-dump [dump]
-  (doseq [[oldid {:keys [panhash circhash]}] dump]
+  (value! tempo-slider (get dump :tempo))
+  (doseq [[oldid {:keys [panhash circhash]}] (dissoc dump :tempo)]
     (restore-panel oldid panhash circhash)))

 (defn save-pattern [e]
@@ -618,8 +636,23 @@
             dump (clojure.edn/read-string dumpstr)]
         (restore-dump dump)))))

+
+;; handler for tempo-slider
+(listen tempo-slider
+        :change
+        (fn [e]
+          (reset! tempo (value tempo-slider))))
+
+(value! tempo-slider 120)
+
+(def repeat-label (label " Off"))
+
+(defn repeat-action [e]
+  (swap! repetition not)
+  (value! repeat-label (if @repetition " On" " Off")))
+
 (def control-frame
-  (frame :title "Tuning Demo"
+  (frame :title "Music Demo"
          :content (vertical-panel
                    :items [;; play tone
                            (button :id :playTestTone
@@ -642,6 +675,19 @@
                            ;; spacer
                            (label :text ""
                                   :size [100 :by 30])
+                           (label "Tempo:")
+                           tempo-slider
+                           ;; spacer
+                           (label :text ""
+                                  :size [100 :by 30])
+                           (horizontal-panel
+                            :items [(button :id :repeats
+                                            :text "Repeat?"
+                                            :listen [:action repeat-action])
+                                    repeat-label])
+                           (combobox :model instruments
+                                     :id :instChooser
+                                     :listen [:action inst-chooser])
                            (label "Instrument:")
                            (combobox :model instruments
                                      :id :instChooser


minor fixes & deploy

minor fixes & deploy

--- src/jarkeeper/core.clj
+++ src/jarkeeper/core.clj
@@ -37,14 +37,11 @@

 (defn read-project-clj [repo-owner repo-name]
   (let [url (str "https://raw.github.com/" repo-owner "/" repo-name "/master/project.clj")]
-    (-> url
-        io/reader
-        (PushbackReader.)
-        edn/read))
+    (edn/read (PushbackReader. (io/reader url)))))

 (defn check-deps [deps]
-  (map #(conj % (anc/artifact-outdated? % {:snapshots? false :qualified? true}))) deps))
+  (map #(conj % (anc/artifact-outdated? % {:snapshots? false :qualified? true})) deps))

 (defn calculate-stats [deps]
   (let [up-to-date-deps (remove nil? (map (fn [dep] (if (nil? (last dep)) dep nil)) deps))
@@ -66,27 +63,32 @@

 (defn project-map [repo-owner repo-name]
-  (let [github-url (str "https://github.com/" repo-owner "/" repo-name)
-        [_ project-name version & info] (read-project-clj repo-owner repo-name)
-        info-map (apply hash-map info)
-        deps (check-deps (:dependencies info-map))
-        plugins (check-deps (:plugins info-map))
-        profiles (check-profiles (:profiles info-map))
-        stats (calculate-stats deps)
-        plugins-stats (calculate-stats plugins)
-        result (assoc info-map
-                 :name project-name
-                 :repo-name repo-name
-                 :repo-owner repo-owner
-                 :version version
-                 :github-url github-url
-                 :deps deps
-                 :profiles profiles
-                 :plugins plugins
-                 :stats stats
-                 :plugins-stats plugins-stats)]
-       (log/info "project map" result profiles)
-       result))
+  (let [github-url (str "https://github.com/" repo-owner "/" repo-name)]
+        (if-let [project-clj-content (read-project-clj repo-owner repo-name)]
+            (do
+              (println "project-clj" project-clj-content)
+              (let [[_ project-name version & info] project-clj-content
+                    info-map (apply hash-map info)
+                    deps (check-deps (:dependencies info-map))
+                    plugins (check-deps (:plugins info-map))
+                    profiles (check-profiles (:profiles info-map))
+                    stats (calculate-stats deps)
+                    plugins-stats (calculate-stats plugins)
+                    result (assoc info-map
+                             :name project-name
+                             :repo-name repo-name
+                             :repo-owner repo-owner
+                             :version version
+                             :github-url github-url
+                             :deps deps
+                             :profiles profiles
+                             :plugins plugins
+                             :stats stats
+                             :plugins-stats plugins-stats)]
+                (log/info "project map" result profiles)
+                result))
+
+            )))

 (defn- repo-redirect [{:keys [params]}]


Handle crazy OS X case where read-line doesn't return nil on EOF.

--- src/leiningen/repl.clj
+++ src/leiningen/repl.clj
@@ -59,10 +59,11 @@
       (recur))))

 (defn repl-client [reader writer]
-  (when-let [input (read-line)]
-    (.write writer (str input "\n"))
-    (.flush writer)
-    (recur reader writer)))
+  (let [input (read-line)]
+    (when (and input (not= "" input))
+      (.write writer (str input "\n"))
+      (.flush writer)
+      (recur reader writer))))

 (defn- connect-to-server [socket]
   (let [reader (InputStreamReader. (.getInputStream socket))


Augment 'newest-voom-ver-by-spec to include full version information.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -427,16 +427,20 @@
                                      (concat (map #(str "^" % "^") tags)
                                              [branch "--" path]))))]
              :when (seq commits)]
-         (some (fn [[current next-commit]]
-                 #_(prn :refs path (:refs next-commit))
-                 (when (or (= :end next-commit)
-                           (some #(= path (:path (parse-tag %)))
-                                 (:refs next-commit)))
-                   {:sha (:sha current)
-                    :path path
-                    :gitdir gitdir
-                    :branch branch}))
-               (partition 2 1 (concat commits [:end]))))))))
+         (let [refs (-> commits first :refs)
+               reflist (filter #(= path (:path %)) (map parse-tag refs))]
+           (some (fn [[current next-commit]]
+                   #_(prn :refs path (:refs next-commit))
+                   (when (or (= :end next-commit)
+                             (some #(= path (:path (parse-tag %)))
+                                   (:refs next-commit)))
+                     {:sha (:sha current)
+                      :ver (-> reflist first :ver)
+                      :path path
+                      :proj proj-name
+                      :gitdir gitdir
+                      :branch branch}))
+                 (partition 2 1 (concat commits [:end])))))))))


Minor translation strings change.

Minor translation strings change.

--- src/uxbox/data/users.cljs
+++ src/uxbox/data/users.cljs
@@ -89,7 +89,7 @@

   rs/EffectEvent
   (-apply-effect [_ state]
-    (udm/info! (tr "profile.password-saved"))))
+    (udm/info! (tr "settings.password-saved"))))

 (defn password-updated
   []


replaced outdated function with new ones

--- src/lights/my_show.clj
+++ src/lights/my_show.clj
@@ -137,9 +137,9 @@
   ;; all the expanded, patched fixtures in it.
   '*show*)

-;(use-my-show)
-
-(use-london-show)
+(use-my-show)
+
+;(use-london-show)

 ; Logging level set to :info
 (core/init-logging)
@@ -438,16 +438,6 @@
         (afterglow.effects.fun/dimmer-sparkle (show/fixtures-named "head") :chance :sparkle-chance :fade-time :sparkle-fade)))
         :held true :priority 100
         :short-name "Sparkle all"
-        ))
-
-  (ct/set-cue! (:cue-grid *show*) 1 7
-    (cues/cue :sparkle (fn [_] (fun/sparkle (show/fixtures-named "scene")
-      ;2DO find good values here
-      :chance 0.3
-      :fade-time 400))
-        :held true
-        :priority 100
-        :short-name "Sparkle scene"
         ))

   (ct/set-cue! (:cue-grid *show*) 7 7
@@ -514,7 +504,7 @@
     ))))

   (let [light-param (params/build-oscillated-param
-        (oscillators/sawtooth-beat :beat-ratio :osc-beat-ratio :down? true) :min :lightness-min-general :max :lightness-max-back)]
+        (oscillators/sawtooth :interval :beat :interval-ratio :osc-beat-ratio :down? true) :min :lightness-min-general :max :lightness-max-back)]
     (ct/set-cue! (:cue-grid *show*) 0 2
       (cues/cue :color  (fn [_] (afterglow.effects/scene
         "Sawtooth Back"
@@ -524,7 +514,7 @@

   (let [light-param (params/build-oscillated-param
-        (oscillators/sawtooth-beat :beat-ratio :osc-beat-ratio :down? true) :min :lightness-min-general :max :lightness-max-front)]
+        (oscillators/sawtooth :interval :beat :interval-ratio :osc-beat-ratio :down? true) :min :lightness-min-general :max :lightness-max-front)]
     (ct/set-cue! (:cue-grid *show*) 1 2
       (cues/cue :color  (fn [_] (afterglow.effects/scene
         "Sawtooth Front"
@@ -532,12 +522,10 @@
             "Bass" (params/build-color-param :h :main-hue :s 100 :l light-param) (show/fixtures-named "front"))
       )))))

-
-
   (let [light-param-back (params/build-oscillated-param
-        (oscillators/sawtooth-beat :beat-ratio :osc-beat-ratio :down? true) :min :lightness-min-general :max :lightness-max-back)
+        (oscillators/sawtooth :interval :beat :interval-ratio :osc-beat-ratio :down? true) :min :lightness-min-general :max :lightness-max-back)
         light-param-front (params/build-oscillated-param
-        (oscillators/sawtooth-beat :beat-ratio :osc-beat-ratio :down? true) :min :lightness-min-general :max :lightness-max-front)]
+        (oscillators/sawtooth :interval :beat :interval-ratio :osc-beat-ratio :down? true) :min :lightness-min-general :max :lightness-max-front)]
     (ct/set-cue! (:cue-grid *show*) 2 2
       (cues/cue :color  (fn [_] (afterglow.effects/scene
         "Sawtooth Back & Front"
@@ -551,7 +539,7 @@
     (cues/cue :color  (fn [_] (afterglow.effects/scene
       "Sine Back & Front"
       (let [light-param (params/build-oscillated-param
-        (oscillators/sine-beat :beat-ratio :osc-beat-ratio :down? true) :min :lightness-min-general :max :lightness-max-general)]
+        (oscillators/sine :interval :beat :interval-ratio :osc-beat-ratio :down? true) :min :lightness-min-general :max :lightness-max-general)]
         (global-color-effect (params/build-color-param :h :main-hue :s 100 :l light-param))
       )
     ))))
@@ -560,7 +548,7 @@
     (cues/cue :color  (fn [_] (afterglow.effects/scene
       "Sawtooth All"
       (let [light-param (params/build-oscillated-param
-        (oscillators/sawtooth-beat :beat-ratio :osc-beat-ratio :down? true) :min :lightness-min-general :max :lightness-max-general)]
+        (oscillators/sawtooth :interval :beat :interval-ratio :beat-ratio :osc-beat-ratio :down? true) :min :lightness-min-general :max :lightness-max-general)]
         (global-color-effect (params/build-color-param :h :main-hue :s 100 :l light-param))
       )
     ))))
@@ -569,7 +557,7 @@
     (cues/cue :color  (fn [_] (afterglow.effects/scene
       "Sine All"
       (let [light-param (params/build-oscillated-param
-        (oscillators/sine-beat :beat-ratio :osc-beat-ratio :down? true) :min :lightness-min-general :max :lightness-max-general)]
+        (oscillators/sine :interval :beat :interval-ratio :osc-beat-ratio :down? true) :min :lightness-min-general :max :lightness-max-general)]
         (global-color-effect (params/build-color-param :h :main-hue :s 100 :l light-param))
       )
     ))))


ok bars are pointing in the right direction

--- src/mortgage/core.cljs
+++ src/mortgage/core.cljs
@@ -153,29 +153,34 @@

 (sm/defn draw-bar-graph [y-axis-label :- s/Str
                          data-points :- [s/Num]]
-  [:svg {:width 400 :height 300}
+  [:svg {:width 500 :height 300}
    [:line {:x1           100 :y1 20
            :x2           100 :y2 280
            :stroke       "black"
            :stroke-width 1}]
    [:line {:x1           100 :y1 280
-           :x2           400 :y2 280
+           :x2           500 :y2 280
            :stroke       "black"
            :stroke-width 1}]
    [:text {:x 70 :y 235 :transform "rotate(270 75 230)"} y-axis-label]
    [:text {:x 90 :y 30 :text-anchor "end"} (str "$" (.toLocaleString (int (apply max data-points))))]
    (for [[index point] (map-indexed vector data-points)]
-     ^{:key (str "rect-" point)} [:rect {:x         (+ 110 (* index 50))
-                                         :y         30
-                                         :width     40
-                                         :height    (* 250
-                                                       (/ point (apply max data-points)))}])])
+     (let [x (+ 110 (* index 50))
+           height (* 250
+                     (/ point (apply max data-points)))]
+       ^{:key (str "rect-" point)} [:rect {:x         (- x 50)
+                                           :y         280
+                                           :width     40
+                                           :transform (str "rotate(180 " x " " 280 ")")
+                                           ; TODO tooltip too
+                                           :height    height}]))])

 (sm/defn draw-money-wasted [state :- UIState]
   [draw-bar-graph "Money Wasted On Interest" (map (comp :interest total-price-breakdown) (:mortgages state))]
   )

 (sm/defn draw-monthly-payment [state :- UIState]
+  [draw-bar-graph "Total Monthly Payment" (map full-monthly-payment-amount (:mortgages state))]
   )

 (sm/defn draw-mortgage [m :- Mortgage


add precision, try/catch

add precision, try/catch

--- src/clj_money/import/gnucash.clj
+++ src/clj_money/import/gnucash.clj
@@ -28,9 +28,10 @@
 (defn- parse-decimal
   [string-decimal]
   (when-let [match (re-find #"(\d+)\/(\d+)" string-decimal)]
-    (apply / (->> match
-                  rest
-                  (map bigdec)))))
+    (with-precision 4
+      (apply / (->> match
+                    rest
+                    (map bigdec))))))

 (def ^:private namespace-map
   (->> ["gnc" "act" "trn" "ts" "split" "bgt" "recurrence" "slot" "cd" "cmdty" "price"]
@@ -291,7 +292,8 @@
                               (count output-paths))]
       (binding [*print-meta* true]
         (with-open [writer (io/writer (GZIPOutputStream. (FileOutputStream. output-path)))]
-          (.write writer (prn-str records))))
+          (with-precision 4
+            (.write writer (prn-str records)))))
       (>!! progress-chan [:output-path output-path])
       (-> context
           (assoc :records [])
@@ -390,20 +392,24 @@
         progress-chan (chan)
         result (go
                  (with-open [input-stream (FileInputStream. input-file)]
-                   (->> (read-source :gnucash input-stream)
-                        (transduce
-                          (comp filter-record
-                                append-record
-                                (partial notify-record progress-chan))
-                          evaluate-output
-                          {:output-paths []
-                           :verbose (-> opts :options :verbose)
-                           :records []
-                           :max-record-count (-> opts :options :maximum)
-                           :file-name (second (re-matches #"^(.+)(\..+)$" file-name))
-                           :output-folder output-folder
-                           :progress-chan progress-chan})
-                        process-output)))]
+                   (try
+                     (->> (read-source :gnucash input-stream)
+                          (transduce
+                            (comp filter-record
+                                  append-record
+                                  (partial notify-record progress-chan))
+                            evaluate-output
+                            {:output-paths []
+                             :verbose (-> opts :options :verbose)
+                             :records []
+                             :max-record-count (-> opts :options :maximum)
+                             :file-name (second (re-matches #"^(.+)(\..+)$" file-name))
+                             :output-folder output-folder
+                             :progress-chan progress-chan})
+                          process-output)
+                     (catch Exception e
+                       (pprint {:error-reading-source e
+                                :stack-trace (.getStackTrace e)})))))]
     (go-loop [value (<! progress-chan)]
              (case (first value)
                :record


correct period logic

correct period logic

--- src/clj_money/models/reports.clj
+++ src/clj_money/models/reports.clj
@@ -262,16 +262,14 @@
    (monitor storage-spec account {}))
   ([storage-spec account {as-of :as-of :or {as-of (t/today)}}]
    (with-storage [s storage-spec]
-     (when-let [budget (budgets/find-by-date s (:entity-id account) as-of)]
-       (when-let [item (budgets/find-item-by-account budget account)]
+     (if-let [budget (budgets/find-by-date s (:entity-id account) as-of)]
+       (if-let [item (budgets/find-item-by-account budget account)]
          (let [period (budgets/period-containing budget as-of)
-               period-budget (reduce + (->> item
+               period-budget (:amount (get (:periods item) (:index period)))
+               total-budget (reduce + (->> item
                                             :periods
                                             (map :amount)
                                             (take (+ 1 (:index period)))))
-               total-budget (reduce + (->> item
-                                           :periods
-                                           (map :amount)))
                percent-of-period (budgets/percent-of-period budget
                                                             as-of)
                period-actual (transactions/balance-delta s


fix import page not appearing in history

--- src/cljs/salava/badge/ui/my.cljs
+++ src/cljs/salava/badge/ui/my.cljs
@@ -6,7 +6,7 @@
     [clojure.set :as set :refer [intersection]]
     [clojure.string :refer [upper-case]]
     [salava.core.ui.ajax-utils :as ajax]
-    [salava.core.ui.helper :as h :refer [unique-values navigate-to path-for  not-activated? private?]]
+    [salava.core.ui.helper :as h :refer [unique-values navigate-to path-for  not-activated? private? js-navigate-to]]
     [salava.core.ui.notactivated :refer [not-activated-banner]]
     [salava.core.ui.layout :as layout]
     [salava.core.ui.grid :as g]
@@ -80,7 +80,7 @@
     (into [:div#grid {:class "row wrap-grid"}
            (when-not (private?)
              [:div#import-badge {:key   "new-badge"}
-            [:a.add-element-link {:href  "#" :on-click #(navigate-to "badge/import")}
+            [:a.add-element-link {:href  "#" :on-click #(js-navigate-to "badge/import")}
              [:div {:class "media grid-container"}
               [:div.media-content
                [:div.media-body


Add simple frm completeness check

Add simple frm completeness check

--- src/cljs/whatishistory/core.cljs
+++ src/cljs/whatishistory/core.cljs
@@ -73,25 +73,34 @@
                   (and email-provided (not email-confirmed)) (js/alert "Please confirm your email address."))
                 false)))))

+(defn data-valid [defn-data frm-mode]
+  (let [nil-fields (filterv #(nil? (second %)) defn-data)]
+    (js/console.log (count nil-fields))
+    (if-not (> (count nil-fields) 0)
+      true
+      (do
+        (js/alert "Please complete the form.")
+        false))))
+
 (defn save-defn [app-atom]
   (let [Definition (js/Parse.Object.extend "Definition")
         frm-mode (get @app-atom :defn-form-mode)
         new-defn (Definition.)]
     (.setACL new-defn (js/Parse.ACL. (.current js/Parse.User)))
-    (def defn-js #js {:definedby (get @app-atom :curr-user)
-                      :definition (get @app-atom :definition)
-                      :author (condp = (get @app-atom :author)
-                                 nil "Anonymous"
-                                 ""  "Anonymous"
-                                 (get @app-atom :author))
-                      :year (if (= frm-mode "default")
-                                 (.getFullYear (js/Date.))
-                                 (get @app-atom :year))
-                      :definitionSubject "history"
-                      :mehuman "1"})
-    (if (email-confirmed app-atom true)
+    (def defn-data {:definedby (get @app-atom :curr-user)
+                    :definition (get @app-atom :definition)
+                    :author (condp = (get @app-atom :author)
+                              nil "Anonymous"
+                              ""  "Anonymous"
+                              (get @app-atom :author))
+                    :year (if (= frm-mode "default")
+                            (.getFullYear (js/Date.))
+                            (get @app-atom :year))
+                    :definitionSubject "history"
+                    :mehuman "1"})
+    (if (and (email-confirmed app-atom true) (data-valid defn-data frm-mode))
       (do
-         (def new-defn-promise (.save new-defn defn-js))
+         (def new-defn-promise (.save new-defn (clj->js defn-data)))
          (.then new-defn-promise (fn [defn]
                               (js/console.log "definition saved: " defn)
                               (swap! app-atom assoc :defn-obj defn)))


style

style

--- src/java_time/defconversion.clj
+++ src/java_time/defconversion.clj
@@ -21,15 +21,15 @@
 (defn- combinations [xs f cost]
   (let [idxs (g/continuous-combinations (count xs))]
     (for [combo idxs]
-      (vector (fn [& vs]
-                (let [res (to-seq (apply f vs))]
-                  (subvec res (first combo) (inc (last combo)))))
-              (g/types (subvec xs (first combo) (inc (last combo))))
-              (cond-> cost
-                ;; TODO: mark as lossy conversion
-                ;; currently we just incur a 0.5*number of types dropped penalty
-                (not= (count idxs) (count xs))
-                (+ (* 0.5 (- (count xs) (count combo)))))))))
+      [(fn [& vs]
+         (let [res (to-seq (apply f vs))]
+           (subvec res (first combo) (inc (last combo)))))
+       (g/types (subvec xs (first combo) (inc (last combo))))
+       (cond-> cost
+         ;; TODO: mark as lossy conversion
+         ;; currently we just incur a 0.5*number of types dropped penalty
+         (not= (count idxs) (count xs))
+         (+ (* 0.5 (- (count xs) (count combo)))))])))

 (def ^:dynamic *fail-on-duplicate-conversion?* true)


update the text after change event instead of before since it's fast enough, and add cursor event

--- src/parinfer/core.cljs
+++ src/parinfer/core.cljs
@@ -40,76 +40,19 @@
 ;; Editor
 ;;------------------------------------------------------------------------

-(defn replace-string-range
-  [orig from to diff]
-  (str
-    (subs orig 0 from)
-    diff
-    (subs orig to)))
-
-(defn calc-new-value
-  "Calculate the new value of Code Mirror given this change.
-  Might be able to ignore this"
-  [cm change]
-  (let [text (.getValue cm)
-        no-lines (.lineCount cm)
-
-        line-lengths (as-> text $
-                          (split-lines $)
-                          (map count $)
-                          (concat $ (repeat 0))
-                          (map inc $)
-                          (take no-lines $))
-
-        line-indexes (reduce
-                         (fn [indexes length]
-                           (let [prev-index (last indexes)
-                                 new-index (+ prev-index length)]
-                             (conj indexes new-index)))
-                         [0]
-                         line-lengths)
-
-        diff (join "\n" (.-text change))
-
-        get-marker (fn [end] {:x-pos (.-ch end) :line-no (.-line end)})
-        markers [(get-marker (.-from change)) (get-marker (.-to change))]
-        marker-sort-key (fn [x] [(:line-no x) (:x-pos x)])
-        marker-to-index (fn [{:keys [line-no x-pos]}]
-                          (+ x-pos (line-indexes line-no)))
-
-        [from to] (->> markers
-                       (sort-by marker-sort-key)
-                       (map marker-to-index))
-
-        new-text (replace-string-range text from to diff)]
-
-    new-text))
-
 (def target-text (atom ""))
 (def global-cm nil)

-(defn before-change
-  [cm change]
-  (println "BEFORE CHANGE")
-  (let [new-text (calc-new-value cm change)]
-    (println "new target:" (pr-str new-text))
-    (println "current target:" (pr-str @target-text))
+(defn update-text!
+  [cm]
+  (let [current-text (.getValue cm)
+        cursor (.getCursor cm)
+        state {:cursor-line (.-line cursor)
+               :cursor-x (.-ch cursor)}
+        formatted (format-text state current-text)]

-    (when-not (= new-text @target-text)
-      (let [line-no (.. change -from -line)
-            x-pos (.. change -from -ch)
-            state {:cursor-line line-no
-                   :cursor-x (inc x-pos)}
-            formatted (format-text state new-text)]
-        (reset! target-text formatted))))
-  )
+    (reset! target-text formatted)

-(defn on-change
-  [cm change]
-  (println "ON CHANGE")
-  (let [cursor (.getCursor cm)
-        current-text (.getValue cm)
-        ]
     (println "current value:" (pr-str current-text))
     (println "current target:" (pr-str @target-text))
     (when-not (= current-text @target-text)
@@ -118,15 +61,31 @@
       ;; TODO: also restore scroll:
       ;;      scrollTop and scrollLeft from cm.getScrollerElement()
       ;;      source: https://groups.google.com/forum/#!topic/codemirror/oNzsevQW1DE
-      ))
+      )
+    )
   )

+;; NOTE:
+;; Text is either updated after a change in text or
+;; a cursor movement, but not both.
+;;
+;; When typing, on-change is called, then on-cursor-activity.
+;; So we prevent updating the text twice by using an update flag.
+
+(def frame-updated? (atom false))
+
+(defn on-change
+  "Called after typing something."
+  [cm change]
+  (update-text! cm)
+  (reset! frame-updated? true))
+
 (defn on-cursor-activity
+  "Called after the cursor moves."
   [cm]
-  (let [cursor (.getCursor cm)]
-    ;; TODO: trigger a change if we move lines, sending only the line. don't care about x-pos
-    )
-  )
+  (when-not @frame-updated?
+    (update-text! cm))
+  (reset! frame-updated? false))

 (def editor-opts
   {:lineNumbers "true"
@@ -139,7 +98,6 @@
   (let [cm (.fromTextArea js/CodeMirror elm (clj->js editor-opts))]
     (set! global-cm cm)
     (.on cm "change" on-change)
-    (.on cm "beforeChange" before-change)
     (.on cm "cursorActivity" on-cursor-activity)))

 (defn root-comp


Added a reminder comment.

Added a reminder comment.

--- src/leiningen/appengine_new.clj
+++ src/leiningen/appengine_new.clj
@@ -40,6 +40,9 @@
     (when-not (.exists WEB-INF-dir)
       (.mkdir WEB-INF-dir)
       (println "created WEB-INF directory" (.getPath WEB-INF-dir)))
+    ;; TODO: Write a .gitignore file here, with classes/, lib/,
+    ;; WEB-INF/classes/, and WEB-INF/lib/ as entries.
+    ;; ...
     ;; write a base entry point servlet file
     (let [src-dir (File. (:source-path project))
           src-base-namespace-dir (File. src-dir (dash_ prj-application))


changed refresh interval from 15 minutes to 5 minutes

--- src/mafia_votecount/handler.clj
+++ src/mafia_votecount/handler.clj
@@ -16,7 +16,7 @@
   (println "mafia-votecount is starting")
   (println "Scheduling refresher")
   (.scheduleAtFixedRate (Executors/newScheduledThreadPool 1)
-                             refresh 1 15 TimeUnit/MINUTES))
+                             refresh 1 5 TimeUnit/MINUTES))

 (defn destroy []
   (println "mafia-votecount is shutting down"))


added toast notification on successfull load

--- src/clojure/org/turtle/geometry/TurtleGraphics.clj
+++ src/clojure/org/turtle/geometry/TurtleGraphics.clj
@@ -654,16 +654,15 @@
                   (.getSupportFragmentManager this)
                   "confirm")
            true)
-         (save))
-
-       ;; (with-open [writer (BufferedWriter. (FileWriter. filename))]
-       ;;   (.write writer (.getText (program-source-editor @this))))
-       )
+         (save)))
      (= request-code intent-load-file)
      (let [uri (.getData data)
-           file (.getPath uri)]
+           filename (.getPath uri)]
        (.setText (program-source-editor @this)
-                 ^String (slurp file)))
+                 ^String (slurp filename))
+       (.show (Toast/makeText this
+                              (format "Loaded %s" filename)
+                              Toast/LENGTH_SHORT)))
      :else
      ;; ignore it
      nil)))


Check data

Check data

--- src/clj_simple_chart/eurostat/data/avia_par_no.clj
+++ src/clj_simple_chart/eurostat/data/avia_par_no.clj
@@ -113,6 +113,8 @@
                 (name)
                 (read-string)))

+(test/is (= 2016 max-year))
+
 (defn add-item [a b]
   (reduce (fn [o [k v]]
             (cond (number? v) (update o k #(+ (or % 0) v))


dissoc ::trace-type when untracing

dissoc ::trace-type when untracing

--- src/com/billpiel/sayid/trace.clj
+++ src/com/billpiel/sayid/trace.clj
@@ -134,16 +134,18 @@

 (defn untrace-var*
   ([ns s]
-     (untrace-var* (ns-resolve ns s)))
+   (untrace-var* (ns-resolve ns s)))
   ([v]
    (let [^clojure.lang.Var v (if (var? v) v (resolve v))
-           ns (.ns v)
-           s  (.sym v)
-           [_ f]  ((meta v) ::traced)]
-       (when f
-         (doto v
-           (alter-var-root (constantly f))
-           (alter-meta! dissoc ::traced))))))
+         ns (.ns v)
+         s  (.sym v)
+         [_ f]  ((meta v) ::traced)]
+     (when f
+       (doto v
+         (alter-var-root (constantly f))
+         (alter-meta! dissoc
+                      ::traced
+                      ::trace-type))))))

 (defn trace-var*
   [v tracer-fn workspace & {:keys [no-overwrite]}]


cleaned up the code a small bit

cleaned up the code a small bit

--- src/pixel_perversion_engine/process/processor.clj
+++ src/pixel_perversion_engine/process/processor.clj
@@ -14,10 +14,17 @@
         ;code 'code
         ;name 'name
         ]
-    `(defn ~name [~entity] (if (contains-keys? ~entity ~@required-keys)
-                             (let [{:keys [~@(map (fn [s] (symbol (apply str (rest (str s))))) required-keys)]} ~entity]
-                               ~code)
-                             ~entity))))
+    `(defn ~name
+       [~entity]
+       (if (contains-keys? ~entity ~@required-keys)
+         (let [{:keys [~@(map (fn [s] (->> (-> s
+                                               str
+                                               rest)
+                                           (apply str)
+                                           symbol))
+                              required-keys)]} ~entity]
+           ~code)
+         ~entity))))

 (comment (defmacro make-processor
   [name required-keys code]


Update alda

Update alda

--- resources/leiningen/new/audio/project.clj
+++ resources/leiningen/new/audio/project.clj
@@ -1,6 +1,6 @@
 (defproject {{app-name}} "0.0.1-SNAPSHOT"
   :description "FIXME: write description"
   :url "http://example.com/FIXME"
-  :dependencies [[alda "1.0.0-rc20"]
+  :dependencies [[alda "1.0.0-rc23"]
                  [org.clojure/clojure "1.8.0"]]
   :main {{namespace}})


add employment section.

add employment section.

--- app/src/cljs/app/res.cljs
+++ app/src/cljs/app/res.cljs
@@ -8,4 +8,8 @@
    :projects [{:title "ThemeCreator"
                :url "https://github.com/mswift42/themecreator"
                :image "images/tc1chrome.png"
-               :description "ThemeCreator lets you easily create beautiful color themes for IntelliJ Editors, Atom, Textmate and Emacs.\nThemeCreator is a Clojurescript app, built using the reagent framework."}]})
+               :description "ThemeCreator lets you easily create beautiful color themes for IntelliJ Editors, Atom, Textmate and Emacs.\nThemeCreator is a Clojurescript app, built using the reagent framework."}]
+   :employment [{:company "Pfeiffer & May GmbH + Co KG"
+                 :title "Head of Heating Department"
+                 :time "2008 - 2012"
+                 :description "Supervising of team members. Negotiating prices and special deals with suppliers and customers. Developing weekly promotions for heating products. Determining of prices and conditions for our supplying of goods for bigger projects. Training and teaching of apprentices. Marketing of products utilising renewable energy. Compiling annual reports and goals for the following year."}]})


Fixed led toggle

Fixed led toggle

--- src/chicken_coop/core.clj
+++ src/chicken_coop/core.clj
@@ -43,7 +43,7 @@

 (defn toggle!
   [pin]
-  (if (on? pin)
+  (if (off? pin)
     (on! pin)
     (off! pin)))


Switch hacker-paradise board to less guessable id

--- frontend/src/faceboard/whitelabel.cljs
+++ frontend/src/faceboard/whitelabel.cljs
@@ -7,7 +7,7 @@

 (def domain-mappings
   [[#"fb\.local.*" "test-localhost-whitelabel"]             ; just a test local host
-   [#".*hackerparadise\.org" "hp"]])                        ; http://faceboard.hackerparadise.org
+   [#".*hackerparadise\.org" "3a8450f9a0cb45d99c1a"]])      ; http://faceboard.hackerparadise.org

 (defn domain->boad-id [domain]
   (if-let [match (utils/find-first #(re-matches (first %) domain) domain-mappings)]


Convert some deftracks back to defns

Convert some deftracks back to defns

Proper fix coming for tracks re-running to often coming soon...


Use Google Closure function for events listening.

--- src/cljs/quil/sketch.cljs
+++ src/cljs/quil/sketch.cljs
@@ -1,7 +1,9 @@
 (ns quil.sketch
   (:require [quil.util :refer [no-fn resolve-constant-key]]
             [quil.middlewares.deprecated-options :refer [deprecated-options]]
-            [goog.dom :as dom])
+            [goog.dom :as dom]
+            [goog.events :as events]
+            [goog.events.EventType :as EventType])
   (:use-macros [quil.sketch :only [with-sketch]]
                [quil.util :only [generate-quil-constants]]))

@@ -91,12 +93,6 @@

 (def sketch-init-list (atom (list )))

-(defn add-js-event [event fun]
-  (if (.-addEventListener js/window)
-      (.addEventListener js/window event fun false)
-      (if (.-attachEvent js/window)
-          (.attachEvent js/window (str "on" event) fun))))
-
 (defn empty-body? []
   (let [child (.-childNodes (.-body js/document))]
     ; seems hacky, we should come up with better way of
@@ -118,4 +114,4 @@
 (defn add-sketch-to-init-list [sk]
   (swap! sketch-init-list conj sk))

-(add-js-event "load" init-sketches)
+(events/listenOnce js/window EventType/LOAD init-sketches)


Fixed very minor spelling in comments.

Fixed very minor spelling in comments.

--- src/clojush/translate.clj
+++ src/clojush/translate.clj
@@ -12,11 +12,11 @@
     (cond
       ; Check if reversed-prog is empty, in which case we are done
       (empty? reversed-prog) (vec (reverse new-prog))
-      ; Chech if done, which is if we've found the first :close, the paren-stack is empty, and the first item in reversed-prog is :open
+      ; Check if done, which is if we've found the first :close, the paren-stack is empty, and the first item in reversed-prog is :open
       (and found-first-close
            (zero? number-close-parens)
            (= :open (first reversed-prog))) (vec (reverse (concat new-prog (rest reversed-prog))))
-      ; Chech if looking for the correct :open but found an :open for a different paren
+      ; Check if looking for the correct :open but found an :open for a different paren
       (and found-first-close
            (< 0 number-close-parens)
            (= :open (first reversed-prog))) (recur (rest reversed-prog)


Moved some acl provider id retrieval to the transmit library.

--- src/cmr/acl/acl_cache.clj
+++ src/cmr/acl/acl_cache.clj
@@ -6,7 +6,6 @@
             [clj-time.core :as t]
             [cmr.common.jobs :refer [defjob]]
             [cmr.transmit.echo.acls :as echo-acls]
-            [cmr.transmit.echo.providers :as echo-providers]
             [cmr.common.log :as log :refer (debug info warn error)]
             [clojure.walk :as w]))

@@ -24,16 +23,6 @@
   [context]
   (get-in context [:system :acl-cache]))

-(defn- set-acl-provider-id
-  "Sets the provider-id in the acl to replace the provider guid"
-  [provider-guid-id-map acl]
-  (update-in acl
-             [:catalog-item-identity]
-             (fn [cii]
-               (-> cii
-                   (assoc :provider-id (provider-guid-id-map (:provider-guid cii)))
-                   (dissoc :provider-guid)))))
-
 (defn reset
   "Resets the cache back to it's initial state"
   [context]
@@ -46,11 +35,9 @@
   to keep the cache fresh. This will throw an exception if there is a problem fetching ACLs. The
   caller is responsible for catching and logging the exception."
   [context]
-  (let [acl-cache-atom (context->acl-cache context)
-        provider-guid-id-map (echo-providers/get-provider-guid-id-map context)
-        acls (mapv (partial set-acl-provider-id provider-guid-id-map)
-                   (echo-acls/get-acls-by-type context "CATALOG_ITEM"))]
-    (reset! acl-cache-atom {:acls acls :last-updated (t/now)})))
+  (let [acl-cache-atom (context->acl-cache context)]
+    (reset! acl-cache-atom {:acls (echo-acls/get-acls-by-type context "CATALOG_ITEM")
+                            :last-updated (t/now)})))

 (defn get-acls
   "Gets the current cached acls."


GR - wording in tests

GR - wording in tests

--- test/objective8/integration/api/up_down_votes.clj
+++ test/objective8/integration/api/up_down_votes.clj
@@ -18,7 +18,7 @@
                                (ih/truncate-tables)))
          (after :facts (ih/truncate-tables))]

-        (fact "Upvotes an answer" ;; Make this generic
+        (fact "A user can upvote an answer" ;; Make this generic
                      (let [{user-id :_id} (sh/store-a-user)
                            {global-id :global-id} (sh/store-an-answer)
                            {response :response} (p/request app (utils/path-for :api/post-up-down-vote)
@@ -30,7 +30,7 @@
                        (:status response) => 200))

-        (fact "A second vote on the same entity is not permitted"
+        (fact "A second vote by the same user on the same entity is not permitted"
               (let [{global-id :global-id created-by-id :created-by-id} (sh/store-an-answer)
                            {response :response} (-> app
                                                     (p/request (utils/path-for :api/post-up-down-vote)


CMR-1980: Start testing returning keywords hierarchically from keyword endpoint

--- search-app/src/cmr/search/api/keyword.clj
+++ search-app/src/cmr/search/api/keyword.clj
@@ -6,6 +6,7 @@
             [cmr.common-app.services.kms-fetcher :as kf]
             [cmr.transmit.kms :as kms]
             [cmr.common.mime-types :as mt]
+            [cmr.common.util :as util]
             [cmr.common.services.errors :as errors]
             [cmr.search.services.query-execution.facets-results-feature :as frf]))

@@ -26,6 +27,72 @@
 ;       (for [value all-values-for-subfield]
 ;         (parse-hierarchical-keywords keyword-scheme (rest keyword-hierarchy) keywords)))))

+
+;; Sample output
+
+(comment
+  ["0dd83b2a-e83f-4a0c-a1ff-2fbdbbcce62d"
+   {:uuid "0dd83b2a-e83f-4a0c-a1ff-2fbdbbcce62d",
+    :variable-level-1 "MOBILE GEOGRAPHIC INFORMATION SYSTEMS",
+    :term "GEOGRAPHIC INFORMATION SYSTEMS",
+    :topic "DATA ANALYSIS AND VISUALIZATION",
+    :category "EARTH SCIENCE SERVICES"}]
+
+  {:category [{:value "EARTH SCIENCE SERVICES"
+               :uuid "894f9116-ae3c-40b6-981d-5113de961710"
+               :subfields ["topic"]
+               :topic [{:value "DATA ANALYSIS AND VISUALIZATION"
+                        :uuid "41adc080-c182-4753-9666-435f8b1c913f"
+                        :subfields ["term"]
+                        :term [{:value "GEOGRAPHIC INFORMATION SYSTEMS"
+                                :uuid "794e3c3b-791f-44de-9ff3-358d8ed74733"
+                                :subfields ["variable-level-1"]
+                                :variable-level-1 [{:value "MOBILE GEOGRAPHIC INFORMATION SYSTEMS"
+                                                    :uuid "0dd83b2a-e83f-4a0c-a1ff-2fbdbbcce62d"
+                                                    }]}]}]}]}
+
+  (def keyword-hierarchy
+    [:category :topic :term :variable-level-1 :variable-level-2 :variable-level-3])
+
+  (def keywords
+    [{:uuid "0dd83b2a-e83f-4a0c-a1ff-2fbdbbcce62d",
+      :variable-level-1 "MOBILE GEOGRAPHIC INFORMATION SYSTEMS",
+      :term "GEOGRAPHIC INFORMATION SYSTEMS",
+      :topic "DATA ANALYSIS AND VISUALIZATION",
+      :category "EARTH SCIENCE SERVICES"}
+     {:uuid "894f9116-ae3c-40b6-981d-5113de961710",
+      :category "EARTH SCIENCE SERVICES"}
+     {:uuid "41adc080-c182-4753-9666-435f8b1c913f",
+      :topic "DATA ANALYSIS AND VISUALIZATION",
+      :category "EARTH SCIENCE SERVICES"}
+     {:uuid "e9f67a66-e9fc-435c-b720-ae32a2c3d8f5",
+      :category "EARTH SCIENCE"}])
+
+  {:category (map (fn [k-word] (util/remove-nil-keys {:value (:category k-word)
+                                                      :uuid (when-not (:topic k-word)
+                                                              (:uuid k-word))})) keywords)}
+
+  (let [all-categories (keep (fn [k-word] (when-not (:topic k-word)
+                                            {:value (:category k-word)
+                                             :uuid  (:uuid k-word)})) keywords)
+        all-topics (for [category all-categories
+                         :let [topics (keep (fn [k-word]
+                                              (when (and (nil? (:term k-word))
+                                                         (:topic k-word)
+                                                         (= (:value category) (:category k-word)))
+                                                {:value (:topic k-word)
+                                                 :uuid (:uuid k-word)})) keywords)]]
+                     (if (seq topics)
+                       (assoc category
+                              :subfields ["topic"]
+                              :topic topics)
+                       category))]
+    {:category all-topics})
+
+
+  (parse-hierarchical-keywords :science-keywords keyword-hierarchy keywords)
+ )
+
 (def keyword-api-routes
   (context "/keywords" []
     ;; Return a list of keywords for the given scheme


Use HTTP code 400 when operation was not successful

--- src/emender_jenkins/rest_api.clj
+++ src/emender_jenkins/rest_api.clj
@@ -53,6 +53,16 @@
         (-> (http-response/response (json/write-str response))
             (http-response/content-type "application/json"))))

+(defn send-error-response
+    [response request]
+    (if (config/pretty-print? request)
+        (-> (http-response/response (with-out-str (json/pprint response)))
+            (http-response/content-type "application/json")
+            (http-response/status 400))
+        (-> (http-response/response (json/write-str response))
+            (http-response/content-type "application/json")
+            (http-response/status 400))))
+
 (defn send-plain-response
     [response]
     (-> (http-response/response response)
@@ -114,7 +124,7 @@
                 (reload-job-list request)
                 (send-response request))
             (-> (job-does-not-exist-response job-name "start")
-                (send-response request)))))
+                (send-error-response request)))))

 (defn enable-job
     [request]
@@ -126,7 +136,7 @@
                 (reload-job-list request)
                 (send-response request))
             (-> (job-does-not-exist-response job-name "enable")
-                (send-response request)))))
+                (send-error-response request)))))

 (defn disable-job
     [request]
@@ -138,7 +148,7 @@
                 (reload-job-list request)
                 (send-response request))
             (-> (job-does-not-exist-response job-name "enable")
-                (send-response request)))))
+                (send-error-response request)))))

 (defn delete-job
     [request]
@@ -150,7 +160,7 @@
                 (reload-job-list request)
                 (send-response request))
             (-> (job-does-not-exist-response job-name "delete")
-                (send-response request)))))
+                (send-error-response request)))))

 (defn create-job
     [request]
@@ -169,7 +179,7 @@
                     (reload-job-list request)
                     (send-response request))
                 (-> (error-response (or job-name "not set!") "create" "invalid input")
-                    (send-response request))))))
+                    (send-error-response request))))))

 (defn uri->job-name
     [uri prefix]
@@ -205,9 +215,9 @@
                     ;(reload-job-list request)
                     (send-response request))
                 (-> (error-response (or job-name "not set!") "update" "invalid input")
-                    (send-response request)))
+                    (send-error-response request)))
             (-> (job-does-not-exist-response job-name "update")
-                (send-response request)))))
+                (send-error-response request)))))

 (defn get-jobs
     [request]
@@ -227,7 +237,7 @@
                      (-> (error-response job-name "get_job_results" "can not read test results")
                          (send-response request))))
             (-> (job-does-not-exist-response job-name "get_job_results")
-                (send-response request)))))
+                (send-error-response request)))))

 (defn job-started-handler
     [request]


improved variable names on exercices and add more specs

--- src/cljs/daveconservatoire/site/ui/exercices.cljs
+++ src/cljs/daveconservatoire/site/ui/exercices.cljs
@@ -11,6 +11,28 @@
 (s/def ::progress-total number?)
 (s/def ::react-component object?)

+(s/def ::description string?)
+(s/def ::option (s/cat :value string? :label string?))
+(s/def ::options (s/+ (s/spec ::option)))
+
+(s/def ::ex-props (s/keys :req [::description ::options]))
+(s/def ::ex-answer (s/nilable string?))
+(s/def ::ex-total-questions pos-int?)
+(s/def ::streak-count nat-int?)
+
+(s/def ::value-descriptor
+  (s/or :sound ::audio/sound
+        :range (s/and (s/tuple ::audio/sound #{".."} ::audio/sound)
+                      (fn [[[_ a] _ [_ b] :as t]]
+                        (if (< (audio/note->semitone a)
+                               (audio/note->semitone b))
+                          t
+                          false)))
+        :list (s/coll-of ::audio/sound [])))
+
+(s/def ::pitch ::value-descriptor)
+(s/def ::variation pos-int?)
+
 (om/defui ^:once ProgressBar
   Object
   (render [this]
@@ -26,17 +48,11 @@
   :args (s/cat :props (s/keys :opt [::progress-total ::progress-value])
                :children (s/* ::react-component)))

-(s/def ::description string?)
-(s/def ::option (s/cat :value string? :label string?))
-(s/def ::options (s/+ (s/spec ::option)))
-
-(s/def ::ex-props (s/keys :req [::description ::options]))
-
 (defn play-notes [notes]
   (let [nodes (->> notes
                    (into [] (map (fn [s]
                                    {::audio/node-gen (->> s audio/semitone->note (get @audio/*sound-library*))}))))]
-    (audio/play-regular-sequence nodes {::audio/time (audio/current-time)
+    (audio/play-regular-sequence nodes {::audio/time     (audio/current-time)
                                         ::audio/interval 2})))

 (defn play-sound [c] (play-notes (-> (om/props c) ::notes)))
@@ -47,18 +63,18 @@
   (om/transact! component `[(ui/set-props ~props)]))

 (defn check-answer [c]
-  (let [{:keys [ui/ex-answer ::correct-answer ui/correct-count]} (om/props c)]
+  (let [{:keys [daveconservatoire.site.ui.exercices/ex-answer ::correct-answer daveconservatoire.site.ui.exercices/streak-count]} (om/props c)]
     (if (= ex-answer correct-answer)
       (do
         (merge-props! c
-          (merge {:ui/correct-count (inc correct-count)
-                  :ui/ex-answer nil})))
-      (um/set-value! c :ui/correct-count 0))))
+          (merge {::streak-count (inc streak-count)
+                  ::ex-answer    nil})))
+      (um/set-value! c ::streak-count 0))))

 (defn render-ex [c]
-  (let [{:keys [::description ::options :ui/ex-answer
-                :ui/ex-total-questions :ui/correct-count] :as props} (om/props c)]
-    (assert (s/valid? ::ex-props props))
+  (let [{:keys [::description ::options ::ex-answer
+                ::ex-total-questions ::streak-count] :as props} (om/props c)]
+    (assert (s/valid? ::ex-props props) (s/explain-str ::ex-props props))
     (dom/div #js {:className "lesson-content"}
       (dom/div #js {:className "single-exercise visited-no-recolor"
                     :style     #js {:overflow "hidden" :visibility "visible"}}
@@ -69,7 +85,7 @@
               (dom/div #js {:className "current-card-container card-type-problem"}
                 (dom/div #js {:className "current-card-container-inner vertical-shadow"}
                   (dom/div #js {:className "current-card-contents"}
-                    (progress-bar {::progress-value correct-count
+                    (progress-bar {::progress-value streak-count
                                    ::progress-total ex-total-questions})
                     (dom/div #js {:id "problem-and-answer" :className "framework-khan-exercises"}
                       (dom/div #js {:id "problemarea"}
@@ -79,7 +95,7 @@
                               (dom/p nil
                                 description)
                               (dom/a #js {:className "btn_primary"
-                                          :onClick #(play-sound c)}
+                                          :onClick   #(play-sound c)}
                                 "Play Again"))))
                         (dom/div #js {:id "hintsarea"}))
                       (dom/div #js {:id "answer_area_wrap"}
@@ -96,25 +112,16 @@
                                         (dom/input #js {:type     "radio" :name "exercice-answer"
                                                         :checked  (= ex-answer value)
                                                         :value    value
-                                                        :onChange #(um/set-string! c :ui/ex-answer :event %)})
+                                                        :onChange #(um/set-string! c ::ex-answer :event %)})
                                         (dom/span #js {:className "value"} label))))))
                               (dom/div #js {:className "answer-buttons"}
                                 (dom/div #js {:className "check-answer-wrapper"}
                                   (dom/input #js {:className "simple-button green" :type "button" :value "Check Answer"
-                                                  :onClick #(check-answer c)}))
+                                                  :onClick   #(check-answer c)}))
                                 (dom/input #js {:className "simple-button green" :id "next-question-button" :name "correctnextbutton" :style #js {:display "none"} :type "button" :value "Correct! Next Question..."})
                                 (dom/div #js {:id "positive-reinforcement" :style #js {:display "none"}}
                                   (dom/img #js {:src "/images/face-smiley.png"})))))))
                       (dom/div #js {:style #js {:clear "both"}}))))))))))))
-
-(s/def ::value-descriptor (s/or :sound ::audio/sound
-                                :range (s/and (s/tuple ::audio/sound #{".."} ::audio/sound)
-                                              (fn [[[_ a] _ [_ b] :as t]]
-                                                (if (< (audio/note->semitone a)
-                                                       (audio/note->semitone b))
-                                                  t
-                                                  false)))
-                                :list (s/coll-of ::audio/sound [])))

 (defn int-in [min max] (+ min (rand-int (- max min))))

@@ -134,16 +141,16 @@

 (om/defui ^:once Exercice
   static uc/InitialAppState
-  (initial-state [_ _] {:ui/ex-answer nil
-                        :ui/ex-total-questions 10
-                        :ui/correct-count 0})
+  (initial-state [_ _] {::ex-answer          nil
+                        ::ex-total-questions 10
+                        ::streak-count       0})

   static om/IQuery
-  (query [_] [::description ::options ::notes ::correct-answer :parent
-              :ui/ex-answer :ui/ex-total-questions :ui/correct-count])
+  (query [_] [::description ::options ::notes ::correct-answer ::parent
+              ::ex-answer ::ex-total-questions ::streak-count])

   static om/Ident
-  (ident [_ props] (om/ident (:parent props) props))
+  (ident [_ props] (om/ident (::parent props) props))

   Object
   (render [this]
@@ -167,9 +174,6 @@
     (assoc props
       ::notes notes
       ::correct-answer (if (< a b) "higher" "lower"))))
-
-(s/def ::pitch ::value-descriptor)
-(s/def ::variation int?)

 (om/defui ^:once PitchDetection
   static uc/InitialAppState
@@ -181,7 +185,7 @@
          ::options     [["lower" "Lower"] ["higher" "Higher"]]
          ::pitch       ["C3" ".." "B5"]
          ::variation   24
-         :parent       this})))
+         ::parent      this})))

   static om/Ident
   (ident [_ props] [:exercice/by-name "pitch"])


dockerhub form -> public support

dockerhub form -> public support

--- src/cljs/swarmpit/component/dockerhub/create.cljs
+++ src/cljs/swarmpit/component/dockerhub/create.cljs
@@ -36,6 +36,14 @@
        :onChange (fn [_ v]
                    (state/update-value [:password] v cursor))})))

+(defn- form-public [value]
+  (comp/form-comp
+    "PUBLIC"
+    (comp/form-checkbox
+      {:checked value
+       :onCheck (fn [_ v]
+                  (state/update-value [:public] v cursor))})))
+
 (defn- add-user-handler
   []
   (handler/post
@@ -54,6 +62,7 @@
   []
   (state/set-value {:username ""
                     :password ""
+                    :public   false
                     :isValid  false} cursor))

 (def init-state-mixin
@@ -65,6 +74,7 @@
                  init-state-mixin []
   (let [{:keys [username
                 password
+                public
                 isValid]} (state/react cursor)]
     [:div
      [:div.form-panel
@@ -82,4 +92,5 @@
         {:onValid   #(state/update-value [:isValid] true cursor)
          :onInvalid #(state/update-value [:isValid] false cursor)}
         (form-username username)
-        (form-password password))]]))+        (form-password password)
+        (form-public public))]]))


Improve docstrings

Improve docstrings

--- src/re_frame/core.cljc
+++ src/re_frame/core.cljc
@@ -267,27 +267,29 @@
    (subs/subscribe query dynv)))

 (defn clear-sub ;; think unreg-sub
-  "When called with no args, unregisters all subscription handlers.
-
-  When given
-  one arg, assumed to be a `query-id` of a registered subscription handler,
-  unregisters the associated handler.
-
-  NOTE: Depending on the usecase it may also be necessary to call
-         `clear-subscription-cache!`.
-  "
+  "Unregisters subscription handlers (presumably registered previously via the use of `reg-sub`).
+
+  When called with no args, it will unregister all currently registered subscription handlers.
+
+  When given one arg, assumed to be the `id` of a previously registered
+  subscription handler, it will unregister the associated handler. Will produce a warning to
+  console if it finds no matching registration.
+
+  NOTE: Depending on the usecase, it may be necessary to call `clear-subscription-cache!` afterwards"
   ([]
    (registrar/clear-handlers subs/kind))
   ([query-id]
    (registrar/clear-handlers subs/kind query-id)))

+
 (defn clear-subscription-cache!
   "Removes all subscriptions from the cache.

-  For use at development time or test time. Useful when hot realoding reloading
-  to subscription handler code or after a React/render exception, because React components won't have been
-  cleaned up properly. And this, in turn, means the subscriptions within those
-  components won't have been cleaned up correctly. So this forces the issue.
+  This function can be used at development time or test time. Useful when hot realoding
+  namespaces containing subscription handlers. Also call it after a React/render exception,
+  because React components won't have been cleaned up properly. And this, in turn, means
+  the subscriptions within those components won't have been cleaned up correctly. So this
+  forces the issue.
   "
   []
   (subs/clear-subscription-cache!))
@@ -296,7 +298,7 @@
   "This is a low level, advanced function.  You should probably be
   using `reg-sub` instead.

-  Some docs are available in
+  Some explanation is available in the docs at
   http://day8.github.io/re-frame/flow-mechanics/"
   [query-id handler-fn]
   (registrar/register-handler subs/kind query-id handler-fn))
@@ -329,10 +331,13 @@

 (defn clear-fx ;; think unreg-fx
-  "When called with no args, unregisters all effect handlers.
+  "Unregisters effect handlers (presumably registered previously via the use of `reg-fx`).
+
+  When called with no args, it will unregister all currently registered effect handlers.

   When given one arg, assumed to be the `id` of a previously registered
-  effect handler, unregisters the associated handler.
+  effect handler, it will unregister the associated handler. Will produce a warning to
+  console if it finds no matching registration.
   "
   ([]
    (registrar/clear-handlers fx/kind))
@@ -415,9 +420,13 @@
    (cofx/inject-cofx id value)))

 (defn clear-cofx ;; think unreg-cofx
-  "When called with no args, unregisters all coeffect handlers. When given one arg,
-   assumed to be the `id` of a registered coeffect handler, unregisters the
-   associated handler."
+  "Unregisters coeffect handlers (presumably registered previously via the use of `reg-cofx`).
+
+  When called with no args, it will unregister all currently registered coeffect handlers.
+
+  When given one arg, assumed to be the `id` of a previously registered
+  coeffect handler, it will unregister the associated handler. Will produce a warning to
+  console if it finds no matching registration."
   ([]
    (registrar/clear-handlers cofx/kind))
   ([id]
@@ -473,11 +482,14 @@
   ([id interceptors handler]
    (events/register id [cofx/inject-db fx/do-fx std-interceptors/inject-global-interceptors interceptors (ctx-handler->interceptor handler)])))

-(defn clear-event ;; think unreg-event-*
-  "When called with no args, unregisters all event handlers.
-
-  When given one argument, assumed to be the `id` of a previously registered
-  event handler, unregisters the associated handler."
+(defn clear-event
+  "Unregisters event handlers (presumably registered previously via the use of `reg-event-db` or `reg-event-fx`).
+
+  When called with no args, it will unregister all currently registered event handlers.
+
+  When given one arg, assumed to be the `id` of a previously registered
+  event handler, it will unregister the associated handler. Will produce a warning to
+  console if it finds no matching registration."
   ([]
    (registrar/clear-handlers events/kind))
   ([id]
@@ -669,14 +681,14 @@
   [interceptor]
   (settings/reg-global-interceptor interceptor))

-(defn clear-global-interceptor ;; think unreg-global-interceptor
-  "Unregisters (removes) global interceptors.
-
-   When called with no arguments, it unregisters all global interceptors.
-
-   When given
-   one argument, assumed to be the `id` of a currently registered global
-   interceptor, it removes the associated interceptor."
+(defn clear-global-interceptor
+  "Unregisters global interceptors (presumably registered previously via the use of `reg-global-interceptor`).
+
+  When called with no args, it will unregister all currently registered global interceptors.
+
+  When given one arg, assumed to be the `id` of a previously registered
+  global interceptors, it will unregister the associated interceptor. Will produce a warning to
+  console if it finds no matching registration."
   ([]
    (settings/clear-global-interceptors))
   ([id]
@@ -697,12 +709,24 @@
       (def my-interceptor
         (->interceptor
          :id     :my-interceptor
-         :before (fn [context]            ;; you normally want to change :coeffects
-                   ... in here use get-coeffect  and assoc-coeffect)
-         :after  (fn [context]                         ;; you normally want to change :effects
-                   (let [db (get-effect context :db)]  ;; (get-in context [:effects :db])
-                     (assoc-effect context :http-ajax {...}])))))
-  "
+         :before (fn [context]
+                   ... modifies and returns `context`)
+         :after  (fn [context]
+                   ... modifies and returns `context`)))
+
+  Notes:
+    - `:before` functions modify and return their `context` argument. Unless they
+      side effect, in which case, they'll perform the side effect and return
+      `context` unchanged.
+    - `:before` fucntions often modify the `:coeffects` map with `context` and,
+      if they do, then they  should use the utility functions `get-coeffect` and
+      `assoc-coeffect`.
+    - `:after` functions modify and return their `context` argument. Unless they
+      side effect, in which case, they'll perform the side effect and return
+      `context` unchanged.
+    - `:after` functions often modify the `:effects` map with `context` and,
+      if they do, then they  should use the utility functions `get-effect`
+      and `assoc-effect`"
   [& {:as m :keys [id before after]}]
   (utils/apply-kw interceptor/->interceptor m))

@@ -766,16 +790,18 @@
 ;; --  logging ----------------------------------------------------------------

 (defn set-loggers!
-  "Internally, re-frame outputs warnings, errors etc via logging functions: `warn`, `log`, `error`, `group` and `groupEnd`
-
-  By default, these functions map directly to their default `js/console` implementations,
-  but you can override that with your own functions (set or subset).
-
-  `new-loggers` should be a map containing a subset of they keys for the standard `loggers`.
+  "re-frame outputs warnings and errors via the API function `console`
+   which, by default, delegates to `js/console`'s default implementation for
+  `log, `error`, `warn` `debug` `group` `groupEnd`. But, using this function,
+   you can override that behaviour with your own functions.
+
+  The argument `new-loggers` should be a map containing a subset of they keys
+  for the standard `loggers`, namely  `:log` `:error` `:warn` `:debug` `:group`
+  or `:groupEnd`.

   Example Usage:

-      (defn my-logger      ;; here is my alternative logging function
+      (defn my-logger      ;; my alternative logging function
         [& args]
         (post-it-somewhere (apply str args)))

@@ -787,10 +813,12 @@

 (defn console
-  "A utility logging function to be used by libraries which
-  extend re-frame, like perhaps an effect handler.
-
-  It will write the given `args` to js/console at the given log `level`.
+  "A utility logging function which is used internally within re-frame to produce
+  warnings and other output. It can also be used by libraries which
+  extend re-frame, such as effect handlers.
+
+  By default, it will output the given `args` to `js/console` at the given log `level`.
+  However, an application using re-frame can redirect `console` output via `set-loggers!`.

   `level` can be one of `:log` `:error` `:warn` `:debug` `:group` `:groupEnd`.

@@ -798,7 +826,7 @@

       (console :error \"Oh, dear God, it happened:\" a-var \"and\" another)
       (console :warn \"Possible breach of containment wall at:\" dt)
-   "
+  "
   [level & args]
   (apply loggers/console (into [level] args)))

@@ -840,7 +868,7 @@
 ;; -- Event Processing Callbacks  ---------------------------------------------

 (defn add-post-event-callback
-  "Registers a function `f` to be called after each event is processed.
+  "Registers the given function `f` to be called after each event is processed.

    `f` will be called with two arguments:

@@ -877,12 +905,12 @@
   "Deprecated. Use `reg-event-db` instead."
   {:deprecated "0.8.0"}
   [& args]
-  (console :warn  "re-frame:  \"register-handler\" has been renamed \"reg-event-db\" (look for registration of " (str (first args)) ")")
+  (console :warn  "re-frame: \"register-handler\" has been renamed \"reg-event-db\" (look for registration of " (str (first args)) ")")
   (apply reg-event-db args))

 (defn register-sub
   "Deprecated. Use `reg-sub-raw` instead."
   {:deprecated "0.8.0"}
   [& args]
-  (console :warn  "re-frame:  \"register-sub\" is deprecated. Use \"reg-sub-raw\" (look for registration of " (str (first args)) ")")
+  (console :warn  "re-frame: \"register-sub\" is used to register the event " (str (first args)) " but it is a deprecated part of the API. Please use \"reg-sub-raw\" instead.")
   (apply reg-sub-raw args))


filter-view-callback and select-view-callback

--- src/er_cassandra/model/types.clj
+++ src/er_cassandra/model/types.clj
@@ -180,7 +180,14 @@
        (assoc r updated-at-col (.toDate (t/now)))
        r))))

-(defn create-view-callback
+(defn create-select-view-callback
+  "selects the given columns from a record"
   [cols]
   (fn [r]
     (select-keys r cols)))
+
+(defn create-filter-view-callback
+  "filers the given columns from a record"
+  [cols]
+  (fn [r]
+    (apply dissoc r cols)))


Fix typo

Fix typo

--- scheduler/src/cook/mesos/scheduler.clj
+++ scheduler/src/cook/mesos/scheduler.clj
@@ -394,8 +394,8 @@
        reverse))

 (timers/deftimer [cook-mesos scheduler handle-resource-offer!-duration])
-(timers/deftimer [cook-mesos scheduler handler-resource-offer!-transact-task-duration])
-(timers/deftimer [cook-mesos scheduler handler-resource-offer!-match-duration])
+(timers/deftimer [cook-mesos scheduler handle-resource-offer!-transact-task-duration])
+(timers/deftimer [cook-mesos scheduler handle-resource-offer!-match-duration])
 (meters/defmeter [cook-mesos scheduler pending-job-atom-contended])
 (histograms/defhistogram [cook-mesos scheduler offer-size-mem])
 (histograms/defhistogram [cook-mesos scheduler offer-size-cpus])


CMR-5248: Fixed failing test.

CMR-5248: Fixed failing test.

--- access-control-app/int-test/cmr/access_control/int_test/permission_check_test.clj
+++ access-control-app/int-test/cmr/access_control/int_test/permission_check_test.clj
@@ -158,7 +158,7 @@
                                        :provider_id "PROV1"}})
             (catch Exception e
               (is (= true
-                     (string/includes?  e "{:errors [\"Invalid revision-id [invalid]. Cmr-Revision-id in the header must be a positive integer.\"]}")))))
+                     (string/includes?  e "{:type :invalid-data, :errors [\"Invalid revision-id [invalid]. Cmr-Revision-id in the header must be a positive integer.\"]}")))))

           ;; conflict revision-id: The previous test already updates the acl to revision 2,
           (try


Update link to API info, to point to the repo

--- src/ctia/http/handler.clj
+++ src/ctia/http/handler.clj
@@ -89,7 +89,7 @@
                            :license {:name "All Rights Reserved",
                                      :url ""}
                            :contact {:name "Cisco Security Business Group -- Advanced Threat "
-                                     :url "http://intel.threatgrid.cisco.com/support"
+                                     :url "http://github.com/threatgrid/ctia"
                                      :email "cisco-intel-api-support@cisco.com"}
                            :description api-description}
                     :tags [{:name "threat", :description "Threat Intelligence"}]}}}


more logging

more logging

--- src/babel/forest.cljc
+++ src/babel/forest.cljc
@@ -216,9 +216,9 @@
               (filter (fn [result]
                         (not (fail? result)))
                       (map (fn [complement]
-                             (let [debug (log/debug (str "add complement ["
-                                                         (get-in bolt [:rule]) " "
-                                                         (morph bolt) "]: trying lexical complement:" (morph complement)))
+                             (let [debug (log/debug (str "add complement to ["
+                                                         (get-in immediate-parent [:rule]) " "
+                                                         (morph immediate-parent) "]: trying lexical complement:" (morph complement)))
                                    result
                                    (unify (copy bolt)
                                           (path-to-map path
@@ -228,7 +228,7 @@
                                  (let [fail-path (fail-path-between (strip-refs (get-in bolt path))
                                                                     (strip-refs complement))]
                                    (log/debug (str "fail-path-between(bolt=val1/comp=val2):" fail-path)))
-                                 (log/debug (str "Success: returning: " (morph result))))
+                                 (log/debug (str "success:" (:rule result) " returning: " (morph result))))

                                (if is-fail? :fail result)))


Only display title when there is one.

Only display title when there is one.

--- src/incise/layouts/impl/base.clj
+++ src/incise/layouts/impl/base.clj
@@ -4,6 +4,7 @@
                                           deflayout
                                           defpartial]])
             [stefon.core :refer [link-to-asset]]
+            [clojure.string :as s]
             [incise.config :as conf]
             (hiccup [core :refer :all]
                     [util :refer [with-base-url]]
@@ -50,7 +51,8 @@
   (with-base-url (when-not (conf/serving?) (str \/ (conf/get :uri-root)))
     (html5
       [:head
-       [:title (str site-title (when title (str " - " title)))]
+       (when (or site-title title)
+         [:title (s/join " - " (keep identity [site-title title]))])
        [:meta {:charset "UTF-8"}]
        [:meta {:name "viewport" :content "width=device-width, initial-scale=1.0"}]
        (apply include-css (remove nil? (stylesheets)))]


Define content partial in page layout.

Define content partial in page layout.

Dispatch content in parse to eval-with-context if it is a list.

--- src/incise/layouts/impl/page.clj
+++ src/incise/layouts/impl/page.clj
@@ -1,11 +1,13 @@
 (ns incise.layouts.impl.page
   (:require (incise.layouts [core :refer [register]]
-                            [html :refer [deflayout defpartial]])
+                            [html :refer [eval-with-context
+                                          deflayout
+                                          defpartial]])
             [stefon.core :refer [link-to-asset]]
-            (hiccup [def :refer :all]
+            (hiccup [core :refer :all]
+                    [def :refer :all]
                     [page :refer :all]
-                    [element :refer :all]
-                    [core :refer :all]))
+                    [element :refer :all]))
   (:import [java.io FileNotFoundException]))

 (defpartial header
@@ -14,9 +16,16 @@
   [:header
    [:h1#site-title (link-to "/" site-title)]])

+(defpartial content
+  "A very basic content partial."
+  [_ {:keys [content]}]
+  (condp #(%1 %2) content
+    list? (eval-with-context content)
+    content))
+
 (defpartial footer
   "A very basic footer crediting this project."
-  [_ {:keys [contacts author]}]
+  [{:keys [contacts author]} _]
   [:footer
    [:p
     "This website was "
@@ -37,6 +46,7 @@

 (deflayout page
   "The default page/post layout."
+  [{:keys [site-title]} {:keys [title]}]
   [:head
    [:title (str site-title (when title (str " - " title)))]
    [:meta {:name "viewport"
@@ -45,7 +55,7 @@
   [:body#page
    [:div.container
     (header)
-    [:div#content content]
+    [:div#content (content)]
     (footer)]
    (apply include-js (remove nil? (javascripts)))])


Loading run and config at init time,

Loading run and config at init time,

--- backend/src/circle/init.clj
+++ backend/src/circle/init.clj
@@ -5,6 +5,8 @@
   (:require circle.repl)
   (:require circle.logging)
   (:require circle.util.chdir)
+  (:require circle.backend.build.run)
+  (:require circle.backend.build.config)
   (:require fs))

 (defn maybe-change-dir


Minor syntax error... hrm

Minor syntax error... hrm

--- src/sdos_site/core.clj
+++ src/sdos_site/core.clj
@@ -113,12 +113,12 @@
 (defn rss
   [req]
   (let [db (:db req)
-        articles (art/find-all-articles db)])
-  (apply rss/channel-xml
-         {:title "Sauerbraten Day of Sobriety"
-          :link base-url
-          :description "A Sauerbraten Tournament"}
-         (map rss-item articles)))
+        articles (find-all-articles db)]
+    (apply rss/channel-xml
+           {:title "Sauerbraten Day of Sobriety"
+            :link base-url
+            :description "A Sauerbraten Tournament"}
+           (map rss-item articles))))

 (defn show-article
   [req]


comment out main

comment out main

--- src/atom_finder/core.clj
+++ src/atom_finder/core.clj
@@ -22,8 +22,8 @@
   ;     (take 10)
   ;     dorun)

-  ; 2017-03-26 01:00)
-  (time (atom-patch/log-atoms-changed-all-commits "gcc-bugs-atoms_2017-03-26.txt" gcc-repo atoms))
+  ; 2017-03-26 02:50)
+  ;(time (log-atoms-changed-all-commits "gcc-bugs-atoms_2017-03-26.txt" gcc-repo atoms))
 )

 ;(->> "macro-operator-precedence_redis_2017-03-10_1.edn"


abandon gen-class

abandon gen-class

--- src/atom_finder/core.clj
+++ src/atom_finder/core.clj
@@ -8,8 +8,14 @@
   [filename]
   (FileContent/createForExternalFileLocation filename))

-(defn translation-unit
-  [filename]
+;; (defn compilation-unit [filename]
+;;   (let [parser (ASTParser/newParser AST/JLS3)
+;;         source (file-content filename)]
+;;     (.setSource parser source)
+;;     (.setKind parser ASTParser/K_COMPILATION_UNIT)
+;;     (.createAST parser null)))
+
+(defn translation-unit [filename]
   (let [definedSymbols {}
         includePaths (make-array String 0)
         info (new ScannerInfo definedSymbols includePaths)
@@ -25,19 +31,34 @@
   [filename]
     (.getIncludeDirectives (translation-unit filename)))

-;; (defn ast-visitor []
-;;   (reify ASTVisitor
-;;     (visit [this name]
-;;       (printf "name: %s\n" name))))
-
 (defmacro set-all! [obj m]
     `(do ~@(map (fn [e] `(set! (. ~obj ~(key e)) ~(val e))) m) ~obj))

-(defn ast-visitor []
+(gen-class :name atom-finder.core.AtomVisitor
+           :prefix "av-"
+           :extends ASTVisitor)
+
+(defn av-visit [name] (printf "name1: %s\n" name) true)
+
+;;(atom-finder.core.AtomVisitor.)
+
+;; (defn ast-visitor-gen-class []
+;;
+;;   (atom-finder.core/set-all! (atom-finder.AtomVisitor.) {
+;;             shouldVisitNames        true
+;;             shouldVisitDeclarations false
+;;             shouldVisitDeclarators  true
+;;             shouldVisitAttributes   true
+;;             shouldVisitStatements   false
+;;             shouldVisitTypeIds      true})
+;;   )
+
+(defn ast-visitor-proxy []
   (->
    (proxy [ASTVisitor] []
-    (visit [name]
-      (printf "name: %s\n" name) 3))
+    (visit [name] (printf "name1: %s\n" name) true)
+    (endVisit [name] (printf "name2: %s\n" name))
+    )

     (set-all! {shouldVisitNames        true
                shouldVisitDeclarations false
@@ -46,10 +67,13 @@
                shouldVisitStatements   false
                shouldVisitTypeIds      true})))

-(defn file-ast
+(defn visit-ast
   [filename]
-  (let [visitor (ast-visitor)]
-    (.accept (translation-unit filename) visitor)))
+  (let [visitor (ast-visitor-proxy)
+        node (translation-unit filename)]
+    (.accept node visitor)
+    ;;(.startVisit visitor node)
+    ))

 (defn print-tree [node index]
   (let [children (.getChildren node)
@@ -77,7 +101,7 @@
   (prn (file-content filename))
   (for [incld (file-includes filename)] (printf "include - %s\n" (.getName incld)))

-  (file-ast filename)
-  (ast-visitor)
+  (visit-ast filename)
+  (ast-visitor-proxy)
   (print-tree (translation-unit filename) 1)
   )


Fix summary hiding.

Fix summary hiding.

It is the actual collection containing the measurement data I'm
interested in not the collection containing collections of measurement
data.

--- src-cljs/kixi/hecuba/tabs/programmes.cljs
+++ src-cljs/kixi/hecuba/tabs/programmes.cljs
@@ -515,7 +515,7 @@
             series-1-count (count series-1)
             series-1-mean (if (not= 0 series-1-count) (/ series-1-sum series-1-count) "NA")]
         (html
-         (if (seq measurements)
+         (if (seq series-1)
            [:div.row#summary-stats
             [:div {:class "col-md-3"}
              (bs/panel "Minimum" (str (.toFixed (js/Number. series-1-min) 3) " " unit))]


add testing for the endpoint-pattern-match?

endpoint-pattern-match? is where we expand wildcards.  It was tested indirectly
via find-clients-test but it's worth having explicit testing here.

--- test/puppetlabs/cthun/inventory/in_memory_test.clj
+++ test/puppetlabs/cthun/inventory/in_memory_test.clj
@@ -1,6 +1,19 @@
 (ns puppetlabs.cthun.inventory.in-memory-test
   (require [clojure.test :refer :all]
            [puppetlabs.cthun.inventory.in-memory :refer :all]))
+
+(deftest endpoint-pattern-match?-test
+  (testing "direct matches"
+    (is (endpoint-pattern-match? "cth://pies/agent" "cth://pies/agent"))
+    (is (endpoint-pattern-match? "cth://pies/agent/extra" "cth://pies/agent"))
+    (is (endpoint-pattern-match? "cth://pies/agent/extra_here" "cth://pies/agent/extra_there"))
+    (is (not (endpoint-pattern-match? "cth://pies/agent" "cth://sheep/agent"))))
+  (testing "it can match on a pattern"
+    (is (endpoint-pattern-match? "cth://*/agent" "cth://pies/agent"))
+    (is (endpoint-pattern-match? "cth://pies/*" "cth://pies/agent")))
+  (testing "patterns only on the lhs"
+    (is (not (endpoint-pattern-match? "cth://pies/agent" "cth://*/agent")))
+    (is (not (endpoint-pattern-match? "cth://pies/agent" "cth://pies/*")))))

 (deftest find-clients-test
   (let [clients (atom #{ "cth://bill/agent"


Session view models work properly.

Session view models work properly.

--- src/shale/sessions.clj
+++ src/shale/sessions.clj
@@ -1,18 +1,19 @@
 (ns shale.sessions
   (:require [clj-webdriver.remote.driver :as remote-webdriver]
             [taoensso.carmine :as car :refer (wcar)])
-  (:use [shale.webdriver :only [new-webdriver resume-webdriver to-async]]))
+  (:use [shale.webdriver :only [new-webdriver resume-webdriver to-async]]
+        clojure.walk))

 (def redis-conn  {:pool {} :spec {}})
 (defmacro with-car*  [& body] `(car/wcar redis-conn ~@body))

 (def redis-key-prefix "_shale")
 (def session-set-key
-  (str (interpose "/" [redis-key-prefix "sessions"])))
+  (apply str (interpose "/" [redis-key-prefix "sessions"])))
 (def session-key-template
-  (str (interpose "/" [redis-key-prefix "sessions" "%s"])))
+  (apply str (interpose "/" [redis-key-prefix "sessions" "%s"])))
 (def session-tags-key-template
-  (str (interpose "/" [redis-key-prefix "session" "%s" "tags"])))
+  (apply str (interpose "/" [redis-key-prefix "session" "%s" "tags"])))

 (defn get-node []
   "http://localhost:5555/wd/hub")
@@ -29,15 +30,19 @@
                               current-url]
                        :or {browser-name "firefox"
                             node nil
-                            reserved nil
-                            tags nil
+                            reserved false
+                            tags []
                             extra-desired-capabilities nil
                             reserve-after-create nil
                             force-create nil
                             current-url nil}
                        :as requirements}]
   (with-car*
-    (def defaulted-reqs {})
+    (def defaulted-reqs
+      (assoc
+        (select-keys requirements [:browser-name :reserved :tags])
+        :node
+        (or node (get-node))))
     (def capabilities (merge {"browserName" browser-name}
                              extra-desired-capabilities))
     (def wd (new-webdriver (get-node) capabilities))
@@ -49,7 +54,7 @@
     (def session-tags-key (format session-tags-key-template session-id))

     (doall
-      (map (partial car/hset session-key)
+      (map #(car/hset session-key (key %1) (val %1))
            (select-keys defaulted-reqs
                         [:browser-name :node :reserved :current-url])))
     (car/del session-tags-key)
@@ -57,13 +62,21 @@
   (view-model session-id))

 (defn view-model [session-id]
+  (let [[contents tags]
+        (subvec
+          (with-car*
+            (let [session-key (format session-key-template session-id)
+                  session-tags-key (format session-tags-key session-id)]
+              (car/watch session-key)
+              (car/watch session-tags-key)
+              (if (car/exists session-key)
+                (do
+                  (car/hgetall session-key)
+                  (car/smembers session-tags-key))
+                nil))) 3 5)]
+    (assoc (keywordize-keys (apply hash-map contents)) :tags tags)))
+
+(defn view-models [session-ids]
   (with-car*
-    (def session-key (format session-key-template session-id))
-    (def session-tags-key (format session-tags-key session-id))
-    (car/watch session-key)
-    (car/watch session-tags-key)
-    (if (car/exists session-key)
-      (merge
-        {:id session-id :tags (car/smembers session-tags-key)}
-        (car/hgetall session-key))
-      nil)))
+    (let [session-ids (or session-ids (car/smembers session-set-key))]
+      (map view-model session-ids))))


The world-lane now uses world-cmd-loop.

The world-lane now uses world-cmd-loop.

--- src/cbfg/world-lane.cljs
+++ src/cbfg/world-lane.cljs
@@ -1,12 +1,11 @@
 (ns cbfg.world-lane
-  (:require-macros [cbfg.ago :refer [ago-loop achan-buf aalts aput]])
+  (:require-macros [cbfg.ago :refer [achan-buf]])
   (:require [cljs.core.async :refer [chan]]
             [cbfg.vis :refer [vis-init get-el-value]]
             [cbfg.fence :refer [make-fenced-pump]]
             [cbfg.lane :refer [make-lane-pump]]
             [cbfg.lane-test]
-            [cbfg.world-base :refer [replay-cmd-ch world-replay
-                                     render-client-hist start-test]]))
+            [cbfg.world-base :refer [replay-cmd-ch world-cmd-loop start-test]]))

 (def cmd-handlers
   {"add"   (fn [c] (assoc c :rq #(cbfg.world-base/example-add % c)))
@@ -31,28 +30,12 @@
                                         :y (js/parseInt (get-el-value "y"))
                                         :delay (js/parseInt (get-el-value "delay"))
                                         :fence (= (get-el-value "fence") "1")
-                                        :lane (get-el-value "lane")}))
-        client-hist (atom {})] ; Keyed by opaque -> [request, replies].
+                                        :lane (get-el-value "lane")}))]
     (vis-init (fn [world vis-chs]
                 (let [in-ch (achan-buf world 100)
                       out-ch (achan-buf world 0)]
-                  (ago-loop client world [num-ins 0 num-outs 0]
-                            (let [[v ch] (aalts client [cmd-ch out-ch])
-                                  ts (+ num-ins num-outs)]
-                              (cond
-                                (= ch cmd-ch) (if (= (:op v) "replay")
-                                                (world-replay in-ch vis-chs world-vis-init el-prefix
-                                                              @client-hist (:replay-to v))
-                                                (let [cmd (assoc v :opaque ts)
-                                                      cmd-rq ((get cmd-handlers (:op cmd)) cmd)]
-                                                  (render-client-hist (swap! client-hist
-                                                                             #(assoc % ts [cmd nil])))
-                                                  (aput client in-ch cmd-rq)
-                                                  (recur (inc num-ins) num-outs)))
-                                (= ch out-ch) (do (render-client-hist (swap! client-hist
-                                                                             #(update-in % [(:opaque v) 1]
-                                                                                conj [ts v])))
-                                                  (recur num-ins (inc num-outs))))))
+                  (world-cmd-loop world cmd-handlers cmd-ch
+                                  in-ch out-ch vis-chs world-vis-init el-prefix)
                   (make-lane-pump world in-ch out-ch make-fenced-pump-lane)))
               el-prefix nil init-event-delay)
     cmd-inject-ch))


disabling coloring and filtering out security logs from println appender

--- src/celestial/launch.clj
+++ src/celestial/launch.clj
@@ -19,9 +19,9 @@
     [clojure.core.strint :refer (<<)]
     [supernal.core :refer [ssh-config]]
     [gelfino.timbre :refer (set-tid get-tid gelf-appender)]
-    [taoensso.timbre :refer (merge-config! set-level!)]
+    [taoensso.timbre  :as timbre :refer (merge-config! set-level!)]
     [taoensso.timbre.appenders.3rd-party.rolling :refer (rolling-appender) ]
-    [taoensso.timbre.appenders.core :refer (spit-appender)]
+    [taoensso.timbre.appenders.core :refer (println-appender)]
     [components.core :refer (start-all stop-all setup-all)]
     [celestial.persistency.core :as p]
     [hypervisors.networking :refer (initialize-networking)]
@@ -34,13 +34,27 @@

 (import-logging)

+(defn disable-coloring
+   "See https://github.com/ptaoussanis/timbre"
+   []
+  (merge-config! {:output-fn (partial timbre/default-output-fn  {:stacktrace-fonts {}})}))
+
+(defn filter-security [{:keys [output-fn ?ns-str] :as data}]
+  (when-not (= "celestial.security" ?ns-str)
+    (println (output-fn data))))
+
 (defn setup-logging
   "Sets up logging configuration"
   []
   (let [log* (partial get* :celestial :log)]
     (when (log* :gelf)
-      (merge-config! {:appenders {:gelf (gelf-appender  {:host (log* :gelf :host)})}}))
-    (merge-config! {:appenders {:rolling (rolling-appender {:path (log* :path) :pattern :weekly})}})
+      (merge-config!
+        {:appenders {:gelf (gelf-appender {:host (log* :gelf :host)})}}))
+    (merge-config!
+      {:appenders {:rolling (rolling-appender {:path (log* :path) :pattern :weekly})}})
+    (merge-config!
+      {:appenders {:println {:fn filter-security}}})
+    (disable-coloring)
     (set-level! (log* :level))))

 (defn build-components []


enforce against-constraint in other direction

--- src/c4_arena/core.clj
+++ src/c4_arena/core.clj
@@ -178,6 +178,11 @@
                           (fn [{other-id :id}]
                             (or (nil? against)
                                 (= other-id against))))
+                         ;; Enforce in the other direction as well
+                         (filter
+                          (fn [{other-against :against}]
+                            (or (nil? other-against)
+                                (= id other-against))))
                          ;; Do not match if there is an active game
                          ;; going on
                          (remove


allow overriding :static-fns and :optimize-constants under :advanced optimization

--- src/clj/cljs/closure.clj
+++ src/clj/cljs/closure.clj
@@ -957,11 +957,13 @@
                      :ups-foreign-libs (:foreign-libs ups-deps)
                      :ups-externs (:externs ups-deps))]
       (binding [ana/*cljs-static-fns*
-                (or (= (opts :optimizations) :advanced)
+                (or (and (= (:optimizations opts) :advanced)
+                         (not (false? (:static-fns opts))))
                     (:static-fns opts)
                     ana/*cljs-static-fns*)
                 ana/*track-constants*
-                (or (= (opts :optimizations) :advanced)
+                (or (and (= (:optimizations opts) :advanced)
+                         (not (false? (:optimize-constants opts))))
                     (:optimize-constants opts)
                     ana/*track-constants*)
                 ana/*cljs-warnings*


fspec gen ignores :fn rather than not gen.

--- src/clj/clojure/spec.clj
+++ src/clj/clojure/spec.clj
@@ -506,6 +506,10 @@

   See 'fdef' for a single operation that creates an fspec and
   registers it, as well as a full description of :args, :ret and :fn
+
+  fspecs can generate functions that validate the arguments and
+  fabricate a return value compliant with the :ret spec, ignoring
+  the :fn spec if present.

   Optionally takes :gen generator-fn, which must be a fn of no args
   that returns a test.check generator."
@@ -1440,11 +1444,10 @@
                  {path {:pred 'ifn? :val f :via via :in in}}))
      (gen* [_ _ _ _] (if gfn
              (gfn)
-             (when-not fnspec
-               (gen/return
-                (fn [& args]
-                  (assert (valid? argspec args) (with-out-str (explain argspec args)))
-                  (gen/generate (gen retspec)))))))
+             (gen/return
+              (fn [& args]
+                (assert (valid? argspec args) (with-out-str (explain argspec args)))
+                (gen/generate (gen retspec))))))
      (with-gen* [_ gfn] (fspec-impl argspec aform retspec rform fnspec fform gfn))
      (describe* [_] `(fspec :args ~aform :ret ~rform :fn ~fform)))))


Fixed issue in player that first time player was started two next clicks were required to make it go.

--- src/cljs/vdd/player.cljs
+++ src/cljs/vdd/player.cljs
@@ -98,7 +98,7 @@
   ([slider options items data-handler]
    {:items items
     :data-handler data-handler
-    :index -1
+    :index 0
     :playing false
     :slider slider
     :options options}))


Logout link bug fix.

Logout link bug fix.

--- src/foreclojure/utils.clj
+++ src/foreclojure/utils.clj
@@ -77,7 +77,7 @@
         (if-let [user (session/session-get :user)]
           [:div
            (str "Logged in as " user)
-           [:a#logout :href "/logout" "Logout"]]
+           [:a#logout {:href "/logout"} "Logout"]]
           [:div
            [:a#login {:href "/login"} "Login"]
            [:a#register {:href "/register"} "Register"]])]]


cleaned up uploads/get-action

cleaned up uploads/get-action

--- src/frontend/uploads.cljs
+++ src/frontend/uploads.cljs
@@ -36,18 +36,19 @@
         new-uploads (:uploads new-state)
         old-upload (old-uploads upload-id)
         new-upload (new-uploads upload-id)]
-    (if (and (not (:stopped? new-upload))
+    (cond
+      (and (not (:stopped? new-upload))
              (:stopped? old-upload))
-      :started
-      (if (and (:stopped? new-upload)
+        :started
+      (and (:stopped? new-upload)
                (not (:stopped? old-upload)))
         :stopped
-        (if (and (:paused? new-upload)
-                 (not (:paused? old-upload)))
-          :paused
-          (if (and (not (:paused? new-upload))
-                   (:paused? old-upload))
-            :resumed))))))
+      (and (:paused? new-upload)
+           (not (:paused? old-upload)))
+        :paused
+      (and (not (:paused? new-upload))
+                (:paused? old-upload))
+        :resumed)))

 (defn handle-state-change [old-state new-state]
   "Returns new state map according to changes between old-state and new-state"