Fixed issue section nesting it tabs. For #29

--- src/cljs/reagent_toolbox_docs/components/tabs.cljs
+++ src/cljs/reagent_toolbox_docs/components/tabs.cljs
@@ -112,36 +112,36 @@
           [:td [:code "on-change"]]
           [:td [:code "function"]]
           [:td]
-          [:td "Callback function that is fired when the tab changes."]]]]
-       [:section
-        [:h3 "Theming"]
-        [:table
-         [:thead
-          [:tr
-           [:th "Name"]
-           [:th "Description"]]]
-         [:tbody
-          [:tr
-           [:td [:code "active"]]
-           [:td "Added to the active tab content and header."]]
-          [:tr
-           [:td [:code "fixed"]]
-           [:td "Used to make the tabs \"fixed tabs\"."]]
-          [:tr
-           [:td [:code "inverse"]]
-           [:td "Used to invert the colors."]]
-          [:tr
-           [:td [:code "navigation"]]
-           [:td "Used for the navigation element."]]
-          [:tr
-           [:td [:code "pointer"]]
-           [:td "Used for the moving underline element."]]
-          [:tr
-           [:td [:code "tabs"]]
-           [:td "Used as a root classname for the component."]]
-          [:tr
-           [:td [:code "tab"]]
-           [:td "Used for the tab content element."]]]]]]]
+          [:td "Callback function that is fired when the tab changes."]]]]]
+      [:section
+       [:h3 "Theming"]
+       [:table
+        [:thead
+         [:tr
+          [:th "Name"]
+          [:th "Description"]]]
+        [:tbody
+         [:tr
+          [:td [:code "active"]]
+          [:td "Added to the active tab content and header."]]
+         [:tr
+          [:td [:code "fixed"]]
+          [:td "Used to make the tabs \"fixed tabs\"."]]
+         [:tr
+          [:td [:code "inverse"]]
+          [:td "Used to invert the colors."]]
+         [:tr
+          [:td [:code "navigation"]]
+          [:td "Used for the navigation element."]]
+         [:tr
+          [:td [:code "pointer"]]
+          [:td "Used for the moving underline element."]]
+         [:tr
+          [:td [:code "tabs"]]
+          [:td "Used as a root classname for the component."]]
+         [:tr
+          [:td [:code "tab"]]
+          [:td "Used for the tab content element."]]]]]]
      [:section
       [:h2 "Tab"]
       [:p "Represent a single tab element and it should include some properties to describe the tab itself and get children elements as content."]


Changing sorted-map to array-map, as it preserves original sorting

--- src/clojure/clojurewerkz/cassaforte/conversion.clj
+++ src/clojure/clojurewerkz/cassaforte/conversion.clj
@@ -327,7 +327,7 @@
                                    (cb/deserialize key-format (:key %)))
                                  list))
              values (reverse (map #(to-plain-hash (or (:columns %) (:value %))) list))]
-         (apply sorted-map (interleave names values)))))
+         (apply array-map (interleave names values)))))

   ColumnOrSuperColumn
   (to-plain-hash


Preload Cipher class for cookie-store performance

Fixes #264.

--- ring-core/src/ring/middleware/session/cookie.clj
+++ ring-core/src/ring/middleware/session/cookie.clj
@@ -23,6 +23,9 @@
        :doc "Full algorithm to encrypt data with."}
   crypt-algorithm
   "AES/CBC/PKCS5Padding")
+
+;; Ensure cipher-algorithm classes are preloaded
+(Cipher/getInstance crypt-algorithm)

 (defn- hmac
   "Generates a Base64 HMAC with the supplied key on a string of data."


Hide grafter.tabular.melt from docs as its not yet really part of the public API.

--- src/tabular/grafter/tabular/melt.clj
+++ src/tabular/grafter/tabular/melt.clj
@@ -1,4 +1,4 @@
-(ns grafter.tabular.melt
+(ns ^:no-doc grafter.tabular.melt
   "Functions for melting data and building variations on melt."
   (:require
    [clojure.set :as set]


regression test for macro docs

regression test for macro docs

--- src/test/clojure/cljs/repl_tests.clj
+++ src/test/clojure/cljs/repl_tests.clj
@@ -1,10 +1,22 @@
 (ns cljs.repl-tests
   (:require [clojure.java.io :as io]
             [cljs.analyzer :as ana]
+            [cljs.analyzer.api :as ana-api]
             [cljs.env :as env]
             [cljs.repl :as repl]
-            [cljs.repl.rhino :as rhino])
+            [cljs.repl.rhino :as rhino]
+            [cljs.compiler :as comp])
     (:use clojure.test))
+
+(def st (env/default-compiler-env))
+
+(env/with-compiler-env st
+  (ana/analyze-file "cljs/core.cljs")
+  (ana/load-core))
+
+(deftest test-doc
+  (env/with-compiler-env st
+    (is (string? (:doc (ana-api/resolve {} '->))))))

 #_(deftest file-info
   (let [repl-env (rhino/repl-env)


add missing string namespace

add missing string namespace

--- src/vignette/perfmonitoring/core.clj
+++ src/vignette/perfmonitoring/core.clj
@@ -1,5 +1,6 @@
 (ns vignette.perfmonitoring.core
-  (:require [vignette.common.logger :as log]
+  (:require [clojure.string :as string]
+            [vignette.common.logger :as log]
             [environ.core :refer [env]]
             [prometheus.core :as prometheus]))


fix spelling of education

fix spelling of education

--- app/src/cljs/app/components.cljs
+++ app/src/cljs/app/components.cljs
@@ -118,7 +118,7 @@
   [:div#education
    [section-component
     [:div.mdl-grid--no-spacing
-     [:h3.employmentheader "Employment"]
+     [:h3.employmentheader "Education"]
      (into [:div.edu]
            (map #(single-education-component %) educationlist))]]])


[#2091] Track metrics on new background thread when no feature flag

--- backend/src/akvo/lumen/lib/auth.clj
+++ backend/src/akvo/lumen/lib/auth.clj
@@ -169,11 +169,14 @@
             auth-uuid-tree (if (and (match-by-jwt-family-name? request)
                                     (match-by-template-and-method? auth-calls request))
                              (load-auth-data dss rasters tenant-conn flow-api request collector tenant)
-                             {:rasters             rasters
-                              :auth-datasets       (mapv :id dss)
-                              :auth-visualisations (mapv :id (all-visualisations tenant-conn))
-                              :auth-dashboards     (mapv :id (all-dashboards tenant-conn))
-                              :auth-collections    (mapv :id (all-collections tenant-conn))})]
+                             (do
+                               (future
+                                 (load-auth-data dss rasters tenant-conn flow-api request collector tenant))
+                               {:rasters             rasters
+                                :auth-datasets       (mapv :id dss)
+                                :auth-visualisations (mapv :id (all-visualisations tenant-conn))
+                                :auth-dashboards     (mapv :id (all-dashboards tenant-conn))
+                                :auth-collections    (mapv :id (all-collections tenant-conn))}))]
         (handler (assoc request
                         :auth-service (new-auth-service auth-uuid-tree)))))))


[scamp] rename and refactor 'subscribe-new-node

--- modules/scamp/src/scamp/core.clj
+++ modules/scamp/src/scamp/core.clj
@@ -328,19 +328,22 @@
    node-contact-address :- NodeContactAddressSchema]
   (get-in world [:network node-contact-address]))

-(s/defn subscribe :- WorldSchema
+(s/defn subscribe-new-node :- WorldSchema
   "Given 'world, a 'new-node-contact-address for the node that is
-  subscribing, and a 'networked-node, forward subscription requests
-  from 'networked-node."
+  subscribing, and a 'node, forward subscription requests
+  from 'node."
   [world :- WorldSchema
    new-node-contact-address :- NodeContactAddressSchema
-   networked-node :- NodeContactAddressSchema]
-  (let [new-node (init-new-subscriber new-node-contact-address networked-node)
+   contact-node-address :- NodeContactAddressSchema]
+  (let [contact-node (get-node-from-world world contact-node-address)
+        new-node (init-new-subscriber new-node-contact-address
+                                      contact-node-address)
         new-messages (handle-new-subscription
                       (:config world)
-                      (get-in world [:network networked-node])
+                      contact-node
                       new-node-contact-address)]
     (-> world
+        (update-self contact-node #(update % :upstream conj new-node-contact-address))
         (add-new-node new-node)
         (add-messages new-messages))))


refactor for clarity

refactor for clarity

--- solutions/day06/solution.clj
+++ solutions/day06/solution.clj
@@ -3,7 +3,6 @@
   (for [x (range xmin xmax)
         y (range ymin ymax)]
     [x y]))
-

 (defn parse-instruction
   [instruction]


Fix NPE in sift --add-jar when used with transitive deps

Fixes #427

--- boot/core/src/boot/task_helpers.clj
+++ boot/core/src/boot/task_helpers.clj
@@ -98,7 +98,8 @@
   [sym]
   (let [env (core/get-env)]
     (->> env
-         :dependencies
+         pod/resolve-dependencies
+         (map :dep)
          (filter #(= sym (first %)))
          first
          (pod/resolve-dependency-jar env))))


Окно вывода ошибки

Окно вывода ошибки

--- src-cljs/ixinfestor/net.cljs
+++ src-cljs/ixinfestor/net.cljs
@@ -28,7 +28,7 @@
                    (fn [e]
                      (let [response (t/read r (.getResponseText (.-target e)))]
                        (println "ERROR: " response)
-                       (println "ОШИБКА ОБРАЩЕНИЯ К СЕРВЕРУ: " response)
+                       (js/alert "ОШИБКА ОБРАЩЕНИЯ К СЕРВЕРУ: " response)
                        (if error-fn (error-fn response)))))

     (events/listen req goog.net.EventType.COMPLETE


Cleans code.

Cleans code.

--- src/active/clojure/match.clj
+++ src/active/clojure/match.clj
@@ -534,8 +534,7 @@

           :optional-path-exists-with-binding
           (let [path     (mapv make-key (:path body))
-                b        (make-binding (:binding body))
-                path-map (assoc-in {} path (symbol b))]
+                b        (make-binding (:binding body))]
             [{} `[~(symbol b) (get-in ~message ~path)]])

           :key-matches-without-binding


Fix require in db.user

Fix require in db.user

--- src/braid/server/db/user.clj
+++ src/braid/server/db/user.clj
@@ -5,7 +5,7 @@
             [crypto.password.scrypt :as scrypt]
             [braid.server.db :as db]
             [braid.server.db.common :refer :all]
-            [braid.server.quests.db :refer [activate-first-quests!]]))
+            [braid.server.quests.db :refer [activate-first-quests-txn]]))

 ;; Queries


only sync beeminder in past week

only sync beeminder in past week

--- src/clj/tictag/beeminder.clj
+++ src/clj/tictag/beeminder.clj
@@ -4,6 +4,8 @@
             [taoensso.timbre :as timbre]
             [clojure.string :as str]
             [clojure.data :refer [diff]]
+            [clj-time.core :as t]
+            [clj-time.periodic :as p]
             [tictag.db :as db]
             [tictag.beeminder-matching :refer [match?]]
             [tictag.riemann :as riemann]))
@@ -27,11 +29,11 @@
     true)))

 (defn update-datapoint! [auth-token user goal datapoint]
-  (http/request {:url (format "https://www.beeminder.com/api/v1/users/%s/goals/%s/datapoints/%s.json"
-                              user goal (:id datapoint))
-                 :method :put
+  (http/request {:url          (format "https://www.beeminder.com/api/v1/users/%s/goals/%s/datapoints/%s.json"
+                                       user goal (:id datapoint))
+                 :method       :put
                  :query-params {:auth_token auth-token
-                                :value (:value datapoint)}}))
+                                :value      (:value datapoint)}}))

 (defn create-datapoint! [auth-token user goal datapoint]
   (http/request {:url (format "https://www.beeminder.com/api/v1/users/%s/goals/%s/datapoints.json"
@@ -53,6 +55,9 @@
                    :method :delete
                    :query-params {:auth_token auth-token}})))

+(defn past-week-days []
+  (set (map db/local-day (take 7 (p/periodic-seq (t/now) (t/days -24))))))
+
 (defn days-matching-tag [tags rows]
   (->> rows
        (filter #(match? tags (:tags %)))
@@ -64,17 +69,21 @@
   (when (:enabled? (:beeminder user))
     (when-let [goals (seq (db/get-goals db (:beeminder user)))]
       (tracef "goals are %s, getting rows" goals)
-      (let [rows (db/get-pings-by-user (:db db) user)]
+      (let [in-past-week? (past-week-days)
+            rows          (filter #(in-past-week? (:local-day %))
+                                  (db/get-pings-by-user (:db db) user))]
         (doseq [{:keys [goal/name goal/tags]} goals]
           (debugf "Syncing goal: %s with tags %s" name tags)
           (let [{:keys [username token]} (:beeminder user)
                 days                     (days-matching-tag tags rows)
-                existing-datapoints      (datapoints
-                                          (get-in
-                                           user
-                                           [:beeminder :token])
-                                          username
-                                          name)
+                existing-datapoints      (filter
+                                          #(in-past-week? (:daystamp %))
+                                          (datapoints
+                                           (get-in
+                                            user
+                                            [:beeminder :token])
+                                           username
+                                           name))
                 existing-map             (group-by :daystamp existing-datapoints)
                 to-save                  (filter :value
                                                  (for [[daystamp value] days
@@ -100,12 +109,12 @@
               (let [r                           @resp
                     {status :status opts :opts} r
                     {url :url method :method}   opts]
-                (riemann/send! riemann {:service "beeminder"
+                (riemann/send! riemann {:service     "beeminder"
                                         :description (pr-str
                                                       {:status status :goal-name name :username username :user (:id user)})
-                                        :state (if (>= status 300)
-                                                 "warning"
-                                                 "ok")})))))))))
+                                        :state       (if (>= status 300)
+                                                       "warning"
+                                                       "ok")})))))))))

 (defn user-for [token]
   (let [resp (-> (http/request {:url         "https://www.beeminder.com/api/v1/users/me.json"


proper caching headers

proper caching headers

--- src/clj_crud/system/ring.clj
+++ src/clj_crud/system/ring.clj
@@ -94,6 +94,10 @@
                     (resource/wrap-resource "/")
                     file-info/wrap-file-info
                     content-type/wrap-content-type
+                    ((fn [handler]
+                       (fn [req]
+                         (-> (handler req)
+                             (update-in [:headers] merge {"Cache-Control" "public, max-age=31536000"})))))
                     wrap-accept-uri
                     wrap-redirect-trailing-slash
                     wrap-stacktrace-to-log)]


woho, pushes shows up now, lets irc up

woho, pushes shows up now, lets irc up

--- src/cljs/breakfast/core.cljs
+++ src/cljs/breakfast/core.cljs
@@ -40,18 +40,19 @@
   )

 (defonce app-state (atom {:text "Hello Breakfast!"
-                          :messages []
+                          :messages ["message"]
                           :uid nil}))

-(defn handle-events []
+(defn handle-events [app]
   (go (while true
         (let [ev (:event (<! ch-chsk))
               msg (second (second ev))]
           (condp keyword-identical? (first ev)
             :chsk/state (prn "sup, checking state")
-            :chsk/recv (prn "msg: " (str (pr-str msg)))
-            ))))))
+            :chsk/recv  (do (om/transact! app :messages #(conj % msg)) ;;(fn [_] msg))
+                            (prn "msg: " (str (pr-str msg))))
+            )))))

 ;;;_ * Actions  -------------------------------------------------------
@@ -65,22 +66,42 @@
       (sente/chsk-reconnect! chsk)))

 ;;;_ * Root -------------------------------------------------------
-(om/root
-  (fn [app owner]
-    (reify
-      om/IWillMount
-      (will-mount [this]
-        (handle-events)
-
-        (if (not (:uid app))
-          (let [uid (str "user_" (rand-int 100))]
-            (do (login! uid)
-                (om/transact! app :uid (fn [_] uid))))))
-      om/IRender
-      (render [_]
-        (dom/h1 nil (str "uid:" (:uid app))))))
-  app-state
-  {:target (. js/document (getElementById "app"))})
+
+(defn main-view [app owner]
+  (reify
+    om/IRender
+    (render [_]
+      (dom/div nil
+               (dom/h1 nil (str "uid:" (:uid app)))))))
+
+(defn irc-view [messages owner]
+  (reify
+    om/IRender
+    (render [_]
+      (dom/div nil
+               (apply dom/ul nil
+                      (map (fn [msg] (dom/li nil (:what-is-this msg))) messages))
+               (dom/h1 nil (str "hi " (first messages)))))))
+
+(defn app-view [app owner]
+  (reify
+    om/IWillMount
+    (will-mount [this]
+      (handle-events app)
+      (if (not (:uid app))
+        (let [uid (str "user_" (rand-int 100))]
+          (do (login! uid)
+              (om/transact! app :uid (fn [_] uid))))))
+    om/IRenderState
+    (render-state [_ _]
+      (dom/div nil
+               (om/build main-view app)
+               (om/build irc-view (:messages app)))
+      )))
+
+(om/root app-view
+         app-state
+         {:target (. js/document (getElementById "app"))})

 ;;;_ * Dev mode -------------------------------------------------------
 (def is-dev (.contains (.. js/document -body -classList) "is-dev"))


Minor fix.

Minor fix.

--- src/cljs/openslack/xmpp.cljs
+++ src/cljs/openslack/xmpp.cljs
@@ -242,8 +242,7 @@
     (when-let [delay (.-delay rchat)]
       (assoc! chat
               :timestamp (.-stamp delay)
-              :delay (js->clj delay)
-              :delay? true))
+              :delay (js->clj delay)))
     (persistent! chat)))

 (defn chats [client]


Improve description for merge-with problem by lifting from clojure.core/merge-with docs

--- src/foreclojure/data_set.clj
+++ src/foreclojure/data_set.clj
@@ -720,7 +720,7 @@
            :title "Merge with a Function"
            :times-solved 0
            :restricted ["merge-with"]
-           :description "Write a function which takes a function f and a variable number of maps.  Your function should return a map that consists of the rest of the maps conj-ed onto the first.  If a key occurs in more than one map, the new value should be calculated by applying f to each of the two original values."
+           :description "Write a function which takes a function f and a variable number of maps.  Your function should return a map that consists of the rest of the maps conj-ed onto the first.  If a key occurs in more than one map, the mapping(s) from the latter (left-to-right) should be combined with the mapping in the result by calling (f val-in-result val-in-latter)"
            :tags ["medium" "core-functions"]
            :tests ["(= (__ * {:a 2, :b 3, :c 4} {:a 2} {:b 2} {:c 5})\n   {:a 4, :b 6, :c 20})"
                    "(= (__ - {1 10, 2 20} {1 3, 2 10, 3 15})\n   {1 7, 2 10, 3 15})"


cleaned up program significantly. Changed workflow to allow creating the number of journal entries from the given day

--- src/journal_creator/core.clj
+++ src/journal_creator/core.clj
@@ -10,53 +10,35 @@
         below-end? (fn [t] (t/within? (t/interval start end) t))]
     (take-while below-end? inf-range)))

-(defn days-in-month
-  ([year month] (days-in-month year month 01))
-  ([year month day]
-   (let [current-date (t/date-time year month day)
-         end-date     (t/plus current-date (t/months 1))]
-     (time-range current-date end-date (t/days 1)))))
-
 (defn get-today []
   (t/to-time-zone (t/now) (t/default-time-zone)))

-(defn unparse-today [formatter]
-  (f/unparse formatter (get-today)))
+(defn parse-date [date format]
+  (f/unparse (f/formatter-local format) date))

-(defn journal-header-format [date]
-  (str "= " date " - <SUMMARY GOES HERE> ="))
+(defn get-journal-header-str [date]
+  (->
+    date
+    #(parse-date % "MMMM dd, yyyy, EEEE")
+    #(str "= " % " - <SUMMARY GOES HERE> =")))

-(defn file-format [file]
-  (str file ".wiki"))
+(defn get-filename-extension-str [date]
+  (->
+    date
+    #(parse-date "yyyy-MM-dd" %)
+    #(str % ".wiki")))

-(defn convert-to-journal-header [date]
-  (f/unparse (f/formatter-local "MMMM dd, yyyy, EEEE") date))
+(defn save [day]
+  (let [filename (get-filename-extension-str day)
+        header (get-journal-header-str day)]
+    (spit filename header)))

-(defn convert-to-filename-extension [date]
-  (f/unparse (f/formatter-local "yyyy-MM-dd") date))
-
-(defn get-journal-header-str [day]
-  ((comp journal-header-format convert-to-journal-header) day))
-
-(defn get-filename-extension-str [day]
-  ((comp file-format convert-to-filename-extension) day))
-
-;; incrediblepoems.com - heaven wont be heaven
-
-(defn generate-journal-files
-  ([year month] (generate-journal-files year month 01))
-  ([year month d]
-   (loop [days (days-in-month year month d)]
-     (when (seq days)
-       (let [day (first days)
-             journal-header (get-journal-header-str day)
-             filename (get-filename-extension-str day)]
-         (prn "remaining:" (count days) "journal-header: " journal-header "filename: " filename)
-         (spit filename journal-header)
-         (recur (rest days)))))))
+(defn iterate-times [times]
+  (let [current-date (get-today)]
+  (map #(save %)
+       (time-range current-date
+                   (t/plus current-date (t/days times)) (t/days 1)))))

 (defn -main [& args]
-  ;; (println "Today is: " (get-journal-header-str (get-today)))
-  ;; (println "file format is: " (get-filename-extension-str (get-today)))
   (prn "args: " args)
-  (generate-journal-files 2017 07 04))
+  (iterate-times (read-string (first args))))


fix issuer badge count

fix issuer badge count

--- src/cljs/salava/extra/application/ui/issuer.cljs
+++ src/cljs/salava/extra/application/ui/issuer.cljs
@@ -18,6 +18,12 @@
     (subs text 1)
     text))

+(defn all-connections [state]
+  (ajax/GET
+    (path-for (str "/obpv1/social/connections_issuer"))
+    {:handler (fn [data]
+                (swap! state assoc :all-connections data)
+                )}))

 (defn init-issuer-applications [state]
   (let [{:keys [user-id country-selected name recipient-name issuer-name order tags show-followed-only]} @state]
@@ -30,7 +36,8 @@
                 :order (trim order)
                 :followed show-followed-only}
        :handler (fn [data]
-                  (swap! state assoc :all-issuer-applications (:applications data) ))})))
+                  (swap! state assoc :all-issuer-applications (:applications data) )
+                  (all-connections state))})))

 (defn fetch-badge-adverts [state]
   (let [{:keys [user-id country-selected name recipient-name issuer-name order tags show-followed-only]} @state]
@@ -70,7 +77,6 @@
   (fetch-badge-adverts state))

 (defn issuer-applications-count [issuer-name state]
-  (init-issuer-applications state)
   (count (filter #(= issuer-name (:issuer_content_name %)) (:all-issuer-applications @state))))

 (defn- issuer-image [path]
@@ -109,7 +115,8 @@

 (defn issuer-content-modal [state]
   (let [applications (cursor state [:all-applications])
-        issuer-name (cursor state [:issuer-content :name])]
+        issuer-name (cursor state [:issuer-content :name])
+        favourites (cursor state [:all-connections])]
     (fn []
       [:div#badge-content
        [:div.modal-body
@@ -167,4 +174,4 @@
       [:button.issuer-button {:class (str "btn form-control btn-active")
                               :id "btn-all"
                               :on-click #(do
-                                           (m/modal! [open-issuer-modal state] {:size :md}))} (str @issuer-name)]]]))
+                                           (m/modal! [open-issuer-modal state] {:size :md :shown (fn [] (init-issuer-applications state)) }))} (str @issuer-name)]]]))


Fix bad expressions.

Fix bad expressions.

--- test/cljam/algo/vcf_indexer_test.clj
+++ test/cljam/algo/vcf_indexer_test.clj
@@ -151,7 +151,7 @@
   (testing "bcf"
     (with-open [r (vcf/reader test-bcf-changed-chr-order-file)]
       (let [file-offsets (vcf/read-file-offsets r)
-            computed
+            computed ^CSI
             (csi/offsets->index file-offsets 14 6
                                 {:variant-file-type :bcf
                                  :names (mapv :id
@@ -162,18 +162,18 @@
                                    (map-indexed #(vector (:file-beg %2)
                                                          %1))
                                    (into {}))]
-        (is (= (.n-ref csi) (.n-ref ^CSI computed)))
-        (is (= (.min-shift csi) (.min-shift ^CSI computed)))
-        (is (= (.depth csi) (.depth ^CSI computed)))
-        (is (= (vec (.aux csi)) (vec (.aux ^CSI computed))))
-        (is (= (.bidx csi) (.bidx ^CSI computed)))
+        (is (= (.n-ref csi) (.n-ref computed)))
+        (is (= (.min-shift csi) (.min-shift computed)))
+        (is (= (.depth csi) (.depth computed)))
+        (is (= (vec (.aux csi)) (vec (.aux computed))))
+        (is (= (.bidx csi) (.bidx computed)))
         (doseq [chr (keys (.loffset csi))]
           (doseq [beg (keys (get (.loffset csi) chr))]
             (is (or (= (get-in (.loffset csi) [chr beg])
-                       (get-in (.loffset ^CSI computed) [chr beg]))
+                       (get-in (.loffset computed) [chr beg]))
                     (check-loffset file-offsets
                                    file-offset-index
-                                   beg (get-in (.loffset ^CSI computed)
+                                   beg (get-in (.loffset computed)
                                                [chr beg]))))))))))

 (deftest about-vcf-changed-chr-order-field-less
@@ -231,7 +231,7 @@
   (testing "vcf"
     (with-open [r (vcf/reader test-vcf-various-bins-gz-file)]
       (let [file-offsets (vcf/read-file-offsets r)
-            computed
+            computed ^CSI
             (csi/offsets->index file-offsets 14 6
                                 {:variant-file-type :vcf
                                  :names (mapv :id
@@ -242,27 +242,27 @@
                                    (map-indexed #(vector (:file-beg %2)
                                                          %1))
                                    (into {}))]
-        (is (= (.n-ref csi) (.n-ref ^CSI computed)))
-        (is (= (.min-shift csi) (.min-shift ^CSI computed)))
-        (is (= (.depth csi) (.depth ^CSI computed)))
-        (is (= (.aux csi) (.aux ^CSI computed)))
+        (is (= (.n-ref csi) (.n-ref computed)))
+        (is (= (.min-shift csi) (.min-shift computed)))
+        (is (= (.depth csi) (.depth computed)))
+        (is (= (.aux csi) (.aux computed)))
          ;;Exclude tail data
          ;;due to differences in implementation of HTSlib and bgzf4j.
         (is (= (update (.bidx csi) 0 dissoc 75)
-               (update (.bidx ^CSI computed) 0 dissoc 75)))
+               (update (.bidx computed) 0 dissoc 75)))

         (doseq [chr (keys (.loffset csi))]
           (doseq [beg (keys (get (.loffset csi) chr))]
             (is (or (= (get-in (.loffset csi) [chr beg])
-                       (get-in (.loffset ^CSI computed) [chr beg]))
+                       (get-in (.loffset computed) [chr beg]))
                     (check-loffset file-offsets
                                    file-offset-index
-                                   beg (get-in (.loffset ^CSI computed)
+                                   beg (get-in (.loffset computed)
                                                [chr beg])))))))))
   (testing "bcf"
     (with-open [r (vcf/reader test-bcf-various-bins-file)]
       (let [file-offsets (vcf/read-file-offsets r)
-            computed
+            computed ^CSI
             (csi/offsets->index file-offsets 14 6
                                 {:variant-file-type :bcf
                                  :names (mapv :id
@@ -273,19 +273,19 @@
                                    (map-indexed #(vector (:file-beg %2)
                                                          %1))
                                    (into {}))]
-        (is (= (.n-ref csi) (.n-ref ^CSI computed)))
-        (is (= (.min-shift csi) (.min-shift ^CSI computed)))
-        (is (= (.depth csi) (.depth ^CSI computed)))
-        (is (= (vec (.aux csi)) (vec (.aux ^CSI computed))))
+        (is (= (.n-ref csi) (.n-ref computed)))
+        (is (= (.min-shift csi) (.min-shift computed)))
+        (is (= (.depth csi) (.depth computed)))
+        (is (= (vec (.aux csi)) (vec (.aux computed))))
         (is (= (.bidx csi)
-               (.bidx ^CSI computed)))
+               (.bidx computed)))
         (doseq [chr (keys (.loffset csi))]
           (doseq [beg (keys (get (.loffset csi) chr))]
             (is (or (= (get-in (.loffset csi) [chr beg])
-                       (get-in (.loffset ^CSI computed) [chr beg]))
+                       (get-in (.loffset computed) [chr beg]))
                     (check-loffset file-offsets
                                    file-offset-index
-                                   beg (get-in (.loffset ^CSI computed)
+                                   beg (get-in (.loffset computed)
                                                [chr beg]))))))))))

 (deftest-remote large-csi-comparison-test
@@ -294,7 +294,7 @@
       (with-open [r (vcf/reader test-large-vcf-file)]
         (let [file-offsets (vcf/read-file-offsets r)
               csi ^CSI (csi/read-index test-large-vcf-csi-file)
-              computed
+              computed ^CSI
               (csi/offsets->index file-offsets 14 6
                                   {:variant-file-type :vcf
                                    :names (mapv :id
@@ -304,26 +304,26 @@
                                      (map-indexed #(vector (:file-beg %2)
                                                            %1))
                                      (into {}))]
-          (is (= (.n-ref csi) (.n-ref ^CSI computed)))
-          (is (= (.min-shift csi) (.min-shift ^CSI computed)))
-          (is (= (.depth csi) (.depth ^CSI computed)))
-          (is (= (.aux csi) (.aux ^CSI computed)))
+          (is (= (.n-ref csi) (.n-ref computed)))
+          (is (= (.min-shift csi) (.min-shift computed)))
+          (is (= (.depth csi) (.depth computed)))
+          (is (= (.aux csi) (.aux computed)))
           (is (= (update (.bidx csi) 24 dissoc 37450)
-                 (update (.bidx ^CSI computed) 24 dissoc 37450)))
+                 (update (.bidx computed) 24 dissoc 37450)))
           (doseq [chr (keys (.loffset csi))]
             (doseq [beg (keys (get (.loffset csi) chr))]
               (is (or (= (get-in (.loffset csi) [chr beg])
-                         (get-in (.loffset ^CSI computed) [chr beg]))
+                         (get-in (.loffset computed) [chr beg]))
                       (check-loffset file-offsets
                                      file-offset-index
-                                     beg (get-in (.loffset ^CSI computed)
+                                     beg (get-in (.loffset computed)
                                                  [chr beg]))))))))))
   (testing "bcf"
     (with-before-after {:before (prepare-cavia!)}
       (with-open [r (vcf/reader test-large-bcf-file)]
         (let [file-offsets (vcf/read-file-offsets r)
               csi ^CSI (csi/read-index test-large-bcf-csi-file)
-              computed
+              computed ^CSI
               (csi/offsets->index file-offsets 14 5
                                   {:variant-file-type :bcf
                                    :names (mapv :id
@@ -333,17 +333,17 @@
                                      (map-indexed #(vector (:file-beg %2)
                                                            %1))
                                      (into {}))]
-          (is (= (.n-ref csi) (.n-ref ^CSI computed)))
-          (is (= (.min-shift csi) (.min-shift ^CSI computed)))
-          (is (= (.depth csi) (.depth ^CSI computed)))
-          (is (= (vec (.aux csi)) (vec (.aux ^CSI computed))))
+          (is (= (.n-ref csi) (.n-ref computed)))
+          (is (= (.min-shift csi) (.min-shift computed)))
+          (is (= (.depth csi) (.depth computed)))
+          (is (= (vec (.aux csi)) (vec (.aux computed))))
           (is (= (update (.bidx csi) 24 dissoc 4681)
-                 (update (.bidx ^CSI computed) 24 dissoc 4681)))
+                 (update (.bidx computed) 24 dissoc 4681)))
           (doseq [chr (keys (.loffset csi))]
             (doseq [beg (keys (get (.loffset csi) chr))]
               (is (or (= (get-in (.loffset csi) [chr beg])
-                         (get-in (.loffset ^CSI computed) [chr beg]))
+                         (get-in (.loffset computed) [chr beg]))
                       (check-loffset file-offsets
                                      file-offset-index
-                                     beg (get-in (.loffset ^CSI computed)
+                                     beg (get-in (.loffset computed)
                                                  [chr beg])))))))))))


Adds failing test for board component. Need to resolve problem with slimerjs and core.async code before it can be  uncommented

--- test/cljs/chess/components_test.cljs
+++ test/cljs/chess/components_test.cljs
@@ -5,6 +5,7 @@
   (:require [cemerick.cljs.test :as t]
             [dommy.core :as dommy]
             [chess.components :as c]
+            [chess.board :as b]
             [om.core :as om :include-macros true]))

 (defn new-node [id]
@@ -29,7 +30,13 @@
 (deftest test-square
          (let [c (container!)]
            (om/root c/square ["a4" :R false] {:target c})
-           (is (sel1 [:#a4 ".white.rook.piece"]))))
+           (is (sel1 c [:#a4 ".white.rook.piece"]))))
+
+(comment "this fails in slimerjs due to core.async code in board component"
+         (deftest test-board
+                  (let [c (container!)]
+                    (om/root c/board {:board b/start-position} {:target c})
+                    (is (sel1 c [:#a1 ".white.rook.piece"])))))


Delete the old track-builder.

Delete the old track-builder.

--- sonic-jam/src/sonic_jam/core.cljs
+++ sonic-jam/src/sonic_jam/core.cljs
@@ -158,7 +158,7 @@

 (def style-grey #js {:style #js {:color "#999"}})

-(defn track-builder2 [{:keys [cursor id set-state-ch]} owner]
+(defn track-builder [{:keys [cursor id set-state-ch]} owner]
   (reify
     om/IInitState
     (init-state [_]
@@ -197,113 +197,6 @@
                        (width-selection 16 " 16")
                        (dom/span nil "}")))))))

-(defn track-builder [{:keys [cursor id set-state-ch]} owner]
-  (reify
-    om/IInitState
-    (init-state [_]
-      {:state :init})
-    om/IRenderState
-    (render-state [_ state]
-      (let [p (partial dom/p #js {:style #js {:color "#999"}})
-            transition #(om/update-state! owner (fn [s] (merge s %)))
-            commit #(condp = (:type state)
-                      "sample" (let [track {"type" (:type state)
-                                            "beats" (repeat (:width state) [0])
-                                            "sample" (:sample state)
-                                            "params" {}}
-                                     tracks (clj->js (conj cursor track))]
-                                 (transition {:state :init})
-                                 (om/update! cursor tracks)
-                                 (go (>! set-state-ch id)))
-                      "synth" (let [track {"type" (:type state)
-                                           "beats" (repeat (:width state) [0])
-                                           "synth" (:synth state)
-                                           "params" {}}
-                                    tracks (clj->js (conj cursor track))]
-                                (transition {:state :init})
-                                (om/update! cursor tracks)
-                                (go (>! set-state-ch id)))
-                      "grid" (let [track {"type" "grid"
-                                          "id" (:text state)
-                                          "beats" (repeat (:width state) [0])
-                                          "params" {}}
-                                   tracks (clj->js (conj cursor track))
-                                   grid (clj->js {"name" (:text state)
-                                                  "id" (:text state)
-                                                  "bpc" (:bpc state)
-                                                  "tracks" []})]
-                               (transition {:state :init})
-                               (let [grids (om/observe owner (grids))]
-                                 (om/transact! grids (fn [s] (assoc s (:text state) grid))))
-                               (om/update! cursor tracks)
-                               (go (>! set-state-ch id))
-                               (go (>! set-state-ch (:text state))))
-                      "play" (let [track {"type" "play"
-                                          "note" (int (:text state))
-                                          "beats" (repeat (:width state) [0])
-                                          "params" {}}
-                                   tracks (clj->js (conj cursor track))]
-                               (transition {:state :init})
-                               (om/update! cursor tracks)
-                               (go (>! set-state-ch id)))
-                      (print "Cannot commit."))]
-        (condp = (:state state)
-          :init (p (dom/span #js {:onClick #(transition {:state :width})} "{+}"))
-          :type (p (dom/span #js {:onClick #(transition {:state :init})} (str "{- " (:width state) " ... "))
-                   (dom/span #js {:onClick #(transition {:state :sample :type "sample"})} " sample ")
-                   (dom/span #js {:onClick #(transition {:state :note :type "play"})} " note ")
-                   (dom/span #js {:onClick #(transition {:state :synth :type "synth"})} " synth ")
-                   (dom/span #js {:onClick #(transition {:state :bpc :type "grid"})} " grid ")
-                   (dom/span nil "}"))
-          :width (p (dom/span #js {:onClick #(transition {:state :init})} "{-")
-                    (dom/span #js {:onClick #(transition {:state :type :width 1})} " 1 ")
-                    (dom/span #js {:onClick #(transition {:state :type :width 2})} " 2 ")
-                    (dom/span #js {:onClick #(transition {:state :type :width 3})} " 3 ")
-                    (dom/span #js {:onClick #(transition {:state :type :width 4})} " 4 ")
-                    (dom/span #js {:onClick #(transition {:state :type :width 6})} " 6 ")
-                    (dom/span #js {:onClick #(transition {:state :type :width 8})} " 8 ")
-                    (dom/span nil "}"))
-          :sample (p (dom/span #js {:onClick #(transition {:state :init})} (str "{- " (:width state) " sample ... "))
-                     (apply dom/select #js {:value (:sample state)
-                                            :onChange #(handle-change % owner state :sample)
-                                            :onClick #(handle-change % owner state :sample)
-                                            :onKeyDown #(when (= 13 (.-which %))
-                                                          (commit))}
-                            (map #(dom/option nil %) (om/observe owner (samples))))
-                     (dom/span nil "}"))
-          :bpc (p (dom/span #js {:onClick #(transition {:state :init})} (str "{- " (:width state) " grid ... "))
-                  (dom/span #js {:onClick #(transition {:state :grid :bpc "1/32"})} " 1/32 ")
-                  (dom/span #js {:onClick #(transition {:state :grid :bpc "1/16"})} " 1/16 ")
-                  (dom/span #js {:onClick #(transition {:state :grid :bpc "1/8"})} " 1/8 ")
-                  (dom/span #js {:onClick #(transition {:state :grid :bpc "1/4"})} " 1/4 ")
-                  (dom/span #js {:onClick #(transition {:state :grid :bpc "1/2"})} " 1/2 ")
-                  (dom/span #js {:onClick #(transition {:state :grid :bpc "1"})} " 1 ")
-                  (dom/span #js {:onClick #(transition {:state :grid :bpc "2"})} " 2 ")
-                  (dom/span #js {:onClick #(transition {:state :grid :bpc "4"})} " 4 ")
-                  (dom/span #js {:onClick #(transition {:state :grid :bpc "6"})} " 6 ")
-                  (dom/span #js {:onClick #(transition {:state :grid :bpc "8"})} " 8 ")
-                  (dom/span nil "}"))
-          :grid (p (dom/span #js {:onClick #(transition {:state :init})}
-                             (str "{- " (:width state) " (" (:bpc state) ") ... "))
-                   (dom/input #js {:type "text" :value (:text state)
-                                   :onChange #(handle-change % owner state :text)})
-                   (dom/span #js {:onClick commit} " commit? ")
-                   (dom/span nil "}"))
-          :note (p (dom/span #js {:onClick #(transition {:state :init})} (str "{- " (:width state) " note ... "))
-                   (dom/input #js {:type "text" :value (:text state)
-                                   :onChange #(handle-change % owner state :text)
-                                   :onKeyDown #(when (= 13 (.-which %))
-                                                 (commit))})
-                   (dom/span nil "}"))
-          :synth (p (dom/span #js {:onClick #(transition {:state :init})} (str "{- " (:width state) " synth ... "))
-                     (apply dom/select #js {:value (:synth state)
-                                            :onChange #(handle-change % owner state :synth)
-                                            :onClick #(handle-change % owner state :synth)
-                                            :onKeyDown #(when (= 13 (.-which %))
-                                                          (commit))}
-                            (map #(dom/option nil %) (om/observe owner (synths))))
-                     (dom/span nil "}")))))))
-
 (defn track-view [{:keys [cursor id delete-ch]} owner]
   (reify
     om/IInitState
@@ -376,9 +269,9 @@
                                                                  (repeat id)
                                                                  (repeat (:delete-ch state)))]
                                                 (om/build-all track-view cursors {:state state}))))
-                            (om/build track-builder2 {:cursor (get cursor "tracks")
-                                                      :id id
-                                                      :set-state-ch (:set-state-ch state)}))))))))
+                            (om/build track-builder {:cursor (get cursor "tracks")
+                                                     :id id
+                                                     :set-state-ch (:set-state-ch state)}))))))))

 (defn app-view [cursor _]
   (reify


Create synth-params and sample-params upon type selection.

--- sonic-jam/src/sonic_jam/core.cljs
+++ sonic-jam/src/sonic_jam/core.cljs
@@ -216,8 +216,16 @@
                                     :onClick #(handle-change % owner state :type)
                                     :onKeyDown #(when (= 13 (.-which %))
                                                   (om/update-state! owner (fn [s] (merge s {:state :immutable})))
-                                                  (if-not (= "grid" (:type state))
-                                                    (om/transact! cursor (fn [c] (assoc c "type" (:type state))))
+                                                  (condp = (:type state)
+                                                    "synth"
+                                                    (om/transact! cursor (fn [c] (assoc c
+                                                                                "type" (:type state)
+                                                                                "synth-params" {})))
+                                                    "sample"
+                                                    (om/transact! cursor (fn [c] (assoc c
+                                                                                "type" (:type state)
+                                                                                "sample-params" {})))
+                                                    "grid"
                                                     (let [grid-id (new-id)
                                                           grid {"name" ""
                                                                 "grid-id" grid-id
@@ -234,7 +242,6 @@
                                                   (go (>! set-state-ch id)))}
                                (dom/option nil "synth")
                                (dom/option nil "sample")
-                               (dom/option nil "play")
                                (dom/option nil "grid"))
         :immutable (dom/span nil (get cursor "type"))))))

@@ -413,11 +420,15 @@
                                                                 (dom/td nil "grid-type:")
                                                                 (dom/td nil (om/build grid-type-editor input)))
                                                         fx-row])
-                                              [(dom/tr nil
-                                                       (dom/td nil nil)
-                                                       (dom/td nil "params:")
-                                                       (dom/td nil (om/build param-editor input)))
-                                               fx-row])
+                                              "sample" [(dom/tr nil
+                                                                (dom/td nil nil)
+                                                                (dom/td nil "params:")
+                                                                (dom/td nil (om/build sample-param-editor input)))
+                                                        fx-row]
+                                              "synth" [(dom/tr nil
+                                                               (dom/td nil nil)
+                                                               (dom/td nil "params:")
+                                                               (dom/td nil (om/build synth-param-editor input)))])
                                             [(dom/tr nil
                                                      (dom/td closer "}")
                                                      (dom/td nil nil)
@@ -436,7 +447,6 @@
                                  (clj->js
                                   (conj s {"type" "none"
                                            "beats" (repeat % [0])
-                                           "params" {}
                                            "fx" []}))))
             width-selection (fn [w s]
                               (dom/span #js {:onClick


Now common-deps are actually in common between frontend and backend

--- resources/leiningen/new/lambone/common/build.boot
+++ resources/leiningen/new/lambone/common/build.boot
@@ -2,27 +2,29 @@
 ;;;  Dependencies  ;;;
 ;;;;;;;;;;;;;;;;;;;;;;

-(def common-deps '[[degree9/boot-semver "1.2.4" :scope "test"]
-                   [adzerk/env "0.3.0" :scope "test"]
-                   [pandeiro/boot-http "0.7.3" :scope "test"]])
+(def cmd-line-deps '[[degree9/boot-semver "1.2.4" :scope "test"]
+                     [adzerk/env "0.3.0" :scope "test"]
+                     [pandeiro/boot-http "0.7.3" :scope "test"]])
+
+(def common-deps '[[org.clojure/clojure "1.8.0" :scope "test"]])

 (def backend-dev-deps '[[adzerk/boot-test "1.1.1"]
                         [adzerk/env "0.3.0" :scope "test"]])

-(def backend-deps '[[org.clojure/clojure "1.8.0"]
-                    [org.clojure/tools.namespace "0.2.10"]
-                    [org.clojure/tools.reader "0.10.0"]
-                    [org.clojure/tools.cli "0.3.3"]
-                    [org.clojure/tools.logging "0.3.1"]
-                    [org.apache.logging.log4j/log4j-api "2.5" :scope "runtime"]
-                    [org.apache.logging.log4j/log4j-core "2.5" :scope "runtime"]
-                    [org.apache.logging.log4j/log4j-jcl "2.5" :scope "runtime"]
-                    [org.apache.logging.log4j/log4j-jul "2.5" :scope "runtime"]
-                    [org.apache.logging.log4j/log4j-1.2-api "2.5" :scope "runtime"]
-                    [org.apache.logging.log4j/log4j-slf4j-impl "2.5" :scope "runtime"]
-                    [mount "0.1.10"]
-                    [robert/hooke "1.3.0"]
-                    [cprop "0.1.7"]])
+(def backend-deps (into common-deps
+                        '[[org.clojure/tools.namespace "0.2.10"]
+                          [org.clojure/tools.reader "0.10.0"]
+                          [org.clojure/tools.cli "0.3.3"]
+                          [org.clojure/tools.logging "0.3.1"]
+                          [org.apache.logging.log4j/log4j-api "2.5" :scope "runtime"]
+                          [org.apache.logging.log4j/log4j-core "2.5" :scope "runtime"]
+                          [org.apache.logging.log4j/log4j-jcl "2.5" :scope "runtime"]
+                          [org.apache.logging.log4j/log4j-jul "2.5" :scope "runtime"]
+                          [org.apache.logging.log4j/log4j-1.2-api "2.5" :scope "runtime"]
+                          [org.apache.logging.log4j/log4j-slf4j-impl "2.5" :scope "runtime"]
+                          [mount "0.1.10"]
+                          [robert/hooke "1.3.0"]
+                          [cprop "0.1.7"]]))
 <% if any frontend %>
 (def frontend-dev-deps '[[adzerk/boot-cljs "1.7.228-1" :scope "test"]
                          [adzerk/boot-cljs-repl "0.3.0" :scope "test"]
@@ -37,20 +39,20 @@

 ;; All the deps are "test" because they are only need for compiling to
 ;; JavaScript, not "real" project dependencies.
-(def frontend-deps '[[org.clojure/clojure "1.8.0" :scope "test"]
-                     [org.clojure/clojurescript "1.8.51" :scope "test"]
-                     [org.clojure/core.async "0.2.374" :scope "test"]
-                     [reagent "0.5.1" :exclusions [org.clojure/tools.reader] :scope "test"]
-                     [reagent-forms "0.5.23" :scope "test"]
-                     [reagent-utils "0.1.8" :scope "test"]
-                     [hiccup "1.0.5" :scope "test"]
-                     [secretary "1.2.3" :scope "test"]
-                     [venantius/accountant "0.1.7" :scope "test"]
-                     [com.cognitect/transit-cljs "0.8.237" :scope "test"]
-                     [adzerk/cljs-console "0.1.1" :scope "test"]])
+(def frontend-deps (into common-deps
+                         '[[org.clojure/clojurescript "1.8.51" :scope "test"]
+                           [org.clojure/core.async "0.2.374" :scope "test"]
+                           [reagent "0.5.1" :exclusions [org.clojure/tools.reader] :scope "test"]
+                           [reagent-forms "0.5.23" :scope "test"]
+                           [reagent-utils "0.1.8" :scope "test"]
+                           [hiccup "1.0.5" :scope "test"]
+                           [secretary "1.2.3" :scope "test"]
+                           [venantius/accountant "0.1.7" :scope "test"]
+                           [com.cognitect/transit-cljs "0.8.237" :scope "test"]
+                           [adzerk/cljs-console "0.1.1" :scope "test"]]))
 <% endif %>
 (set-env! :source-paths #{"dev"}
-          :dependencies common-deps)
+          :dependencies cmd-line-deps)

 (require 'boot
          '[clojure.pprint :refer [pprint]]


Throw exception when creating an existing database.

--- src/merkle_db/connection.clj
+++ src/merkle_db/connection.clj
@@ -93,6 +93,11 @@
   (create-db!
     [this db-name root-data]
     ; TODO: lock db
+    (when (::ref/value (ref/get-ref (.tracker this) db-name))
+      (throw (ex-info (str "Cannot create new database: " db-name
+                           " already exists")
+                      {:type ::db-conflict
+                       :db-name db-name})))
     (->>
       (if (::db/tables root-data)
         root-data


Condensed the def*-openly macro code

Condensed the def*-openly macro code

--- src/midje/open_protocols.clj
+++ src/midje/open_protocols.clj
@@ -20,16 +20,15 @@
        (apply ~name ~args)
        (do ~@body))))

-(defn- defx-openly [x name fields specs]
-  (let [revised-specs (for [spec specs]
-                        (if (and (implementation? spec)
-                              (user-desires-checking?))
-                          (open-spec spec)
-                          spec))]
-    (list* x name fields revised-specs)))
+(defn- revised-specs [specs]
+  (for [spec specs]
+    (if (and (implementation? spec) (user-desires-checking?))
+      (open-spec spec)
+      spec)))

 (defmacro deftype-openly [name fields & specs]
-  (defx-openly 'deftype name fields specs))
+  `(~'deftype ~name ~fields ~@(revised-specs specs)))
+
 (defmacro defrecord-openly [name fields & specs]
-  (defx-openly 'defrecord name fields specs))
+  `(~'defrecord ~name ~fields ~@(revised-specs specs)))


Remove print stacktrace

Remove print stacktrace

--- src/obb_rules_api/routes.clj
+++ src/obb_rules_api/routes.clj
@@ -29,7 +29,7 @@
     (try
       (handler req)
       (catch Exception e
-        (clojure.stacktrace/print-stack-trace e 10)
+        #_(clojure.stacktrace/print-stack-trace e 10)
         (reply/exception e)))))

 (def app


using floating-ips object and seperating addresses from first ip

--- src/openstack/networking.clj
+++ src/openstack/networking.clj
@@ -12,16 +12,18 @@
 (ns openstack.networking
   "openstack networking management"
   (:require
+    [celestial.common :refer (import-logging)]
     [clojure.java.data :refer [from-java]]
-    [celestial.persistency.systems :as s]
-    )
+    [celestial.persistency.systems :as s]))

- )
+(import-logging)

-(defn first-ip [server network]
-  (first
-    (map (comp :addr from-java)
-       (get-in (from-java server) [:addresses :addresses network]))))
+(defn addresses-ip
+   "grab addresses from server"
+   [server network]
+   (map (comp :addr from-java) (get-in (from-java server) [:addresses :addresses network])))
+
+(defn first-ip [server network] (first (addresses-ip server network)))

 (defn update-ip [spec ip]
   "update instance ip"
@@ -30,11 +32,13 @@

 (defn assoc-floating
    "assoc floating ip with instance"
-   [compute server ip]
-   (-> compute (.floatingIps) (.addFloatingIP server ip)))
+   [floating-ips server ip]
+     (debug "assoc" ip "to" (:id (from-java server)))
+     (.addFloatingIP floating-ips server ip))

-(defn dissoc-ip
+(defn dissoc-floating
    "dissoc ip for instance"
-   [compute server ip]
-    (-> compute (.floatingIps) (.removeFloatingIP server ip))
-  )
+   [floating-ips server ip]
+     (debug "dissoc" ip "from" (:id (from-java server)))
+     (.removeFloatingIP floating-ips server ip))
+


Add live-synth-controller function for interactive control of a live synth. I found this very useful. Perhaps others will, too.

--- src/overtone/gui/control.clj
+++ src/overtone/gui/control.clj
@@ -1,5 +1,6 @@
 (ns overtone.gui.control
   (:use [overtone.gui dial spinner-label]
+        [overtone.sc.node :only [ctl]]
         [seesaw core mig]
         [seesaw.border :only [line-border]])
   (:require [seesaw.bind :as bind]))
@@ -115,6 +116,27 @@
       (listen frame :window-closed (fn [_] (cleanup)))
       (-> frame pack! show!))))

+(defn live-synth-controller
+  "Create a synth instance and attach a synth-controller to it.
+  Allows you to control the-synth interactively.
+
+  (defsynth foo [freq1 {:default 332 :min 200 :max 800 :step 1}
+                 freq2 {:default 333 :min 200 :max 800 :step 1}]
+     (out 0 (pan2 (mix [(lf-tri freq1) (lf-tri freq2)]))))
+
+  (live-synth-controller foo)"
+  [the-synth]
+  (let [the-instance (the-synth)
+        the-watchers (map
+                      (fn [param]
+                        (add-watch
+                         (:value param)
+                         (keyword (:name param))
+                         (fn [_ _ _ val] (ctl the-instance (keyword (:name param)) val))))
+                      (:params the-synth))
+        the-controller (synth-controller the-synth)]
+    (vector the-instance the-watchers the-controller)))
+
 (comment
   (use 'overtone.gui.control)
   (def synth {:name "Test"


scheduler: tests: Allow specifying job name in test fixtures.

--- scheduler/test/cook/test/mesos/schema.clj
+++ scheduler/test/cook/test/mesos/schema.clj
@@ -55,6 +55,7 @@
                   :job/uuid uuid
                   :job/command command
                   :job/user user
+                  :job/name name
                   :job/max-retries retry-count
                   :job/max-runtime max-runtime
                   :job/priority priority


whitespace

whitespace

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -2358,7 +2358,7 @@
                   (let [obj (atom :top)]
                     {:share-sem :obj
                      :synsem {:cat :verb
-                             :sem {:obj obj}
+                              :sem {:obj obj}
                               :subcat {:2 {:cat :prep
                                            :sem {:obj obj}}}}}))


+"arrive" + PP[at]

+"arrive" + PP[at]

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -76,9 +76,10 @@
    "approve" {:synsem {:cat :verb
                 :sem {:pred :approve}}}

-   "arrive" {:synsem {:cat :verb
-                      :sem {:pred :arrive}}}
-
+   "arrive" [{:synsem {:cat :verb
+                       :sem {:pred :arrive
+                             :subcat {:2 {:cat :prep
+                                          :sem {:pred :at}}}}}}]
    "ask" {:synsem {:cat :verb
                    :sem {:pred :chiedere}}}


Remove stale require

Remove stale require

--- src/braid/quests/server/db.clj
+++ src/braid/quests/server/db.clj
@@ -1,8 +1,7 @@
 (ns braid.quests.server.db
   (:require
     [datomic.api :as d]
-    [braid.server.db :as db]
-    [braid.server.db.common :refer [quest-record-pull-pattern]]))
+    [braid.server.db :as db]))

 ; Pull Patterns


sql "first prototype" fix

sql "first prototype" fix

--- configuration/sql-input-model.clj
+++ configuration/sql-input-model.clj
@@ -1,9 +1,14 @@
-(table "Entity" :Entity
-       (column "ID" :ID :String :notnull))
+(table "entity" :Entity
+       (column "ID" :ID :VARCHAR_45_ :pk :notnull)
+       (column "CreationTime" :CreationTime :DATETIME)
+       (column "Validity" :Validity :BIGINT)
+       (column "Name" :Name :VARCHAR_45_))

-(table "EntityOtherInfo" :EntityOtherInfo
-       (column "ID" :EntityID :String :notnull)
-       (column "OtherInfo" :OtherInfo :String :notnull))
+(table "entity_other_info" :EntityOtherInfo
+       (column "EntityID" :EntityID :VARCHAR_45_ :notnull)
+       (column "OtherInfo" :OtherInfo :VARCHAR_45_ :notnull)
+       (fk "EntityOtherInfo"
+           (between :EntityID :Entity :ID)))

 (relation :EntityOtherInfo
           (edge :Entity :ID :*)


[experiment/train] Mild improvement to simple loss print. (#246)

--- experiment/src/cortex/experiment/train.clj
+++ experiment/src/cortex/experiment/train.clj
@@ -28,7 +28,6 @@
 (defn save-network
   "Saves a trained network out to the filesystem."
   [network network-filename]
-  (println "Saving network to" network-filename)
   (util/write-nippy-file network-filename network)
   network)

@@ -77,7 +76,9 @@
                                                       loss-val
                                                       current-best-loss))
         epoch (get new-network :epoch-count)]
-    (println (format "Loss for epoch %s: (current) %s (best) %s" epoch loss-val current-best-loss))
+    (println (format "Loss for epoch %3d: (current) %.8f (best) %.8f%s"
+                     epoch loss-val current-best-loss
+                     (if best-network? " [new best]" "")))
     {:best-network? best-network?
      :network updated-network}))


FIXED bug #4

FIXED bug #4

--- src/clinvar_submitter/form.clj
+++ src/clinvar_submitter/form.clj
@@ -8,7 +8,10 @@
 	 "Outputs a well-formed value for output of the CSV file being generated.
 	   nil should be empty strings, non-strings should be stringified, etc..."
 	 [v fn]
-	 (if (nil? v) fn (if (number? v) (str v) v)))
+   (cond
+     (nil? v) fn
+	   (number? v) (str v)
+     (seq? v) (apply str v) :else v))

  ; *** Interpretation related transformations
  (defn interp-id
@@ -17,7 +20,6 @@
    [i]
    (let [full-id (get i "id")]
    (let [id (get (re-find #"\/([a-z0-9\-]+)\/$" full-id) 1)]
-     (println "id" id)
      (if (nil? id) (log/debug (str "ERROR-interp-id: id not found")))
      (csv-colval id "ERROR-interp-id"))))

@@ -218,7 +220,7 @@
     [t e]
     (let [info-sources (ld-> t e "information" "evidence" "information" "source")
           pmids (re-extract info-sources #"https\:\/\/www\.ncbi\.nlm\.nih\.gov\/pubmed\/(\p{Digit}*)" 1)]
-      (csv-colval (clojure.string/join ", " (map #(str "PMID:" %) pmids)) "")))
+      (csv-colval (clojure.string/join ", " (map #(apply str "PMID:" %) pmids)) "")))

   (defn get-met-evidence
    "Returns a collated map of all 'met' evidence records needed for the


handle case where trim may be needed after stripping "the"

--- src/clj/cljspazzer/scanner.clj
+++ src/clj/cljspazzer/scanner.clj
@@ -25,8 +25,8 @@
   (let [result (s/trim (s/lower-case s))]
     (if (and (> (count s) 4)
          (= "the " (subs result 0 4)))
-      (subs result 4)
-      result)))
+      (s/trim (subs result 4))
+      (s/trim result))))

 (defn get-info [f]
   (let [id3tags (try


Toggle enabled buttons based on simulation state

--- src/cljs/robot_kata/robot.cljs
+++ src/cljs/robot_kata/robot.cljs
@@ -1,11 +1,11 @@
 (ns robot-kata.robot

-  (:require [dommy.core          :refer [append! listen!                                                     ]]
+  (:require [dommy.core          :refer [append! listen! remove-attr! set-attr!                              ]]
             [robot-kata.geometry :refer [calculate-next-position calculate-position-delta get-sensor-position]]
             [robot-kata.image    :refer [get-2d-context get-color-name get-pixel-color                       ]]
             [robot-kata.svg      :refer [make-robot-graphic set-position!                                    ]] )

-  (:require-macros [dommy.macros :refer [node sel1]]) )
+  (:require-macros [dommy.macros :refer [node sel sel1]]) )

 (def robot-params {:robot-radius              35 ; pixels
                    :center-to-sensor-distance 30 ; pixels
@@ -22,6 +22,7 @@

 (defn init-ui []
   (let [stop-button (node [:button "Stop simulation"])]
+    (set-attr! stop-button :disabled)
     (listen! stop-button :click stop-simulation!)
     (append! (sel1 :#stop-button-div) stop-button) )
   (add-test "Test 1" {:x 275 :y 450 :theta 0})
@@ -32,7 +33,9 @@

 (defn add-test [name start-position]
   (let [button (node [:button name])]
-    (listen! button :click #(simulate start-position))
+    (listen! button :click #(do
+                              (disable-start-test-buttons)
+                              (simulate start-position) ))
     (append! (sel1 :#test-start-button-div) (node [:div button])) ) )

 (let [last-tick-time (atom 0)]
@@ -44,6 +47,16 @@
 (defn get-new-robot-velocity [sensed-color]
   (cond (= sensed-color "white") {:trans 50 :rot  0}
         :else                    {:trans  0 :rot 10} ) )
+
+(defn enable-start-test-buttons []
+  (doseq [b (sel [:#test-start-button-div :button])]
+    (remove-attr! b :disabled) )
+  (set-attr! (sel1 [:#stop-button-div :button]) :disabled) )
+
+(defn disable-start-test-buttons []
+  (doseq [b (sel [:#test-start-button-div :button])]
+    (set-attr! b :disabled) )
+  (remove-attr! (sel1 [:#stop-button-div :button]) :disabled) )

 (let [stop-simulation? (atom false)]
   (defn stop-simulation! []
@@ -71,5 +84,6 @@
                                               (if (time-for-control-tick?)
                                                 (get-new-robot-velocity sensed-color)
                                                 robot-velocity )
-                                              tick-time ))  ) ) ) )
+                                              tick-time ))
+         (enable-start-test-buttons) ) ) ) )


Only apply :default-layout-params trait if at least one attribute is present

--- src/clojure/neko/ui/traits.clj
+++ src/clojure/neko/ui/traits.clj
@@ -211,7 +211,7 @@
   "Takes `:layout-width` and `:layout-height` attributes and sets
    LayoutParams, if the container type is not specified."
   {:attributes [:layout-width :layout-height]
-   :applies? (nil? container-type)}
+   :applies? (and (or layout-width layout-height) (nil? container-type))}
   [^View wdg, {:keys [layout-width layout-height]} {:keys [container-type]}]
   (let [^int width  (kw/value :layout-params (or layout-width  :wrap))
         ^int height (kw/value :layout-params (or layout-height :wrap))]


Fill collection-renderer-lib's project.clj without getting bitten by parinfer

--- collection-renderer-lib/project.clj
+++ collection-renderer-lib/project.clj
@@ -23,7 +23,7 @@
   :resource-paths ["resources" ~gem-install-path]
   :jvm-opts ^:replace ["-server"
                        "-Dclojure.compiler.direct-linking=true"]
-  :profiles {}
+  :profiles {
     :dev {:dependencies [[org.clojure/tools.namespace "0.2.11"]
                          [proto-repl "0.3.1"]
                          [pjstadig/humane-test-output "0.8.1"]]
@@ -35,7 +35,7 @@
     ;; project, use `lein lint` from inside the project directory. To run for
     ;; all projects at the same time, use the same command but from the top-
     ;; level directory.
-    :lint {}
+    :lint {
       :source-paths ^:replace ["src"]
       :test-paths ^:replace []
       :plugins [[jonase/eastwood "0.2.3"]
@@ -43,7 +43,7 @@
                 [lein-bikeshed "0.4.1"]
                 [lein-kibit "0.1.2"]
                 [lein-shell "0.4.0"]
-                [venantius/yagni "0.1.4"]]
+                [venantius/yagni "0.1.4"]]}}
   :aliases {"install-gems" ["shell"
                             "support/install_gems.sh"
                             ~jruby-version


Fix random dungeon stairs

Fix random dungeon stairs

--- src/dungeon_crusade/common.clj
+++ src/dungeon_crusade/common.clj
@@ -113,7 +113,7 @@
         _ (println "former place id" (keyword (str (dec level))))
         up-stairs   (assoc-in (place :up-stairs) [1 :dest-place] (keyword (str (dec level))))
         _ (println "up-stairs" up-stairs)
-        down-stairs (assoc-in (place :down-stairs) [1 :dest-place] (keyword (str level)))
+        down-stairs (assoc-in (place :down-stairs) [1 :dest-place] (keyword (str (inc level))))
         place       (place :place)
         _ (println "place" place)]
     (add-extras place [down-stairs up-stairs])))


list all repos, optionally with forks

list all repos, optionally with forks

--- src/gh_waiting_room/github.clj
+++ src/gh_waiting_room/github.clj
@@ -1,6 +1,6 @@
 (ns gh-waiting-room.github
   (:require [tentacles.issues :refer [my-issues create-comment]]
-            [tentacles.repos :refer [create-hook hooks]]
+            [tentacles.repos :refer [create-hook hooks repos]]
             [gh-waiting-room.config :refer [gh-auth issue-url-regex gh-hide-labels app-domain]]))

 ;;; util fns
@@ -77,6 +77,14 @@
    (map (fn [h]
           {:url (get-in! h [:config :url]) :id (:id h)}))))

+(defn list-repos
+  []
+  (let [all-repos (repos (assoc (gh-auth) :type "public" :all-pages true))
+        filter-fn (if (System/getenv "GITHUB_ACTIVATE_FORKS") identity :fork)]
+    (->> all-repos
+         (filter filter-fn)
+         (map :name))))
+
 (defn create-issue-comment [db issue-id issue-num]
   (let [issue (or
                (some #(and (= (:id %) issue-id) %) (viewable-issues db))


Adds zone to the header for the GM

Adds zone to the header for the GM

--- src/hphelper/scengen/print.clj
+++ src/hphelper/scengen/print.clj
@@ -42,7 +42,6 @@
   "Prints all the crisises in html"
   [scenRec]
   (html [:div
-         [:b "Welcome GM. Crisis numbers are: " (interpose ", " (map :c_id (scenRec :crisises))) [:br]]
          (map html-print-crisis (scenRec :crisises))
          ]))

@@ -155,11 +154,20 @@
                       ])
           (partition-all 2 directives))]])

+(defn- html-print-header
+  "Prints a short summary at the beginning"
+  [{zone :zone :as scenRec}]
+  [:div
+   [:b "Welcome GM. Zone is: " zone ". "
+    "Crisis numbers are: " (interpose ", " (map :c_id (scenRec :crisises))) [:br]]
+   ])
+
 (defn html-print-scenario
   "Prints a scenario in html format"
   [scenRec]
   (html [:div
          ;[:div "DEBUG: " (str scenRec)] ;; Prints out the entire map for debugging
+         (html-print-header scenRec)
          (html-print-indicies scenRec)
          (html-print-crisises scenRec)
          (html-print-directive-summary scenRec)


Move asset-full-path examples into docstring

--- src/afrey/boot_asset_fingerprint/impl.clj
+++ src/afrey/boot_asset_fingerprint/impl.clj
@@ -3,11 +3,13 @@
             [clojure.java.io :as io]))

 (defn asset-full-path
-  "Return the full path of an asset, taking into account relative and absolute paths TODO"
-  ;; (asset-root "foo.txt" "") => "foo.txt"
-  ;; (asset-root "/foo.txt" "") => "foo.txt"
-  ;; (asset-root "/foo.txt" "parent") => "foo.txt"
-  ;; (asset-root "foo.txt" "parent") => "parent/foo.txt"
+  "Return the full path of an asset, taking into account relative and absolute paths.
+
+  Examples:
+  (asset-full-path \"foo.txt\" \"\") => \"foo.txt\"
+  (asset-full-path \"/foo.txt\" \"\") => \"foo.txt\"
+  (asset-full-path \"/foo.txt\" \"parent\") => \"foo.txt\"
+  (asset-full-path \"foo.txt\" \"parent\") => \"parent/foo.txt\""

   [path relative-root]
   (let [separator (java.io.File/separator)]


async cached urlfetch. involved some refactoring to avoid repeating myself too much in the 4 different fetch methods now available.

--- src/appengine_magic/services/urlfetch.clj
+++ src/appengine_magic/services/urlfetch.clj
@@ -3,6 +3,7 @@
             URLFetchServiceFactory
             FetchOptions
             FetchOptions$Builder
+            HTTPHeader
             HTTPRequest
             HTTPMethod])
   (:require [clojure.contrib.string :as string]
@@ -58,13 +59,12 @@
       (.followRedirects fetch-options)
       (.doNotFollowRedirects fetch-options))
     (.setDeadline fetch-options deadline)
-    (let [url-obj    (urlify url)
-          method-obj (method {:delete HTTPMethod/DELETE
+    (let [method-obj (method {:delete HTTPMethod/DELETE
                               :get    HTTPMethod/GET
                               :head   HTTPMethod/HEAD
                               :post   HTTPMethod/POST
                               :put    HTTPMethod/PUT})
-          request    (HTTPRequest. url-obj method-obj fetch-options)]
+          request    (HTTPRequest. url method-obj fetch-options)]
       (doseq [h (make-headers headers)] (.addHeader request h))
       (when-not (nil? payload)
         (.setPayload request payload))
@@ -89,51 +89,76 @@

   [url & opts]
   (parse-response (.fetch (get-urlfetch-service)
-                          (apply make-request url opts))))
+                          (apply make-request (urlify url) opts))))
+
+(defn- derefify-future
+  "Cribbed from clojure.core/future-call, but returns the result of a
+   custom function of no-args for deref."
+  [f deref-fn]
+  (reify
+   clojure.lang.IDeref
+   (deref [_] (deref-fn))
+   java.util.concurrent.Future
+   (get [_] (.get f))
+   (get [_ timeout unit] (.get f timeout unit))
+   (isCancelled [_] (.isCancelled f))
+   (isDone [_] (.isDone f))
+   (cancel [_ interrupt?] (.cancel f interrupt?))))

 (defn fetch-async
   "Just like fetch, but returns a future-like object."
   [url & opts]
-  (let [f (.fetchAsync (get-urlfetch-service) (apply make-request url opts))]
-    (reify
-     clojure.lang.IDeref
-      (deref [_] (parse-response (.get f)))
-     java.util.concurrent.Future
-      (get [_] (.get f))
-      (get [_ timeout unit] (.get f timeout unit))
-      (isCancelled [_] (.isCancelled f))
-      (isDone [_] (.isDone f))
-      (cancel [_ interrupt?] (.cancel f interrupt?)))))
+  (let [f (.fetchAsync (get-urlfetch-service)
+                       (apply make-request (urlify url) opts))]
+    (derefify-future f #(parse-response (.get f)))))

+;; A 2-level cache for fetch results; first in memory, then memcache.
 (def *memcache-namespace* "appengine-magic.services.urlfetch")
 (def *memory-cache* (atom {}))
-(defn cache-response [url response]
+(defn- cache-response [url response]
   ;; save unnecessary memcache calls by checking for relevant headers
   (if (or (:Last-Modified (:headers response))
           (:ETag (:headers response)))
-    (do (swap! assoc url response)
+    (do (swap! *memory-cache* assoc url response)
         (memcache/put! url response :namespace *memcache-namespace*)
         response)))
-(defn uncache-response [url]
+(defn- uncache-response [url]
   (if-let [response (@*memory-cache* url)]
     response
     (memcache/get url :namespace *memcache-namespace*)))
+
+(defn- make-cache-sensitive-request [old-response url & opts]
+  (let [request (apply make-request url opts)]
+    (if old-response
+      (if-let [etag (:ETag (:headers old-response))]
+        (.setHeader request (HTTPHeader. "If-None-Match" etag))
+        (if-let [last-modified (:Last-Modified (:headers old-response))]
+          (.setHeader request
+                      (HTTPHeader. "If-Modified-Since" last-modified)))))
+    request))

 (defn memcached-fetch
   "Like fetch, but caches its results in memcache and uses ETag or
    Last-Modified headers to avoid doing full-fetches when possible."
   [url & opts]
-  (let [request (apply make-request url opts)
-        url     (.getURL request)]
-    (if-let [old-response (uncache-response url)]
-      (do
-        (if-let [etag (:ETag (:headers old-response))]
-          (.setHeader request "If-None-Match" etag)
-          (if-let [last-modified (:Last-Modified (:headers old-response))]
-            (.setHeader request "If-Modified-Since" last-modified)))
-        (let [response (parse-response (.fetch (get-urlfetch-service) request))]
-          (if (= 304 (:response-code response))
-            old-response
-            (cache-response url response))))
-      ;; if no cache, do a regular fetch
-      (cache-response (apply fetch url opts)))))
+  (let [url          (urlify url)
+        old-response (uncache-response url)
+        request      (apply make-cache-sensitive-request old-response url opts)
+        response     (parse-response (.fetch (get-urlfetch-service) request))]
+    (if (= 304 (:response-code response))
+      old-response
+      (cache-response url response))))
+
+(defn memcached-fetch-async
+  "Like fetch-async, but caches its results like memcached-fetch."
+  [url & opts]
+  (let [url          (urlify url)
+        old-response (uncache-response url)
+        request      (apply make-cache-sensitive-request old-response url opts)
+        responsef    (.fetchAsync (get-urlfetch-service) request)]
+    (derefify-future responsef
+                     (fn []
+                       (let [response (parse-response (.get responsef))]
+                         (if (= 304 (:response-code response))
+                           old-response
+                           (cache-response url response)))))))


Update common.clj

Update common.clj

--- src/jarkeeper/views/common.clj
+++ src/jarkeeper/views/common.clj
@@ -12,7 +12,6 @@
     [:meta {:name "author" :content "Hashobject (team@hashobject.com)"}]
     [:meta {:rel "author" :type "text/plain" :href "/humans.txt"}]
     [:link {:rel "shortcut icon" :href "/favicon.ico"}]))
-

 (defn common-footer []
   [:footer.footer.row


third time's the charm

third time's the charm

--- src/main/shadow/cljs/devtools/server/web/repl.clj
+++ src/main/shadow/cljs/devtools/server/web/repl.clj
@@ -58,9 +58,10 @@
             (try
               (loop [buf (char-array 1024)]
                 (let [len (.read in buf)]
-                  (when-not (neg? len)
-                    (out-fn {:tag :socket-in :text (String. buf 0 len)})))
-                (recur buf))
+                  (when (not= -1 len)
+                    (when (pos? len)
+                      (out-fn {:tag :socket-in :text (String. buf 0 len)}))
+                    (recur buf))))
               (catch Exception e
                 (log/debug e ::repl-out)))))]


making a set before passing to compare function

--- src/shuppet/securitygroups.clj
+++ src/shuppet/securitygroups.clj
@@ -132,8 +132,8 @@
 (defn- compare-sg
   [sg-id aws local]
   (let [remote (build-config aws)
-        ingress (compare-config  (:Ingress local) (:Ingress remote))
-        egress  (compare-config (:Egress local) (:Egress remote))]
+        ingress (compare-config  (set (:Ingress local)) (set (:Ingress remote)))
+        egress  (compare-config (set (:Egress local)) (set (:Egress remote)))]
     (ensure-ingress (:GroupName local) sg-id ingress)
     (ensure-egress (:GroupName local) sg-id egress)))


Always pull config from db.

Always pull config from db.

--- src/task_tracker/server/db.clj
+++ src/task_tracker/server/db.clj
@@ -2,8 +2,6 @@
   (:require [clojure.java.jdbc                  :as jdbc]
             [java-jdbc.sql                      :as sql-dsl]
             [task-tracker.server.service-config :refer [config]]))
-
-(def db (config :db))

 (defn gen-find-by-sql
   [^clojure.lang.Keyword table ^java.util.Map criteria]
@@ -25,13 +23,13 @@
 (defn find-by
   [^clojure.lang.Keyword table ^java.util.Map criteria]
   (jdbc/query
-   db
+   (config :db)
    [(gen-find-by-sql table criteria)]))

 (defn insert-record
   [^clojure.lang.Keyword table ^java.util.Map params]
   (jdbc/insert!
-   db
+   (config :db)
    table
    params))

@@ -52,7 +50,7 @@
   [^clojure.lang.Keyword table ^java.util.Map lookup-fields ^java.util.Map update-params]
   (let [where-clause (sql-dsl/where lookup-fields)]
     (jdbc/update!
-     db
+     (config :db)
      table
      update-params
      where-clause)))


generic-integrate-ident takes a sequence instead of varargs

--- src/untangled/client/core.cljc
+++ src/untangled/client/core.cljc
@@ -290,7 +290,7 @@
                 :clj  clojure.lang.Atom) x))

 (defn- generic-integrate-ident
-  [state ident & named-parameters]
+  [state ident named-parameters]
   (let [is-state-atom?             (is-atom? state)
         tmp-state                  (if is-state-atom? @state state)
         already-has-ident-at-path? (fn [data-path] (boolean (seq (filter #(= % ident) (get-in tmp-state data-path)))))
@@ -340,7 +340,7 @@
   [state ident & named-parameters]
   (assert (not (is-atom? state))
           "The state can't be an atom. Use 'integrate-ident!' instead.")
-  (apply generic-integrate-ident state ident named-parameters))
+  (generic-integrate-ident state ident named-parameters))

 (defn integrate-ident!
   "Integrate an ident into any number of places in the app state. This function is safe to use within mutation
@@ -358,7 +358,7 @@
   [state ident & named-parameters]
   (assert (is-atom? state)
           "The state has to be an atom. Use 'integrate-ident' instead.")
-  (apply generic-integrate-ident state ident named-parameters))
+  (generic-integrate-ident state ident named-parameters))

 (defn merge-state!


Parsing of expected duff values should be quiet.

We get lots of bad values "N/A", nil, etc uploaded via the api which we
still store. We do have to filter them out when we do calculations so we
convert them to nil.

--- src/clj/kixi/hecuba/data/measurements.clj
+++ src/clj/kixi/hecuba/data/measurements.clj
@@ -200,21 +200,17 @@
   (sort-by :timestamp m) m)

 (defn parse-measurements
-  "Takes measurements in the format returned from the database.
-   Returns a list of maps, with all values parsed approprietly."
+  "Takes measurements in the format returned from the
+   database. Returns a list of maps, with all values parsed
+   approprietly. If the value is a number or coercable to a number it
+   will be returned. Otherwise the value will be nil."
   [measurements]
-  (map (fn [m] (assoc-in m [:value]
-                         (let [n (if (number? (:value m))
-                                   (:value m)
-                                   (try
-                                     (Double/valueOf (:value m))
-                                     (catch NumberFormatException e nil
-                                            (log/errorf e "> NumberFormatException in parse-measurements - %s %s [%s] " (:sensor_id m) (:timestamp m) (:value m)))
-                                     (catch NullPointerException e nil
-                                            (log/errorf e "> NumberFormatException in parse-measurements - %s %s [%s] " (:sensor_id m) (:timestamp m) (:value m)))))]
-                           (if (number? n)
-                             n
-                             nil))))
+  (map (fn [m] (assoc-in m [:value] (if (number? (:value m))
+                                      (:value m)
+                                      (try
+                                        (Double/valueOf (:value m))
+                                        (catch Throwable t
+                                          nil)))))
        measurements))

 (defn where


Cleanup

Cleanup

--- src/cljs/gtfve/components/side_panel.cljs
+++ src/cljs/gtfve/components/side_panel.cljs
@@ -101,8 +101,7 @@
                                                   (let [classList (.. % -target -classList)]
                                                     (and
                                                      (.contains classList "tab-pane")
-                                                     (.contains classList "fade")))))
-                               )))
+                                                     (.contains classList "fade"))))))))
             active-in-ch (chan 1)]
         (go-loop []
           (let [[v c] (alts! [active-in-ch toggle-ch kill-ch])]
@@ -114,8 +113,7 @@
                               (om/set-state! owner :in nil)
                               (<! transition-ch)
                               (om/set-state! owner :active v)
-                              (>! active-in-ch v)
-                              )
+                              (>! active-in-ch v))
                   active-in-ch (om/set-state! owner :in v))
                 (recur)))))))
     om/IWillUnmount


CMR-4985: Put buried string values at namespace-level instead.

--- src/cmr/opendap/ous/concepts/variable.clj
+++ src/cmr/opendap/ous/concepts/variable.clj
@@ -18,7 +18,11 @@

 ;; XXX We can pull this from configuration once async-get-metadata function
 ;;     signatures get updated to accept the system data structure as an arg.
+(def variables-api-path "/variables")
 (def pinned-variable-schema-version "1.2")
+(def results-content-type "application/vnd.nasa.cmr.umm_results+json")
+(def charset "charset=utf-8")
+(def accept-format "%s; version=%s; %s")

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;   Notes   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -129,7 +133,7 @@
   variables, if params does not contain any."
   [search-endpoint user-token {variable-ids :variables}]
   (if (seq variable-ids)
-    (let [url (str search-endpoint "/variables")
+    (let [url (str search-endpoint variables-api-path)
           payload (build-query variable-ids)]
       (log/debug "Variables query CMR URL:" url)
       (log/debug "Variables query CMR payload:" payload)
@@ -137,10 +141,10 @@
        url
        (-> {}
            (request/add-token-header user-token)
-           (request/add-accept (format "%s; version=%s; %s"
-                                       "application/vnd.nasa.cmr.umm_results+json"
+           (request/add-accept (format accept-format
+                                       results-content-type
                                        pinned-variable-schema-version
-                                       "charset=utf-8"))
+                                       charset))
            (request/add-form-ct)
            (request/add-payload payload)
            ((fn [x] (log/trace "Full request:" x) x)))


Add currency to snapshot response, and make UUID fragment of snapshot ObscURL 5 characters instead of 4.

--- src/open_company/resources/stakeholder_update.clj
+++ src/open_company/resources/stakeholder_update.clj
@@ -19,7 +19,7 @@
   "Create a slug for the stakeholder update from the slugified title and a short UUID."
   [title]
   (let [non-blank-title (if (s/blank? title) "update" title)]
-    (str (slug/slugify non-blank-title) "-" (subs (str (java.util.UUID/randomUUID)) 0 4))))
+    (str (slug/slugify non-blank-title) "-" (subs (str (java.util.UUID/randomUUID)) 0 5))))

 (defun- sections-for
   "Recursive function to get each specified section and add it to the stakeholder update."
@@ -51,7 +51,7 @@
   (-> su-props
     (assoc :slug (slug-for title))
     (assoc :company-slug (:slug company))
-    (merge (select-keys company [:name :logo :logo-width :logo-height])) ; freeze some props of company
+    (merge (select-keys company [:name :logo :logo-width :logo-height :currency])) ; freeze some props of company
     (update :title #(or % ""))
     (assoc :author (common/author-for-user user))
     (assoc :created-at timestamp)


Revert "use RT.classForNameNonLoading rather than Class/forName"

This reverts commit cdf28664fa4a544bbe4a5cfdc1a79bfabd7e15c0.

RT.classForNameNonLoading was private until 1.7.0-alpha4

--- src/main/clojure/clojure/tools/reader.clj
+++ src/main/clojure/clojure/tools/reader.clj
@@ -631,7 +631,7 @@
 (defn- read-ctor [rdr class-name]
   (when-not *read-eval*
     (reader-error "Record construction syntax can only be used when *read-eval* == true"))
-  (let [class (RT/classForNameNonLoading (name class-name))
+  (let [class (Class/forName (name class-name) false (RT/baseLoader))
         ch (read-past whitespace? rdr)] ;; differs from clojure
     (if-let [[end-ch form] (case ch
                              \[ [\] :short]


Rewrite with-out-str with binding

Rewrite with-out-str with binding

--- core/data/core.clj
+++ core/data/core.clj
@@ -2446,12 +2446,9 @@
   calls."
   {:added "1.0"}
   [& body]
-  `(let [s# (buffer*)
-         out# *out*]
-     (var-set* (var *out*) s#)
+  `(binding [*out* (buffer*)]
      ~@body
-     (var-set (var *out*) out#)
-     (str s#)))
+     (str *out*)))

 (defn hash
   "Returns the hash code of its argument."


Trim namespace from the value passed to print-doc

Fixes an issue in which the namespace would appear twice when calling doc. If
the namespace on the :name symbol exists and is the same as the :ns symbol,
we drop the namespace value from the :name symbol before calling print-doc.

Related to CLJS-921, but the fix should not cause problems if ClojureScript's
behavior changes.

Signed-off-by: Mike Fikes <mike@fikesfarm.com>

Former-commit-id: f0d3dc7e8b0c268ff4c47723301df028d4417693

--- planck-cljs/src/planck/core.cljs
+++ planck-cljs/src/planck/core.cljs
@@ -198,8 +198,11 @@
             doc (if (repl-specials (second expression-form))
                   (repl/print-doc (repl-special-doc (second expression-form)))
                   (repl/print-doc
-                    (let [sym (second expression-form)]
-                          (with-compiler-env st (resolve env sym))))))
+                    (let [sym (second expression-form)
+                          var (with-compiler-env st (resolve env sym))]
+                      (if (= (namespace (:name var)) (str (:ns var)))
+                        (update var :name #(symbol (name %)))
+                        var)))))
           (prn nil))
         (try
           (cljs/eval-str


Don't cache planck.repl macros

Don't cache planck.repl macros

Fixes #193

--- planck-cljs/src/planck/repl.cljs
+++ planck-cljs/src/planck/repl.cljs
@@ -413,9 +413,13 @@
   [cache]
   (s/ends-with? (str (:name cache)) "$macros"))

+(defn cache-eligible?
+  [name]
+  (not= name 'planck.repl))
+
 (defn caching-js-eval
   [{:keys [path name source cache]}]
-  (when (and path source cache (:cache-path @app-env))
+  (when (and path source cache (:cache-path @app-env) (cache-eligible? name))
     (js/PLANCK_CACHE (cache-prefix-for-path path (is-macros? cache))
       (str (compiled-by-string) "\n" source) (cljs->transit-json cache)))
   (js/eval source))


Update material-ui deps

Update material-ui deps

--- examples/material-ui/project.clj
+++ examples/material-ui/project.clj
@@ -3,8 +3,8 @@
                  [org.clojure/clojurescript "1.10.339"]
                  [reagent "0.8.1"]
                  [figwheel "0.5.16"]
-                 [cljsjs/material-ui "1.2.1-1"]
-                 [cljsjs/material-ui-icons "1.1.0-1"]]
+                 [cljsjs/material-ui "3.1.1-0"]
+                 [cljsjs/material-ui-icons "3.0.1-0"]]

   :plugins [[lein-cljsbuild "1.1.7"]
             [lein-figwheel "0.5.16"]]
@@ -43,6 +43,6 @@
                 :npm-deps {react "16.4.0"
                            react-dom "16.4.0"
                            create-react-class "15.6.3"
-                           "@material-ui/core" "1.2.1"
-                           "@material-ui/icons" "1.1.0"}
+                           "@material-ui/core" "3.1.1"
+                           "@material-ui/icons" "3.0.1"}
                 :process-shim true}}}})


Count lines after comments

Count lines after comments

--- src/atom_finder/location_dump.clj
+++ src/atom_finder/location_dump.clj
@@ -62,8 +62,43 @@
      (map #(merge %1 (if (:path %1) {:depth (count (:path %1))} {})))
      (map (juxt :file :type :start-line :end-line :depth))
      (map prn)
-     ;(take 50000)
+     (take 50000)
      dorun
      (log-to "location-dump_non-atoms_2017-06-02.txt")
      time
      )
+
+(defn read-lines
+  "read edn file with one entry per line"
+  [filename]
+  (->> filename
+       slurp-lines
+       (map read-string)
+       ))
+
+(->> "tmp/location-dump_non-atoms_2017-06-02.txt_100000"
+     read-lines
+     (def location-dump-data)
+     time
+     )
+
+(defn process-dump-file
+  [[filename atoms-lst]]
+  (let [atoms (map (fn [[atom start-line end-line depth]]
+                     {:atom atom :start-line start-line :end-line end-line :depth depth}) atoms-lst)
+        comments (filter #(= :comment (:atom %)) atoms)]
+    (for [comment comments]
+      (let [next-line (->> atoms (map :start-line) (filter #(<= (:end-line comment) %)) min-of) ; next non-blank line after comment
+            next-line-items (filter #(= next-line (:start-line %)) atoms)
+            next-line-counts (frequencies next-line-items)]
+        (pprn [filename comment next-line next-line-counts])
+        next-line-counts
+      ))))
+
+(->> location-dump-data
+     (take 50)
+     (partition-by first)
+     (map (fn [lst] [(first (first lst)) (map rest lst)]))
+     (map process-dump-file)
+     pprint
+     )


No wait, this *is* bilinear interpolation...

--- src/bru_3/geometry/distortion.clj
+++ src/bru_3/geometry/distortion.clj
@@ -7,8 +7,6 @@
   axes."
   [xres yres]
   (vec (for [x (range xres)] (vec (for [y (range yres)] (v/randvec2))))))
-
-;; TODO: Implement proper bilinear interpolation.

 (defn vec-at
   "Returns the (normalized) interpolated Vec2 from a given vector field vf at


Badge import fix

Badge import fix

--- src/clj/salava/badge/importer.clj
+++ src/clj/salava/badge/importer.clj
@@ -49,17 +49,21 @@
     [{:error "badge/Invalidassertion"} nil]))

 (defn- add-assertion-and-key [badge]
-  (let [badge-type (get-badge-type badge)
-        [assertion assertion-key] (get-assertion-and-key badge-type badge)
-        old-assertion (:assertion badge)]
-    (assoc badge :assertion (a/create-assertion assertion old-assertion)
-                 :assertion_key assertion-key)))
+  (try
+    (let [badge-type (get-badge-type badge)
+          [assertion assertion-key] (get-assertion-and-key badge-type badge)
+          old-assertion (:assertion badge)]
+      (assoc badge :assertion (a/create-assertion assertion old-assertion)
+             :assertion_key assertion-key))
+    (catch Throwable ex
+      (log/error "add-assertion-and-key: failed to get assertion")
+      (log/error (.toString ex)))))

 (defn- collect-badges
   "Collect badges fetched from groups"
   [badge-colls]
   (let [badges (flatten badge-colls)]
-    (map add-assertion-and-key badges)))
+    (filter #(not (nil? %)) (pmap add-assertion-and-key badges))))

 (defn- fetch-badges-by-group
   "Get badges from public group in Backpack"


Focus console on page load. Fixes #135.

Focus console on page load. Fixes #135.

--- src/cljs/cljs_repl_web/views.cljs
+++ src/cljs/cljs_repl_web/views.cljs
@@ -29,7 +29,8 @@
    (fn []
      (let [jqconsole (cljs/cljs-console! console-opts)]
        (dispatch [:add-console :cljs-console jqconsole])
-       (cljs/cljs-console-prompt! jqconsole)))))
+       (cljs/cljs-console-prompt! jqconsole)
+       (console/focus-console! jqconsole)))))

 (defn cljs-console-render []
   [:div.cljs-console.console])


Setup responsive of footer and cljs-buttons components.

--- src/cljs/cljs_repl_web/views.cljs
+++ src/cljs/cljs_repl_web/views.cljs
@@ -178,33 +178,39 @@
    To place them in a layout, call the function (it does not return a
    component)."
   []
-  (let [console-created? (subscribe [:console-created? :cljs-console])
+  (let [media-query (subscribe [:media-query-size])
+        console-created? (subscribe [:console-created? :cljs-console])
         example-mode? (subscribe [:example-mode? :cljs-console])]
     (fn cljs-buttons-form2 []
-      [v-box
-       :gap "8px"
-       :children [[md-icon-button
-                   :md-icon-name "zmdi-delete"
-                   :on-click #(dispatch [:reset-console :cljs-console])
-                   :class "cljs-btn"
-                   :tooltip "Reset"
-                   :tooltip-position :left-center
-                   :disabled? (not @console-created?)]
-                  [md-icon-button
-                   :md-icon-name "zmdi-format-clear-all"
-                   :on-click #(dispatch [:clear-console :cljs-console])
-                   :class "cljs-btn"
-                   :tooltip "Clear"
-                   :tooltip-position :left-center
-                   :disabled? (not @console-created?)]
-                  [gist-login-dialog]
-                  [md-icon-button
-                   :md-icon-name "zmdi-stop"
-                   :on-click #(dispatch [:exit-interactive-examples :cljs-console])
-                   :class "cljs-btn"
-                   :tooltip "Stop interactive example mode"
-                   :tooltip-position :below-center
-                   :disabled? (not @example-mode?)]]])))
+      (let [children [[md-icon-button
+                       :md-icon-name "zmdi-delete"
+                       :on-click #(dispatch [:reset-console :cljs-console])
+                       :class "cljs-btn"
+                       :tooltip "Reset"
+                       :tooltip-position :left-center
+                       :disabled? (not @console-created?)]
+                      [md-icon-button
+                       :md-icon-name "zmdi-format-clear-all"
+                       :on-click #(dispatch [:clear-console :cljs-console])
+                       :class "cljs-btn"
+                       :tooltip "Clear"
+                       :tooltip-position :left-center
+                       :disabled? (not @console-created?)]
+                      [gist-login-dialog]
+                      [md-icon-button
+                       :md-icon-name "zmdi-stop"
+                       :on-click #(dispatch [:exit-interactive-examples :cljs-console])
+                       :class "cljs-btn"
+                       :tooltip "Stop interactive example mode"
+                       :tooltip-position :below-center
+                       :disabled? (not @example-mode?)]]]
+        (if-not (= :narrow @media-query)
+          [v-box
+           :gap "8px"
+           :children children]
+          [h-box
+           :gap "8px"
+           :children children])))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;  API panel section  ;;;
@@ -575,13 +581,22 @@
    :children [[api-panel (:sections api-utils/custom-api-map)]]])

 (defn repl-component []
-  [h-box
-   :class "app-main"
-   :size "1 1 auto"
-   :justify :center
-   :gap "10px"
-   :children [[cljs-buttons]
-              [box
-               :size "1"
-               :style {:overflow "hidden"}
-               :child [cljs-console-component]]]])
+  (let [media-query (subscribe [:media-query-size])]
+    (fn repl-component-form2 []
+      (let [children [[cljs-buttons]
+                      [box
+                       :size "0 0 auto"
+                       :style {:overflow "hidden"}
+                       :child [cljs-console-component]]]]
+        (if (= :narrow @media-query)
+          [v-box
+           :size "1 1 auto"
+           :align :center
+           :gap "10px"
+           :children children]
+          [h-box
+           :size "1 1 auto"
+           :justify :center
+           :gap "10px"
+           :children children])) ))
+  )


refactor turn

refactor turn

--- src/cljs/triboard/logic/turn.cljs
+++ src/cljs/triboard/logic/turn.cljs
@@ -25,10 +25,8 @@
   [{:keys [board player] :as turn}]
   (let [transitions (transition/all-transitions board)
         next-player (first (who-can-play player transitions))]
-    (-> turn
-      (assoc :transitions (get transitions next-player))
-      (assoc :player next-player)
-      )))
+    (merge turn
+      {:transitions (get transitions next-player) :player next-player})))

 ;; -----------------------------------------


Trim whitespace on the left before auto-indentation

--- src/clojure/nightcode/editors.clj
+++ src/clojure/nightcode/editors.clj
@@ -324,7 +324,7 @@
       [(update lines
                cursor-line
                (fn [line]
-                 (str (str/join (repeat indent-level " ")) line)))
+                 (str (str/join (repeat indent-level " ")) (str/triml line))))
        (+ (:cursor-position state) indent-level)])
     [lines (:cursor-position state)]))