Cursor blink state when playback stops

Cursor blink state when playback stops

This change looks big but actually it changes only 2 things:

* switches from go-loop to go and loop separately (causing re-alignment
  of everything inside the go block)
* resets the blink state at the end of the go block

--- src/cljs/asciinema_player/core.cljs
+++ src/cljs/asciinema_player/core.cljs
@@ -79,23 +79,25 @@
         stop-fn (fn []
                   (close! stop-playback-chan)
                   (elapsed-time))]
-    (go-loop [cursor-blink-chan (make-cursor-blink-chan)]
-      (let [[v c] (alts! [diff-chan timer-chan cursor-blink-chan stop-playback-chan])]
-        (condp = c
-          timer-chan (let [t (+ play-from (elapsed-time))]
-                       (dispatch [:update-state assoc :current-time t])
-                       (recur cursor-blink-chan))
-          cursor-blink-chan (do
-                              (dispatch [:update-state assoc-in [:cursor :on] v])
-                              (recur cursor-blink-chan))
-          diff-chan (if v
-                      (do
-                        (dispatch [:update-state #(-> % (apply-diff v) reset-blink)])
-                        (recur (make-cursor-blink-chan)))
-                      (do
-                        (dispatch [:finished])
-                        (print (str "finished in " (elapsed-time-since start)))))
-          stop-playback-chan nil))) ; do nothing, break the loop
+    (go
+      (loop [cursor-blink-chan (make-cursor-blink-chan)]
+        (let [[v c] (alts! [diff-chan timer-chan cursor-blink-chan stop-playback-chan])]
+          (condp = c
+            timer-chan (let [t (+ play-from (elapsed-time))]
+                         (dispatch [:update-state assoc :current-time t])
+                         (recur cursor-blink-chan))
+            cursor-blink-chan (do
+                                (dispatch [:update-state assoc-in [:cursor :on] v])
+                                (recur cursor-blink-chan))
+            diff-chan (if v
+                        (do
+                          (dispatch [:update-state #(-> % (apply-diff v) reset-blink)])
+                          (recur (make-cursor-blink-chan)))
+                        (do
+                          (dispatch [:finished])
+                          (print (str "finished in " (elapsed-time-since start)))))
+            stop-playback-chan nil))) ; do nothing, break the loop
+      (dispatch [:update-state reset-blink]))
     (-> state
         (apply-diff (prev-diff (:frames state) play-from))
         (assoc :stop stop-fn))))


RDC - Rotate doesn't use rotations.

RDC - Rotate doesn't use rotations.

--- src/icfp2015/board.clj
+++ src/icfp2015/board.clj
@@ -64,7 +64,7 @@
   "Given a board and command, returns a new (possibly invalid) board"
   [board [command arg]]
   (let [unit-fn (case command
-                  :rotate (apply unit/rotate (unit/rotations arg))
+                  :rotate (unit/rotate arg)
                   :move (unit/translate arg))
         new-board (update-in board [:current-unit] unit-fn)]
     (if (valid-position? new-board)


unlight

unlight

--- src/launchpad/core.clj
+++ src/launchpad/core.clj
@@ -17,3 +17,6 @@
    m
    (+ x (* 0x10 y))
    c))
+
+(defn unlight [m x y]
+  (light m x y 0))


Add and use safe-checkout to clean before co in .voom-repos

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -240,6 +240,10 @@
                    (= name pname))]
     prj))

+(defn safe-checkout [gitdir sha]
+  (git {:gitdir gitdir} "clean" "-x" "-d" "--force" "--quiet")
+  (git {:gitdir gitdir} "checkout" sha))
+
 (defn find-matching-projects
   "[project {groupId name ctime sha}] [project coordinate-string]"
   [repos-dir pspec]
@@ -252,7 +256,7 @@
                            (do (fetch-all dirs)
                                (locate-sha dirs sha)))]
     (mapcat (fn [c]
-              (git {:gitdir c} "checkout" sha)
+              (safe-checkout c sha)
               (find-project groupId artifactId c))
             sha-candidates)))

@@ -637,7 +641,7 @@
       (if (.exists ^File checkout)
         (git g "fetch")
         (git {} "clone" repo "--refer" gitdir checkout))
-      (git g "checkout" sha) ; must detach head for update...
+      (safe-checkout checkout sha) ; must detach head for update...
       (git g "branch" "-f" branch sha)
       (git g "checkout" branch)
       (sh "rm" "-f" pdir)
@@ -1139,7 +1143,7 @@
                                    candidates-f)]
         {:keys [sha ctime]} candidates-g]
     {:verify (when verify-newest?
-               (git {:gitdir gitdir} "checkout" (str sha))
+               (safe-checkout gitdir (str sha))
                (let [check-sha (sha/mk (:sha (get-voom-version found-path :gitdir gitdir)))]
                  (if (= check-sha sha)
                    :ok


Add more options to 'origin-branches and 'git-commits

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -462,9 +462,12 @@
          (.delete tmp-file))))))

 (defn origin-branches
-  [gitdir]
-  (->> (git {:gitdir gitdir} "rev-parse"
-            "--symbolic-full-name" "--remotes=origin/")
+  [gitdir & {:keys [sha?]}]
+  (->> (apply git {:gitdir gitdir} "rev-parse"
+              (concat
+               (when-not sha?
+                 ["--symbolic-full-name"])
+               ["--remotes=origin/"]))
        :lines
        (map #(re-find #"[^/]+$" %))
        distinct))
@@ -983,9 +986,10 @@

 (defn git-commits
-  [gitdir branch]
+  [gitdir & args]
   (->>
-   (git {:gitdir gitdir} "log" "--full-history" "--reverse" "--pretty=%H,%ct,%T,%P" branch)
+   (apply git {:gitdir gitdir} "log" "--full-history" "--reverse"
+          "--pretty=%H,%ct,%T,%P" args)
    :lines
    (map #(let [[sha ctime tree parents] (s/split % #",")
                parents (when parents (s/split parents #" "))]


Update pillar柱子的视图

Update pillar柱子的视图

--- src/flappy_bird_demo/core.cljs
+++ src/flappy_bird_demo/core.cljs
@@ -197,12 +197,16 @@

 (defn px [n] (str n "px"))

+;; 柱子的视图: (first (:pillar-list @flap-state)) ;; => {:start-time 17636.856000004627, :pos-x 900, :cur-x 232, :gap-top 200}
 (defn pillar [{:keys [cur-x pos-x upper-height lower-height]}]
   [:div.pillars
+   ;; cur-x 是上下柱子的左右位置,横轴X轴的位置
+   ;; 上面的柱子: left: 232px; height: 200px; upper-height 是上面柱子的高度
    [:div.pillar.pillar-upper {:style {:left (px cur-x)
-                                       :height upper-height}}]
+                                      :height upper-height}}]
+   ;; 下面的柱子: left: 232px; height: 203px; lower-height 是下面柱子的高度
    [:div.pillar.pillar-lower {:style {:left (px cur-x)
-                                       :height lower-height}}]])
+                                      :height lower-height}}]])

 (defn time-loop [time]
   (let [new-state (swap! flap-state (partial time-update time))]


Fix some doc strings.

Fix some doc strings.

--- src/grafter/tabular/common.clj
+++ src/grafter/tabular/common.clj
@@ -10,14 +10,18 @@
            [org.apache.poi.ss.usermodel Workbook Sheet]
            [incanter.core Dataset]))

-(defn copy-first-row-to-header [data]
+(defn copy-first-row-to-header
   "For use with make-dataset.  Copies the first row of data into the
   header, removing it from the source data."
+  [data]
+
   [(first data) data])

-(defn move-first-row-to-header [[first-row & other-rows]]
+(defn move-first-row-to-header
   "For use with make-dataset.  Moves the first row of data into the
   header, removing it from the source data."
+  [[first-row & other-rows]]
+
   [first-row other-rows])

 (defn make-dataset


repl stuff still, need libraries default load

--- src/lseq_tree/core.clj
+++ src/lseq_tree/core.clj
@@ -1,4 +1,15 @@
-(ns lseq-tree.core)
+(ns lseq-tree.core
+  (:require [lseq-tree.util :as util]
+            [lseq-tree.lseq-node :as n :refer [node add]]
+            [lseq-tree.triple :as t :refer [triple]]))
+
+(def node1 (node [(triple 1 2 3)] "a"))
+(def node2 (node [(triple 4 5 6)
+                  (triple 7 8 9)] "b"))
+(def node3 (node [(triple 4 5 6)
+                  (triple 10 11 12)] "c"))
+(def node4 (reduce add [node1 node2 node3]))
+(def fchild (first (:children node4)))

 (defn foo
   "I don't do a whole lot."


add helper to get sequence of paths to ports

--- src/nl_streamer/serial_port.clj
+++ src/nl_streamer/serial_port.clj
@@ -20,6 +20,9 @@
   "Returns a seq representing all port identifiers visible to the system"
   []
   (enumeration-seq (CommPortIdentifier/getPortIdentifiers)))
+
+(defn port-names []
+  (map #(.getName %) (port-ids)))

 (defn port-at
   "Returns the name of the serial port at idx."


Added support for cljx in the main file

Added support for cljx in the main file

Refactored out the arguments to `->files` to conditionally include core.cljx

--- src/leiningen/new/chestnut.clj
+++ src/leiningen/new/chestnut.clj
@@ -19,6 +19,15 @@
 (defn om-tools? [opts]
   (some #{"--om-tools"} opts))

+(defn cljx? [opts]
+  (some #{"--cljx"} opts))
+
+(def cljx-plugin
+  "com.keminglabs/cljx \"0.4.0\" :exclusions [org.clojure/clojure]")
+
+(def cljx-source-paths
+  " \"target/generated/clj\" \"target/generated/cljx\"")
+
 (defn server-clj-requires [opts]
   (if (http-kit? opts)
     ["org.httpkit.server :refer [run-server]"]
@@ -35,6 +44,10 @@
           (http-kit? opts) (conj "http-kit \"2.1.19\"")
           (om-tools? opts) (conj "prismatic/om-tools \"0.3.3\"")))

+(defn project-plugins [opts]
+  (cond-> []
+          (cljx? opts) (conj cljx-plugin)))
+
 (defn template-data [name opts]
   {:full-name name
    :name (project-name name)
@@ -44,39 +57,57 @@
    :server-clj-requires (dep-list 12 (server-clj-requires opts))
    :core-cljs-requires (dep-list 12 (core-cljs-requires opts))
    :project-clj-deps (dep-list 17 (project-clj-deps opts))
+   :project-dev-plugins (dep-list 29 (project-plugins opts))
    :server-command (if (http-kit? opts) "run-server" "run-jetty")
    :compojure-handler (if (site-middleware? opts) "site" "api")
-   :not-om-tools? (fn [block] (if (om-tools? opts) "" block))})
+   :not-om-tools? (fn [block] (if (om-tools? opts) "" block))

-(defn chestnut [name & opts]
-  (let [data (template-data name opts)]
-    (main/info "Generating fresh 'lein new' chestnut project.")
-    (->files data
-             ["project.clj"
-              (render "project.clj" data)]
-             ["resources/index.html"
-              (render "resources/index.html" data)]
-             ["resources/public/css/style.css"
-              (render "resources/public/css/style.css" data)]
-             ["src/clj/{{sanitized}}/server.clj"
-              (render "src/clj/chestnut/server.clj" data)]
-             ["src/clj/{{sanitized}}/dev.clj"
-              (render "src/clj/chestnut/dev.clj" data)]
-             ["src/cljs/{{sanitized}}/core.cljs"
-              (render "src/cljs/chestnut/core.cljs" data)]
-             ["env/dev/cljs/{{sanitized}}/dev.cljs"
-              (render "env/dev/cljs/chestnut/dev.cljs" data)]
-             ["env/prod/cljs/{{sanitized}}/prod.cljs"
-              (render "env/prod/cljs/chestnut/prod.cljs" data)]
-             ["LICENSE"
-              (render "LICENSE" data)]
-             ["README.md"
-              (render "README.md" data)]
-             [".gitignore"
-              (render ".gitignore" data)]
+   ;; cljx
+   :cljx-source-paths (if (cljx? opts) cljx-source-paths "")
+   :cljx-extension (if (cljx? opts) "|\\.cljx")
+   :jar-exclusions? (fn [block] (if (cljx? opts) block ""))
+   :cljx-cljsbuild-spath (if (cljx? opts) " \"target/generated/cljs\"" "")
+   :cljx-hook? (fn [block] (if (cljx? opts) (str block "\n") ""))
+   :cljx-build? (fn [block] (if (cljx? opts) (str block "\n") ""))
+   :cljx-uberjar-hook (if (cljx? opts) "cljx.hooks " "")})
+
+(defn format-files-args [name opts]
+  (let [data (template-data name opts)
+        args [data
+              ["project.clj"
+               (render "project.clj" data)]
+              ["resources/index.html"
+               (render "resources/index.html" data)]
+              ["resources/public/css/style.css"
+               (render "resources/public/css/style.css" data)]
+              ["src/clj/{{sanitized}}/server.clj"
+               (render "src/clj/chestnut/server.clj" data)]
+              ["src/clj/{{sanitized}}/dev.clj"
+               (render "src/clj/chestnut/dev.clj" data)]
+              ["src/cljs/{{sanitized}}/core.cljs"
+               (render "src/cljs/chestnut/core.cljs" data)]
+              ["env/dev/cljs/{{sanitized}}/dev.cljs"
+               (render "env/dev/cljs/chestnut/dev.cljs" data)]
+              ["env/prod/cljs/{{sanitized}}/prod.cljs"
+               (render "env/prod/cljs/chestnut/prod.cljs" data)]
+              ["LICENSE"
+               (render "LICENSE" data)]
+              ["README.md"
+               (render "README.md" data)]
+              [".gitignore"
+               (render ".gitignore" data)]

              ;; Heroku support
              ["system.properties"
               (render "system.properties" data)]
              ["Procfile"
-              (render "Procfile" data)])))
+              (render "Procfile" data)]]]
+
+    (if (cljx? opts)
+      (conj args ["src/cljx/{{sanitized}}/core.cljx"
+                  (render "src/cljx/chestnut/core.cljx" data)])
+      args)))
+
+(defn chestnut [name & opts]
+  (main/info "Generating fresh 'lein new' chestnut project.")
+  (apply ->files (format-files-args name opts)))


Quit using :library-path key.

Quit using :library-path key.

--- src/leiningen/ring/uberwar.clj
+++ src/leiningen/ring/uberwar.clj
@@ -21,7 +21,7 @@

 (defn jar-entries [war project]
   (doseq [jar-file (jar-dependencies project)]
-    (let [dir-path (:library-path project)
+    (let [dir-path (.getParent jar-file)
           war-path (war/in-war-path "WEB-INF/lib/" dir-path jar-file)]
       (war/file-entry war project war-path jar-file))))


Replace set! with goog.object.set

Replace set! with goog.object.set

--- src/pasmo_gigi/geo/ui/core.cljs
+++ src/pasmo_gigi/geo/ui/core.cljs
@@ -17,7 +17,7 @@
   (.log js/console "mapbox api: " mapbox-api)
   (let [mapbox (gob/get mapbox-api "mapbox")]
     (.log js/console "mapbox prop from api: " mapbox)
-    (set! (.-accessToken mapbox) "pk.eyJ1IjoidXJpczc3IiwiYSI6InRuYTZRa3MifQ._Bo-JRcA7QVGocCJvdSoJg")
+    #_(set! (.-accessToken mapbox) "pk.eyJ1IjoidXJpczc3IiwiYSI6InRuYTZRa3MifQ._Bo-JRcA7QVGocCJvdSoJg")
     (gob/set mapbox "accessToken" "pk.eyJ1IjoidXJpczc3IiwiYSI6InRuYTZRa3MifQ._Bo-JRcA7QVGocCJvdSoJg")
     (swap! db/settings assoc :mapbox-api mapbox-api))


fixing fact and build

fixing fact and build


environment is no longer a list

environment is no longer a list

--- alerta.clj
+++ alerta.clj
@@ -1,7 +1,7 @@
 ; -*- mode: clojure; -*-
 ; vim: filetype=clojure

-(def version "1.0.0")
+(def version "3.0.0")

 (def alerta-endpoints
 	{:alert "http://localhost:8080/api/alert"
@@ -36,11 +36,10 @@
    :group (get event :group "Performance")
    :value (:metric event)
    :severity (:state event)
-   :environment [(get event :environment "INFRA")]
-   :service [(get event :grid "Common")]
+   :environment (get event :environment "infrastructure")
+   :service [(get event :grid "Platform")]
    :tags (:tags event)
    :text (:description event)
-   :moreInfo "more info here"
    :rawData event})

 (defn alerta
@@ -52,6 +51,6 @@
 (defn heartbeat [e] (post-to-alerta
 	(:heartbeat alerta-endpoints)
 	{:origin (str "riemann/" hostname)
-	   :version version
+	   :tags [version]
 	   :type "Heartbeat"}))


Translate tooltip

Translate tooltip

--- src/discuss/components/tooltip.cljs
+++ src/discuss/components/tooltip.cljs
@@ -3,6 +3,7 @@
             [om.dom :as dom :include-macros true]
             [goog.dom :as gdom]
             [discuss.components.clipboard :as clipboard]
+            [discuss.translations :refer [translate]]
             [discuss.utils.common :as lib]
             [discuss.utils.views :as vlib]
             [discuss.components.sidebar :as sidebar]))
@@ -69,9 +70,9 @@
                (dom/span #js {:className "pointer"
                               :onClick   (fn [] (clipboard/add-item!) (sidebar/show) (hide))}
                          (vlib/fa-icon "fa-bookmark-o")
-                         " Speichern")
+                         (translate :common :save))
                (vlib/safe-space) "  " (vlib/safe-space)
                (dom/span #js {:className "pointer"
                               :onClick   (fn [] (sidebar/show) (hide))}
                          (vlib/fa-icon "fa-comment")
-                         " Zeige Discuss")))))+                         (translate :common :show-discuss))))))


awful, awful, awful code that fixes the all-bars-get-redrawn issue. perf is still real bad, though\! dang\!

--- src/mortgage/core.cljs
+++ src/mortgage/core.cljs
@@ -163,11 +163,11 @@
 (sm/defn format-number [n :- s/Num]
   (str "$" (.toLocaleString n)))

-; XXXXXXXXX THIS CANNOT TAKE A STATE ARG
 (sm/defn draw-bar [point :- DataPoint
                    offset :- s/Int
                    max-value :- s/Int
-                   state
+                   is-selected-mortgage :- s/Bool
+                   ui-event-chan
                    ]
   (js/console.log "drawing bar")
   (let [x (+ 110 (* offset 30))
@@ -178,21 +178,22 @@
                 :width          30
                 :transform      (str "rotate(180 " x " " 280 ")")
                 :height         height
-                :class          (when (= (:selected-mortgage state) (:mortgage point))
+                :class          (when is-selected-mortgage
                                   "selected")
-                :on-mouse-enter #(put! (:ui-event-chan state) {:type     :selection-start
-                                                               :mortgage (:mortgage point)})}]))
+                :on-mouse-enter #(put! ui-event-chan {:type     :selection-start
+                                                      :mortgage (:mortgage point)})}]))

 (sm/defn draw-bar-graph [y-axis-label :- s/Str
                          data-points :- [DataPoint]
-                         state]
+                         selected-mortgage :- Mortgage
+                         ui-event-chan]
   [:svg {:width 520 :height 300}
    [:rect {:x              0
            :y              0
            :width          500
            :height         300
            :fill           "#FFF"
-           :on-mouse-enter #(put! (:ui-event-chan state) {:type :selection-end})}]
+           :on-mouse-enter #(put! ui-event-chan {:type :selection-end})}]
    [:line {:x1           100 :y1 20
            :x2           100 :y2 280
            :stroke       "black"
@@ -206,11 +207,15 @@
    [:text {:x 90 :y 30 :text-anchor "end"} (format-number (int (apply max (map :value data-points))))]

    (for [[index point] (map-indexed vector data-points)]
-       ^{:key (str "rect-" index (point :value))} [draw-bar point index (apply max (map :value data-points)) state])
-
-   (when (:selected-mortgage state)
-     (let [point (first (filter #(= (:mortgage %)
-                                    (:selected-mortgage state))
+     ^{:key (str "rect-" index (point :value))} [draw-bar
+                                                 point
+                                                 index
+                                                 (apply max (map :value data-points))
+                                                 (= (point :mortgage) selected-mortgage)
+                                                 ui-event-chan])
+
+   (when selected-mortgage
+     (let [point (first (filter #(= (:mortgage %) selected-mortgage)
                                 data-points))
            index (.indexOf (to-array data-points) point)
            x (+ 110 (* index 30))]
@@ -228,7 +233,8 @@
    (for [m mortgages]
      {:mortgage m
       :value    (-> m total-price-breakdown :interest)})
-   state])
+   (state :selected-mortgage)
+   (state :ui-event-chan)])

 (sm/defn draw-monthly-payment [mortgages :- [Mortgage]
                                state :- UIState]
@@ -237,15 +243,18 @@
    (for [m mortgages]
      {:mortgage m
       :value    (full-monthly-payment-amount m)})
-   state])
+   (state :selected-mortgage)
+   (state :ui-event-chan)])
+

 (sm/defn draw-mortgage [m :- Mortgage
-                        state :- UIState]
+                        is-selected-mortgage :- s/Bool
+                        ui-event-chan]
   [:tr.mortgage
-   {:on-mouse-enter #(put! (:ui-event-chan state) {:type     :selection-start
-                                                   :mortgage m})
-    :on-mouse-leave #(put! (:ui-event-chan state) {:type :selection-end})
-    :class          (when (= m (:selected-mortgage state))
+   {:on-mouse-enter #(put! ui-event-chan {:type     :selection-start
+                                          :mortgage m})
+    :on-mouse-leave #(put! ui-event-chan {:type :selection-end})
+    :class          (when is-selected-mortgage
                       "selected")}
    [:td (:house-price m)]
    [:td (:apr m)]
@@ -275,9 +284,9 @@
         [:th "% Down"]
         [:th "Duration"]]
        (when (:selected-mortgage state)
-         [draw-mortgage (:selected-mortgage state) state])
+         [draw-mortgage (:selected-mortgage state) true (:ui-event-chan state)])
        (for [[index m] (map-indexed vector (:mortgages state))]
-         ^{:key (str "mortgage-" index)} [draw-mortgage m state])]]]))
+         ^{:key (str "mortgage-" index)} [draw-mortgage m (= m (:selected-mortgage state)) (:ui-event-chan state)])]]]))

 (def some-mortgages
   (apply concat


Add find-first fn

Add find-first fn

--- src/musicbox/util.cljs
+++ src/musicbox/util.cljs
@@ -26,6 +26,10 @@

 (defn get-ctx [canvas-id]
   (.getContext (dom/getElement canvas-id) "2d"))
+
+(defn find-first
+  [pred coll]
+  (first (filter pred coll)))

 (def keyword->event-type
   {:keyup goog.events.EventType.KEYUP


quick fix.

quick fix.

--- src/overtone/synth.clj
+++ src/overtone/synth.clj
@@ -220,11 +220,12 @@
         [params pnames] (make-params grouped-params)
         with-ctl-ugens (concat (make-control-ugens grouped-params) ugens)
         detailed (detail-ugens with-ctl-ugens constants grouped-params)]
-    {:name (str name)
-     :constants constants
-     :params params
-     :pnames pnames
-     :ugens detailed}))
+    (with-meta {:name (str name)
+                :constants constants
+                :params params
+                :pnames pnames
+                :ugens detailed}
+               {:type :overtone.synthdef/synthdef})))

 (defn synthdef
   "Transforms a synth definition (ugen-graph) into a form that's ready to save
@@ -232,8 +233,7 @@
   "
   [ugens]
   (let [sname (str "anon-" (next-id :anonymous-synth))]
-    (with-meta (build-synthdef sname {} ugens)
-               {:type :overtone.synthdef/synthdef})))
+    (build-synthdef sname {} ugens)))

 (defn synth
   [ugen]


let the frontend handle redirecting from early-access to team

--- src/pc/http/routes.clj
+++ src/pc/http/routes.clj
@@ -236,10 +236,10 @@
   (outer-page req))

 (defpage early-access "/early-access" [req]
-  (redirect (str "/trial/team")))
+  (outer-page req))

 (defpage early-access-type "/early-access/:type" [req]
-  (redirect (str "/trial/" (-> req :params :type))))
+  (outer-page req))

 (defpage trial "/trial/:type" [req]
   (outer-page req))


fixing frontier devcard

fixing frontier devcard

--- examples/frontier_examples/devcards.cljs
+++ examples/frontier_examples/devcards.cljs
@@ -1,6 +1,6 @@
 (ns frontier-examples.devcards
   (:require
-   [devcards.core :refer [om-root-card]]
+   [devcards.core :as dc]
    [frontier.core :refer [compose make-renderable]]
    [frontier.adaptors :refer [om-adaptor]]
    [frontier.cards :as cards :refer [system-card
@@ -27,7 +27,7 @@
                                  [:create-todo {:content "buy an F1 racer"}]])))

 (defcard managed-ex
-  (managed-history-card { }
+  (dc/managed-history-card { }
                         (todo-counter-app)
                         [[:inc] [:inc]]))


Typo.

Typo.

--- src/oc/storage/api/entries.clj
+++ src/oc/storage/api/entries.clj
@@ -123,7 +123,7 @@
             updated-entry (:updated-entry ctx)
             publish-result (entry-res/publish-entry! conn (:uuid updated-entry) updated-entry user)]
     (do
-      (timbre/info "Published entry for:" (:uuid entry))
+      (timbre/info "Published entry for:" (:uuid updated-entry))
       (change/send-trigger! (change/->trigger :add publish-result))
       (timbre/info "Published entry:" entry-for)
       {:updated-entry publish-result})


[fix] Mistakes.

[fix] Mistakes.

--- src/ombs/handler/adminacts.clj
+++ src/ombs/handler/adminacts.clj
@@ -23,5 +23,5 @@
   (println "moneyout " username " " money)
   (let [uid (db/get-uid username)]
     (if (isvalid/moneyout? uid money)
-      (dbpay/credit-payment uid db/moeid money)
+      (dbp/credit-payment uid db/moeid money)
       (ch/generate-string {:error (isvalid/errors-string)}))))


Fixes #464 - flow conditions :flow/from -> :all didn't compile properly.

--- src/onyx/peer/task_compile.clj
+++ src/onyx/peer/task_compile.clj
@@ -9,7 +9,7 @@
             [clj-tuple :as t]))

 (defn only-relevant-branches [flow task]
-  (filter #(or (= (:flow/from %) task) (= :all %)) flow))
+  (filter #(or (= (:flow/from %) task) (= :all (:flow/from %))) flow))

 (defn compile-flow-conditions [flow-conditions task-name f]
   (let [conditions (filter f (only-relevant-branches flow-conditions task-name))]


Avoid input plugin burning cpu.

Avoid input plugin burning cpu.

--- src/onyx/plugin/core_async.clj
+++ src/onyx/plugin/core_async.clj
@@ -18,17 +18,19 @@
 (defmethod p-ext/read-batch :core.async/read-from-chan
   [{:keys [onyx.core/task-map core.async/chan core.async/retry-ch
            core.async/pending-messages] :as event}]
-  (let [pending (count (keys @pending-messages))
+  (let [pending (count @pending-messages)
         max-pending (or (:onyx/max-pending task-map) 10000)
         batch-size (:onyx/batch-size task-map)
         max-segments (min (- max-pending pending) batch-size)
         ms (or (:onyx/batch-timeout task-map) 50)
         timeout-ch (timeout ms)
-        batch (->> (range max-segments)
-                   (map (fn [_] {:id (java.util.UUID/randomUUID)
-                                :input :core.async
-                                :message (first (alts!! [retry-ch chan timeout-ch] :priority true))}))
-                   (remove (comp nil? :message)))]
+        batch (if (zero? max-segments)
+                (<!! timeout-ch)
+                (->> (range max-segments)
+                     (map (fn [_] {:id (java.util.UUID/randomUUID)
+                                   :input :core.async
+                                   :message (first (alts!! [retry-ch chan timeout-ch] :priority true))}))
+                     (remove (comp nil? :message))))]
     (doseq [m batch]
       (swap! pending-messages assoc (:id m) (:message m)))
     {:onyx.core/batch batch}))


Extracted functions for the intro and first bit.

--- src/overtunes/songs/at_all.clj
+++ src/overtunes/songs/at_all.clj
@@ -18,11 +18,10 @@
 (def note# (comp sampled-piano ground))
 (defn chord# [chord] (doseq [note (vals chord)] (note# note)))

-; ionian is quite messed up...
 (def ionian #(let [interval (mod % 7)
                   note ([0 2 4 5 7 9 11] interval)
-                  octave (quot (- % interval) 7)]
-              (+ (* 12 octave) note)))
+                  octave (quot (- % interval) 7)]
+               (+ (* 12 octave) note)))

 (defn triad [scale root]
   (zipmap [:i :iii :v]
@@ -51,20 +50,27 @@
     (if chords
       (rhythm-n-bass# (from timing 8) chords))))

-
 (defn even-melody# [timing [note & notes]]
   (do
     (at (timing 0) (note# note))
     (if notes
       (even-melody# (from timing 1) notes))))

+(defn intro# [timing]
+    (rhythm-n-bass# timing (take 8 (cycle progression)))
+    (even-melody# timing (take 32 (cycle [9 7]))))
+
+(defn first-bit# [timing]
+    (rhythm-n-bass# timing (take 8 (cycle progression)))
+    (even-melody# (speed-up (from timing -1) 2) (map ionian [2 4 5 4 4 2 4]))
+    (even-melody# (speed-up (from timing 7) 2) (map ionian [-2 1 2 1 1 -2 1]))
+    (even-melody# (speed-up (from timing 15) 2) (map ionian [-2 1 2 1 1 -2 1 2 3 4]))
+    (even-melody# (speed-up (from timing 23) 2) (map ionian [-1 -2 -3 0 0 -3 0 1 0 -3])))
+
 (defn play# []
-  (let [timing (from (bpm 120) 2)]
-    (even-melody# timing (take 32 (cycle [9 7])))
-    (rhythm-n-bass# timing (take 16 (cycle progression)))
-    (even-melody# (speed-up (from timing 31) 2) (map ionian [2 4 5 4 4 2 4]))
-    (even-melody# (speed-up (from timing 39) 2) (map ionian [-3 1 2 1 1 -3 1]))
-    (even-melody# (speed-up (from timing 47) 2) (map ionian [-3 1 2 1 1 -3 1 2 3 4]))
-    (even-melody# (speed-up (from timing 55) 2) (map ionian [-3 1 2 1 1 -3 1 2 1 -1]))))
+  (let [timing (from (bpm 120) 2)] ; Lead in with two beats so that everything starts at once.
+    (intro# timing)
+    (first-bit# (from timing 32))
+    (first-bit# (from timing 64))))

-(play#)
+; (play#)


Added a final chord.

Added a final chord.

--- src/overtunes/songs/at_all.clj
+++ src/overtunes/songs/at_all.clj
@@ -30,6 +30,8 @@
            (scale (+ root 4))]))

 (defn lower [note] (- note 12))
+(defn raise [note] (+ note 12))
+
 (defn with-base [chord]
   (assoc chord :base
          (lower (:i chord))))
@@ -77,6 +79,10 @@
     (even-melody# (map ionian [-1 -2 -3 0 0 -3 0 1 0 -3])))
   (rhythm-n-bass# timing (take 8 (cycle progression))))

-(defn play# [] (-> (bpm 120) (from 2) intro# first-bit# (speed-up 3/2) first-bit#))
+(defn final-chord# [timing]
+  (at (timing 0)
+      (chord# (update-in I [:i] raise))))
+
+(defn play# [] (-> (bpm 120) (from 2) intro# first-bit# (speed-up 3/2) first-bit# final-chord#))

 ; (play#)


making alpha work.

making alpha work.

--- src/play_clj/core_graphics.clj
+++ src/play_clj/core_graphics.clj
@@ -475,7 +475,9 @@
   (let [^Batch batch (.getBatch renderer)]
     (.begin batch)
     (doseq [entity entities]
-      (e/draw-entity! entity screen batch))
+      (.setColor batch (color 1 1 1 (or (:opacity entity) 1.0)))
+      (e/draw-entity! entity screen batch)
+      (.setColor batch (color 1 1 1 1)))
     (.end batch))
   entities)


Allow to post payload with entityId.

Allow to post payload with entityId.

--- src/kixi/hecuba/amon.clj
+++ src/kixi/hecuba/amon.clj
@@ -252,7 +252,9 @@

   :post!
   (fn [{{body :body} :request}]
-    (let [entity (-> body read-json-body ->shallow-kebab-map)]
+    (let [payload (-> body read-json-body ->shallow-kebab-map)
+          id      (-> payload :entity-id)
+          entity  (-> payload (assoc-in [:id] id) (dissoc :entity-id))]
       {:entity-id (upsert! commander :entity entity)}))

   :handle-created


Ensure only the right vectors in Mongo queries get turned into maps

--- src/qu/query/where.clj
+++ src/qu/query/where.clj
@@ -4,6 +4,7 @@
   (:require [clojure.string :as str]
             [clojure.walk :refer [postwalk]]
             [protoflex.parse :as p]
+            [taoensso.timbre :as log]
             [qu.query.parser :refer [where-expr]])
   (:import (java.util.regex Pattern)))

@@ -78,9 +79,11 @@
   "In Mongo queries, equality or comparison is done with one-element
   maps. mapcat turns these into 2-element vectors, so this fixes them."
   [evaled-operands]
-  (postwalk #(if (and (vector? %) (= 2 (count %)))
-                   (apply hash-map %)
-                   %)
+  (postwalk #(if (and (vector? %)
+                      (= 2 (count %))
+                      (keyword? (first %)))
+               (apply hash-map %)
+               %)
             evaled-operands))

 (defn mongo-eval


get single channel working again

get single channel working again

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@9463 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- plugins/SlideExplorer2/src/slide_explorer/main.clj
+++ plugins/SlideExplorer2/src/slide_explorer/main.clj
@@ -18,7 +18,7 @@
   (:use [org.micromanager.mm :only (core edt mmc gui load-mm json-to-data)]
         [slide-explorer.affine :only (set-destination-origin transform inverse-transform)]
         [slide-explorer.view :only (floor-int show add-to-available-tiles pixel-rectangle tiles-in-pixel-rectangle)]
-        [slide-explorer.image :only (show-image statistics intensity-range lut-object)]
+        [slide-explorer.image :only (show-image intensity-range lut-object)]
         [slide-explorer.tiles :only (tile-list offset-tiles)]))

@@ -140,7 +140,7 @@
                       [chan {:color color}]))
               (into {}
                     (for [[chan images] (group-by #(get-in % [:tags "Channel"]) tagged-image-processors)]
-                      [chan (assoc (apply intensity-range (map :proc images)) :gamma 1.0)]))))
+                      [(or chan "Default") (assoc (apply intensity-range (map :proc images)) :gamma 1.0)]))))

 (defn initial-lut-objects [tagged-image-processors]
   (into {}
@@ -165,7 +165,7 @@
   (doseq [image (acquire-at (inverse-transform (Point. (* 512 nx) (* 512 ny)) affine-stage-to-pixel))]
     (add-to-available-tiles available-tiles
                             {:nx nx :ny ny :nz (get-in image [:tags "SliceIndex"]) :nt 0
-                             :nc (get-in image [:tags "Channel"])}
+                             :nc (or (get-in image [:tags "Channel"]) "Default")}
                             (image :proc)))
   (await available-tiles))


Clarify taken-marstime sorting name

Clarify taken-marstime sorting name

--- src/mars_ogler/views.clj
+++ src/mars_ogler/views.clj
@@ -127,7 +127,7 @@
   [{:keys [cams page per-page sorting thumbs view]}]
   (let [grid? (= view :grid)
         sorting-names {:released "Date Released", :taken-utc "Date Taken"
-                       :taken-marstime "Martian Time Taken"}]
+                       :taken-marstime "Time of Martian Day Taken"}]
     [:div#toolbar-wrapper
      [:div#toolbar {:class (str "content "(if grid? "grid-content"))}
       [:form {:action "/"}


Work around binding conveyance bug in Immutant 1.0.1; some docs.

--- src/rivulet/bridge.clj
+++ src/rivulet/bridge.clj
@@ -21,14 +21,19 @@
     (assoc (zipmap [:protocol :host :port :path] parts)
       :url (apply format "%s://%s:%s%s" parts))))

-(defn dest->eventbus
+(defn- dest->eventbus
+  "Sets up a listener to copy messages from an Immutant messaging dest to a Vertx address.
+   If a selector string is provided, it will be applied to the
+   listener, and only messages matching the selector will be copied."
   ([dest address]
      (dest->eventbus dest address nil))
   ([dest address selector]
-     (with-vertx
-       (msg/listen dest (partial eb/publish address) :selector selector))))
+     (msg/listen dest #(with-vertx
+                         (eb/publish address %)) :selector selector)))

-(defn eventbus->dest [address dest]
+(defn- eventbus->dest
+  "Sets up a listener to copy messages from a Vertx address to an Immutant messaging dest."
+  [address dest]
   (with-vertx
     (eb/on-message address (partial msg/publish dest))))


Force note style on note for inliner.

Force note style on note for inliner.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -45,7 +45,7 @@
   [:table {:class "row note"}
     [:tbody
       [:tr
-        [:th {:class "small-12 large-12 first last columns"}
+        [:th {:class "small-12 large-12 first last columns note"}
           (emojify (:note snapshot))]]]])

 (defn- attribution [snapshot]
@@ -53,8 +53,8 @@
     [:table {:class "row note"}
       [:tbody
         [:tr
-          [:th {:class "small-12 large-12 first last columns"}
-            [:p (str "— " author)]]]]]))
+          [:th {:class "small-12 large-12 first last columns note"}
+            [:p {:class "note"} (str "— " author)]]]]]))

 (defn- spacer
   ([pixels] (spacer pixels ""))
@@ -145,8 +145,8 @@
       [:meta {:name "viewport", :content "width=device-width"}]
       [:link {:rel "stylesheet", :href "resources/css/foundation.css"}] ; Regular use
       [:link {:rel "stylesheet", :href "resources/css/opencompany.css"}] ; Regular use
-      ;;[:link {:rel "stylesheet", :href "css/foundation.css"}] ; REPL testing
-      ;;[:link {:rel "stylesheet", :href "css/opencompany.css"}] ; REPL testing
+      ;; [:link {:rel "stylesheet", :href "css/foundation.css"}] ; REPL testing
+      ;; [:link {:rel "stylesheet", :href "css/opencompany.css"}] ; REPL testing
       [:link {:href "http://fonts.googleapis.com/css?family=Domine", :rel "stylesheet", :type "text/css"}]
       [:link {:href "http://fonts.googleapis.com/css?family=Open+Sans", :rel "stylesheet", :type "text/css"}]
       (body snapshot)]])


Minor nit

Minor nit

--- src/tenor/entities.clj
+++ src/tenor/entities.clj
@@ -6,8 +6,7 @@

 (defrecord Note [note-value pitch-letter octave]
   Entity
-  (repr [this] (keyword (str pitch-letter octave)))
-)
+  (repr [this] (keyword (str pitch-letter octave))))

 (defn make-note [notation]
   (let [notation-re #"^(1|2|4|8|16)([A-G])([#b]?)([1-9])$"


Update task bundles for new format

Update task bundles for new format

--- src/onyx/tasks/kafka.clj
+++ src/onyx/tasks/kafka.clj
@@ -1,6 +1,7 @@
 (ns onyx.tasks.kafka
   (:require [cheshire.core :as json]
             [schema.core :as s]
+            [onyx.job :refer [add-task]]
             [onyx.schema :as os]))

 ;;;; Reader task
@@ -16,24 +17,20 @@
     (catch Exception e
       {:error e})))

-(def UserTaskMapKey
-  (os/build-allowed-key-ns :kafka))
-
 (def KafkaInputTaskMap
-  (s/->Both [os/TaskMap
-             {:kafka/topic s/Str
-              :kafka/group-id s/Str
-              :kafka/zookeeper s/Str
-              :kafka/offset-reset (s/enum :smallest :largest)
-              :kafka/force-reset? s/Bool
-              :kafka/deserializer-fn os/NamespacedKeyword
-              (s/optional-key :kafka/partition) s/Str
-              (s/optional-key :kafka/chan-capacity) s/Num
-              (s/optional-key :kafka/fetch-size) s/Num
-              (s/optional-key :kafka/empty-read-back-off) s/Num
-              (s/optional-key :kafka/commit-interval) s/Num
-              (s/optional-key :kafka/wrap-with-metadata?) s/Bool
-              UserTaskMapKey s/Any}]))
+  {:kafka/topic s/Str
+   :kafka/group-id s/Str
+   :kafka/zookeeper s/Str
+   :kafka/offset-reset (s/enum :smallest :largest)
+   :kafka/force-reset? s/Bool
+   :kafka/deserializer-fn os/NamespacedKeyword
+   (s/optional-key :kafka/partition) s/Str
+   (s/optional-key :kafka/chan-capacity) s/Num
+   (s/optional-key :kafka/fetch-size) s/Num
+   (s/optional-key :kafka/empty-read-back-off) s/Num
+   (s/optional-key :kafka/commit-interval) s/Num
+   (s/optional-key :kafka/wrap-with-metadata?) s/Bool
+   (os/restricted-ns :kafka) s/Any})

 (s/defn ^:always-validate consumer
   ([task-name :- s/Keyword opts]
@@ -50,8 +47,7 @@
                             opts)
            :lifecycles [{:lifecycle/task task-name
                          :lifecycle/calls :onyx.plugin.kafka/read-messages-calls}]}
-    :schema {:task-map KafkaInputTaskMap
-             :lifecycles [os/Lifecycle]}})
+    :schema {:task-map KafkaInputTaskMap}})
   ([task-name :- s/Keyword
     topic :- s/Str
     group-id :- s/Str
@@ -76,12 +72,12 @@
   (.getBytes (pr-str segment)))

 (def KafkaOutputTaskMap
-  (s/->Both [os/TaskMap
-             {:kafka/topic s/Str
-              :kafka/zookeeper s/Str
-              :kafka/serializer-fn os/NamespacedKeyword
-              :kafka/request-size s/Num
-              UserTaskMapKey s/Any}]))
+  {:kafka/topic s/Str
+   :kafka/zookeeper s/Str
+   :kafka/serializer-fn os/NamespacedKeyword
+   :kafka/request-size s/Num
+   (s/optional-key :kafka/no-seal?) s/Bool
+   (os/restricted-ns :kafka) s/Any})

 (s/defn ^:always-validate producer
   ([task-name :- s/Keyword opts]
@@ -93,8 +89,7 @@
                             opts)
            :lifecycles [{:lifecycle/task task-name
                          :lifecycle/calls :onyx.plugin.kafka/write-messages-calls}]}
-    :schema {:task-map KafkaOutputTaskMap
-             :lifecycles [os/Lifecycle]}})
+    :schema {:task-map KafkaOutputTaskMap}})
   ([task-name :- s/Keyword
     topic :- s/Str
     zookeeper :- s/Str


match retrieves original value

match retrieves original value

--- src/ophion/aggregate.clj
+++ src/ophion/aggregate.clj
@@ -135,10 +135,12 @@
         (reduce
          (fn [queries s]
            (let [label (first s)
-                 query (rest s)]
+                 query (concat [{:mark label}] (rest s) [{:select [label]}])]
              (assoc queries label (translate query))))
          {} sub)]
     [{:$facet queries}]))
+     ;; {:$setIntersection (map (comp #(str "$" % "." %) first) queries)}
+

 (def steps
   {:from-edge from-edge


Fix up docstrings to be more accurate

Fix up docstrings to be more accurate

--- src/overtone/sc/ugen.clj
+++ src/overtone/sc/ugen.clj
@@ -286,9 +286,9 @@
                (map #(if (bus? %) (:id %) %) args))))

 (defn- with-ugen-metadata-init
-  "Calls init fn (catching, wrappign and rethrowing any errors). If init fn
-  returns a map, merges it with the ugen else assumes the result is a new
-  arg list and simply assocs it to the ugen under the key :args."
+  "Calls init fn fun. If init fn returns a map, merges it with the ugen
+  otherwise if the result is a new arg list and simply assocs it to the ugen
+  under the key :args, else throws an exception."
   [spec fun ugen]
   (let [rate (:rate ugen)
         args (:args ugen)
@@ -300,7 +300,7 @@

 (defn- placebo-ugen-init-fn
   "The default ugen init fn (used if an :init key is not present in the ugen
-  metadata. Simply returns the args unchanged."
+  metadata). Simply returns the args unchanged."
   [rate args spec] args)

 (defn- with-init-fn


messing with tooltips

messing with tooltips

--- src/prais2/map_data.cljs
+++ src/prais2/map_data.cljs
@@ -1,5 +1,6 @@
 (ns ^:figwheek-always prais2.map-data
     (:require [rum.core :as rum]
+              [prais2.utils :refer [key-with]]
               [prais2.core :as core :refer [event-bus bs-popover bs-tooltip]]
               [prais2.content :as content]
               [prais2.data :as data]
@@ -24,12 +25,42 @@
       [:.detail-container (data/hospital-detail (:map-h-code (rum/react core/app)))]]]]])

+(rum/defc annotate [note]
+  [:#tip1.tooltip.top.in {:role "tooltip"
+                          :data-placement "bottom"}
+   [:.tooltip-arrow]
+   [:.tooltip-inner note]])
+
+(rum/defc static-bars [width]
+  [:.bar-chart
+   [:.bar.button {:style
+                  {:border-radius "0px" :width width :height "25px" :background-color "rgb(249,249,249)"}}
+    ]])
+
+
+(rum/defc hospital-example < rum/reactive
+  []
+  (let [ap (rum/react core/app)]
+    [:#detail
+     (let [selected-row content/sample-hospital]
+
+       (map-indexed key-with
+                    [(data/sample-hospital-intro-text)
+                     (annotate "Ii there")
+                     (data/hospital-header selected-row)
+                     (data/slider-widget content/header-row data/detail-slider-control (:detail-slider-axis-value ap))
+                     (static-bars "95%")
+
+                     (data/chart-cell selected-row (:detail-slider-axis-value ap))
+                     (data/interpretation selected-row)]))]))
+
+
 (rum/defc render-sample-data < rum/reactive []
-  [:.container
+  [:#sample.container
    [:.row
     [:section {:style {:max-width "800px"}}
      [:p]
-     [:h3
+     [:h3 {:data-title "Foo" :data-trigger "manual" :data-toggle "tooltip" :data-placement "bottom"}
       "We present each hospital's observed survival in the context of its predicted range - see illustration below."]

      [:div {:style
@@ -38,158 +69,10 @@
              :margin "10px"
              :padding "20px"
              :box-shadow "2px 2px 2px #888888"}}
-      [:.detail-container (data/hospital-detail (:map-h-code (rum/react core/app)))]]
+      (hospital-example)]

      [:p]
      [:.alert.alert-danger "IMPORTANT: If one hospital has a lower predicted range than another it is only because it treated children with more complex medical problems over that 3 year period!"]

 ]]])
-
-(comment
-
-
-
-[:p.MsoNormal
- [:span
-  {:style "color:#0070C0"}]]
-[:p.MsoNormal
- {:style "text-autospace:none"}
- [:span
-  [:b
-   [:span
-    {:style "color:#6600CC"}
-    "Map of hospitals and their results [ (PS Love this map & presentation!!)]"]]]]
-[:p.MsoNormal
- {:style "text-autospace:none"}
- [:span]]
-[:p.MsoNormal
- {:style "text-autospace:none"}
- [:span
-  "There are fourteen hospitals in the UK and Ireland that perform heart surgery in children (here a child means someone under the age of 16). "]]
-[:p.MsoNormal
- {:style "text-autospace:none"}
- [:span]]
-[:p.MsoNormal
- {:style "text-autospace:none"}
- [:span
-  "This data is updated annually and covers last three years. The survival data in this map is from 2011-14"]]
-[:p.MsoNormal
- {:style "text-autospace:none"}
- [:span]]
-[:p.MsoNormal
- {:style "text-autospace:none"}
- [:span
-  "THEN MIKE MAP"]]
-[:p.MsoNormal
- {:style "text-autospace:none"}
- [:span]]
-[:p.MsoNormal
- {:style "text-autospace:none"}
- [:span
-  "For the example graphic, can we do it with a bit more info – eg see below (I’ve sent you the ppt it’s based on in case useful)!  "]]
-[:p.MsoNormal
- {:style "text-autospace:none"}
- [:span]]
-[:p.MsoNormal
- {:style "text-autospace:none"}
- [:span
-  {:lang "EN-US"}
-  [:img#Picture 2
-   {:border "0", :width "407", :height "300", :src "intro_files/image001.png"}]]]
-[:p.MsoNormal
- [:span
-  "At bottom of map, add this statement “"]
- [:i
-  [:span
-   {:style "background:yellow"}
-   "“There is no evidence that any of these hospitals’ "]]
- [:i
-  [:span
-   {:style "background:yellow"}
-   "survival rates are meaningfully different from what is predicted”"]]]
-[:p.MsoNormal
- [:i
-  [:span
-   {:style "background:transparent"}]]]
-[:p.MsoNormal
- [:span
-  {:style "color:red;background:transparent"}
-  "NOTE: need to check text with NICOR as to actions when outside range! "]]
-[:p.MsoNormal
- {:style "text-autospace:none"}
- [:b
-  [:span
-   {:style "color:red"}]]]
-[:p.MsoNormal
- {:style "text-autospace:none"}
- [:b
-  [:span
-   {:style "color:red"}
-   "NOTE TO ALL: I’d really like to test how we present this example graphic & the map alongside the table… "]]]
-[:p.MsoNormal
- {:style "text-autospace:none"}
- [:b
-  [:span
-   {:style "color:red"}
-   "Also good to test the two colours now for the different ends & the possibility of green “ok” icon along with summary sentence… Not sure I like the idea but… "]]]
-[:p.MsoNormal
- [:b
-  [:span]]]
-[:p.MsoNormal
- [:b
-  [:span
-   "SEPARATE DATA TAB – change label to “TABLED DATA” ? too long? "]]]
-[:p.MsoNormal
- [:b
-  [:span]]]
-[:p.MsoNormal
- [:span
-  "Add to top of table ““This data is updated annually and covers last three years. The data displayed in this chart is from 2011-14”"]]
-[:p.MsoNormal
- [:span]]
-[:p.MsoNormal
- [:span
-  "Call it “Full results table”  to distinguish from the map?"]]
-[:p.MsoNormal
- [:span]]
-[:p.MsoNormal
- [:span
-  "Selecting an individual hospital no longer seems to bring up the individual hospital’s results (like for the map) – would be great if this did work again? (I’m using latest version of Chrome on a windows laptop)"]]
-[:p.MsoNormal
- [:span]]
-[:p.MsoNormal
- [:span
-  "“i” button for survival rate – I like how you’ve changed the text but can you add “, so there is no point ordering the table on this”. (or similar wording?) "]]
-[:p.MsoNormal
- [:span]]
-[:p.MsoNormal
- [:b
-  [:span
-   "Axis title"]]
- [:span
-  ": “Observed survival (black dot) with predicted range (coloured bar)” "]]
-[:p.MsoNormal
- [:span]]
-[:p.MsoNormal
- [:span
-  "At bottom of table, add this statement “"]
- [:i
-  [:span
-   {:style "background:yellow"}
-   "“There is no evidence that any of these hospitals’ "]]
- [:i
-  [:span
-   {:style "background:yellow"}
-   "survival rates are meaningfully different from what is predicted”"]]]
-[:p.MsoNormal
- [:i
-  [:span
-   {:style "background:transparent"}]]]
-[:p.MsoNormal
- [:span
-  {:style "background:transparent"}
-  "Also at bottom of table add link to NICOR report (ie have the downloadable PDF). "]]
-
-
-  )


Type checks for format-date function

Type checks for format-date function

--- src/zg/format_date.clj
+++ src/zg/format_date.clj
@@ -19,8 +19,9 @@

 (defn format-date
     "Format given date using unified date format."
-    [date]
-    (.format unified-date-format date))
+    [^java.util.Date date]
+    (let [^java.text.DateFormat format-object unified-date-format]
+        (.format format-object date)))

 (defn format-current-date
     "Format current date using unified date format."


Make window appear centered

Make window appear centered

--- src/robinson/swingterminal.clj
+++ src/robinson/swingterminal.clj
@@ -187,6 +187,7 @@
                              (.setIconImage icon)
                              (.setFocusTraversalKeysEnabled false)
                              (.setResizable false)
+                             (.setLocationRelativeTo nil)
                              (.pack))]
       (reify ATerminal
         (get-size [this]


Use long to represent offsets

Use long to represent offsets

--- metamorphosis-dashboard/src/main/clojure/com/github/killme2008/metamorphosis/dashboard/handler.clj
+++ metamorphosis-dashboard/src/main/clojure/com/github/killme2008/metamorphosis/dashboard/handler.clj
@@ -66,7 +66,7 @@
 (defn- dashboard [req]
   (render-tpl "dashboard.vm"
               :instance (u/stringfy-map-keys (instance))
-              :version (u/stringfy-map-keys (version))
+              :version (u/stringfy-map-keys (version))
               :jvm (u/stringfy-map-keys (jvm))
               :system (u/stringfy-map-keys (system))))

@@ -111,7 +111,7 @@
                                owner (ZkUtils/readDataMaybeNull zc owner-znode)]
                            (when (or msg-store (seq owner))
                              (let [consumer-offset (if (seq offset-str)
-                                                     (Integer/valueOf
+                                                     (Long/valueOf
                                                       (if (.contains offset-str "-")
                                                         (let [idx (.lastIndexOf offset-str "-")]
                                                           (.substring offset-str (inc idx)))
@@ -119,7 +119,7 @@
                                                      0)
                                    max-offset (if msg-store
                                                 (-> msg-store (.getMaxOffset))
-                                                0)
+                                                0)
                                    min-offset (if msg-store
                                                 (-> msg-store (.getMinOffset))
                                                 0)
@@ -142,7 +142,7 @@

 (defn- skip-pending-msgs [req]
   (let [{:keys [topic group partition]} (-> req :params)
-        partition (Integer/valueOf ^String partition)
+        partition (Long/valueOf ^String partition)
         ^MetaZookeeper mz (with-broker (.getBrokerZooKeeper) (.getMetaZookeeper))
         ^ZkClient zc (.getZkClient mz)
         broker-id (with-broker (.getMetaConfig) (.getBrokerId))


colors

colors

--- src/top_five_things/index.clj
+++ src/top_five_things/index.clj
@@ -12,6 +12,6 @@
   :handle-ok
   (fn [ctx]
     (case (get-in ctx [:representation :media-type])
-      "text/html" (html5 [:body [:p "OK!"]])
+      "text/html" (html5 [:body [:p {:style "color: green"} "OK!"]])
       "application/json" index-body)))


Add debug logging

Add debug logging

--- src/wombats/handlers/auth.clj
+++ src/wombats/handlers/auth.clj
@@ -126,6 +126,15 @@
            {signing-secret-check :signing-secret
             access-key-key :access-key} (read-string (url-decode state))]

+       (log/error (str "github-settings: "
+                       (get-github-settings context)))
+
+       (log/error (str "request-params: "
+                       (:query-params request)))
+
+       (log/error (str "state-decode: "
+                       (read-string (url-decode state))))
+
        ;; Check to see if the request is originating from the correct user
        (if (= signing-secret-check signing-secret)
          (let [github-access-token @(get-access-token {:client_id client-id


Improve API for INCLUDE-type index projections

--- src/taoensso/faraday.clj
+++ src/taoensso/faraday.clj
@@ -166,24 +166,22 @@
        (.setAttributeType (utils/enum key-type))))
    defs))

-(defn- projection "Returns a new Projection object."
-  [projection & [included-attrs]]
-  (let [pr (Projection.)]
-    (.setProjectionType pr (utils/enum projection))
-    (when included-attrs (.setNonKeyAttributes pr included-attrs))
-    pr))
-
 (defn- local-indexes "Returns a vector of new LocalSecondaryIndexes objects."
   [hash-key indexes]
   (mapv
    (fn [{index-name :name
-        :keys [range-key projection included-attrs]
+        :keys [range-key projection]
         :or   {projection :all}
         :as   index}]
      (doto (LocalSecondaryIndex.)
        (.setIndexName  (name index-name))
        (.setKeySchema  (key-schema hash-key range-key))
-       (.setProjection (projection projection included-attrs))))
+       (.setProjection
+        (let [pr (Projection.)
+              ptype (if (vector? projection) :include projection)]
+          (.setProjectionType pr (utils/enum ptype))
+          (when (= ptype :include) (.setNonKeyAttributes pr (mapv name projection)))
+          pr))))
    indexes))

 (defn- expected-values "{attr cond} -> {attr ExpectedAttributeValue}"
@@ -269,7 +267,7 @@
     :hash-key   - (required) {:name <> :type <#{:s :n :ss :ns :b :bs}>}.
     :range-key  - (optional) {:name <> :type <#{:s :n :ss :ns :b :bs}>}.
     :indexes    - (optional) [{:name <> :range-key <>
-                               :projection <#{:all :keys-only [attrs ...]}>}]"
+                               :projection <#{:all :keys-only [<attr1> ...]}>}]"
   [creds {table-name :name
           :keys [throughput hash-key range-key indexes]
           :or   {throughput {:read 1 :write 1}}}]


Add `items-by-attrs` helper for bulk & query/scan result structuring

--- src/taoensso/faraday.clj
+++ src/taoensso/faraday.clj
@@ -625,6 +625,36 @@
                (range total-segments))
          (mapv deref))))

+;;;; Helpers, etc.
+
+(defn items-by-attrs
+  "Groups one or more items by one or more attributes, returning a map of form
+  {<attr-val> <item> ...} or {{<attr> <val> ...} <item>}.
+
+  Good for collecting batch or query/scan items results into useable maps,
+  indexed by their 'primary key' (which, remember, may consist of 1 OR 2 attrs)."
+  [attr-or-attrs item-or-items]
+  (letfn [(item-by-attrs [a-or-as item] ;
+            (if-not (utils/coll?* a-or-as)
+              (let [a  a-or-as] {(get item a) (dissoc item a)})
+              (let [as a-or-as] {(select-keys item as) (apply dissoc item as)})))]
+
+    (if-not (utils/coll?* item-or-items)
+      (let [item  item-or-items] (item-by-attrs attr-or-attrs item))
+      (let [items item-or-items]
+        (into {} (mapv (partial item-by-attrs attr-or-attrs) items))))))
+
+(comment
+  (items-by-attrs :a      {:a :A :b :B :c :C})
+  (items-by-attrs [:a]    {:a :A :b :B :c :C})
+  (items-by-attrs [:a :b] {:a :A :b :B :c :C})
+  (items-by-attrs :a      [{:a :A1 :b :B1 :c :C2}
+                           {:a :A2 :b :B2 :c :C2}])
+  (items-by-attrs [:a]    [{:a :A1 :b :B1 :c :C2}
+                           {:a :A2 :b :B2 :c :C2}])
+  (items-by-attrs [:a :b] [{:a :A1 :b :B1 :c :C2}
+                           {:a :A2 :b :B2 :c :C2}]))
+
 ;;;; README

 (comment


Add proxy support (Rotary PR: cesarpinera)

--- src/taoensso/faraday.clj
+++ src/taoensso/faraday.clj
@@ -36,11 +36,11 @@
              ResourceNotFoundException
              ScanRequest
              WriteRequest]
+            com.amazonaws.ClientConfiguration
             com.amazonaws.auth.BasicAWSCredentials
             com.amazonaws.services.dynamodb.AmazonDynamoDBClient))

 ;;;; TODO Rotary PRs
-;; * Added proxy support (cesarpinera)
 ;; * Feature/can update dynamo items (mrgordon)
 ;; * Support conditional PUT (BestFriendChris)
 ;; * More flexible key support and additional options from SDK (mrgordon)
@@ -65,11 +65,14 @@

 (defn- db-client*
   "Returns an AmazonDynamoDBClient instance for the supplied IAM credentials."
-  [{:keys [access-key secret-key endpoint] :as creds}]
-  (let [aws-creds (BasicAWSCredentials. access-key secret-key)
-        client    (AmazonDynamoDBClient. aws-creds)]
-    (when endpoint (.setEndpoint client endpoint))
-    client))
+  [{:keys [access-key secret-key endpoint proxy-host proxy-port] :as creds}]
+  (let [aws-creds     (BasicAWSCredentials. access-key secret-key)
+        client-config (ClientConfiguration.)]
+    (when proxy-host (.setProxyHost client-config proxy-host))
+    (when proxy-port (.setProxyPort client-config proxy-port))
+    (let [client (AmazonDynamoDBClient. aws-creds client-config)]
+      (when endpoint (.setEndpoint client endpoint))
+      client)))

 (def db-client (memoize db-client*))


finish find-c

finish find-c

--- stuf/src/sandbox/4clojure.clj
+++ stuf/src/sandbox/4clojure.clj
@@ -827,10 +827,12 @@
        :when (= \M (get-in board [y x]))]
     [x y]))

-(defn find-c [board pos]
+(defn find-c [board pos path]
+  (println path)
   (let [val (get-in board pos)]
     (cond
-      (= val nil) false
+      (or (= val nil) (= val \#)) false
+      (some #{pos} path) false
       (= val \C) true
-      :else (some #(find-c board %) (map #(map + pos %2) [[-1 0] [0 -1] [0 1] [1 0]])))))
+      :else (some #(find-c board % (cons pos path)) (map #(mapv + pos %) [[-1 0] [0 -1] [0 1] [1 0]])))))


Info when revoking caps

Info when revoking caps

--- test/icecap/e2e/common.clj
+++ test/icecap/e2e/common.clj
@@ -35,3 +35,4 @@
   "Revokes the capability with the given URL."
   [cap-url]
   (spy (http/delete cap-url)))
+  (info "Revoking cap" cap-url)


Remove default proportion lock from the new shapes.

--- src/uxbox/main/geom.cljs
+++ src/uxbox/main/geom.cljs
@@ -285,14 +285,14 @@
   (let [{:keys [width height]} metadata]
     (assoc shape
            :proportion (/ width height)
-           :proportion-lock true)))
+           :proportion-lock false)))

 (defn setup-proportions-rect
   [shape]
   (let [{:keys [width height]} (size shape)]
     (assoc shape
            :proportion (/ width height)
-           :proportion-lock true)))
+           :proportion-lock false)))

 ;; --- Resize (Dimentsions)


Switched to 8000 port

Switched to 8000 port

--- src/word_keeper/core.clj
+++ src/word_keeper/core.clj
@@ -59,5 +59,5 @@
   (let [handler (if (in-dev?)
                   (reload/wrap-reload (site #'routes))
                   (site routes))]
-    (run-server handler {:port 8080})
-    (println "Head to localhost:8080")))
+    (run-server handler {:port 8000})
+    (println "Head to localhost:8000")))


lein: update version

lein: update version

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -1,3 +1,3 @@
-{:repl {:plugins [[cider/cider-nrepl "0.16.0"]]
+{:repl {:plugins [[cider/cider-nrepl "0.17.0"]]
         :dependencies [[org.clojure/tools.nrepl "0.2.13"]]}
  :user {:plugins [[lein-pprint "1.2.0"]]}}


[lein] Add lein-test-refresh

[lein] Add lein-test-refresh

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -3,6 +3,9 @@

                   ; Check for outdated dependencies
                   [lein-ancient                      "0.6.10"]
+
+                  ;; lein-test when something changes
+                  [com.jakemccrary/lein-test-refresh "0.21.1"]

                   [lein-figwheel                     "0.5.10"]
                   [venantius/ultra                   "0.5.1"]]
@@ -14,7 +17,8 @@
                        ;; http://docs.caudate.me/lucidity/lucid-core.html#core-inject
                        [im.chit/lucid.core.inject    "1.3.9"]]

-        :ultra {:repl {:sort-keys false ; don't sort collections before printing
+        :ultra {:stacktraces false ; don't break my stacktraces thanks
+                :repl {:sort-keys false ; don't sort collections before printing
                        }}

         :injections [(require 'lucid.core.inject)


Add a bunch of reload goodies to our user ns

This implements everything that is required to use `go` `stop` and
`reset` in the user namespace.

Happy hacking!

--- dev/user.clj
+++ dev/user.clj
@@ -11,32 +11,40 @@
    [clojure.string :as str]
    [clojure.test :as test]
    [clojure.tools.namespace.repl :refer [refresh refresh-all]]
-   [expensapp.handler]))
+   [ring.server.standalone :refer [serve]]
+   [expensapp.handler :refer [app]]))

 (def system
   "A Var containing an object representing the application under
   development."
-  nil)
+  (atom nil))

 (defn init
   "Creates and initializes the system under development in the Var
   #'system."
-  []
-  ;; TODO
-  )
+  [])
+

 (defn start
   "Starts the system running, updates the Var #'system."
   []
-  ;; TODO
-  )
+  (let [port 3000]
+    (reset! system
+            (serve app
+                   {:port port
+                    :init init
+                    :open-browser? false
+                    :auto-reload? true
+                    :destroy true
+                    :join true}))
+    (println (str "You can view the site at http://localhost:" port))))

 (defn stop
   "Stops the system if it is currently running, updates the Var
   #'system."
   []
-  ;; TODO
-  )
+  (.stop @system)
+  (reset! system nil))

 (defn go
   "Initializes and starts the system running."


Separated system type into a def to make it checkable in tests.

--- dev/user.clj
+++ dev/user.clj
@@ -15,6 +15,8 @@

 (def system nil)

+(def system-type #_:external-dbs :in-memory)
+

 (defn start
   "Starts the current development system."
@@ -22,7 +24,7 @@
   (config/reset-config-values)
   (data/reset-uniques)

-  (let [s (system/create-system #_:external-dbs :in-memory)]
+  (let [s (system/create-system system-type)]
     (alter-var-root #'system
                     (constantly
                       (system/start s))))


add midje repl

add midje repl

--- dev/user.clj
+++ dev/user.clj
@@ -1,7 +1,10 @@
 (ns user
-  (:require [clojure.java.io :as io]
-            [clojure.string :as str]
-            [clojure.pprint :refer (pprint)]
-            [clojure.repl :refer :all]
-            [clojure.tools.namespace.repl :refer (refresh refresh-all)]
-            [celestial.launch :as launch]))
+  (:use midje.repl)
+  (:require
+     [clojure.java.io :as io]
+     [clojure.string :as str]
+     [clojure.pprint :refer (pprint)]
+     [clojure.repl :refer :all]
+     [clojure.tools.namespace.repl :refer (refresh refresh-all)]
+     [celestial.launch :as launch]))
+


Add a test to catch a bug with tag modifications.

--- test/shale/test/client.clj
+++ test/shale/test/client.clj
@@ -90,6 +90,15 @@
               (is (get session "browser_name") "phantomjs")))]
       (is (= 1 (session-diff test-fn))))))

+(deftest ^:integration test-tag-modification
+  (testing "setting tags"
+    (let [session (first (shale.client/sessions))
+          id (:id session)]
+      (shale.client/modify-session! id {:tags ["test-tag"]})
+      (is (= "test-tag" (-> (shale.client/session id)
+                            :tags
+                            first))))))
+
 (deftest ^:integration test-reservations
   (testing "releasing a session"
     (let [test-fn (fn []


Deleting default test file

Deleting default test file

--- test/clj/clumcl/core_test.clj
+++ test/clj/clumcl/core_test.clj
@@ -1,7 +0,0 @@
-(ns clumcl.core-test
-  (:require [clojure.test :refer :all]
-            [clumcl.core :refer :all]))
-
-(deftest a-test
-  (testing "FIXME, I fail."
-    (is (= 0 1))))


Add a test for h2 identity query.

Add a test for h2 identity query.

--- test/clj_record/util_test.clj
+++ test/clj_record/util_test.clj
@@ -35,6 +35,10 @@
   (are (= _1 (util/id-query-for _2 "table_name"))
     "SELECT LAST_INSERT_ID()" {:classname "com.mysql.jdbc.Driver" :subprotocol "mysql"}))

+(deftest provides-id-query-for-h2
+  (are (= _1 (util/id-query-for _2 "table_name"))
+    "CALL IDENTITY()" {:subprotocol "h2"}))
+
 (deftest throws-if-asked-for-id-query-of-unrecognized-db-spec
   (is (thrown? Exception
     (util/id-query-for {:classname "com.example.MadeUpDriver" :subprotocol "madeup"}))))


write-str without options is complete.

write-str without options is complete.

--- src/cassidy/shon.clj
+++ src/cassidy/shon.clj
@@ -3,85 +3,93 @@
   (:import [java.io PrintWriter]))

 (defprotocol SHONWriter
-  (-write [object out]
-    "Print object to PrintWriter as SHON"))
+  (-write-str [object]
+    "Print object to as a SHON string."))

-(defn- write-string [^CharSequence s ^PrintWriter out]
-  (.print out (str s)))
+(defn- write-string [^CharSequence s]
+  (str s))

-(defn write-dl [m ^PrintWriter out]
-  (.print
-   out
-   (html [:dl.shon
-          (map #(let [[k v] %]
-                  (when-not (string? k)
-                    (throw (Exception. "SHON dl dt elements must be strings.")))
-                  (html [:dt.field (-write k out)]
-                        [:dd {:class (-write k out)} (-write v out)]))
-               m)])))
+(defn write-dl [m]
+  (html [:dl.shon
+         (map #(let [[k v] %]
+                 (when-not (string? (name k))
+                   (throw (Exception. "SHON dl dt elements must be strings.")))
+                 (html [:dt.field (-write-str k)]
+                       [:dd {:class (-write-str k)} (-write-str v)]))
+              m)]))

-(defn write-ol [m ^PrintWriter out])
+(defn write-ol [l]
+  (html [:ol.shon
+         (map #(html [:li (-write-str %)]) l)]))

-(defn write-ul [m ^PrintWriter out])
+(defn write-ul [l]
+  (html [:ul.shon
+         (map #(html [:li (-write-str %)]) l)]))

-(defn- write-bignum [x ^PrintWriter out]
-  (.print out (str x)))
+(defn- write-bignum [x]
+  (str x))

-(defn- write-float [^Float x ^PrintWriter out]
+(defn- write-float [^Float x]
   (cond (.isInfinite x)
         (throw (Exception. "SHON error: cannot write infinite Float."))
         (.isNaN x)
         (throw (Exception. "SHON error: cannot write Float NaN."))
         :else
-        (.print out x)))
+        (str x)))

-(defn- write-double [^Double x ^PrintWriter out]
+(defn- write-double [^Double x]
   (cond (.isInfinite x)
         (throw (Exception. "SHON error: cannot write infinite Double."))
         (.isNaN x)
         (throw (Exception. "SHON error: cannot write Double NaN."))
         :else
-        (.print out x)))
+        (str x)))

-(defn- write-plain [x ^PrintWriter out]
-  (.print out x))
+(defn- write-plain [x]
+  (str x))

-(defn- write-null [x ^PrintWriter out]
-  (.print out "null"))
+(defn- write-null [x]
+  (str "null"))

-(defn- write-named [x out]
-  (write-string (name x) out))
+(defn- write-named [x]
+  (write-string (name x)))

-(defn- write-generic [x out]
+(defn- write-generic [x]
   (if (.isArray (class x))
-    (-write (seq x) out)
+    (-write-str (seq x))
     (throw (Exception. (str "Don't know how to write SHON of " (class x))))))

-(defn- write-ratio [x out]
-  (-write (double x) out))
+(defn- write-ratio [x]
+  (-write-str (double x)))

 ;; nil, true, false
-(extend nil                    SHONWriter {:-write write-null})
-(extend java.lang.Boolean      SHONWriter {:-write write-plain})
+(extend nil                    SHONWriter {:-write-str write-null})
+(extend java.lang.Boolean      SHONWriter {:-write-str write-plain}) ;*

 ;; Numbers
-(extend java.lang.Byte         SHONWriter {:-write write-plain})
-(extend java.lang.Short        SHONWriter {:-write write-plain})
-(extend java.lang.Integer      SHONWriter {:-write write-plain})
-(extend java.lang.Long         SHONWriter {:-write write-plain})
-(extend java.lang.Float        SHONWriter {:-write write-float})
-(extend java.lang.Double       SHONWriter {:-write write-double})
-(extend clojure.lang.Ratio     SHONWriter {:-write write-ratio})
-(extend java.math.BigInteger   SHONWriter {:-write write-bignum})
-(extend java.math.BigDecimal   SHONWriter {:-write write-bignum})
-(extend java.util.concurrent.atomic.AtomicInteger SHONWriter {:-write write-plain})
-(extend java.util.concurrent.atomic.AtomicLong SHONWriter {:-write write-plain})
+(extend java.lang.Byte         SHONWriter {:-write-str write-plain}) ;*
+(extend java.lang.Short        SHONWriter {:-write-str write-plain}) ;*
+(extend java.lang.Integer      SHONWriter {:-write-str write-plain}) ;*
+(extend java.lang.Long         SHONWriter {:-write-str write-plain}) ;*
+(extend java.lang.Float        SHONWriter {:-write-str write-float}) ;*
+(extend java.lang.Double       SHONWriter {:-write-str write-double}) ;*
+(extend clojure.lang.Ratio     SHONWriter {:-write-str write-ratio})
+(extend java.math.BigInteger   SHONWriter {:-write-str write-bignum}) ;*
+(extend java.math.BigDecimal   SHONWriter {:-write-str write-bignum}) ;*
+(extend java.util.concurrent.atomic.AtomicInteger SHONWriter {:-write-str write-plain}) ;*
+(extend java.util.concurrent.atomic.AtomicLong SHONWriter {:-write-str write-plain})    ;*

 ;; Symbols, Keywords and Strings
-(extend clojure.lang.Named     SHONWriter {:-write write-named})
-(extend java.lang.CharSequence SHONWriter {:-write write-string})
+(extend clojure.lang.Named     SHONWriter {:-write-str write-named})
+(extend java.lang.CharSequence SHONWriter {:-write-str write-string}) ;*

-(extend java.lang.Object       SHONWriter {:-write write-generic})
+(extend java.util.Map          SHONWriter {:-write-str write-dl})
+(extend java.util.Collection   SHONWriter {:-write-str write-ul})
+
+(extend java.lang.Object       SHONWriter {:-write-str write-generic})
+
+(defn write-str [x]
+  (-write-str x))


make protobuf-seq close the stream after entire sequence is consumed

--- src/clj/protobuf.clj
+++ src/clj/protobuf.clj
@@ -75,8 +75,9 @@
   (lazy-seq
    (io!
     (let [^InputStream in (input-stream in)]
-      (when-let [p (PersistentProtocolBufferMap/parseDelimitedFrom type in)]
-        (cons p (protobuf-seq type in)))))))
+      (if-let [p (PersistentProtocolBufferMap/parseDelimitedFrom type in)]
+        (cons p (protobuf-seq type in))
+        (.close in))))))

 (defn protobuf-write
   "Write the given protobufs to the given output stream, prefixing each with its length to delimit them."


Refactor maybe-project-linkify

Refactor maybe-project-linkify

--- src-cljs/frontend/components/pages/build/head.cljs
+++ src-cljs/frontend/components/pages/build/head.cljs
@@ -44,27 +44,23 @@
         (.replace (js/RegExp. (.-source pseudo-url-pattern) "gim")
                   "$1$2"))))

+(defn- replace-issue [text link endpoint project-name]
+  (string/replace text
+                  #"(^|\s)#(\d+)\b"
+                  (gstring/format link endpoint project-name)))
+
 (defn- maybe-project-linkify [text vcs-type project-name]
-  (if-not project-name
-    text
-    (let [issue-pattern #"(^|\s)#(\d+)\b"]
-      (cond
-        (and (= vcs-type "bitbucket") (re-find #"pull request #\d+" text))
-        (string/replace
-          text
-          issue-pattern
-          (gstring/format "$1pull request #$2"
-                          (bb-utils/http-endpoint)
-                          project-name))
-        :else
-        (string/replace
-          text
-          issue-pattern
-          (gstring/format "$1#$2"
-                          (case vcs-type
-                            "github" (gh-utils/http-endpoint)
-                            "bitbucket" (bb-utils/http-endpoint))
-                          project-name))))))
+  (cond-> text
+    (and project-name (= "bitbucket" vcs-type) (re-find #"pull request #\d+" text))
+    (replace-issue "$1pull request #$2"
+                   (bb-utils/http-endpoint)
+                   project-name)
+    project-name
+    (replace-issue "$1#$2"
+                   (case vcs-type
+                     "github" (gh-utils/http-endpoint)
+                     "bitbucket" (bb-utils/http-endpoint))
+                   project-name)))

 (defn- commit-line [{:keys [author_name build subject body commit_url commit] :as commit-details} owner]
   (reify


add examples for dbrown, diwhite, dwhite and also make the dibrown example poll the current value of the demand sequence.

--- src/overtone/sc/examples/demand.clj
+++ src/overtone/sc/examples/demand.clj
@@ -6,14 +6,70 @@

 (defexamples dibrown
   (:rand-walk
-   "Random walk through freqs with rate determined by mouse-x"
-   "Here we use dibrown to create an infinite sequence of values between 0 and max where each successive value is no more than step plus or minus the last value. This creates a walk-like effect. We then pull out the values from dibrown using the demand ugen, pulling at the rate defined by the impulse - which is between 1 and 40 depending on the mouse-x coord. Therefore, you can use the mouse to speed up and slow down the walk."
+   "Random whole number walk through freqs with rate determined by mouse-x"
+   "Here we use dibrown to create an infinite sequence of values between 0 and max where each successive value is a whole number no more than step plus or minus the last value. This creates a walk-like effect. We then pull out the values from dibrown using the demand ugen, pulling at the rate defined by the impulse - which is between 1 and 40 depending on the mouse-x coord. Therefore, you can use the mouse to speed up and slow down the walk.
+
+   We poll the current value so you can see the output as well as hear it"
    rate :ar
    [max {:default 15 :doc "Max walk range. Increase to allow for higher freqs."}
     step {:default 1 :doc "Step size. Increase to allow for larger steps (will sound more random)"}]
    "
-   (let [vals (dibrown 0 max step INF)
+   (let [vals (dibrown 0 15 1 INF)
          trig (impulse:kr (mouse-x 1 40 1))
-         freq (+ 340 (* 30 (demand trig 0 vals)))]
+         val (demand trig 0 vals)
+         poll (poll trig val \"dibrown val:\")
+         freq (+ 340 (* 30 val))]
      (* 0.1 (sin-osc freq)))"
    contributor "Sam Aaron"))
+
+(defexamples dbrown
+  (:rand-walk
+   "Random floating point number walk through freqs with rate determined by mouse-x"
+   "Here we use dbrown to create an infinite sequence of values between 0 and max where each successive value is a float no more than step plus or minus the last value. This creates a walk-like effect. We then pull out the values from dibrown using the demand ugen, pulling at the rate defined by the impulse - which is between 1 and 40 depending on the mouse-x coord. Therefore, you can use the mouse to speed up and slow down the walk.
+
+    We poll the current value so you can see the output as well as hear it"
+   rate :ar
+   [max {:default 15 :doc "Max walk range. Increase to allow for higher freqs."}
+    step {:default 1 :doc "Step size. Increase to allow for larger steps (will sound more random)"}]
+   "
+   (let [vals (dbrown 0 15 1 INF)
+         trig (impulse:kr (mouse-x 1 40 1))
+         val (demand trig 0 vals)
+         poll (poll trig val \"dbrown val:\")
+         freq (+ 340 (* 30 val))]
+     (* 0.1 (sin-osc freq)))"
+   contributor "Sam Aaron"))
+
+(defexamples diwhite
+  (:rand-seq
+   "Play a random sequence of integers mapped to freqs with rate determined by mouse-x"
+   "Here we use diwhite to create an infinite sequence of random integer values between 0 and max. We then pull out the values from diwhite using the demand ugen, pulling at the rate defined by the impulse - which is between 1 and 40 depending on the mouse-x coord. Therefore, you can use the mouse to speed up and slow down the walk.
+
+    We poll the current value so you can see the output as well as hear it"
+   rate :ar
+   [max {:default 15 :doc "Max walk range. Increase to allow for higher freqs."}]
+   "
+   (let [vals (diwhite 0 15 INF)
+         trig (impulse:kr (mouse-x 1 40 1))
+         val (demand:kr trig 0 vals)
+         poll (poll trig val \"diwhite val:\")
+         freq (+ 340 (* 30 val))]
+     (* 0.1 (sin-osc freq)))"
+   contributor "Sam Aaron"))
+
+(defexamples dwhite
+  (:rand-seq
+   "Play a random sequence of floats mapped to freqs with rate determined by mouse-x"
+   "Here we use dwhite to create an infinite sequence of random floating point values between 0 and max. We then pull out the values from diwhite using the demand ugen, pulling at the rate defined by the impulse - which is between 1 and 40 depending on the mouse-x coord. Therefore, you can use the mouse to speed up and slow down the walk.
+
+    We poll the current value so you can see the output as well as hear it"
+   rate :ar
+   [max {:default 15 :doc "Max walk range. Increase to allow for higher freqs."}]
+   "
+   (let [vals (dwhite 0 15 INF)
+         trig (impulse:kr (mouse-x 1 40 1))
+         val (demand:kr trig 0 vals)
+         poll (poll trig val \"diwhite val:\")
+         freq (+ 340 (* 30 val))]
+     (* 0.1 (sin-osc freq)))"
+   contributor "Sam Aaron"))


Make :version attr mandatory in update-kvstore service.

--- src/uxbox/services/kvstore.clj
+++ src/uxbox/services/kvstore.clj
@@ -33,8 +33,7 @@
 ;; --- Update KVStore

 (s/def ::update-kvstore
-  (s/keys :req-un [::key ::value ::user]
-          :opt-un [::version]))
+  (s/keys :req-un [::key ::value ::user ::version]))

 (defn update-kvstore
   [conn {:keys [user key value version] :as data}]


Added a boolean parsing function

Added a boolean parsing function

--- src/puppetlabs/kitchensink/core.clj
+++ src/puppetlabs/kitchensink/core.clj
@@ -53,6 +53,13 @@
   (instance? java.util.regex.Pattern regexp))

 ;; ## String utilities
+
+(defn parse-bool
+  "Parse a string and return its boolean value."
+  [s]
+  {:pre [(or (nil? s) (string? s))]
+   :post [(boolean? %)]}
+  (Boolean/parseBoolean s))

 (defn string-contains?
   "Returns true if `s` has the `substring` in it"


Correct project.clj to test plugin for karma

--- plugin/project.clj
+++ plugin/project.clj
@@ -15,9 +15,11 @@
                  [org.clojure/clojurescript "0.0-3308" :scope "provided"]
                  [doo "0.1.6-SNAPSHOT"]]

-  :clean-targets ^{:protect false} [:target-path "resources/public/js/"]
+  :clean-targets ^{:protect false} [:target-path "resources/public/js/" "out"]

-  :doo {:paths {:karma "karma"}}
+  :doo {:paths {:karma "karma"}
+        :alias {:browsers [:chrome :firefox]
+                :dom [:browsers :headless]}}

   :cljsbuild
   {:builds {:test {:source-paths ["src" "test"]


CMR-4499: Use full namespace name rather than an alias to see if that fixes tests in CI

--- system-int-test/test/cmr/system_int_test/search/collection_relevancy/collection_relevancy.clj
+++ system-int-test/test/cmr/system_int_test/search/collection_relevancy/collection_relevancy.clj
@@ -8,7 +8,6 @@
    [cmr.common.config :as config]
    [cmr.common.util :as util :refer [are3]]
    [cmr.mock-echo.client.echo-util :as e]
-   [cmr.search.data.elastic-relevancy-scoring :as elastic-relevancy-scoring]
    [cmr.system-int-test.data2.core :as d]
    [cmr.system-int-test.data2.umm-spec-collection :as data-umm-c]
    [cmr.system-int-test.data2.umm-spec-common :as data-common]
@@ -32,9 +31,9 @@
        "Usage-130,1,130\n"))

 (deftest relevancy-temporal-ranges
-  (dev-sys-util/eval-in-dev-sys `(elastic-relevancy-scoring/set-sort-use-relevancy-score! true))
-  (dev-sys-util/eval-in-dev-sys `(elastic-relevancy-scoring/set-sort-use-temporal-relevancy! true))
-  (dev-sys-util/eval-in-dev-sys `(elastic-relevancy-scoring/set-sort-bin-keyword-scores! false))
+  (dev-sys-util/eval-in-dev-sys `(cmr.search.data.elastic-relevancy-scoring/set-sort-use-relevancy-score! true))
+  (dev-sys-util/eval-in-dev-sys `(cmr.search.data.elastic-relevancy-scoring/set-sort-use-temporal-relevancy! true))
+  (dev-sys-util/eval-in-dev-sys `(cmr.search.data.elastic-relevancy-scoring/set-sort-bin-keyword-scores! false))
   (let [coll1 (d/ingest-umm-spec-collection
                "PROV1"
                (data-umm-c/collection
@@ -87,7 +86,7 @@

    (testing "Keyword, temporal, and usage"
      ;; No binning of community usage
-     (dev-sys-util/eval-in-dev-sys `(elastic-relevancy-scoring/set-community-usage-bin-size! 1))
+     (dev-sys-util/eval-in-dev-sys `(cmr.search.data.elastic-relevancy-scoring/set-community-usage-bin-size! 1))
      (hu/ingest-community-usage-metrics sample-usage-csv)

      (are3 [expected-collections search-params]
@@ -117,20 +116,20 @@
      (is (= [0.65 0.5 0.5]
             (map :score (:refs (search/find-refs :collection {:keyword "Usage"})))))

-     (dev-sys-util/eval-in-dev-sys `(elastic-relevancy-scoring/set-sort-bin-keyword-scores! true))
+     (dev-sys-util/eval-in-dev-sys `(cmr.search.data.elastic-relevancy-scoring/set-sort-bin-keyword-scores! true))

      (testing "bin size 0.1, same order"
-       (dev-sys-util/eval-in-dev-sys `(elastic-relevancy-scoring/set-keyword-score-bin-size! 0.1))
+       (dev-sys-util/eval-in-dev-sys `(cmr.search.data.elastic-relevancy-scoring/set-keyword-score-bin-size! 0.1))
        (is (d/refs-match-order? [coll1 coll2 coll3]
                                 (search/find-refs :collection {:keyword "Usage"}))))

      (testing "bin size 0.2, order by usage"
-       (dev-sys-util/eval-in-dev-sys `(elastic-relevancy-scoring/set-keyword-score-bin-size! 0.2))
+       (dev-sys-util/eval-in-dev-sys `(cmr.search.data.elastic-relevancy-scoring/set-keyword-score-bin-size! 0.2))
        (is (d/refs-match-order? [coll2 coll1 coll3]
                                 (search/find-refs :collection {:keyword "Usage"}))))

      (testing "bin size 0.3 - same as 0.2"
-       (dev-sys-util/eval-in-dev-sys `(elastic-relevancy-scoring/set-keyword-score-bin-size! 0.3))
+       (dev-sys-util/eval-in-dev-sys `(cmr.search.data.elastic-relevancy-scoring/set-keyword-score-bin-size! 0.3))
        (is (d/refs-match-order? [coll2 coll1 coll3]
                                 (search/find-refs :collection {:keyword "Usage"})))))))

@@ -183,17 +182,17 @@
     (hu/ingest-community-usage-metrics sample-usage-csv)
     (testing "Community usage binning"
       (testing "All in different bins returns by community usage order."
-        (dev-sys-util/eval-in-dev-sys `(elastic-relevancy-scoring/set-community-usage-bin-size! 1))
+        (dev-sys-util/eval-in-dev-sys `(cmr.search.data.elastic-relevancy-scoring/set-community-usage-bin-size! 1))
         (is (d/refs-match-order?
              [coll-usage-130 coll-usage-100 coll-usage-30 coll-usage-10 coll-no-usage]
              (search/find-refs :collection {:keyword "Usage"}))))
       (testing "All in the same bin returns by temporal end date."
-        (dev-sys-util/eval-in-dev-sys `(elastic-relevancy-scoring/set-community-usage-bin-size! 1000))
+        (dev-sys-util/eval-in-dev-sys `(cmr.search.data.elastic-relevancy-scoring/set-community-usage-bin-size! 1000))
         (is (d/refs-match-order?
              [coll-no-usage coll-usage-10 coll-usage-30 coll-usage-100 coll-usage-130]
              (search/find-refs :collection {:keyword "Usage"}))))
       (testing "Usage 100 and 130 binned together and no usage, 10, and 30 binned together"
-        (dev-sys-util/eval-in-dev-sys `(elastic-relevancy-scoring/set-community-usage-bin-size! 100))
+        (dev-sys-util/eval-in-dev-sys `(cmr.search.data.elastic-relevancy-scoring/set-community-usage-bin-size! 100))
         (is (d/refs-match-order?
              [coll-usage-100 coll-usage-130 coll-no-usage coll-usage-10 coll-usage-30]
              (search/find-refs :collection {:keyword "Usage"})))))))


Benchmarking

Benchmarking

--- src/euler/helper.clj
+++ src/euler/helper.clj
@@ -1,8 +1,20 @@
 (ns euler.helper)

-;; shortcuts for point-free notation
+;; == point-free notation =====================================================
+;; shortcuts
 (def & "function composition" comp)
 (def p "partial application" partial)
+
+;; == benchmarking ============================================================
+;; taken from https://adambard.com/blog/clojure-reducers-for-mortals/
+
+(defn benchmark
+  "Map f over the range of N x times."
+  [f N x] (let [nums (vec (range N))
+                start (java.lang.System/currentTimeMillis)]
+            (dotimes [n x]
+              (f nums))
+            (- (java.lang.System/currentTimeMillis) start)))

 ;; == factorisation ===========================================================

@@ -185,7 +197,7 @@
    (cond
      (= 1 number) factors
      (factor? number (first ps)) (prime-factors (/ number (first ps))
-                               (conj factors (first ps)) ps)
+                                                (conj factors (first ps)) ps)
      :else (prime-factors number factors (rest ps)))))

 (defn count-divisors
@@ -259,7 +271,7 @@
 (defn digits
   "**digits :: Int -> [Int]**
   Converts a number n into a list of its digits."
-  [n] (map #(Character/digit % 10) (str n)))
+  [n] (map #(Character/getNumericValue %) (str n)))

 (defn narcissistic?
   "**narcissistic? :: Int, Int -> Bool**


CMR-2881: Updated comment.

CMR-2881: Updated comment.

--- ingest-app/src/cmr/ingest/services/ingest_service.clj
+++ ingest-app/src/cmr/ingest/services/ingest_service.clj
@@ -74,7 +74,7 @@
      context (assoc coll-concept :umm-concept collection))

     ;; Validate ingest business rule through umm-lib
-    ;; Remove this as part of CMR-3345
+    ;; TO DO this will be removed at the end of this issue CMR-2881.
     (v/validate-business-rules
      context (assoc coll-concept :umm-concept umm-lib-collection))
     coll-concept))


(MAINT) Reformatting

(MAINT) Reformatting

--- src/puppetlabs/trapperkeeper/authorization/acl.clj
+++ src/puppetlabs/trapperkeeper/authorization/acl.clj
@@ -9,13 +9,11 @@

 (def Entry
   "An authorization entry matching a network or a domain"
-  {
-    :auth-type auth-type
-    :type (schema/enum :allow-all :ip :domain :opaque :regex :dynamic)
-    :qualifier (schema/enum :exact :inexact)
-    :length (schema/maybe schema/Int)
-    :pattern schema/Any
-    })
+  {:auth-type auth-type
+  :type (schema/enum :allow-all :ip :domain :opaque :regex :dynamic)
+  :qualifier (schema/enum :exact :inexact)
+  :length (schema/maybe schema/Int)
+  :pattern schema/Any})

 (def ACL
   "An ordered list of authorization Entry"
@@ -57,8 +55,7 @@
    * exact wins other inexact
    * ip wins other domain
    * larger pattern length wins
-   * order patterns
-  "
+   * order patterns"
   [a :- Entry
    b :- Entry]
   (or-zero
@@ -79,7 +76,11 @@
   [pattern]
   (-> pattern (str/lower-case) (str/split #"\.") reverse vec))

-(def allow-all { :auth-type :allow :type :allow-all :qualifier :exact :length nil :pattern [] })
+(def allow-all {:auth-type :allow
+                :type :allow-all
+                :qualifier :exact
+                :length nil
+                :pattern []})

 (def deny-all {:auth-type :deny
                :type :regex
@@ -92,24 +93,56 @@
   [type :- auth-type
    pattern :- schema/Str]
   (cond
-    (and (= "*" pattern) (= type :allow)) allow-all
+    (and (= "*" pattern) (= type :allow))
+    allow-all
+
     ; global deny
-    (and (= "*" pattern) (= type :deny)) deny-all
+    (and (= "*" pattern) (= type :deny))
+    deny-all
+
     ; exact domain
-    (re-matches #"^(\w[-\w]*\.)+[-\w]+$" pattern) { :auth-type type :type :domain :qualifier :exact :length nil :pattern (munge-name pattern) }
+    (re-matches #"^(\w[-\w]*\.)+[-\w]+$" pattern)
+    {:auth-type type
+     :type :domain
+     :qualifier :exact
+     :length nil
+     :pattern (munge-name pattern)}
+
     ; *.domain.com
     (re-matches #"^\*(\.(\w[-\w]*)){1,}$" pattern)
-      (let [host_sans_star (vec (drop-last (munge-name pattern)))]
-        {:auth-type type :type :domain :qualifier :inexact :length (count host_sans_star) :pattern host_sans_star})
+    (let [host_sans_star (vec (drop-last (munge-name pattern)))]
+      {:auth-type type
+       :type :domain
+       :qualifier :inexact
+       :length (count host_sans_star)
+       :pattern host_sans_star})
+
     ; backreference
-    (re-find #"\$\d+" pattern) {:auth-type type :type :dynamic :qualifier :exact :length nil :pattern (munge-name pattern)}
+    (re-find #"\$\d+" pattern)
+    {:auth-type type
+     :type :dynamic
+     :qualifier :exact
+     :length nil
+     :pattern (munge-name pattern)}
+
     ; opaque string
-    (re-matches #"^\w[-.@\w]*$" pattern) {:auth-type type :type :opaque :qualifier :exact :length nil :pattern [pattern]}
+    (re-matches #"^\w[-.@\w]*$" pattern)
+    {:auth-type type
+     :type :opaque
+     :qualifier :exact
+     :length nil
+     :pattern [pattern]}
+
     ; regex
-    (re-matches #"^/.*/$" pattern) {:auth-type type :type :regex :qualifier :inexact :length nil :pattern (str/replace pattern #"^/(.*)/$" "$1")}
+    (re-matches #"^/.*/$" pattern)
+    {:auth-type type
+     :type :regex
+     :qualifier :inexact
+     :length nil
+     :pattern (str/replace pattern #"^/(.*)/$" "$1")}
+
     :else
-      (throw (Exception. (str "invalid domain pattern: " pattern)))
-    ))
+    (throw (Exception. (str "invalid domain pattern: " pattern)))))

 (schema/defn new-ip :- Entry
   "Creates a new ACE for an ip address or network"
@@ -124,8 +157,7 @@
        :length bits
        :pattern (ip/network (str (str/join "." (map str (take 4 (concat segments [0 0 0])))) "/" bits))})
     (ip/network? pattern) {:auth-type type :type :ip :qualifier :inexact :length (ip/network-length pattern) :pattern (ip/network pattern)}
-    (ip/address? pattern) {:auth-type type :type :ip :qualifier :exact :length nil :pattern (ip/address pattern)}
-  ))
+    (ip/address? pattern) {:auth-type type :type :ip :qualifier :exact :length nil :pattern (ip/address pattern)}))

 ;; ACE matching

@@ -234,4 +266,3 @@
       (if match
         (allow? match)
         false))))
-


Removed pre-compilation - only made things slower

--- src/hiccup.clj
+++ src/hiccup.clj
@@ -9,7 +9,9 @@
 (ns hiccup
   "Efficiently generate HTML from a Clojure data structure."
   (:use clojure.contrib.def)
-  (:use clojure.contrib.java-utils))
+  (:use clojure.contrib.java-utils)
+  (:import clojure.lang.IPersistentVector)
+  (:import clojure.lang.ISeq))

 (defn escape-html
   "Change special characters into HTML character entities."
@@ -21,168 +23,61 @@
     (replace "\"" """)))

 (defn- format-attr
-  "Turn a key-value pair into a pair of attribute-value strings."
-  [[key value]]
-  (cond
-    (true? value) [(as-str key) (escape-html key)]
-    (not value)   nil
-    :otherwise    [(as-str key) (escape-html value)]))
+  "Turn a name/value pair into an attribute stringp"
+  [name value]
+  (str " " (as-str name) "=\"" (escape-html value) "\""))

 (defn- make-attrs
-  "Turn a map into a string of HTML attributes, sorted by attribute name."
+  "Turn a map into a string of sorted HTML attributes."
   [attrs]
-  (remove nil?
-    (for [[attr value] (sort (map format-attr attrs))]
-      (if attr
-        (str " " attr "=\"" value "\"")))))
+  (apply str
+    (sort
+      (for [[attr value] attrs]
+        (cond
+          (true? value) (format-attr attr attr)
+          (not value)   ""
+          :otherwise    (format-attr attr value))))))

 (defvar- re-tag
   #"([^\s\.#]+)(?:#([^\s\.#]+))?(?:\.([^\s#]+))?"
   "Regular expression that parses a CSS-style id and class from a tag name.")
+
+(defvar- container-tags
+  #{"a" "b" "body" "dd" "div" "dl" "dt" "em" "fieldset" "form" "h1" "h2" "h3"
+    "h4" "h5" "h6" "head" "html" "i" "label" "li" "ol" "pre" "script" "span"
+    "strong" "style" "textarea" "ul"}
+  "A list of tags that need an explicit ending tag when rendered.")

 (defn parse-tag-name
   "Parse the id and classes from a tag name."
   [tag]
   (rest (re-matches re-tag (as-str tag))))

-(derive clojure.lang.IPersistentVector ::vector)
-(derive clojure.lang.ISeq ::seq)
-
 (defmulti render-html
-  "Render a Clojure data structure to a seq of HTML at runtime."
+  "Render a Clojure data structure to a string of HTML."
   type)

-(defn render-tag
-  "Render a HTML tag."
-  [tag-name content]
-  (let [[tag id class] (parse-tag-name tag-name)
-        attributes     (make-attrs {:id id, :class class})]
-    (concat
-      (list* "<" tag attributes)
-      content
-      (list "</" tag ">"))))
+(defmethod render-html IPersistentVector
+  [[tag content]]
+  (let [[tag id class]  (parse-tag-name tag)
+        tag-attrs       {:id id, :class class}
+        [attrs content] (if (map? (first content))
+                          [(merge tag-attrs (first content)), (rest content)]
+                          [tag-attrs content])]
+    (if (or content (container-tags tag))
+      (str "<" tag (make-attrs attrs) ">"
+           (render-html content)
+           "</" tag ">")
+      (str "<" tag (make-attrs attrs) " />"))))

-(defn render-attrs
-  "Render an attribute map."
-  [attrs content]
-  (concat
-    (if (map? attrs)
-      (make-attrs attrs))
-    content))
+(defmethod render-html ISeq
+  [coll]
+  (apply str (map render-html coll)))

-(defn render-content
-  "Render the contents of a tag."
-  [content]
-  (cons
-    ">"
-    (render-html
-      (if (map? (first content))
-        (rest content)
-        content))))
+(defmethod render-html :default [x]
+  (as-str x))

-(defmethod render-html ::vector
-  [[tag & content]]
-  (render-tag tag
-    (render-attrs (first content)
-      (render-content content))))
-
-(defmethod render-html ::seq
-  [coll]
-  (mapcat render-html coll))
-
-(defmethod render-html :default
-  [x]
-  (list (as-str x)))
-
-(defn quoted?
-  "True if the form is a quoted value."
-  [x]
-  (and (list? x)
-       (= 'quote (first x))))
-
-(defn literal?
-  "True if the value is a literal value."
-  [x]
-  (or (and (not (seq? x))
-           (not (symbol? x)))
-      (quoted? x)))
-
-(derive clojure.lang.IPersistentList ::form)
-(derive clojure.lang.Symbol ::form)
-
-(defmulti compile-html
-  "Render a Clojure data structure to a seq of HTML at compile-time when
-  possible, at runtime when not."
-  type)
-
-(defn- collapse-strs
-  "Concatenate adjacent strings in a sequence."
-  [coll]
-  (reduce
-    (fn [xs y]
-      (if (and (string? (first xs)) (string? y))
-        (cons (str y (first xs)) (rest xs))
-        (cons y xs)))
-    '()
-    (reverse coll)))
-
-(defn compile-seq
-  "Compile a sequence of Clojure data structures into HTML"
-  [coll]
-  (let [forms (collapse-strs (mapcat compile-html coll))]
-    (if (every? literal? forms)
-      `(list ~@forms)
-      `(concat ~@(for [form forms]
-                   (if (literal? form)
-                     `(list ~form)
-                     form))))))
-
-(defn compile-tag
-  "Attempt to pre-render a HTML tag."
-  [tag-name content]
-  (if (literal? tag-name)
-    (render-tag tag-name content)
-   `(render-tag ~tag-name ~(compile-seq content))))
-
-(defn compile-attrs
-  "Attempt to pre-render an attribute map."
-  [attrs content]
-  (if (map? attrs)
-    (render-attrs attrs content)
-    (if-not (literal? attrs)
-     `((render-attrs ~attrs ~(compile-seq content)))
-      content)))
-
-(defn compile-content
-  "Attempt to pre-render the contents of a tag."
-  [content]
-  (cons
-    ">"
-    (cond
-      (map? (first content))
-        (mapcat compile-html (rest content))
-      (literal? (first content))
-        (mapcat compile-html content)
-      :else
-        (concat
-          (take 2 content)
-          (mapcat compile-html (drop 2 content))))))
-
-(defmethod compile-html ::vector
-  [[tag & content]]
-  (compile-tag tag
-    (compile-attrs (first content)
-      (compile-content content))))
-
-(defmethod compile-html ::form
-  [form]
-  `((render-html ~form)))
-
-(defmethod compile-html :default
-  [x]
-  (render-html x))
-
-(defmacro html
-  "Efficiently render a Clojure data structure into a seq of HTML."
+(defn html
+  "Render Clojure data structures to HTML."
   [& content]
-  (compile-seq content))
+  (render-html content))


Reorder code signing key columns.

Reorder code signing key columns.

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -1391,11 +1391,11 @@
       (html
         (when-not (empty? id)
           [:tr
+           [:td description]
+           [:td filename]
            [:td id]
-           [:td filename]
-           [:td description]
            [:td (datetime/as-time-since uploaded_at)]
-           [:td {:on-click #(raise! owner [:delete-p12 {:project-name project-name :id id}])} [:i.fa.fa-times-circle]]])))))
+           [:td {:on-click #(raise! owner [:delete-p12 {:project-name project-name :id id}])} [:i.material-icons "cancel"]]])))))

 (defn code-signing [{:keys [project osx-keys]} owner]
   (reify
@@ -1416,9 +1416,9 @@
              [:table.table
               [:thead
                [:tr
+                [:th "Description"]
+                [:th "Filename"]
                 [:th "ID"]
-                [:th "Filename"]
-                [:th "Description"]
                 [:th "Uploaded"]
                 [:th]]]
               [:tbody


Refer to `applet-close` as opposed to only "use"-ing that single func.

--- src/videotest/falling/fall_core.clj
+++ src/videotest/falling/fall_core.clj
@@ -1,6 +1,6 @@
 (ns videotest.falling.fall-core
   (:require
-   [quil.applet :as qa :only [applet-close]]
+   [quil.applet :as qa :refer [applet-close]]
    [quil.core :as q]
    [quil.middleware :as m]
    [videotest.falling.cv :as cv])


modify log statements

modify log statements

--- src/vip/data_processor/pipeline.clj
+++ src/vip/data_processor/pipeline.clj
@@ -20,9 +20,10 @@

 (defn check-stop-flag
   [ctx]
-  (log/info "Checking stop request flag")
-  (if (psql/get-run-field ctx :stop_requested)
-    (assoc ctx :stop "Stop requested")
+  (log/debug "Checking stop request flag")
+  (if-let [stop-requested (psql/get-run-field ctx :stop_requested)]
+    (do (log/info "db stop requested by" stop-requested)
+        (assoc ctx :stop "Stop requested"))
     ctx))

 (defn run-pipeline


long wait to make safari happy again

long wait to make safari happy again

--- test/etaoin/api_test.clj
+++ test/etaoin/api_test.clj
@@ -209,7 +209,11 @@
   (testing "wait for an element has class"
     (doto *driver*
       (click {:id :wait-add-class-trigger})
-      (wait-has-class {:id :wait-add-class-target} :new-one))))
+      (wait-has-class {:id :wait-add-class-target}
+                      :new-one
+                      {:timeout 20
+                       :interval 1
+                       :message "No 'new-one' class found."}))))

 (deftest test-close-window
   (is 1)