clean up server

clean up server

--- src/tabby/server.clj
+++ src/tabby/server.clj
@@ -1,11 +1,11 @@
 (ns tabby.server
   (:require [tabby.utils :as utils]
-            [tabby.log :refer :all]
+            [tabby.log :as log]
             [tabby.client-state :as cs]
-            [tabby.leader :refer :all]
-            [tabby.follower :refer :all]
-            [clojure.tools.logging :refer :all]
-            [tabby.candidate :refer :all]))
+            [tabby.leader :as l]
+            [tabby.follower :as f]
+            [clojure.tools.logging :refer [warn info]]
+            [tabby.candidate :as c]))

 ;;; Utility Functions
 (defn packet-count
@@ -24,8 +24,8 @@
             (and (= :candidate (:type state))
                  (= :append-entries (:type params))
                  (<= (:current-term state) (:term body))))
-      (become-follower (assoc state :current-term (:term body))
-                       (:leader-id body))
+      (f/become-follower (assoc state :current-term (:term body))
+                         (:leader-id body))
       (if (:leader-id body)
         (assoc state :leader-id (:leader-id body))
         state))))
@@ -33,7 +33,7 @@
 (defn- apply-commit-index [state]
   (if (> (:commit-index state) (:last-applied state))
     (-> (update state :last-applied inc)
-        (update :db #(apply-entry state %)))
+        (update :db #(log/apply-entry state %)))
     state))

 (defn- redirect-to-leader [state p]
@@ -52,9 +52,9 @@

 (defn- handle-set [state p]
   (cs/add-write
-   (write state {:key (:key p)
-                 :value (:value p)
-                 :op :set})
+   (l/write state {:key (:key p)
+                   :value (:value p)
+                   :op :set})
    p))

 (defn- handle-cas [state p]
@@ -62,29 +62,30 @@

 (defn handle-append-entries-response [state p]
   (if (pos? (get-in p [:body :count])) ; heart beat response
-    (check-and-update-append-entries state p)
+    (l/check-and-update-append-entries state p)
     (update state :clients cs/inc-heartbeats (:src p))))

 (defn client-read
   [state pkt]
   (let [[s response] (cs/add-read state pkt)]
     (if (= :broadcast-heart-beat response)
-      (broadcast-heartbeat s)
+      (l/broadcast-heartbeat s)
       (utils/transmit s response))))

 (defn- handle-get [state p]
   (client-read state p))

-(defn- handle-packet [state]
+(defn- handle-packet
+  [state]
   (let [p (first (:rx-queue state))
         s (check-term state p)]
     (condp = (:type p)
       :get (handle handle-get s p)
       :set (handle handle-set s p)
       :cas (handle handle-cas s p)
-      :request-vote (handle-request-vote s p)
-      :request-vote-reply (handle-request-vote-response s p)
-      :append-entries (handle-append-entries s p)
+      :request-vote (f/handle-request-vote s p)
+      :request-vote-reply (c/handle-request-vote-response s p)
+      :append-entries (f/handle-append-entries s p)
       :append-entries-response (handle-append-entries-response s p))))

 (defn- process-rx-packets [state]
@@ -97,9 +98,9 @@
   (->
    (update state :election-timeout - dt)
    (apply-commit-index)
-   (utils/if-not-leader? check-election-timeout)
+   (utils/if-not-leader? f/check-election-timeout)
    (process-rx-packets)
-   (utils/if-leader? check-backlog dt)
+   (utils/if-leader? l/check-backlog dt)
    (utils/if-leader? cs/check-clients)))

 (defn set-peers [state peers]


changed a comment in the actual code.

changed a comment in the actual code.

--- hr/nonvisualstudio/clojure/algorithms/warmup/Implementation/FilesThatActuallyRan/diagonal-difference.clj
+++ hr/nonvisualstudio/clojure/algorithms/warmup/Implementation/FilesThatActuallyRan/diagonal-difference.clj
@@ -13,7 +13,7 @@
   [seqToSum]
   (reduce + seqToSum))

-;;io algo
+;;meat of the algo

 (defn get-diagonal-numbers
   [vectorOfVectors]


filling in cljs tests

filling in cljs tests

--- test/deferst/system_test.cljc
+++ test/deferst/system_test.cljc
@@ -20,24 +20,26 @@

 (deftest empty-system
   (let [sb (s/system-builder [])
-        sys (s/start-system! sb {:foo 10})]
+        sys (s/start-system! sb {:foo 10})
+        sysmap (s/system-map sys)
+        x-sysmap {:foo 10}]

     (testing "null system contains config"
-      #?(:clj (is (= (first @sys) {:foo 10}))
-
-         :cljs
-         (t/async
-          done
-          (p/then
-           sys
+      #?(:clj (is (= @sysmap x-sysmap))
+
+         :cljs
+         (t/async
+          done
+          (p/then
+           sysmap
            (fn [v]
-             (t/is (= (first v) {:foo 10}))
+             (t/is (= v x-sysmap))
              (done))))))))

 (deftest empty-system-stops
   (let [sb (s/system-builder [])
         sys (s/start-system! sb {:foo 10})
-        _ (s/stop-system! sys)]
+        stop-sys (s/stop-system! sys)]

     (testing "null system has no managed objects"
       #?(:clj
@@ -60,66 +62,130 @@
         ff (fn [v] [v (fn [] (swap! destructor-vals conj v))])
         sb (s/system-builder [[:a ff {:a-arg [:foo]}]])
         sys (s/start-system! sb {:foo 10})
-        _ (s/stop-system! sys)]
+        sysmap (s/system-map sys)
+        stop-sys (s/stop-system! sys)
+
+        x-sysmap {:foo 10 :a {:a-arg 10}}
+        x-dvals [{:a-arg 10}]]

     (testing "single item system has the single object"
-      (is (= @(s/system-map sys)
-             {:foo 10
-              :a {:a-arg 10}})))
+      #?(:clj
+         (do
+           @stop-sys
+           (is (= @sysmap
+                  x-sysmap)))
+
+         :cljs
+         (t/async
+          done
+          (p/then
+           sysmap
+           (fn [v] (is (= v x-sysmap))
+             (done))))))

     (testing "single item was destroyed"
-      (is (= @destructor-vals
-             [{:a-arg 10}])))))
+      #?(:clj
+         (is (= @destructor-vals
+                x-dvals))
+         :cljs
+         (t/async
+          done
+          (p/then
+           stop-sys
+           (fn [_] (is (= @destructor-vals x-dvals))
+             (done))))))))

 (deftest single-item-system-with-vector-arg-specs
   (let [destructor-vals (atom [])
         ff (fn [v] [v (fn [] (swap! destructor-vals conj v))])
         sb (s/system-builder [[:a ff [:foo]]])
-        sys (s/start-system! sb {:foo 10})]
+        sys (s/start-system! sb {:foo 10})
+        smap (s/system-map sys)
+        stop-sys (s/stop-system! sys)
+        x-sysmap {:foo 10 :a 10}
+        x-dvals [10]]

     (testing "single item system has the single object"
-      (is (= @(s/system-map sys)
-             {:foo 10
-              :a 10})))
+      #?(:clj
+         (is (= @smap
+                x-sysmap))
+
+         :cljs
+         (t/async
+          done
+          (p/then
+           smap
+           (fn [v] (= v x-sysmap)
+             (done))))))

     (testing "single item was destroyed"
-      @(s/stop-system! sys)
-      (is (= @destructor-vals
-             [10])))))
+      #?(:clj
+         (do
+           @stop-sys
+           (is (= @destructor-vals
+                  x-dvals)))
+
+         :cljs
+         (t/async
+          done
+          (p/then
+           stop-sys
+           (fn [_] (is (= @destructor-vals x-dvals))
+             (done))))))))

 (deftest bad-arg-specs-throw
   (let [destructor-vals (atom [])
         ff (fn [v] [v (fn [] (swap! destructor-vals conj v))])]

     (testing "an error is thrown describing the bad arg specs"
-      (is (thrown? clojure.lang.ExceptionInfo
-                   (s/system-builder [[:a ff :foo]])
-                   ;; arg-specs throws on toposort now
-                   ;;@(s/start-system! sb {:foo 10})
-                   )))))
+      (is (thrown? #?(:clj clojure.lang.ExceptionInfo :cljs :default)
+                   (s/system-builder [[:a ff :foo]]))))))

 (deftest single-item-system-without-destructors
   (let [sb (s/system-builder [[:a identity {:a-arg [:foo]}]])
         sys (s/start-system! sb {:foo 10})
-        _ (s/stop-system! sys)]
+        sysmap (s/system-map sys)
+        stop-sys (s/stop-system! sys)
+        x-sysmap {:foo 10
+                :a {:a-arg 10}}]

     (testing "single item system has the single object"
-      (is (= @(s/system-map sys)
-             {:foo 10
-              :a {:a-arg 10}})))))
+      #?(:clj
+         (is (= @sysmap x-sysmap))
+
+         :cljs
+         (t/async
+          done
+          (p/then
+           sysmap
+           (fn [v] (is (= v x-sysmap))
+             (done))))))))

 (deftest single-deferred-item-system
   (let [destructor-vals (atom [])
-        ff (fn [v] (d/success-deferred
-                    [v (fn [] (swap! destructor-vals conj v))]))
+
+        ff (fn [v]
+             (let [obj-destr [v (fn [] (swap! destructor-vals conj v))]]
+               #?(:clj (d/success-deferred obj-destr)
+                  :cljs (p/promise obj-destr))))
         sb (s/system-builder [[:a ff {:a-arg [:foo]}]])
         sys (s/start-system! sb {:foo 10})
-        _ (s/stop-system! sys)]
+        sysmap (s/system-map sys)
+        stop-sys (s/stop-system! sys)
+        x-sysmap {:foo 10 :a {:a-arg 10}}]

     (testing "single item system has the single object"
-      (is (= @(s/system-map sys)
-             {:foo 10
-              :a {:a-arg 10}})))))
+      #?(:clj
+         (is (= @sysmap x-sysmap))
+
+         :cljs
+         (t/async
+          done
+          (p/then
+           sysmap
+           (fn [v] (is (= v x-sysmap))
+             (done))))
+         ))))

 (deftest dependent-item-system
@@ -128,18 +194,34 @@
         sb (s/system-builder [[:a ff {:a-arg [:foo]}]
                               [:b ff {:b-arg [:a :a-arg]}]])
         sys (s/start-system! sb {:foo 10})
-        _ (s/stop-system! sys)]
+        sysmap (s/system-map sys)
+        stop-sys (s/stop-system! sys)
+        x-sysmap {:foo 10 :a {:a-arg 10} :b {:b-arg 10}}
+        x-dvals [{:b-arg 10} {:a-arg 10}]]

     (testing "dependent items are created"
-      (is (= @(s/system-map sys)
-             {:foo 10
-              :a {:a-arg 10}
-              :b {:b-arg 10}})))
+      #?(:clj
+         (is (= @sysmap x-sysmap))
+
+         :cljs
+         (t/async
+          done
+          (p/then
+           sysmap
+           (fn [v] (is (= v x-sysmap))
+             (done))))))

     (testing "dependent items were destroyed"
-      (is (= @destructor-vals
-             [{:b-arg 10}
-              {:a-arg 10}])))))
+      #?(:clj
+         (is (= @destructor-vals x-dvals))
+
+         :cljs
+         (t/async
+          done
+          (p/then
+           stop-sys
+           (fn [v] (is (= @destructor-vals x-dvals))
+             (done))))))))

 (deftest dependent-item-system-specified-out-of-order
   (let [destructor-vals (atom [])
@@ -147,26 +229,30 @@
         sb (s/system-builder [[:b ff {:b-arg [:a :a-arg]}]
                               [:a ff {:a-arg [:foo]}]])
         sys (s/start-system! sb {:foo 10})
-        _ (s/stop-system! sys)]
+        sysmap (s/system-map sys)
+        stop-sys (s/stop-system! sys)]

     (testing "dependent items are created"
-      (is (= @(s/system-map sys)
-             {:foo 10
-              :a {:a-arg 10}
-              :b {:b-arg 10}})))
+      #?(:clj
+         (is (= @(s/system-map sys)
+                {:foo 10
+                 :a {:a-arg 10}
+                 :b {:b-arg 10}}))))

     (testing "dependent items were destroyed"
-      (is (= @destructor-vals
-             [{:b-arg 10}
-              {:a-arg 10}])))))
+      #?(:clj
+         (is (= @destructor-vals
+                [{:b-arg 10}
+                 {:a-arg 10}]))))))

 (deftest dependent-item-system-with-circular-deps
   (let [ff (fn [v] v)]
-    (is (thrown-with-msg?
-         clojure.lang.ExceptionInfo
-         #"circular dependency"
-         (s/system-builder [[:a ff {:a-arg [:b :b-arg]}]
-                            [:b ff {:b-arg [:a :a-arg]}]])))))
+    #?(:clj
+       (is (thrown-with-msg?
+            clojure.lang.ExceptionInfo
+            #"circular dependency"
+            (s/system-builder [[:a ff {:a-arg [:b :b-arg]}]
+                               [:b ff {:b-arg [:a :a-arg]}]]))))))

 (deftest dependent-item-system-with-vector-arg-specs
   (let [destructor-vals (atom [])
@@ -174,18 +260,21 @@
         sb (s/system-builder [[:a ff [:foo]]
                               [:b ff {:b-arg [:a]}]])
         sys (s/start-system! sb {:foo 10})
-        _ (s/stop-system! sys)]
+        sysmap (s/system-map sys)
+        stop-sys (s/stop-system! sys)]

     (testing "dependent items are created"
-      (is (= @(s/system-map sys)
-             {:foo 10
-              :a 10
-              :b {:b-arg 10}})))
+      #?(:clj
+         (is (= @(s/system-map sys)
+                {:foo 10
+                 :a 10
+                 :b {:b-arg 10}}))))

     (testing "dependent items were destroyed"
-      (is (= @destructor-vals
-             [{:b-arg 10}
-              10])))))
+      #?(:clj
+         (is (= @destructor-vals
+                [{:b-arg 10}
+                 10]))))))

 (deftest dependent-item-system-with-mixed-destructors
   (let [destructor-vals (atom [])
@@ -193,17 +282,20 @@
         sb (s/system-builder [[:a identity {:a-arg [:foo]}]
                               [:b ff {:b-arg [:a :a-arg]}]])
         sys (s/start-system! sb {:foo 10})
-        _ (s/stop-system! sys)]
+        sysmap (s/system-map sys)
+        stop-sys (s/stop-system! sys)]

     (testing "dependent items are created"
-      (is (= @(s/system-map sys)
-             {:foo 10
-              :a {:a-arg 10}
-              :b {:b-arg 10}})))
+      #?(:clj
+         (is (= @(s/system-map sys)
+                {:foo 10
+                 :a {:a-arg 10}
+                 :b {:b-arg 10}}))))

     (testing "dependent items were destroyed"
-      (is (= @destructor-vals
-             [{:b-arg 10}])))))
+      #?(:clj
+         (is (= @destructor-vals
+                [{:b-arg 10}]))))))

 (deftest composed-builders
   (let [destructor-vals (atom [])
@@ -213,20 +305,24 @@
         sb2 (s/system-builder sb [[:c ff {:c-a [:a :a-arg]
                                           :c-b [:b :b-arg]}]])
         sys (s/start-system! sb2 {:foo 10})
-        ]
+        sysmap (s/system-map sys)
+        stop-sys (s/stop-system! sys)]

     (testing "items are created"
-      (is (= @(s/system-map sys)
-             {:foo 10
-              :a {:a-arg 10}
-              :b {:b-arg 10}
-              :c {:c-a 10 :c-b 10}})))
+      #?(:clj
+         (is (= @(s/system-map sys)
+                {:foo 10
+                 :a {:a-arg 10}
+                 :b {:b-arg 10}
+                 :c {:c-a 10 :c-b 10}}))))

     (testing "items were destroyed"
-      @(s/stop-system! sys)
-      (is (= @destructor-vals
-             [{:c-a 10 :c-b 10}
-              {:a-arg 10}])))))
+      #?(:clj
+         (do
+           @stop-sys
+           (is (= @destructor-vals
+                  [{:c-a 10 :c-b 10}
+                   {:a-arg 10}])))))))

 (deftest unwind-on-builder-error
   (let [destructor-vals (atom [])
@@ -236,8 +332,10 @@
                               [:b boom {:b-arg [:a :a-arg]}]])
         sys (s/start-system! sb {:foo 10})]
     (testing "system is unwound"
-      (is (= @destructor-vals [{:a-arg 10}]))
-      (is (thrown-with-msg?
-           clojure.lang.ExceptionInfo
-           #"start-system! failed and unwound"
-           @sys)))))
+      #?(:clj
+         (do
+           (is (= @destructor-vals [{:a-arg 10}]))
+           (is (thrown-with-msg?
+                clojure.lang.ExceptionInfo
+                #"start-system! failed and unwound"
+                @sys)))))))


make a couple of cljs tests work

make a couple of cljs tests work

--- test/deferst/system_test.cljc
+++ test/deferst/system_test.cljc
@@ -15,15 +15,24 @@
    [deferst.system :as s]))

 ;; check schemas
-(use-fixtures :once schema.test/validate-schemas)
+#?(:clj
+   (use-fixtures :once schema.test/validate-schemas))

 (deftest empty-system
   (let [sb (s/system-builder [])
         sys (s/start-system! sb {:foo 10})]

     (testing "null system contains config"
-      (is (= @(s/system-map sys)
-             {:foo 10})))))
+      #?(:clj (is (= (first @sys) {:foo 10}))
+
+         :cljs
+         (t/async
+          done
+          (p/then
+           sys
+           (fn [v]
+             (t/is (= (first v) {:foo 10}))
+             (done))))))))

 (deftest empty-system-stops
   (let [sb (s/system-builder [])
@@ -31,8 +40,20 @@
         _ (s/stop-system! sys)]

     (testing "null system has no managed objects"
-      (is (= (-> sys deref last :s/system empty?)
-             true)))))
+      #?(:clj
+         (do
+           (is (contains? (-> sys deref last) :deferst.system/system))
+           (is (empty? (-> sys deref last :deferst.system/system))))
+
+         :cljs
+         (t/async
+          done
+          (p/then
+           sys
+           (fn [v]
+             (is (contains? (-> v last) :deferst.system/system))
+             (is (empty? (-> v last :deferst.system/system)))
+             (done))))))))

 (deftest single-item-system
   (let [destructor-vals (atom [])


Don't catch oauth url in the UI router

Don't catch oauth url in the UI router

--- priv/ui/src/cljs/holiday_ping_ui/auth/views.cljs
+++ priv/ui/src/cljs/holiday_ping_ui/auth/views.cljs
@@ -15,7 +15,8 @@
      [:div.card-content
       [:div.has-text-centered
        [:a.button.is-medium.is-primary.is-fullwidth
-        {:href "/oauth/github"}
+        {:data-pushy-ignore true ;; don't try to hadle this uri in the frontend
+         :href              "/oauth/github"}
         [:span.icon.is-medium [:i.fa.fa-github]]
         [:span " Login with GitHub"]]]
       [:hr]


Working authrorization rules

Working authrorization rules

--- src/otaservice/handler.clj
+++ src/otaservice/handler.clj
@@ -1,15 +1,37 @@
 (ns otaservice.handler
-  (:require #_[compojure.core :refer :all]
-            [compojure.route :as route]
+  (:require [compojure.route :as route]
             [ring.util.response :as r]
             [ring.util.http-response :as rh]
             [clojure.java.io :as io]
             [compojure.api.sweet :as sw]
+            [compojure.api.meta :refer [restructure-param]]
             [schema.core :as s]
+            [buddy.auth.accessrules :refer [wrap-access-rules]]
             [buddy.auth.backends :as backends]
-            [buddy.auth.middleware :refer [wrap-authentication]]
+            [buddy.auth.middleware :refer [wrap-authentication wrap-authorization]]
             [buddy.sign.jwt :as jwt]
-            [ring.middleware.defaults :refer [wrap-defaults api-defaults]]))
+            [ring.middleware.defaults :refer [wrap-defaults api-defaults]]
+            [otaservice.tools :as t])
+  (:import (java.io File)))
+
+(defn authenticated-user
+  "Check if there is any identity with request"
+  [request]
+  (t/not-nil? (:identity request)))
+
+(defn access-error
+  [req val]
+  (rh/forbidden {:reason "No access rights to this resource"}))
+
+(defn wrap-rule [handler rule]
+  (-> handler
+      (wrap-access-rules {:rules [{:pattern #".*"
+                                   :handler rule}]
+                          :on-error access-error})))
+
+(defmethod restructure-param :auth-rules
+  [_ rule acc]
+  (update-in acc [:middleware] conj [wrap-rule rule]))

 (def secret "lolsecretjk")
 (def backend (backends/jws {:secret secret}))
@@ -25,9 +47,9 @@

 (defn login-handler [request]
   (if-let [user (find-user (:username request)
-                        (:password request))]
+                           (:password request))]
     (rh/ok {:token (jwt/sign {:user (:id user)} secret)})
-    (rh/forbidden {:reason "Wrong credentials"})))
+    (rh/unauthorized {:reason "Wrong credentials"})))

 (defn ota-update
   "Performs OTA update for ESP8266"
@@ -41,36 +63,38 @@

 (def rest-api
   (sw/api
-   {:swagger {:ui "/"
+   {:swagger {:ui "/api"
               :spec "/swagger.json"
               :data {:info {:title "OTA Service"
                             :description "ESP8266 OTA Updates service"}
+                     :securityDefinitions {:api_key {:type "apiKey"
+                                                     :name "Authorization"
+                                                     :in "header"}}
                      :tags [{:name "api1" :description "first generation api"}]}}}
    (sw/context "/api/v1" []
-            :tags ["api1"]
+               :tags ["api1"]

-            (sw/POST "/login" []
-                     :body [creds Credentials]
-                     :responses {403 {:schema {:reason s/Str}
-                                      :description "No user with this login & pass found."}}
-                     :return {:token s/Str}
-                     :summary "authorize and receive jwt token"
-                     (login-handler creds))
+               (sw/POST "/login" []
+                        :body [creds Credentials]
+                        :responses {401 {:schema {:reason s/Str}
+                                         :description "No user with this login & pass found."}}
+                        :return {:token s/Str}
+                        :summary "authorize and receive jwt token"
+                        (login-handler creds))

-            (sw/GET "/plus" []
-                 :return Long
-                 :query-params [x :- Long, y :- Long]
-                 :summary "Adds two numbers together"
-                 (rh/ok (+ x y)))
-
-            (sw/GET "/update" request
-                 :summary "Performs OTA update for ESP8266"
-                 (ota-update request)))))
-
-#_(defroutes app-routes
-    (GET "/" [] "Hello World")
-    (GET "/update" request (ota-update request))
-    (route/not-found "Not Found"))
+               (sw/GET "/plus" []
+                       :return Long
+                       :query-params [x :- Long, y :- Long]
+                       :auth-rules authenticated-user
+                       :summary "Adds two numbers together"
+                       (rh/ok (+ x y)))
+
+               (sw/GET "/update" request
+                       :summary "Performs OTA update for ESP8266"
+                       :return File
+                       (ota-update request)))))

 (def app
-  (wrap-authentication (wrap-defaults rest-api api-defaults) backend))
+  (-> rest-api
+      (wrap-authorization backend)
+      (wrap-authentication backend)))


fix bug in snare drum inst

fix bug in snare drum inst

--- src/overtone/inst/drum.clj
+++ src/overtone/inst/drum.clj
@@ -70,7 +70,7 @@
         filtered (* (env-gen (perc 0.005 sustain) :action FREE)
                     (brf filtered 2000 0.0001))
         crackle (* (resonz filtered tightness) crackle-amp)]
-    (* amp (* (+ drum crackle)))))
+    (* amp (+ drum crackle))))

 (definst snare2 [amp 0.5 decay 0.1 freq 1000]
   (let [env (env-gen (perc 0 decay) :action FREE)


expose optional 'args' parameter to the defsample macro

--- src/overtone/sc/sample.clj
+++ src/overtone/sc/sample.clj
@@ -126,5 +126,5 @@

 (defmethod buffer-id ::sample [sample] (:id sample))

-(defmacro defsample [s-name path]
-  `(def ~s-name (sample ~path)))
+(defmacro defsample [s-name path & args]
+  `(def ~s-name (sample ~path ~@args)))


Create mini-ships-texture ahead of time, obvious refactor :)

--- desktop/src-common/ds3/hud.clj
+++ desktop/src-common/ds3/hud.clj
@@ -21,6 +21,8 @@
 (def ^:const high-score-label-x (/ 472.0 2.0)) ;(* 3 224)
 (def ^:const high-score-x (/ 472.0 2.0))

+(def mini-ships-texture (atom nil))
+
 (defscreen hud-screen
   :on-show
   (fn [screen entities]
@@ -32,7 +34,8 @@
                           :high-score 0
                           :render? false
                           :game-state :attract-mode
-                          :font (bitmap-font "arcade20.fnt"))]
+                          :font (bitmap-font "arcade20.fnt"))
+          _ (reset! mini-ships-texture (ds3.ship/create-pixel-ship-texture (Integer/MAX_VALUE)))]
       entities))

   :on-render
@@ -75,14 +78,12 @@
            (count-mini-ships screen)
            (render! screen))))

-  ;Called by the main_screen, passing in :score
+                                        ;Called by the main_screen, passing in :score
   :on-update-score
   (fn [screen entities]
     (let [score (:p1-score screen)
           high-score (:high-score screen)]
-      (update! screen :p1-score score :high-score high-score)
-      ;(prn :score score)
-      )
+      (update! screen :p1-score score :high-score high-score))
     nil)

   :on-update-lives
@@ -117,10 +118,10 @@
 (defn add-mini-ships [n entities]
   (let [ships (for [ship (range n)
                     :let [x (- 600 (* ship 32))]]
-                (assoc (ds3.ship/create-pixel-ship-texture (Integer/MAX_VALUE))
-                  :width 32 :height 32
-                  :x x :y 5
-                  :id :pixel-ship :mini-ship? true))]
+                (assoc @mini-ships-texture
+                       :width 32 :height 32
+                       :x x :y 5
+                       :id :pixel-ship :mini-ship? true))]
     (flatten (conj entities ships))))

 (defn pad-score [score]


Pass vcs-type to branch breadcrumb

Pass vcs-type to branch breadcrumb

--- src-cljs/frontend/controllers/navigation.cljs
+++ src-cljs/frontend/controllers/navigation.cljs
@@ -285,7 +285,8 @@
                                    {:type :project-branch
                                     :username org
                                     :branch branch
-                                    :project repo}])))
+                                    :project repo
+                                    :vcs_type vcs_type}])))

 (defmethod post-navigated-to! :project-insights
   [history-imp navigation-point args previous-state current-state]


Simply go loop

Simply go loop

--- src-shared/cljs/cljs_webrepl/repl_thread.cljs
+++ src-shared/cljs/cljs_webrepl/repl_thread.cljs
@@ -27,6 +27,12 @@
   (let [msg (t/write writer msg)]
     (debugf "Serialized: %s %s" (worker-type) msg)
     (js-obj "msg" msg)))
+
+(defn post-message [target writer msg]
+  (try
+    (.postMessage target (serialize writer msg))
+    (catch js/Error e
+      (.postMessage target (serialize writer [:webworker/error nil (str e)])))))

 (defn- async-worker [& [target close-fn]]
   (let [is-worker? (not (some? target))
@@ -62,10 +68,7 @@
     (go
       (loop []
         (when-let [msg (<! input-ch)]
-          (try
-            (.postMessage target (serialize writer msg))
-            (catch js/Error e
-              (.postMessage target (serialize writer [:webworker/error nil (str e)]))))
+          (post-msg target writer msg)
           (recur)))
       (finally-fn))
     {:input-ch  input-ch


Index outputs a list of all locations

Index outputs a list of all locations

-> is broken because umlauts got fucked up when importing into DB

--- src/barmap/web.clj
+++ src/barmap/web.clj
@@ -1,7 +1,8 @@
 (ns barmap.web
   (:use [compojure.core]
         [ring.util.response]
-        [ring.middleware.format-response])
+        [ring.middleware.format-response]
+        [hiccup.core])
   (:require
     [compojure.handler :as handler]
     [compojure.route :as route]
@@ -13,7 +14,8 @@
     [ring.middleware.basic-authentication :as basic]
     [cemerick.drawbridge :as drawbridge]
     [barmap.controllers.api :as apiController]
-    [environ.core :refer [env]]))
+    [environ.core :refer [env]]
+    [barmap.model.places :as places]))

 (defn- authenticated? [user pass]
   ;; TODO: heroku config:add REPL_USER=[...] REPL_PASSWORD=[...]
@@ -35,14 +37,17 @@

 (defroutes app
            apiController/routes
-          (ANY "/repl" {:as req}
+           (ANY "/repl" {:as req}
                 (drawbridge req))
            (GET "/" []
-                {:status  200
-                 :headers {"Content-Type" "text/plain"}
-                 :body    (pr-str ["Hello" :from 'Heroku])})
+                (html
+                  [:html5
+                   [:body [:div#content
+                           [:ul#locationList
+                            (for [bar (places/all)]
+                              [:li (:name bar)])]]]]))
            (ANY "*" []
-                (route/not-found (slurp (io/resource "404.html")))) )
+                (route/not-found (slurp (io/resource "404.html")))))

 (defn wrap-app [app]
   ;; TODO: heroku config:add SESSION_SECRET=$RANDOM_16_CHARS
@@ -52,7 +57,7 @@
            wrap-error-page
            trace/wrap-stacktrace))
         (wrap-restful-response)
-          (handler/site {:session {:store store}}))))
+        (handler/site {:session {:store store}}))))

 (defn -main [& [port]]
   (let [port (Integer. (or port (env :port) 5000))]


migrating instance-desc to amazonica

migrating instance-desc to amazonica

--- src/aws/common.clj
+++ src/aws/common.clj
@@ -26,7 +26,7 @@
 (defn instance-desc [endpoint instance-id & ks]
   (->
     (with-ctx ec2/describe-instances {:instance-ids  [instance-id]})
-      first :instances first (get-in ks)))
+      :reservations first :instances first (get-in ks)))

 (defn image-id [machine]
   (hypervisor :aws :ostemplates (machine :os) :ami))


remove exception-throwing in overc: needed for tests

--- src/babel/over.clj
+++ src/babel/over.clj
@@ -208,9 +208,6 @@
 (defn overc [parent comp]
   "add given child as the comp child of the phrase: parent."

-  ;; disabled for now.
-  (throw (Exception. (str "GOT INTO OVERC.")))
-
   (log/debug (str "set? parent:" (set? parent)))
   (log/debug (str "seq? parent:" (seq? parent)))
   (log/debug (str "seq? comp:" (seq? comp)))


out of do

out of do

--- src/cljs/bills_to_beans/bills.cljs
+++ src/cljs/bills_to_beans/bills.cljs
@@ -99,23 +99,23 @@
                      (when (and (validate-all-transactions! bill-data)
                                 (validate-all-balances! bill-data)
                                 (validate-all-notes! bill-data))
-                         (do (go (let [response (<! (req-save))]
-                                   (if (:success response)
-                                     (let [notice [<saved-files-notice>
-                                                   (get-in response [:body :dir_path])
-                                                   (get-in response [:body :saved_paths])
-                                                   (get-in response [:body :saved_sizes])]]
-
-                                       (do (swap! bill-data assoc :documents
-                                                  [{:filename nil :size nil}])
-                                           (swap! bill-data assoc :transactions
-                                                  [{:data @default-transaction :ui {}}])
-                                           (swap! bill-data assoc :balances [])
-                                           (swap! bill-data assoc :notes []))
-
-                                       (flash! response notice))
-                                     (flash! response)
-                                     ))))))
+                       (go (let [response (<! (req-save))]
+                             (if (:success response)
+                               (let [notice [<saved-files-notice>
+                                             (get-in response [:body :dir_path])
+                                             (get-in response [:body :saved_paths])
+                                             (get-in response [:body :saved_sizes])]]
+
+                                 (do (swap! bill-data assoc :documents
+                                            [{:filename nil :size nil}])
+                                     (swap! bill-data assoc :transactions
+                                            [{:data @default-transaction :ui {}}])
+                                     (swap! bill-data assoc :balances [])
+                                     (swap! bill-data assoc :notes []))
+
+                                 (flash! response notice))
+                               (flash! response)
+                               )))))

         add-new-transaction! (fn [_] (swap! bill-data update :transactions
                                             (fn [a]


Accessibility Improvements

Accessibility Improvements

--- src/cljs/salava/user/ui/login.cljs
+++ src/cljs/salava/user/ui/login.cljs
@@ -77,6 +77,7 @@
                                                                                [:div
                                                                                (:modal-content @state)]
                                                                                [:fieldset {:class "col-md-12 checkbox"}
+                                                                                [:legend {:style {:display "none"}} ""]
                                                                                [:div.col-md-12 {:style {:text-align "center"}} [:label
                                                                                [:input {:type     "checkbox"
                                                                                :on-change (fn [e]


added spinner to app

added spinner to app

--- src/clojure/com/gt/metime/main.clj
+++ src/clojure/com/gt/metime/main.clj
@@ -43,6 +43,7 @@
   (reset! listing @listing))                                ; to trigger the update... crappy i know

 (defn stop-timer [task event-chonometer event-linear-layout-view timer-context]
+  (config (find-view event-linear-layout-view ::spinner) :visibility View/GONE)
   (.stop event-chonometer)

   (if (:running @timer-context) (reset! timer-context (apply ->TimerContext [false (- (:base @timer-context) (SystemClock/elapsedRealtime)) (:base @timer-context)])) ())
@@ -51,7 +52,8 @@
                                         (stop-all-timers (:date task)) ; stop other timers only on click
                                         (start-timer task event-chonometer event-linear-layout-view timer-context))))

-(defn start-timer [_ event-chonometer _ timer-context]
+(defn start-timer [_ event-chonometer event-linear-layout-view timer-context]
+  (config (find-view event-linear-layout-view ::spinner) :visibility View/VISIBLE)
   (if (:running @timer-context) () (reset! timer-context (apply ->TimerContext [true (:offset @timer-context) (+ (SystemClock/elapsedRealtime) (:offset @timer-context))])))
   (.setBase event-chonometer (:base @timer-context))

@@ -75,6 +77,7 @@
        [:linear-layout {:id          ::event-ll
                         :id-holder   true
                         :orientation :horizontal}
+        [:progress-bar {:id ::spinner}]
         [:text-view {:id ::event-tv}]
         [:text-view {:id ::goal-tv}]
         [:chronometer {:id ::time-tv}]
@@ -90,10 +93,6 @@

         (.setOnChronometerTickListener event-chonometer (get-chronometer-listener))
         (.setClickable event-linear-layout-view true)
-        (config event-linear-layout-view :on-click (fn [_] (.println System/out "clicked ll")))
-
-        (.println System/out (str "(:name task) = " (:name task)))
-        (.println System/out (str "(:running @timer-context) = " (:running @timer-context)))

         ;mutates the viz
         (config date-text-view :visibility (if (= (:date-index task) 0) View/VISIBLE View/GONE))


set gen-max on json-array gen

set gen-max on json-array gen

--- src/test/clojure/clojure/data/json_gen_test.clj
+++ src/test/clojure/clojure/data/json_gen_test.clj
@@ -19,7 +19,7 @@
                           :array ::json-array
                           :scalar ::json-scalar))

-(s/def ::json-array (s/coll-of ::json-value))
+(s/def ::json-array (s/coll-of ::json-value :gen-max 12))
 (s/def ::json-object (s/map-of string? ::json-value
                                :gen-max 10))


Create mapped-here links for all nodes

Create mapped-here links for all nodes

This is so that e.g. components can express that requirements are
mapped to them.

--- src/custard/parser.clj
+++ src/custard/parser.clj
@@ -72,6 +72,11 @@
                                    (:name parent)))
      :ctx (if (contains? node "kind") node parent)}))

+(defn create-mapped-here-links [node _]
+  {:node (update node "mapped-here"
+                 (fn [mapped-here]
+                   (mapv #(hash-map :name %) mapped-here)))})
+
 (defn build-tree [root data]
   (letfn [(build-node [name-segment data]
             (cond
@@ -91,7 +96,8 @@
       (-> tree
           (process-down normalize-kind nil)
           (process-down inject-name [])
-          (process-down inject-parent nil)))))
+          (process-down inject-parent nil)
+          (process-down create-mapped-here-links nil)))))

 (defn flatten-tree [node]
   (letfn [(collect-step [m node]


Refactor and corrections of repness function

--- src/polismath/clusters.clj
+++ src/polismath/clusters.clj
@@ -295,7 +295,22 @@
     {:votes vote-col}))

+(defn- add-comparitive-stats [in-stats rest-stats]
+  (assoc in-stats
+    :ra (/ (:pa in-stats)
+           (/ (+ 1 (pc/sum :na rest-stats))
+              (+ 2 (pc/sum :ns rest-stats))))
+    :rd (/ (:pd in-stats)
+           (/ (+ 1 (pc/sum :nd rest-stats))
+              (+ 2 (pc/sum :ns rest-stats))))
+    :rat (two-prop-test (:na in-stats) (pc/sum :na rest-stats)
+                        (:ns in-stats) (pc/sum :ns rest-stats))
+    :rdt (two-prop-test (:nd in-stats) (pc/sum :nd rest-stats)
+                        (:ns in-stats) (pc/sum :ns rest-stats))))
+
+
 (defn conv-repness
+  ; output legend: n=#, p=prob, r=rep, t=test, a=agree, d=disagree, s=seen
   [data group-clusters base-clusters]
   {:ids (map :id group-clusters)
    :stats
@@ -304,25 +319,12 @@
        (mapv (comp columns get-matrix (partial rowname-subset data) #(group-members % base-clusters)))
        (apply
          map
-         ; This becomes a function that maps
-         ; legend: n=#, p=prob, r=rep, t=test, a=agree, d=disagree, s=seen
          (fn [& vote-cols-for-groups]
            (->>
              (mapv initial-comment-stats vote-cols-for-groups)
-             (mapv-rest
-               (fn [grp-stats rest-stats]
-                 (assoc grp-stats
-                   :ra (/ (:pa grp-stats)
-                          (/ (+ 1 (pc/sum :na rest-stats))
-                             (+ 2 (pc/sum :ns rest-stats))))
-                   :rd (/ (:pd grp-stats)
-                          (/ (+ 1 (pc/sum :nd rest-stats))
-                             (+ 2 (pc/sum :ns rest-stats))))
-                   :rat (two-prop-test (:na grp-stats)         (:ns grp-stats)
-                                       (pc/sum :na rest-stats) (pc/sum :ns rest-stats))
-                   :rdt (two-prop-test (:nd grp-stats)         (:ns grp-stats)
-                                       (pc/sum :nd rest-stats) (pc/sum :ns rest-stats))
-                   )))))))})
+             (mapv-rest add-comparitive-stats)))))})
+
+

 (defn xy-clusters-to-nmat [clusters]


work on game-of-life

work on game-of-life

--- game-of-life/src/game_of_life/life.clj
+++ game-of-life/src/game_of_life/life.clj
@@ -19,4 +19,162 @@

 (def glider (populate (empty-board 6 6) #{[2 0] [2 1] [2 2] [1 2] [0 1]}) )

-;(pprint glider)
+;;(pprint glider)
+
+;;Example 3-6. Implementation and helpers for indexed-step
+(defn neighbours
+  [[x y]]
+  (for [dx [-1 0 1] dy [-1 0 1] :when (not= 0 dx dy)]
+    [(+ dx x) (+ dy y)]))
+
+(defn count-neighbours
+  [board loc]
+  (count (filter #(get-in board %) (neighbours loc)))) ; will not throw errros
+
+(defn indexed-step
+  "Yields the next state of the board, using indices to determine neighbors,
+  liveness, etc."
+  [board]
+  (let [w (count board)
+        h (count (first board))]
+    (loop [new-board board x 0 y 0]
+      (cond
+        (>= x w) new-board
+        (>= y h) (recur new-board (inc x) 0)
+        :else
+        (let [new-liveness
+              (case (count-neighbours board [x y])
+                2 (get-in board [x y])
+                3 :on
+                nil)]
+          (recur (assoc-in new-board [x y] new-liveness) x (inc y)))))))
+
+;;(-> (iterate indexed-step glider)(nth 8) pprint)
+
+(defn indexed-step2
+  [board]
+  (let [w (count board)
+        h (count (first board))]
+    (reduce
+      (fn [new-board x]
+        (reduce
+          (fn [new-board y]
+            (let [new-liveness
+                   (case (count-neighbours board [x y])
+                     2 (get-in board [x y])
+                     3 :on
+                     nil)]
+              (assoc-in new-board [x y] new-liveness)))
+          new-board (range h)))
+      board (range w))))
+
+
+(defn indexed-step3
+  [board]
+  (let [w (count board)
+        h (count (first board))]
+    (reduce
+      (fn [new-board [x y]]
+        (let [new-liveness
+               (case (count-neighbours board [x y])
+                 2 (get-in board [x y])
+                 3 :on
+                 nil)]
+           (assoc-in new-board [x y] new-liveness)))
+      board (for [x (range h) y (range w)] [x y]))))
+
+(defn window
+  "Returns a lazy sequence of 3-item windows centered
+   around each item of coll, padded as necessary with
+   pad or nil."
+  ([coll] (window nil coll))
+  ([pad coll]
+   (partition 3 1 (concat [pad] coll [pad]))))
+
+(defn cell-block
+  "Creates a sequences of 3x3 windows from a triple of 3 sequences."
+  [[left mid right]]
+  (window (map vector left mid right)))
+
+(defn liveness
+  "Returns the liveness (nil or :on) of the center cell for
+   the next step."
+  [block]
+  (let [[_ [_ center _] _] block]
+    (case (- (count (filter #{:on} (apply concat block)))
+             (if (= :on center) 1 0))
+      2 center
+      3 :on
+      nil)))
+
+(defn- step-row
+  "Yields the next state of the center row."
+  [rows-triple]
+  (vec (map liveness (cell-block rows-triple))))
+
+(defn index-free-step
+  "Yields the next state of the board."
+  [board]
+  (vec (map step-row (window (repeat nil) board))))
+
+(defn step
+ "Yields the next state of the world"
+ [cells]
+ (set (for [[loc n] (frequencies (mapcat neighbours cells))
+            :when (or (= n 3) (and (= n 2) (cells loc)))]
+        loc)))
+
+(defn stepper
+  "Returns a step function for Life-like cell automata.
+   neighbours takes a location and return a sequential collection
+   of locations. survive? and birth? are predicates on the number
+   of living neighbours."
+  [neighbours birth? survive?]
+  (fn [cells]
+    (set (for [[loc n] (frequencies (mapcat neighbours cells))
+               :when (if (cells loc) (survive? n) (birth? n))]
+           loc))))
+
+(defn hex-neighbours
+  [[x y]]
+  (for [dx [-1 0 1] dy (if (zero? dx) [-2 2] [-1 1])]
+    [(+ dx x) (+ dy y)]))
+
+(def hex-step (stepper hex-neighbours #{2} #{3 4}))
+
+(defn rect-stepper
+  "Returns a step function for standard game of life on a (bounded) rectangular
+   board of specified size."
+  [w h]
+  (stepper #(filter (fn [[i j]] (and (< -1 i w) (< -1 j h)))
+                    (neighbours %)) #{2 3} #{3}))
+
+(defn draw
+  [w h step cells]
+  (let [state (atom cells)
+        run (atom true)
+        listener (proxy [java.awt.event.WindowAdapter] []
+                   (windowClosing [_] (reset! run false)))
+        pane
+          (doto (proxy [javax.swing.JPanel] []
+                  (paintComponent [^java.awt.Graphics g]
+                    (let [g (doto ^java.awt.Graphics2D (.create g)
+                              (.setColor java.awt.Color/BLACK)
+                              (.fillRect 0 0 (* w 10) (* h 10))
+                              (.setColor java.awt.Color/WHITE))]
+                      (doseq [[x y] @state]
+                        (.fillRect g (inc (* 10 x)) (inc (* 10 y)) 8 8)))))
+            (.setPreferredSize (java.awt.Dimension. (* 10 w) (* 10 h))))]
+    (doto (javax.swing.JFrame. "Quad Life")
+      (.setContentPane pane)
+      (.addWindowListener listener)
+      .pack
+      (.setVisible true))
+    (future (while @run
+              (Thread/sleep 80)
+              (swap! state step)
+              (.repaint pane)))))
+
+(defn rect-demo []
+  (draw 30 30 (rect-stepper 30 30)
+      #{[15 15] [15 17] [16 16] [15 16]}))


Make equality checking more consistent

Make equality checking more consistent

--- src/reagent/impl/util.cljs
+++ src/reagent/impl/util.cljs
@@ -131,29 +131,31 @@

 (def -not-found (js-obj))

+(defn identical-ish? [x y]
+  (or (keyword-identical? x y)
+      (and (or (symbol? x)
+               (identical? (type x) partial-ifn))
+           (= x y))))
+
 (defn shallow-equal-maps [x y]
-  ;; Compare two maps, using keyword-identical? on all values
+  ;; Compare two maps, using identical-ish? on all values
   (or (identical? x y)
       (and (map? x)
            (map? y)
            (== (count x) (count y))
            (reduce-kv (fn [res k v]
                         (let [yv (get y k -not-found)]
-                          (if (or (keyword-identical? v yv)
-                                  ;; Allow :style maps, symbols
-                                  ;; and reagent/partial
-                                  ;; to be compared properly
+                          (if (or (identical? v yv)
+                                  (identical-ish? v yv)
+                                  ;; Handle :style maps specially
                                   (and (keyword-identical? k :style)
-                                       (shallow-equal-maps v yv))
-                                  (and (or (identical? (type v) partial-ifn)
-                                           (symbol? v))
-                                       (= v yv)))
+                                       (shallow-equal-maps v yv)))
                             res
                             (reduced false))))
                       true x))))

 (defn equal-args [v1 v2]
-  ;; Compare two vectors using identical?
+  ;; Compare two vectors using identical-ish?
   (assert (vector? v1))
   (assert (vector? v2))
   (or (identical? v1 v2)
@@ -161,6 +163,7 @@
            (reduce-kv (fn [res k v]
                         (let [v' (v2 k)]
                           (if (or (identical? v v')
+                                  (identical-ish? v v')
                                   (and (== 1 k)
                                        (shallow-equal-maps v v')))
                             res


moved reader and writer repl into fns

moved reader and writer repl into fns

--- src/responsive_db/core.clj
+++ src/responsive_db/core.clj
@@ -23,21 +23,28 @@
 (defn id-of-created [transaction]
   (first (vals (:tempids transaction))))

+(def uri "datomic:free://localhost:4334/responsive-db")
+
+(defn reader-repl []
+  (let [conn  (d/connect uri)
+        queue (d/tx-report-queue conn)]
+    (loop [tx (.take queue)]
+      (let [id (id-of-created tx)
+            e  (d/entity (:db-after tx) id)]
+        (println (:thing/name e))
+        (recur (.take queue)))) ))
+
+(defn writer-repl []
+  (let [conn (d/connect uri)]
+    (create conn {:thing/name "Logan"})
+    (create conn {:thing/name "Bob"})))
+
 (comment
-
-  (def conn (seed "datomic:free://localhost:4334/responsive-db"))
+
+  (seed uri)

-  (def queue (d/tx-report-queue conn))
+  (reader-repl)

-  (loop [tx (.take queue)]
-    (let [id (id-of-created tx)
-          e  (d/entity (:db-after tx) id)]
-      (println (:thing/name e))
-      (recur (.take queue))))
-
-  (create conn {:thing/name "Logan"})
-
-  (create conn {:thing/name "Bob"})
-
+  (writer-repl)
+
   )
-


Update dirac and cljs-devtools to latest

--- resources/leiningen/new/lambone/common/dev/boot.clj
+++ resources/leiningen/new/lambone/common/dev/boot.clj
@@ -71,8 +71,8 @@
     [org.clojure/tools.nrepl "0.2.12" :scope "test"]])

 (def dirac-repl-deps
-  '[[binaryage/devtools "0.7.2" :scope "test"]
-    [binaryage/dirac "0.6.2" :scope "test"]
+  '[[binaryage/devtools "0.8.0" :scope "test"]
+    [binaryage/dirac "0.6.3" :scope "test"]
     [powerlaces/boot-cljs-devtools "0.1.1-SNAPSHOT" :scope "test"]])

 (defn add-repl-deps


[CS] Fix precinct_split tag-name in data-spec

--- src/vip/data_processor/validation/data_spec.clj
+++ src/vip/data_processor/validation/data_spec.clj
@@ -234,7 +234,7 @@
               {:name "ballot_style_image_url" :format format/url}]}
    {:filename "precinct_split.txt"
     :table :precinct-splits
-    :tag-name :precinct-split
+    :tag-name :precinct_split
     :xml-references [{:join-table :precinct-split-electoral-districts
                       :id "precinct_split_id"
                       :joined-id "electoral_district_id"}


removed 'View the docs' link, fixed heading capitalization

--- src/xebang/views.clj
+++ src/xebang/views.clj
@@ -44,7 +44,7 @@
    [:div {:style "width: 100%; height: 300px;"}]
    [:div.row
     [:div.span6.offset3
-     [:h1 "!xebang" [:small " custom url bangs"]]]]
+     [:h1 "!Xebang" [:small " custom url bangs"]]]]
    [:div.row
     [:div.span6.offset3
      [:form.form-inline {:id "command" :method "GET" :action "/q/"}
@@ -55,7 +55,6 @@
    [:div.row
     [:div.span6.offset3
      [:small "Enter a bang. Perform a search. "
-      [:a {:href "/help"} "View the docs"] ". "
       [:a {:href "/browser"} "Tell your browser"] "!"]]]))


[core] remove extraneous argument to mount/start

--- src/braid/core.clj
+++ src/braid/core.clj
@@ -20,7 +20,7 @@
   ;; modules must run first
   (modules/init!)
   (-> (mount/with-args {:port port})
-      (mount/start {:port port})))
+      (mount/start)))

 (defn stop!
   "Helper function for stopping all Braid components."


Add traverse function to core

Add traverse function to core

--- src/cats/core.cljc
+++ src/cats/core.cljc
@@ -739,3 +739,10 @@
    (if (empty? xs)
      (return ctx z)
      (foldm f z xs))))
+
+(defn traverse
+  ([f tv]
+   (traverse (ctx/get-current) f tv))
+  ([ctx f tv]
+   (ctx/with-context ctx
+     (p/traverse (p/get-context tv) f tv))))


Don't recurse or show lines if closed.

Don't recurse or show lines if closed.

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -171,7 +171,7 @@
                                           "]"]
              :default [name " " (if val val "nil")]))))

-(defn vis-html-actx [vis actx actx-ch-ch-infos parent-closed]
+(defn vis-html-actx [vis actx actx-ch-ch-infos]
   (let [actx-id (last actx)
         actx-info (get-in vis [:actxs actx])
         children (:children actx-info)]
@@ -188,12 +188,12 @@
                ["
" ch-id ": " (:msgs ch-info) "
"]))
            (get actx-ch-ch-infos actx))
      "

"
-     ["
" (mapv (fn [child-actx]
-                     ["
" (vis-html-actx vis child-actx
-                                            actx-ch-ch-infos (:closed actx-info))
-                      "
"])
-                   (sort #(compare (last %1) (last %2)) (keys children)))
-      "
"]
+     (when (not (:closed actx-info))
+       ["
" (mapv (fn [child-actx]
+                       ["
" (vis-html-actx vis child-actx actx-ch-ch-infos)
+                        "
"])
+                     (sort #(compare (last %1) (last %2)) (keys children)))
+        "
"])
      "
"]))

 ;; ------------------------------------------------
@@ -216,13 +216,14 @@
                              [wait-kind ch-name] wait-kind-ch-name
                              ay (actx-y actx)
                              cy (ch-y ch)]
-                         [(if (= :put wait-kind)
-                            ["<line x1='500' y1='" ay "' x2='600' y2='" cy]
-                            ["<line x1='600' y1='" cy "' x2='500' y2='" ay])
-                          "' stroke='#faa' stroke-width='1' marker-end='url(#triangle)'/>"
-                          (when ch-name
-                            ["<text class='ch-name' x='540' y='" (* 0.5 (+ ay cy))
-                             "'>" ch-name "</text>"])]))
+                         (when (not= ay cy)
+                           [(if (= :put wait-kind)
+                              ["<line x1='500' y1='" ay "' x2='600' y2='" cy]
+                              ["<line x1='600' y1='" cy "' x2='500' y2='" ay])
+                            "' stroke='#faa' stroke-width='1' marker-end='url(#triangle)'/>"
+                            (when ch-name
+                              ["<text class='ch-name' x='540' y='" (* 0.5 (+ ay cy))
+                               "'>" ch-name "</text>"])])))
                      (:wait-chs actx-info))))
            (:actxs vis))
      (mapv (fn [delta]
@@ -230,28 +231,29 @@
                (let [childy (actx-y (:child-actx delta))
                      ay (actx-y (:actx delta))
                      cy (ch-y (:ch delta))]
-                 [(case (:delta delta)
-                    :put (when (get chs (:ch delta))
-                           ["<g transform='translate(500," ay ")'>"
-                            "<line class='delta' x1='0' y1='0' x2='100' y2='"
-                            (- cy ay) "' stroke='green'"])
-                    :take (when (get chs (:ch delta))
-                            ["<g transform='translate(600," cy ")'>"
-                             "<line class='delta' x1='0' y1='0' x2='-100' y2='"
-                             (- ay cy) "' stroke='" (if (:msg delta) "green" "black") "'"])
-                    :actx-start (when (> childy line-height)
-                                  ["<g transform='translate(30," ay ")'>"
-                                   "<line class='delta' x1='0' y1='0' x2='30' y2='"
-                                   (- childy ay) "' stroke='green'"])
-                    :actx-end (when (> childy line-height)
-                                ["<g transform='translate(60," childy ")'>"
-                                 "<line class='delta' x1='0' y1='0' x2='-30' y2='"
-                                 (- ay childy) "' stroke='black'"])
-                    nil)
-                  " stroke-width='1' marker-end='url(#triangle)'/></g>"
-                  (when (:ch-name delta)
-                    ["<text class='ch-name' x='540' y='" (* 0.5 (+ ay cy))
-                     "'>" (:ch-name delta) "</text>"])])))
+                 (when (not= ay cy)
+                   [(case (:delta delta)
+                      :put (when (get chs (:ch delta))
+                             ["<g transform='translate(500," ay ")'>"
+                              "<line class='delta' x1='0' y1='0' x2='100' y2='"
+                              (- cy ay) "' stroke='green'"])
+                      :take (when (get chs (:ch delta))
+                              ["<g transform='translate(600," cy ")'>"
+                               "<line class='delta' x1='0' y1='0' x2='-100' y2='"
+                               (- ay cy) "' stroke='" (if (:msg delta) "green" "black") "'"])
+                      :actx-start (when (> childy line-height)
+                                    ["<g transform='translate(30," ay ")'>"
+                                     "<line class='delta' x1='0' y1='0' x2='30' y2='"
+                                     (- childy ay) "' stroke='green'"])
+                      :actx-end (when (> childy line-height)
+                                  ["<g transform='translate(60," childy ")'>"
+                                   "<line class='delta' x1='0' y1='0' x2='-30' y2='"
+                                   (- ay childy) "' stroke='black'"])
+                      nil)
+                    " stroke-width='1' marker-end='url(#triangle)'/></g>"
+                    (when (:ch-name delta)
+                      ["<text class='ch-name' x='540' y='" (* 0.5 (+ ay cy))
+                       "'>" (:ch-name delta) "</text>"])]))))
            deltas)]))

 ;; ------------------------------------------------
@@ -312,11 +314,9 @@
           (when (< @event-delay 0) (<! step-ch)))
         (assign-positions @vis @root-actx vis-positions actx-ch-ch-infos nil)
         (set-el-innerHTML (str el-prefix "-html")
-                          (apply str (flatten (vis-html-actx @vis @root-actx
-                                                             actx-ch-ch-infos false))))
+                          (apply str (flatten (vis-html-actx @vis @root-actx actx-ch-ch-infos))))
         (set-el-innerHTML (str el-prefix "-svg")
-                          (apply str (flatten (vis-svg-actxs @vis @vis-positions
-                                                             deltas :curr))))
+                          (apply str (flatten (vis-svg-actxs @vis @vis-positions deltas :curr))))
         (recur (inc num-events) @vis @vis-positions)))
     (ago world w
          (reset! root-actx world)


Add ASCCI art for REPL

Add ASCCI art for REPL


Add layout function to dry out the templates

--- src/blog/pages.clj
+++ src/blog/pages.clj
@@ -1,6 +1,14 @@
 (ns blog.pages
   (:require [hiccup.form :as form])
   (:use [hiccup.page :only (html5 include-js include-css)]))
+
+(defn layout [title & body]
+  (html5 [:head
+          [:title title]
+          (include-css "/css/main.css")]
+         [:body
+          body
+          (include-js "/javascripts/main.js")]))

 (defn new-post []
   (html5 [:head
@@ -16,31 +24,30 @@
              (include-js "/javascripts/main.js")]))

 (defn show-post [post]
-  (html5 [:h2 (:title post)]
-         [:p (:content post)]
-         [:div {:class "controls"}
-          [:a {:href "/"} "Back"]
-          [:br]
-          [:a {:href (str "/posts/"
-                          (:_id post)
-                          "/destroy")} "Delete"]]))
+  (layout (str "Blog - " (:title post))
+          [:h2 (:title post)]
+          [:p (:content post)]
+          [:div {:class "controls"}
+           [:a {:href "/"} "Back"]
+           [:a {:href (str "/posts/"
+                           (:_id post)
+                           "/destroy")} "Delete"]]))

 (defn show-post-summary [post]
-  (html5 [:h2 (:title post)]
-         [:p (:summary post)]
-         [:a {:href (str "/posts/"
-                         (:_id post))}
-          "Read More"]))
+  [:div [:h2 (:title post)]
+   [:p (:summary post)]
+   [:a {:href (str "/posts/"
+                   (:_id post))}
+    "Read More"]])

 (defn show-posts [posts]
   (map show-post-summary posts))

 (defn index [posts]
-  (html5 [:body
+  (layout "Blog"
           [:h1 "Blog"]
           [:a {:href "/posts/new"} "New Post"]
-          (show-posts posts)
-          (include-js "/javascripts/main.js")]))
+          (show-posts posts)))

 (defn test [params]
   (html5 [:body


Clojure: +midje, bump cider, -others

Clojure: +midje, bump cider, -others

--- home/.lein/profiles.clj
+++ home/.lein/profiles.clj
@@ -1,4 +1,2 @@
-{:user {:plugins [[cider/cider-nrepl "0.8.1"]
-                  [com.jakemccrary/lein-test-refresh  "0.5.4"]
-                  [jonase/eastwood "0.2.0"]
-                  [lein-kibit "0.0.8"]]}}
+{:user {:plugins [[cider/cider-nrepl "0.10.0"]
+                  [lein-midje "3.1.3"]]}}


small changes

small changes

--- src/hydrofoil/core.clj
+++ src/hydrofoil/core.clj
@@ -1,6 +1,6 @@
 (ns hydrofoil.core
   (:require [hydrofoil.evolution :as evo]
-            [hydrofoil.model :as model]))
+            [hydrofoil.model :refer :all]))

 ;(defn -main [& args]
  ; (println (model/atan 1)))
@@ -14,7 +14,7 @@

 (defn generate-random-design
   []
-  (NACA-design (format "%.1f" (rand 9.5)) (format "%.1f" (rand 90)) (+ (format "%.1f" (rand 39)) 1)))
+  (NACA-design (round-double (rand 9.5)) (round-double (rand 90)) (+ (round-double (rand 39)) 1)))

 (defn random-change
@@ -36,6 +36,6 @@

 (defn change-max-camber
   []
-  (if (> (+ max-camber (rand 1)) 9.5) ))
+  (if (> (+ max-camber (round-double (rand 1))) 9.5) ))


Create the "module assemblies"

Create the "module assemblies"

--- support/build-plugin/src/leiningen/immutant.clj
+++ support/build-plugin/src/leiningen/immutant.clj
@@ -3,10 +3,13 @@
             [leiningen.pom]
             [leiningen.jar]
             [leiningen.core.main :as main]
+            [leiningen.core.project :as prj]
+            [leiningen.core.classpath :as cp]
             [clojure.java.io :as io]))

 (defn copy-jar [f & args]
-  (let [[project main] args]
+  "Only because our 'namespaces' jars are really our 'modules' jars"
+  (let [[project] args]
     (if-let [src (and (= 2 (count args)) (:src-jar project))]
       (let [src (io/file (:root project)
                   (.replace src "${version}" (:version project)))
@@ -24,6 +27,26 @@
       (f project "target/pom.xml")
       (apply f args))))

+(defn- copy-sans-version [dir file]
+  (let [name (apply str (rest (re-find #"(.*)-\d.*(\..*)$" (.getName file))))
+        dest (io/file dir (if (empty? name) (.getName file) name))]
+    (io/copy file dest)))
+
+(defn prepare-module-after-jar [f & args]
+  (let [result (apply f args)
+        [project] args
+        module (io/file (:root project) "src/module/resources/module.xml")]
+    (if (.exists module)
+      (let [dir (io/file (:target-path project) (str (:name project) "-module"))]
+        (.mkdirs dir)
+        (spit (io/file dir "module.xml")
+          (.replace (slurp module) "${project.artifactId}" (:name project)))
+        (copy-sans-version dir (io/file (result [:extension "jar"])))
+        (doseq [dep (cp/resolve-dependencies :dependencies (prj/unmerge-profiles project [:default]))]
+          (copy-sans-version dir dep))))
+    result))
+
 (defn hooks []
   (robert.hooke/add-hook #'leiningen.pom/pom #'put-pom-in-target)
-  (robert.hooke/add-hook #'leiningen.jar/jar #'copy-jar))
+  (robert.hooke/add-hook #'leiningen.jar/jar #'copy-jar)
+  (robert.hooke/add-hook #'leiningen.jar/jar #'prepare-module-after-jar))


Generate curried function manually, no need for more flexibility

--- src/cats/core.cljc
+++ src/cats/core.cljc
@@ -339,10 +339,10 @@
                         faps (map #(get env %) rs)]
                     (if (= (count syms) 1)
                       `(fmap (fn [~fs] ~acc) ~fa)
-                       `(fapply (fmap (fn [~fs]
-                                        (curry ~(count (rest syms)) (fn [~@(rest syms)] ~acc))) ;; TODO: only need 1 arity, don't invoke `curry`
-                                      ~fa)
-                                ~@faps))))
+                      (let [cf (reduce (fn [f sym] `(fn [~sym] ~f))
+                                       acc
+                                       (reverse syms))]
+                        `(fapply (fmap ~cf ~fa) ~@faps)))))
                 `(do ~body)
                 (reverse batches))
         join-count (dec (count batches))]


Don't show actx die line if actx is already gone.

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -215,13 +215,13 @@
                         (- (actx-y (:actx delta)) (ch-y (:ch delta)))
                         "' stroke='green' stroke-width='1' marker-end='url(#triangle)'/>"
                         "</g>"])
-               :actx-start (when (> (actx-y (:child-actx delta)) 0)
+               :actx-start (when (> (actx-y (:child-actx delta)) line-height)
                              ["<g transform='translate(30," (actx-y (:actx delta)) ")'>"
                               "<line class='delta' x1='0' y1='0' x2='50' y2='"
                               (- (actx-y (:child-actx delta)) (actx-y (:actx delta)))
                               "' stroke='green' stroke-width='1' marker-end='url(#triangle)'/>"
                               "</g>"])
-               :actx-end (when (> (actx-y (:child-actx delta)) 0)
+               :actx-end (when (> (actx-y (:child-actx delta)) line-height)
                            ["<g transform='translate(80," (actx-y (:child-actx delta)) ")'>"
                             "<line class='delta' x1='0' y1='0' x2='-50' y2='"
                             (- (actx-y (:actx delta)) (actx-y (:child-actx delta)))


Move generic fn out of aga terumo bit.

Move generic fn out of aga terumo bit.

--- src/african_polyphony_and_polyrhythm/talk.clj
+++ src/african_polyphony_and_polyrhythm/talk.clj
@@ -55,6 +55,13 @@
   "Generate version of the model using the variations fns."
   [model & variations]
   ((apply juxt identity variations) model))
+
+(defn introduce-after
+  "Gradually introduce each part after t beats."
+  [t parts]
+  (->> parts
+       (map after (range 0 (* (count parts) t) t))
+       (reduce with)))

@@ -88,11 +95,6 @@
         f (split 0 1/5)
         g (comp (split 0 1/10) f)]
     (part model a b c d e f g)))
-
-(defn introduce-after [t parts]
-  (->> parts
-       (map after (range 0 (* (count parts) t) t))
-       (reduce with)))

 (def aga-terumo ; p299
   (let [drums [child mother father]]


total sum is now calculated

total sum is now calculated

--- examples/shopping-cart/src/app/view_model.cljs
+++ examples/shopping-cart/src/app/view_model.cljs
@@ -3,30 +3,34 @@
             [datascript.core :as d])
   (:require-macros [reagent.ratom :refer [reaction]]))

-(defn -describe-results
-  [keys query-result]
-  (map #(zipmap keys %) query-result))
+(defn -q
+  "Queries model's db and returns result as a map with specified keys."
+  [model keys q]
+  (->>
+    (d/q q (:db @model))
+    (map #(zipmap keys %))))

 (defn view-model
   [model]
-  {:products      (reaction (-describe-results
-                              [:id :title :price :disabled?]
-                              (d/q '[:find ?e ?t ?p ?disabled?
-                                     :where
-                                     [?e :product/title ?t]
-                                     [?e :product/price ?p]
-                                     [?e :product/inventory ?i]
-                                     [(< ?i 1) ?disabled?]]
-                                   (:db @model))))
+  (let [cart-products (reaction (-q model
+                                    [:id :title :price :quantity]
+                                    '[:find ?e ?t ?p ?q
+                                      :where
+                                      [?e :order-line/product ?pe]
+                                      [?pe :product/title ?t]
+                                      [?pe :product/price ?p]
+                                      [?e :order-line/quantity ?q]]))]
+    {:cart-products cart-products

-   :cart-products (reaction (-describe-results
-                              [:id :title :price :quantity]
-                              (d/q '[:find ?e ?t ?p ?q
-                                     :where
-                                     [?e :order-line/product ?pe]
-                                     [?pe :product/title ?t]
-                                     [?pe :product/price ?p]
-                                     [?e :order-line/quantity ?q]]
-                                   (:db @model))))
+     :cart-total    (reaction (reduce #(+ %1 (* (:price %2) (:quantity %2)))
+                                      0
+                                      @cart-products))

-   :cart-total    (reaction "$$$ TBD $$$")})+     :products      (reaction (-q model
+                                  [:id :title :price :disabled?]
+                                  '[:find ?e ?t ?p ?disabled?
+                                    :where
+                                    [?e :product/title ?t]
+                                    [?e :product/price ?p]
+                                    [?e :product/inventory ?i]
+                                    [(< ?i 1) ?disabled?]]))}))


Menu fix

Menu fix

--- src/tango/cljs/client.cljs
+++ src/tango/cljs/client.cljs
@@ -553,21 +553,29 @@

                      ;; Navigation items
                      (dom/div #js {:id "navbar" :className "navbar-collapse collapse"}
-                       (dom/ul #js {:className "nav navbar-nav"}
-                               (dom/li #js {:className ""
-                                            :onClick #(om/transact!
-                                                       this
-                                                       `[(app/select-page {:page :competitions})])}
-                                       (dom/a nil
-                                         (dom/span #js {:className   "glyphicon glyphicon-home"
-                                                        :aria-hidden "true"}) " Home"))
-                               (dom/li #js {:className ""}
-                                       (dom/a nil "Properties"))
-
-                               (make-button "Classes" :classes)
-
-
-                               )
+                       (apply dom/ul #js {:className "nav navbar-nav"}
+                              (map (fn [[name key]] (make-button name key))
+                                   [["Home" :competitions]
+                                    ["Properties" :properties]
+                                    ["Classes" :classes]
+                                    ["Time Schedule" :schedule]
+                                    ["Adjudicators" :adjudicators]
+                                    ["Adjudicator Panels" :adjudicator-panels]]))
+                       ;(dom/ul #js {:className "nav navbar-nav"}
+                       ;        (dom/li #js {:className ""
+                       ;                     :onClick #(om/transact!
+                       ;                                this
+                       ;                                `[(app/select-page {:page :competitions})])}
+                       ;                (dom/a nil
+                       ;                  (dom/span #js {:className   "glyphicon glyphicon-home"
+                       ;                                 :aria-hidden "true"}) " Home"))
+                       ;        (dom/li #js {:className ""}
+                       ;                (dom/a nil "Properties"))
+                       ;
+                       ;        (make-button "Classes" :classes)
+                       ;
+                       ;
+                       ;        )
                        ;(dom/form #js {:className "navbar-form navbar-right"}
                        ;  (dom/input #js {:type        "text"
                        ;                  :className   "form-control"
@@ -576,18 +584,7 @@

         (dom/div #js {:className "container"}
           (dom/div #js {:className "row"}
-            ;(when (and (seq selected-competition)
-            ;           (= :running (:app/status (om/props this)))
-            ;           (not= :importing (:app/import-status (om/props this))))
-            ;  (dom/div #js {:className "col-sm-2 col-md-2 sidebar"}
-            ;    (dom/div nil (dom/u nil "Meny"))
-            ;    (apply dom/ul #js {:className "nav nav-sidebar"}
-            ;           (map (fn [[name key]] (make-button name key))
-            ;                [["Properties" :properties]
-            ;                 ["Classes" :classes]
-            ;                 ["Time Schedule" :schedule]
-            ;                 ["Adjudicators" :adjudicators]
-            ;                 ["Adjudicator Panels" :adjudicator-panels]]))))
+

             (dom/div #js {:className "col-lg-4"}
               (condp = spage


Fix konserve.core/keys.

Fix konserve.core/keys.

--- src/konserve/core.cljc
+++ src/konserve/core.cljc
@@ -208,7 +208,7 @@
   "Return a channel that will yield all top-level keys currently in the store,
   in sorted order. If start-key is given, only returns keys larger than
   that value."
-  ([store] (-keys store))
+  ([store] (keys store nil))
   ([store start-key] (-keys store start-key)))


Don't mkdir classes if it's a task that doesn't take a project arg.

--- src/leiningen/core.clj
+++ src/leiningen/core.clj
@@ -54,7 +54,7 @@
                   (first args)
                   (read-project))
         compile-path (:compile-path project)]
-    (.mkdirs (File. compile-path))
+    (when compile-path (.mkdirs (File. compile-path)))
     (binding [*compile-path* compile-path]
       (apply (resolve-command command) project args))
     ;; In case tests or some other task started any:


Add test for force-update-all

Add test for force-update-all

--- test/testreagent.cljs
+++ test/testreagent.cljs
@@ -45,8 +45,12 @@
       (with-mounted-component [really-simple nil nil]
         (fn [c div]
           (swap! ran inc)
-          (is (found-in #"div in really-simple" div))))
-      (is (= 2 @ran)))))
+          (is (found-in #"div in really-simple" div))
+          (reagent/flush)
+          (is (= 2 @ran))
+          (reagent/force-update-all)
+          (is (= 3 @ran))))
+      (is (= 3 @ran)))))

 (deftest test-simple-callback
   (when isClient
@@ -93,8 +97,7 @@

           (reagent/set-state @self {:foo "you"})
           (rflush)
-          (is (found-in #"hi you" div))
-          ))
+          (is (found-in #"hi you" div))))
       (is (= 4 @ran)))))

 (deftest test-ratom-change
@@ -223,7 +226,10 @@
           (is (= @child-ran 6))
           (do (reset! child-props {:on-change (reagent/partial f1)})
               (rflush))
-          (is (= @child-ran 7)))))))
+          (is (= @child-ran 7))
+
+          (reagent/force-update-all)
+          (is (= @child-ran 8)))))))

 (deftest dirty-test
   (when isClient


fix email

fix email

--- src/cljs/just_married/home/accommodation.cljs
+++ src/cljs/just_married/home/accommodation.cljs
@@ -12,7 +12,7 @@
    :triple    89
    :quadruple 107})

-(def email-hotel "info@villaimmacolata.it")
+(def email-hotel "info@hotelvillaimmacolata.it")

 (def ^:private accommodation-dict
   {:en {:title     "Accommodation"


added ports into service dashboard, cleanup state

--- src/cljs/swarmpit/component/service/list.cljs
+++ src/cljs/swarmpit/component/service/list.cljs
@@ -13,21 +13,22 @@
 (def cursor [:page :service :list])

 (def headers [{:name  "Name"
-               :width "20%"}
+               :width "15%"}
               {:name  "Image"
                :width "30%"}
-              {:name  "Mode"
-               :width "10%"}
               {:name  "Replicas"
-               :width "10%"}
+               :width "15%"}
+              {:name  "Ports"
+               :width "15%"}
               {:name  "Status"
-               :width "30%"}])
+               :width "25%"}])

 (def render-item-keys
-  [[:serviceName] [:repository :image] [:mode] [:status :info] [:state]])
+  [[:serviceName] [:repository :image] [:status :info] [:ports] [:state]])

 (defn- render-item-update-state [value]
-  (if (some? value)
+  (case value
+    "rollback_started" (comp/label-update "rollback")
     (comp/label-update value)))

 (defn- render-item-state [value]
@@ -36,16 +37,35 @@
     "not running" (comp/label-grey value)
     "partly running" (comp/label-yellow value)))

+(defn- render-item-ports [value]
+  (html
+    (for [port value]
+      [:div (str (:hostPort port) " ➟ " (:containerPort port) "/" (:protocol port))])))
+
+(defn- render-item-info [value mode]
+  (html
+    (if (= "global" mode)
+      [:span
+       [:span (comp/label-info value)]
+       [:span " "]
+       [:span.label.label-info [:b "G"]]]
+      [:span (comp/label-info value)])))
+
+(defn- render-status [value update-status]
+  (if (or (= "updating" update-status)
+          (= "rollback_started" update-status))
+    (render-item-update-state update-status)
+    (render-item-state value)))
+
 (defn- render-item
   [item service]
-  (let [update (get-in service [:status :message])
+  (let [update (get-in service [:status :update])
+        mode (:mode service)
         value (val item)]
     (case (key item)
-      :state (html [:span
-                    [:span (render-item-state value)]
-                    [:span " "]
-                    [:span (render-item-update-state update)]])
-      :info (comp/label-info value)
+      :ports (render-item-ports value)
+      :state (render-status value update)
+      :info (render-item-info value mode)
       value)))

 (defn- onclick-handler


Convert more to vectors in knock-off-chip-off-the-old-block

--- src/clojush/pushgp/selection/preselection.clj
+++ src/clojush/pushgp/selection/preselection.clj
@@ -105,7 +105,10 @@
               (if (or subset? single?)
                 (let [all (shuffle (range (count (first (:history (first pop))))))
                       keepers (cons (first all)
-                                    (if single? [] (take (rand (count all)) (rest all))))]
+                                    (if single?
+                                      []
+                                      (vec (take (rand (count all))
+                                                 (rest all)))))]
                   (fn [ind]
                     (mapv (fn [errs]
                            (vec (for [i keepers] (nth errs i)))
@@ -133,7 +136,7 @@
               changed (vec (filter (fn [ind]
                                      (or (< (count (:history ind)) diffs)
                                          (let [hist (filtered-history ind)
-                                               case-hists (apply map list hist)]
+                                               case-hists (apply mapv list hist)]
                                            (some (fn [h]
                                                    (>= (count (distinct (take outof h)))
                                                        diffs))


Finish implentation (fix bug) in :unsolved for :knock-off-chip-off-the-old-block

--- src/clojush/pushgp/selection/preselection.clj
+++ src/clojush/pushgp/selection/preselection.clj
@@ -114,7 +114,8 @@
                                           hist)))
                                  :history)]
           (if (= true (first knock-spec))
-            (let [changed (vec (filter #(not= (first (:history %)) (second (:history %)))
+            (let [changed (vec (filter #(not= (first (filtered-history %))
+                                              (second (filtered-history %)))
                                        pop))]
               (if (empty? changed)
                 pop
@@ -138,8 +139,9 @@
                                    (inc (lrand-int (dec outof)))
                                    (lrand-int outof))))
                           diffs)
-                  changed (vec (filter #(or (< (count (:history %)) diffs)
-                                            (>= (count (distinct (take outof (:history %))))
+                  changed (vec (filter #(or (< (count (filtered-history %)) diffs)
+                                            (>= (count (distinct (take outof
+                                                                       (filtered-history %))))
                                                 diffs))
                                        pop))]
               (if (empty? changed)


No need to import com.rabbitmq.client.Channel

--- src/com/farmlogs/conduit/reliable_channel.clj
+++ src/com/farmlogs/conduit/reliable_channel.clj
@@ -5,8 +5,7 @@
             [langohr
              [basic :as rmq.basic]
              [channel :as rmq.chan]])
-  (:import [com.rabbitmq.client ConfirmListener
-            Channel]))
+  (:import [com.rabbitmq.client ConfirmListener]))

 (defrecord Confirm [tag multiple? result])
 (defrecord Await [tag async-chan])


Migration task: limit memory usage (#1309)

This PR is an attempt to fix a memory leak in migration task.

--- src/ctia/task/migration/migrate_es_stores.clj
+++ src/ctia/task/migration/migrate_es_stores.clj
@@ -129,7 +129,7 @@
   [read-params :- (s/maybe BatchParams)]
   (lazy-seq
    (when-let [batch (read-source-batch read-params)]
-     (cons batch (read-source batch)))))
+     (cons batch (read-source (dissoc batch :documents))))))

 (s/defn write-target :- s/Int
   "This function writes a batch of documents which are (1) modified with `migrations` functions,
@@ -150,7 +150,7 @@
    services :- mst/MigrationStoreServices]
   (let [migrated (transduce migrations conj documents)
         {:keys [data errors]} (list-coerce migrated)
-        new-migrated-count (+ migrated-count (count data))]
+        new-migrated-count (+ (count data) migrated-count)]
     (doseq [entity errors]
       (let [message
             (format "%s - Cannot migrate entity: %s"


Adjust namespace name to conform to package-hierarchy.

--- src/dda/pallet/crate/servertest/fact/file.clj
+++ src/dda/pallet/crate/servertest/fact/file.clj
@@ -15,7 +15,7 @@
 ; limitations under the License.

-(ns dda.pallet.servertest.fact.file
+(ns dda.pallet.crate.servertest.fact.file
   (:require
    [dda.pallet.servertest.core.fact :refer :all]
    [schema.core :as s]))


Use require instead of use

Use require instead of use

--- src/mdr2/pipeline1.clj
+++ src/mdr2/pipeline1.clj
@@ -4,8 +4,8 @@
   It is assumed that there is a binary named `daisy-pipeline` on the
   path and that the pipeline scripts are installed under
   `/usr/lib/daisy-pipeline/scripts`."
-  (:use [clojure.java.shell :only [sh]])
-  (:require [clojure.string :as s]))
+  (:require [clojure.java.shell :refer [sh]]
+            [clojure.string :as s]))

 (defn- clean-line [line file]
   (-> line


commenting bumps

commenting bumps

--- src/ontrail/mutate.clj
+++ src/ontrail/mutate.clj
@@ -118,8 +118,8 @@
   (.debug logger (str user " creating comment " params))
   (mc/update-by-id EXERCISE
                    (ObjectId. (:id params))
-                   {:lastModifiedDate (time/now)}
-                   {"$push" {:comments {:avatar (get-avatar-url user)
+                   {"$set" {:lastModifiedDate (time/now)}
+                    "$push" {:comments {:avatar (get-avatar-url user)
                                         :title (:title params)
                                         :date (to-human-date (time/now))
                                         :user user


refresh active users after removing

refresh active users after removing

--- src/pc/billing/dev.clj
+++ src/pc/billing/dev.clj
@@ -39,4 +39,5 @@
                                               cust
                                               {:cust/uuid (:cust/uuid prcrsr-bot)
                                                :transaction/team (:db/id team)
-                                               :transaction/broadcast true})))
+                                               :transaction/broadcast true}))
+  (billing/set-active-users (pcd/default-db) team))


show user's teams on the user page

show user's teams on the user page

--- src/pc/views/admin.clj
+++ src/pc/views/admin.clj
@@ -412,7 +412,15 @@
     (for [[k v] (sort-by first (into {} cust))]
       [:tr
        [:td (h/h (str k))]
-       [:td (render-cust-prop k v)]])]))
+       [:td (render-cust-prop k v)]])
+    [:tr
+     [:td "Teams"]
+     [:td (interleave (->> cust
+                        (permission-model/find-team-permissions-for-cust (pcd/default-db))
+                        (map :permission/team)
+                        (sort-by :team/subdomain)
+                        (map team-link))
+                      (repeat " "))]]]))

 (defn doc-info [doc auth]
   (let [db (pcd/default-db)]


Remove unnecessary code

Remove unnecessary code

--- src/photon/streams.clj
+++ src/photon/streams.clj
@@ -10,13 +10,6 @@
             [somnium.congomongo :as m]
             [clj-time.coerce :as cc]
             [photon.db :as db]))
-
-(defn seq->channel [s]
-  (let [ch (chan (buffer 1))]
-    (go
-      (doseq [event s]
-        (>! ch event)))
-    ch))

 (defprotocol ColdStream
   (clean! [this])


Remove :group metadata from flat-plan runnable examples

--- src/main/clojure/com/stuartsierra/lazytest/plan.clj
+++ src/main/clojure/com/stuartsierra/lazytest/plan.clj
@@ -16,7 +16,6 @@
   (let [m (meta f)]
     (RunnableExample. f contexts
 		      (assoc m
-			:group group
 			:doc (str parent-doc (when parent-doc " ") (:doc m))
 			:tags (union parent-tags (:tags m)))
 		      nil)))


Use :key instead of :keycode

Use :key instead of :keycode

--- resources/arcade/core.clj
+++ resources/arcade/core.clj
@@ -55,7 +55,7 @@
   ; runs when a key is pressed
   :on-key-down
   (fn [screen entities]
-    (when (= (:keycode screen) (key-code :space))
+    (when (= (:key screen) (key-code :space))
       (conj entities (create-missile))))
   ; runs when the mouse is clicked
   :on-touch-down


Update and add form functionality for mutation changed

--- src_cljs/rrm/corecljs.cljs
+++ src_cljs/rrm/corecljs.cljs
@@ -503,27 +503,36 @@

-(defn form-input-check-element [id label ttype data-set focus]
-  (let [input-focus (r/atom nil)
-        check (r/atom true)]
+(defn date-input [id data-set placeholder bool]
+  [:input.form-control {:id id
+                        :type "date"
+                        :value (@data-set id)
+                        :placeholder placeholder
+                        :on-change #(swap! data-set assoc id (-> % .-target .-value))
+                        :disabled bool
+                        }])
+
+(defn add-check-input-element [id label data-set focus]
+  (let [check (r/atom true)]
     (fn []
-      (if (id @data-set)
-        [:div.form-group
-         [:label.col-sm-3.control-label label]
-         [:div.col-sm-6 [input-element id ttype data-set label input-focus]]
-         [:div.col-sm-3 [:div]]]
-        [:div.form-group
-         [:div.col-sm-1
-          [:input {:type "checkbox"
-                   :style {:width "17px" :height "17px" :float "right"}
-                   :on-change #(swap! check not)}]]
-         [:label.col-sm-2.control-label label]
-         [:div.col-sm-6
-          (if @check
-            [:div]
-            [input-element id ttype data-set label input-focus])]
-         [:div.col-sm-3 [:div]]]
-        ))))
+      [:div
+       [:div.form-group
+        [:div.col-sm-3
+         [:input {:type "checkbox"
+                  :style {:width "17px" :height "17px" :float "right"}
+                  :on-change #(swap! check not)}]]
+        [:label.col-sm-6 "Out side Record Room"]
+        [:div.col-sm-3 [:div]]]
+       (if @check
+         [:div]
+         [:div
+          [:div.form-group
+           [:label.col-sm-3.control-label label]
+           [:div.col-sm-6 [date-input id data-set label false]]
+           [:div.col-sm-3 [:div]]]
+          [form-input-element :remarks "Remarks" "text" data-set focus]
+          ])])))
+

 (defn add-mutation-template [doc-name data-set focus save-function]
   [:div.container
@@ -550,8 +559,7 @@
        [form-input-element :o4number "O4 Number" "text" data-set focus]
        [form-input-element :o6number "O6 Number" "text" data-set focus]
        [form-input-element :racknumber "Rack Number" "text" data-set focus]
-       [form-input-check-element :senddate "Send Date" "date" data-set focus]
-       [form-input-element :remarks "Remarks" "text" data-set focus]
+       [add-check-input-element :senddate "Send Date" data-set focus]
        ]
       [:div.box-footer
        [:button.btn.btn-default {:on-click form-cancel} "Cancel"]
@@ -559,6 +567,44 @@
        ;;[:span (str @data-set)]
        ]]]]])

+(defn upd-check-input-element [data-set focus]
+  (let [check1 (r/atom true)
+        check2 (r/atom true)]
+    (fn []
+      [:div
+       (if (:senddate @data-set)
+         [:div.form-group
+          [:label.col-sm-3.control-label "Send Date"]
+          [:div.col-sm-6 [date-input :senddate data-set "Send Date" true]]
+          [:div.col-sm-3 [:div]]]
+         [:div
+          [:div.form-group
+           [:div.col-sm-3
+            [:input {:type "checkbox"
+                     :style {:width "17px" :height "17px" :float "right"}
+                     :on-change #(swap! check1 not)}]]
+           [:label.col-sm-6 "Check here to enter Send date"]
+           [:div.col-sm-3 [:div]]]
+          (if @check1
+            [:div]
+            [:div.form-group
+             [:label.col-sm-3.control-label "Send Date"]
+             [:div.col-sm-6 [date-input :senddate data-set "Send Date" false]]
+             [:div.col-sm-3 [:div]]])])
+       [:div.form-group
+        [:div.col-sm-3
+         [:input {:type "checkbox"
+                  :style {:width "17px" :height "17px" :float "right"}
+                  :on-change #(swap! check2 not)}]]
+        [:label.col-sm-6 "Check here to enter received date"]
+        [:div.col-sm-3 [:div]]]
+       (if @check2
+         [:div]
+         [:div.form-group
+          [:label.col-sm-3.control-label "Received Date"]
+          [:div.col-sm-6 [date-input :receiveddate data-set "Received Date" false]]
+          [:div.col-sm-3 [:div]]])
+       [form-input-element :remarks "Remarks" "text" data-set focus]])))

@@ -587,9 +633,7 @@
        [form-input-element :o4number "O4 Number" "text" data-set focus]
        [form-input-element :o6number "O6 Number" "text" data-set focus]
        [form-input-element :racknumber "Rack Number" "text" data-set focus]
-       [form-input-check-element :senddate "Send Date" "date" data-set focus]
-       [form-input-check-element :receiveddate "Received Date" "date" data-set focus]
-       [form-input-element :remarks "Remarks" "text" data-set focus]
+       [upd-check-input-element data-set focus]
        ]
       [:div.box-footer
        [:button.btn.btn-default {:on-click form-cancel} "Cancel"]
@@ -2014,7 +2058,7 @@
                      :title [[v/required :message "Field is required"]]
                      :remarks [[v/required :message "Field is required"]]
                      :dispatcheddate [[v/required :message "Field is required"]]
-                     :receiveddate [[v/required :message "Field is required"]]
+                     ;; :receiveddate [[v/required :message "Field is required"]]
                      )))


Fixing the joda time test.

Fixing the joda time test.

--- common-lib/test/cmr/common/test/joda_time.clj
+++ common-lib/test/cmr/common/test/joda_time.clj
@@ -1,6 +1,7 @@
 (ns cmr.common.test.joda-time
   "Tests the joda time "
   (:require [clojure.test :refer :all]
+            [cmr.common.joda-time]
             [clj-time.core :as t]))

 (deftest printing-and-parsing-joda-time


added howler for sound to libs

added howler for sound to libs

--- resources/leiningen/new/threejs_game/project.clj
+++ resources/leiningen/new/threejs_game/project.clj
@@ -4,6 +4,7 @@
   :dependencies [[org.clojure/clojure "1.9.0-beta2"]
                  [org.clojure/clojurescript "1.9.946"]
                  [cljsjs/three "0.0.87-0"]
+                 [cljsjs/howler "2.5.0-0"]
                  [reagent "0.8.0-alpha1"]]
   :plugins [[lein-cljsbuild "1.1.7"]
             [lein-figwheel "0.5.14"]]


Simplify the equlity check against 0

Simplify the equlity check against 0

Replace this with (zero? ...)

--- ring-core/src/ring/middleware/session/cookie.clj
+++ ring-core/src/ring/middleware/session/cookie.clj
@@ -79,12 +79,9 @@

 (defn- secure-compare [^String a ^String b]
   (if (and a b (= (.length a) (.length b)))
-      (= 0
-         (reduce bit-or
-                 (map bit-xor
-                      (.getBytes a)
-                      (.getBytes b))))
-      false))
+    (zero? (reduce bit-or
+                   (map bit-xor (.getBytes a) (.getBytes b))))
+    false))

 (defn- unseal
   "Retrieve a sealed Clojure data structure from a string"


added gui width and height

added gui width and height

--- src/dj/gui/svg.clj
+++ src/dj/gui/svg.clj
@@ -24,8 +24,10 @@
       (.setVisible true))))

 (defn view! [args]
-  (let [default {:title "Replace me!"}
-        {:keys [title svg-str]} (merge default args)]
+  (let [default {:title "Replace me!"
+                 :width 640
+                 :height 480}
+        {:keys [title svg-str width height]} (merge default args)]
     (javax.swing.SwingUtilities/invokeLater
      (fn []
        (let [f (javax.swing.JFrame. title)
@@ -38,6 +40,7 @@
          (doto (.getContentPane f)
            (.add s))
          (doto f
+           (.setPreferredSize (java.awt.Dimension. width height))
            (.pack)
            (.setVisible true)))))))


Fix cookie session max-age to seconds

Fix cookie session max-age to seconds

Was previously out by 3 orders of magnitude

--- src/cylon/core.clj
+++ src/cylon/core.clj
@@ -225,7 +225,7 @@
               :expiry (+ (.getTime (java.util.Date.)) (* expiry-seconds 1000))})
       ;; TODO: Make this cookie name configurable
       {"session" {:value uuid
-                  :max-age (* expiry-seconds 1000)}}))
+                  :max-age expiry-seconds}}))
   (get-session [this cookies]
     (when-let [{:keys [expiry] :as session} (->> (get cookies "session") :value (get @(:sessions this)))]
       (when (< (.getTime (java.util.Date.)) expiry)


figwheel.main: print to stderr on REPL warnings

fixes #695

--- figwheel-main/src/figwheel/main.cljc
+++ figwheel-main/src/figwheel/main.cljc
@@ -1259,17 +1259,18 @@
                           cljs.analyzer/*cljs-warning-handlers*)
                   (fn [warning-type env extra]
                     (when (get cljs.analyzer/*cljs-warnings* warning-type)
-                      (->> {:warning-type warning-type
-                            :env env
-                            :extra extra
-                            :path ana/*cljs-file*}
-                           figwheel.core/warning-info
-                           (fig-ex/root-source->file-excerpt (:root-source-info env))
-                           log/format-ex
-                           ansip/format-str
-                           string/trim-newline
-                           println)
-                      (flush))))]
+                      (binding [*out* *err*]
+                        (->> {:warning-type warning-type
+                              :env env
+                              :extra extra
+                              :path ana/*cljs-file*}
+                             figwheel.core/warning-info
+                             (fig-ex/root-source->file-excerpt (:root-source-info env))
+                             log/format-ex
+                             ansip/format-str
+                             string/trim-newline
+                             println)
+                        (flush)))))]
     (let [repl-options (-> repl-options
                            (assoc :caught (:caught repl-options repl-caught)))]
       (println (ansip/format-str


Only cache templates in production.

Only cache templates in production.

--- src/redial/handler.clj
+++ src/redial/handler.clj
@@ -9,15 +9,17 @@
         [ring.middleware.json :only [wrap-json-response]])
   (:import java.net.URL))

+(def production? (System/getenv "LEIN_NO_DEV"))
 (def cached-templates (atom {}))

 (defn template-path [filename]
   (.getPath (io/file "templates" filename)))

 (defn get-template [path]
-  (or (@cached-templates path)
+  (or (and production? (@cached-templates path))
       (let [template (slurp (io/resource path))]
-        (swap! cached-templates assoc path template)
+        (if production?
+          (swap! cached-templates assoc path template))
         template)))

 (defn page [content]


Remove unused comment

Remove unused comment

--- test/carambar/mvn_test.clj
+++ test/carambar/mvn_test.clj
@@ -70,6 +70,3 @@
            "/m2_repo/org/slf4j/slf4j-api/1.7.8/slf4j-api-1.7.8.jar"
            "/m2_repo/ch/qos/logback/logback-classic/1.1.2/logback-classic-1.1.2.jar"
            "/m2_repo/ch/qos/logback/logback-core/1.1.2/logback-core-1.1.2.jar"]})))
-
-(comment "Step"
-  (aether/dependency-files (aether/resolve-dependencies :coordinates '[[junit "4.12"]])))


Made sets test more robust; previous version seems inconsistent with different versions of Redis.

--- test/carmine/test/core.clj
+++ test/carmine/test/core.clj
@@ -140,13 +140,8 @@
     (is (= 0 (wc (r/sismember k1 "reflexes"))))
     (wc (r/sadd k2 "pecking"))
     (wc (r/sadd k2 "flight"))
-
-    ;; TODO When/why did this change!?
-    ;; (is (= '("pecking" "x-ray vision" "flight")
-    ;;        (wc (r/sunion k1 k2))))
-
-    (is (= '("flight" "pecking" "x-ray vision")
-           (wc (r/sunion k1 k2))))))
+    (is (= (set '("flight" "pecking" "x-ray vision"))
+           (set (wc (r/sunion k1 k2)))))))

 (deftest test-sorted-sets
   (let [k1 (test-key "hackers")


proxmox test requirments

proxmox test requirments

--- test/celestial/proxmox.clj
+++ test/celestial/proxmox.clj
@@ -1,5 +1,5 @@
 (ns celestial.proxmox
-  "Integration tests assume a proxmox vm with local address"
+  "Integration tests assume a proxmox vm with local address make sure to configure it"
   (:use
     clojure.test
     proxmox.provider)


Use debugf instead of info for query timing logging.

--- src/oc/storage/resources/entry.clj
+++ src/oc/storage/resources/entry.clj
@@ -14,7 +14,7 @@
 (defn- log-query-time
   "Log the current time, the timestamp is in nanoseconds, 1/1000000000 to get seconds."
   [step]
-  (timbre/info (str "StorageQueryTiming, " step ", " (. System (nanoTime)))))
+  (timbre/debugf "StorageQueryTiming, %s, %d" step (. System (nanoTime))))

 (def temp-uuid "9999-9999-9999")


fix offshooting containers on Chrome and Safari

--- frontend/controllers/controls.cljs
+++ frontend/controllers/controls.cljs
@@ -19,6 +19,7 @@
             [frontend.utils.seq :refer [dissoc-in]]
             [frontend.utils.state :as state-utils]
             [goog.string :as gstring]
+            [goog.labs.userAgent.engine :as engine]
             goog.style)
   (:require-macros [dommy.macros :refer [sel sel1]]
                    [cljs.core.async.macros :as am :refer [go go-loop alt!]])
@@ -366,13 +367,17 @@
         ;; XXX stop making (count containers) queries on each scroll
         containers (sort-by (fn [c] (Math/abs (- parent-scroll-left (.-x (goog.style.getContainerOffsetToScrollInto c parent)))))
                             (sel parent ".container-view"))
-        ;; if we're scrolling left, then we want the container whose rightmost portion is showing
-        ;; if we're scrolling right, then we want the container whose leftmost portion is showing
         new-scrolled-container-id (if (= parent-scroll-left current-container-scroll-left)
                                     current-container-id
-                                    (if (< parent-scroll-left current-container-scroll-left)
-                                      (apply min (map container-id (take 2 containers)))
-                                      (apply max (map container-id (take 2 containers)))))]
+                                    (if-not (engine/isGecko)
+                                      ;; Safari and Chrome scroll the found content to the center of the page
+                                      (container-id (first containers))
+                                      ;; Firefox scrolls the content just into view
+                                      ;; if we're scrolling left, then we want the container whose rightmost portion is showing
+                                      ;; if we're scrolling right, then we want the container whose leftmost portion is showing
+                                      (if (< parent-scroll-left current-container-scroll-left)
+                                        (apply min (map container-id (take 2 containers)))
+                                        (apply max (map container-id (take 2 containers))))))]
     ;; This is kind of dangerous, we could end up with an infinite loop. Might want to
     ;; do a swap here (or find a better way to structure this!)
     (when (not= current-container-id new-scrolled-container-id)