Add and use 'config-instance'.

Add and use 'config-instance'.

--- src/org/spootnik/cyanite/config.clj
+++ src/org/spootnik/cyanite/config.clj
@@ -152,6 +152,12 @@
     (info "Loading blacklist rules from: " path)
     (doseq [[k v] (parse-string (slurp path) false)] (set-blacklist-patterns! k v))))

+(defn config-instance
+  [config entity default]
+  (-> config
+      (update-in [entity] (partial merge default))
+      (update-in [entity] get-instance entity)))
+
 (defn config-with-deps
   [config entity default deps]
   (let [settings (merge default (select-keys config deps))]
@@ -174,19 +180,16 @@
     (when-not quiet?
       (println "starting with configuration: " path))
     (-> (load-path path)
-        (update-in [:logging] (partial merge default-logging))
-        (update-in [:logging] get-instance :logging)
+        (config-instance :logging default-logging)
         (update-in [:stats] (partial merge default-stats))
-        (update-in [:store] (partial merge default-store))
-        (update-in [:store] get-instance :store)
+        (config-instance :store default-store)
         (config-with-deps :store-cache default-store-cache [:store])
         (config-with-deps :store-middleware default-store-middleware
                           [:store :store-cache])
         (update-in [:carbon] (partial merge default-carbon))
         (update-in [:carbon :rollups] convert-shorthand-rollups)
         (update-in [:carbon :rollups] assoc-rollup-to)
-        (update-in [:index] (partial merge default-index))
-        (update-in [:index] get-instance :index)
+        (config-instance :index default-index)
         (update-in [:http] (partial merge default-http))
         (update-in [:aggregator] (partial merge default-aggregator))
         (update-in [:blacklist] (partial merge default-blacklist))


stop figwheel before starting

stop figwheel before starting

--- dev/user.clj
+++ dev/user.clj
@@ -22,8 +22,9 @@
             [environ.core :refer [env]]
             [figwheel-sidecar.repl-api]))

-(defn cljs-lein-repl []
-  (do (figwheel-sidecar.repl-api/start-figwheel!)
+(defn cljs-repl []
+  (do (figwheel-sidecar.repl-api/stop-figwheel!)
+      (figwheel-sidecar.repl-api/start-figwheel!)
       (figwheel-sidecar.repl-api/cljs-repl)))

 (defn migrate! [] (migrate ragtime/config))


Harden entity parsing.

Harden entity parsing.

To deal with some still broken data in Cassandra.

--- src/kixi/hecuba/data/entities.clj
+++ src/kixi/hecuba/data/entities.clj
@@ -87,7 +87,12 @@

 (defn decode-property-data [entity]
   (-> entity
-      (assoc :property_data (json/parse-string (:property_data entity) keyword))
+      (assoc :property_data
+        (try
+          (json/parse-string (:property_data entity) keyword)
+          (catch Throwable t
+            (log/errorf "Could not parse property_data %s for entity %s" (:property_data entity) entity)))
+             {})
       (decode-tech-icons)))

 (defn decode [entity]


Added entry sorting to rss-feed.

Added entry sorting to rss-feed.

--- src/lambda_blog/templates/rss.clj
+++ src/lambda_blog/templates/rss.clj
@@ -30,4 +30,4 @@
                                         :label (:id %)})
                             (sort-by :id tags))
                        (_summary {:type :html} summary)))
-              entries))])
+              (reverse (sort-by :timestamp entries))))])


improved deserialization of update error edn files

--- src/polismath/math/conversation.clj
+++ src/polismath/math/conversation.clj
@@ -873,14 +873,22 @@
   (ipv-print-method o w))

+(defn misc-reader [type]
+ (fn [& args]
+   {:type type
+    :args args}))
+
 ; a reader that uses these custom printing formats
 (defn read-vectorz-edn [text]
   (edn/read-string
     {:readers {'mikera.vectorz.Vector matrix/matrix
                'mikera.arrayz.NDArray matrix/matrix
                'mikera.matrixx.Matrix matrix/matrix
-               'polismath.named-matrix.NamedMatrix nm/named-matrix-reader}}
+               'polismath.named-matrix.NamedMatrix nm/named-matrix-reader
+               'object (misc-reader :object)
+               'error (misc-reader :error)}}
     text))
+

 (defn conv-update-dump


Updates add and get for user in model.

Updates add and get for user in model.

--- src/cadence/model.clj
+++ src/cadence/model.clj
@@ -1,22 +1,27 @@
 (ns cadence.model
   (:require [monger.core :as mg]
             [monger.collection :as mc]
-            [cadence.model.validators :as is-valid]))
+            [cadence.model.validators :as is-valid])
+  (:use clojure.walk
+        [cemerick.friend.credentials :only [hash-bcrypt]]))
+

 (defn connect [connection-info]
   (if (:uri connection-info)
     (mg/connect-via-uri! (:uri connection-info))
     (mg/connect!))
   (let [db-name (:db-name connection-info)]
-    (mg/authenticate db-name (:username connection-info) (into-array Character/TYPE (:password connection-info)))
+    (mg/authenticate db-name
+                     (:username connection-info)
+                     (into-array Character/TYPE (:password connection-info)))
     (mg/set-db! (mg/get-db db-name))))

 (defn get-user [username]
-  (mc/find "users" {:username username}))
+  (keywordize-keys (into {} (mc/find-one "users" {:username username}))))

 (defn add-user [user]
   (if (is-valid/user? user)
-    (mc/insert "users" user)))
+    (mc/insert "users" (assoc user :password (hash-bcrypt (:password user))))))

 (defn get-phrase []
   "passwords are so completely last decade")


audit ro api

audit ro api

--- src/celestial/api.clj
+++ src/celestial/api.clj
@@ -24,6 +24,7 @@
       [jobs :refer (jobs)]
       [actions :refer (actions actions-ro)]
       [types :refer (types types-ro)]
+      [audits :refer (audits-ro)]
       [systems :refer (systems environments)]
       [users :refer (users quotas users-ro)]
       [ui :refer (public sessions)]]
@@ -38,7 +39,7 @@
 (import-logging)

 (defroutes app-routes
-  systems types-ro actions-ro environments jobs sessions
+  systems types-ro audits-ro actions-ro environments jobs sessions
   (friend/wrap-authorize users-ro su)
   (friend/wrap-authorize users admin)
   (friend/wrap-authorize actions admin)


fixing a log message to make sense

fixing a log message to make sense

--- pp-server/src/pp_server/core/handler.clj
+++ pp-server/src/pp_server/core/handler.clj
@@ -13,7 +13,7 @@
   (POST "/format/:tipe" request
     (let [tipe (:tipe (:params request))
           input (:input (decode-body! request))]
-      (log/debug "Formating " input " to type " tipe)
+      (log/debug "Formating to type " tipe " for input " input)
       (mapfn input tipe)))
   (route/not-found "Not Found"))


Help automatic externs inference with type hints (#239)

CLJS compiler was not able to infer these calls.
Produced e.g. following error with `shadow-cljs release app --debug`:
react-dom.production.min.js:199 TypeError: this.$setState$ is not a function

Setting `(set! *warn-on-infer* true)` on rum.core namespace reported these issues.
For example:
WARNING: 00a66b06d16f043d13284c3366a4f9ea3237e8ef@5b042995"])
coming from UNSAFE_componentWillReceiveProps function

--- src/rum/core.cljs
+++ src/rum/core.cljs
@@ -15,7 +15,7 @@

 (defn state
   "Given React component, returns Rum state associated with it."
-  [comp]
+  [^js/React.Component comp]
   (gobj/get (.-state comp) ":rum/state"))

 (defn- extend! [obj props]
@@ -88,7 +88,7 @@
                                                  (gobj/get next-props ":rum/initial-state"))
                                next-state (reduce #(%2 old-state %1) state will-remount)]
             ;; allocate new volatile so that we can access both old and new states in shouldComponentUpdate
-                           (.setState this #js {":rum/state" (volatile! next-state)})))))
+                           (.setState ^js/React.Component this #js {":rum/state" (volatile! next-state)})))))

     (when-not (empty? should-update)
       (gobj/set prototype "shouldComponentUpdate"
@@ -124,7 +124,7 @@
                 (fn [error info]
                   (this-as this
                            (vswap! (state this) call-all did-catch error {:rum/component-stack (gobj/get info "componentStack")})
-                           (.forceUpdate this)))))
+                           (.forceUpdate ^js/React.Component this)))))

     (gobj/set prototype "componentWillUnmount"
               (fn []
@@ -146,7 +146,7 @@
     ctor))

 (defn- set-meta! [c]
-  (let [f #(let [ctr (c)]
+  (let [f #(let [^js ctr (c)]
              (.apply ctr ctr (js-arguments)))]
     (specify! f IMeta (-meta [_] (meta (c))))
     f))
@@ -216,7 +216,7 @@
   (let [render (fn [state] [(apply render-body (:rum/react-component state) (:rum/args state)) state])]
     (build-ctor render mixins display-name)))

-(defn request-render [comp]
+(defn request-render [^js/React.Component comp]
   (.forceUpdate comp))

 (defn mount
@@ -336,7 +336,7 @@
    {:will-mount
     (fn [state]
       (let [local-state (atom initial)
-            component   ^js (:rum/react-component state)]
+            ^js/React.Component component (:rum/react-component state)]
         (add-watch local-state key
                    (fn [_ _ p n]
                      (when (not= p n)
@@ -381,7 +381,7 @@
                (add-watch ref key
                           (fn [_ _ p n]
                             (when (not= p n)
-                              (.forceUpdate comp))))))
+                              (.forceUpdate ^js/React.Component comp))))))
            [dom (assoc next-state :rum.reactive/refs new-reactions)]))))
    :will-unmount
    (fn [state]
@@ -608,7 +608,7 @@
   ([element opts]
    (if-not (identical? *target* "nodejs")
      (.renderToString js/ReactDOMServer element)
-     (let [react-dom-server (js/require "react-dom/server")]
+     (let [^js/ReactDOMServer react-dom-server (js/require "react-dom/server")]
        (.renderToString react-dom-server element)))))

 (defn render-static-markup
@@ -617,7 +617,7 @@
   [src]
   (if-not (identical? *target* "nodejs")
     (.renderToStaticMarkup js/ReactDOMServer src)
-    (let [react-dom-server (js/require "react-dom/server")]
+    (let [^js/ReactDOMServer react-dom-server (js/require "react-dom/server")]
       (.renderToStaticMarkup react-dom-server src))))

 ;; JS components adapter


work arround closure renaming global to window.global

fixes #405

--- src/main/shadow/build/closure.clj
+++ src/main/shadow/build/closure.clj
@@ -876,6 +876,7 @@
       (str/replace "window.module.exports", "/*****/module.exports")
       (str/replace "window.__filename", "/*****/__filename")
       (str/replace "window.__dirname", "/*****/__dirname")
+      (str/replace "window.global", "/*****/global")
       ))

 (defn dump-js-modules [modules]


improve behavior of cljs.repl/mapped-stacktrace if source file does not exist

--- src/clj/cljs/repl.clj
+++ src/clj/cljs/repl.clj
@@ -220,25 +220,26 @@
   (when-let [smf (util/file-or-resource (str f ".map"))]
     (let [ns (if (= f "cljs/core.aot.js")
                'cljs.core
-               (:ns (ana/parse-ns (js-src->cljs-src f))))]
-      (as-> @env/*compiler* compiler-env
-        (let [t (util/last-modified smf)]
-          (if (or (and (= ns 'cljs.core)
-                       (nil? (get-in compiler-env [::source-maps ns])))
-                  (and (not= ns 'cljs.core)
-                       (> t (get-in compiler-env [::source-maps ns :last-modified] 0))))
-            (swap! env/*compiler* assoc-in [::source-maps ns]
-              {:last-modified t
-               :source-map (sm/decode (json/read-str (slurp smf) :key-fn keyword))})
-            compiler-env))
-        (get-in compiler-env [::source-maps ns :source-map])))))
+               (some-> (js-src->cljs-src f) ana/parse-ns :ns))]
+      (when ns
+        (as-> @env/*compiler* compiler-env
+         (let [t (util/last-modified smf)]
+           (if (or (and (= ns 'cljs.core)
+                        (nil? (get-in compiler-env [::source-maps ns])))
+                 (and (not= ns 'cljs.core)
+                      (> t (get-in compiler-env [::source-maps ns :last-modified] 0))))
+             (swap! env/*compiler* assoc-in [::source-maps ns]
+               {:last-modified t
+                :source-map (sm/decode (json/read-str (slurp smf) :key-fn keyword))})
+             compiler-env))
+         (get-in compiler-env [::source-maps ns :source-map]))))))

 (defn ns-info
   "Given a path to a js source file return the ns info for the corresponding
    ClojureScript file if it exists."
   [f]
   (let [f' (js-src->cljs-src f)]
-    (when (.exists f')
+    (when (and f' (.exists f'))
       (ana/parse-ns f'))))

 (defn- mapped-line-column-call
@@ -334,12 +335,12 @@
    print the ClojureScript stacktrace. See mapped-stacktrace."
   ([stacktrace] (print-mapped-stacktrace stacktrace *repl-opts*))
   ([stacktrace opts]
-    (doseq [{:keys [function file line column]}
-            (mapped-stacktrace stacktrace opts)]
-      (err-out
-        (println "\t"
-          (str (when function (str function " "))
-            "(" file (when line (str ":" line)) (when column (str ":" column)) ")"))))))
+   (doseq [{:keys [function file line column]}
+           (mapped-stacktrace stacktrace opts)]
+     (err-out
+       (println "\t"
+         (str (when function (str function " "))
+           "(" file (when line (str ":" line)) (when column (str ":" column)) ")"))))))

 (comment
   (cljsc/build "samples/hello/src"


Fix for :install-rezzed cards like Oaktown Renovation.

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -432,9 +432,11 @@
   (swap! state update-in [:bonus :cost] (fnil #(+ % n) 0)))

 (defn rez-cost [state side {:keys [cost] :as card}]
-  (-> cost
-      (+ (or (get-in @state [:bonus :cost]) 0))
-      (max 0)))
+  (if (nil? cost)
+    nil
+    (-> cost
+        (+ (or (get-in @state [:bonus :cost]) 0))
+        (max 0))))

 (defn trash-cost-bonus [state side n]
   (swap! state update-in [:bonus :trash] (fnil #(+ % n) 0)))


fix eval-map

fix eval-map

--- src/signet/db.clj
+++ src/signet/db.clj
@@ -42,7 +42,15 @@
            :bookmark/url url
            :bookmark/user user
            :val/id id}])))
-
+   (fn [conn params]
+      (let [id (uuid params)
+            {:keys [title user url]} params]
+        (db-transact
+         conn
+         [{:bookmark/title title
+           :bookmark/url url
+           :bookmark/user user
+           :val/id id}])))
    })


set default order on dashboard 'ordered_cards' to be by :created_at :asc so it matches the django app.  this realistically only affects the card order when no explicit order has been set by repositioning them.

--- src/metabase/models/dashboard.clj
+++ src/metabase/models/dashboard.clj
@@ -24,7 +24,7 @@
       (assoc :creator       (delay (sel :one User :id creator_id))
              :description   (util/jdbc-clob->str description)
              :organization  (delay (sel :one Org :id organization_id))
-             :ordered_cards (delay (sel :many DashboardCard :dashboard_id id)))
+             :ordered_cards (delay (sel :many DashboardCard :dashboard_id id (order :created_at :asc))))
       assoc-permissions-sets))

 ; TODO - ordered_cards


start without any synth defined

start without any synth defined

--- src/codemash/core.clj
+++ src/codemash/core.clj
@@ -51,13 +51,7 @@

 (do (voice/synthesis))

-(defsynth wallop [freq 300]
-  (let [tri (lf-tri freq)
-        sin1 (* 1 (sin-osc freq))
-        sin2 (* 1.1 (sin-osc freq))
-        src (mix [tri sin1 sin2])
-        env (env-gen (perc :attack 0 :release 0.25))]
-    (out 0 (pan2 (* env src)))))
+(defsynth wallop [])

 (show-graphviz-synth wallop)

@@ -76,16 +70,6 @@
 (do
   (voice/ugens)
   (println art/sweet-shop))
-
-(defsynth ding [freq 880 dur 0.2 level 0.25 pan 0.0 out-bus 0]
-  (let [amp  (env-gen:ar (env-perc) :action FREE :time-scale dur)
-        snd (* (sin-osc:ar freq ) amp level)]
-    (out out-bus (pan2:ar snd pan))))
-
-(defsynth tick [freq 880 dur 0.1 level 0.25 pan 0.0 out-bus 0]
-  (let [amp (env-gen (env-perc) :action FREE :time-scale dur)
-        snd (lpf:ar (white-noise:ar) freq)]
-    (out out-bus (pan2:ar (* snd amp level) pan))))

 (defsynth woody-beep [freq 300 out-bus 0 dur 0.4]
   (let [tri (* 0.5 (lf-tri:ar freq))
@@ -116,6 +100,7 @@
 (tick)

 (kill fallout-wind)
+
 ;;;;;;;;;;;
 ;;Samples;;
 ;;;;;;;;;;;
@@ -127,8 +112,6 @@
 (def clap (freesound 48310))
 (def clap2 (freesound 132676))

-(def waves-s (sample (freesound-path 48412)))
-(def waves (waves-s :rate 0.3 :vol 0.5))
 (def waves-s (freesound-sample 163120))
 (def waves (waves-s :rate 0.8 :vol 0.5))
 (ctl waves :rate 1)
@@ -406,13 +389,13 @@
 (ctl ps :amp 1)
 (kill ps)

-(buffer-write! bass-duration-b (take 128 (cycle [(/ 1 0.87)])))
-(buffer-write! bass-notes-b (take 128 (cycle (map note [:F2 :F2 :G2 :G2 :F2 :F2]))))
-
+(buffer-write! bass-duration-b (take 128 (cycle [(/ 1 7)])))
+(buffer-write! bass-notes-b (take 128 (cycle (map note bass-score))))
 (buffer-write! bass-notes-b (take 128 (cycle (map #(+ -5 (note %)) score))))

-(buffer-write! score-b (take 128 (cycle (map note score))))
-(buffer-write! duration-b (take 128 (cycle duration)))
+(buffer-write! score-b (take 128 (cycle (map #(+ 0 ( note %)) score))))
+
+(Buffer-write! duration-b (take 128 (cycle duration)))

 (ctl root-trigger :rate 100)
 (ctl beat-trigger :div 29)
@@ -480,4 +463,4 @@
 (do
   (voice/the-end)
   (println art/end)
-)
+))


added crawl model

added crawl model

--- src/crawler/model.clj
+++ src/crawler/model.clj
@@ -2,6 +2,7 @@
   "Contains code to read and process a
    sampled model"
   (:require [clojure.java.io :as io]
+            [clojure.string :as string]
             [crawler.corpus :as corpus]
             [crawler.dom :as dom]
             [structural-similarity.xpath-text :as similarity])
@@ -13,65 +14,8 @@
   (with-open [rdr (io/reader a-model-file)]
     (-> rdr PushbackReader. read)))

-(defn read-corpus
-  [a-corpus-file]
-  (with-open [rdr (io/reader a-corpus-file)]
-    (-> rdr PushbackReader. read)))
-
-(defn not-paginated
-  [an-action-seq pagination]
-  (not
-   (some
-    (fn [[src-xpath actions]]
-      (some
-       (fn [action]
-         (let [paging-action (cons action src-xpath)]
-           (some
-            (fn [[x y]]
-              (= x y))
-            (map vector paging-action (reverse an-action-seq)))))
-       actions))
-    pagination)))
-
-(defn trim-pagination
-  [model pagination]
-  (filter
-   (fn [[action-seq _]]
-     (not-paginated action-seq pagination))
-   model))
-
-;; (defn fix-model
-;;   "Code that takes a sampled model and
-;;    fixes up the crawled model"
-;;   [model-file corpus-file]
-;;   (let [model       (read-model model-file)
-;;         corpus-data (corpus/read-corpus-file corpus-file)
-
-;;         model-trimmed (corpus/refine-model-with-positions model
-;;                                                           corpus-data)
-
-;;         pagination (corpus/pagination-in-corpus corpus-data)
-;;         pagination-trimmed (into
-;;                             {}
-;;                             (map
-;;                              (fn [[action-seq paging-actions]]
-;;                                [action-seq
-;;                                 (map
-;;                                  (fn [paging-action]
-;;                                    (corpus/refine-pagination-with-positions action-seq
-;;                                                                             paging-action
-;;                                                                             corpus-data))
-;;                                  paging-actions)])
-;;                              pagination))]
-;;     {:action-seqs model-trimmed
-;;      :pagination-trimmed pagination-trimmed}))
-
-(defn inspect-action-seq
-  [action-seq corpus]
-  (map
-   first
-   (filter
-    (fn [[u x]]
-      (= (:src-xpath x)
-         action-seq))
-    corpus)))
+(defn associated-corpus-file
+  "Finds the corpus file that produced
+   provided model file"
+  [a-model-file]
+  (string/replace a-model-file #".model" ".corpus"))


fix #1171: hide remove option from profile menu for unremovable contacts

--- src/status_im/profile/screen.cljs
+++ src/status_im/profile/screen.cljs
@@ -40,7 +40,8 @@

 (defn profile-toolbar [contact]
   [toolbar
-   (when-not (:pending? contact)
+   (when (and (not (:pending? contact))
+              (not (:unremovable? contact)))
      {:actions [(act/opts [{:value #(dispatch [:hide-contact contact])
                             :text  (label :t/remove-from-contacts)}])]})])


Remove reducers require

Remove reducers require

--- src/yetibot/core/models/history.clj
+++ src/yetibot/core/models/history.clj
@@ -2,7 +2,6 @@
   (:require
     [yetibot.core.db.history :refer :all]
     [clojure.string :refer [join split]]
-    [clojure.core.reducers :as r]
     [yetibot.core.models.users :as u]
     [taoensso.timbre :refer [info warn error spy]]
     [datomico.core :as dc]


Add asynchronous friendly println function to user.clj

--- dev/user.clj
+++ dev/user.clj
@@ -24,3 +24,14 @@
     (binding [*namespaces* nss]
       (repl/refresh :after 'user/run-tests'))
     (repl/refresh :after 'user/run-tests')))
+
+(defn trace
+  "Asynchronous friendly println variant."
+  [& strings]
+  (locking println
+    (apply println strings)))
+
+;; (require '[cats.core :as m]
+;;          '[cats.context :as mc]
+;;          '[cats.monad.either :as either]
+;;          '[cats.builtin])


Enhance the logging instrumentation

Enhance the logging instrumentation

--- dev/user.clj
+++ dev/user.clj
@@ -1,16 +1,41 @@
 (ns user
   (:require [robert.hooke :as rh]
-            [clojure.tools.logging :as log]
-            [mdr2.db :as db]))
+            [clojure.tools.logging :as log]))

-(defn debug [f & args]
-  (log/debug "Calling " (:name (meta f)) " with " args)
+;; inspiration from
+;; http://martintrojer.github.io/clojure/2014/03/09/working-with-coreasync-blocking-calls/
+
+(defn debug [{:keys [name ns]} f & args]
+  (log/debug "Calling " (ns-name ns) "/" name " with " args)
   (apply f args))

+(defn enable-debug [var]
+  (log/debug "Enabling debugging for" var)
+  (robert.hooke/add-hook var (partial debug (meta var))))
+
+(defn disable-debug [var]
+  (log/debug "Disabling debugging for" var)
+  (robert.hooke/clear-hooks var))
+
+(defn public-fns [sym]
+  (->> sym
+   find-ns
+   ns-publics
+   vals
+   (filter #(fn? (deref %)))))
+
 (defn debug-ns [sym]
-  (doseq [v (vals (ns-publics (find-ns sym)))]
-    (rh/add-hook v #'debug))
-  )
+  (->> (public-fns sym)
+   ;; remove dups
+   (remove #(:robert.hooke/hooks (meta (deref %)))) ; this doesn't seem to work
+   (map enable-debug)
+   doall))
+
+(defn undebug-ns [sym]
+  (->> (public-fns sym)
+   ;; (filter #(:robert.hooke/hook (meta (deref %))))
+   (map disable-debug)
+   doall))

 (comment
   (debug-ns 'mdr2.db))


Cleaning up a small cruft spill

Cleaning up a small cruft spill

--- src/vdquil/chapter6/figure6-2.clj
+++ src/vdquil/chapter6/figure6-2.clj
@@ -67,12 +67,10 @@
               (raw-key))]
     (if (or (= (key-code) (keys :backspace)) (= (key-code) (keys :delete)))
       (if (> (count @typed-chars) 0)
-        (do ;;(swap! typed-count dec)
-            (swap! typed-chars #(subs % 0 (- (count @typed-chars) 1)))))
+        (swap! typed-chars #(subs % 0 (- (count @typed-chars) 1))))
       (if (and (>= (int key) (int (keys :0))) (<= (int key) (int (keys :9)))
                (< (count @typed-chars) 5))
-        (do ;;(swap! typed-count inc)
-            (swap! typed-chars #(str % key)))))))
+        (swap! typed-chars #(str % key))))))

 (defsketch zips
   :title "Figure 6-2: selecting a region of zip codes"


DM | Add liberator tracing middleware

DM | Add liberator tracing middleware

--- src/freecoin/core.clj
+++ src/freecoin/core.clj
@@ -28,6 +28,7 @@

 (ns freecoin.core
   (:require [org.httpkit.server :as server]
+            [liberator.dev :as ld]
             [clojure.tools.logging :as log]
             [ring.middleware.defaults :as ring-mw]
             [ring.middleware.cookies :refer [wrap-cookies]]
@@ -103,11 +104,18 @@
       (assoc-in [:session :store] session-store)
       (assoc-in [:security :anti-forgery] {:error-handler handle-anti-forgery-error})))

+(defn conditionally-wrap-with [handler wrapper wrap-when-true]
+  (if wrap-when-true
+    (wrapper handler)
+    handler))
+
 (defn create-app [config-m stores-m blockchain]
-  (-> (scenic/scenic-handler routes/routes (handlers config-m stores-m blockchain) not-found)
-      (ring-mw/wrap-defaults (wrap-defaults-config (cookie-store (config/cookie-secret config-m))
-                                                   (config/secure? config-m)))
-      #_(mw-logger/wrap-with-logger)))
+  (let [debug-mode true]
+    (-> (scenic/scenic-handler routes/routes (handlers config-m stores-m blockchain) not-found)
+        (conditionally-wrap-with #(ld/wrap-trace % :header :ui) debug-mode)
+        (ring-mw/wrap-defaults (wrap-defaults-config (cookie-store (config/cookie-secret config-m))
+                                                     (config/secure? config-m)))
+        #_(mw-logger/wrap-with-logger))))

 ;; launching and halting the app
 (defonce app-state {})


Fixed unit test

Fixed unit test

--- ssclj/jar/src/test/clojure/com/sixsq/slipstream/ssclj/resources/event_schema_test.clj
+++ ssclj/jar/src/test/clojure/com/sixsq/slipstream/ssclj/resources/event_schema_test.clj
@@ -13,6 +13,8 @@
                 :acl {:owner {:type "USER" :principal "joe"}
                       :rules [{:type "ROLE" :principal "ANON" :right "ALL"}]}

+                :id "Event/262626262626262"
+
                 :resourceURI resource-uri

                 :timestamp event-timestamp


New test: test-read-description-3

New test: test-read-description-3

--- test/clouseau/test_db_interface.clj
+++ test/clouseau/test_db_interface.clj
@@ -124,10 +124,22 @@
                                :subprotocol "sqlite"
                                :subname     "packages/rhel6/primary.sqlite"
                            }]]
-            (is (= "select description from packages where lower(name)='package-name';"
-                (read-description product "package-name")))
-            (is (= "select description from packages where lower(name)='package-name';"
-                (read-description product "Package-Name")))
-            (is (= "select description from packages where lower(name)='package-name';"
-                (read-description product "PACKAGE-NAME")))))))
+                (is (= "select description from packages where lower(name)='package-name';"
+                    (read-description product "package-name")))
+                (is (= "select description from packages where lower(name)='package-name';"
+                    (read-description product "Package-Name")))
+                (is (= "select description from packages where lower(name)='package-name';"
+                    (read-description product "PACKAGE-NAME")))))))

+(deftest test-read-description-3
+    (testing "clouseau.db-interface/read-description"
+        ; use mock instead of jdbc/query
+        (with-redefs [jdbc/query (fn [product package] package)]
+            (let [product ["RHEL 6"                                   ; first
+                              {:classname   "org.sqlite.JDBC"         ; second
+                               :subprotocol "sqlite"
+                               :subname     "packages/rhel6/primary.sqlite"
+                           }]]
+                (is (= "select description from packages where lower(name)='';"
+                    (read-description product "")))))))
+


Testing error case for raw deserializer

Testing error case for raw deserializer

--- test/desdemona/tasks/kafka_test.clj
+++ test/desdemona/tasks/kafka_test.clj
@@ -6,3 +6,7 @@
   (let [got (deserialize-message-raw (.getBytes "this is raw text"))
         expected {:line "this is raw text"}]
     (is (= got expected))))
+
+(deftest deserialize-message-raw-fails-test
+  (let [got (deserialize-message-raw "this should be bytes")]
+    (is (= (.getMessage (got :error)) "No matching ctor found for class java.lang.String"))))


Better task checking

Better task checking

--- src/leiningen/amp.clj
+++ src/leiningen/amp.clj
@@ -21,8 +21,8 @@

    Usage:

-     lein amp package [<options>] [<path>]
-     lein amp deploy [<options>]
+     lein amp package [<options>]
+     lein amp deploy [<options>] [<path-to-alfresco>]

    Tasks:

@@ -32,22 +32,6 @@
    Commandline Options:

      ####TODO - FIX THIS
-
-     :aggressive          Check all available repositories (= Do not stop after first artifact match).
-     :all                 Check Dependencies and Plugins.
-     :allow-all           Allow SNAPSHOT and qualified versions to be reported as new.
-     :allow-qualified     Allow '*-alpha*' versions & co. to be reported as new.
-     :allow-snapshots     Allow '*-SNAPSHOT' versions to be reported as new.
-     :check-clojure       Include Clojure (org.clojure/clojure) in checks.
-     :dependencies        Check Dependencies. (default)
-     :interactive         Run 'upgrade' in interactive mode, prompting whether to apply changes.
-     :no-colors           Disable colorized output.
-     :no-profiles         Do not check Dependencies/Plugins in Profiles.
-     :no-tests            Do not run tests after upgrading a project.
-     :overwrite-backup    Do not prompt if a backup file exists when upgrading a project.
-     :plugins             Check Plugins.
-     :print               Print result of 'upgrade' task instead of writing it to 'project.clj'.
-     :recursive           Perform recursive 'check' or 'upgrade'.
   "
   [project & args]
   (let [^String t (when-let [^String t (first args)]
@@ -56,4 +40,4 @@
         args      (if run-task! (rest args) args)]
     (if run-task!
       (run-task! project args)
-      (println "Unknown task" t))))
+      (println "Unknown task" (if (nil? t) "<no task specified>" t)))))


offending logger line

offending logger line

--- src/ontrail/group.clj
+++ src/ontrail/group.clj
@@ -136,7 +136,6 @@
        (mq/sort {:creationDate 1}))))

 (defn analyze-chinups [day-number all-results user]
-  (.info logger (str day-number))
   (let [results (filter #(= user (:user %)) all-results)
         reps-map (accumulate-repeats-map results)
         day-range (vec (range 1 (inc day-number)))


Add missing excludes.

Add missing excludes.

--- src/promesa/core.cljc
+++ src/promesa/core.cljc
@@ -23,7 +23,7 @@
 ;; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 (ns promesa.core
-  (:refer-clojure :exclude [delay spread promise await])
+  (:refer-clojure :exclude [delay spread promise await map mapcat])
   (:require [promesa.protocols :as p]
             #?(:cljs [org.bluebird]))
   #?(:clj


src/riemann/xymon.clj: minor aesthetic docstring reformatting

--- src/riemann/xymon.clj
+++ src/riemann/xymon.clj
@@ -42,8 +42,7 @@
             ttl-prefix host service state description)))

 (defn event->enable
-  "
-  Convert an event to an Xymon enable message:
+  "Converts an event to an Xymon enable message:

   enable HOSTNAME.TESTNAME

@@ -56,8 +55,8 @@
     (format "enable %s.%s" host service)))

 (defn event->disable
-  "
-  Convert an event to a Xymon disable message:
+  "Converts an event to a Xymon disable message:
+
   disable HOSTNAME.TESTNAME DURATION <additional text>

   Fields mapping is the same as event->status'. Also, the event ttl is
@@ -71,8 +70,7 @@
             host service (int (ceil (/ ttl 60))) description)))

 (defn *send-message-error-handler*
-  "
-  Logs given exception as an error message.
+  "Logs given exception as an error message.

   *send-message-error-handler* is the default error handler invoked by
   send-single-message if none is provided.
@@ -82,8 +80,7 @@
                            (:host opts) (:port opts))))

 (defn send-single-message
-  "
-  Connects to a Xymon server, sends message, then closes the
+  "Connects to a Xymon server, sends message, then closes the
   connection. This is a blocking operation and should happen on a
   dedicated thread.

@@ -108,8 +105,7 @@
         ((:error-handler opts) opts e)))))

 (defn send-message
-  "
-  Sends given message to Xymon host(s).
+  "Sends given message to Xymon host(s).

   If (:hosts opts) is a sequence _and_ (:host opts) is false, sends
   the message to all hosts described in (:hosts opts). When
@@ -127,8 +123,7 @@
     (send-single-message opts message)))

 (defn xymon
-  "
-  Returns a function which accepts an event and sends it to Xymon.
+  "Returns a function which accepts an event and sends it to Xymon.
   Drops events when Xymon is down. Use:

   (xymon {:host \"127.0.0.1\" :port 1984
@@ -147,8 +142,7 @@
 (def- combo-header-len (count combo-header))

 (defn events->combo
-  "
-  Returns a lazy sequence of combo messages. Each message is at most
+  "Returns a lazy sequence of combo messages. Each message is at most
   message-max-length long.
   "
   ([formatter events]
@@ -165,9 +159,8 @@
          (cons message (lazy-seq (events->combo formatter events))))))))

 (defn send-combo
-  "
-  Turns events into combo messages (using events->combo) and send them
-  to Xymon.
+  "Turns events into combo messages (using events->combo) and send
+  them to Xymon.
   "
   [opts events]
   (let [formatter (or (:formatter opts) event->status)]
@@ -175,11 +168,12 @@
       (send-message opts combo-message))))

 (defn xymon-batch
-  "
+  "Returns a function which accepts an event or a vector of events and
+  which sends them to Xymon, as 'combo' messages if needed. Filters
+  events with nil :state or :service.

-  Returns a function which accepts a vector of events and which sends
-  them to Xymon as 'combo' messages. Filters events with nil :state
-  or :service.
+  (xymon {:host \"127.0.0.1\" :port 1984
+          :timeout 5 :formatter event->status})
   "
   [opts]
   (fn [events]


fixing up printing error notifications

fixing up printing error notifications

--- sidecar/src/figwheel_sidecar/build_middleware/notifications.clj
+++ sidecar/src/figwheel_sidecar/build_middleware/notifications.clj
@@ -148,10 +148,15 @@
       (when-let [s (cljs.analyzer/error-message warning-type extra)]
         (callback (cljs.analyzer/message env s))))))

-(defmulti report-exception (fn [exception cause] (:type cause)))
+(defmulti report-exception (fn [exception cause] (or (:type cause) (:tag cause))))

 (defmethod report-exception :reader-exception [e {:keys [file line column]}]
   (println (format "ERROR: %s on file %s, line %d, column %d"
+                   (some-> e (.getCause) (.getMessage))
+                   file line column)))
+
+(defmethod report-exception :cljs/analysis-error [e {:keys [file line column]}]
+  (println (format "ANALYSIS ERROR: %s on file %s, line %d, column %d"
                    (some-> e (.getCause) (.getMessage))
                    file line column)))

@@ -183,5 +188,3 @@
           (notify-change-helper build-state changed-files))
         (catch Throwable e
           (handle-exceptions figwheel-server (assoc build-config :exception e)))))))
-
-


(SERVER-1183) Removed unchecked protection for cache id increment

This commit removes protection for buffer overflow for increments to
the `cache-generation-id` given that it would be extremely unlikely to
ever practically hit the upper bound on the id before overflowing.

This commit also changes the function name
`updated-environment-class-info-entry` to
`update-environment-class-info-entry` so that a verb is used in the
name for more similarity with the names of other functions.

--- src/clj/puppetlabs/services/jruby/jruby_puppet_core.clj
+++ src/clj/puppetlabs/services/jruby/jruby_puppet_core.clj
@@ -354,12 +354,10 @@
   [original-environment-class-info-entry :-
    (schema/maybe EnvironmentClassInfoCacheEntry)]
   (if original-environment-class-info-entry
-    (update original-environment-class-info-entry
-            :cache-generation-id
-            #(if (= % Long/MAX_VALUE) Long/MIN_VALUE (inc %)))
+    (update original-environment-class-info-entry :cache-generation-id inc)
     (environment-class-info-entry)))

-(schema/defn ^:always-validate updated-environment-class-info-entry
+(schema/defn ^:always-validate update-environment-class-info-entry
   :- EnvironmentClassInfoCacheEntry
   "Return the supplied 'original-environment-class-info-entry', only updated
   with the supplied tag and a cache-generation-id value that has been
@@ -377,7 +375,7 @@
   with a nil tag and a cache-generation-id value that has been incremented."
   [original-environment-class-info-entry :-
    (schema/maybe EnvironmentClassInfoCacheEntry)]
-  (updated-environment-class-info-entry
+  (update-environment-class-info-entry
    original-environment-class-info-entry
    nil))

@@ -417,7 +415,7 @@
            cache-generation-id-before-tag-computed)
       (assoc environment-class-info-cache
         env-name
-        (updated-environment-class-info-entry cache-entry tag))
+        (update-environment-class-info-entry cache-entry tag))
       environment-class-info-cache)))

 (schema/defn ^:always-validate


using doto and enabling pty

using doto and enabling pty

--- src/supernal/sshj.clj
+++ src/supernal/sshj.clj
@@ -26,12 +26,11 @@
   (doseq [line (line-seq (clojure.java.io/reader out))] (debug  (<< "[~{host}]:") line)))

 (defnk ssh-strap [host {user (@config :user)}]
-  (let [ssh (SSHClient.)]
-    (.addHostKeyVerifier ssh (PromiscuousVerifier.))
-    (.loadKnownHosts ssh)
-    (.connect ssh host)
-    (.authPublickey ssh user #^"[Ljava.lang.String;" (into-array [(@config :key)]) )
-    ssh))
+  (doto (SSHClient.)
+    (.addHostKeyVerifier (PromiscuousVerifier.))
+    (.loadKnownHosts )
+    (.connect host)
+    (.authPublickey user #^"[Ljava.lang.String;" (into-array [(@config :key)]))))

 (defmacro with-ssh [remote & body]
   `(let [~'ssh (ssh-strap ~remote)]
@@ -45,9 +44,14 @@
   "Executes a cmd on a remote host"
   [cmd remote]
   (with-ssh remote
-    (let [session (.startSession ssh) res (.exec session cmd) ]
+    (let [session (doto (.startSession ssh) (.allocateDefaultPTY)) command (.exec session cmd) ]
       (debug (<< "[~(remote :host)]:") cmd)
-      (log-output (.getInputStream res) (remote :host)))))
+      (log-output (.getInputStream command) (remote :host))
+      (log-output (.getErrorStream command) (remote :host))
+      (.join command 60 TimeUnit/SECONDS)
+      (when-not (= 0 (.getExitStatus command))
+        (throw (Exception. (<< "Failed to execute ~{cmd} on ~{remote}"))))
+      )))

 (def listener
   (proxy [TransferListener] []


CMR-3832: Added nil check.

CMR-3832: Added nil check.

--- umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/iso19115_2/additional_attribute.clj
+++ umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/iso19115_2/additional_attribute.clj
@@ -34,8 +34,8 @@
           :let [description (first (select aa additional-attribute-xpath))]]
       {:Group (char-string-value description "eos:identifier/gmd:MD_Identifier/gmd:code")
        :Name (char-string-value description "eos:name")
-       :DataType (s/trim
-                  (value-of description "eos:dataType/eos:EOS_AdditionalAttributeDataTypeCode"))
+       :DataType (when-let [data-type (value-of description "eos:dataType/eos:EOS_AdditionalAttributeDataTypeCode")]
+                   (s/trim data-type))
        :Value (char-string-value aa "eos:value")
        :Description (su/with-default (char-string-value description "eos:description") sanitize?)
        :MeasurementResolution (char-string-value description "eos:measurementResolution")


Remove convenient requires from user namespace

--- resources/leiningen/new/jcf/dev/user.clj
+++ resources/leiningen/new/jcf/dev/user.clj
@@ -1,12 +1,5 @@
 (ns user
-  (:require [clojure.java.io :as io]
-            [clojure.java.javadoc :refer [javadoc]]
-            [clojure.pprint :refer [pprint]]
-            [clojure.repl :refer [apropos dir doc find-doc pst source]]
-            [clojure.set :as set]
-            [clojure.string :as str]
-            [clojure.test :as test]
-            [environ.core :refer [env]]
+  (:require [environ.core :refer [env]]
             [reloaded.repl :refer [go init reset start stop system]]
             [{{ns}}.config :refer [config-map]]
             [{{ns}}.system :refer [new-system]]))


Only strip the first char if the 2nd char is ESC

--- src/transit/write.clj
+++ src/transit/write.clj
@@ -66,7 +66,7 @@
   [^String s]
   (if (> (.length s) 0)
     (let [c (subs s 0 1)]
-      (cond (= RESERVED c)
+      (cond (and (= RESERVED c) (= ESC (subs s 1 2)))
             (subs s 1)

             (or (= ESC c) (= SUB c))
@@ -366,7 +366,7 @@
    (tag [_ _] "?")
    (rep [_ b] b)
    (str-rep [_ b] (str b)))
-
+
  java.lang.Byte
  (reify Handler
    (tag [_ _] "i")
@@ -562,7 +562,7 @@
 (extend-protocol Writerable
   OutputStream
   (make-writer [^OutputStream stm type opts]
-    (Writer.
+    (Writer.
      (case type
        :json (.createGenerator (JsonFactory.) stm)
        :msgpack (.createPacker (MessagePack.) stm))
@@ -596,7 +596,3 @@
     (tag [_ o] (tag-fn o))
     (rep [_ o] (rep-fn o))
     (str-rep [_ o] (str-rep-fn o))))
-
-
-
-


Extract print-property for external use

Extract print-property for external use

--- src/tick/ical.clj
+++ src/tick/ical.clj
@@ -83,16 +83,19 @@
      ~@body
      (print-cl "END:" ~c)))

+(defn print-property [prop-name prop-value]
+  (let [{:keys [params value]} (serialize-value prop-value)]
+    (print-cl
+      (str/upper-case (name prop-name))
+      (apply str (for [[k v] params]
+                   (str ";" (str/upper-case (name k)) "=" v)))
+      ":"
+      value)))
+
 (defrecord Property [prop-name prop-value]
   IPrintable
   (print-object [_]
-    (let [{:keys [params value]} (serialize-value prop-value)]
-      (print-cl
-        (str/upper-case (name prop-name))
-        (apply str (for [[k v] params]
-                     (str ";" (str/upper-case (name k)) "=" v)))
-        ":"
-        value))))
+    (print-property prop-name prop-value)))

 (defrecord VEvent []
   t/ITimeSpan


Make the 'show forks' toggle start with the right state.

--- src-cljs/frontend/components/add_projects.cljs
+++ src-cljs/frontend/components/add_projects.cljs
@@ -197,6 +197,7 @@
       [:div.checkbox.pull-right.fork-filter
        [:label
         [:input {:type "checkbox"
+                 :checked (-> settings :add-projects :show-forks)
                  :name "Show forks"
                  :on-change #(utils/toggle-input owner [:settings :add-projects :show-forks] %)}]
         "Show forks"]]])))


Use if-not.

Use if-not.

--- src-cljs/frontend/components/contact_form.cljs
+++ src-cljs/frontend/components/contact_form.cljs
@@ -148,7 +148,7 @@
                                   params (into {} (map (juxt #(.-name %) #(.-value %)) (.-elements form)))
                                   filtered-params (params-filter params)
                                   valid? (fn [f] (every? #(.checkValidity %) (.-elements f)))]
-                              (if (not (valid? form))
+                              (if-not (valid? form)
                                 (om/set-state! owner :show-validations? true)
                                 (do
                                   (om/update-state! owner #(merge % {:notice nil


Update headings and remove errant spaces

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -320,7 +320,7 @@
     (render [_]
       (html
        [:fieldset.osx-faq
-        [:legend "FAQ"]
+        [:legend "FAQs"]
         [:dl
          (for [{:keys [question answer]} items]
            (list
@@ -335,7 +335,8 @@
         (html
           [:div.osx-plans
            [:fieldset
-            [:legend (str "iOS Limited Release Plans - The below selection only applies to iOS service and will not affect the Linux Containers above.")]]
+            [:legend (str "iOS Limited Release Plans")]
+            [:p "Your selection selection below only applies to iOS service and will not affect Linux Containers above."]]
            [:div.plan-selection
             (om/build osx-plan {:plan plan :price 79 :plan-type "starter" :current-plan current-plan})
             (om/build osx-plan {:plan plan :price 139 :plan-type "standard" :current-plan current-plan})
@@ -1047,7 +1048,7 @@
         (cond (> containers 1)
               [:p (str "All Linux builds will be distributed across " containers " containers.")]
               (= containers 1)
-              [:div
+              [:div
                [:p (str org-name " is currently on the Hobbyist plan. Builds will run in a single, free container.")]
                [:p "By " [:a {:href (routes/v1-org-settings-subpage {:org (:org_name plan)
                                                                :subpage "containers"})}
@@ -1086,7 +1087,7 @@
           [:p "If enabled, you may also choose a seperate iOS plan "
            [:a {:href "#containers"} "here"]
            ". If you would like to join the limited relase, please contact sayhi@circleci.com. We will support general release soon!"]
-          (om/build osx-overview plan))
+          (om/build osx-overview plan))
         (when (and (feature/enabled? :ios-build-usage)
                    (pm/osx? plan))
           (om/build osx-usage-table {:plan plan}))]]))))


Using url to switch between selected plan tabs.

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -654,21 +654,17 @@
                     " ended " (pluralize (Math/abs (pm/days-left-in-trial plan)) "day")
                     " ago. Pay now to enable builds of private repositories."])))]]]]])))))

-(defn pricing-tabs [{:keys [app plan checkout-loaded? starting-tab]} owner]
-  (reify
-    om/IInitState
-    (init-state [_]
-      {:selected-tab (or starting-tab :linux)})
-
-    om/IRenderState
-    (render-state [_ {:keys [selected-tab]}]
+(defn pricing-tabs [{:keys [app plan checkout-loaded? selected-tab] :or {selected-tab :linux}} owner]
+  (reify
+    om/IRender
+    (render[_]
       (html [:div {:data-component `pricing-tabs}
              [:ul.nav.nav-tabs
               [:li {:class (when (= selected-tab :linux) "active")}
-               [:a {:on-click #(om/set-state! owner [:selected-tab] :linux)}
+               [:a {:href (routes/v1-org-settings-path {:org (:org_name plan) :_fragment "linux-pricing"})}
                 [:i.fa.fa-linux.fa-lg] "Build on Linux"]]
               [:li {:class (when (= selected-tab :osx) "active")}
-               [:a {:on-click #(om/set-state! owner [:selected-tab] :osx)}
+               [:a {:href (routes/v1-org-settings-path {:org (:org_name plan) :_fragment "osx-pricing"})}
                 [:i.fa.fa-apple.fa-lg] "Build on OS X"]]]
              (condp = selected-tab
                :linux [:div.card
@@ -729,7 +725,7 @@
               (if (feature/enabled? :osx-ga-inner-pricing)
                 [:div
                  (om/build pricing-tabs {:app app :plan plan :checkout-loaded? checkout-loaded?
-                                         :starting-tab (pricing-starting-tab (get-in app state/org-settings-subpage-path))})]
+                                         :selected-tab (pricing-starting-tab (get-in app state/org-settings-subpage-path))})]

                 [:div
                  (om/build linux-plan {:app app :checkout-loaded? checkout-loaded?})


add eggs

add eggs

--- clojure/src/dnd/level.cljs
+++ clojure/src/dnd/level.cljs
@@ -1,4 +1,6 @@
-(ns dnd.level)
+(ns dnd.level
+   (:require
+    [ dnd.character :as character ]))

 (def block {
             :x 0
@@ -11,8 +13,20 @@
 (def height 10)

 (defn make-block [x y]
-  (let [solid (> (rand) 0.9)]
-    (assoc block :x x :y y :solid solid)))
+  (let [solid (> (rand) 0.9)
+        walkable (not solid)
+        has-inhabitant (> (rand) .8)
+        inhabitants (if (and (not solid) has-inhabitant)
+                      [(assoc character/character :char "e" :color (rand-int 256))]
+                      [])
+        color (if (and walkable (> (rand) 0.9)) 4 2)]
+    (assoc block
+           :x x
+           :y y
+           :solid solid
+           :inhabitants inhabitants
+           :color color
+           )))

 (defn make-level
   ([]


added "menu" state

added "menu" state

--- src/ui/state.cljs
+++ src/ui/state.cljs
@@ -11,12 +11,12 @@
   (apply str (take (inc (rand-int 5)) (repeatedly rand-char))))

 (defonce app-state
-  (atom {:text "Hello Ringo!"
+  (atom {:text "Hello Mala."
          :devices {:all []}
          :chart {:data []}
          :words (into []
                       (map (fn [w i] {:index i :word w :count (count w)})
                            (sort (into [] (take 100 (repeatedly rand-word))))
-                           (range)))}))
-
-
+                           (range)))
+         :menu [{:name "Typeahead" :path "/typeahead"}
+                {:name "Dimple" :path "/graph"}]}))


Overwriting shutdown behavior in stress-test, maybe this makes travis happy?

--- test/clj/lambdacd/stress_test.clj
+++ test/clj/lambdacd/stress_test.clj
@@ -78,7 +78,8 @@
           config   {:home-dir             home-dir
                     :name                 "deadlock pipeline"
                     :step-updates-per-sec 10
-                    :use-new-event-bus    true}
+                    :use-new-event-bus    true
+                    :shutdown-sequence    (fn [& _ ] (println "Shutting down deadlock-test pipeline, doing nothing"))}
           pipeline (lambdacd.core/assemble-pipeline pipeline-def config)
           sub (lambdacd.event-bus/subscribe (:context pipeline) :step-finished)
           count-finished (atom 0)]


Text correction

Text correction

--- src/clj/popchange/views/raster_calculation.clj
+++ src/clj/popchange/views/raster_calculation.clj
@@ -158,7 +158,7 @@
   [:div.container
    [:div.page-header
     [:h1 "Raster Calculation Visualisation"]]
-   [:p.lead "To compute a map of differences between two years enter the most recent year (e.g., 2011) first (" [:code "[set 1]"] ") and the older year (e.g., 1991) second (" [:code "[set 2]"] "). Negative values will represent decreases and positive values will represent increases."]
+   [:p.lead "Generate a visualisation based on the calculation between two data sets to identify areas of positive or negative growth. To compute a map of differences between two years enter the most recent year (e.g., 2011) first (" [:code "[set 1]"] ") and the older year (e.g., 1991) second (" [:code "[set 2]"] "). Negative values will represent decreases and positive values will represent increases."]

    [:div.col-md-4
     [:div.non-js


Before refactoring opencl stuff.

Before refactoring opencl stuff.

--- src/clojure/uncomplicate/neanderthal/block.clj
+++ src/clojure/uncomplicate/neanderthal/block.clj
@@ -12,8 +12,6 @@
            [uncomplicate.neanderthal.protocols
             BLAS RealBufferAccessor BufferAccessor
             RealVector RealMatrix Vector Matrix RealChangeable Block]))
-
-;;TODO clean up

 (def ^:private DIMENSIONS_MSG
   "Vector dimensions should be %d.")


Added deseasonalization test, tweaked shorten-ts test


Added support for multiple expressions in test and output

--- lib/compojure/doctest/doctest.clj
+++ lib/compojure/doctest/doctest.clj
@@ -20,9 +20,14 @@
   :expected
   :actual)

-(defn- pushback-str
+(defn- read-str
+  "Parse a string and return a list of all Clojure expressions from it."
   [string]
-  (new PushbackReader (new StringReader string)))
+  (let [eof    (new Object)
+        reader (new PushbackReader (new StringReader string))]
+    (take-while
+      #(not (identical? % eof))
+       (repeatedly #(read reader false eof)))))

 (defn- file-reader
   "Return a buffered file reader."
@@ -42,7 +47,7 @@
      (map (partial re-sub #"^. ?" "") lines))])

 (defn- expr-marker?
-  "Is the line marked as an expression?"
+  "Is the line marked as an test expression?"
   [[marker _]]
   (= marker \>))

@@ -50,14 +55,14 @@
   "Does a test result match the marker/value pair?"
   [marker expected actual]
   (case marker
-    \= (= actual (read (pushback-str expected)))
-    \` (= actual expected)))
+    \= (= actual (last (read-str expected)))
+    \` (= (.trim actual) (.trim expected))))

 (defn eval-test
   "Evaluate a test parsed from a file, returning true if the test passes."
   [[[[_ expr]] [[marker expected]]]]
-  (let [expr     (read (pushback-str expr))
-        actual   (eval expr)
+  (let [expr     (read-str expr)
+        actual   (last (map eval expr))
         success? (result-matches? marker expected actual)]
     (struct result
        expr success? expected actual)))
@@ -78,7 +83,7 @@
   [results]
   (doseq result (filter (complement :success?) results)
     (.println *test-out*
-      (str (pr-str (result :expr))
+      (str (pr-str (last (result :expr)))
            "\n  expected: " (pr-str (result :expected))
            "\n  actual:   " (pr-str (result :actual)) "\n")))
   (.println *test-out*


Don't run ES publisher in email test

Don't run ES publisher in email test

--- test/runbld/test/publish_test.clj
+++ test/runbld/test/publish_test.clj
@@ -20,7 +20,7 @@
   (with-redefs [elasticsearch/index (make-error-maker "es")
                 email/send (make-error-maker "email")]
     (let [opts (opts/parse-args ["-c" "test/runbld.yaml"
-                                   "--job-name" "elastic,proj1,master"
+                                 "--job-name" "elastic,proj1,master"
                                  "test/success.bash"])]
       (is (= 2 (count @(:errors (main/run opts))))))))

@@ -58,7 +58,9 @@

 (deftest email
   (let [sent (atom [])]
-    (with-redefs [email/send* (fn [conn from to subj body]
+    (with-redefs [publish/handlers (fn []
+                                     [#'runbld.publish.email/send])
+                  email/send* (fn [conn from to subj body]
                                 (swap! sent conj [to body]))]

       (let [opts (opts/parse-args ["-c" "test/runbld.yaml"