Inbox: Introduce `replace-column!' and use where necessary.

--- src-cljs/pepa/workflows/inbox2.cljs
+++ src-cljs/pepa/workflows/inbox2.cljs
@@ -75,7 +75,7 @@
   (will-mount [_]
     (api/fetch-inbox!)))

-(declare add-column! current-columns)
+(declare add-column! replace-column! current-columns)

 (defrecord DocumentColumnSource [id document-id]
   ColumnSource
@@ -324,10 +324,9 @@
      [:header
       [:form {:on-submit (fn [e]
                            (ui/cancel-event e)
-                           (let [text (.-value (om/get-node owner "search"))
-                                 columns (->> (current-columns state)
-                                              (remove #(= % [:search (:search column)])))]
-                             (add-column! columns [:search text])))}
+                           (let [text (.-value (om/get-node owner "search"))]
+                             (replace-column! (current-columns state)
+                                              [:search (:search column)] [:search text])))}
        [:input.search {:type "text"
                        :ref "search"
                        :placeholder "Search Documents"
@@ -337,9 +336,9 @@
      [:ul.search-results
       (om/build-all search-result-row (map #(get-in state [:documents %]) documents)
                     {:opts {:on-click (fn [document]
-                                        (let [columns (->> (current-columns state)
-                                                           (remove (fn [[k _]] (= k :search))))]
-                                          (add-column! columns [:document (:id document)])))}})]]))
+                                        (replace-column! (current-columns state)
+                                                         [:search (:search column)]
+                                                         [:document (:id document)]))}})]]))

 (defn ^:private inbox-handle-drop! [state owner page-cache target source page-ids target-idx]
   (let [columns (om/get-state owner :columns)
@@ -416,6 +415,15 @@
        (parse-column-param)
        (remove nil?)))

+(defn- replace-column! [columns old new]
+  {:pre [(vector? old) (vector? new)]}
+  (nav/navigate! (nav/workflow-route
+                  :inbox
+                  {:columns (->> columns
+                                (map #(if (= old %) new %))
+                                (vec)
+                                (serialize-column-param))})))
+
 (defn- add-column! [columns column]
   {:pre [(vector? column)
          (keyword? (first column))


1. applied get :content node

1. applied get :content node

--- src/clj/courtauction/component/crawler.clj
+++ src/clj/courtauction/component/crawler.clj
@@ -70,10 +70,9 @@
                             }
                            )
       )
-    (println "XXXXX" (:content (map (get [(getbyitemprop (:body resp) :class "Ltbl_list")] 0))))
-    (doseq [node (:content (getbyitemprop (:body resp) :class "Ltbl_list"))]
-      (println node)
-      (if (= (:tag node) :tbody)
+;    (println "XXXXX" (:content (getbyitemprop (:body resp) :class "Ltbl_list")))
+    (doseq [node (getbyitemprop (:body resp) :class "Ltbl_list")]
+      (if (= (:tag (:content node)) :tbody)
         (println "XXXXX, " node))
       )
 ;    (println (:body resp))


Catch occasional error in compile for canon output.

--- src/clj/minijava/compile.clj
+++ src/clj/minijava/compile.clj
@@ -41,10 +41,12 @@
     (->> prog
        (apply-tree table)
        (map-method canon)
+			 (map-method (fn [x] (flatten (vector x))))
        (map-method basic-blocks)
        (map-method #(trace % nil))
        (map-method #(flatten (map select %)))
-       (map-method (comp fill vec)))))
+       (map-method (comp fill vec))
+)))

 ;; convert all GAS instructions to strings
 (defn extract-program-text [program]


mapping exposable ports to swarmpit structure

--- src/clj/swarmpit/docker/mapper/inbound.clj
+++ src/clj/swarmpit/docker/mapper/inbound.clj
@@ -8,6 +8,16 @@
 (defn date
   [date]
   (str (.parse date-format date)))
+
+(defn ->image-ports
+  [image-config]
+  (let [ports (:ExposedPorts image-config)]
+    (->> (keys ports)
+         (map #(let [port-segment (str/split (str %) #"/")]
+                 {:containerPort (Integer. (subs (first port-segment) 1))
+                  :protocol      (second port-segment)
+                  :hostPort      0}))
+         (into []))))

 (defn ->network
   [network]


small fix

small fix

--- src/clj/salava/page/main.clj
+++ src/clj/salava/page/main.clj
@@ -385,8 +385,8 @@
 (defn delete-page-showcase-blocks! [db page-id]
  (let [showcase-blocks (select-badge-showcase-blocks {:page_id page-id} db)]
   (doseq [sb showcase-blocks]
-   (delete-showcase-badges! {:block_id (:id sb)} db)
-   (delete-showcase-blocks! {:page_id page-id} db))))
+   (delete-showcase-badges! {:block_id (:id sb)} db))
+  (delete-showcase-blocks! {:page_id page-id} db)))

 (defn delete-profile-block-and-fields! [db page-id]
  (do


thread through renderer in preparation for pixi v4

--- src/cljs/infinitelives/pixi/resources.cljs
+++ src/cljs/infinitelives/pixi/resources.cljs
@@ -20,24 +20,24 @@

 (defn progress-texture
   "Draws an empty box that can serve as a default progress bar for preloading images"
-  [fraction {:keys [empty-colour full-colour
-                    border-colour border-width draw-border
-                    width height
-                    highlight highlight-offset highlight-width
-                    lowlight lowlight-offset lowlight-width]
-             :or {empty-colour 0x000000
-                  full-colour 0x808080
-                  border-colour 0xffffff
-                  border-width 2
-                  draw-border false
-                  width 600
-                  height 40
-                  highlight-offset 0
-                  highlight-width 1
-                  lowlight-offset 0
-                  lowlight-width 1
-                  }
-             :as options}]
+  [renderer fraction {:keys [empty-colour full-colour
+                             border-colour border-width draw-border
+                             width height
+                             highlight highlight-offset highlight-width
+                             lowlight lowlight-offset lowlight-width]
+                      :or {empty-colour 0x000000
+                           full-colour 0x808080
+                           border-colour 0xffffff
+                           border-width 2
+                           draw-border false
+                           width 600
+                           height 40
+                           highlight-offset 0
+                           highlight-width 1
+                           lowlight-offset 0
+                           lowlight-width 1
+                           }
+                      :as options}]
   (let [box (js/PIXI.Graphics.)]
     (doto box
       (.beginFill empty-colour)
@@ -56,10 +56,10 @@
       (when (> bw 0)
         (when highlight
           (doto box
-              (.lineStyle highlight-width highlight)
-              (.moveTo x1 y2)
-              (.lineTo x1 y1)
-              (.lineTo x2 y1)))
+            (.lineStyle highlight-width highlight)
+            (.moveTo x1 y2)
+            (.lineTo x1 y1)
+            (.lineTo x2 y1)))
         (when lowlight
           (doto box
             (.lineStyle lowlight-width lowlight)
@@ -74,8 +74,8 @@

     (.generateTexture box false)))

-(defn add-prog-bar [stage options]
-  (let [s (sprite/make-sprite (progress-texture 0 options)
+(defn add-prog-bar [renderer stage options]
+  (let [s (sprite/make-sprite (progress-texture renderer 0 options)
                               :scale (get options :scale sprite/*default-scale*))]
     (set! (.-alpha s) 0)
     (.addChild stage s)
@@ -141,10 +141,10 @@
         (set! (.-alpha spr) (+ start (* (- end start) (/ (- ticks i) ticks))))
         (when (pos? i) (recur (dec i)))))))

-(defn load-resources [canvas layer urls & {:keys [fade-in fade-out]
-                      :or {fade-in 0.01 fade-out 0.01}
-                      :as options}]
-  (let [b (add-prog-bar (m/get-layer canvas layer) options)]
+(defn load-resources [{:keys [renderer] :as canvas} layer urls & {:keys [fade-in fade-out]
+                                              :or {fade-in 0.01 fade-out 0.01}
+                                                                  :as options}]
+  (let [b (add-prog-bar renderer (m/get-layer canvas layer) options)]
     (go
       ;; fade in
       (<! (fadein b :duration fade-in))
@@ -153,7 +153,7 @@
       (let [coll (<! (resources/load-urls urls
                       (fn [i num-urls url obj]
                         (set! (.-texture b)
-                              (progress-texture (/ i num-urls) options)))))]
+                              (progress-texture renderer (/ i num-urls) options)))))]

         ;; fadeout
         (<! (fadeout b :duration fade-out))


change app-element to a fn

change app-element to a fn

--- src/cljs/clj_money/core.cljs
+++ src/cljs/clj_money/core.cljs
@@ -81,17 +81,17 @@
    [:div.container
     [entities/management]]])

-(def app-element
+(defn app-element []
   (.getElementById js/document "app"))

 (secretary/defroute root-path "/" []
-  (r/render home-page app-element))
+  (r/render home-page (app-element)))

 (secretary/defroute entities-path "/entities" []
-  (r/render entities-page app-element))
+  (r/render entities-page (app-element)))

 (defn mount-root []
-  (r/render home-page app-element))
+  (r/render home-page (app-element)))

 (defn init! []
   (accountant/configure-navigation!


style

style

--- src/cljs/reagent_demo/views/home_page.cljs
+++ src/cljs/reagent_demo/views/home_page.cljs
@@ -51,14 +51,14 @@

 (defn note-button [note] [:button {:on-mouse-down #(note-on note) :on-mouse-up note-off} note])
 (defn note-button2 [note] [:button {:on-mouse-down #(note-on2 note) :on-mouse-up note-off2} (str note " 2")])
-(defn note-button3 [n1 n2] [:button {:on-mouse-down #(note-on3 n1 n2) :on-mouse-up note-off3} (str n1 " " n2)])
+(defn note-button3 [n1 n2] [:button {:style {:height "40px" :border 0 :margin "1px"} :on-mouse-down #(note-on3 n1 n2) :on-mouse-up note-off3} (str n1 "-" n2)])

 (defn button-row [n]
-  [:span (map #(note-button3 n %) (range 10 100 10))
+  [:span (map #(note-button3 n %) (range 10 100 8))
     [:br]])

 (defn button-grid [n]
-  (map #(button-row %) (range 10 n 10)))
+  (map #(button-row %) (range 10 n 8)))

 (defn main []
    [:div [:h2 "Welcome to reagent_demo"]


tiny refactor of results count and added docs

--- src/cljs/gointermod/nav.cljs
+++ src/cljs/gointermod/nav.cljs
@@ -1,7 +1,9 @@
 (ns gointermod.nav
     (:require [re-frame.core :as re-frame]))

-(defn build-url [organism]
+(defn build-url
+  "generate a deep link for a given mine go query - e.g. link straight to humanmine query results page"
+  [organism]
   (str "http://"
       (:url (:mine organism))
       "/loadQuery.do?skipBuilder=true&query="
@@ -9,7 +11,9 @@
       "&trail=|query&method=xml"
 ))

-(defn modal [organism]
+(defn modal
+  "visual component - modal popup to show the query in search status sidebar"
+  [organism]
   [:div.fade {:on-click
       (fn [e]
         (.stopPropagation js/e)
@@ -36,18 +40,21 @@
     ]]]
   )

-(defn prep-status-details [organism]
+(defn prep-status-details
+  "status bar for a given mine"
+  [organism]
+
   [:div
-  (cond
-    (= (:status (:status organism)) :loading)
-    [:span.loading "Loading . . ."]
-    (= (:status (:status organism)) :error)
-    [:span.error "Error loading results"]
-    (= (:status (:status organism)) :na)
-    [:span.na "No search performed"]
-    (= (:status (:status organism)) :success)
-    [:span.success (:details (:status organism)) " results"]
-    )
+    (cond
+      (= (:status (:status organism)) :loading)
+        [:span.loading "Loading . . ."]
+      (= (:status (:status organism)) :error)
+        [:span.error "Error loading results"]
+      (= (:status (:status organism)) :na)
+        [:span.na "No search performed"]
+      (= (:status (:status organism)) :success)
+        [:span.success (:details (:status organism)) " results"]
+      )
    (let [status (:status organism)
          active-modal (re-frame/subscribe [:active-modal])
          active (= @active-modal (:id organism))]
@@ -60,18 +67,17 @@
   (let [organisms (re-frame/subscribe [:organisms])]
     [:div.status
     [:h4 "Search status: "]
-     [:div.results
-    (doall (map (fn [[_ organism]]
-      ^{:key (:id organism)}
-      [:div.organism
-        {:on-click
-          #(re-frame/dispatch [:active-modal (:id organism)])
-          :class (clj->js (:id organism))}
-          [:h5 (:abbrev organism)]
-          [:div (prep-status-details organism)
-        ]]
-           ) @organisms))
-    [:p.info "'Result' in this context means a single organism + ortholog + GO Term combination. Results in the main pane are aggregated, so will not match the numbers shown here."] ]]))
+    (into [:div.results]
+      (map (fn [[_ organism]]
+        [:div.organism
+          {:on-click
+            #(re-frame/dispatch [:active-modal (:id organism)])
+            :class (clj->js (:id organism))}
+            [:h5 (:abbrev organism)]
+            [:div (prep-status-details organism)
+          ]]
+    ) @organisms))
+    [:p.info "'Result' in this context means a single organism + ortholog + GO Term combination. Results in the main pane are aggregated, so will not match the numbers shown here."] ]))

 (defn nav []
 (let [active-view (re-frame/subscribe [:active-view])


node info messages when empty linked resources

--- src/cljs/swarmpit/component/node/info.cljs
+++ src/cljs/swarmpit/component/node/info.cljs
@@ -95,14 +95,18 @@
                                    :node-edit {:id id}
                                    {:section "Labels"})}
                     (comp/svg icon/edit-path))})
-    (comp/card-content
-      {:className "Swarmpit-table-card-content"
-       :key       "nlcc"}
-      (rum/with-key
-        (list/list
-          render-labels-metadata
-          labels
-          nil) "nlccrl"))))
+    (if (empty? labels)
+      (comp/card-content
+        {:key "nlcce"}
+        (html [:div "No labels defined for the node."]))
+      (comp/card-content
+        {:className "Swarmpit-table-card-content"
+         :key       "nlcc"}
+        (rum/with-key
+          (list/list
+            render-labels-metadata
+            labels
+            nil) "nlcclc")))))

 (rum/defc form-plugins < rum/static [networks volumes]
   (comp/card
@@ -145,14 +149,18 @@
          :title     (comp/typography
                       {:variant "h6"
                        :key     "tasks-title"} "Tasks")})
-      (comp/card-content
-        {:className "Swarmpit-table-card-content"
-         :key       "ftcc"}
-        (rum/with-key
-          (list/responsive
-            custom-metadata
-            (filter #(not (= "shutdown" (:state %))) tasks)
-            tasks/onclick-handler) "ftccrl")))))
+      (if (empty? tasks)
+        (comp/card-content
+          {:key "ftcce"}
+          (html [:div "No tasks running on the node."]))
+        (comp/card-content
+          {:className "Swarmpit-table-card-content"
+           :key       "ftcc"}
+          (rum/with-key
+            (list/responsive
+              custom-metadata
+              (filter #(not (= "shutdown" (:state %))) tasks)
+              tasks/onclick-handler) "ftccrl"))))))

 (defn- node-tasks-handler
   [node-id]


Use table replace directly call in init-border.

--- src/cljs/reversi/phaser.cljs
+++ src/cljs/reversi/phaser.cljs
@@ -2,9 +2,9 @@
   (:require [clojure.browser.repl]
             [reversi.core :as rcore]))

-(def *border*  rcore/*default-border*)
-(def *phaser-border* [[] [] [] [] [] [] [] []])
-(def *visible-possible-grids-pos* '())
+(def ^:dynamic *border*  rcore/*default-border*)
+(def ^:dynamic *phaser-border* [[] [] [] [] [] [] [] []])
+(def ^:dynamic *visible-possible-grids-pos* '())
 (def ^:dynamic *default-player-piece* rcore/*black-piece*)
 (def ^:dynamic *default-pc-piece* rcore/*white-piece*)
 (def *game* (js/Phaser.Game.
@@ -154,20 +154,20 @@
         (set! (.-phaserBorder game)
               (assoc-in phaser-border [y x grid-name] pgrid))))))

-;; (defn game-loop []
-;;   (js/alert "wiwi"))
-
 (defn init-border [game]
-  (let [phaser-border (.-phaserBorder game)]
-    (set! (.-visible ((rcore/gridth [3 3] phaser-border) "black-piece")) true)
-    (set! (.-visible ((rcore/gridth [4 4] phaser-border) "black-piece")) true)
-    (set! (.-visible ((rcore/gridth [4 3] phaser-border) "white-piece")) true)
-    (set! (.-visible ((rcore/gridth [3 4] phaser-border) "white-piece")) true)
-    (set! (.-visible ((rcore/gridth [3 4] phaser-border) "white-piece")) true)
-    (set! (.-visible ((rcore/gridth [4 2] phaser-border) "possible-grid")) true)
-    (set! (.-visible ((rcore/gridth [3 5] phaser-border) "possible-grid")) true)
-    (set! (.-visible ((rcore/gridth [5 3] phaser-border) "possible-grid")) true)
-    (set! (.-visible ((rcore/gridth [2 4] phaser-border) "possible-grid")) true)
+  (let [phaser-border (.-phaserBorder game)
+        view-table [[[3 3] "black-piece"]
+                    [[4 4] "black-piece"]
+                    [[4 3] "white-piece"]
+                    [[3 4] "white-piece"]
+                    [[4 2] "possible-grid"]
+                    [[3 5] "possible-grid"]
+                    [[5 3] "possible-grid"]
+                    [[2 4] "possible-grid"]]]
+    (doseq [view-pair view-table]
+      (let [pos (first view-pair)
+            name (second view-pair)]
+        (set! (.-visible ((rcore/gridth pos phaser-border) name)) true)))
     (doseq [pos [ [4 2] [3 5] [5 3] [2 4] ]]
       (let [visible-possible-grids-pos (.-visiblePossibleGridsPos game)]
         (set! (.-visiblePossibleGridsPos game)
@@ -194,7 +194,7 @@
     (set! (.-restartButton game) restart-button)))

 (def ^:dynamic *assets-table*
-                                        ;name    path
+   ;name    path
   [["border"         "assets/reversi-border.png"]
    ["white-piece"    "assets/white-piece.png"]
    ["black-piece"    "assets/black-piece.png"]
@@ -213,12 +213,12 @@

 ;; (defn render [game])

-(defn init-reversi []
-  (set! (.-border *game*) *border*)
-  (set! (.-phaserBorder *game*) *phaser-border*)
-  (set! (.-visiblePossibleGridsPos *game*) *visible-possible-grids-pos*)
-  (set! (.-defaultPlayerPiece *game*) *default-player-piece*)
-  (set! (.-defaultPcPiece *game*) *default-pc-piece*))
+(defn init-phaser [game]
+  (set! (.-border game) *border*)
+  (set! (.-phaserBorder game) *phaser-border*)
+  (set! (.-visiblePossibleGridsPos game) *visible-possible-grids-pos*)
+  (set! (.-defaultPlayerPiece game) *default-player-piece*)
+  (set! (.-defaultPcPiece game) *default-pc-piece*))

 (defn create [game]
   (set! (.-backgroundColor (.-stage game)) "#ffffff")
@@ -230,7 +230,7 @@
   (init-border game))

 (defn ^export start [game]
-  (init-reversi)
+  (init-phaser game)
     (.add (.-state game) "main"
           (clj->js {:preload preload
                     :create create


Fixed a refactor, moving named constant ns

Refreshing missed the change. Didn't spot the problem until I restarted
the JVM.

--- src/clojure/frereth_cp/server/initiate.clj
+++ src/clojure/frereth_cp/server/initiate.clj
@@ -11,7 +11,7 @@
             [frereth-cp.shared.constants :as K]
             [frereth-cp.shared.crypto :as crypto]
             [frereth-cp.shared.serialization :as serial]
-            [frereth-cp.shared.specs :as shared-specs]
+            [frereth-cp.shared.specs :as specs]
             [frereth-cp.util :as util]
             [manifold.deferred :as dfrd]
             [manifold.stream :as strm])
@@ -43,8 +43,8 @@
   [shared-key nonce-suffix box nonce]
   (b-t/byte-copy! nonce K/initiate-nonce-prefix)
   (b-t/byte-copy! nonce
-                  shared-specs/client-nonce-prefix-length
-                  shared-specs/client-nonce-suffix-length
+                  specs/client-nonce-prefix-length
+                  specs/client-nonce-suffix-length
                   nonce-suffix)
   (try
     (let [plain-vector (crypto/open-after box 0 (count box) nonce shared-key)]
@@ -147,7 +147,7 @@
                   K/box-zero-bytes
                   K/hello-crypto-box-length
                   hello-cookie
-                  K/server-nonce-suffix-length)
+                  specs/server-nonce-suffix-length)
   (let [;; Q: How much faster/more efficient is it to have a
         ;; io.netty.buffer.PooledByteBufAllocator around that
         ;; I could use for either .heapBuffer or .directBuffer?
@@ -156,8 +156,8 @@
     (try
       (b-t/byte-copy! nonce K/cookie-nonce-minute-prefix)
       (b-t/byte-copy! nonce
-                      shared-specs/server-nonce-prefix-length
-                      shared-specs/server-nonce-suffix-length
+                      specs/server-nonce-prefix-length
+                      specs/server-nonce-suffix-length
                       hello-cookie)
       (crypto/secret-unbox dst dst K/server-cookie-length nonce (::state/minute-key cookie-cutter))
       true
@@ -169,7 +169,7 @@
                         K/box-zero-bytes
                         K/hello-crypto-box-length
                         hello-cookie
-                        shared-specs/server-nonce-suffix-length)
+                        specs/server-nonce-suffix-length)

         (try
           (crypto/secret-unbox dst
@@ -292,8 +292,9 @@
         :ret boolean?)
 (defn validate-server-name
   [state inner-client-box]
-  (let [^bytes rcvd-name (::shared-specs/srvr-name inner-client-box)
-        my-name (get-in state [::shared/my-keys ::shared-specs/srvr-name])
+  (let [rcvd-name (::specs/srvr-name inner-client-box)
+        rcvd-name (bytes rcvd-name)
+        my-name (get-in state [::shared/my-keys ::specs/srvr-name])
         match (b-t/bytes= rcvd-name my-name)]
     (when-not match
       (log/warn (str "Message was intended for another server\n"
@@ -431,7 +432,7 @@
                              ;; This takes us down to line 381
                              (when (verify-client-public-key-triad state client-short-pk client-message-box)
                                (let [^ByteBuf rcvd-nonce-buffer (::K/outer-i-nonce initiate)
-                                     rcvd-nonce-array (byte-array shared-specs/client-nonce-suffix-length)
+                                     rcvd-nonce-array (byte-array specs/client-nonce-suffix-length)
                                      _ (.getBytes rcvd-nonce-buffer 0 rcvd-nonce-array)
                                      _ (.release rcvd-nonce-buffer)
                                      rcvd-nonce (b-t/uint64-unpack rcvd-nonce-array)


benchmark

benchmark

--- src/cljs/triboard/ai/ai.cljs
+++ src/cljs/triboard/ai/ai.cljs
@@ -105,6 +105,12 @@
         ai (make-ai (:board turn) (:player turn))]
     (tree-score ai init-game 2)))

+#_(defn benchmark
+  []
+  (time (dotimes [i 10]
+          (test-score-tree)
+          )))
+
 ;; -----------------------------------------

 (defn- worst-possible-score-from


Changed digits

Changed digits

--- src/clojush/problems/software/digits_c.clj
+++ src/clojush/problems/software/digits_c.clj
@@ -16,6 +16,7 @@
   (:use clojush.pushgp.pushgp
         [clojush pushstate interpreter random util globals]
         clojush.instructions.tag
+        clojush.instructions.environment
         [clojure.math numeric-tower]
         ))

@@ -32,7 +33,7 @@
             'in1
             ;;; end input instructions
             )
-          (registered-for-stacks [:integer :boolean :string :char :exec :print])))
+          (registered-for-stacks [:integer :boolean :string :char :exec :print :environment])))

 (defn my-rand-long
   "replaces rand-int when need longs"


force heroku rebuild

force heroku rebuild

--- src/cljs/workers/turtle.cljs
+++ src/cljs/workers/turtle.cljs
@@ -109,4 +109,4 @@

 (w/on-message (fn [[l-system-data result-cmds]]
                 (let [l-system (l-system-coercer l-system-data)]
-                  (w/post-message (gen-lines-coords l-system result-cmds)))))
+                  (w/post-message (gen-lines-coords l-system result-cmds)))))


force heroku rebuild

force heroku rebuild

--- src/cljs/workers/turtle.cljs
+++ src/cljs/workers/turtle.cljs
@@ -73,7 +73,6 @@
               (update-in [:position :y] (partial move-fn :y))
               (update-turtle-lines position))))

-
 (s/defmethod
   command :left :- ch/Turtle
   [_ turtle :- ch/Turtle


Type hint for default configuration.

Type hint for default configuration.

--- src/clojure/parkour/conf.clj
+++ src/clojure/parkour/conf.clj
@@ -7,7 +7,7 @@
            [org.apache.hadoop.conf Configuration Configurable]
            [org.apache.hadoop.mapreduce Job JobContext]))

-(def ^:dynamic ^:private *default*
+(def ^:dynamic ^:private ^Configuration *default*
   "Base configuration, used as template for fresh configurations."
   (Configuration.))


Expand tool API to expose more underlying options.

--- src/clojure/parkour/tool.clj
+++ src/clojure/parkour/tool.clj
@@ -1,5 +1,6 @@
 (ns parkour.tool
-  (:require [parkour.util :refer [coerce]])
+  (:require [parkour.conf :as conf]
+            [parkour.util :refer [coerce]])
   (:import [org.apache.hadoop.conf Configuration Configurable]
            [org.apache.hadoop.util Tool ToolRunner]))

@@ -18,11 +19,17 @@
 `Configuration` as it's first argument, follow by any number of
 additional (command-line string) argument."
   {:tag `Tool}
-  [f] (ParkourTool. nil f))
+  ([f] (ParkourTool. nil f))
+  ([conf f] (ParkourTool. (conf/iguration conf) f)))

 (defn run
   "Run the Tool/function `t` with the arguments `args`."
   ([t args]
-     (ToolRunner/run (coerce Tool tool t) (into-array String args)))
-  ([^Configuration conf t args]
-     (ToolRunner/run conf (coerce Tool tool t) (into-array String args))))
+     (let [t (coerce Tool tool t)
+           args (into-array String args)]
+       (ToolRunner/run ^Tool t args)))
+  ([conf t args]
+     (let [conf (conf/iguration conf)
+           t (coerce Tool tool t)
+           args (into-array String args)]
+       (ToolRunner/run ^Configuration conf ^Tool t args))))


Don't thread where a function call will suffice

The -> & ->> threading macros are very useful to sometimes untangle
nested function calls. However, as it's just a single function call on a
Clojure map, directly call the function with our data to simplify things
for the reader.

--- src/com/puppetlabs/puppetdb/query/node.clj
+++ src/com/puppetlabs/puppetdb/query/node.clj
@@ -128,6 +128,5 @@
   (when (empty? terms)
     (throw (IllegalArgumentException. (str op " requires at least one term"))))
   (let [term  (compile-term (cons "or" terms))
-        query (->> (:where term)
-                   (format "NOT (%s)"))]
+        query (format "NOT (%s)" (:where term))]
     (assoc term :where query)))


core: when

core: when

--- core.clj
+++ core.clj
@@ -341,3 +341,9 @@
                      (list 'var name)))))

 (set-macro* #'defmacro)
+
+(defmacro when
+  "Evaluates test. If logical true, evaluates body in an implicit do."
+  {:added "1.0"}
+  [test & body]
+  (list 'if test (cons 'do body)))


Use 'identity' instead of '#(do %)'

Use 'identity' instead of '#(do %)'

--- src/cyanite_remover/core.clj
+++ src/cyanite_remover/core.clj
@@ -65,7 +65,7 @@
 (defn- get-sort-or-dummy-fn
   "Get sort or dummy function."
   [sort?]
-  (if sort? sort #(do %)))
+  (if sort? sort identity))

 (defn- lookup-paths
   "Lookup paths."
@@ -73,7 +73,7 @@
    & [sidefx-fn]]
   (let [lookup-fn #(pstore/lookup pstore tenant leafs-only limit-depth %
                                   exclude-paths)
-        sidefx-wrapper (if sidefx-fn #(do (sidefx-fn %) %) #(do %))
+        sidefx-wrapper (if sidefx-fn #(do (sidefx-fn %) %) identity)
         sort (get-sort-or-dummy-fn sort-paths?)]
     (sort (map :path (map sidefx-wrapper (flatten (map lookup-fn paths)))))))


Reformat code

Reformat code

--- src/day8/re_frame/trace.cljs
+++ src/day8/re_frame/trace.cljs
@@ -28,15 +28,15 @@

 ;; from https://github.com/reagent-project/reagent/blob/3fd0f1b1d8f43dbf169d136f0f905030d7e093bd/src/reagent/impl/component.cljs#L274
 (defn fiber-component-path [fiber]
-  (let [name (some-> fiber
-                     ($ :type)
-                     ($ :displayName))
+  (let [name   (some-> fiber
+                       ($ :type)
+                       ($ :displayName))
         parent (some-> fiber
                        ($ :return))
-        path (some-> parent
-                     fiber-component-path
-                     (str " > "))
-        res (str path name)]
+        path   (some-> parent
+                       fiber-component-path
+                       (str " > "))
+        res    (str path name)]
     (when-not (empty? res) res)))

 (defn component-path [c]


spelling and plural

spelling and plural

--- src/foosball/views/front.clj
+++ src/foosball/views/front.clj
@@ -24,12 +24,12 @@
     [:h1 "Foosball"]
     [:h2 "Keeps track of results, ratings and players for foosball matches."]
     [:div.row
-     (nav-button "/stats/players" "See all player's ratings")
+     (nav-button "/stats/players" "See ratings for all players")
      (nav-button "/matchup"       "Matchup players for a match")]
     [:br]
     [:div.row
      (nav-button "/report/match"  "Report the result of a match")
-     (nav-button "/matches"       "See all played matches' results")]]
+     (nav-button "/matches"       "See results of all played  matches")]]
    [:table.table.table-hover.table-condensed
     [:caption [:h1 "Current leaderboard"]]
     [:thead


Produce a login link when attempting to view unapproved problems.

--- src/foreclojure/problems.clj
+++ src/foreclojure/problems.clj
@@ -323,10 +323,14 @@
            [:button.large {:id "approve-button"} "Approve"]]))]}))

 (defn problem-page [id]
-  (if (or (:approved (get-problem id))
-          (approver? (session/session-get :user)))
-    (code-box id)
-    (flash-error "You cannot access this page" "/problems")))
+  (let [error #(flash-error % "/problems")
+        user (delay (session/session-get :user))]
+    (if-let [{:keys [approved]} (get-problem id)]
+      (cond (or approved (approver? (force user))) (code-box id)
+            (force user) (error "You cannot access this page")
+            :else (error (str "You must " (login-link)
+                              " to view unapproved problems")))
+      (error "No such problem!"))))

 (def-page show-solutions-page [problem-id]
   {:title "4Clojure - Problem Solutions"


bootstrap boot/myocamlbuild.boot

bootstrap boot/myocamlbuild.boot

git-svn-id: e7e61699ce1738538ffebb75374fbea0924bc775@7925 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02


[build sys] regen boot/myocamlbuild.boot

git-svn-id: e7e61699ce1738538ffebb75374fbea0924bc775@8593 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02


Staging banner copy

Staging banner copy

--- src/clj/clojuredocs/site/common.clj
+++ src/clj/clojuredocs/site/common.clj
@@ -95,7 +95,7 @@
     [:div.sticky-wrapper
      (when config/staging?
        [:div.staging-banner
-        "This is the ClojureDocs staging site, where you'll find all the neat things we're working on (don't link to here)."])
+        "This is the ClojureDocs staging site, where you'll find all the neat things we're working on. Please don't link to here."])
      ($navbar opts)
      [:div.container
       [:div.row


Adding locale to app component

Adding locale to app component

--- src/clj/zetawar/components/app.cljs
+++ src/clj/zetawar/components/app.cljs
@@ -3,20 +3,22 @@
    [com.stuartsierra.component :as component]
    [posh.core :as posh]))

-(defrecord App [datascript router timbre conn ev-chan notify-pub players]
+(defrecord App [datascript router timbre conn ev-chan notify-pub players locale]
   component/Lifecycle
   (start [component]
     (assoc component
            :conn (:conn datascript)
            :ev-chan (:ev-chan router)
            :notify-pub (:notify-pub router)
-           :players (:players router)))
+           :players (:players router)
+           :locale :en))
   (stop [component]
     (assoc component
            :datascript nil
            :conn nil
            :ev-chan nil
-           :players nil)))
+           :players nil
+           :locale nil)))

 (defn new-app
   []


Various comment/docstring tweakings in protocols ns

--- src/clj_bots/pin_ctrl/protocols.clj
+++ src/clj_bots/pin_ctrl/protocols.clj
@@ -22,15 +22,16 @@
   (create-board [this config] "Return a new board instance of this implementation. This shouldn't do any initializaiton.")
   (default-config [this] "Return the default configuration map (see schema XXX) for this implementation. This is useful for simulation."))

+;; read-raw-value -> analog-bits
+;; remove-mult
+;; updat set-edge!
+;;
+;; finshed:
+;; read-value : arity taking mode
+;; write-value : arity taking mode
+;; added init!
 ;; changes: pin-modes -> available-modes
 ;; current-pin-modes -> pin-modes
-;; added init!
-;; read-raw-value -> analog-bits
-;; read-value : arity taking mode
-;; write-value : arity taking mode
-;; remove-mult
-;; updat set-edge!
-

 ;; # Board Implementation Protocols
 ;;
@@ -42,7 +43,7 @@
   (init! [this] "Do any necessary initialization. Not required. Should return the board.")
   (available-pin-modes [this] "Return a map of pin numbers to available pin modes.")
   ;; This should now be optional, with the default calling through to the recorded state
-  (pin-modes [this] "Get the current pin mode values. Implementing this method is optional; default behaviour is to track modes and return from there."))
+  (pin-modes [this] "Get the current pin mode values. Implementing this method is optional; default behaviour is to let the state wrapper track modes and return from there. Only implement this method if you want to manually implement functions that directly query the board for a pin's state."))

 ; Need to have a good way of setting default nullary implementations of these
 (defprotocol POverwireBoard


Function job-name->url should accept (two) Strings only

--- src/clj_jenkins_api/jenkins_api.clj
+++ src/clj_jenkins_api/jenkins_api.clj
@@ -28,7 +28,7 @@

 (defn job-name->url
     "Transform job name (that can contain spaces) to the URL part."
-    [jenkins-url job-name]
+    [^String jenkins-url ^String job-name]
     (str jenkins-url "job/" (encode-spaces job-name)))

 (defn update-jenkins-url


Make tooltip failsafe

Make tooltip failsafe

--- src/discuss/components/tooltip.cljs
+++ src/discuss/components/tooltip.cljs
@@ -19,13 +19,13 @@
 (defn show
   "Show tooltip by removing a class."
   []
-  (let [tooltip (get-tooltip)]
+  (when-let [tooltip (get-tooltip)]
     (lib/add-class tooltip "discuss-tooltip-active")))

 (defn hide
   "Hide tooltip by adding a class."
   []
-  (let [tooltip (get-tooltip)]
+  (when-let [tooltip (get-tooltip)]
     (lib/remove-class tooltip "discuss-tooltip-active")))

 (defn x-position
@@ -56,11 +56,11 @@
 (defn move-to-selection
   "Sets CSS position of tooltip and move it to the mouse selection."
   []
-  (let [tooltip (get-tooltip)
-        [top left] (calc-position tooltip.offsetWidth tooltip.offsetHeight)]
-    (set! (.. tooltip -style -top) (str top "px"))
-    (set! (.. tooltip -style -left) (str left "px"))
-    (show)))
+  (when-let [tooltip (get-tooltip)]
+    (let [[top left] (calc-position tooltip.offsetWidth tooltip.offsetHeight)]
+      (set! (.. tooltip -style -top) (str top "px"))
+      (set! (.. tooltip -style -left) (str left "px"))
+      (show))))

 ;;;; Include listener for tooltips


Removed unused function.

Removed unused function.

--- src/dragon/blog/content/rfc5322.clj
+++ src/dragon/blog/content/rfc5322.clj
@@ -17,16 +17,6 @@
    :keywords :tags
    :comments :comment-link})

-; (defn remap-keys
-;   "Update the keys in a map, converting them with the provided function."
-;   [mapper-fn ^clojure.lang.PersistentArrayMap data]
-;   (rename-keys
-;     data
-;     (->> data
-;          (keys)
-;          (map #(vector % (mapper-fn %)))
-;          (into {}))))
-
 (defn parse
   "Parse the given message, converting the parsed tree into a Clojure map."
   ([msg]


Fix year on the copyright preamble on promesa/core.cljc file.

--- src/promesa/core.cljc
+++ src/promesa/core.cljc
@@ -1,4 +1,4 @@
-;; Copyright (c) 2015 Andrey Antukh <niwi@niwi.nz>
+;; Copyright (c) 2015-2016 Andrey Antukh <niwi@niwi.nz>
 ;; All rights reserved.
 ;;
 ;; Redistribution and use in source and binary forms, with or without


Add another type hint

Add another type hint

--- src/play_clj/core_render.clj
+++ src/play_clj/core_render.clj
@@ -24,7 +24,7 @@
     (.draw ^Stage renderer)))

 (defn tiled-map-layer
-  [{:keys [^BatchTiledMapRenderer renderer]} layer]
+  [{:keys [^BatchTiledMapRenderer renderer]} ^String layer]
   (assert renderer)
   (-> renderer .getMap .getLayers (.get layer)))


(maint) remove extra parens from handle-server-error

--- src/clj/puppetlabs/services/ca/certificate_authority_core.clj
+++ src/clj/puppetlabs/services/ca/certificate_authority_core.clj
@@ -28,10 +28,10 @@
 ;;; 'handler' functions for HTTP endpoints

 (defn handle-server-error
-  ([message]
-    (-> (rr/response message)
-        (rr/status 400)
-        (rr/content-type "text/plain"))))
+  [message]
+  (-> (rr/response message)
+      (rr/status 400)
+      (rr/content-type "text/plain")))

 (defn handle-get-certificate
   [subject {:keys [cacert signeddir]}]


Updated ring-core dependency versions

Updated ring-core dependency versions

--- ring-core/project.clj
+++ ring-core/project.clj
@@ -3,10 +3,10 @@
   :url "https://github.com/ring-clojure/ring"
   :dependencies [[org.clojure/clojure "1.3.0"]
                  [ring/ring-codec "1.0.0"]
-                 [commons-io "2.1"]
-                 [commons-fileupload "1.2.1"]
+                 [commons-io "2.4"]
+                 [commons-fileupload "1.2.2"]
                  [javax.servlet/servlet-api "2.5"]
-                 [clj-time "0.3.7"]]
+                 [clj-time "0.4.4"]]
   :profiles
   {:1.4 {:dependencies [[org.clojure/clojure "1.4.0"]]}
    :1.5 {:dependencies [[org.clojure/clojure "1.5.0-RC1"]]}})


consumer ns has been cleaned up

consumer ns has been cleaned up

--- extra_components/kafka/src/clj/hellhound/kafka/consumers.clj
+++ extra_components/kafka/src/clj/hellhound/kafka/consumers.clj
@@ -1,4 +1,16 @@
 (ns hellhound.kafka.consumers
+  "This namespace provides a very lightweight wrapper around the official Kafka
+  Consumer API. Here's a very simple example:
+
+  ``` clj
+  (let [c (make-consumer {"bootstrap.servers" "localhost:9092"
+                          "group.id"          "test"})]
+    (subscribe c ["sometopoc"])
+    (consume-each c #(println %))
+    (.close c)
+  ```
+  For more information please checkout the KafkaConsumer API documentation
+  "
   (:require
    [hellhound.kafka.core :as core])
   (:import
@@ -64,14 +76,3 @@
      (if timeout
        (consume consumer func timeout)
        (consume consumer func)))))
-
-(comment
-  (def c (make-consumer {"bootstrap.servers" "localhost:9092"
-                         "group.id"          "test"}))
-
-
-  (subscribe c ["something"])
-  (consume-each c (fn [x]
-                    (println "-------------------")
-                    (println x))) 1000
-  (.close c))


Fix handlers indentation

Fix handlers indentation

--- src/trustroots/handlers.cljs
+++ src/trustroots/handlers.cljs
@@ -1,14 +1,13 @@
 (ns trustroots.handlers
-  (:require
-    [clojure.walk :refer [keywordize-keys]]
-    [re-frame.core :refer [register-handler after dispatch dispatch-sync]]
-    [schema.core :as   s :include-macros true]
-    [trustroots.domain.main :as main :refer [app-db schema]]
-    [trustroots.helpers :refer [log info debug]]
-    [trustroots.db :as db]
-    [trustroots.domain.auth :as auth]
-    [trustroots.api :as api]
-    [clojure.string :as str]))
+  (:require [clojure.walk :refer [keywordize-keys]]
+            [re-frame.core :refer [register-handler after dispatch dispatch-sync]]
+            [schema.core :as   s :include-macros true]
+            [trustroots.domain.main :as main :refer [app-db schema]]
+            [trustroots.helpers :refer [log info debug]]
+            [trustroots.db :as db]
+            [trustroots.domain.auth :as auth]
+            [trustroots.api :as api]
+            [clojure.string :as str]))

 ;; -- Constants

@@ -38,11 +37,11 @@
   "Simplify register handler calls by automatically registring middleware
    and by droping event name from event arguments"
   (register-handler
-    event-name
-    validate-schema-mw
-    (fn [db evt]
-      (debug (str "Dispatch " event-name))
-      (apply handler-fn (concat [db] (rest evt))))))
+   event-name
+   validate-schema-mw
+   (fn [db evt]
+     (debug (str "Dispatch " event-name))
+     (apply handler-fn (concat [db] (rest evt))))))

 (defn add-in-progress-event-for [db event-key] db)

@@ -103,13 +102,13 @@
 ;; -------------------------------------------------------------

 (register-handler-for
-  :initialize-db
-  (fn [_ _]
-    (info app-db)
-    (db/cache-load user-pwd-cache-key
-                (fn [data] (dispatch [:auth/login data]))
-                identity)
-    app-db))
+ :initialize-db
+ (fn [_ _]
+   (info app-db)
+   (db/cache-load user-pwd-cache-key
+                  (fn [data] (dispatch [:auth/login data]))
+                  identity)
+   app-db))

 (register-handler-for
@@ -122,83 +121,82 @@
 ;; -------------------------------------------------------------

 (register-handler-for
-  :set-page
-  (fn [db value]
-    (let [navigator (get-in db [:services :navigator])]
-      (.push navigator (clj->js {:index (-> navigator
-                                          (.getCurrentRoutes)
-                                          (.-length)
-                                          (+ 1))
-                                 :name (str value)})))
-    (assoc-in db [:page] value)))
-
-(register-handler-for
-  :navigate/back
-  (fn [db _]
-    (let [navigator (get-in db [:services :navigator])]
-      (if (< 1 (-> navigator
-                     (.getCurrentRoutes)
-                     (.-length)))
-          (do (.pop navigator)
-              (assoc-in db [:page] (-> navigator
-                                      (.getCurrentRoutes)
-                                      (js->clj :keywordize-keys true)
-                                      (butlast)
-                                      (last)
-                                      (:name)
-                                      (str/split #":")
-                                      (last)
-                                      (keyword))))
-          db))))
+ :set-page
+ (fn [db value]
+   (let [navigator (get-in db [:services :navigator])]
+     (.push navigator (clj->js {:index (-> navigator
+                                           (.getCurrentRoutes)
+                                           (.-length)
+                                           (+ 1))
+                                :name (str value)})))
+   (assoc-in db [:page] value)))
+
+(register-handler-for
+ :navigate/back
+ (fn [db _]
+   (let [navigator (get-in db [:services :navigator])]
+     (if (< 1 (-> navigator
+                  (.getCurrentRoutes)
+                  (.-length)))
+       (do (.pop navigator)
+           (assoc-in db [:page] (-> navigator
+                                    (.getCurrentRoutes)
+                                    (js->clj :keywordize-keys true)
+                                    (butlast)
+                                    (last)
+                                    (:name)
+                                    (str/split #":")
+                                    (last)
+                                    (keyword))))
+       db))))

 ;; DB handlers
 ;; -------------------------------------------------------------

 (register-handler-for
-  :set-db
-  (fn [db new-state]
-    (if-let [problems (s/check schema new-state)]
-      (do
-        (log problems)
-        db)
-      new-state)))
+ :set-db
+ (fn [db new-state]
+   (if-let [problems (s/check schema new-state)]
+     (do
+       (log problems)
+       db)
+     new-state)))

 (register-handler-for
  :storage-error
  (fn [db err-event error]
    (log error)
-   ; currently do nothing error handling should be here
+   ;; currently do nothing error handling should be here
    db))

 (register-handler-for
-  :load-db
-  (fn [db _]
-    (db/load #(dispatch [:set-db %1]) #(dispatch [:storage-error :load-db %1]))
-    db))
-
-(register-handler-for
-  :save-db
-  (fn [db _]
-    (println db)
-    (let [db-filtered (apply dissoc db db-ignored-keys)]
-      (db/save! db-filtered #(dispatch [:storage-error :save-db %1]))
-      db)))
+ :load-db
+ (fn [db _]
+   (db/load #(dispatch [:set-db %1]) #(dispatch [:storage-error :load-db %1]))
+   db))
+
+(register-handler-for
+ :save-db
+ (fn [db _]
+   (println db)
+   (let [db-filtered (apply dissoc db db-ignored-keys)]
+     (db/save! db-filtered #(dispatch [:storage-error :save-db %1]))
+     db)))

 ;; db handlers
 ;; -------------------------------------------------------------

-; (register-handler-for
-;   :logout
-;   (fn [db _]
-;     (api/signout
-;       :on-success (fn []))
-;     (auth/set-user! db nil)
-;     (dispatch [:save-db])
-;     (dispatch [:set-page :login])
-;     (-> app-db
-;       (assoc :services (:services db)))))  ;; we need to preserve the instance of Navigator and Toaster
-
+;; (register-handler-for
+;;   :logout
+;;   (fn [db _]
+;;     (api/signout
+;;       :on-success (fn []))
+;;     (auth/set-user! db nil)
+;;     (dispatch [:save-db])
+;;     (dispatch [:set-page :login])
+;;     (-> app-db
+;;       (assoc :services (:services db)))))  ;; we need to preserve the instance of Navigator and Toaster

 (register-handler-for
  :login
@@ -240,44 +238,43 @@
 (register-api-call-handler
  :begin-api-event-key  :auth/logout
  :api-call             api/signout
- :params-fn            (fn [db _]
-                          {})
+ :params-fn            (fn [db _] {})
  :success-fn           (fn [db _ _]
-                          (dispatch [:save-db])
-                          (db/cache! user-pwd-cache-key nil)
-                          (dispatch [:set-page :login])
-                          (-> app-db
-                            (assoc :services (:services db))))  ;; we need to preserve the instance of Navigator and Toaster
+                         (dispatch [:save-db])
+                         (db/cache! user-pwd-cache-key nil)
+                         (dispatch [:set-page :login])
+                         (-> app-db
+                             (assoc :services (:services db))))  ;; we need to preserve the instance of Navigator and Toaster
  :error-fn             (fn [db]
                          (-> db
                              (auth/set-error! "Logout failed"))))

 (register-handler-for
-  :auth-fail
-  (fn [db error]
-    (-> db
-        (auth/set-in-progress! false)
-        (auth/set-user!        nil)
-        (auth/set-error!       "Authentication failed"))))
-
-(register-handler-for
-  :auth-success
-  (fn [db user]
-    (dispatch [:save-db])
-    (when (= (:page db) "login")
-      (dispatch [:set-page :inbox]))
-    (-> db
-        (auth/set-in-progress! false)
-        (auth/set-user!        user)
-        (auth/set-error!       nil))))
+ :auth-fail
+ (fn [db error]
+   (-> db
+       (auth/set-in-progress! false)
+       (auth/set-user!        nil)
+       (auth/set-error!       "Authentication failed"))))
+
+(register-handler-for
+ :auth-success
+ (fn [db user]
+   (dispatch [:save-db])
+   (when (= (:page db) "login")
+     (dispatch [:set-page :inbox]))
+   (-> db
+       (auth/set-in-progress! false)
+       (auth/set-user!        user)
+       (auth/set-error!       nil))))

 (register-handler-for
  :set-offline
  (fn [db mode]
    (when-let [toaster (get-in db [:services :toaster])]
-            (log toaster)
-            (toaster "You are currently offline" 5000))
+     (log toaster)
+     (toaster "You are currently offline" 5000))

    (assoc db :network-state mode)))

@@ -359,10 +356,10 @@
       (fn [error]
         (log error)
         (condp = (:type error)
-           :invalid-credentials (dispatch [:logout])
-           :network-error       (do (dispatch [:set-offline true])
-                                  (dispatch [:message/send-to-fail to-user-id content]))
-           (dispatch [:unknown-error]))))
+          :invalid-credentials (dispatch [:logout])
+          :network-error       (do (dispatch [:set-offline true])
+                                   (dispatch [:message/send-to-fail to-user-id content]))
+          (dispatch [:unknown-error]))))

      db)))

@@ -396,13 +393,12 @@
    ;; check once
    ;; Currently any way to check NetInfo does not work
    ;; This is left here as warning
-   ;(js/setTimeout
-   ;    check-nework-state
-   ;    15000)
+   ;;(js/setTimeout
+   ;;    check-nework-state
+   ;;    15000)
    db))

 (comment
-
   (re-frame.core/dispatch [:set-page :inbox])
   (re-frame.core/dispatch [:inbox/fetch])
   (re-frame.core/subscribe [:inbox/get]))


Handle toggle expand/contract events right.

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -348,7 +348,7 @@
           (doseq [[actx actx-info] (:actxs @vis)]
             (when (= actx-id (last actx))
               (swap! vis #(assoc-in % [:actxs actx :closed] (not (:closed actx-info))))
-              (>! render-ch [@vis nil])))
+              (>! render-ch [@vis nil true])))
           (recur))))
     (vis-run-controls event-delay step-ch el-prefix)))


Set default audio track

Set default audio track

--- src/video_server/encoder.clj
+++ src/video_server/encoder.clj
@@ -167,9 +167,9 @@

 (defn set-default-track
   "Sets the default video, audio or subtitle track."
-  [file track]
+  [file track & [info]]
   (when (and (= (file-type file) :mkv) @mkvpropedit)
-    (let [info (video-info (io/file file))
+    (let [info (or info (video-info (io/file file)))
           streams (:streams info)
           default (container-track info track)
           codec (:codec_type default)
@@ -190,6 +190,13 @@
           (when-not (zero? (:exit exec))
             (log/warn "changing default track failed:" \newline cmd \newline exec)))))))

+(defn set-default-audio-track
+  "Ensures only one track is set as the default audio track."
+  [file]
+  (let [info (video-info (io/file file))
+        track (-> info audio-streams default-audio :index)]
+    (set-default-track file track info)))
+
 (def mkclean (delay (exec? "mkclean")))

 (defn clean
@@ -220,7 +227,8 @@
       (if (zero? (:exit exec))
         (do
           (log/info "encoding was successful")
-          (clear-subtitles (:output spec))
+          (set-default-audio-track output)
+          (clear-subtitles output)
           (clean spec)
           spec)
         (do


Wrong order for aalts event result destructuring.

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -105,7 +105,7 @@
     :end (fn [vis actx args]
            (let [[ch-bindings result] args
                  chs (map #(if (seq? %) (first %) %) ch-bindings)
-                 [result-ch result-msg] result]
+                 [result-msg result-ch] result]
              (doseq [ch chs]
                (swap! vis #(dissoc-in % [:actxs actx :wait-chs ch])))
              (swap! vis #(dissoc-in % [:chs result-ch :msgs result-msg]))


Always show next html/svg.

Always show next html/svg.

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -315,10 +315,10 @@
         (assign-positions @vis @root-actx vis-positions actx-ch-ch-infos nil)
         (let [vis-next-html (apply str (flatten (vis-html-actx @vis @root-actx actx-ch-ch-infos)))
               vis-next-svg (apply str (flatten (vis-svg-actxs @vis @vis-positions deltas :curr)))]
+          (set-el-innerHTML (str el-prefix "-html") vis-next-html)
+          (set-el-innerHTML (str el-prefix "-svg") vis-next-svg)
           (if (or (not= vis-next-html vis-last-html)
                   (not= vis-next-svg vis-last-svg))
-            (set-el-innerHTML (str el-prefix "-html") vis-next-html)
-            (set-el-innerHTML (str el-prefix "-svg") vis-next-svg)
             (when (> @event-delay 0) (<! (timeout @event-delay)))
             (when (< @event-delay 0) (<! step-ch)))
           (recur (inc num-events) @vis @vis-positions vis-next-html vis-next-svg))))


send \r\n in test suite

send \r\n in test suite

--- test/subrosa/test/expect.clj
+++ test/subrosa/test/expect.clj
@@ -58,7 +58,7 @@

 (defn transmit [socket command]
   (let [out (:out socket)]
-    (.write out (.getBytes (str command "\n")))
+    (.write out (.getBytes (str command "\r\n")))
     (.flush out)))

 (defn found? [pattern lines]


Add the dam number to the repair view

Add the dam number to the repair view

--- src/mdr2/views.clj
+++ src/mdr2/views.clj
@@ -333,19 +333,18 @@
       (layout/common identity
        [:h1 "Productions to repair"]
        [:table.table.table-striped
-        [:thead [:tr [:th "Title"] [:th "Creator"] [:th "Action"]]]
+        [:thead [:tr [:th "DAM"] [:th "Title"] [:th "Creator"] [:th "Action"]]]
         [:tbody
-         (for [p productions]
+         (for [{:keys [id title creator]} productions]
            [:tr
-            [:td (:title p)]
-            [:td (:creator p)]
-            [:td
-             (form/form-to
-              {:class "btn-group"}
-              [:post "/production/repair"]
-              (form/hidden-field :id (:id p))
-              (anti-forgery-field)
-              [:button.btn.btn-default (layout/glyphicon "wrench") " Repair"])]])]]
+            [:td id] [:td title] [:td creator]
+            [:td (form/form-to
+                  {:class "btn-group"}
+                  [:post "/production/repair"]
+                  (form/hidden-field :id id)
+                  (anti-forgery-field)
+                  [:button.btn.btn-default
+                   (layout/glyphicon "wrench") " Repair"])]])]]
        (when (empty? productions)
          [:div.alert.alert-warning {:role "alert"} "No Data to display"])))))


Byte to int32 conversion

Byte to int32 conversion

--- src/neuhon/wav.clj
+++ src/neuhon/wav.clj
@@ -6,11 +6,19 @@
 (def wav-header-size (int 44)) ;; total size : 44 bytes
 (def bits-per-sample-loc (int 34))
 (def number-of-channels-loc (int 22))
+(def number-of-bytes-loc (int 40))

+
+(defn le-bytes-to-int32 [arr ith] ;; little endian
+  (bit-or (bit-and (aget arr (+ ith 3)) 0x000000ff)
+    (bit-and (bit-shift-left (aget arr (+ ith 2)) 8) 0x0000ff00)
+    (bit-and (bit-shift-left (aget arr (+ ith 1)) 16) 0x00ff0000)
+    (bit-and (bit-shift-left (aget arr ith) 24) 0xff000000)))

 (defn load-wav [filepath]
   (with-open [r (io/input-stream filepath)]
     (let [data (IOUtils/toByteArray (DataInputStream. r))
           bits-per-sample (int (aget data bits-per-sample-loc))
-          number-of-channels (int (get data number-of-channels-loc))]
-      (println (int (aget data 22))))))+          number-of-channels (int (get data number-of-channels-loc))
+          number-of-bytes-loc (le-bytes-to-int32 data number-of-bytes-loc)]
+      (println number-of-bytes-loc))))


fix dev config file name

fix dev config file name

--- src/bract/core/dev.clj
+++ src/bract/core/dev.clj
@@ -61,7 +61,7 @@
 ;; ----- default -----

-(def default-root-context {(key kdef/ctx-config-files) ["kdef/config.dev.edn"]
+(def default-root-context {(key kdef/ctx-config-files) ["config/config.dev.edn"]
                            (key kdef/ctx-launch?)      false})


return context after init in dev mode

return context after init in dev mode

--- src/bract/core/dev.clj
+++ src/bract/core/dev.clj
@@ -80,7 +80,6 @@
     (inducer/set-verbosity default-root-context)
     (echo/with-latency-capture "Initializing app in DEV mode"
       (inducer/induce inducer/apply-inducer default-root-context default-root-inducers))
-    nil
     (catch Throwable e
       (util/pst-when-uncaught-handler e)
       (throw e))))


don't bind values or instantiate objects when not needed

--- src/cheshire/parse.clj
+++ src/cheshire/parse.clj
@@ -45,16 +45,26 @@

 (defn parse [^JsonParser jp fst? keywords? eof array-coerce-fn]
   (let [fst? (boolean fst?)
-        keywords? (boolean keywords?)
-        x (if fst?
-            (do
-              (.nextToken jp)
-              (if (nil? (.getCurrentToken jp))
-                eof
-                (Object.)))
-            (Object.))]
-    (if (= x eof)
-      eof
+        keywords? (boolean keywords?)]
+    (if fst?
+      (do
+        (.nextToken jp)
+        (if (nil? (.getCurrentToken jp))
+          eof
+          (condp = (.getCurrentToken jp)
+            JsonToken/START_OBJECT (parse-object jp fst? keywords?
+                                                 eof array-coerce-fn)
+            JsonToken/START_ARRAY (parse-array jp fst? keywords?
+                                               eof array-coerce-fn)
+            JsonToken/VALUE_STRING (.getText jp)
+            JsonToken/VALUE_NUMBER_INT (.getNumberValue jp)
+            JsonToken/VALUE_NUMBER_FLOAT (.getDoubleValue jp)
+            JsonToken/VALUE_TRUE true
+            JsonToken/VALUE_FALSE false
+            JsonToken/VALUE_NULL nil
+            (throw
+             (Exception.
+              (str "Cannot parse " (pr-str (.getCurrentToken jp))))))))
       (condp = (.getCurrentToken jp)
         JsonToken/START_OBJECT (parse-object jp fst? keywords?
                                              eof array-coerce-fn)


fix prod build

fix prod build

--- src/clj/ceres/core.clj
+++ src/clj/ceres/core.clj
@@ -111,7 +111,7 @@
   (resources "/")
   (GET "/tweets/ws" [] tweet-handler)
   (GET "tweets/export" [] (export-edn))
-  (GET "/*" [] (if (= (:build @server-state) "prod")
+  (GET "/*" [] (if (= (:build @server-state) :prod)
                  (static-page)
                  (io/resource "public/index.html"))))

@@ -123,6 +123,7 @@
   (run-server (site #'all-routes) {:port (:port @server-state) :join? false})
   (let [{:keys [follow track handler credentials]} (:app @server-state)]
     (start-filter-stream follow track handler credentials)))
+

 (comment


Plascrete Carapace self-trash.

Plascrete Carapace self-trash.

--- src/clj/game/cards.clj
+++ src/clj/game/cards.clj
@@ -1599,7 +1599,9 @@
    "Plascrete Carapace"
    {:data [:counter 4]
     :prevent [:meat]
-    :abilities [{:counter-cost 1 :msg "prevent 1 meat damage" :effect (effect (damage-prevent :meat 1))}]}
+    :abilities [{:counter-cost 1 :msg "prevent 1 meat damage"
+                 :effect (req (damage-prevent state side :meat 1)
+                              (when (= (:counter card) 0) (trash state side card)))}]}

    "Priority Requisition"
    {:choices {:req #(and (= (:type %) "ICE") (not (:rezzed %)))}


Add support for adding headers

Add support for adding headers

--- src/clj_http/core2.clj
+++ src/clj_http/core2.clj
@@ -142,6 +142,7 @@
   [{:keys [body
            conn-mgr
            cookie-store
+           headers
            multipart
            query-string
            retry-handler
@@ -179,6 +180,11 @@
                       (if (string? body)
                         (StringEntity. ^String body "UTF-8")
                         (ByteArrayEntity. body))))))
+    (doseq [[header-n header-v] headers]
+      (if (coll? header-v)
+        (doseq [header-vth header-v]
+          (.addHeader http-req header-n header-vth))
+        (.addHeader http-req header-n (str header-v))))
     (let [^HttpResponse response (.execute client http-req context)
           ^HttpEntity entity (.getEntity response)
           status (.getStatusLine response)]


removing score

removing score

--- src/codemash/score.clj
+++ src/codemash/score.clj
@@ -1,84 +0,0 @@
-(ns codemash.score
-  "Score taken from Meta-ex: https://github.com/meta-ex/ignite"
-  (:use [overtone.live]))
-
-(def repetition-sub-a (map note [:C5, :A3, :B4, :A3, :C5, :E5, :A3, :A4, :C5, :A3, :B4, :A3, :C5, :A4]))
-(def repetition-a (concat (map note [:A4, :A3]) repetition-sub-a (map note [:A3, :A4]) repetition-sub-a))
-
-(def repetition-b  (map note [:F4, :F4, :A4, :F4, :G4, :F4, :A4, :C5, :F4, :F4, :A4, :F4, :G4, :F4, :A4, :F4]))
-
-;; slight variation of the above with different distances between the 2nd and 3rd note
-(def repetition-b3 (map note [:E4, :E4, :G4, :E4, :F#3, :E4, :G4, :B4, :E4, :E4, :G4, :E4, :F#3, :E4, :G4, :E4]))
-
-(defn transpose [updown notes]
-  (map #(+ updown %1) notes))
-
-(def theme  (concat
-             repetition-a
-             (transpose -5 repetition-a)
-             repetition-a
-             (transpose -5 repetition-a)
-             repetition-b
-             (transpose 2 repetition-b)
-             (transpose -2 repetition-b3)
-             repetition-b3
-             repetition-b
-             (transpose 2 repetition-b)
-             repetition-b3
-             repetition-b3))
-
-(def score (concat
-            (concat (drop-last theme) [(note :A4)])
-            theme
-            (concat (drop-last theme) [(note :A4)])
-            (concat (drop-last theme) [(note :A4)])))
-
-
-
-(require '[codemash.timing :as time])
-
-(defonce rhythm-g (group "Rhythm" :after time/timing-g))
-(defonce music-buffer (buffer 256))
-
-(def phasor-b (control-bus))
-(def saw-x-b1 (control-bus))
-(def saw-x-b2 (control-bus))
-
-(defonce saw-s1 (time/saw-x [:head rhythm-g] :out-bus saw-x-b1))
-(defonce saw-s2 (time/saw-x [:head rhythm-g] :out-bus saw-x-b2))
-
-(def phasor-s (time/buf-phasor [:after saw-s1] saw-x-b1 :out-bus phasor-b :buf music-buffer))
-
-(defsynth fuzzy-beep [attack 0.01 sustain 0.03 release 0.1 amp 0.8 out-bus 0]
-  (let [freq (/ (in:kr phasor-b) 2)
-        env  (env-gen (env-lin attack sustain release) 1 1 0 1)
-        src  (mix (saw [freq (* 1.01 freq)]))
-        src  (lpf src (mouse-y 100 20000))
-        sin  (sin-osc (* 1 freq))
-        sin2 (sin-osc freq)
-        src  (mix [src sin sin2])]
-    (out out-bus (pan2 (* src amp)))))
-
-(defsynth beepy [amp 1 out-bus 0]
-  (let [freq   (* (in:kr phasor-b) 1)
-        ct-saw (+ (lin-lin (in:kr saw-x-b2) 0 1 0.5 1))]
-    (out out-bus (* 0.5  ct-saw amp 1.25 (mix (+ (lf-tri [(* 0.5 freq)
-                                                          (* 0.25 freq)
-                                                          (* 0.5 freq)
-                                                          (* 2.01 freq)])))))))
-
-(def hi   (beepy      [:head rhythm-g] :amp 0 :out-bus 0))
-(def mid  (fuzzy-beep [:head rhythm-g] :amp 0 :out-bus 0))
-
-(def score (map note [:C5 :A3 :B4 :A3 :C5 :E5 :A3 :A4 :C5 :A3 :B4 :A3 :C5 :A4]))
-
-(buffer-write! music-buffer (take 256 (cycle (map midi->hz codemash.score/score))))
-
-(ctl time/root-s :rate 1/32)
-
-(ctl hi :amp 1)
-(ctl mid :amp 1)
-
-(kill hi)
-(kill mid)
-(stop)


fix css

fix css

--- resources/leiningen/new/closp/cljs/views.cljs
+++ resources/leiningen/new/closp/cljs/views.cljs
@@ -55,7 +55,7 @@
               [:div
                [:header [menu]]

-               [:main.container
+               [:main
                 [:div#content

                  (when (<sub [::comm/generic-error-sub])


λ lacked the implicit do, so no null pointer

--- code/clj/nihil/src/nihil/core.clj
+++ code/clj/nihil/src/nihil/core.clj
@@ -2,12 +2,10 @@
   (:gen-class))

 (defn -main
-  "I don't do a whole lot ... yet."
+  "testing for zen through null sets."
   [& args]
-  (let [f #(
-    (println "empty?" (empty? %))
-    (println "empty" (not (nil? (empty %))))
-    (println "not-empty" (not (nil? (not-empty %))))
-    (println "true?" (true? %))
-    (println "false?" (false? %)))]
-  (f (set '(nil)))))
+  (let [x (set '(nil))]
+    (println "empty →" (not (nil? (empty x))))
+    (println "not-empty →" (not (nil? (not-empty x))))
+    (println "true? →" (true? x))
+    (println "false? →" (false? x))))


CMR-6219 fixed duplicate syntax problem

CMR-6219 fixed duplicate syntax problem

--- search-app/src/cmr/search/api/association.clj
+++ search-app/src/cmr/search/api/association.clj
@@ -44,21 +44,7 @@
   concept-type)

 (defmethod association-results->status-code :default
-  "If the concept-type is :variable the function will check for any errors in the results, and will return 400 if
-  any are present. Otherwise it will return 200"
-  ([results]
-   (let [errors-during-association (filter #(some? (:errors %)) results)]
-     (if (seq errors-during-association) 400 200)))
-  ([results concept-type]
-   (if (some #{concept-type} '(:variable :service))
-     (association-results->status-code results)
-     200)))
-
-(defmulti association-results->status-code
-  [concept-type results]
-  concept-type)
-
-(defmethod association-results->status-code :default
+  "Return 200 status code"
   [_ _]
   200)


Fixed up concurrency problem by sleeping more

--- clojure/day3.clj
+++ clojure/day3.clj
@@ -51,6 +51,8 @@
   (loop []
     (if @continue-running
       (do
+        ; prevent this thread from gobbling up all processing power
+        (Thread/sleep 1)
         (send barber cut-hair)
         (recur)))))


fix minor figwheel issue

fix minor figwheel issue

--- src/voke/core.cljs
+++ src/voke/core.cljs
@@ -4,13 +4,13 @@
             [voke.system.core :refer [make-system-runner]])
   (:require-macros [schema.core :as sm]))

-(def player (e/player 488 300))
-
 (sm/defn make-game-state :- GameState
   [entities :- [Entity]]
   {:entities (into {}
                    (map (juxt :id identity)
                         entities))})
+
+(defonce player (e/player 488 300))

 ; TODO :mode? :active-level?
 (defonce game-state


spec voke.pixi

spec voke.pixi

--- src/voke/pixi.cljs
+++ src/voke/pixi.cljs
@@ -1,7 +1,6 @@
 (ns voke.pixi
-  (:require [cljsjs.pixi]
-            [voke.schemas :refer [Entity Shape System]])
-  (:require-macros [schema.core :as sm]))
+  (:require [cljs.spec :as s]
+            [cljsjs.pixi]))

 (defn make-renderer
   [width height node]
@@ -39,29 +38,36 @@
       (aset "y" (- y (/ h 2))))
     graphics-data))

-(sm/defn entity->graphics-data!
-  [entity :- Entity]
-  (rectangle (-> entity :shape :center :x)
-             (-> entity :shape :center :y)
-             (-> entity :shape :width)
-             (-> entity :shape :height)
-             (-> entity :render-info :fill)))
+(defn entity->graphics-data!
+  [entity]
+  (rectangle (-> entity :component/shape :shape/center :geometry/x)
+             (-> entity :component/shape :shape/center :geometry/y)
+             (-> entity :component/shape :shape/width)
+             (-> entity :component/shape :shape/height)
+             (-> entity :component/render :render/fill)))
+
+(s/fdef entity->graphics-data!
+  :args (s/cat :entity :entity/entity))

 (defn handle-unknown-entities! [entities]
   ; TODO - only actually operate on the entity if it's visible
   (doseq [entity entities]
     (swap! graphics-data-by-entity-id
            assoc
-           (:id entity)
+           (:entity/id entity)
            (entity->graphics-data! entity))))

-(sm/defn update-entity-position!
+(defn update-entity-position!
   [entity-id new-center]
   (let [graphics-data (@graphics-data-by-entity-id entity-id)]
     (when graphics-data
       (let [shape (aget graphics-data "shape")]
-        (aset shape "x" (- (new-center :x) (/ (aget shape "width") 2)))
-        (aset shape "y" (- (new-center :y) (/ (aget shape "height") 2)))))))
+        (aset shape "x" (- (new-center :geometry/x) (/ (aget shape "width") 2)))
+        (aset shape "y" (- (new-center :geometry/y) (/ (aget shape "height") 2)))))))
+
+(s/fdef update-entity-position!
+  :args (s/cat :entity-id :entity/id
+               :new-center :geometry/vector2))

 (defn remove-entity!
   [entity-id]
@@ -75,7 +81,7 @@

 (defn render! [entities]
   (handle-unknown-entities! (filter
-                              #(not (contains? @graphics-data-by-entity-id (:id %)))
+                              #(not (contains? @graphics-data-by-entity-id (:entity/id %)))
                               entities))
   ; TODO update entity visibility
   ; TODO something something camera


Improve tailing -- Towards an API

Improve tailing -- Towards an API

--- test/com/nomistech/clojure_the_language/c_920_io/tailing.clj
+++ test/com/nomistech/clojure_the_language/c_920_io/tailing.clj
@@ -6,16 +6,6 @@
   (:import (java.io File)
            (org.apache.commons.io.input TailerListener
                                         Tailer)))
-
-(defn chan->seq [c]
-  (lazy-seq
-   (when-let [v (a/<!! c)]
-     (cons v (chan->seq c)))))
-
-(defn tailer-and-channel->seq [t-and-c]
-  (-> t-and-c
-      :channel
-      chan->seq))

 (defn tailer-listener [c]
   (reify TailerListener
@@ -31,16 +21,19 @@
     (^void handle [this ^Exception i]
      (println (str "exception: " i)))))

-(defn tailer-and-channel [file delay-ms]
+(defn make-tailer-and-channel [file delay-ms]
   (let [c      (a/chan)
         tailer (Tailer/create file
                               (tailer-listener c)
                               delay-ms
                               true)]
-    {:channel c
-     :tailer  tailer}))
+    {::channel c
+     ::tailer  tailer}))

-(defn stop-tailer-and-channel [{:keys [channel tailer]}]
+(defn channel [t-and-c]
+  (::channel t-and-c))
+
+(defn stop-tailer-and-channel [{:keys [::channel ::tailer]}]
   (.stop tailer)
   (a/close! channel))

@@ -53,6 +46,16 @@
             (str line "\n")
             :append true)
       (Thread/sleep sleep-ms))))
+
+(defn chan->seq [c]
+  (lazy-seq
+   (when-let [v (a/<!! c)]
+     (cons v (chan->seq c)))))
+
+(defn tailer-and-channel->seq [t-and-c]
+  (-> t-and-c
+      channel
+      chan->seq))

 (fact (let [delay-ms  100
             sleep-ms  (+ delay-ms 10)
@@ -67,7 +70,7 @@
                         (io/make-parents f)
                         (spit f "this will be ignored this will be ignored this will be ignored this will be ignored\n")
                         f)
-            t-and-c   (tailer-and-channel file delay-ms)
+            t-and-c   (make-tailer-and-channel file delay-ms)
             result-ch (a/thread (doall (tailer-and-channel->seq t-and-c)))]
         (spit-lines-s file lines-s sleep-ms)
         (stop-tailer-and-channel t-and-c)


fix #7

fix #7

--- src/jarkeeper/core.clj
+++ src/jarkeeper/core.clj
@@ -43,7 +43,7 @@
          (let [profile (val profile-entry)
                profile-name (key profile-entry)]
                (if (not (starting-num? profile-name))
-                 (if-let [dependencies (:dependencies profile)]
+                 (if-let [dependencies (concat (:dependencies profile) (:plugins profile))]
                    (if-let [deps (check-deps dependencies)]
                      [profile-name deps (calculate-stats deps)])))))
        profiles))


reindent

reindent

--- src/launchpad/core.clj
+++ src/launchpad/core.clj
@@ -25,18 +25,18 @@
   ModelBehavior
   (grid [this [x y] [red green]]
     (.render this (assoc-in @(.state this)
-                         [:grid x y]
-                         [red green])))
+                            [:grid x y]
+                            [red green])))

   (top [this x [red green]]
     (.render this (assoc-in @(.state this)
-                         [:top x]
-                         [red green])))
+                            [:top x]
+                            [red green])))

   (side [this y [red green]]
     (.render this (assoc-in @(.state this)
-                         [:side y]
-                         [red green])))
+                            [:side y]
+                            [red green])))

   (render [this newstate]
     ;; TODO more efficient
@@ -46,17 +46,17 @@
       (dotimes [x 8]
         (dotimes [y 8]
           (.send dev
-             (midi/note-on (coord->note [x y])
-                           (color->velocity (get-in state [:grid x y])))
-             -1))
+                 (midi/note-on (coord->note [x y])
+                               (color->velocity (get-in state [:grid x y])))
+                 -1))
         (.send dev
-           (midi/control-change (+ 0x68 x)
-                 (color->velocity (get-in state [:top x])))
-           -1)
+               (midi/control-change (+ 0x68 x)
+                                    (color->velocity (get-in state [:top x])))
+               -1)
         (.send dev
-           (midi/note-on (coord->note [8 x])
-                 (color->velocity (get-in state [:side x])))
-           -1))))
+               (midi/note-on (coord->note [8 x])
+                             (color->velocity (get-in state [:side x])))
+               -1))))

   (reset [this]
     (.send (.device this) (midi/control-change 0 0) -1)
@@ -64,13 +64,13 @@

 (defn make-state
   ([] (State. (vec (repeat 8 (vec (repeat 8 [0 0]))))
-         (vec (repeat 8 [0 0]))
-         (vec (repeat 8 [0 0]))))
+              (vec (repeat 8 [0 0]))
+              (vec (repeat 8 [0 0]))))
   ([_] (make-state)))

 (defn make-model []
   (let [model (Model. (atom (make-state))
-                     (midi/get-receiver "Launchpad"))]
+                      (midi/get-receiver "Launchpad"))]
     (.reset model)
     model))


Add ternary implementation

Add ternary implementation

When xs is not empty, we don't need the explicit context.
See @dialelo's comment on funcool/cats#55

--- src/cats/core.cljc
+++ src/cats/core.cljc
@@ -500,13 +500,17 @@
       (p/foldl ctx f z xs))))

 (defn foldm
-  "Given a monadic context, a function that takes two non-monadic arguments and
-  returns a value inside the given monadic context, an initial value, and a
-  collection of values, perform a left-associative fold."
-  [ctx f z xs]
-  (letfn [(foldm' [z' xs']
-            (if (empty? xs')
-              (return ctx z')
-              (let [[h & t] xs']
-                (>>= (f z' h) (fn [z''] (foldm' z'' t))))))]
-    (foldm' z xs)))
+  "Given an optional monadic context, a function that takes two non-monadic
+  arguments and returns a value inside the given monadic context, an initial
+  value, and a collection of values, perform a left-associative fold."
+  ([f z xs]
+   {:pre [(seq xs)]}
+   (let [[h & t] xs]
+     (mlet [z' (f z h)]
+       (if (empty? t)
+         (return z')
+         (foldm f z' t)))))
+  ([ctx f z xs]
+   (if (empty? xs)
+     (return ctx z)
+     (foldm f z xs))))


Fix body symbol renaming bug

Fix body symbol renaming bug

--- src/cats/core.cljc
+++ src/cats/core.cljc
@@ -242,7 +242,7 @@
   (cond
     (symbol? expr)
     (rename-sym expr renames)
-    (list? expr)
+    (seq? expr)
     (map #(rename % renames) expr)
     :else
     expr))
@@ -250,19 +250,26 @@
 (defn dedupe-symbols*
   [sym->ap body]
   (letfn [(renamer [{:keys [body syms aps seen renames] :as summ} [s ap]]
-           (let [ap' (rename ap renames)]
+           (let [ap' (rename ap renames)
+                 new-aps (conj aps ap')]
              (if (seen s)
-               (let [s' (gensym)]
-                 {:syms (conj syms s')
-                  :aps (conj aps ap')
-                  :seen (conj seen s')
-                  :renames (assoc renames s s')
-                  :body (rename body (assoc renames s s'))})
-               {:syms (conj syms s)
-                :aps (conj aps ap')
-                :seen (conj seen s)
-                :renames renames
-                :body body})))]
+               (let [s' (gensym)
+                     new-syms (conj syms s')
+                     new-seen (conj seen s')
+                     new-renames (assoc renames s s')
+                     new-body (rename body new-renames)]
+                 {:syms new-syms
+                  :aps new-aps
+                  :seen new-seen
+                  :renames new-renames
+                  :body new-body})
+               (let [new-syms (conj syms s)
+                     new-seen (conj seen s)]
+                 {:syms new-syms
+                  :aps new-aps
+                  :seen new-seen
+                  :renames renames
+                  :body body}))))]
     (let [summ
           (reduce renamer
                   {:syms []


Enhance the producer-brief enhancement

Enhance the producer-brief enhancement

1. If producer is a number larger than 0 then look up the value in
   producer-raw-to-producer
2. If producer is nil or a number equal to 0 then construct the
   producer-brief from producer-long and producer-place (if either of
   them is not nil)

Apparently the library system contains quite a few records where the
producer is nil, so this should cover up those cases.

--- src/catalog/vubis.clj
+++ src/catalog/vubis.clj
@@ -272,31 +272,34 @@
        (remove nil?)
        (string/join ", ")))))

+(defn- construct-producer-brief [producer-long producer-place]
+  "Return a producer-brief string based on `producer-long` and
+  `producer-place`. Both of these can potentially be nil or blank."
+  (some->>
+   [producer-long producer-place]
+   (remove nil?)
+   (remove string/blank?)
+   (seq) ; short-circuit if both producer-long and producer-place are
+         ; nil or blank
+   (string/join ", ")))
+
 (defn get-producer-brief
   "Get the producer-brief. If `producer` contains a valid numerical
   value other than `0` then return the string from the lookup table in
-  [[producer-raw-to-producer]]. If `producer` contains `0` then generate
-  a brief from `producer-long` and `producer-place`. Otherwise return
-  nil."
+  [[producer-raw-to-producer]]. If `producer` contains `0` or is nil
+  then generate a brief from `producer-long` and `producer-place`."
   [{:keys [producer producer-long producer-place]}]
-  (let [producer-key (parse-int producer)]
+  (let [producer-key (parse-int producer)
+        producer-brief (construct-producer-brief producer-long producer-place)]
     (cond
-      (nil? producer-key)
        ;; no valid producer key
-      nil
-      (= producer-key 0)
+      (nil? producer-key) producer-brief
       ;; the producer is known to be unknown: create a producer based
       ;; on producer-long and producer-place
-      (some->>
-       [producer-long producer-place]
-       (remove nil?)
-       (remove string/blank?)
-       (seq) ; short-circuit if both producer-long and producer-place
-             ; are nil or blank
-       (string/join ", "))
-      :else
-      ;; the producer has a valid key. Return the brief string from the lookup map.
-      (producer-raw-to-producer producer-key))))
+      (= producer-key 0) producer-brief
+      ;; the producer has a valid key. Return the brief string from
+      ;; the lookup map.
+      :else (producer-raw-to-producer producer-key))))

 (defn clean-raw-item
   "Return a proper production based on a raw item, e.g.


Remove dependency on `net.sf.samtools.util.StringUtil` class

--- src/cljam/util.clj
+++ src/cljam/util.clj
@@ -1,12 +1,27 @@
 (ns cljam.util
-  (:require [clojure.string :refer [join]])
-  (:import net.sf.samtools.util.StringUtil))
+  (:require [clojure.string :refer [join]]))

 (defn ubyte
   "Casts to byte avoiding an error about out of range for byte."
   [n]
   {:pre [(<= 0 n 255)]}
   (byte (if (< n 0x80) n (- n 0x100))))
+
+(defn ra-line-seq
+  [rdr]
+  (when-let [line (.readLine rdr)]
+    (cons line (lazy-seq (ra-line-seq rdr)))))
+
+;;; string utils
+
+(def ^:private upper-case-offset (- (byte \A) (byte \a)))
+
+(defn upper-case
+  "Converts a lower case letter to upper case."
+  [b]
+  (if (or (< b \a) (> b \z))
+    b
+    (byte (+ b upper-case-offset))))

 (defn string->bytes [s]
   (let [buf (byte-array (count s))]
@@ -29,10 +44,7 @@
                        from-hex-digit (nth s (inc (* % 2)))))
         (range (count s)))))

-(defn ra-line-seq
-  [rdr]
-  (when-let [line (.readLine rdr)]
-    (cons line (lazy-seq (ra-line-seq rdr)))))
+;;;

 (defn reg->bin
   "Calculates bin given an alignment covering [beg,end) (zero-based, half-close-half-open),
@@ -204,7 +216,7 @@

 (defn normalize-bases [bases]
   (map-indexed (fn [idx _]
-                 (aset bases idx (StringUtil/toUpperCase (nth bases idx)))
+                 (aset bases idx (upper-case (nth bases idx)))
                  (if (= (nth bases idx) \.)
                    (aset bases idx \N)))
                bases)


rm test comment

rm test comment

--- src/dalap/html.clj
+++ src/dalap/html.clj
@@ -85,21 +85,3 @@
   [(doctype :html5)
    [:html ;{:lang (options# :lang)}
     contents]])
-
-;;; test
-
-#_(to-html
-   [" match tag: " [:p "Paragraph&" [1 2 "34" 'bar] " Foo"]
-    " match tag: " [:p {:id "bar" :ti&tle "fo\"o"} "Paragraph" " Foo"]
-    " nesting: " [:div [:div [:div [:div]]]]
-    " match tag: " [:input]
-    " match tag: " [:input {:type "text"}]
-    " match tag: " [:form#contact {:action "GET"}
-                    [:input {:type "text"
-                             :name "first-name"
-                             :value "Tavis & Company"}]]
-    " empty :" [:hr.clear {:asdf 1234}]
-    ;" safe: " (apply safe (keys html-esc-map))
-    ;" chars to esc: " (keys html-esc-map)
-    ;(apply str (keys html-esc-map))
-    ])


Fixing bug when merging attributes on TagAttrs

Problems when merging the class attribute with
the classes that were given in the tag name.

--- src/dalap/html.clj
+++ src/dalap/html.clj
@@ -67,7 +67,10 @@
                     (into {}))
     attr-merge (fn [result [k v]]
                  (cond
-                   (= k :class) (union (:class result #{}) (make-set v))
+                   (= k :class) (assoc result
+                                       k
+                                       (union (:class result #{})
+                                              (make-set v)))
                    :else (assoc result k v)))
   ]
   (reduce attr-merge base-attrs tag-attrs)))


force the schema transactions when loading

--- src/goodbot/db.clj
+++ src/goodbot/db.clj
@@ -15,9 +15,9 @@
                     clojure.java.io/reader
                     java.io.PushbackReader.)]
     (doseq [datoms (clojure.edn/read
-                             {:readers *data-readers*}
-                             r)]
-      (d/transact conn [datoms]))))
+                     {:readers *data-readers*}
+                     r)]
+      @(d/transact conn [datoms]))))

 (defn start [irc]
   (d/create-database (:datomic-uri @irc))


use natal-shell

use natal-shell

--- resources/project.clj
+++ resources/project.clj
@@ -6,9 +6,10 @@
   :dependencies [[org.clojure/clojure "1.7.0"]
                  [org.clojure/clojurescript "1.7.145"]
                  [$REACT_INTERFACE$]
-                 [org.omcljs/ambly "0.6.0"]]
-:plugins [[lein-cljsbuild "1.1.0"]]
-:cljsbuild {:builds {:dev {:source-paths ["src"]
-                           :compiler {:output-to "target/out/main.js"
-                                      :output-dir "target/out"
-                                      :optimizations :none}}}})
+                 [org.omcljs/ambly "0.6.0"]
+                 [natal-shell "0.1.0"]]
+ :plugins [[lein-cljsbuild "1.1.0"]]
+ :cljsbuild {:builds {:dev {:source-paths ["src"]
+                            :compiler {:output-to "target/out/main.js"
+                                       :output-dir "target/out"
+                                       :optimizations :none}}}})


inverted condition for line height

inverted condition for line height

--- src/lt/objs/style.cljs
+++ src/lt/objs/style.cljs
@@ -63,7 +63,7 @@
                                             (assoc final :font-size size)
                                             final)
                                     final (if (and line-height
-                                                   (< 0 line-height))
+                                                   (> line-height 0))
                                             (assoc final :line-height line-height)
                                             final)]
                                 (object/merge! styles final))))


implement reformatted version of Michal Marczyk's optimized case macro

--- src/clj/cljs/core.clj
+++ src/clj/cljs/core.clj
@@ -1126,35 +1126,50 @@
            ~gexpr ~expr]
        ~(emit gpred gexpr clauses))))

+(defn- assoc-test [m test expr env]
+  (if (contains? m test)
+    (throw
+      (clojure.core/IllegalArgumentException.
+        (core/str "Duplicate case test constant '"
+          test "'"
+          (when (:line env)
+            (core/str " on line " (:line env) " "
+              cljs.analyzer/*cljs-file*)))))
+    (assoc m test expr)))
+
 (defmacro case [e & clauses]
-  (let [default (if (odd? (count clauses))
-                  (last clauses)
-                  `(throw (js/Error. (core/str "No matching clause: " ~e))))
-        assoc-test (fn assoc-test [m test expr]
-                         (if (contains? m test)
-                           (throw (clojure.core/IllegalArgumentException.
-                                   (core/str "Duplicate case test constant '"
-                                             test "'"
-                                             (when (:line &env)
-                                               (core/str " on line " (:line &env) " "
-                                                         cljs.analyzer/*cljs-file*)))))
-                           (assoc m test expr)))
-        pairs (reduce (fn [m [test expr]]
-                        (core/cond
-                         (seq? test) (reduce (fn [m test]
-                                               (let [test (if (core/symbol? test)
-                                                            (core/list 'quote test)
-                                                            test)]
-                                                 (assoc-test m test expr)))
-                                             m test)
-                         (core/symbol? test) (assoc-test m (core/list 'quote test) expr)
-                         :else (assoc-test m test expr)))
-                      {} (partition 2 clauses))
-        esym (gensym)]
-   `(let [~esym ~e]
-      (cond
-        ~@(mapcat (fn [[m c]] `((cljs.core/= ~m ~esym) ~c)) pairs)
-        :else ~default))))
+  (core/let [default (if (odd? (count clauses))
+                       (last clauses)
+                       `(throw
+                          (js/Error.
+                            (core/str "No matching clause: " ~e))))
+             env     &env
+             pairs   (reduce
+                       (fn [m [test expr]]
+                         (core/cond
+                           (seq? test)
+                           (reduce
+                             (fn [m test]
+                               (let [test (if (core/symbol? test)
+                                            (core/list 'quote test)
+                                            test)]
+                                 (assoc-test m test expr env)))
+                             m test)
+                           (core/symbol? test)
+                           (assoc-test m (core/list 'quote test) expr env)
+                           :else
+                           (assoc-test m test expr env)))
+                     {} (partition 2 clauses))
+             esym (gensym)]
+    (if (every? (some-fn core/number? core/string?) (keys pairs))
+      (core/let [no-default (if (odd? (count clauses)) (butlast clauses) clauses)
+                 tests      (mapv #(if (seq? %) (vec %) [%]) (take-nth 2 no-default))
+                 thens      (vec (take-nth 2 (drop 1 no-default)))]
+        `(let [~esym ~e] (case* ~esym ~tests ~thens ~default)))
+      `(let [~esym ~e]
+         (cond
+           ~@(mapcat (fn [[m c]] `((cljs.core/= ~m ~esym) ~c)) pairs)
+           :else ~default)))))

 (defmacro assert
   "Evaluates expr and throws an exception if it does not evaluate to


fix issue with mulligan

fix issue with mulligan

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -426,8 +426,10 @@
 (defn mulligan [state side args]
   (shuffle-into-deck state side :hand)
   (draw state side 5)
-  (when-let [cdef (card-def (get-in @state [side :identity]))]
-    (when-let [mul (:mulligan cdef)] (mul state side nil)))
+  (let [card (get-in @state [side :identity])]
+    (when-let [cdef (card-def card)]
+      (when-let [mul (:mulligan cdef)]
+        (mul state side card nil))))
   (swap! state assoc-in [side :keep] true)
   (system-msg state side "takes a mulligan"))


Make get-virus-counter handle nil :counter without crashing.

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -1247,8 +1247,8 @@
   (trigger-event state side :purge))

 (defn get-virus-counters [state side card]
-   (let [hiveminds (filter #(= (:title %) "Hivemind") (all-installed state :runner))]
-        (reduce + (map :counter (cons card hiveminds)))))
+  (let [hiveminds (filter #(= (:title %) "Hivemind") (all-installed state :runner))]
+    (reduce + (map #(get % :counter 0) (cons card hiveminds)))))

 (defn play-instant
   ([state side card] (play-instant state side card nil))


Adding kalams

Adding kalams

--- src/movertone/core.clj
+++ src/movertone/core.clj
@@ -14,6 +14,9 @@
 (def shruthi :c)
 (def tempo 80)
 (def jathi 4)
+(def kalams {:lower  1
+             :middle 2
+             :higher 3})

 (defn default-durations [num-swarams]
   (take num-swarams (repeatedly (constantly jathi))))
@@ -43,7 +46,7 @@
        llive/play))

 (defn play-arohanam-and-avarohanam [{:keys [arohanam avarohanam] :as ragam}]
-  (play-phrase (phrase (concat arohanam avarohanam) nil 2)))
+  (play-phrase (phrase (concat arohanam avarohanam) nil (:middle kalams))))

 (defn string->phrase [ragam s]
   (let [swaram "[.]*[A-z][.]*"
@@ -51,7 +54,7 @@
         split-seq (re-seq (re-pattern swaram-with-duration) s)
         swarams (map #(keyword (re-find (re-pattern swaram) %)) split-seq)
         durations (map #(count (s/replace % #"\." "")) split-seq)]
-    (phrase ragam swarams durations 1)))
+    (phrase ragam swarams durations (:middle kalams))))

 (defn play-string [raga string]
   (play-phrase
@@ -73,13 +76,13 @@

   (play-phrase (phrase [:s :r2 :g3 :p :m1 :g3 :r2 :s]
                        [ 1   1  1  1   1   1   2   4]
-                       1))
+                       (:lower kalams)))

   (play-phrase
    (phrase (:mechakalyani r/ragams)
            [:m :d :n :g :m :d :r :g :m  :g :m :d :n :s.]
            [ 1  1  2  1  1  2  1  1  4   1  1  1  1  4]
-           2))
+           (:middle kalams)))

   (play-string (:bilahari r/ragams)
                "s,,r g,p, d,s., n,d, p,dp mgrs rs .n .d s,,,


Adding all 5 sthayis

Adding all 5 sthayis

--- src/movertone/defs.clj
+++ src/movertone/defs.clj
@@ -47,7 +47,7 @@
    :n2 "Kaisika Nishaadham"
    :n3 "Kaakali Nishaadham"})

-(def swarams->notes
+(def madhya-sthayi
   {:s 0
    :r1 1
    :r2 2
@@ -63,8 +63,38 @@
    :d3 10
    :n1 9
    :n2 10
-   :n3 11
-   :s. 12})
+   :n3 11})
+
+(defn swaram->sthayi [position dots difference [swaram sthanam]]
+  (let [new-name (if (= :prefix position)
+                   (str dots (name swaram))
+                   (str (name swaram) dots))
+        new-sthanam (+ difference sthanam)]
+    {(keyword new-name) new-sthanam}))
+
+(defn ->sthayi [position dots difference]
+  (->> madhya-sthayi
+       (map (partial swaram->sthayi position dots difference))
+       (into {})))
+
+(def anumandra-sthayi
+  (->sthayi :prefix ".." -24))
+
+(def mandra-sthayi
+  (->sthayi :prefix "." -12))
+
+(def thara-sthayi
+  (->sthayi :suffix "." 12))
+
+(def athithara-sthayi
+  (->sthayi :suffix ".." 24))
+
+(def swarams->notes
+  (merge anumandra-sthayi
+         mandra-sthayi
+         madhya-sthayi
+         thara-sthayi
+         athithara-sthayi))

 (defn raga [{:keys [arohanam avarohanam] :as scale}]
   (zipmap arohanam scale))


Fix util namespace

Fix util namespace

--- src/musicbox/util.cljs
+++ src/musicbox/util.cljs
@@ -1,4 +1,4 @@
-(ns music.util
+(ns musicbox.util
   (:require-macros [cljs.core.async.macros :refer [go]])
   (:require [goog.dom :as dom]
             [goog.events :as events]


Disable warning for dar.write/import

Disable warning for dar.write/import

Signed-off-by: Gregory Haskins <640d9fe47775e6723f0355b7315e38f7d98d3539@gmail.com>

--- src/obcc/dar/write.clj
+++ src/obcc/dar/write.clj
@@ -1,4 +1,5 @@
 (ns obcc.dar.write
+  (:refer-clojure :exclude [import])
   (:import [org.apache.commons.io.input TeeInputStream]
            [org.apache.commons.io.output ByteArrayOutputStream]
            [java.util.zip GZIPOutputStream])


Switch to trigger/delay for performance, make percentile watermarks stateless.

--- src/onyx/triggers.cljc
+++ src/onyx/triggers.cljc
@@ -37,11 +37,6 @@
   [trigger]
   {:fire? false})

-(defn percentile-watermark-init-state
-  [trigger]
-  ;; Intentionally return nil - this trigger is stateless.
-  )
-
 ;; Init local functions

 (defn segment-init-locals [trigger]
@@ -79,11 +74,6 @@
   (let [{:keys [pred-fn]} trigger-state]
     {:fire? (pred-fn trigger state-event)}))

-(defn percentile-watermark-next-state
-  [trigger state state-event]
-  ;; Intentionally return nil - this trigger is stateless.
-  )
-
 ;;; Fire predicate functions
 (defn segment-fire?
   [{:keys [trigger/threshold] :as trigger}
@@ -101,15 +91,17 @@
   [trigger state state-event]
   (:fire? state))

+(defn watermark-init-locals [{:keys [trigger/delay]}]
+  {:delay (if delay (apply to-standard-units delay) 0)})
+
 (defn watermark-fire?
-  [{:keys [trigger/period]} trigger-state {:keys [event-type upper-bound watermarks] :as state-event}]
+  [_ _ {:keys [event-type upper-bound watermarks trigger-state] :as state-event}]
   (or (= :job-completed event-type)
       (and (= :watermark event-type)
-           (let [standard (if period (apply to-standard-units period) 0)]
-             (> (:input watermarks) (+ upper-bound standard))))))
+           (> (:input watermarks) (+ upper-bound (:delay trigger-state))))))

 (defn percentile-watermark-fire?
-  [trigger trigger-state {:keys [lower-bound upper-bound event-type segment window]}]
+  [trigger _ {:keys [lower-bound upper-bound event-type segment window]}]
   ;; If this was stimulated by a new segment, check if it should fire.
   ;; Otherwise if this was a completed task, always fire.
   (or (and segment (exceeds-percentile-watermark? window trigger lower-bound upper-bound segment))
@@ -135,10 +127,9 @@
    :trigger/trigger-fire? punctuation-fire?})

 (def ^:export watermark
-  {:trigger/trigger-fire? watermark-fire?})
+  {:trigger/init-locals watermark-init-locals
+   :trigger/trigger-fire? watermark-fire?})

 (def ^:export percentile-watermark
-  {:trigger/init-state percentile-watermark-init-state
-   :trigger/init-locals percentile-watermark-init-locals
-   :trigger/next-state percentile-watermark-next-state
+  {:trigger/init-locals percentile-watermark-init-locals
    :trigger/trigger-fire? percentile-watermark-fire?})


Improve API comment

Improve API comment

--- src/re_frame/core.cljs
+++ src/re_frame/core.cljs
@@ -33,8 +33,10 @@
 ;; --  Logging -----
 ;; re-frame uses the logging functions: warn, log, error, group and groupEnd
 ;; By default, these functions map directly to the js/console implementations
-;; But you can override with your own (set or subset):
-;;   (set-loggers!  {:warn  my-warn   :log  my-looger ...})
+;; But you can override with your own (set or subset).
+;; Example Usage:
+;;   (defn my-warn-fn [& args]  (post-somewhere (apply str args)))
+;;   (re-frame.core/set-loggers!  {:warn  my-warn-fn})
 (def set-loggers! utils/set-loggers!)


Some more documentation

Some more documentation

--- src/reagent/ratom.cljs
+++ src/reagent/ratom.cljs
@@ -33,14 +33,16 @@
                  false))))))

 (defn- in-context [obj f]
-  "If 'f' uses '*ratom-context*' anywhere, it will be given 'obj'"
+  "If 'f' uses '*ratom-context*' anywhere, it will be given 'obj'
+
+   When f is executed, if f derefs any atoms, they are then added to '-captured' in *ratom-context* i.e. obj - see function notify-deref-watcher!   "
   (binding [*ratom-context* obj]
     (f)))

 (defn- deref-capture
   "
   1. Sets the '-captured' to nil
-  2. Gets the response by executing the function in context of component
+  2. Gets the response by executing the function in context of
   3.
   "

@@ -525,7 +527,7 @@

 (defn run-in-reaction [f obj key run opts]
-  (js/console.log "run-in-reaction" temp-reaction)
+  (js/console.log "run-in-reaction" temp-reaction (.-watching temp-reaction))
   (let [r temp-reaction
         res (deref-capture f r)]
     (when-not (nil? (.-watching r))


Bumps version to 1.46.1-SNAPSHOT

Bumps version to 1.46.1-SNAPSHOT

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.46.0"
+(defproject cook "1.46.1-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.8.0"]


Bind vault to metlog-common 0.1.0

Bind vault to metlog-common 0.1.0

--- metlog-vault/project.clj
+++ metlog-vault/project.clj
@@ -22,7 +22,7 @@
                  [reagent "0.8.1"]
                  [com.andrewmcveigh/cljs-time "0.5.2"]

-                 [metlog-common "0.1.0-SNAPSHOT"]]
+                 [metlog-common "0.1.0"]]

   :plugins [[lein-cljsbuild "1.1.4"]
             [lein-tar "3.3.0"]]


Added s3 endpoints based on region

Added s3 endpoints based on region

--- src/terraboot/core.clj
+++ src/terraboot/core.clj
@@ -352,12 +352,28 @@
   [naming-fn]
   (fn [type name] (id-of type (naming-fn name))))

+;; From http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
+(def s3-endpoints
+  {"us-east-1"      "s3.amazonaws.com"
+   "us-west-1"      "s3-us-west-1.amazonaws.com"
+   "us-west-2"      "s3-us-west-2.amazonaws.com"
+   "ap-south-1"     "s3.ap-south-1.amazonaws.com"
+   "ap-northeast-2" "s3.ap-northeast-2.amazonaws.com"
+   "ap-southeast-1" "s3-ap-southeast-1.amazonaws.com"
+   "ap-southeast-2" "s3-ap-southeast-2.amazonaws.com"
+   "ap-northeast-1" "s3-ap-northeast-1.amazonaws.com"
+   "eu-central-1"   "s3.eu-central-1.amazonaws.com"
+   "eu-west-1"      "s3-eu-west-1.amazonaws.com"
+   "sa-east-1"      "s3-sa-east-1.amazonaws.com"})
+
 (defn remote-state [region name]
   (resource "terraform_remote_state" name
             {:backend "s3"
              :config {:bucket "terraboot"
+                      :encrypt true
                       :key (str name ".tfstate")
-                      :region region}}))
+                      :region region
+                      :endpoint (get s3-endpoints region)}}))

 (defn remote-output-of [module name]
   (output-of (str "terraform_remote_state." module) "output" name))