clean up some junk

clean up some junk

--- src/cljc/western_music/lib/ui.cljc
+++ src/cljc/western_music/lib/ui.cljc
@@ -8,14 +8,6 @@
             [#?(:cljs cljs.spec.impl.gen
                 :clj clojure.spec.gen) :as gen]))

-#?(:clj
-   (do
-     (def fake-dispatch-results (atom []))
-
-     (defn dispatch [arg]
-       (swap! fake-dispatch-results conj arg))
-     ))
-
 (s/def :data/raw (s/coll-of ::spec/composition))

 (s/def :data/ui
@@ -42,15 +34,7 @@
          (fn [{playing :player/playing q :player/queue}]
            (if playing
              (contains? (into #{} (map :track/id) q) (:track/id playing))
-             true)))
-  #_(s/with-gen
-
-    #(gen/fmap (fn [{playing :player/playing q :player/queue :as p}]
-                 (if playing
-                   (assoc p :player/playing (first q))
-                   p))
-               ;; TODO some separate, unchecked stuff, as seen with compositions
-               )))
+             true))))

 (s/def :player/paused boolean?)

@@ -64,10 +48,8 @@

 (def all-data-spec (s/keys :req [:data/raw :data/ui]))

-#?(:cljs
-   (def verify-all-data
-     (after (partial spec/verify all-data-spec)))
-   )
+(def verify-all-data
+ (after (partial spec/verify all-data-spec)))

 (def ^:const blank
   #:ui{:player #:player{:queue []


Disable browser referrer following for now

--- src/cljs/salava/user/ui/login.cljs
+++ src/cljs/salava/user/ui/login.cljs
@@ -40,7 +40,7 @@
     (cond
       (not (empty? verification-key))  (str "/user/verify_email/" verification-key)
       (and (not (empty? manual-referrer)) (string/starts-with? manual-referrer "/")) manual-referrer
-      (and (not (empty? path)) (not= "/user/login" path) (not= path (path-for "/user/login"))) path
+      ;(and (not (empty? path)) (not= "/user/login" path) (not= path (path-for "/user/login"))) path
       :else "/social/stream")))

 (defn toggle-accept-terms [state]


guard against nil IDs

guard against nil IDs

--- src/clojure/zensols/dataset/db.clj
+++ src/clojure/zensols/dataset/db.clj
@@ -649,8 +649,9 @@
                       header-inst (first insts)]
                   (->> insts
                        (map (fn [{:keys [class-label id instance]}]
-                              (->> (instance-fn instance)
-                                   (concat fields [class-label id]))))
+                              (let [id (or id "")]
+                                (->> (instance-fn instance)
+                                     (concat fields [class-label id])))))
                        ((if header?
                           #(cons (concat col-names
                                          ["Label" "Id"]


did some more mh refactoring

did some more mh refactoring

--- uberjar/src/dda/pallet/dda_user_crate/main.clj
+++ uberjar/src/dda/pallet/dda_user_crate/main.clj
@@ -47,21 +47,13 @@
     "  - has to be a valid UserDomainConfig (see: https://github.com/DomainDrivenArchitecture/dda-user-crate)"
     ""]))

-(defn error-msg [errors]
-  (str "The following errors occurred while parsing your command:\n\n"
-       (str/join \newline errors)))
-
-(defn exit [status msg]
-  (println msg)
-  (System/exit status))
-
 (defn -main [& args]
   (let [{:keys [options arguments errors summary help]} (cli/parse-opts args cli-options)
         verbose (if (contains? options :verbose) 1 0)]
     (cond
-      help (exit 0 (usage summary))
-      errors (exit 1 (error-msg errors))
-      (not= (count arguments) 1) (exit 1 (usage summary))
+      help (mh/exit 0 (usage summary))
+      errors (mh/exit 1 (mh/error-msg errors))
+      (not= (count arguments) 1) (mh/exit 1 (usage summary))
       (:serverspec options) (if (core-app/existing-serverspec
                                   app/crate-app
                                   {:domain (first arguments)


fix typos

fix typos

--- src/babel/espanol/lexicon.clj
+++ src/babel/espanol/lexicon.clj
@@ -878,8 +878,8 @@
    "parar" {:synsem {:cat :verb
                       :sem {:pred :stop}}}

-   "pararse" (let [subject-semantics
-                    subject-agr (atom :top)]
+   "pararse" (let [subject-semantics (atom :top)
+                   subject-agr (atom :top)]
                 {:synsem {:cat :verb
                           :sem {:pred :stop-oneself
                                 :reflexive true
@@ -897,7 +897,7 @@
              :synsem {:cat :verb
                       :sem {:pred :ask-for}}}

-   "peinarse" (let [subject-semantics
+   "peinarse" (let [subject-semantics (atom :top)
                     subject-agr (atom :top)]
                 {:synsem {:cat :verb
                           :sem {:pred :comb-oneself
@@ -910,7 +910,6 @@
                                        :pronoun true
                                        :reflexive true
                                        :sem subject-semantics}}}})
-
    "os"
    {:synsem {:cat cat-of-pronoun
              :pronoun true
@@ -966,12 +965,9 @@
                            :pred :put}}}

    "ponerse de pie" {}
-
-
-   "preguntar" {:espanol
-             :synsem {:cat :verb
-                      :sem {:pred :ask-for}}}
-
+
+   "preguntar" {:synsem {:cat :verb
+                         :sem {:pred :ask-for}}}

    "preocuparse" (let [subject-semantics (atom {:animate true})
                     subject-agr (atom :top)]
@@ -987,9 +983,8 @@
                                        :reflexive true
                                        :sem subject-semantics}}}})

-   "prestar" {:espanol
-             :synsem {:cat :verb
-                      :sem {:pred :lend}}}
+   "prestar" {:synsem {:cat :verb
+                       :sem {:pred :lend}}}

    "quedarse" (let [subject-semantics (atom {:animate true})
                     subject-agr (atom :top)]


1.3-ifying examples.tagged-regression

1.3-ifying examples.tagged-regression

--- src/examples/tagged_regression.clj
+++ src/examples/tagged_regression.clj
@@ -3,8 +3,8 @@
 ;; Lee Spector, lspector@hampshire.edu, 2010

 (ns examples.tagged-regression
-  (:require [clojush] [clojure.contrib.math])
-  (:use [clojush] [clojure.contrib.math]))
+  (:use [clojush]
+	[clojure.math.numeric-tower]))

 ;;;;;;;;;;;;
 ;; Integer symbolic regression of x^3 - 2x^2 - x (problem 5 from the


Add missing type hint on server ns.

Add missing type hint on server ns.

--- src/catacumba/impl/server.clj
+++ src/catacumba/impl/server.clj
@@ -25,7 +25,7 @@

 (defmethod setup-handler :ratpack-router
   [handler ^RatpackServerSpec spec]
-  (.handlers spec (helpers/action handler)))
+  (.handlers spec ^Action (helpers/action handler)))

 (defmethod setup-handler :ring
   [handler ^RatpackServerSpec spec]


fixing validate args

fixing validate args

--- src/celestial/persistency.clj
+++ src/celestial/persistency.clj
@@ -110,7 +110,8 @@
        (defn ~add-fn [~'v]
          (~validate-fn ~'v)
          (let [id# ~add-k-fn]
-           (wcar (hsetall* (~id-fn id#) ~'v)) id#))
+           (wcar (hsetall* (~id-fn id#) ~'v))
+           id#))

        (defn ~update-fn ~up-args
          (~validate-fn ~'v)
@@ -144,11 +145,10 @@

 (entity task)

-
 (defn cap-v
   "Validates a capistrano task"
-  [c-task]
-  (validate-nest [:capistrano]
+  [cap-task]
+  (validate-nest cap-task [:capistrano]
     [:src] [v/required str-v]
     [:args] [v/required str-v]
     [:name] [v/required str-v]))


duplicated friend require

duplicated friend require

--- src/celestial/persistency.clj
+++ src/celestial/persistency.clj
@@ -19,7 +19,6 @@
     [vc.validations :as vc]
     [subs.core :as subs :refer (validate! combine when-not-nil validation every-v every-kv validation)]
     [taoensso.carmine :as car]
-    [cemerick.friend :as friend]
      proxmox.model aws.model)
   (:use
     [puny.core :only (entity)]


Fix coercion to int to access jdbc method

--- src/clj/dbquery/databases.clj
+++ src/clj/dbquery/databases.clj
@@ -21,7 +21,8 @@
 (def ^:private executing-queries (atom {}))

 (defn- col-reader [sql-type]
-  (get result-extractors sql-type (fn [rs i] (.getObject rs i))))
+  (get result-extractors sql-type
+       (fn [^ResultSet rs ^Integer i] (.getObject rs i))))

 (defn ^:private rs-rows [rs row-reader offset limit]
   (if (and (> offset 0) (= ResultSet/TYPE_SCROLL_INSENSITIVE (.getType rs)))
@@ -51,8 +52,8 @@
   ([rs {:keys [offset limit fields] :or {offset 0 limit 100}}]
    (let [fields-map (key-map fields)
          meta (.getMetaData rs)
-         col-count (inc (.getColumnCount meta))
-         col-and-readers (doall (for [i (range 1 col-count)
+         col-count (-> (.getColumnCount meta) inc int)
+         col-and-readers (doall (for [i (range (int 1) col-count)
                                       :let [col-name (.getColumnLabel meta i)
                                             key (or (and (nil? fields) (keyword (s/lower-case col-name)))
                                                     (fields-map col-name))]


fires now successfully aggregate into months.


show Runner credits lost from Reversed Accounts in game log

--- src/clj/game/cards-assets.clj
+++ src/clj/game/cards-assets.clj
@@ -402,6 +402,8 @@
    "Reversed Accounts"
    {:advanceable :always
     :abilities [{:cost [:click 1]
+                 :label "Force the Runner to lose 4 [Credits] per advancement"
+                 :msg (msg "force the Runner to lose " (min (* 4 (:advance-counter card)) (:credit runner)) " [Credits]")
                  :effect (effect (lose :runner :credit (* 4 (:advance-counter card))) (trash card))}]}

    "Rex Campaign"


Disable verbose matching log statements

Disable verbose matching log statements

--- src/cljc/robinson/macros.cljc
+++ src/cljc/robinson/macros.cljc
@@ -18,7 +18,7 @@
                          (set? test-term) (contains? test-term term)
                          :else            (= test-term term)))
         found-match  (every? arg-match? (map vector test-expr expr))]
-    (if found-match
+    #_(if found-match
       (println "Found match" test-expr expr)
       (println "Did not find match" test-expr expr))
     found-match))


Added iso-mends mime type.

Added iso-mends mime type.

--- src/cmr/common/mime_types.clj
+++ src/cmr/common/mime_types.clj
@@ -10,6 +10,7 @@
    "application/echo10+xml" :echo10
    "application/iso_prototype+xml" :iso-prototype
    "application/iso:smap+xml" :iso-smap
+   "application/iso-mends+xml" :iso-mends
    "application/iso19115+xml" :iso19115
    "application/dif+xml" :dif
    "text/csv" :csv
@@ -21,6 +22,7 @@
    :echo10 "application/echo10+xml"
    :iso-prototype "application/iso_prototype+xml"
    :iso-smap "application/iso:smap+xml"
+   :iso-mends "application/iso-mends+xml"
    :iso19115 "application/iso19115+xml"
    :dif "application/dif+xml"
    :csv "text/csv"


CMR-615: Removed debug output.

CMR-615: Removed debug output.

--- src/cmr/search/api/routes.clj
+++ src/cmr/search/api/routes.clj
@@ -148,7 +148,6 @@
 (defn- find-concepts
   "Invokes query service to find results and returns the response"
   [context path-w-extension params headers query-string]
-  (println headers)
   (if (= "application/x-www-form-urlencoded" (get headers (str/lower-case CONTENT_TYPE_HEADER)))
     (let [concept-type (concept-type-path-w-extension->concept-type path-w-extension)
           context (-> context


CMR-3701: Removed the duplicated sensor functions.

--- system-int-test/src/cmr/system_int_test/data2/umm_spec_collection.clj
+++ system-int-test/src/cmr/system_int_test/data2/umm_spec_collection.clj
@@ -69,20 +69,6 @@
   [attribs]
   (umm-cmn/map->ScienceKeywordType attribs))

-(defn sensor
-  "Return a child instrument based on short-name"
-  [attribs]
-  (umm-cmn/map->InstrumentType (merge {:ShortName (d/unique-str "short-name")}
-                                      attribs)))
-
-(defn sensors
-  "Return a sequence of child instruments with the given short names"
-  [& short-names]
-  (map #(umm-cmn/map->InstrumentType
-          {:ShortName %
-           :LongName (d/unique-str "long-name")})
-       short-names))
-
 (defn instrument
   "Return an instrument based on instrument attribs"
   [attribs]
@@ -100,7 +86,7 @@
 (defn instrument-with-sensors
   "Return an instrument, with a sequence of child instruments"
   [short-name & child-instrument-short-names]
-  (let [childinstruments (apply sensors child-instrument-short-names)]
+  (let [childinstruments (apply instruments child-instrument-short-names)]
     (umm-cmn/map->InstrumentType {:ShortName short-name
                                   :LongName (d/unique-str "long-name")
                                   :ComposedOf childinstruments})))


Update lein-npm version to 0.6.1.

Update lein-npm version to 0.6.1.

--- src/leiningen/new/mies/project.clj
+++ src/leiningen/new/mies/project.clj
@@ -6,8 +6,8 @@
                   :exclusion [org.clojure/data.json]]
                  [org.clojure/data.json "0.2.6" :classifier "aot"]]
   :jvm-opts ^:replace ["-Xmx1g" "-server"]
-  :node-dependencies [[source-map-support "0.3.2"]]
-  :plugins [[lein-npm "0.5.0"]]
+  :plugins [[lein-npm "0.6.1"]]
+  :npm {:dependencies [[source-map-support "0.3.2"]]}
   :source-paths ["src" "target/classes"]
   :clean-targets ["out" "release"]
   :target-path "target")


Remove matrices websocket-init, no longer logging channel data.

--- src/mtrx9/controllers/matrices.clj
+++ src/mtrx9/controllers/matrices.clj
@@ -13,12 +13,9 @@
 (defn- rand-matrix-id []
   (clojure.string/join (repeatedly id-length #(rand-nth id-chars))))

-(defn websocket-init [channel]
-  (receive-all channel #(println "C:" %)))
-
 (defn websocket-handler [channel request]
   (let [matrix-id (get-in request [:route-params :id])
-        matrix-channel (named-channel matrix-id websocket-init)]
+        matrix-channel (named-channel matrix-id nil)]
     (siphon matrix-channel channel)))

 (defn show [id]
@@ -29,7 +26,7 @@

 (defn update [id chars]
   (println "U:" id chars)
-  (enqueue (named-channel id websocket-init) (encode-json->string {:chars chars}))
+  (enqueue (named-channel id nil) (encode-json->string {:chars chars}))
   {:status 204})

 (defroutes routes


swagger schema validation error fix

swagger schema validation error fix

--- src/ephemeris_api/service.clj
+++ src/ephemeris_api/service.clj
@@ -30,9 +30,9 @@
 (api/defroutes routes
   {:info {:title       "Ephemeris API"
           :description "For Astrology Applications"
-          :version     "0.1"
-          :externalDocs {:description "Find out more"
-                         :url         "https://github.com/astrolet/ephemeris-api"}}
+          :version     "0.1"}
+   :externalDocs {:description "Find out more"
+                  :url         "https://github.com/astrolet/ephemeris-api"}
    :basePath "/"}
   [[[(get cfg :base) ^:interceptors
             [api/error-responses


fix typeo bug and decrease wait time

fix typeo bug and decrease wait time

--- src/group_redis/partition.clj
+++ src/group_redis/partition.clj
@@ -110,11 +110,11 @@
                  )

                (if (is-partition-flag? connector topic)
-		             (do (Thread/sleep 200) (recur (inc c)))))))
+		             (do (Thread/sleep 100) (recur (inc c)))))))

       ;print out if this took longer than a second
       (if (> (- (System/currentTimeMillis) start-time) 1000)
-        (warn "waiting on partition flag took " (- (System/currentTimeMillis) start) "ms"))
+        (warn "waiting on partition flag took " (- (System/currentTimeMillis) start-time) "ms"))

       true)
     false))


quotes and parens removed in tokenizing

quotes and parens removed in tokenizing

--- src/help_me_im_dumb/index.clj
+++ src/help_me_im_dumb/index.clj
@@ -14,8 +14,8 @@
         comments (doc "comments")
         comment-string (concat (map #(get % "text") comments))]
     (->
-     (clojure.string/replace #"[,!'.%?]" "")
      (apply str body comment-string)
+     (clojure.string/replace #"[,!'.%?\"\(\)]" "")
      (clojure.string/split #"\s+"))))

 (defn token-seq-from-file


handle enter on login page

handle enter on login page

--- src/homesale/pages/login.cljs
+++ src/homesale/pages/login.cljs
@@ -13,19 +13,22 @@
           (when @error
             [:div.error
              [:p (str @error)]])
-          [:div.form-group
-           [:input.form-control {:type "email"
-                                 :placeholder "Email address"
-                                 :value email
-                                 :on-change #(swap! login-state assoc :email (-> % .-target .-value))}]]
-          [:div.form-group
-           [:input.form-control {:type "password"
-                                 :placeholder "Password"
-                                 :value password
-                                 :on-change #(swap! login-state assoc :password (-> % .-target .-value))}]]
-          [:div
-           (if @processing?
-             [:div.text-center [:i.fa.fa-spinner.fa-spin.fa-2x]]
-             [:button.btn.btn-default.center-block
-              {:on-click #(dispatch [:login-request (:email @login-state) (:password @login-state)] )}
-              "Login"])]]]))))
+          [:form {:on-submit (fn [e]
+                               (.preventDefault e)
+                               (dispatch [:login-request (:email @login-state) (:password @login-state)]))}
+           [:div.form-group
+            [:input.form-control {:type "email"
+                                  :placeholder "Email address"
+                                  :value email
+                                  :on-change #(swap! login-state assoc :email (-> % .-target .-value))}]]
+           [:div.form-group
+            [:input.form-control {:type "password"
+                                  :placeholder "Password"
+                                  :value password
+                                  :on-change #(swap! login-state assoc :password (-> % .-target .-value))}]]
+           [:div
+            (if @processing?
+              [:div.text-center [:i.fa.fa-spinner.fa-spin.fa-2x]]
+              [:button.btn.btn-default.center-block
+               {:type "submit"}
+               "Login"])]]]]))))


Use nat-int? fn

Use nat-int? fn

--- src/hundred_pushups/core.cljc
+++ src/hundred_pushups/core.cljc
@@ -6,8 +6,7 @@

 ;;;;;; specs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(s/def :exr/s-pos-int (s/and int? #(<= 0 %))) ; strictly positive int
-(s/def :exr/reps :exr/s-pos-int)
+(s/def :exr/reps nat-int?)
 (s/def :exr/pushup-reps :exr/reps)
 (s/def :exr/plank-reps :exr/reps)
 (s/def :exr/sets (s/int-in 4 20))


added :persistent true attribute to langohr.basic/publish call

--- src/lcmap/aardvark/source.clj
+++ src/lcmap/aardvark/source.clj
@@ -64,7 +64,7 @@
         payload (json/encode source)]
     (log/debugf "publish '%s' source: %s" routing payload)
     (lb/publish amqp-channel exchange routing payload
-                {:content-type "application/json"}))
+                {:content-type "application/json" :persistent true}))
   source)

 (defn insert-and-publish


Fixed test

Fixed test

--- project/analyze-data/test/analyze_data/corpus_to_tf_idf_test.clj
+++ project/analyze-data/test/analyze_data/corpus_to_tf_idf_test.clj
@@ -18,5 +18,5 @@
     (is (= "foo"
            (first second-row))
         "first element of second row is first item-name")
-    (is (and (map #(= java.lang.Double (type %)) second-row))
+    (is (every? #(= java.lang.Double (type %)) (rest second-row))
         "rest of elements of second row are doubles (tf-idf values)")))


port to om

port to om

--- frontend/components/build_head.cljs
+++ frontend/components/build_head.cljs
@@ -55,7 +55,26 @@
                                              "add more containers"]
                " and finish even faster."])]))))))

-(defn commit-line [{:keys [subject body commit_url commit] :as commit-details} owner]
+(defn linkify [text]
+  (let [url-pattern #"(?im)(\b(https?|ftp)://[-A-Za-z0-9+@#/%?=~_|!:,.;]*[-A-Za-z0-9+@#/%=~_|])"
+        pseudo-url-pattern #"(?im)(^|[^/])(www\.[\S]+(\b|$))"]
+    (-> text
+        ;; TODO: switch to clojure.string/replace when they fix
+        ;; http://dev.clojure.org/jira/browse/CLJS-485...
+        (.replace (js/RegExp. (.-source url-pattern) "gim")
+                  "$1")
+        (.replace (js/RegExp. (.-source pseudo-url-pattern) "gim")
+                  "$1$2"))))
+
+(defn maybe-project-linkify [text project-name]
+  (if-not project-name
+    text
+    (let [issue-pattern #"(^|\s)#(\d+)\b"]
+      (-> text
+          (string/replace issue-pattern
+                          (gstring/format "$1#$2" project-name))))))
+
+(defn commit-line [{:keys [build subject body commit_url commit] :as commit-details} owner]
   (reify
     om/IDidMount
     (did-mount [_]
@@ -66,8 +85,11 @@
       (html
        [:div
         [:span {:title body
-                :id (str "commit-line-tooltip-hack-" commit)}
-         subject " "]
+                :id (str "commit-line-tooltip-hack-" commit)
+                :dangerouslySetInnerHTML {:__html (-> subject
+                                                      (gstring/htmlEscape)
+                                                      (linkify)
+                                                      (maybe-project-linkify (vcs-url/project-name (:vcs_url build))))}}]
         [:a.sha-one {:href commit_url
                      :title commit}
          " "
@@ -100,14 +122,17 @@
                 [:i.fa.fa-caret-down])])]
           [:div.build-commits-list
            (if-not (seq (:all_commit_details build))
-             (om/build commit-line {:subject (:subject build)
+             (om/build commit-line {:build build
+                                    :subject (:subject build)
                                     :body (:body build)
                                     :commit_url (build-model/github-commit-url build)
                                     :commit (:vcs_revision build)})
              (list
-              (om/build-all commit-line (take 3 (:all_commit_details build)))
+              (om/build-all commit-line (take 3 (map #(assoc % :build build)
+                                                     (:all_commit_details build))))
               (when (:show-all-commits build-data)
-                (om/build-all commit-line (drop 3 (:all_commit_details build))))))]])))))
+                (om/build-all commit-line (drop 3 (map #(assoc % :build build)
+                                                       (:all_commit_details build)))))))]])))))

 (defn build-ssh [nodes owner]
   (reify


fix cache issue for #::alias{:foo "bar"}

tools.reader expects the alias'd namespace to exist on the CLJ
side. compilation would create it so we need to restore it
when loading from cache only.

fixes #748

--- src/main/shadow/build/compiler.clj
+++ src/main/shadow/build/compiler.clj
@@ -766,7 +766,12 @@
                            resource-refs)))

               ;; restore analysis data
-              (swap! env/*compiler* update-in [::ana/namespaces (:ns cache-data)] merge ana-data)
+              (let [{:keys [ns]} cache-data]
+                ;; make sure the namespace exists on the CLJ side
+                ;; otherwise tools.reader will have issues reading #::alias{:foo "bar"}
+                (create-ns ns)
+                (swap! env/*compiler* update-in [::ana/namespaces ns] merge ana-data))
+
               (swap! env/*compiler* update :shadow/protocol-prefixes set/union (:shadow/protocol-prefixes ana-data))
               (macros/load-macros ana-data)


fix find-js-require-pass not finding js/require created by macros

fixes #586

--- src/main/shadow/build/compiler.clj
+++ src/main/shadow/build/compiler.clj
@@ -1,32 +1,34 @@
 (ns shadow.build.compiler
-  (:require [clojure.spec.alpha :as s]
-            [clojure.string :as str]
-            [clojure.set :as set]
-            [clojure.java.io :as io]
-            [clojure.tools.reader.reader-types :as readers]
-            [clojure.tools.reader :as reader]
-            [cljs.analyzer :as cljs-ana]
-            [cljs.analyzer :as ana]
-            [cljs.compiler :as comp]
-            [cljs.spec.alpha :as cljs-spec]
-            [cljs.env :as env]
-            [cljs.tagged-literals :as tags]
-            [cljs.core] ;; do not remove, need to ensure this is loaded before compiling anything
-            [cljs.source-map :as sm]
-            [shadow.lazy :as lazy]
-            [shadow.cljs.util :as util]
-            [shadow.build.warnings :as warnings]
-            [shadow.build.macros :as macros]
-            [shadow.build.cache :as cache]
-            [shadow.build.cljs-hacks :as cljs-hacks]
-            [shadow.build.cljs-bridge :as cljs-bridge]
-            [shadow.build.resource :as rc]
-            [shadow.build.ns-form :as ns-form]
-            [shadow.build.data :as data]
-            [shadow.build.closure :as closure]
-            [shadow.build.npm :as npm]
-            [shadow.jvm-log :as log]
-            [shadow.build.async :as async])
+  (:require
+    [clojure.spec.alpha :as s]
+    [clojure.string :as str]
+    [clojure.set :as set]
+    [clojure.java.io :as io]
+    [clojure.tools.reader.reader-types :as readers]
+    [clojure.tools.reader :as reader]
+    [cljs.analyzer :as cljs-ana]
+    [cljs.analyzer :as ana]
+    [cljs.compiler :as comp]
+    [cljs.spec.alpha :as cljs-spec]
+    [cljs.env :as env]
+    [cljs.tagged-literals :as tags]
+    [cljs.core] ;; do not remove, need to ensure this is loaded before compiling anything
+    [cljs.source-map :as sm]
+    [shadow.debug :refer (?> ?-> ?->>)]
+    [shadow.lazy :as lazy]
+    [shadow.cljs.util :as util]
+    [shadow.build.warnings :as warnings]
+    [shadow.build.macros :as macros]
+    [shadow.build.cache :as cache]
+    [shadow.build.cljs-hacks :as cljs-hacks]
+    [shadow.build.cljs-bridge :as cljs-bridge]
+    [shadow.build.resource :as rc]
+    [shadow.build.ns-form :as ns-form]
+    [shadow.build.data :as data]
+    [shadow.build.closure :as closure]
+    [shadow.build.npm :as npm]
+    [shadow.jvm-log :as log]
+    [shadow.build.async :as async])
   (:import (java.util.concurrent ExecutorService)
            (java.io File StringReader PushbackReader StringWriter)
            [java.util.concurrent.atomic AtomicLong]))
@@ -147,7 +149,7 @@
              ;; js/require called at the REPL should not be added to metadata since it becomes sticky
              (not (::repl-context env)))
     (let [{:keys [form]} ast]
-      (when (and (list? form)
+      (when (and (seq? form)
                  (= 'js/require (first form))
                  (= 2 (count form)))
         (let [require (second form)


experimental dual-build pom

experimental dual-build pom

--- hyrax/project.clj
+++ hyrax/project.clj
@@ -17,10 +17,51 @@
   :pom-plugins [[com.theoryinpractise/clojure-maven-plugin "1.3.13"
                  {:configuration [:sourceDirectories [:sourceDirectory "src/clojure"]]
                   :extensions "true"
-                  :executions ([:execution [:id "compile-clojure"]
+                  :executions ([:execution [:id "no-aot-compile"]
                                 [:goals ([:goal "compile"])]
-                                [:phase "compile"]])}]
-
+                                [:phase "compile"]
+                                [:configuration
+                                 [:outputDirectory "${basedir}/target/no-aot"]
+                                 [:temporaryOutputDirectory true]]]
+
+                               [:execution [:id "aot-compile"]
+                                [:goals ([:goal "compile"])]
+                                [:phase "compile"]
+                                [:configuration
+                                 [:outputDirectory "${basedir}/target/aot"]
+                                 [:temporaryOutputDirectory false]]])}]
+
+                [org.apache.maven.plugins/maven-resources-plugin "2.7"
+                 {:executions ([:execution [:id "copy-resources-no-aot"]
+                                [:goals ([:goal "copy-resources"])]
+                                [:phase "package"]
+                                [:configuration
+                                 [:outputDirectory "${basedir}/target/no-aot"]
+                                 [:resources [:resource [:directory "${basedir}/target/classes"]]]]]
+
+                               [:execution [:id "copy-resources-aot"]
+                                [:goals ([:goal "copy-resources"])]
+                                [:phase "package"]
+                                [:configuration [:outputDirectory "${basedir}/target/aot"]
+                                 [:resources [:resource [:directory "${basedir}/target/classes"]]]]])}]
+
+                [org.apache.maven.plugins/maven-jar-plugin "2.6"
+                 {:executions ([:execution [:id "default-jar"]
+                                [:phase "none"]]
+
+                               [:execution [:id "no-aot"]
+                                [:goals ([:goal "jar"])]
+                                [:phase "package"]
+                                [:configuration
+                                 [:classesDirectory "${basedir}/target/no-aot"]]]
+
+                               [:execution [:id "aot"]
+                                [:goals ([:goal "jar"])]
+                                [:phase "package"]
+                                [:configuration
+                                 [:classesDirectory "${basedir}/target/aot"]
+                                 [:classifier "aot"]]])}]
+
                 [org.apache.maven.plugins/maven-source-plugin "2.4"
                  {:executions ([:execution [:id "sources"]
                                [:goals ([:goal "jar"])]


Adjust code for kibit. Thanks kibit!

Adjust code for kibit. Thanks kibit!

--- src/oc/storage/resources/entry.clj
+++ src/oc/storage/resources/entry.clj
@@ -146,8 +146,7 @@
     (let [authors (:author original-entry)
           new-topic-name (:topic-name entry)
           topic-name (if (clojure.string/blank? new-topic-name)
-                      (if (contains? entry :topic-name)
-                        nil ; topic name is being intentionally cleared out
+                      (when-not (contains? entry :topic-name)
                         (:topic-name original-entry)) ; keep prior topic name
                       new-topic-name) ; new topic name provided
           topic-slug (when topic-name (slugify/slugify topic-name))


fix for removing versions after publish

fix for removing versions after publish

--- src/oc/storage/resources/entry.clj
+++ src/oc/storage/resources/entry.clj
@@ -116,9 +116,10 @@
       updated-entry)))

 (defn delete-versions [conn entry]
-  (doseq [version (range (inc (:revision-id entry)))]
-    (let [version-uuid (str (:uuid entry) "-v" version)]
-      (db-common/delete-resource conn versions-table-name version-uuid))))
+  (when (pos? (:revision-id entry))
+    (doseq [version (range (:revision-id entry))]
+      (let [version-uuid (str (:uuid entry) "-v" version)]
+        (db-common/delete-resource conn versions-table-name version-uuid)))))

 (declare get-entry)


Freeze snapshot of core.async

Freeze snapshot of core.async

--- common/project.clj
+++ common/project.clj
@@ -7,7 +7,7 @@
   :repositories {"sonatype-nexus-snapshots" "https://oss.sonatype.org/content/repositories/snapshots"
                  "sonatype-oss-public" "https://oss.sonatype.org/content/groups/public/" }
   :dependencies [[org.clojure/clojure "1.5.1"]
-                 [org.clojure/core.async "0.1.0-SNAPSHOT"]
+                 [org.clojure/core.async "0.1.0-20130827.050117-78"]
                  [org.clojure/tools.logging "0.2.6"]
                  [org.clojure/tools.cli "0.2.4"]
                  [com.taoensso/nippy "2.2.0-RC1"]


fix REPL require issue

fix REPL require issue

sources defined in the REPL are no longer part of the regular
build cycle and removing their output can run into issues if
something tries to load them "later" since they are only compiled
initially in repl setup. when removed inbetween we get nasty
confusing errors.

same goes for REPL interactions where hot-reload was removing
sources defined in the REPL leaving the REPL in a bad state.

fixes #788

--- src/main/shadow/build/api.clj
+++ src/main/shadow/build/api.clj
@@ -351,10 +351,18 @@

       (reduce
         (fn [state resource-id]
-          (if (contains? modified resource-id)
+          (cond
             ;; fully remove specified resources (eg. modified sources found by watch)
+            (contains? modified resource-id)
             (data/remove-source-by-id state resource-id)
+
+            ;; do nothing with sources defined in the REPL since the steps that produced
+            ;; them may not be repeatable. just keep them as is.
+            (get-in state [:sources resource-id :defined-in-repl])
+            state
+
             ;; affected deps only have their output removed since their source didn't change
+            :else
             (data/remove-output-by-id state resource-id)))
         state
         all-deps-to-reset))))


Correct test which wasn't quite testing what it was supposed to

--- test/exploud/messages/asg_test.clj
+++ test/exploud/messages/asg_test.clj
@@ -603,7 +603,8 @@
                     :tyranitar {:deployment-params {:selected-load-balancers ["lb-1" "lb-2"]}}}})

 (fact "that attempting to deregister instances from no load balancers is successful"
-      (deregister-old-instances-from-load-balancers {:parameters {:previous-state {:tyranitar {:deployment-params {:selected-load-balancers []}}}}}) => (contains {:status :success}))
+      (deregister-old-instances-from-load-balancers {:parameters {:previous-state {:auto-scaling-group-name "old-asg"
+                                                                                :tyranitar {:deployment-params {:selected-load-balancers []}}}}}) => (contains {:status :success}))

 (fact "that attempting to deregister when there are no instances is successful"
       (deregister-old-instances-from-load-balancers {:parameters deregister-old-instances-from-load-balancers-params}) => (contains {:status :success})


fix test

fix test

--- test/hivewing_core/apiary_test.clj
+++ test/hivewing_core/apiary_test.clj
@@ -12,6 +12,6 @@
         ))
   (testing "create without a beekeeper"
     (let [result (try
-                    (apiary-create {:beekeeper_uuid nil})
+                    (apiary-create {:beekeeper_uuid "12345678-1234-1234-1234-12345678"})
                     (catch org.postgresql.util.PSQLException e (str "error")))]
       (is (= "error" result)))))


fix pressure value sent to playback device

--- src/server/handlers/recordings.clj
+++ src/server/handlers/recordings.clj
@@ -61,7 +61,7 @@
   (let [pressure (get-in req [:body :pressure])
         rmq-ch (get-in req [:resources :rabbit :rmq-ch])]
     (le/direct rmq-ch "touchvision")
-    (infof "[playback]: sending %d" pressure)
-    (lb/publish rmq-ch "touchvision" "playback"  (encode (:body req)) {:content-type "text/plain"})
+    (infof "[playback]: sending %f" pressure)
+    (lb/publish rmq-ch "touchvision" "playback"  (encode {:pressure (int pressure)}) {:content-type "text/plain"})
     (res {:msg "sent"
           :data (:body req)})))


set x/y-offset and window-width/height for legacy urls

--- src/vignette/api/legacy/routes.clj
+++ src/vignette/api/legacy/routes.clj
@@ -39,6 +39,7 @@

 (defn route->thumb-map
   [route-params]
+  ; order is important! mostly due to the different options changing :thumbnail-mode
   (let [map (-> route-params
                 (assoc :request-type :thumbnail)
                 (assoc :thumbnail-mode "thumbnail")
@@ -91,9 +92,15 @@
       :else map)
     map))

-; we currently don't support offsets
 (defn route->offset
   [map]
-  (if (clojure.string/blank? (:offset map))
-    map
-    (assoc map :unsupported true)))
+  (let [[_ x-offset x-end y-offset y-end] (re-find #"^(\d+),(\d+),(\d+),(\d+)-$" (:offset map))
+        window-width (- (Integer. x-end) (Integer. x-offset))
+        window-height (- (Integer. y-end) (Integer. y-offset))]
+    (assoc map :thumbnail-mode (if (= (:height map) :auto)
+                                 "window-crop"
+                                 "window-crop-fixed")
+               :x-offset x-offset
+               :y-offset y-offset
+               :window-width window-width
+               :window-height window-height)))


Call interpret from clojure

Call interpret from clojure

--- abg_clojure/src/abg_clojure/core.clj
+++ abg_clojure/src/abg_clojure/core.clj
@@ -35,11 +35,10 @@
       (.add fahrenheit-label)
       (.setSize 300 480)
       (.setVisible true))))
-(celsius)

 (defn foo
   "I don't do a whole lot."
-  [x]
-  (Abg.interpret 7.2 24.0 13.0)
-  (println x "Hello, World!"))
+  (Abg/interpret 7.2 24.0 13.0))

+(celsius)
+(foo)


rename longitude conversion function to match lat

--- src/zooniverse_live/world_map.cljs
+++ src/zooniverse_live/world_map.cljs
@@ -25,7 +25,7 @@
      (> adj-lat 180) 0
      :else (- height (* adj-lat(/ height 180))))))

-(defn long->screen-x
+(defn long->canvas-x
   [long canvas]
   (let [adj-long (+ (* 1 long) 180)
         width (parse-int (.-width canvas))]
@@ -53,7 +53,7 @@
       (.beginPath ctx)
       (doseq [pt shape]
         (let [lat (lat->canvas-y (parse-int (:lat pt)) canvas)
-              long (long->screen-x (parse-int (:lon pt)) canvas)]
+              long (long->canvas-x (parse-int (:lon pt)) canvas)]
           (.lineTo ctx long lat)))
       (.fill ctx)
       (.stroke ctx))))
@@ -66,7 +66,7 @@
     (set! (.-fillStyle ctx) points-color)
     (doseq [{:keys [latitude longitude]} classifications]
       (let [x (lat->canvas-y latitude canvas)
-            y (long->screen-x longitude canvas)]
+            y (long->canvas-x longitude canvas)]
         (.beginPath ctx)
         (.arc ctx y x radius (* 2 pi) false)
         (.fill ctx)))))


core: mapv

core: mapv

--- core/data/core.clj
+++ core/data/core.clj
@@ -3451,6 +3451,22 @@
   [to from]
   (reduce conj to from))

+(defn mapv
+  "Returns a vector consisting of the result of applying f to the
+  set of first items of each coll, followed by applying f to the set
+  of second items in each coll, until any one of the colls is
+  exhausted.  Any remaining items in other colls are ignored. Function
+  f should accept number-of-colls arguments."
+  {:added "1.0"}
+  ([f coll]
+   (reduce (fn [v o] (conj v (f o))) [] coll))
+  ([f c1 c2]
+   (into [] (map f c1 c2)))
+  ([f c1 c2 c3]
+   (into [] (map f c1 c2 c3)))
+  ([f c1 c2 c3 & colls]
+   (into [] (apply map f c1 c2 c3 colls))))
+
 (defmacro cond->
   "Takes an expression and a set of test/form pairs. Threads expr (via ->)
   through each form for which the corresponding test


Testing build system tests

Testing build system tests

--- backend/project.clj
+++ backend/project.clj
@@ -1,4 +1,4 @@
-(defproject org.akvo/lumen "0.14-SNAPSHOT"
+(defproject org.akvo/lumen "0.22.1-SNAPSHOT"
   :description "Akvo Lumen backend"
   :url "https://github.com/akvo/akvo-lumen"
   :license {:name "GNU Affero General Public License 3.0"


using java resource loader to fetch local assets

--- src/bad_movie_back_end/core/routes/bad_movie_back_end_routes.clj
+++ src/bad_movie_back_end/core/routes/bad_movie_back_end_routes.clj
@@ -2,8 +2,7 @@

   (:import [
             javax.script
-            ScriptEngineManager
-            ])
+            ScriptEngineManager])

   (:require
     [clojure.data.json :as json]
@@ -22,7 +21,10 @@

 (def react "http://cdnjs.cloudflare.com/ajax/libs/react/0.12.2/react.min.js")

-(def app "/Users/pdoherty/projects/bad-movie-poll-back-end/resources/public/javascripts/app.js")
+(defn local-script [path]
+  (clojure.java.io/resource (str "public/javascripts/" path)))
+
+(def app (local-script "app.js"))

 (def nashorn (create-engine [react app]))


Don't leak the apikey

Don't leak the apikey

--- src/multiplex/routes/home.clj
+++ src/multiplex/routes/home.clj
@@ -98,23 +98,24 @@
 (defn render-page-index []
   (layout/render "page_index.html"))

-(defn render-page-user-x [params usr]
+(defn render-page-user-x [params usr loggedin]
   (let [author (:uid usr)
         apikey (:apikey usr)
         avatar (util/get-avatar author)
         where-clause (if (mpost/valid-itemtype? (:itemtype params))
                          {:author author :itemtype (:itemtype params)}
                          {:author author})
-        posts-map (get-some (:limit params) (:page params) where-clause)]
-    (layout/render "page_user.html" (assoc posts-map :post (assoc (cleanup usr) :avatar avatar :apikey apikey)))))
+        posts-map (get-some (:limit params) (:page params) where-clause)
+        post (if (true? loggedin)
+                 (assoc (cleanup usr) :avatar avatar :apikey apikey)
+                 (assoc (cleanup usr) :avatar avatar))]
+    (layout/render "page_user.html" (assoc posts-map :post post))))

 (defn render-page-user [params]
   (if-let [usr (muser/get-user-by-key (:apikey params))]
-    (do (println "by-apikey")
-    (render-page-user-x params usr))
+    (render-page-user-x params usr true)
     (if-let [usr (muser/get-user-by-name (:username params))]
-    (do (println "by-name")
-      (render-page-user-x params usr))
+      (render-page-user-x params usr false)
       (render-page-plain "User does not exist."))))

 (defn render-page-stream [params]


Fix missing bookmarklet

Fix missing bookmarklet

--- src/multiplex/routes/home.clj
+++ src/multiplex/routes/home.clj
@@ -99,18 +99,21 @@

 (defn render-page-user-x [params usr]
   (let [author (:uid usr)
+        apikey (:apikey usr)
         avatar (util/get-avatar author)
         where-clause (if (mpost/valid-itemtype? (:itemtype params))
                          {:author author :itemtype (:itemtype params)}
                          {:author author})
         posts-map (get-some (:limit params) (:page params) where-clause)]
-    (layout/render "page_user.html" (assoc posts-map :post (assoc (cleanup usr) :avatar avatar)))))
+    (layout/render "page_user.html" (assoc posts-map :post (assoc (cleanup usr) :avatar avatar :apikey apikey)))))

 (defn render-page-user [params]
   (if-let [usr (muser/get-user-by-key (:apikey params))]
-    (render-page-user-x params usr)
+    (do (println "by-apikey")
+    (render-page-user-x params usr))
     (if-let [usr (muser/get-user-by-name (:username params))]
-      (render-page-user-x params usr)
+    (do (println "by-name")
+      (render-page-user-x params usr))
       (render-page-plain "User does not exist."))))

 (defn render-page-stream [params]
@@ -148,7 +151,7 @@
     (do
       (println (str "xxx: " sizes resized))
       (println (str "store-image: " (:url params)))
-        (if-let [need (gfx/needs-resize? sizes resized)]
+        (if-let [need (gfx/needs-resize? sizes resized abs-filename)]
           (let [r (gfx/resize img abs-filename (first resized) (second resized))
                 params (assoc params :meta (assoc (:meta params) :thumb (util/file-extension abs-filename)
                                                                  :thumbsize (clojure.string/join ":" resized)))]
@@ -239,8 +242,7 @@
                            :page (util/int-or-default page 1)
                            :itemtype (util/string-or-default type)})))
   (GET  "/meta/:apikey" [apikey page limit type]
-    (render-page-user {:username (muser/get-user-by-key apikey)
-                       :limit (util/int-or-default limit 10)
+    (render-page-user {:limit (util/int-or-default limit 10)
                        :page (util/int-or-default page 1)
                        :itemtype (util/string-or-default type)
                        :apikey apikey}))


Leave things like you found them

Leave things like you found them

--- integration-tests/apps/ring/basic-ring/test/basic_ring/test/reload.clj
+++ integration-tests/apps/ring/basic-ring/test/basic_ring/test/reload.clj
@@ -35,19 +35,22 @@
 (let [path "/test-reload"]

   (deftest test-reload-changes
-    (web/start path reload-test-handler)
-    (is (= "foo" (:body (http/get (str (util/app-uri) path)))))
-    (drool "bar")
-    (is (= "bar" (:body (http/get (str (util/app-uri) path)))))
-    (web/start path #'reload-test-handler)
-    (is (= "bar" (:body (http/get (str (util/app-uri) path)))))
-    (drool "foo")
-    (is (= "foo" (:body (http/get (str (util/app-uri) path)))))
-    (let [handler reload-test-handler]
-      (web/start path handler)
+    (try
+      (web/start path reload-test-handler)
       (is (= "foo" (:body (http/get (str (util/app-uri) path)))))
       (drool "bar")
-      (is (= "bar" (:body (http/get (str (util/app-uri) path)))))))
+      (is (= "bar" (:body (http/get (str (util/app-uri) path)))))
+      (web/start path #'reload-test-handler)
+      (is (= "bar" (:body (http/get (str (util/app-uri) path)))))
+      (drool "foo")
+      (is (= "foo" (:body (http/get (str (util/app-uri) path)))))
+      (let [handler reload-test-handler]
+        (web/start path handler)
+        (is (= "foo" (:body (http/get (str (util/app-uri) path)))))
+        (drool "bar")
+        (is (= "bar" (:body (http/get (str (util/app-uri) path))))))
+      (finally
+        (drool "foo"))))

   (deftest test-shadowed-var
     (let [wrong-handler (constantly


update trig docstrings

update trig docstrings

--- src/overtone/sc/ugen/trig.clj
+++ src/overtone/sc/ugen/trig.clj
@@ -23,7 +23,7 @@
        :doc "outputs one for dur seconds whenever the input goes from negative to positive"}

       {:name "Trig", :extends "Trig1"
-       :doc "outputs the level of the triggering input when it goes from negative to positive"}
+       :doc "When a nonpositive to positive transition occurs at the input, Trig outputs the level of the triggering input for the specified duration, otherwise it outputs zero."}

       {:name "TDelay"
        :args [{:name "trig", :default 0.0 :doc "input trigger signal."}
@@ -104,7 +104,7 @@
               {:name "step", :default 1 :doc "step value each trigger. May be negative."}
               {:name "resetval" :default 1 :doc "value to which the counter is reset when it receives a reset trigger."}] ; TODO MAYBE? allow :default :min
        :check [same-rate-as-first-input]
-       :doc "triggers increment a counter that loops around from max to min"}
+       :doc "triggers increment a counter which is output as a signal. The counter loops around from max to min by step increments"}

       {:name "PulseDivider"
        :args [{:name "trig", :default 0.0 :doc "trigger. Trigger can be any signal. A trigger happens when the signal changes from non-positive to positive."}
@@ -162,12 +162,13 @@
 This is a better pitch follower than ZeroCrossing, but more costly of CPU. For most purposes the default settings can be used and only in needs to be supplied. Pitch returns two values (via an Array of OutputProxys, see the OutputProxy help file), a freq which is the pitch estimate and hasFreq, which tells whether a pitch was found. Some vowels are still problematic, for instance a wide open mouth sound somewhere between a low pitched short 'a' sound as in 'sat', and long 'i' sound as in 'fire', contains enough overtone energy to confuse the algorithm."}

       {:name "InRange"
-       :args [{:name "in", :default 0.0 :doc "signal to be tested"}
+       :args [{:name "in", :default 0.0 :doc "input signal"}
               {:name "lo", :default 0.0 :doc "low threshold"}
               {:name "hi", :default 1.0 :doc "high threshold"}]
-       :doc "tests if a signal is between lo and hi"}
-
-      {:name "Fold", :extends "InRange"}
+       :doc "Tests if a signal is between lo and hi"}
+
+      {:name "Fold", :extends "InRange"
+       :doc "Folds input wave to within the lo and hi thresholds. This differs from the BinaryOpUGen fold2 in that it allows one to set both low and high thresholds."}

       {:name "Clip"
        :args [{:name "in", :default 0.0 :doc "The signal to be clipped"}
@@ -175,7 +176,8 @@
               {:name "hi", :default 1.0, :doc "High threshold of clipping. Must be greater then lo"}]
        :doc "Clip a signal outside given thresholds. This differs from the BinaryOpUGen clip2 in that it allows one to set both low and high thresholds."}

-      {:name "Wrap", :extends "InRange"}
+      {:name "Wrap", :extends "InRange"
+       :doc "Wraps input wave to the low and high thresholds. This differs from the BinaryOpUGen wrap2 in that it allows one to set both low and high thresholds."}

       {:name "Schmidt", :extends "InRange"
        :doc "outout one when signal greater than high, and zero when lower than low."}


fixed a bug in the analytics/track defmethod argument declaration

--- src-cljs/frontend/analytics/core.cljs
+++ src-cljs/frontend/analytics/core.cljs
@@ -138,7 +138,7 @@
     (supplement-tracking-properties-from-owner properties owner)
     (supplement-tracking-properties-from-state properties current-state)))

-(s/defmethod track :default [{:keys [event-type :- SupportedEvents properties owner current-state]} :as event-data :- AnalyticsEvent]
+(s/defmethod track :default [{:keys [event-type :- SupportedEvents properties owner current-state] :as event-data :- AnalyticsEvent}]
     (segment/track-event event-type (supplement-tracking-properties {:properties properties
                                                                      :owner owner
                                                                      :current-state current-state})))


show 4.5 list items in viewers list

show 4.5 list items in viewers list

--- src-cljs/frontend/components/hud.cljs
+++ src-cljs/frontend/components/hud.cljs
@@ -137,7 +137,7 @@
               can-edit? (not (empty? (:cust app)))
               viewers-truncated? (< 4 viewers-count)
               show-viewers? (and (not (overlay-visible? app))
-                                 (get app :show-viewers? (< 1 viewers-count 5)))]
+                                 (get app :show-viewers? (< 1 viewers-count 6)))]
           (html
             [:div.viewers.hud-item
              {:class (when viewers-truncated? ["truncated"])}


Touch source files before reloading

Touch source files before reloading


chore: fix log status

chore: fix log status


Show argument potential.

Show argument potential.


Fix Error handling

Fix Error handling


prepping to clean up DSL

prepping to clean up DSL

--- src/push/instructions/dsl.clj
+++ src/push/instructions/dsl.clj
@@ -398,6 +398,7 @@
     [(u/merge-snapshot interpreter (using scratch)) scratch]))

+
 (defn save-top-of-binding
   "Takes a PushDSL blob, a scratch keyword, and a second :as scratch keyword; looks up the top item in the binding keyed by the first argument, and stores that value (which may be nil) in the second scratch variable. Exception if there is no :as argument. Fine if the result is nil."
   [[interpreter scratch] which & {:keys [as]}]


add test for 2 mb strings

add test for 2 mb strings

--- test/clj/backtype/storm/serialization_test.clj
+++ test/clj/backtype/storm/serialization_test.clj
@@ -47,6 +47,7 @@
   (is-roundtrip ["a" "bb" "cde"])
   (is-roundtrip [(mk-string (* 64 1024))])
   (is-roundtrip [(mk-string (* 1024 1024))])
+  (is-roundtrip [(mk-string (* 1024 1024 2))])
   )

 (deftest test-clojure-serialization


CMR-1589: Fixed merge issue

CMR-1589: Fixed merge issue

--- umm-spec-lib/src/cmr/umm_spec/umm_to_xml_mappings/iso19115_2.clj
+++ umm-spec-lib/src/cmr/umm_spec/umm_to_xml_mappings/iso19115_2.clj
@@ -18,16 +18,47 @@
    :xmlns:swe "http://schemas.opengis.net/sweCommon/2.0/"
    :xmlns:gsr "http://www.isotc211.org/2005/gsr"})

+(defn- date-mapping
+  "Returns the date element mapping for the given name and date value in string format."
+  [date-name value]
+  [:gmd:date
+   [:gmd:CI_Date
+    [:gmd:date
+     [:gco:DateTime value]]
+    [:gmd:dateType
+     [:gmd:CI_DateTypeCode {:codeList "http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode"
+                            :codeListValue date-name} date-name]]]])
+
 (def umm-c-to-iso19115-2-xml
   [:gmi:MI_Metadata
    iso19115-2-xml-namespaces
+   [:gmd:fileIdentifier (char-string-from "/EntryTitle")]
+   [:gmd:language (char-string "eng")]
+   [:gmd:characterSet
+    [:gmd:MD_CharacterSetCode {:codeList "http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#MD_CharacterSetCode"
+                               :codeListValue "utf8"} "utf8"]]
+   [:gmd:hierarchyLevel
+    [:gmd:MD_ScopeCode {:codeList "http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#MD_ScopeCode"
+                        :codeListValue "series"} "series"]]
+   [:gmd:contact {:gco:nilReason "missing"}]
+   [:gmd:dateStamp
+    [:gco:DateTime "2014-08-25T15:25:44.641-04:00"]]
+   [:gmd:metadataStandardName (char-string "ISO 19115-2 Geographic Information - Metadata Part 2 Extensions for imagery and gridded data")]
+   [:gmd:metadataStandardVersion (char-string "ISO 19115-2:2009(E)")]
+
+
    [:gmd:identificationInfo
     [:gmd:MD_DataIdentification
      [:gmd:citation
       [:gmd:CI_Citation
        [:gmd:title (char-string-from "/EntryTitle")]
+       (date-mapping "revision" "2000-12-31T19:00:00-05:00")
+       (date-mapping "creation" "2000-12-31T19:00:00-05:00")
        [:gmd:identifier
         [:gmd:MD_Identifier
-         [:gmd:code (char-string-from "/EntryId/Id")]]]]]]]])
+         [:gmd:code (char-string-from "/EntryId/Id")]]]]]
+     [:gmd:abstract (char-string-from "/Abstract")]
+     [:gmd:purpose {:gco:nilReason "missing"}]
+     [:gmd:language (char-string "eng")]]]])


fixed tests

fixed tests

--- test/iwaswhere_web/stats_award_points_test.clj
+++ test/iwaswhere_web/stats_award_points_test.clj
@@ -32,17 +32,20 @@

 (deftest award-point-stats-test
   (testing "works with empty stats list"
-    (is (= {:total 0}
+    (is (= {:total         0
+            :total-skipped 0}
            (aw/award-points-by :habit {} []))))
   (testing "sums correctly"
-    (is (= {:by-day {"2017-03-23" {:habit 30}
-                     "2017-03-24" {:habit 190}
-                     "2017-03-25" {:habit 185}
-                     "2017-03-26" {:habit 225}}
-            :total  630}
+    (is (= {:by-day        {"2017-03-23" {:habit 30}
+                            "2017-03-24" {:habit 190}
+                            "2017-03-25" {:habit 185}
+                            "2017-03-26" {:habit 225}}
+            :total         630
+            :total-skipped 0}
            (aw/award-points-by :habit {} entries))))
   (testing "ignores entry when not done"
-    (is (= {:by-day {"2017-03-24" {:habit 10}
-                     "2017-03-25" {:habit 100}}
-            :total  110}
+    (is (= {:by-day        {"2017-03-24" {:habit 10}
+                            "2017-03-25" {:habit 100}}
+            :total         110
+            :total-skipped 0}
            (aw/award-points-by :habit {} entries2)))))


Don't turn interval keywords into var params!

--- src/afterglow/effects/oscillators.clj
+++ src/afterglow/effects/oscillators.clj
@@ -110,8 +110,7 @@
   for an expanded explanation illustrated with graphs.)"
   [shape-fn & {:keys [interval interval-ratio phase] :or {interval :beat interval-ratio 1 phase 0.0}}]
   {:pre [(fn? shape-fn)]}
-  (let [interval (params/bind-keyword-param interval clojure.lang.Keyword :beat)
-        interval-ratio (params/bind-keyword-param interval-ratio Number 1)
+  (let [interval-ratio (params/bind-keyword-param interval-ratio Number 1)
         phase (params/bind-keyword-param phase Number 0)]
     (if (not-any? params/param? [interval interval-ratio phase])  ; Can optimize case with no dynamic parameters
       (fixed-oscillator shape-fn interval interval-ratio phase)


Prevent compojure-api handle unknown exceptions

--- src/asciinema/endpoint/asciicasts.clj
+++ src/asciinema/endpoint/asciicasts.clj
@@ -7,8 +7,12 @@
             [ring.util.http-response :as response]
             [schema.core :as s]))

+(defn exception-handler [^Exception e data request]
+  (throw e))
+
 (defn asciicasts-endpoint [{:keys [db file-server]}]
   (api
+   {:exceptions {:handlers {:compojure.api.exception/default exception-handler}}}
    (context
     "/a" []
     (GET "/:token.json" []


CMR-1246: Add message-queue-history atom to track message processing in integration tests

--- dev-system/src/cmr/dev_system/queue_broker_wrapper.clj
+++ dev-system/src/cmr/dev_system/queue_broker_wrapper.clj
@@ -9,7 +9,146 @@
             [cmr.message-queue.services.queue :as queue]
             [cmr.message-queue.config :as iconfig]
             [cmr.common.log :as log :refer (debug info warn error)]
-            [clojure.set :as set]))
+            [clojure.set :as set]
+            [cmr.common.util :as util]))
+
+(def message-queue-history
+  "A vector of message queue maps. A new message queue map is added every time an action takes
+  place on the message queue. A message queue map contains an action and a list of
+  messages.  See message-queue-history-example for an example."
+  (atom []))
+
+(def valid-action-types
+  "A set of the valid action types for a message queue"
+  #{:reset
+    :enqueue
+    :process})
+
+(defn create-message-queue-history-entry
+  "Create a message queue history map. Takes an action, the data associated with that action
+  and the result of that action."
+  [action-type data resulting-state]
+  (when-not (valid-action-types action-type)
+    (throw (Exception. (str "Unknown action-type: " action-type))))
+  (let [data-with-state (when (seq data) (assoc data :state resulting-state))
+        messages (case action-type
+                   :reset []
+                   (:enqueue :process)
+                   (when (seq data)
+                     (-> (peek @message-queue-history)
+                         :messages
+                         ;; Replace the given concept ID and revision ID with the updated message
+                         (->> (remove #(and (= (:concept-id data) (:concept-id %))
+                                            (= (:revision-id data (:revision-id %))))))
+                         (conj data-with-state))))
+        new-action (util/remove-nil-keys {:action-type action-type
+                                          :data data-with-state})]
+    {:action new-action
+     :messages messages}))
+
+
+(defn update-message-queue-history
+  "TODO"
+  [action-type data resulting-state]
+  (swap! message-queue-history
+         conj
+         (create-message-queue-history-entry action-type data resulting-state)))
+
+(comment
+  (update-message-queue-history :enqueue
+                                {:concept-id "C3-PROV1"
+                                 :revision-id 1
+                                 :id 1}
+                                :initial)
+
+  (update-message-queue-history :reset
+                                {}
+                                nil)
+
+  (:messages (peek @message-queue-history))
+  )
+
+(def message-queue-history-example
+  [
+   ;; initial message queue state
+   {:action {:action-type :reset}
+    :messages []}
+
+   ;; message put on the queue
+   {:action {:action-type :enqueue
+             :data {:concept-id "C1-PROV1"
+                    :revision-id 1
+                    :id 1
+                    :state :initial}}
+    :messages [{:concept-id "C1-PROV1"
+                :revision-id 1
+                :id 1
+                :state :initial}]}
+
+   ;; message put on the queue
+   {:action {:action-type :enqueue
+             :data {:concept-id "C2-PROV1"
+                    :revision-id 1
+                    :id 2
+                    :state :initial}}
+    :messages [{:concept-id "C1-PROV1"
+                :revision-id 1
+                :id 1
+                :state :initial}
+               {:concept-id "C2-PROV1"
+                :revision-id 1
+                :id 2
+                :state :initial}]}
+
+   ;; Successfully process one
+   {:action {:action-type :process
+             :data {:concept-id "C1-PROV1"
+                    :revision-id 1
+                    :id 1
+                    :state :initial}}
+    :response {:status :ok}
+    :messages [{:concept-id "C1-PROV1"
+                :revision-id 1
+                :id 1
+                :state :processed}
+               {:concept-id "C2-PROV1"
+                :revision-id 1
+                :id 2
+                :state :initial}]}
+   ])
+
+(comment
+
+
+  (defn current-states
+    []
+    (map :state (:messages (peek message-queue-history-example))))
+
+  (current-states)
+
+  (defn messages+id->message
+    [messages id]
+    (first (filter #(= id (:id %)) messages)))
+
+  (defn concept-history
+    "Returns a map of concept id revision id tuples to the sequence of states for each one"
+    []
+    (let [int-states (for [mq message-queue-history-example
+                           :when (not= (get-in mq [:action :action-type]) :reset)
+                           :let [{{:keys [action-type]
+                                   {:keys [concept-id revision-id id]} :data} :action} mq
+                                 result-state (:state (messages+id->message (:messages mq) id))]]
+                       {[concept-id revision-id] [{:action action-type :result result-state}]})]
+      (apply merge-with concat int-states)))
+
+  (concept-history)
+
+  {["C2-PROV1" 1] [{:action :enqueue, :result :initial}],
+   ["C1-PROV1" 1] ({:action :enqueue, :result :initial}
+                   {:action :process, :result :processed})}
+  )
+
+

 (def message-id-key
   "Key used to track messages within a message map. Each message will have a unique id."
@@ -31,7 +170,8 @@
     (throw (Exception. (str "Unknown state: " state))))
   (let [message-state-atom (:message-state-atom broker-wrapper)
         message-id (message-id-key msg)]
-    (swap! message-state-atom #(assoc % message-id state))))
+    (swap! message-state-atom #(assoc % message-id state))
+    state))

 (defn handler-wrapper
   "Wraps handler function to count acks, retries, fails"
@@ -45,17 +185,17 @@
       ;; if in :normal mode do the same thing as before
       ;; if in :failure mode return
       ;; {:status :retry :message "Queue is in failure mode"}
-      (let [resp (handler context msg)]
-        (debug "Processing message")
-        (case (:status resp)
-          :ok (set-message-state broker-wrapper msg :processed)
-
-          :retry (when (queue/retry-limit-met? msg (count (iconfig/rabbit-mq-ttls)))
-                   (set-message-state broker-wrapper msg :failed))
-
-          :fail (set-message-state broker-wrapper msg :failed)
-
-          (throw (Exception. (str "Invalid response: " (pr-str resp)))))
+      (let [resp (handler context msg)
+            message-state (case (:status resp)
+                            :ok (set-message-state broker-wrapper msg :processed)
+
+                            :retry (when (queue/retry-limit-met? msg (count (iconfig/rabbit-mq-ttls)))
+                                     (set-message-state broker-wrapper msg :failed))
+
+                            :fail (set-message-state broker-wrapper msg :failed)
+
+                            (throw (Exception. (str "Invalid response: " (pr-str resp)))))]
+        (update-message-queue-history :process msg message-state)
         resp))))

 (defn- current-message-states
@@ -136,6 +276,7 @@

       ;; Set the initial state of the message to :initial
       (set-message-state this tagged-msg :initial)
+      (update-message-queue-history :enqueue tagged-msg :initial)

       ;; delegate the request to the wrapped broker
       (queue/publish queue-broker queue-name tagged-msg)))
@@ -162,31 +303,35 @@
       (queue/reset queue-broker)
       (reset! message-state-atom {})
       (reset! id-sequence-atom 0)
+      (reset! message-queue-history [])
       (finally
         (reset! resetting?-atom false)))))

 (defn wait-for-indexing
   "Wait for all messages to be marked as processed"
   [broker-wrapper]
+  ; (Thread/sleep 10)
+  ; nil)
   (wait-for-states broker-wrapper [:processed]))

 ;; TODO
 #_(def valid-message-modes
-  "A list of the modes in which the message queue broker can operate.
-  :normal - message functions are called and processed as they normally would.
-  :retry - all messages return a retry when they are processed."
-  #{:normal :retry})
+    "A list of the modes in which the message queue broker can operate.
+    :normal - message functions are called and processed as they normally would.
+    :retry - all messages return a retry when they are processed."
+    #{:normal
+      :retry})

 ;; TODO
 #_(defn set-message-mode
-  "Used to toggle message queue between normal mode and failure mode. In normal mode messages are
-  processed normally. In failure mode all messages return failures. The failure mode is useful for
-  automated tests verifying specific behaviors on failure."
-  [mode]
-  (if (valid-message-modes mode)
-    ;; Use an atom to set state?
-    "TODO"
-    (throw (Exception. (str "Invalid message queue mode: " mode)))))
+    "Used to toggle message queue between normal mode and failure mode. In normal mode messages are
+    processed normally. In failure mode all messages return failures. The failure mode is useful for
+    automated tests verifying specific behaviors on failure."
+    [mode]
+    (if (valid-message-modes mode)
+      ;; Use an atom to set state?
+      "TODO"
+      (throw (Exception. (str "Invalid message queue mode: " mode)))))

 (defn create-queue-broker-wrapper


Unbreak cljs tests.

Unbreak cljs tests.

--- test/active/clojure/config_test.cljc
+++ test/active/clojure/config_test.cljc
@@ -1,6 +1,6 @@
 (ns ^:config active.clojure.config-test
   (:require [active.clojure.config :as c]
-            #?(:cljs [clojure.test :as t])
+            #?(:cljs [cljs.test :as t])
             #?(:clj [clojure.test :refer :all]))
   #?(:cljs (:require-macros [cljs.test :refer (is deftest run-tests testing)])))


[test] much better testing params

[test] much better testing params

--- test/clj_dstream/generative_test.clj
+++ test/clj_dstream/generative_test.clj
@@ -14,49 +14,12 @@
             [clojure.core.matrix.random :as random]
             [taoensso.tufte :as tufte :refer (defnp p profiled profile)]))

-
-(defn get-random-sample [method properties & {:keys [centroids pos]}]
-  ;;TODO make this sample some actua; distributions....
-  (if centroids
-    (let [the-centroid (get centroids (rand-int (count centroids)))
-          {:keys [row col]} pos
-
-          ]
-      (n/noise2 (* row 0.1) (* col 0.25))
-      (vec
-        (map-indexed (fn [idx {:keys [::core/domain-start ::core/domain-end]}]
-                       (max domain-start (min domain-end (+ domain-start
-
-                                                            ;(rand (- domain-end domain-start))
-                                                            (+ (get the-centroid idx) (/ (first (random/sample-normal 1)) 10.0))
-                                                            ))))
-                     (::core/phase-space properties))))
-    (case method
-      :normal (vec
-                (map-indexed (fn [idx {:keys [::core/domain-start ::core/domain-end]}]
-                               (max domain-start (min domain-end (first (random/sample-normal 1)))))
-                             (::core/phase-space properties)))
-      :unifrom
-      (vec
-        (map-indexed (fn [idx {:keys [::core/domain-start ::core/domain-end]}]
-                       (max domain-start (min domain-end (+ domain-start (rand (- domain-end domain-start))))))
-                     (::core/phase-space properties))))
-    ))
-
-
-(def test-matrix
-  (->> (for [y (range 10) x (range 50)] (n/noise2 (* x 0.1) (* y 0.25)))
-       (viz/matrix-2d 50 10)))
-
 (defn grids-2d->heatmap-vec [grid-cells props & {:keys [clusters-only]}]
   (let [phase-space (::core/phase-space props)
         d1          (first phase-space)
         d2          (second phase-space)
         rows        (int (/ (- (::core/domain-end d1) (::core/domain-start d1)) (::core/domain-interval d1)))
         cols        (int (/ (- (::core/domain-end d2) (::core/domain-start d2)) (::core/domain-interval d2)))]
-
-    (println "rows, cols: " rows cols)
-
     (let [vecs
           (for [c (range cols) r (range rows)]
             (let [num (or
@@ -65,25 +28,19 @@
                             (if (and (not (= nil cluster))
                                      (not (= "NO_CLASS" cluster)))
                               (do
-                                (println "cluster:" cluster)
                                 (::core/density-at-last-update (get grid-cells [r c])))
                               (/ (rand) 10000))))
                         (::core/density-at-last-update (get grid-cells [r c]))
                         (/ (rand) 10000))]
-              num
-              ))]
-
+              num))]
       {:matrix (->>
                  vecs
-                 (viz/matrix-2d rows cols)
-                 )
+                 (viz/matrix-2d rows cols))
        :rows   rows
-       :cols   cols})
-    ))
+       :cols   cols})))

 (defn heatmap-spec
   [id the-matrix]
-  (println "id, matrix: " id the-matrix)
   {:matrix        the-matrix
    :value-domain  (viz/value-domain-bounds the-matrix)
    :palette       (->> id (grad/cosine-schemes) (apply grad/cosine-gradient 100))
@@ -135,8 +92,24 @@
   )

-
-
+(defn sample-at-time [t time-intervals props]
+  (hash-map
+    ::core/raw-datum
+    {::core/position-value
+                  (vec (take (::core/dimensions props)
+                             (repeatedly
+                               (fn []
+                                 (let [r (rand)]
+                                   (cond (< t (int (/ time-intervals 2))) (+ 0.1
+                                                                             (* 0.2
+                                                                                (first
+                                                                                (random/sample-normal 1))))
+                                         :else (-
+                                                 (* 0.2
+                                                    (first
+                                                      (random/sample-normal 1)))
+                                                 0.4)))))))
+     ::core/value 1.0}))

 (deftest stuff
   (let [test-props     {::core/c_m         3.0
@@ -147,32 +120,14 @@
                         ::core/phase-space [
                                             {::core/domain-start    -1.0
                                              ::core/domain-end      1.0
-                                             ::core/domain-interval 0.2}
+                                             ::core/domain-interval 0.1}
                                             {::core/domain-start    -1.0
                                              ::core/domain-end      1.0
-                                             ::core/domain-interval 0.2}]
+                                             ::core/domain-interval 0.1}]
                         ::core/gap-time    500}
-        time-intervals 50000
+        time-intervals 10000
         samples        (map (fn [t]
-                              (hash-map
-                                ::core/raw-datum
-                                {::core/position-value
-                                              (vec
-                                                (take
-                                                  (::core/dimensions test-props)
-                                                  (repeatedly
-                                                    (fn []
-                                                      (let [r (rand)]
-                                                        (cond (< t (int (/ time-intervals 2))) (+ 0.1
-                                                                                (* 0.15
-                                                                                (first
-                                                                                (random/sample-normal 1))))
-                                                              :else (-
-                                                                      (* 0.15
-                                                                         (first
-                                                                           (random/sample-normal 1)))
-                                                                      0.3)))))))
-                                 ::core/value 1.0})
+                              (sample-at-time t time-intervals test-props)
                               ) (range time-intervals))

         test-state     {::core/state {::core/grid-cells           {}
@@ -180,7 +135,7 @@
                                       ::core/initialized-clusters false}}

         _              (println "samples count: " (count samples))
-        [{:keys [final-state state-ts]} prof-stats] (profiled {} (core/dstream-iterations test-state samples :state-append-every 100))
+        [{:keys [final-state state-ts]} prof-stats] (profiled {} (core/dstream-iterations test-state samples :state-append-every (int (/ time-intervals 20))))
         final-grids    (::core/grid-cells final-state)
         sorted-stats   (take 3 (sort-by #(* -1 (:mean (second %))) (:id-stats-map prof-stats)))
         displayable    (display-state "final" test-props (::core/grid-cells final-state))]


Fix missing import.

Fix missing import.

--- clojure/src/advent2017/day9.clj
+++ clojure/src/advent2017/day9.clj
@@ -3,7 +3,7 @@
   ignoring the discard garbage. Part 1 is the sum of the depths of the groups.
   Part 2 is the sum of the number of non-discard garbage."
   (:require [instaparse.core :as insta]
-            [advent2017.core :refer [read-puzzle ->lines]]))
+            [advent2017.core :refer [read-puzzle ->lines bfs-lazy]]))

 (def puzzle (read-puzzle "day9.data" (comp first ->lines)))


Show a cursor pointer over group-type choices

--- src/braid/client/register/styles.cljs
+++ src/braid/client/register/styles.cljs
@@ -153,7 +153,8 @@
        :border "1px solid #eee"
        :padding [["0.75rem" "1rem" "1.0rem"]]
        :border-radius border-radius
-       :position "relative"}
+       :position "relative"
+       :cursor "pointer"}

       [:&.checked
        [:&::after


Remove unused global sites var

Remove unused global sites var

--- src/clj/comic_reader/site_scraper.clj
+++ src/clj/comic_reader/site_scraper.clj
@@ -18,8 +18,6 @@
        (map make-site-entry)
        flatten
        (apply hash-map)))
-
-(def sites (dissoc (get-sites) "test-site"))

 (defprotocol ISiteScraper
   (list-sites  [this]           "Returns the list of sites this scraper supports.")


increase pending tasks in thread pool

increase pending tasks in thread pool

--- src/clj/neb/durability/serv/trunk.clj
+++ src/clj/neb/durability/serv/trunk.clj
@@ -54,7 +54,7 @@
         seg-size (read-int-from-stream reader)
         thread-size (cp/ncpus)
         recover-seg-pool (cp/threadpool thread-size :name "Recover-Seg")
-        recover-seg-semaphore (Semaphore. (int thread-size))]
+        recover-seg-semaphore (Semaphore. (int (* 2 thread-size)))]
     (try
       (while (> (.available reader) 0)
         (let [seg-append-header (read-int-from-stream reader)


mock out start game action

mock out start game action

--- src/cljs/battlebots/panels/admin.cljs
+++ src/cljs/battlebots/panels/admin.cljs
@@ -49,13 +49,18 @@
                        :confirmed #(re-frame/dispatch [:remove-game (:_id record)])
                        :type :option}]))

-(defn start-game-action
-  "starts a game"
+(defn initialize-game-action
+  "initializes a game"
   [record]
   (re-frame/dispatch [:display-alert
                       {:title (str "Are you sure you want to initialize this game?")
                        :confirmed #(re-frame/dispatch [:initialize-game (:_id record)])
                        :type :option}]))
+
+(defn start-game-action
+  "starts a game"
+  [record]
+  (println "TODO: Start game"))

 (defn render-games
   "renders games table"
@@ -75,8 +80,11 @@
                                    :remove (fn [record]
                                              [:button {:on-click #(remove-game-action record)} "Remove Game"])
                                    :game-action (fn [record]
-                                                  (if (= (:state record) "pending")
-                                                    [:button {:on-click #(start-game-action record)} "Initialize Game"]))}})]))
+                                                  (cond
+                                                   (= (:state record) "pending")
+                                                   [:button {:on-click #(initialize-game-action record)} "Initialize Game"]
+                                                   (= (:state record) "initialized")
+                                                   [:button {:on-click #(start-game-action record)} "Start Game"]))}})]))

 (defn show-active-panel
   []


gtag clj 1st try

gtag clj 1st try

--- src/clojurescript/nossal/app/app.cljs
+++ src/clojurescript/nossal/app/app.cljs
@@ -4,11 +4,12 @@

 (enable-console-print!)

-(defn alert-me [what]
-  (.log js/console what))
+(defn alert! [what]
+  (do (println what)
+      (.log js/console what)))

 (defn online-status [e]
-  (alert-me (if (.-navigator.onLine js/self) "ONLINE!" "OFFLINE!")))
+  (alert! (if (.-navigator.onLine js/self) "ONLINE!" "OFFLINE!")))

 (defn is-service-worker-supported? []
@@ -54,9 +55,10 @@
 (set! js/dataLayer (if (exists? js/dataLayer) js/dataLayer (clj->js [])))

 (defn gtag [& args]
-  (println args)
-  (.push js/dataLayer (clj->js args)))
+  (do (alert! args)
+      (.push js/dataLayer (clj->js args))))

+(set! js/gtag gtag)

 (defn analytics-setup [data]
   (gtag "js" (clj->js (js/Date.)))
@@ -68,7 +70,7 @@
         (when-let [elements (not-empty (->Array (.querySelectorAll js/document (:selector conf))))]
           (doseq [element elements]
             (.addEventListener element (:on conf) (fn [e] (gtag (:requst conf) (:on conf) (:vars conf))))))
-        "visible" (println ">>>> " (:request conf))
+        "visible" (alert! ">>>> " (:request conf))
         (.addEventListener js/document (:on conf) (fn [e] (gtag (:requst conf) (:on conf) (:vars conf))))))))
       ; (if (= "click" (:on conf))
       ;   (when-let [elements (not-empty (->Array (.querySelectorAll js/document (:selector conf))))]


BREAKING: Refactor session store API

BREAKING: Refactor session store API

`make-carmine-store` now takes connection pool and spec as mandatory args.

--- src/taoensso/carmine/ring.clj
+++ src/taoensso/carmine/ring.clj
@@ -7,12 +7,15 @@

 (defn new-session-key [prefix] (str prefix ":" (UUID/randomUUID)))

-(defmacro wc [& body] `(carmine/with-conn @~'pool-atom @~'spec-atom ~@body))
+(defmacro wc
+  [& body]
+  `(let [{pool# :pool spec# :spec} @~'conn-atom]
+     (carmine/with-conn pool# spec# ~@body)))

 (defprotocol ICarmineSessionStore
   (reset-conn [this pool spec]))

-(defrecord CarmineSessionStore [pool-atom spec-atom prefix expiration]
+(defrecord CarmineSessionStore [conn-atom prefix expiration]
   session-store/SessionStore
   (read-session   [_ key] (or (when key (wc (carmine/get key))) {}))
   (delete-session [_ key] (wc (carmine/del key)) nil)
@@ -24,16 +27,15 @@
       key))

   ICarmineSessionStore
-  (reset-conn [_ pool spec]
-    (reset! pool-atom pool)
-    (reset! spec-atom spec)))
+  (reset-conn [_ pool spec] (reset! conn-atom {:pool pool :spec spec})))

 (defn make-carmine-store
   "Creates and returns a Carmine-backed Ring SessionStore. Use `expiration-secs`
   to specify how long session data will survive after last write. When nil,
   sessions will never expire."
-  [& {:keys [connection-pool connection-spec key-prefix expiration-secs]
+  [connection-pool connection-spec
+   & {:keys [key-prefix expiration-secs]
       :or   {key-prefix       "carmine:session"
              expiration-secs  (str (* 60 60 24 30))}}]
-  (CarmineSessionStore. (atom connection-pool) (atom connection-spec)
+  (CarmineSessionStore. (atom {:pool connection-pool :spec connection-spec})
                         key-prefix (str expiration-secs)))


Cleaned up parser a bit.

Cleaned up parser a bit.

--- formatter/src/formatter/parser.clj
+++ formatter/src/formatter/parser.clj
@@ -1,48 +1,15 @@
 (ns formatter.parser
   (require [instaparse.core :as insta]))
-;(insta/set-default-output-format! :enlive)
 (insta/set-default-output-format! :hiccup)

-(def grammar-whitespace
-  (insta/parser
-    "Whitespace = #'[,\\s]+'"))
+(def grammar-whitespace (insta/parser "Whitespace = #'[,\\s]+'"))

 ; Doesn't have Other Special Forms, Binding Forms
 (def grammar (slurp "src/formatter/grammar.txt"))
-(def str-str (slurp "src/formatter/string.txt"))

 (def par (insta/parser grammar :auto-whitespace grammar-whitespace))
 (defn parser [s & args]
   (par s :unhide :content))

-(def string-simple
-"(cons 4 [1 23])")
-
-(def string-bool
-"(if false false true)")
-
-(def string-int
-"65 13 199 5r13 (!set zoo 9)")
-
-(def string-quotes
-"(str\"Zeus\"\"Hera\")")
-
-(def string-reify
-"(reify FormatterExtension
-  (is-active [this] true)
-  (modify-string [this x] x))")
-
-(def string-40
-"(fn custom-interpose [sep, in-seq]
-  (butlast (flatten
-   (map (fn [in, sep] [in sep]) in-seq (take (count in-seq) (repeat sep))))))")
-
-(def string-when-not
-"(when (not pred )
-       foo
-       bar)")
-(def tree-when-not (parser string-when-not :unhide :content))
-(def t-node (nth tree-when-not 1))
-
 (defn htree-to-str [tree]
   (apply str (filter string? (flatten tree))))


Implemented a list to finger-tree convenience function.

--- PersistentDataStructures/finger_trees.clj
+++ PersistentDataStructures/finger_trees.clj
@@ -86,6 +86,14 @@
                 (delay (push-back m-forced (apply make-node-3 monoid (tser r)))))
             [(last r) a])))

+; Convenience function to convert a list into a finger tree
+(defn to-tree [monoid vec] (
+    (fn [tree vec] (if (empty? vec)
+        tree
+        (recur (push-back tree (first vec)) (rest vec))))
+    (make-finger-tree-empty monoid)
+    vec))
+
 (defn nodes [monoid a b & r]
     (case (count r)
         0 [(make-node-2 monoid a b)]


Remove traces

Remove traces

--- api/src/geocommit/config.clj
+++ api/src/geocommit/config.clj
@@ -21,7 +21,7 @@
   (let [file (condp = @used-config
                     :production "production.properties"
                     "development.properties")]
-    (t/trace (.getProperty
+    (.getProperty
       (jutils/read-properties
         (File. (.toURI (jio/resource file))))
-      (t/trace key)))))
+      key)))


Sync up clj-refactor and refactor-repl versions

--- lein/profiles.clj
+++ lein/profiles.clj
@@ -1,3 +1,3 @@
 {:user {:plugins [[cider/cider-nrepl "0.10.0-snapshot"]
-                  [refactor-nrepl "1.1.0"]]
+                  [refactor-nrepl "1.2.0-SNAPSHOT"]]
         :dependencies [[org.clojure/tools.nrepl "0.2.7"]]}}


matcher-combinators: Move `exception-matching-test` to end

--- test/com/nomistech/clojure_the_language/c_800_libraries/s_106_matcher_combinators/matcher_generators_test.clj
+++ test/com/nomistech/clojure_the_language/c_800_libraries/s_106_matcher_combinators/matcher_generators_test.clj
@@ -74,11 +74,6 @@
   (is (match? (m/equals {:a 1 :b even?})
               {:a 1 :b 1234})))

-(deftest exception-matching-test
-  (is (thrown-match? clojure.lang.ExceptionInfo
-                     {:foo 1}
-                     (throw (ex-info "Boom!" {:foo 1 :bar 2})))))
-
 (deftest sequences-test
   ;; A sequence is interpreted as an `equals` matcher, which specifies count and
   ;; order of matching elements. The elements are matched based on their types.
@@ -137,6 +132,11 @@
               1234)) ; TODO: I guess we need this in contexts where `even?` would not be treated as a pred -- but what are those contexts?
   )

+(deftest exception-matching-test
+  (is (thrown-match? clojure.lang.ExceptionInfo
+                     {:foo 1}
+                     (throw (ex-info "Boom!" {:foo 1 :bar 2})))))
+
 ;;;; TODO: There's more. Continue going through the documentation at
 ;;;;       https://github.com/nubank/matcher-combinators and adding
 ;;;;       examples here.


Better inline-comment detection

Better inline-comment detection

--- src/atom_finder/function_dump.clj
+++ src/atom_finder/function_dump.clj
@@ -93,23 +93,26 @@
         in-function-offset? #(and (not (function-node? %1))
                                   (offset %1)
                                   (function-offset-set (offset %1)))
+        all-nodes  (flatten-tree root)
+        all-node-lines (set (mapcat (juxt start-line end-line) all-nodes))
+        inline-comment? #(all-node-lines (start-line %)) ; does a comment appear on the same line as an AST node
         [fn-comments global-comments] (separate in-function-offset? comments)
         [fn-comment-line-set global-comment-line-set] (for [comments [fn-comments global-comments]]
                                                         (->> comments ; the lines this comment is likely talking about
                                                            (map (fn [cmnt]
-                                                                  (if (.isBlockComment cmnt)
+                                                                  (if (inline-comment? cmnt)
                                                                     [(start-line cmnt) (+ (end-line cmnt) 3)]
                                                                     [(start-line cmnt) (end-line cmnt)])))
                                                            range-set-cc))
         ]
-    (->> root
-         flatten-tree
+    (->> all-nodes
          (concat (all-preprocessor root))
          (filter offset)
          (map (fn [node]
                 {node
                  {:in-function? (in-function-offset? node)
                   :comment ((if (in-function-offset? node) fn-comment-line-set  global-comment-line-set) (start-line node))
+                  ;:line (start-line node)
                   }}))
          (into {}))
     ))
@@ -127,14 +130,38 @@
     (concat atom-cmnts non-atom-cmnts)
     ))

+(->> gcc-path
+      (pmap-dir-trees
+       (juxt filename
+             #(->> %
+                   atoms-by-comments&function
+                   frequencies
+                   (sort-by prn-str))))
+      (map prn)
+      ;(take 10)
+      dorun
+      (log-to "tmp/comments-by-atom-function.txt")
+      time-mins)
+
+;; find examples of atoms outside functions
 '(->> gcc-path
- (pmap-dir-trees
-  (juxt filename
-        #(->> %
-              atoms-by-comments&function
-              frequencies
-              (sort-by prn-str))))
- (map prn)
- (take 3)
- dorun
- time-mins)
+     (pmap-dir-trees (juxt filename atoms-by-comments&function))
+     (mapcat (fn [[filename hashes]] (map #(assoc % :file filename) hashes)))
+     (filter :atom)
+     (remove :in-function?)
+     (remove (comp #{:macro-operator-precedence :preprocessor-in-statement} :atom))
+     (take 10)
+     (map prn))
+
+(->> "int main
+{
+  // comment 1
+  /* comment 2 */
+  /*
+comment 3
+*/
+}
+"
+    parse-source
+    all-comments
+    )


Improvement: Adding page visit age to display

--- src/ui/relevance/display.cljs
+++ src/ui/relevance/display.cljs
@@ -190,14 +190,19 @@
                         label)]
           ^{:key i}
           [:tr
-           [:td {:class "col-sm-2"} (time-display (:time tab))]
-           [:td {:class "col-sm-9 col-sm-offset-1"} [:a
-                                                     {:href url :target "_blank"}
-                                                     (if favicon
-                                                       [:img {:src    favicon
-                                                              :width  16
-                                                              :height 16}])
-                                                     display]]
+           [:td {:class "col-sm-2"}
+            (time-display (:time tab))]
+           [:td {:class "col-sm-8"}
+            [:a
+             {:href url :target "_blank"}
+             (if favicon
+               [:img {:src    favicon
+                      :width  16
+                      :height 16}])
+             display]]
+           [:td {:class "col-sm-2"}
+            (time-display (quot (- (.now js/Date) (:ts tab)) 1000))
+            ]
            ])))))

@@ -214,9 +219,11 @@
           [:thead
            [:tr
             [:th "Time"]
-            [:th "Title"]]]
+            [:th "Title"]
+            [:th "Last visit"]]]
           [:tbody
-           (list-urls @to-list @site-times)]]]]
+           (list-urls @to-list @site-times)
+           ]]]]
        ])
     ))


handle :error in enrich-mq-entries

handle :error in enrich-mq-entries

--- src/brainbot/nozzle/esconnect.clj
+++ src/brainbot/nozzle/esconnect.clj
@@ -76,9 +76,6 @@
           (map convert-entry entries))))))

-
-
-
 (defn es-recursive-delete
   [index-name parent]
   (let [with-slash (misc/ensure-endswith-slash parent)]
@@ -96,13 +93,15 @@

 (defn enrich-mq-entries
   [directory entries]
-  (let [parent-id (make-id "" directory)
-        enrich-entry (fn [entry]
-                       (assoc entry
-                         :id (make-id "" directory (:relpath entry))
-                         :type (get-in entry [:stat :type])
-                         :mtime (get-in entry [:stat :mtime])))]
-    (map enrich-entry entries)))
+  (map
+   (fn [entry]
+     (assoc entry
+       :id (make-id "" directory (:relpath entry))
+       :type (if (:error entry)
+               "error"
+               (get-in entry [:stat :type]))
+       :mtime (get-in entry [:stat :mtime])))
+   entries)


Remove duplicate 'import-live!' from macros file.

--- src/clj/cljs_music/lib/macros.clj
+++ src/clj/cljs_music/lib/macros.clj
@@ -26,53 +26,3 @@
 (defmacro import-namespace-vars [namespaces]
   `(do
      ~@(mapcat namespace-defs namespaces)))
-
-(defmacro import-live! []
-  '(cljs-music.lib.macros/import-namespace-vars
-    [{:ns cljs-bach.synthesis
-      :vars [run-with destination
-             current-time
-
-             connect-> add            ; Synth connectors
-
-             high-pass low-pass       ; Frequency filters
-
-             sawtooth sine square     ; Signal generators
-             triangle white-noise
-             constant
-
-             adsr gain percussive     ; Signal shapers
-             adshr envelope
-
-             stereo-panner reverb     ; Effects
-             delay-line enhance]}
-     {:ns leipzig.scale
-      :vars [A B C D E F G            ; Keys
-             flat high low sharp      ; Key modifiers
-             major minor ionian       ; Scales
-             dorian phrygian lydian
-             mixolydian aeolian
-             locrian blues pentatonic
-             raise lower]}            ; Degree modifiers
-     {:ns leipzig.chord
-      :vars [triad seventh ninth      ; Chords
-             inversion root augment]} ; Chord modifiers
-     {:ns leipzig.melody
-      :vars [phrase then times with   ; Melody makers
-             rhythm having
-             all bpm tempo where      ; Melody modifiers
-             after wherever duration]}
-     {:ns leipzig.temperament
-      :var-prefix "temp-"
-      :vars [equal five-limit-just
-             just meantone pythagorean
-             pythagorean-comma
-             seven-limit-just well
-             werckmeister-i
-             werckmeister-ii
-             werckmeister-iii]}
-     {:ns cljs-music.lib.web-audio
-      :vars [play! play-notes!
-             now loop!]}
-     {:ns cljs-music.lib.midi
-      :vars [set-midi-listener!]}]))


ALL and MAP-VALS perf improvement for small maps

--- src/clj/com/rpl/specter/impl.cljx
+++ src/clj/com/rpl/specter/impl.cljx
@@ -837,7 +837,24 @@
   (all-transform [structure next-fn]
     (mapv next-fn structure))

-  #+clj clojure.lang.PersistentArrayMap #+cljs cljs.core/PersistentArrayMap
+  #+clj
+  clojure.lang.PersistentArrayMap
+  #+clj
+  (all-transform [structure next-fn]
+    (let [k-it (.keyIterator structure)
+          v-it (.valIterator structure)]
+      (loop [ret {}]
+        (if (.hasNext k-it)
+          (let [k (.next k-it)
+                v (.next v-it)
+                [newk newv] (next-fn [k v])]
+            (recur (assoc ret newk newv)))
+          ret
+          ))))
+
+  #+cljs
+  cljs.core/PersistentArrayMap
+  #+cljs
   (all-transform [structure next-fn]
     (non-transient-map-all-transform structure next-fn {})
     )
@@ -923,7 +940,23 @@
     nil
     )

-  #+clj clojure.lang.PersistentArrayMap #+cljs cljs.core/PersistentArrayMap
+  #+clj
+  clojure.lang.PersistentArrayMap
+  #+clj
+  (map-vals-transform [structure next-fn]
+    (let [k-it (.keyIterator structure)
+          v-it (.valIterator structure)]
+      (loop [ret {}]
+        (if (.hasNext k-it)
+          (let [k (.next k-it)
+                v (.next v-it)]
+            (recur (assoc ret k (next-fn v))))
+          ret
+          ))))
+
+  #+cljs
+  cljs.core/PersistentArrayMap
+  #+cljs
   (map-vals-transform [structure next-fn]
     (map-vals-non-transient-transform structure {} next-fn)
     )


don't try to lookup entity without an id

--- src/clj_money/models/accounts.clj
+++ src/clj_money/models/accounts.clj
@@ -38,7 +38,7 @@
   (cond-> account

     ; If no entity is specified, try to look it up
-    (nil? (:entity-id account))
+    (and (:id account) (nil? (:entity-id account)))
     (assoc :entity-id (:entity-id (find-by-id storage
                                               (Integer. (:id account)))))


Add fn to load cards from localStorage

Add fn to load cards from localStorage

--- src/cljs/decktouch/card-data.cljs
+++ src/cljs/decktouch/card-data.cljs
@@ -1,3 +1,13 @@
 (ns decktouch.card-data)

+(defn get-card-list-from-storage []
+  "Get the list of cards from localStorage, or [] if it is empty"
+  (let [key "card-list"
+        list (.getItem js/localStorage key)]
+    (do
+      (.log js/console key list)
+      (if (undefined? list)
+        []
+        (.parse (js/JSON))))))
+
 (def cards [])


Allow no arguments if they are being ignored

--- src/clojure/nightcode/editors.clj
+++ src/clojure/nightcode/editors.clj
@@ -119,7 +119,7 @@
   (ui/config! editor :#redo :enabled? (.canRedo text-area)))

 (defn save-file!
-  [_]
+  [& _]
   (when-let [text-area (get-selected-text-area)]
     (io!
       (with-open [w (io/writer (io/file @ui/tree-selection))]
@@ -130,13 +130,13 @@
   true)

 (defn undo-file!
-  [_]
+  [& _]
   (when-let [text-area (get-selected-text-area)]
     (.undoLastAction text-area)
     (update-buttons! (get-selected-editor) text-area)))

 (defn redo-file!
-  [_]
+  [& _]
   (when-let [text-area (get-selected-text-area)]
     (.redoLastAction text-area)
     (update-buttons! (get-selected-editor) text-area)))
@@ -156,15 +156,15 @@
   (utils/write-pref! :font-size size))

 (defn decrease-font-size!
-  [_]
+  [& _]
   (swap! font-size dec))

 (defn increase-font-size!
-  [_]
+  [& _]
   (swap! font-size inc))

 (defn do-completion!
-  [_]
+  [& _]
   (when-let [{:keys [text-area completer] :as editor-map}
              (get @editors @ui/tree-selection)]
     (when text-area
@@ -185,11 +185,11 @@
   (utils/write-pref! :enable-paredit enable?))

 (defn toggle-paredit!
-  [_]
+  [& _]
   (reset! paredit-enabled? (not @paredit-enabled?)))

 (defn show-paredit-help!
-  [_]
+  [& _]
   (let [commands (->> pw/advanced-keymap
                       (apply concat)
                       (cons #(compare %1 %2))
@@ -211,11 +211,11 @@
         .selectAll))))

 (defn focus-on-find!
-  [_]
+  [& _]
   (focus-on-field! :#find))

 (defn focus-on-replace!
-  [_]
+  [& _]
   (focus-on-field! :#replace))

 (defn find-text!
@@ -608,7 +608,7 @@
        :text-area text-area
        :completer completer
        :close-fn! #(when (.isDirty text-area)
-                     (save-file! nil))
+                     (save-file!))
        :italicize-fn #(.isDirty text-area)
        :should-remove-fn #(not (.exists (io/file path)))
        :toggle-paredit-fn! (init-paredit! text-area is-clojure? is-clojure?)})))


Underline all open files contained in selected directory

--- src/clojure/nightcode/editors.clj
+++ src/clojure/nightcode/editors.clj
@@ -59,7 +59,7 @@
   (let [editor-pane (ui/get-editor-pane)]
     (when @tabs (.closeBalloon @tabs))
     (->> (for [[editor-path {:keys [italicize-fn]}] (reverse @editors)]
-           (let [underline-fn #(= path editor-path)
+           (let [underline-fn #(and path (.startsWith editor-path path))
                  add-italics #(if (italicize-fn) (str "" % "") %)
                  add-underline #(if (underline-fn) (str "" % "") %)]
              (-> editor-path java.io/file .getName add-italics add-underline)))


Add remove-me function to review

Add remove-me function to review

--- src/antlion_clojure/bot.clj
+++ src/antlion_clojure/bot.clj
@@ -285,12 +285,16 @@
                      :channel channel
                      :text "ｹﾝｹﾞﾝｶﾞﾅｲｰﾖ!"}))))

+(defn- remove-me
+  [reviewers slack]
+  (remove #(= (-> slack :rtm-connection :start :self :id) (:id %)) reviewers))
+
 (defn- get-reviewer
   [{:keys [slack dynamodb res] :as opt} usergroups-str]
   (let [usergroups-users (some->> usergroups-str
                                   slack/parse-usergroups
                                   (slack/usergroups-users slack))
-        reviewers (dynamodb/get-all-reviewers dynamodb)]
+        reviewers (-> (dynamodb/get-all-reviewers dynamodb) remove-me)]
     (if (seq usergroups-users)
       (some->> reviewers
                (filter #((set usergroups-users) (:id %)))


:green_tree: Support response to mentions

--- src/antlion_clojure/bot.clj
+++ src/antlion_clojure/bot.clj
@@ -503,10 +503,7 @@
       "rm-response" (rm-response opt (first args))
       "get-all-response" (get-all-response opt)
       "get-page-speed-report" (page-speed-report opt)
-      (map->Payload {:type :message
-                     :user user
-                     :channel channel
-                     :text "ﾊﾞｶｼﾞｬﾈｰﾉ"}))))
+      nil)))

 (defn- matched-response?
   [txt response]
@@ -528,14 +525,16 @@
     (cond
       (and (slack/message-for-me? opt)
                (not (slack/message-from-me? opt)))
-      (cond
-        (dynamodb/get-checking-question? dynamodb user)
-        (check-question opt)
-        (= (-> txt first) \()
-        (eval opt txt)
-        :else (command-message-handler opt))
-      (and (not-empty matched-responses) (not (slack/message-from-me? opt)))
-      (registered-response-handler opt matched-responses)
+      (or
+        (cond (dynamodb/get-checking-question? dynamodb user) (check-question opt)
+              (= (-> txt first) \() (eval opt txt)
+              :else (command-message-handler opt))
+        (and (not-empty matched-responses) (registered-response-handler opt matched-responses))
+        (map->Payload {:type :message
+                       :user user
+                       :channel channel
+                       :text "ﾊﾞｶｼﾞｬﾈｰﾉ"}))
+      (and (not-empty matched-responses) (not (slack/message-from-me? opt))) (registered-response-handler opt matched-responses)
       :else nil)))

 (defn message-handler