[#3083] Refactor

[#3083] Refactor

--- backend/src/akvo/lumen/lib/transformation/engine.clj
+++ backend/src/akvo/lumen/lib/transformation/engine.clj
@@ -163,7 +163,7 @@
     (throw (ex-info "Failed to transform. Transformation can't have columns from more than one data-group specified"
                     {:transformation transformation}))))

-(defn data-group-by-tx [transformation data-groups]
+(defn data-group-by-op [transformation data-groups]
   (let [columns-in-transformation (columns-used (w/keywordize-keys transformation) (reduce into [] (map :columns data-groups)))
         _  (ensure-one-data-group-related transformation columns-in-transformation data-groups)
         column-name (first columns-in-transformation)]
@@ -177,7 +177,7 @@
   4. separate transformation data-group columns from the others"
   [{:keys [tenant-conn] :as deps}
    {:keys [transformation data-groups data-group]}]
-  (let [data-group (or data-group (data-group-by-tx transformation data-groups))
+  (let [data-group (or data-group (data-group-by-op transformation data-groups))
         source-table (:table-name data-group)
         other-dgs-columns (reduce (fn [c dg] (if (= (:id dg) (:id data-group))
                                                c (into c (:columns dg)))) [] data-groups)
@@ -488,7 +488,7 @@
     (if-let [transformation (first transformations)]
       (let [columns (reduce into [] (map :columns data-groups))
             transformation       (adapt-transformation transformation old-columns columns)
-            data-group (data-group-by-tx transformation data-groups)
+            data-group (data-group-by-op transformation data-groups)
             avoid-tranformation? (let [t (w/keywordize-keys transformation)]
                                    (and
                                     (avoidable-if-missing? t)


kafka component has been removed from hellhound.kafka

--- extra_components/kafka/src/clj/hellhound/components/kafka.clj
+++ extra_components/kafka/src/clj/hellhound/components/kafka.clj
@@ -1,28 +0,0 @@
-(ns hellhound.components.kafka
-  (:require [kafka-clj.client    :as kafka]
-            [hellhound.core      :as hellhound]
-            [hellhound.component :as component]))
-
-
-(defn start
-  [address config]
-
-  (fn
-    [this context]
-    (let [[input output] (component/io this)
-          connector      (kafka/create-connector address config)]
-      (stream/consume #(kafka/send-msg connector %) input)
-      (assoc this :connector connector))))
-
-(defn stop
-  [this])
-
-
-
-
-
-
-
-
-(or (hellhound/get-config [:kafka :host]) "localhost")
-(or (hellhound/get-config [:kafka :port]) "9092")


(PE-34383) Allow running with jdk 17 without warnings

--- src/puppetlabs/puppetdb/cli/util.clj
+++ src/puppetlabs/puppetdb/cli/util.clj
@@ -24,6 +24,7 @@
     (re-matches #"1\.[89]($|(\..*))" version) :deprecated
     (re-matches #"10($|(\..*))" version) :deprecated
     (re-matches (re-pattern (str supported-java-version "($|(\\..*))")) version) :official
+    (re-matches #"17($|(\..*))" version) :tested
     :else :unknown))

 (defn jdk-unsupported-msg [version]


Added an init fn and move the event registration code there.

--- src/traveler.clj
+++ src/traveler.clj
@@ -10,9 +10,13 @@
 (defn user-in [db-conn user]
   (tx-entity! db-conn :user (hatch/slam-all user :user)))   ; TODO: consider having gangway do a slam-all

-(defn start!
-  "Galleon start up fn that registers events with Flare."
+(defn init!
   [system]
   (flare.event/register! (:db-conn system) :traveler :user
                          (traveler.schema/attribute-names :user))
   system)
+
+(defn start!
+  "Galleon start up fn that registers events with Flare."
+  [system]
+  system)


prompt for java.library.path

prompt for java.library.path

--- src/cake/tasks/compile.clj
+++ src/cake/tasks/compile.clj
@@ -88,4 +88,3 @@
         dest (prompt-read (format "java.library.path [%s]:" default))
         dest (if (= "" dest) default dest)]
     (apply sudo "cp" (conj files dest))))
-


Render Musiknotes signatures properly

Render Musiknotes signatures properly

--- src/catalog/layout/fop.clj
+++ src/catalog/layout/fop.clj
@@ -144,6 +144,10 @@
   (when signature
     (block {:keep-with-previous "always"} (bold "Ausleihe:") " " signature)))

+(defn- ausleihe-multi [signatures]
+  (when signatures
+    (block {:keep-with-previous "always"} (bold "Ausleihe:") " " (layout/braille-signatures signatures))))
+
 (defn- verkauf [product-number price]
   (when product-number
      (block {:keep-with-previous "always"} (bold "Verkauf:") " " price ", " (layout/braille-signatures product-number))))
@@ -173,8 +177,7 @@
    (block (wrap genre-text "Genre: "))
    (block (wrap description))
    (block producer-brief (if rucksackbuch? (str ", Rucksackbuch Nr. " rucksackbuch-number) "") ".")
-   (when library-signature
-     (block {:keep-with-previous "always"} (bold "Ausleihe:") " " (layout/braille-signatures library-signature)))
+   (ausleihe-multi library-signature)
    (verkauf product-number price)))

 (defmethod entry-sexp :grossdruck
@@ -233,8 +236,8 @@
    (entry-heading-sexp creator record-id title subtitles name-of-part source-publisher source-date)
    (block (wrap description))
    (block (wrap producer-brief))
-   (ausleihe library-signature))
-   (verkauf product-number price))
+   (ausleihe-multi library-signature)
+   (verkauf product-number price)))

 (defmethod entry-sexp :taktilesbuch
   [{:keys [creator record-id title subtitles name-of-part source-publisher source-date


cleanup a bit

cleanup a bit

--- src/cljs/unfolds/core.cljs
+++ src/cljs/unfolds/core.cljs
@@ -80,7 +80,7 @@
 ;; =============================================================================
 ;; Components

-(defn item-view [item owner {:keys [navigate event]}]
+(defn item-view [item owner]
   (reify
     om/IRender
     (render [_]
@@ -96,7 +96,7 @@
 (defn item-add-view [item owner]
   (reify
     om/IRenderState
-    (render-state [_ state] ;; keys chan as etc?
+    (render-state [_ state]
       (let [event-chan (om/get-state owner [:event-chan])]
         (dom/div #js {:id "item-add-view"}
         (dom/div #js {:id "item-info"}
@@ -134,14 +134,10 @@
       (put! event-chan {:op :search :data {:subs search}}))))

 (defn search-view [items owner]
- ;;defn search-view [items owner {:keys [navigate event]}]
   (reify
     om/IRenderState
     (render-state [_ state]
-      (let [event-chan (om/get-state owner [:event-chan])
-            ;; opts {:navigate navigate
-            ;;       :event event}
-            ]
+      (let [event-chan (om/get-state owner [:event-chan])]
         (dom/div #js {:id "search-view"}
                  (dom/p nil "Currently only titles are searchable. It
                  might take a few seconds before entries are
@@ -171,9 +167,7 @@
   (reify
     om/IInitState
     (init-state [_]
-      {:chans {:event-chan (chan (sliding-buffer 1))}
-       :navigate (chan)
-       :event (chan (sliding-buffer 1))})
+      {:chans {:event-chan (chan (sliding-buffer 1))}})

     om/IWillMount
     (will-mount [_]
@@ -182,9 +176,7 @@
         (go
           (while true
             (let [{:keys [op data]} (<! event-chan)]
-              (prn "event-chan " op ": " data)
               (condp = op
-
                 :view-new
                 (do
                   (.setToken history "/new")


Link directly to statuspage page

Link directly to statuspage page

This avoids certificate issues with using a CNAME.

Fixes #830.

--- src/clojars/web/common.clj
+++ src/clojars/web/common.clj
@@ -28,7 +28,7 @@
   (if footer-links?
     [:footer.row
      (link-to "https://github.com/clojars/clojars-web/wiki/About" "about")
-     (link-to "http://status.clojars.org" "status")
+     (link-to "https://clojars.statuspage.io" "status")
      (link-to "/projects" "projects")
      (link-to "https://github.com/clojars/clojars-web/wiki/Contributing" "contribute")
      (link-to "https://groups.google.com/forum/?fromgroups#!topicsearchin/clojars-maintainers/group:clojars-maintainers$20AND$20subject:ann" "news")


Added text-area to html_helpers, fixed .js bug Perry Trolard found

--- lib/compojure/html/html_helpers.clj
+++ lib/compojure/html/html_helpers.clj
@@ -48,6 +48,10 @@
   [name]
   [:input {:type "text" :name (str* name) :id (str* name)}])

+(defn text-area
+  [name]
+  [:textarea {:name (str* name) :id (str* name)} ""])
+
 (defn hidden-field
   [name value]
   [:input {:type  "hidden"
@@ -83,7 +87,7 @@
   [& styles]
   (domap style styles
     [:link {:type "text/css"
-            :href (str @*static* "/stylesheet/" style ".js")}]))
+            :href (str @*static* "/stylesheet/" style ".css")}]))

 (defn xhtml-tag
   [lang & contents]


refactoring dao code

refactoring dao code

--- src/ruuvi_server/models/entities.clj
+++ src/ruuvi_server/models/entities.clj
@@ -16,13 +16,13 @@
   (defentity event-extension-type
     (table :event_extension_types)
     (pk :id)
-    (entity-fields :name)
+    (entity-fields :name :description)
     )

   (defentity event-extension-value
     (table :event_extension_values)
     (pk :id)
-    (entity-fields :id :value)
+    (entity-fields :value)
     (belongs-to event-extension-type {:fk :event_extension_type_id})
     )

@@ -42,20 +42,41 @@
     )
 )

+;; private functions
+(defn- to-sql-timestamp [date]
+  (if date
+    (java.sql.Date. (.getTime date))
+    nil))
+
+(defn- current-sql-timestamp []
+  (java.sql.Date. (java.util.Date.)))
+
+(defn- remove-nil-values [map-data]
+  (flatten (filter (fn [x] (nth x 1) ) map-data) ))
+
+;; public functions
 (defn get-event [event_id]
-  (first (select event (with tracker) (with event-location) (with event-extension-value) (where {:id event_id})))
+  (first (select event
+                 (with tracker)
+                 (with event-location)
+                 (with event-extension-value)
+                 (where {:id event_id})))
   )

-(defn get-tracker [tracker-identifier]
+(defn get-tracker [id]
+  (first (select tracker
+                 (where {:id id}))))
+
+(defn get-tracker-by-identifier [tracker-identifier]
   (first (select tracker
                  (where {:tracker_identifier tracker-identifier}))))

-(defn get-tracker! [tracker-identifier & tracker-name]
-  (let [existing-tracker (get-tracker tracker-identifier)]
+(defn get-tracker-by-identifier! [tracker-identifier & tracker-name]
+  (let [existing-tracker (get-tracker-by-identifier tracker-identifier)]
     (if existing-tracker
       existing-tracker
       (insert tracker (values {:tracker_identifier tracker-identifier
-                              :name tracker-name}))
+                              :name (or tracker-name tracker-identifier)}))
       )))

 (defn get-extension-type-by-name [type-name]
@@ -74,12 +95,14 @@
   (let [extension-keys (filter (fn [key]
                                  (.startsWith (name key) "X-"))
                                (keys data))
-        tracker (get-tracker! (:tracker_identifier data))
+        tracker (get-tracker-by-identifier! (:tracker_identifier data))
         latitude (:latitude data)
         longitude (:longitude data)
+
         event-entity (insert event (values
                                     {:tracker_id (tracker :id)
-                                     :event_time (:event_time data)
+                                     :event_time (or (to-sql-timestamp (:event_time data))
+                                                     (current-sql-timestamp) )
                                      }))]

     (if (and latitude longitude)
@@ -91,6 +114,7 @@
                                :satellite_count (:satellite_count data)
                                :altitude (:altitude data)}))
       )
+
     (doseq [key extension-keys]
       (insert event-extension-value
               (values
@@ -101,9 +125,3 @@
                )))
     event-entity
  ))
-
-(defn -main []
-  (map-entities *database-config*)
-  (select tracker)
-  (get-tracker! "roo2" name)
-  )


_new isn't a thing

_new isn't a thing

--- src-cljs/frontend/components/build_steps.cljs
+++ src-cljs/frontend/components/build_steps.cljs
@@ -93,7 +93,7 @@
             "You can download the output once this step is finished."
             [:a {:href (:user-facing-output-url action)
                  :download "BuildOutput.txt"
-                 :target "_new"}
+                 :target "_blank"}
              (if (:truncated action)
                "Download the first 4MB as a file."
                "Download the full output as a file.")])])))))


added turn began state and documented ideal states

--- src/nonaga/draw.cljs
+++ src/nonaga/draw.cljs
@@ -3,6 +3,17 @@
   (:require [nonaga.core :as n]
             [nonaga.rules.ball :as b])
   (:use-macros [dommy.macros :only [sel1]]))
+
+; Events
+;
+; [:turn-began      :red]
+; [:marble-selected :red coords]
+; [:marble-moved    :red]
+; [:ring-selected   :ring coords]
+; [:turn-began      :blue]
+; [:marble-selected :blue coords]
+; [:marble-moved    :blue]
+; [:ring-selected   :blue coords]

 (defn hex->svg [[hex-x hex-y]]
   (let [width  40
@@ -70,7 +81,9 @@
 (def board
   (create-class
     "getInitialState"
-    (fn [] #js {:wrapper n/initial-game})
+    (fn []
+      (let [initial-state (assoc n/initial-game :event [:turn-began :red])]
+        #js {:wrapper initial-state}))
     "render"
     (fn []
       (this-as this


Crude (but working) attempt at querying a KStreams store

:-D

--- clstreams/src/clstreams/webapi.clj
+++ clstreams/src/clstreams/webapi.clj
@@ -1,11 +1,16 @@
 (ns clstreams.webapi
-  (:require [ring.util.response :refer (response)]
-            [ring.middleware.json :refer (wrap-json-body wrap-json-response)]
+  (:require [clstreams.webapi.component :refer [new-immutant]]
+            [ring.middleware.json :refer [wrap-json-body wrap-json-response]]
+            [ring.util.response :refer [response]]
+            [clstreams.kstreams :as ks])
+  (:import org.apache.kafka.streams.state.QueryableStoreTypes))

-            [clstreams.webapi.component :refer (new-immutant)]))
+(defn main-handler [{{kstreams :kstreams} :pipeline} request]
+  (let [store (.store kstreams "Counts" (QueryableStoreTypes/keyValueStore))]
+    (response (str (.get store "kafka")))))

 (defn make-app [component]
-  (-> (fn [request] (response (str (into {} component))))
+  (-> (partial main-handler component)
       wrap-json-body
       wrap-json-response))


authenticate profile updates

authenticate profile updates

--- src/ontrail/core.clj
+++ src/ontrail/core.clj
@@ -68,7 +68,8 @@
   (GET "/rest/v1/weekly/:user" {params :params} (json-response (weekly-wrapper params)))

   (GET "/rest/v1/profile/:user" [user] (json-response (get-profile user)))
-  (POST "/rest/v1/profile" {params :params cookies :cookies} (json-response (post-profile (user-from-cookie cookies) params)))
+  (POST "/rest/v1/profile" {params :params cookies :cookies}
+    (is-authenticated? cookies (json-response (post-profile (user-from-cookie cookies) params))))

   (GET "/rest/v1/email" {cookies :cookies} (json-response {:email (:email (get-user (user-from-cookie cookies)))}))


replaceRoot introduced in 3.4

replaceRoot introduced in 3.4

--- src/ophion/store.clj
+++ src/ophion/store.clj
@@ -42,11 +42,20 @@

 (defn load-results
   [db key]
-  (db/aggregate
-   db :ophionresults
-   [{:$match {:key key}}
-    {:$sort {:order 1}}
-    {:$replaceRoot {:newRoot "$result"}}]))
+  (map
+   :result
+   (db/aggregate
+    db :ophionresults
+    [{:$match {:key key}}
+     {:$sort {:order 1}}])))
+
+;; (defn load-results
+;;   [db key]
+;;   (db/aggregate
+;;    db :ophionresults
+;;    [{:$match {:key key}}
+;;     {:$sort {:order 1}}
+;;     {:$replaceRoot {:newRoot "$result"}}]))

 (defn queries-for-focus
   [db focus]


wip: control flow with results chan per org

--- src/otto/control.clj
+++ src/otto/control.clj
@@ -3,26 +3,26 @@
             [otto.github :as github]))

 (defn- update-repository
-  [repos v k]
-  (println v k)
-  (not (nil? v)))
+  [repos r]
+  (if (nil? r)
+    false
+    (do (println r)
+        true)))

 (defn- update-repositories
-  [orgs user update-fn]
+  [org user repo-fn]
   (let [r (chan)
         t (timeout 1000)]
-    (doseq [o orgs]
-      (github/fetch-repositories o user r))
+    (github/fetch-repositories org user r)
     (loop []
-      (if (update-fn (alts!! [r t]))
-        (recur)
-        (do (close! r)
-            (close! t))))))
+      (if (apply repo-fn (alts!! [r t]))
+        (recur)))))

 (defn periodically-update
   [orgs user interval repos]
-  (let [update-fn #(apply update-repository repos %)]
+  (doseq [o orgs]
     (go (loop []
           (<! (timeout interval))
-          (update-repositories orgs user update-fn)
+          (update-repositories o user (fn [r _]
+                                        (update-repository repos r)))
           (recur)))))


Update autocomplete behaviour to point to plugin

--- src/lt/objs/langs/clj.cljs
+++ src/lt/objs/langs/clj.cljs
@@ -619,8 +619,8 @@
                                     type (-> info :mime mime->type)
                                     ns (:ns info)
                                     code (case type
-                                           "clj" `(lt.objs.langs.clj.auto-complete/clj-hints '~ns)
-                                           "cljs" `(lt.objs.langs.clj.auto-complete/cljs-hints '~ns))
+                                           "clj" `(lighttable.nrepl.auto-complete/clj-hints '~ns)
+                                           "cljs" `(lighttable.nrepl.auto-complete/cljs-hints '~ns))
                                     info (assoc info
                                            :code (pr-str code)
                                            :meta {:verbatim true


Add a bunch of generator doc strings

Add a bunch of generator doc strings

--- src/simple_check/generators.clj
+++ src/simple_check/generators.clj
@@ -3,7 +3,7 @@
   (:refer-clojure :exclude [int vector list map keyword char boolean]))

-;; TODO: namespace the :gen tag
+;; TODO: namespace the :gen tag?

 ;; Helpers
 ;; ---------------------------------------------------------------------------
@@ -28,6 +28,8 @@
      (clojure.core/map (partial call-gen generator r) size-seq))))

 (defn sample
+  "Return a sequence of `num-samples` (default 10)
+  realized values from `generator`."
   ([generator]
    (sample generator 10))
   ([generator num-samples]
@@ -37,22 +39,29 @@
 ;; ---------------------------------------------------------------------------

 (defprotocol Shrink
-  (shrink [this]))
+  "The Shrink protocol exists for dispatching the shrink function
+  based on type."
+  (shrink [this]
+          "Return a (possibly empty) sequence of smaller values.
+          Care must be given to not create any loops if shrink is called
+          recursively on the sequence."))

 (defn fmap
-  "NOTE: since `gen` is a function, this is just equivalent
-  to `comp`. Perhaps using fmap will be more confusing to people?"
+  "Create a new generator that calls `f` on the generated value before
+  returning it"
   [f gen]
   [:gen (fn [rand-seed size]
           (f (call-gen gen rand-seed size)))])

 (defn bind
+  "Monadic bind"
   [gen k]
   [:gen (fn [rand-seed size]
           (let [value (call-gen gen rand-seed size)]
             (call-gen (k value) rand-seed size)))])

 (defn return
+  "Create a generator that always returns `val`"
   [val]
   [:gen (fn [rand-seed size] val)])

@@ -67,6 +76,8 @@
     (- )))

 (defn choose
+  "Create a generator that returns numbers in the range
+  `min-range` to `max-range`"
   [min-range max-range]
   (let [diff (Math/abs (- max-range min-range))]
     [:gen (fn [rand-seed _size]
@@ -76,6 +87,13 @@

 (defn one-of
+  "Create a generator that randomly chooses a value from the list of
+  provided generators.
+
+  Examples:
+
+    (one-of [gen/int gen/boolean (gen/vector gen/int)])
+  "
   [generators]
   (bind (choose 0 (dec (count generators)))
         #(nth generators %)))
@@ -88,17 +106,40 @@
       (recur tail (- n chance)))))

 (defn frequency
+  "Create a generator that chooses a generator from `pairs` based on the
+  provided likelihoods. The likelihood of a given generator being chosen is
+  its likelihood divided by the sum of all likelihoods
+
+  Examples:
+
+    (gen/frequency [[5 gen/int] [3 (gen/vector gen/int)] [2 gen/boolean]])
+  "
   [pairs]
   (let [total (apply + (clojure.core/map first pairs))]
     (bind (choose 1 total)
           (partial pick pairs))))

 (defn elements
+  "Create a generator that randomly chooses an element from `coll`.
+
+  Examples:
+
+    (gen/elements [:foo :bar :baz])"
   [coll]
   (fmap #(nth coll %)
         (choose 0 (dec (count coll)))))

 (defn such-that
+  "Create a generator that generates values from `gen` that satisfy predicate
+  `f`. Care is needed to ensure there is a high chance `gen` will satisfy `f`,
+  otherwise it will keep trying forever. Eventually we will add another
+  generator combinator that only tries N times before giving up. In the Haskell
+  version this is called `suchThatMaybe`.
+
+  Examples:
+
+    ;; generate non-empty vectors of integers
+    (such-that (gen/vector gen/int) not-empty)"
   [gen f]
   [:gen (fn [rand-seed size]
     (let [value (call-gen gen rand-seed size)]
@@ -110,6 +151,13 @@
 ;; ---------------------------------------------------------------------------

 (defn pair
+  "Create a generator that generates two-vectors that generate a value
+  from `a` and `b`.
+
+  Examples:
+
+    (pair gen/int gen/int)
+  "
   [a b]
   [:gen (fn [rand-seed size]
     [(call-gen a rand-seed size)
@@ -154,10 +202,17 @@
    (call-gen (choose (- size) size)
       rand-seed size)))

-(def int [:gen int-gen])
-
-(def pos-int (fmap #(Math/abs %) int))
-(def neg-int (fmap (partial * -1) pos-int))
+(def int
+  "Generates a positive or negative integer bounded by the generator's
+  `size` paramter."
+  [:gen int-gen])
+
+(def pos-int
+  "Generate positive integers bounded by the generator's `size` paramter."
+  (fmap #(Math/abs %) int))
+(def neg-int
+  "Generate negative integers bounded by the generator's `size` paramter."
+  (fmap (partial * -1) pos-int))

 (defn shrink-int
   [integer]
@@ -173,6 +228,16 @@
 ;; ---------------------------------------------------------------------------

 (defn tuple
+  "Create a generator that returns a vector, whose elements are chosen
+  from the generators in the same position.
+
+  Examples:
+
+    (def t (tuple [gen/int gen/boolean]))
+    (sample t)
+    ;; => ([1 true] [2 true] [2 false] [1 false] [0 true] [-2 false] [-6 false]
+    ;; =>  [3 true] [-4 false] [9 true]))
+  "
   [generators]
   [:gen (fn [rand-seed size]
     (vec (clojure.core/map #(call-gen % rand-seed size) generators)))])
@@ -189,6 +254,8 @@
 ;; ---------------------------------------------------------------------------

 (defn vector
+  "Create a generator whose elements are chosen from `gen`. The count of the
+  vector will be bounded by the `size` generator parameter."
   [gen]
   [:gen (fn [rand-seed size]
     (let [num-elements (Math/abs (call-gen int rand-seed size))]
@@ -204,6 +271,7 @@
 ;; ---------------------------------------------------------------------------

 (defn list
+  "Like `vector`, but generators lists."
   [gen]
   [:gen (fn [rand-seed size]
     (let [num-elements (Math/abs (call-gen int rand-seed size))]
@@ -223,6 +291,8 @@
 ;; ---------------------------------------------------------------------------

 (defn map
+  "Create a generator that generates maps, with keys chosen from
+  `ken-gen` and values chosen from `val-gen`."
   [key-gen val-gen]
   [:gen (fn [rand-seed size]
     (let [map-size (call-gen (choose 0 size) rand-seed size)
@@ -240,14 +310,20 @@
 ;; (generator and shrink strategy pretty much ripped from Haskell impl.)
 ;; ---------------------------------------------------------------------------

-(def char (fmap clojure.core/char (choose 0 255)))
-
-(def char-ascii (fmap clojure.core/char (choose 32 126)))
-
-(def char-alpha-numeric (fmap clojure.core/char
-                              (one-of [(choose 48 57)
-                                       (choose 65 90)
-                                       (choose 97 122)])))
+(def char
+  "Generates character from 0-255"
+  (fmap clojure.core/char (choose 0 255)))
+
+(def char-ascii
+  "Generate only ascii character"
+  (fmap clojure.core/char (choose 32 126)))
+
+(def char-alpha-numeric
+  "Generate alpha-numeric characters"
+  (fmap clojure.core/char
+        (one-of [(choose 48 57)
+                 (choose 65 90)
+                 (choose 97 122)])))

 (defn- stamp
   [c]
@@ -288,19 +364,25 @@
   [rand-seed size]
   (clojure.string/join (repeatedly size #(call-gen char rand-seed size))))

-(def string [:gen string-gen])
+(def string
+  "Generate strings"
+  [:gen string-gen])

 (defn string-ascii-gen
   [rand-seed size]
   (clojure.string/join (repeatedly size #(call-gen char-ascii rand-seed size))))

-(def string-ascii [:gen string-ascii-gen])
+(def string-ascii
+  "Generate ascii strings"
+  [:gen string-ascii-gen])

 (defn string-alpha-numeric-gen
   [rand-seed size]
   (clojure.string/join (repeatedly size #(call-gen char-alpha-numeric rand-seed size))))

-(def string-alpha-numeric [:gen string-alpha-numeric-gen])
+(def string-alpha-numeric
+  "Generate alpha-numeric strings"
+  [:gen string-alpha-numeric-gen])

 (defn shrink-string
   [s]
@@ -313,8 +395,10 @@
 ;; Keyword
 ;; ---------------------------------------------------------------------------

-(def keyword (fmap clojure.core/keyword
-                   (such-that string-alpha-numeric #(not= "" %))))
+(def keyword
+  "Generate keywords"
+  (fmap clojure.core/keyword
+        (such-that string-alpha-numeric #(not= "" %))))

 (defn shrink-keyword
   [k]


RR/PLD: attempt to drop node in read-next-chuck!

--- src/hatti/ona/stream.cljs
+++ src/hatti/ona/stream.cljs
@@ -28,7 +28,8 @@
   (swap! agg conj data-chunk)
   (when (and (>= @read-count 100) (integer? (.log10 js/Math @read-count)))
     (put! channel {:data @agg})
-    (reset! agg [])))
+    (reset! agg [])
+    (.drop js/oboe)))

 (defn streamingly-read-json!
   "Given url, a node pattern matcher, and a callback, streaming-read json."


Turning things into more of a library

Turning things into more of a library

--- src/pianola/core.clj
+++ src/pianola/core.clj
@@ -28,6 +28,26 @@
        (nth aut avg)))
    cur-gen))

+(defn scale-rhythm [note]
+  (/ 1 (bit-shift-left 1 note)))
+
+(defn automate-music [automaton first-gen]
+  (let [rhythm-automaton (first automaton)
+        note-automaton (second automaton)
+        automate-rhythm (partial next-gen rhythm-automaton)
+        automate-notes (partial next-gen note-automaton)
+        rhythm (first first-gen)
+        notes (second first-gen)]
+    (phrase (map scale-rhythm (flatten (iterate automate-rhythm rhythm)))
+            (flatten (iterate automate-notes notes)))))
+
+(play-tune (automate-music [[2 0 1 3 5 4 6]
+                            [1 2 0 4 5 6 3]]
+                           [[2 3 2 3 1 2 2 2]
+                            [2 1 2 1 2 3 4 5]]))
+
+(live/stop)
+
 (def rhythm-automaton [2 0 1 3 5 4 6])
 (def note-automaton [1 2 0 4 5 6 3])

@@ -36,9 +56,6 @@

 (def automate-notes (partial next-gen note-automaton))
 (def automate-rhythm (partial next-gen rhythm-automaton))
-
-(defn scale-rhythm [note]
-  (/ 1 (bit-shift-left 1 note)))

 (next-gen notes)


closes #11373

closes #11373

Signed-off-by: Michele Balistreri <47483730395cccb6448ad7313d5cedb48de25e40@bitgamma.com>
Signed-off-by: andrey <b713972e59b8e606e23253c4a13e948139fea4d1@gmail.com>

--- src/status_im/keycard/sign.cljs
+++ src/status_im/keycard/sign.cljs
@@ -129,7 +129,7 @@
   (let [{:keys [result error]} (types/json->clj result)
         message (get-in db [:signing/sign :formatted-data :message])
         currency-contract (:currency message)]
-    (when-not (or (:receiver message) (:code message))
+    (when currency-contract
       (json-rpc/eth-call {:contract currency-contract
                           :method "decimals()"
                           :outputs ["uint8"]


use the currently selected account for signing messages/typed data

Signed-off-by: Michele Balistreri <47483730395cccb6448ad7313d5cedb48de25e40@bitgamma.com>

--- src/status_im/keycard/sign.cljs
+++ src/status_im/keycard/sign.cljs
@@ -21,7 +21,7 @@
         data                 (get-in db [:keycard :data])
         typed?               (get-in db [:keycard :typed?])
         pin                  (common/vector->string (get-in db [:keycard :pin :sign]))
-        from                 (get-in db [:signing/tx :from :address])
+        from                 (or (get-in db [:signing/tx :from :address]) (get-in db [:signing/tx :message :from]) (ethereum/default-address db))
         path                 (reduce
                               (fn [_ {:keys [address path]}]
                                 (when (= from address)


Encode indices as base64 for riak

Encode indices as base64 for riak

--- src/icecap/store/riak.clj
+++ src/icecap/store/riak.clj
@@ -1,18 +1,25 @@
 (ns icecap.store.riak
   (:require [clojure.core.async :as a :refer [thread]]
             [clojurewerkz.welle.kv :as kv]
+            [icecap.codec :refer [safebase64-encode]]
             [icecap.store.api :refer [Store]]))
+
+(defmacro ^:private riak-op
+  "Runs `body` in a thread, and encodes the index as urlsafe base64."
+  [& body]
+  `(let [~'index (safebase64-encode ~'index)]
+     (thread ~@body)))

 (defn riak-store
   "Creates a Riak-backed store."
   [conn bucket]
   (reify Store
     (create! [_ index blob]
-      (thread (kv/store conn bucket index blob)))
+      (riak-op (kv/store conn bucket index blob)))
     (retrieve [_ index]
-      (thread (kv/fetch-one conn bucket index)))
+      (riak-op (kv/fetch-one conn bucket index)))
     (delete! [_ index]
-      (thread (kv/delete conn bucket index)))))
+      (riak-op (kv/delete conn bucket index)))))

 (defn bucket-props
   "Creates some bucket props suitable for an icecap bucket.


(SERVER-1079) Add docstring to current-code-id function

--- src/clj/puppetlabs/services/versioned_code_service/versioned_code_service.clj
+++ src/clj/puppetlabs/services/versioned_code_service/versioned_code_service.clj
@@ -14,6 +14,8 @@

   (current-code-id
    [this environment]
+   "Returns the current code id (representing the freshest code) for the given environment.
+   In the case of a non-zero return from the code-id-command, returns nil."
    (let [code-id-script (get-in-config [:versioned-code :code-id-command])
          {:keys [exit-code stderr stdout]} (shell-utils/execute-command code-id-script [environment])]
      ; TODO Decide what to do about normalizing/sanitizing output with respect to


CMR-5520: dissoc instead of assign arbitrary fmt.

--- search-app/src/cmr/search/services/query_execution/multi_part_query_feature_common.clj
+++ search-app/src/cmr/search/services/query_execution/multi_part_query_feature_common.clj
@@ -42,8 +42,8 @@
   [query granule-field]
   (-> query
       (dissoc :result-features)
+      (dissoc :result-format)
       (assoc :page-size :unlimited
-             :result-format :xml
              :result-fields [(query-to-elastic/query-field->elastic-field
                               :concept-id :collection)])
       query-model/query


bugfix

bugfix

--- src/tango/generate_recalled.clj
+++ src/tango/generate_recalled.clj
@@ -63,7 +63,7 @@
   ;; Returns an updated hash-set to be supplied the next time this function is invoked.
   [exluded-rounds recalled-htmls write-fn]
   (let [new-htmls (filter #(nil? (get exluded-rounds (:activity/number %))) recalled-htmls)]
-    (reduce #(do (write-fn (str "nv_re_" (:activity/number %2) ".htm") (:html %2))
+    (reduce #(do (write-fn (str "ny_re_" (:activity/number %2) ".htm") (:html %2))
                  (conj %1 (:activity/number %2)))
             exluded-rounds
             new-htmls)))


sounds added back

sounds added back

--- src/divergence/system.cljs
+++ src/divergence/system.cljs
@@ -1,7 +1,7 @@
 (ns divergence.system
-  (:require  ;[divergence.audio :as a]
-             [divergence.physics :as phys]
-             [cljs.reader :as reader]))
+  (:require  [cljs.reader :as reader]
+             [divergence.audio :as a]
+             [divergence.physics :as phys]))

 ;;GLOBAL VALUES===============================================
 (def camera-width 900)
@@ -237,7 +237,7 @@
         (swap! e assoc-in [:acceleration] [0 1 0]))
       (when
         (and (= (@e :can-jump) 1) (actions :up))
-        ;(a/play-sound :jump)
+        (a/play-sound :jump)
         (swap! e assoc-in [:acceleration] [0 -4 0])
         (swap! e assoc-in [:can-jump] 0))


Schema for the join table; tweak the bootstrapping function

--- src/doctopus/db/schema.clj
+++ src/doctopus/db/schema.clj
@@ -30,7 +30,7 @@

 (def tentacle-schema
   [[:name "varchar(50)" "PRIMARY KEY"]
-   [:head_name "varchar(50)"]
+;   [:head_name "varchar(50)"]
    [:output_root "varchar(50)"]
    [:html_commands "varchar(250)"]
    [:source_control "varchar(50)"]
@@ -38,6 +38,10 @@
    [:entry_point "varchar(50)"]
    [:created "varchar(50)" "NOT NULL"]
    [:updated "varchar(50)" "NOT NULL"]])
+
+(def head-tentacle-schema
+  [[:head-name "varchar(50)" "FOREIGN KEY"]
+   [:tentacle-name "varchar(50)" "FOREIGN KEY"]])

 (defn- create-table!
   "creates a table with a given name and schema"
@@ -50,8 +54,9 @@
 (defn bootstrap
   "checks for the presence of tables and creates them if necessary"
   []
-  (do
-   (when (not (table-created? "heads"))
-     (create-table! "heads" head-schema))
-   (when (not (table-created? "tentacles"))
-     (create-table! "tentacles" tentacle-schema))))
+  (let [assure {"heads" head-schema
+                "tentacles" tentacle-schema
+                "head_tentacle_mappings" head-tentacle-schema}]
+    (doseq [[table-name schema] assure]
+      (when (not (table-created? table-name))
+        (create-table! "heads" schema)))))


add fixme statements

add fixme statements

--- ssclj/jar/src/main/clojure/com/sixsq/slipstream/ssclj/resources/common/cimi_filter.clj
+++ ssclj/jar/src/main/clojure/com/sixsq/slipstream/ssclj/resources/common/cimi_filter.clj
@@ -42,6 +42,9 @@
         "<"   (<  0 (compare value actual-value))
         ">"   (>  0 (compare value actual-value))))))

+;;
+;; FIXME: This will not correctly handle clauses like "'a'=attribute".
+;;
 (defn handle-comp
   ([x]
     x)
@@ -61,6 +64,9 @@
   [& preds]
   (apply every-pred preds))

+;;
+;; FIXME: This does not handle integers or booleans.
+;;
 (def ^:private transformations
   {:SingleQuoteString   remove-quotes
    :DoubleQuoteString   remove-quotes


simplify fn get-revpairs

simplify fn get-revpairs

--- src/revdiff/core.clj
+++ src/revdiff/core.clj
@@ -1,4 +1,3 @@
-;; TODO make get-revpairs non-recursive?
 ;; TODO make diffrevpairs non-recursive?

 (ns revdiff.core
@@ -82,9 +81,7 @@
 ;; revlist (9 8 6 4 1), return (8 9 6 8 4 6 1 4).

 (defn get-revpairs [revlist object]
-  (when (seq (rest revlist))
-    (concat (list (first (rest revlist)) (first revlist))
-            (get-revpairs (rest revlist) object))))
+  (interleave (rest revlist) (butlast revlist)))

 ;; Return a string containing the xml-formatted svn log for the requested
 ;; object.


Allow for using Riemann as a dependency (#881)

* Allow for using Riemann as a dependency.

While using Riemann by writing a configuration file is perfectly fine
for most purposes, sometimes people (particularly Clojure developers)
might prefer to stick to their existing workflows that typically involve
a true project manager such as Leiningen or Boot.  These tools in turn
allow the users to make use of the dev tools they've come to depend on,
such as the REPL, linters, code formatters, etc.

This PR introduces a new entrypoint that is the "run" function.  Users
can then declare Riemann as a dependency, import the "run" function,
then simply start Riemann by calling the "run" function with a "setup"
function, which contains code that they would otherwise put into the
configuration file.

* Rename "run" to "run!" to indicate side effects

--- src/riemann/bin.clj
+++ src/riemann/bin.clj
@@ -55,11 +55,11 @@
   []
   (if (not (.contains (. System getProperty "os.name") "Windows"))
     (sun.misc.Signal/handle
-      (sun.misc.Signal. "HUP")
-      (proxy [sun.misc.SignalHandler] []
-        (handle [sig]
-                (info "Caught SIGHUP, reloading")
-                (reload!))))))
+     (sun.misc.Signal. "HUP")
+     (proxy [sun.misc.SignalHandler] []
+       (handle [sig]
+         (info "Caught SIGHUP, reloading")
+         (reload!))))))

 (defn pom-version
   "Return version from Maven POM file."
@@ -79,11 +79,10 @@
   "Process identifier, such as it is on the JVM. :-/"
   []
   (let [name (-> (java.lang.management.ManagementFactory/getRuntimeMXBean)
-               (.getName))]
+                 (.getName))]
     (try
       (get (re-find #"^(\d+).*" name) 1)
       (catch Exception e name))))
-

 (defn run-tests-with-format
   "Run all tests matching `test-name-pattern`.
@@ -113,6 +112,18 @@
     (when-not (instance? DynamicClassLoader cl)
       (.setContextClassLoader thread (DynamicClassLoader. cl)))))

+(defn run!
+  "Start Riemann with the given setup function. The setup function is responsible
+  for executing code that you would normally put into your riemann.config file,
+  e.g. setting up streams."
+  [setup]
+  (info "PID" (pid))
+  (handle-signals)
+  (riemann.time/start!)
+  (setup)
+  (riemann.config/apply!)
+  nil)
+
 (defn -main
   "Start Riemann. Loads a configuration file from the first of its args."
   ([]
@@ -124,13 +135,8 @@
    (ensure-dynamic-classloader)
    (case command
      "start" (try
-               (info "PID" (pid))
                (set-config-file! config)
-               (handle-signals)
-               (riemann.time/start!)
-               (riemann.config/include @config-file)
-               (riemann.config/apply!)
-               nil
+               (run! #(riemann.config/include @config-file))
                (catch Exception e
                  (error e "Couldn't start")))


track bars now resize

track bars now resize

--- src/frontend/renderer.cljs
+++ src/frontend/renderer.cljs
@@ -205,7 +205,10 @@
                               :className "bar-tracker"
                               :style style}
                   (dom/div #js {:id "progress-track-ball-display"
-                                :className "track-ball-display"})))))))))
+                                :className "track-ball-display"})))))))
+    om/IDidMount
+    (did-mount [this]
+      (.addEventListener js/window "resize" #(om/set-state! owner #js {})))))

 (om/root resume-button core/app-state {:target (. js/document (getElementById "play-button"))})
 (om/root pause-button core/app-state {:target (. js/document (getElementById "pause-button"))})
@@ -230,6 +233,10 @@
           (dom/div #js {:id "volume-ball"
                         :className "bar-tracker"}
             (dom/div #js {:id "volume-ball-display"
-                          :className "track-ball-display"})))))))
+                          :className "track-ball-display"})))))
+
+    om/IDidMount
+    (did-mount [this]
+      (.addEventListener js/window "resize" #(om/set-state! owner #js {})))))

 (om/root volume player/app-state {:target (. js/document (getElementById "volume"))})


fixed collection-name compile error, oops

--- src/karras/collection.clj
+++ src/karras/collection.clj
@@ -177,7 +177,7 @@
   ([#^DBCollection collection keys cond initial reduce]
      (group collection keys cond initial reduce nil))
   ([#^DBCollection collection keys cond initial reduce finalize]
-     (let [cmd {:ns (collection-name collection)
+     (let [cmd {:ns (.getName collection)
                 :key (zipmap (map name keys) (repeat true))
                 :cond cond
                 :initial initial


Code column changed to nullable

Code column changed to nullable

--- src/wishlistd/models/create.clj
+++ src/wishlistd/models/create.clj
@@ -11,7 +11,7 @@
   (sql/with-connection db
     (sql/create-table :wishlist
     	              [:id :serial "PRIMARY KEY"]
-    	              [:code :varchar :unique "NOT NULL"]
+    	              [:code :varchar :unique]
 	                  [:title :varchar "NOT NULL"]
 	                  [:created_at :timestamp "NOT NULL" "DEFAULT CURRENT_TIMESTAMP"])))


Remove println and add sanity-check

Remove println and add sanity-check

--- src/holston/repository.clj
+++ src/holston/repository.clj
@@ -9,7 +9,6 @@
               "postgresql://localhost:5432/holston"))

 (defn add-tasting [tasting]
-  (println tasting)
   (jdbc/insert! db :tasting tasting))

 (defn get-brewery [name]
@@ -23,3 +22,7 @@

 (defn add-beer [name]
   (jdbc/insert! db :beer {:name name}))
+
+(defn db-sanity-check []
+  (str "Static query from DB value: " (:?column? (first (jdbc/query db
+           ["select 'foobar'"])))))


don't render layers without types

don't render layers without types

--- src-cljs/frontend/clipboard.cljs
+++ src-cljs/frontend/clipboard.cljs
@@ -262,7 +262,8 @@
                    (not (contains? #{"input" "textarea"} (str/lower-case (.-tagName target)))))))
     (.preventDefault e)
     (when-let [layers (seq (remove
-                            #(= :layer.type/group (:layer/type %))
+                            #(or (= :layer.type/group (:layer/type %))
+                                 (not (:layer/type %)))
                             (map #(dissoc (ds/touch+ (d/entity @(:db app-state) %))
                                           :unsaved)
                                  (get-in app-state [:selected-eids :selected-eids]))))]


Improve UX of schema

Improve UX of schema

--- src-cljs/photon/ui/frontend.cljs
+++ src-cljs/photon/ui/frontend.cljs
@@ -651,6 +651,8 @@
                                    (iframeio-upload-file "upload-form"
                                                          owner))
                        :action "/api/new-stream"}
+          (dom/input #js {:type "hidden" :name "token"
+                          :value (ck/get "token")} nil)
           (dom/h1 #js {:className "view-title"} "New Stream")
           (:upload-status state)
           (dom/div
@@ -800,7 +802,7 @@
             fn-clk (fn [_]
                      (go (let [res (<! (fn-post))]
                            (upd :auth res)
-                           (ck/set "token" (:simple-token (:body res))))))]
+                           (ck/set "token" (:token #_:simple-token (:body res))))))]
         (if (= 200 (:status (:auth state)))
           (set! (.-location js/window) "/ui")
           (dom/div nil
@@ -845,46 +847,108 @@
                                 % {:text (:analyse-stream data)}) %)
                              (:streams data))))))))

+(def type-mappings {"s/Str" "string"
+                    "s/Bool" "bool"})
+
+(defn type->text [t]
+  (get type-mappings t t))
+
+(defn m->text [m]
+  (let [t (map type->text m)
+        tt (if (string? m) (type->text m) (clojure.string/join ", " t))]
+    tt))
+
+(declare tree->js)
+
+(defmulti node->js
+  (fn [[_ v]]
+    (if (contains? v :leaf)
+      :leaf
+      (if-let [vv (get v "[]")]
+        (if (contains? vv :leaf)
+          :vector
+          :vector-object)
+        :tree))))
+
+;; TODO: Encapsulate into CSS classes
+
+(defn render-text [text mode]
+  (condp = mode
+    :required (str "" text "")
+    :optional text
+    :rare (str "" text "")
+    (pr-str mode)))
+
+(defmethod node->js :leaf [[k v]]
+  (let [sch (:leaf v)
+        ts (:type sch)
+        tt (m->text ts)
+        n (render-text (name k) (:mode sch)) ]
+    {:text (str n " [" tt "]")
+     :a_attr {:style "color: #111111;"}
+     :icon "ui/images/ic_short_text_black_18dp.png"}))
+
+(defmethod node->js :vector-object [[k v]]
+  (let [vv (get v "[]")]
+    {:text (str (name k) " [Array (Object)]")
+     :state {:opened false}
+     :icon "ui/images/ic_grid_on_black_18dp.png"
+     :children (tree->js vv)}))
+
+(defmethod node->js :vector [[k v]]
+  (let [vv (get v "[]")
+        leaf (:leaf vv)
+        under-type (m->text (:type leaf))]
+    {:text (str (render-text (name k) (:mode leaf))
+                " [Array (" under-type ")]")
+     :icon "ui/images/ic_more_horiz_black_18dp.png"}))
+
+(defmethod node->js :tree [[k v]]
+  {:text (str "" (name k) " [Object]")
+   :state {:opened false}
+   :icon "ui/images/ic_folder_open_black_18dp.png"
+   :children (tree->js v)})
+
 (defn tree->js [tree]
-  (map #(if (or (nil? (val %)) (= (val %) "[]"))
-          (name (key %))
-          {:text (name (key %))
-           :state {:opened false}
-           :children (tree->js (val %))})
-       tree))
+  (map node->js tree))

 (defn schema->tree [schema]
-  (reduce #(assoc-in %1 (key %2) nil) {} (:m schema)))
+  (reduce #(assoc-in %1 (key %2) {:leaf (val %2)}) {} (:m schema)))
+
+(defn produce-tree! [data]
+  (let [tj (tree->js (schema->tree (:schema data)))
+        cd (clj->js {:core {:data tj}})]
+    (.jstree ($ :#tree) cd)
+    nil))
+
+(defn clean-tree! [data]
+  (let [tj (tree->js (schema->tree (:schema data)))
+        cd (clj->js {:core {:data tj}})
+        t (.jstree ($ :#tree) true)]
+    (set! (.-data (.-core (.-settings t))) cd)
+    (.destroy t)
+    nil))

 (defn stream-schema [data owner]
   (reify
     om/IDidMount
     (did-mount [_]
-      (let [tj (tree->js (schema->tree (:schema data)))
-            cd (clj->js {:core {:data tj}})]
-        (.log js/console "Producing again" (pr-str cd))
-        (.jstree ($ :#tree) cd)
-        nil))
+      (produce-tree! data))
     om/IDidUpdate
     (did-update [_ _ _]
-      (let [tj (tree->js (schema->tree (:schema data)))
-            cd (clj->js {:core {:data tj}})
-            t (.jstree ($ :#tree) true)]
-        (.log js/console "Producing again" (pr-str cd))
-        (set! (.-data (.-core (.-settings t))) cd)
-        (.destroy t)
-        nil)
-      (let [tj (tree->js (schema->tree (:schema data)))
-            cd (clj->js {:core {:data tj}})]
-        (.log js/console "Producing again" (pr-str cd))
-        (.jstree ($ :#tree) cd)
-        nil))
+      (clean-tree! data)
+      (produce-tree! data))
     om/IRender
     (render [_]
-      (.log js/console "render")
-      (dom/div nil
-               (dom/div #js {:id "tree"})
-               (dom/p nil (pr-str data))))))
+      (dom/div
+       nil
+       (dom/div
+        #js {:className "container-fluid"}
+        (dom/div
+         #js {:className "row"}
+         (dom/div #js {:className "col-md-1" :id "tree"})
+         (dom/div #js {:className "col-md-1" :id "tree"} (dom/p nil "hello"))))
+       (dom/p nil (pr-str data))))))

 (defn widget-analyse [data owner]
   (reify


added master to the list of branches created.

--- src/shuppet/git.clj
+++ src/shuppet/git.clj
@@ -275,4 +275,4 @@
                 (conj valid-environments "master") " for application '" name "'"))
   {:name name
    :path (str base-git-url name)
-   :branches valid-environments})
+   :branches (conj valid-environments "master")})


Remove unused Instrument type.

Remove unused Instrument type.

--- src/isla/user.clj
+++ src/isla/user.clj
@@ -1,7 +1,4 @@
 (ns isla.user)
-
-(defrecord Instrument [sound awesomeness])
-(def instrument-defaults ["" ""])

 (defrecord IList [list])
 (def list-defaults [[]])


remove typos

remove typos

--- src/main/cljs/cljs/js.cljs
+++ src/main/cljs/cljs/js.cljs
@@ -232,7 +232,7 @@
        :*cljs-ns*      'cljs.user
        :*ns*           (create-ns 'cljs.user)
        :*data-readers* tags/*cljs-data-readers*
-       :*eval-fn*      (or (:js-eval opts) js/eval)}`
+       :*eval-fn*      (or (:js-eval opts) js/eval)}
       source opts cb)))

 ;; -----------------------------------------------------------------------------
@@ -267,5 +267,5 @@
       :*cljs-ns*      'cljs.user
       :*ns*           (create-ns 'cljs.user)
       :*data-readers* tags/*cljs-data-readers*
-      :*eval-fn*      (or (:js-eval opts) js/eval)}`
-       source opts cb)))+      :*eval-fn*      (or (:js-eval opts) js/eval)}
+     source opts cb)))


support mutiple evaluations at REPL by attaching timestamp to inline source maps

--- src/main/cljs/cljs/js.cljs
+++ src/main/cljs/cljs/js.cljs
@@ -120,23 +120,31 @@
      :gen-col    0
      :gen-line   0}))

-(defn append-source-map [state name source sb sm-data opts]
+(defn prefix [s pre]
+  (str pre s))
+
+(defn append-source-map
+  [state name source sb sm-data {:keys [output-dir asset-path] :as opts}]
    (let [t    (.valueOf (js/Date.))
          smn  (if name
-                (munge name)
+                (string/replace (munge (str name)) "." "/")
                 (str "cljs-" t))
-         src  (str smn ".cljs")
-         file (str smn ".js")
+         ts   (.valueOf (js/Date.))
+         out  (or output-dir asset-path)
+         src  (cond-> (str smn ".cljs?rel=" ts)
+                out (prefix (str out "/")))
+         file (cond-> (str smn ".js?rel=" ts)
+                out (prefix (str out "/")))
          json (sm/encode {src (:source-map sm-data)}
                 {:lines (+ (:gen-line sm-data) 3)
-                 :file file :sources-content [source]})]
+                 :file  file :sources-content [source]})]
      (when (:verbose opts) (debug-prn json))
      (swap! state assoc-in
        [:source-maps name] (sm/invert-reverse-map (:source-map sm-data)))
      (.append sb
        (str "\n//# sourceURL=" file
             "\n//# sourceMappingURL=data:application/json;base64,"
-            (base64/encodeString json true)))))
+            (base64/encodeString json)))))

 ;; -----------------------------------------------------------------------------
 ;; Analyze


Basic Block Movement

Basic Block Movement

--- src/tester/core.cljs
+++ src/tester/core.cljs
@@ -1,6 +1,7 @@
 (ns tester.core
   (:require [reagent.core :as reagent]
             [clojure.test.check.generators]
+            [cljs.spec.test :as st]
             [cljs.spec.impl.gen :as gen]
             [cljs.spec :as s]))

@@ -12,13 +13,15 @@
 (def screen-height (.-innerHeight js/window))

 (def tile-width (/ (min screen-height screen-width) board-size))
+
 (s/def ::within-board-size (s/int-in 0 board-size))
 (s/def ::x ::within-board-size)
 (s/def ::y ::within-board-size)
-(s/def ::value pos-int?)
 (s/def ::direction directions)
 (s/def ::position (s/tuple ::within-board-size ::within-board-size))
-(s/def ::tile (s/keys :req [::value]))
+
+(s/def ::tile pos-int?)
+
 (s/def ::game-board (s/map-of ::position ::tile :max-count (* board-size board-size) :min-count 2))
 (s/def ::app-db (s/keys :req [::game-board ::direction]))

@@ -28,40 +31,70 @@

 (defonce app-db (reagent/atom (initial-state)))

-(s/fdef move-direction
-        :args (s/cat :board ::game-board :direction ::direction)
-        :ret ::game-board)
-
-(defn move-direction
-  [board direction]
-  (gen/generate (s/gen ::game-board)))
-
-(defn correct-number-of-positions?
-  [current-position direction-to-move]
-
-  )
-
 (s/fdef positions-to-move
         :args (s/cat :current-position ::position
                      :move-direction ::direction)
         :ret (s/coll-of ::position))

-
+(defn dec-pos
+  [x]
+  (if (pos? (dec x))
+    (dec x)
+    0))

 (defn positions-to-move
   [[x y] move-direction]
   (case move-direction
-    ::up (map (fn [yy] [x yy]) (reverse (range 0 y))))
-  )
+    ::up    (map (fn [new-y] [x new-y]) (range (inc y) board-size))
+    ::down  (map (fn [new-y] [x new-y]) (reverse (range (dec-pos y))))
+    ::right (map (fn [new-x] [new-x y]) (range (inc x) board-size))
+    ::left  (map (fn [new-x] [new-x y]) (reverse (range (dec-pos x))))))
+
+(s/fdef next-position
+        :args (s/cat :board ::game-board :positions-to-check (s/coll-of ::position))
+        :ret ::position)
+
+(defn next-position
+  [board positions-to-check]
+  (or (first (filter board positions-to-check)) (last positions-to-check)))
+
+(defn board->position-board
+  [board direction]
+  (zipmap (keys board) (map #(positions-to-move % direction) (keys board))))
+
+(s/fdef move-direction
+        :args (s/cat :board ::game-board :direction ::direction)
+        :ret ::game-board)
+
+(defn sort-next-positions
+  [nps direction]
+  (case direction
+    ::up (sort-by (fn [[x y] _] y) nps)
+    ::down (reverse (sort-by (fn [[x y] _] y) nps))
+    ::right (sort-by (fn [[x y] _] x) nps)
+    ::left (reverse (sort-by (fn [[x y] _] x) nps))))
+
+(defn move-direction
+  [board direction]
+  (let [positions (board->position-board board direction)
+        next-positions (map (fn [[k v]] [k (next-position board v)]) positions)
+        only-moves (filter (fn [[k v]] (not-empty v)) next-positions)
+        sorted-next-positions (sort-next-positions only-moves direction)
+        updated-board (reduce (fn [b [p1 p2]] (update (dissoc b p1) p2 + (b p1))) board sorted-next-positions)
+        ]
+    updated-board
+    ))

 (defn update-state
   [state [event-type & params]]
   (case event-type
-    ::move-direction (let [[direction] params] (update state ::game-board #(move-direction % directions)))))
+    ::move-direction (let [[direction] params] (update state ::game-board #(move-direction % direction)))))

 (defn dispatch-event!
   [event]
-  (swap! app-db update-state event))
+  (swap! app-db update-state event)
+  (println @app-db)
+  (s/assert ::app-db @app-db)  )

 (def key-code->direction
   {38 ::up
@@ -91,35 +124,35 @@
               :height screen-height
               :justify-content "center"
               :align-items "center"}}
-    [:div
-     {:style {:display "flex"
-              :width (min screen-width screen-height)
-              :height (min screen-width screen-height)
-              :padding "10%"
-              :justify-content "center"
-              :align-items "center"}}
-     (for [location game-board
-           :let [[position tile] location
-                 [x y] (position->coordinates position)]]
-       ^{:key (hash location)}
-       [:div {:style {:position "absolute"
-                      :background-color "orange"
-                      :border-width 1
-                      :display "flex"
-                      :font-color "black"
-                      :border-style "solid"
-                      :justify-content"center"
-                      :align-items "center"
-                      :font-size 20
-                      :left x
-                      :top y
-                      :width tile-width
-                      :height tile-width
-                      }}[:a (::value tile)]])]]))
+     [:div
+      {:style {:display "flex"
+               :width (min screen-width screen-height)
+               :height (min screen-width screen-height)
+               :padding "10%"
+               :justify-content "center"
+               :align-items "center"}}
+      (for [location game-board
+            :let [[position tile] location
+                  [x y] (position->coordinates position)]]
+        ^{:key (hash location)}
+        [:div {:style {:position "absolute"
+                       :background-color "orange"
+                       :border-width 1
+                       :display "flex"
+                       :font-color "black"
+                       :border-style "solid"
+                       :justify-content"center"
+                       :align-items "center"
+                       :font-size 20
+                       :left x
+                       :bottom y
+                       :width tile-width
+                       :height tile-width
+                       }}[:a (str position tile)]])]]))

 (defn game []
   (reagent/create-class {:reagent-render (fn [_] [game-board])
-                   :component-did-mount (fn [_] (watch-keys!))}))
+                         :component-did-mount (fn [_] (watch-keys!))}))

 (defn home-page []
   [:div "TEST"])
@@ -129,3 +162,5 @@

 (defn init! []
   (mount-root))
+
+(st/instrument)


Add pause functionality (press p).

Add pause functionality (press p).

--- src/tetris/core.cljs
+++ src/tetris/core.cljs
@@ -1,6 +1,8 @@
 (ns tetris.core
   (:require [cljs.core.async :refer [chan >! <! timeout]])
   (:require-macros [cljs.core.async.macros :refer [go go-loop]]))
+
+(enable-console-print!)

 (def screen-ctx (-> js/document (.getElementById "screen") (.getContext "2d")))
 (def preview-ctx (-> js/document (.getElementById "preview-screen") (.getContext "2d")))
@@ -25,10 +27,12 @@
              \m "#a081ee" ;magenta
              \r "#ff5349" ;red
              " " nil})
-(def controls {37 :left
-               39 :right
-               40 :down
-               38 :rotate})
+(def controls {37 :left ; ←
+               39 :right ; →
+               40 :down ; ↓
+               38 :rotate ; ↑
+               80 :pause ; p
+               })
 (def directions {:down [0 1]
                  :right [1 0]
                  :left [-1 0]})
@@ -263,17 +267,24 @@
   (assoc state :level (-> (/ score level-up-score) int inc)))

 (defmulti process-keyboard
-  (fn [{key :pressed-key}] (if (contains? directions key) :move key)))
-
-(defmethod process-keyboard :move [{key :pressed-key :as state}]
+  (fn [{key :pressed-key mode :mode}]
+    [mode (if (contains? directions key) :move key)]))
+
+(defmethod process-keyboard [:game :move] [{key :pressed-key :as state}]
   (-> state
       (update-in [:tetrimino] move-tetrimino key)
       (maybe-rollback state)))

-(defmethod process-keyboard :rotate [state]
+(defmethod process-keyboard [:game :rotate] [state]
   (-> state
       (update-in [:tetrimino] rotate-tetrimino)
       (maybe-rollback state)))
+
+(defmethod process-keyboard [:game :pause] [state]
+  (assoc state :mode :pause))
+
+(defmethod process-keyboard [:pause :pause] [state]
+  (assoc state :mode :game))

 (defmethod process-keyboard :default [state] state)

@@ -291,7 +302,7 @@
                        :gravity-interval 500
                        :score 0
                        :level 1
-                       :running? true}))
+                       :mode :game}))

 (defn time-left
   "Given a timestamp and a time interval, returns a remaining interval
@@ -354,18 +365,16 @@

 (defn run-game-cycle
   "Puts everything together."
-  [{:keys [running? tetrimino] :as state}]
-  (if running?
-    (-> state
-        process-time
-        process-keyboard
-        release-keyboard
-        process-gravity
-        maybe-score
-        maybe-level-up
-        maybe-next-tetrimino
-        maybe-game-over)
-    state))
+  [{:keys [mode tetrimino] :as state}]
+  (cond-> state
+          true process-time
+          true process-keyboard
+          true release-keyboard
+          (= mode :game) process-gravity
+          (= mode :game) maybe-score
+          (= mode :game) maybe-level-up
+          (= mode :game) maybe-next-tetrimino
+          (= mode :game) maybe-game-over))

 (.addEventListener js/document "keydown" #(swap! game-state handle-key-press (.-keyCode %)) false)
 (render-loop)


Use closure goog to do event key listening

--- src/tetris/core.cljs
+++ src/tetris/core.cljs
@@ -1,5 +1,9 @@
 (ns tetris.core
-  (:require [reagent.core :as r]))
+  (:require [goog.events :as events]
+            [goog.events.KeyCodes :as key-codes]
+            [goog.events.EventType :as event-type]
+            [reagent.core :as r]))
+

 (defonce initial-tick-frequency 500)
 (defonce min-tick-frequency 50)
@@ -173,11 +177,13 @@

 (defonce initialize
   (do
-    (.addEventListener (.-body js/document) "keydown"
-                       (fn [e]
-                         (when-let [direction ({37 :left, 38 :up, 39 :right, 40 :down}
-                                               (.-keyCode e))]
-                           (move! world-atom direction))))
+    (events/listen js/document event-type/KEYDOWN
+                   (fn [e]
+                     (when-let [direction ({key-codes/LEFT  :left
+                                            key-codes/UP    :up
+                                            key-codes/RIGHT :right
+                                            key-codes/DOWN  :down} (.-keyCode e))]
+                       (move! world-atom direction))))
     (tick!)
     true))


Protect throws when package.json not exists

--- src/npm/boot.cljs
+++ src/npm/boot.cljs
@@ -3,7 +3,12 @@
             [cljs.analyzer.api :as analy]
             [npm.mvn :as mvn]))

-(def PACKAGE (js->clj (js/require (str js/process.env.PWD "/package.json"))))
+(def PACKAGE
+  (if (js/fs.existsSync (str js/process.env.PWD "/package.json"))
+    (js->clj (js/require (str js/process.env.PWD "/package.json"))
+             :keywordize-keys true)
+    {:cljs {:source-paths ["src"]}}))
+
 (declare *classpath*)

 (defn file-seq [root]
@@ -17,7 +22,7 @@

 (defn ^:export lumo [& opts]
   (let [process        (atom nil)
-        source-paths   (get-in PACKAGE ["cljs" "source-paths"])
+        source-paths   (get-in PACKAGE [:cljs :source-paths])
         source-pattern (re-pattern (str \( (str/join "|" source-paths) \) "/?"))
         cache-path     (or (when (some #{"-K"} opts)
                              ".lumo_cache")
@@ -84,7 +89,7 @@
                     (apply (aget NS-EXPORTS (munge t)) args))))))

 (defn -main [& argv]
-  (mvn/async-map mvn/download-dep (map mvn/parse-dep (get-in PACKAGE ["cljs" "dependencies"]))
+  (mvn/async-map mvn/download-dep (map mvn/parse-dep (get-in PACKAGE [:cljs :dependencies]))
                  (fn [paths]
                    (set! *classpath* paths)
                    (run-task (argv->task argv)))))


Adds support for project creation and update

--- src/great_things_done/db.cljs
+++ src/great_things_done/db.cljs
@@ -1,6 +1,7 @@
 (ns great-things-done.db
   (:require [cljs-uuid-utils.core :as uuid]
             [great-things-done.platform :as platform]
+            [great-things-done.utils :refer [clj->json]]
             [node.fs :as fs]))

 (def ^:private meta-projects (atom []))
@@ -22,37 +23,52 @@
 (defn- write-project-to-disk
   [project]
   (let [projects-path (platform/database-projects-path)
-        filename      (str (:name project) "-" (:id project))])
-  )
+        filename      (str (:name project) "-" (:id project))
+        full-path     (str projects-path "/" filename)]
+    (fs/ensure-dir! full-path)
+    (fs/write-file! (str full-path "/.project.pgtd")
+                    (clj->json (assoc
+                                 project
+                                 :tasks
+                                 (map :id (:tasks project)))))))

 (defn- install-project
   [project]
   (swap! projects assoc (:id project) project)
-  (write-project-to-disk project))
+  (write-project-to-disk project)
+  project)

+(defn- move-all-tasks
+  [project old-name]
+  (let [new-path      (str (platform/database-projects-path)
+                           "/"
+                           (str (:name project) "-" (:id project)))
+        old-path      (str (platform/database-projects-path)
+                           "/"
+                           (str old-name "-" (:id project)))]
+    (fs/rename! old-path new-path)))

-(defn- create-project
+(defn- new-project
   [project-name tags tasks description due-date]
-  (let [id (generate-uuid)]
-    [id
      {:name          project-name
+      :id            (generate-uuid)
       :tags          tags
       :tasks         tasks
       :description   description
       :creation-date (now-as-milliseconds)
-      :due-date      due-date}]))
+      :due-date      due-date})

-(defn register-project!
+(defn register-project
   [project-name & {:keys [tags tasks description due-date]
                    :or {tags []
                         tasks []
                         description ""
                         due-date nil}}]
-  (let [project (create-project project-name
-                                tags
-                                tasks
-                                description
-                                due-date)]
+  (let [project (new-project project-name
+                             tags
+                             tasks
+                             description
+                             due-date)]
     (install-project project)))

 (defn update-project!
@@ -61,12 +77,15 @@
                    (map #(into [] %)
                         (partition 2 body)))]
     (if (even? (count body))
-      (let [tmp-project (atom {})]
+      (let [tmp-project (atom project)]
         (doseq [[k v] args]
           (when (= (name k) "id")
             (throw (js/Error. "`id` can not be updated!")))
           (swap! tmp-project assoc (keyword k) v)
-          (install-project (merge project tmp-project))))
+          (js/console.log (name k))
+          (when (= (name k) "name")
+            (move-all-tasks @tmp-project (:name project))))
+          (install-project @tmp-project))
       (throw (js/Error. "Wong number of arguments. `body` has to have an even number of elements")))))

 (defn ^:export list-of-projects


Add more fmap tests for nested type validation

--- test/deepfns/core_test.cljc
+++ test/deepfns/core_test.cljc
@@ -12,8 +12,6 @@
 ;; 2. associativity/functional composition
 ;; 3. validate all nested types are unchanged
 ;; TODO: type validation on all nested types
-;; TODO: get multiple validation working, tricky because every
-;;  generated element needs to have the same structure but different vals
 (defspec deepfmap-spec
   (prop/for-all [nums (gen/one-of [(gen/set gen/int)
                                    (gen/list gen/int)
@@ -31,3 +29,31 @@
       ;; for now we're just checking the top level type
       (every? #(= (type nums) (type %)) ; 3
         [out-single1 out-single2]))))
+
+;; Here are some test cases for nested type checking (3)
+(deftest deepfmap-types-single
+  (are [expected f args]
+      (is (= expected (deepfmap f args)))
+    nil identity nil
+
+    [2] inc [1]
+
+    #{1 '(2) [3]} inc #{0 '(1) [2]}
+
+    {:a 1 :b 2} inc {:a 0 :b 1}
+
+    {:foo [#{[1]}]} inc {:foo [#{[0]}]}))
+
+;; and to cover the variadic version of deepfmap
+(deftest deepfmap-types-multi
+  (are [expected f arg1 arg2 arg3]
+      (is (= expected (deepfmap f arg1 arg2 arg3)))
+    nil identity nil nil nil
+
+    [[1] [2] [3]] inc [0] [1] [2]
+
+    [#{1 '(2) [3]} #{5 '(6) [7]} #{8 '(9) [10]}]
+    inc #{0 '(1) [2]} #{4 '(5) [6]} #{7 '(8) [9]}
+
+    [{:foo [#{[1]}] :b 2} {:bar[#{[3]}] :k 4} {:bazz [#{[5]}] :z 6}]
+    inc {:foo [#{[0]}] :b 1} {:bar[#{[2]}] :k 3} {:bazz [#{[4]}] :z 5}))


added rum/dom-node

added rum/dom-node

--- src/rum/core.cljs
+++ src/rum/core.cljs
@@ -161,6 +161,9 @@

 (defn with-ref [element ref]
   (js/React.cloneElement element #js { "ref" ref } nil))
+
+(defn dom-node [state]
+  (js/ReactDOM.findDOMNode (:rum/react-component state)))

 ;; static mixin


Fix namespace

Fix namespace

--- src/onyx/doc.cljc
+++ src/onyx/doc.cljc
@@ -1,4 +1,4 @@
-(ns onyx.information-model
+(ns onyx.doc
   (:require [onyx.information-model]))

 (defn lookup-categories [model kw]


Fixed bug in split-batches for message splitting

--- src/polismath/conv_man.clj
+++ src/polismath/conv_man.clj
@@ -259,8 +259,8 @@
   (->> messages
        (group-by first)
        (pc/map-vals
-         (fn [[_ batches]]
-           (->> batches
+         (fn [labeled-batches]
+           (->> labeled-batches
                 (map second)
                 (flatten))))))

@@ -281,7 +281,8 @@
                         (split-batches msgs)]
           (when mods
             (swap! conv/mod-update mods))
-          (swap! conv update-fn (or votes []) err-handler))
+          (when votes
+            (swap! conv update-fn (or votes []) err-handler)))
         (catch Exception e
           (log/error "Excpetion not handler by err-handler:" e)
           (.printStackTrace e)))


Test request spec with embedded empty request spec

--- test/icecap/schema_test.clj
+++ test/icecap/schema_test.clj
@@ -18,6 +18,10 @@
                              (pr-str reason))
          [] '(not ("collection of one or more request specs" []))
          #{} '(not ("collection of one or more request specs" #{}))))
+  (testing "Specs with embedded empty specs don't validate"
+    (are [example reason] (= (pr-str (s/check RequestSpec example))
+                             (pr-str reason))
+      [#{} simple-http-request] ['(not ("collection of one or more request specs" #{})) nil]))
   (testing "Request specs with unknown/unsupported schemes don't validate"
     ;; Comparing string representations isn't great, but it's the best
     ;; easily available tool until maybe one day cddr/integrity's


More digested/uniform consensus stats shape/format

--- src/polismath/clusters.clj
+++ src/polismath/clusters.clj
@@ -576,14 +576,28 @@
                          :dm (* (:pd stat) (:pdt stat))
                          :am (* (:pa stat) (:pat stat))))
                 cons-stats)
-        top-5 (fn [metric prob test]
-                (->> stats
-                     (filter #(and (> (prob %) 0.5)
-                                   (z-sig-90? (test %))))
-                     (sort-by (comp - metric))
-                     (take 5)))]
-    {:agree    (top-5 :am :pa :pat)
-     :disagree (top-5 :dm :pd :pdt)}))
+        format-stat
+              (fn [cons-for stat]
+                (let [[n-success p-success p-test] (if (= cons-for :agree)
+                                                     [:na :pa :pat]
+                                                     [:nd :pd :pdt])]
+                  {:tid (:tid stat)
+                   :n-success (n-success stat)
+                   :n-trials (:ns stat)
+                   :p-success (p-success stat)
+                   :p-test (p-test stat)}))
+        top-5 (fn [cons-for]
+                (let [[metric prob test] (if (= cons-for :agree)
+                                           [:am :pa :pat]
+                                           [:dm :pd :pdt])]
+                  (->> stats
+                       (filter #(and (> (prob %) 0.5)
+                                     (z-sig-90? (test %))))
+                       (sort-by (comp - metric))
+                       (take 5)
+                       (map (partial format-stat cons-for)))))]
+    {:agree    (top-5 :agree)
+     :disagree (top-5 :disagree)}))

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


update overall network analysis

update overall network analysis


fix #2160 - status author name no longer overlaps with chat button on smaller screens

--- src/status_im/ui/screens/discover/styles.cljs
+++ src/status_im/ui/screens/discover/styles.cljs
@@ -48,6 +48,7 @@

 (def discover-list-item-name-container
   {:flex            0.3
+   :padding-right   30
    :flex-direction  :row
    :justify-content :flex-start
    :align-items     :center})


Time comparison

Time comparison

--- src/tick/core.clj
+++ src/tick/core.clj
@@ -254,10 +254,33 @@
 (defn between [i1 i2]
   (Duration/between (instant i1) (instant i2)))

-(definline < [x y] `(.isBefore (or ~x (epoch)) (or~y (epoch))))
-(definline <= [x y] `(not (.isAfter (or ~x (epoch)) (or~y (epoch)))))
-(definline > [x y] `(.isAfter (or ~x (epoch)) (or ~y (epoch))))
-(definline >= [x y] `(not (.isBefore (or ~x (epoch)) (or ~y (epoch)))))
+(defprotocol ITimeComparison
+  (< [x y] "Is x before y?")
+  (<= [x y] "Is x before or at the same time as y?")
+  (> [x y] "Is x after y?")
+  (>= [x y] "Is x after or at the same time as y?"))
+
+(extend-protocol ITimeComparison
+  LocalDate
+  (< [x y] (.isBefore x y))
+  (<= [x y] (not (.isAfter x y)))
+  (> [x y] (.isAfter x y))
+  (>= [x y] (not (.isBefore x y)))
+  YearMonth
+  (< [x y] (.isBefore x y))
+  (<= [x y] (not (.isAfter x y)))
+  (> [x y] (.isAfter x y))
+  (>= [x y] (not (.isBefore x y)))
+  Year
+  (< [x y] (.isBefore x y))
+  (<= [x y] (not (.isAfter x y)))
+  (> [x y] (.isAfter x y))
+  (>= [x y] (not (.isBefore x y)))
+  Instant
+  (< [x y] (.isBefore x y))
+  (<= [x y] (not (.isAfter x y)))
+  (> [x y] (.isAfter x y))
+  (>= [x y] (not (.isBefore x y))))

 (defprotocol ITimeArithmetic
   (+ [_ _] "Add time")
@@ -524,6 +547,23 @@
   ZonedDateTime
   (min-of-type [_] (Instant/MIN))
   (max-of-type [_] (Instant/MAX))
+  ;; TODO: This may cause surprises - see clojure/java-time. We should
+  ;; change the semantics of nil to not imply epoch, forever, or
+  ;; whatever.
   nil
   (min-of-type [_] (Instant/MIN))
   (max-of-type [_] (Instant/MAX)))
+
+
+;; first/last using java.time.temporal/TemporalAdjuster
+;; See also java.time.temporal/TemporalAdjusters
+
+;; java.time.temporal/TemporalAmount
+
+#_(defn adjust [t adjuster]
+  (.with t adjuster))
+
+;; adjust
+
+
+;; Conversions


Bump chef-full revision for Ohai 0.6.10

Bump chef-full revision for Ohai 0.6.10

--- config/projects/chef-full.clj
+++ config/projects/chef-full.clj
@@ -17,6 +17,6 @@
 ;; limitations under the License.
 ;;

-(project "chef-full" "0.10.4" "5"
+(project "chef-full" "0.10.4" "6"
          :build-order [ "prep" "help2man" "libtool" "autoconf" "automake" "gdbm" "zlib" "libiconv" "readline" "db" "ncurses"
                         "openssl" "libxml2" "libxslt" "ruby" "rsync" "chef" ])


user user-cursor helper in pills

user user-cursor helper in pills

--- src/chat/client/views/pills.cljs
+++ src/chat/client/views/pills.cljs
@@ -3,7 +3,7 @@
             [om.dom :as dom]
             [chat.client.dispatcher :refer [dispatch!]]
             [chat.client.store :as store]
-            [chat.client.views.helpers :refer [id->color]]))
+            [chat.client.views.helpers :refer [id->color user-cursor]]))

 (defn subscribe-button [tag]
   (if (store/is-subscribed-to-tag? (tag :id))
@@ -36,9 +36,7 @@
   (reify
     om/IRender
     (render [_]
-      (let [user (om/observe owner (-> (om/root-cursor store/app-state)
-                                       (get-in [:users (user :id)])
-                                       om/ref-cursor))]
+      (let [user (om/observe owner (user-cursor (user :id)))]
         (dom/div #js {:className (str "user pill" (case (user :status)
                                                     :online " on"
                                                     " off"))


Set task state to executing when trial is dispatching

--- src/cider_ci/dispatcher/task.clj
+++ src/cider_ci/dispatcher/task.clj
@@ -52,10 +52,9 @@
   (cond (some #{"passed"} trial-states) "passed"
         (every? #{"aborted"} trial-states ) "aborted"
         (every? #{"failed" "aborted"} trial-states) "failed"
-        (some #{"executing"} trial-states) "executing"
+        (some #{"executing" "dispatching"} trial-states) "executing"
         (some #{"pending"} trial-states) "pending"
         (some #{"aborting"} trial-states) "aborting"
-        (every? #{"aborted"} trial-states) "aborted"
         :else (do (logging/warn 'eval-new-state "Unmatched condition"
                                 {:task task :trial-states trial-states})
                 "failed")))


Next with a hashmap

Next with a hashmap

--- src/client/my_css/mutations.cljs
+++ src/client/my_css/mutations.cljs
@@ -2,9 +2,6 @@
   (:require [untangled.client.mutations :as m]
             [untangled.dom :refer [unique-key]]))

-(comment
-  (defmethod m/mutate 'nav/change-tab [{:keys [state]} k {:keys [target]}]
-    {:action (fn [] (swap! state assoc :app/current-tab [target :singleton]))}))

 (defn unload [state prev-target]
   (case prev-target
@@ -12,6 +9,15 @@
                       (update-in [:app/trending :singleton] dissoc
                                  :grid/gas-query-grid
                                  :graph/trending-graph
+                                 ))
+    state))
+
+(defn load [state new-target]
+  (case new-target
+    :app/trending (-> state
+                      (update-in [:app/trending :singleton] assoc
+                                 :grid/gas-query-grid [:gas-query-grid/by-id 10800]
+                                 :graph/trending-graph [:trending-graph/by-id 10300]
                                  ))
     state))

@@ -23,14 +29,9 @@
   (let [prev-target (first (get old-st :app/current-tab))
         new-state (-> old-st
                       (unload prev-target)
+                      (load new-target)
                       (assoc :app/current-tab [new-target :singleton]))]
-    (case new-target
-      :app/trending (-> new-state
-                        (update-in [:app/trending :singleton] assoc
-                                   :grid/gas-query-grid [:gas-query-grid/by-id 10800]
-                                   :graph/trending-graph [:trending-graph/by-id 10300]
-                                   ))
-      new-state)))
+    new-state))

 (defmethod m/mutate 'nav/load-tab [{:keys [state]} k {:keys [target]}]
   {:action (fn [] (swap! state change-tab target))})


move anti-forgery

move anti-forgery

--- src/clj/clj_money/web/server.clj
+++ src/clj/clj_money/web/server.clj
@@ -209,13 +209,14 @@
      :redirect-on-auth? false}))

 (defroutes app
-  (-> (routes open-routes
-              (-> protected-routes
-                  wrap-multipart-params
-                  wrap-keyword-params
-                  wrap-params
-                  (friend/wrap-authorize #{:user})
-                  wrap-authenticate)
+  (-> (routes (-> (routes open-routes
+                          (-> protected-routes
+                              wrap-multipart-params
+                              wrap-keyword-params
+                              wrap-params
+                              (friend/wrap-authorize #{:user})
+                              wrap-authenticate))
+                  wrap-anti-forgery)
               (-> api-routes
                   wrap-json-response
                   wrap-keyword-params
@@ -223,7 +224,6 @@
                   wrap-params
                   (friend/wrap-authorize #{:user})
                   wrap-authenticate))
-      wrap-anti-forgery
       wrap-exception-handling
       wrap-content-type
       (wrap-resource "public")


Fixed Paige Piper crashing on Yes.

Fixed Paige Piper crashing on Yes.

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -370,9 +370,10 @@
                       {:optional
                        {:req (req (> num 0))
                         :prompt (str "Use Paige Piper to trash copies of " (:title card) "?")
-                        :choices {:number (req num)}
-                        :msg "to shuffle their Stack"
-                        :yes-ability {:effect (req (doseq [c (take (int target) cards)]
+                        :yes-ability {:prompt "How many would you like to trash?"
+                                      :choices {:number (req num)}
+                                      :msg "shuffle their Stack"
+                                      :effect (req (doseq [c (take (int target) cards)]
                                                                (trash state side c))
                                                    (shuffle! state :runner :deck)
                                                    (when (> (int target) 0)


Add Google Analytics.

Add Google Analytics.

--- src/clj/quil_site/views/page.clj
+++ src/clj/quil_site/views/page.clj
@@ -11,6 +11,16 @@
            :content "width=device-width, initial-scale=1"}]

    [:title "Quil"]
+
+   [:script {:async "async"
+             :src "//www.google-analytics.com/analytics.js"}]
+   [:script
+    "(function(i,s,r){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();
+  })(window,document,'ga');
+
+  ga('create', 'UA-51485241-2', 'auto');
+  ga('send', 'pageview');"]

    (let [css-files (conj (:css-files opts [])
                          "/css/bootstrap.min.css"


Adding TODOs

Adding TODOs

--- src/clj/zetawar/system/spec.cljs
+++ src/clj/zetawar/system/spec.cljs
@@ -58,6 +58,9 @@
 ;; Views
 (s/def :zetawar.system.views/locale string?)

+;; TODO: add spec for dispatch function
+;; TODO: add spec for translate function
+
 (s/def :zetawar.system/views
   (s/keys :req-un [:zetawar.system.datascript/conn
                    :zetawar.system.router/ev-chan


Add input handling

Add input handling

--- src/cljs/caves_of_cljs/core.cljs
+++ src/cljs/caves_of_cljs/core.cljs
@@ -27,7 +27,11 @@
 (defonce key-loop
   (go-loop []
     (when-let [event (<! key-chan)]
-      (swap! app-state dissoc :game)
+      (let [keycode (.. event -keyCode)
+            input (get *keys* (if (<= 96 keycode 105)
+                                (- keycode 48)
+                                keycode))]
+        (swap! app-state assoc :input input))
       (recur))))

 (defmulti draw-ui
@@ -51,12 +55,34 @@
   (doseq [ui (:uis game)]
     (draw-ui ui game screen)))

+(defmulti process-input
+  (fn [game input]
+    (:kind (last (:uis game)))))
+
+(defmethod process-input :start [game input]
+  (if (= input :ENTER)
+    (assoc game :uis [{:kind :win}])
+    (assoc game :uis [{:kind :lose}])))
+
+(defmethod process-input :win [game input]
+  (if (= input :ESC)
+    (assoc game :uis [])
+    (assoc game :uis [{:kind :start}])))
+
+(defmethod process-input :lose [game input]
+  (if (= input :ESC)
+    (assoc game :uis [])
+    (assoc game :uis [{:kind :start}])))

 (defn game-loop []
   (when-let [screen (:screen @app-state)]
     (let [input (:input @app-state)
-          game (:game @app-state)]
-      (draw-game game screen)))
+          game (if (nil? input)
+                 (:game @app-state)
+                 (process-input (:game (swap! app-state dissoc :input))
+                                input))]
+      (draw-game game screen)
+      (swap! app-state assoc :game game)))
   (.requestAnimationFrame js/window #(game-loop)))

 (defn init-game! []
@@ -111,7 +137,8 @@
 (secretary/defroute "/" []
   (swap! app-state assoc
          :current-page :home
-         :game {:uis [{:kind :start}]}))
+         :game {:uis [{:kind :start}]}
+         :input nil))

 (secretary/defroute "/about" []
   (swap! app-state assoc :current-page :about))


Words added via whitelist should be separated by line ends

--- src/zg/server.clj
+++ src/zg/server.clj
@@ -124,7 +124,7 @@
 (defn split-words
     [input]
     (if input
-        (->> (clojure.string/split input #"[\s,]")
+        (->> (clojure.string/split input #"[\s,\n]")
              (filter seq))))

 (defn proper-word?


Removed bad require.

Removed bad require.

--- src/dragon/event/system/impl.clj
+++ src/dragon/event/system/impl.clj
@@ -1,6 +1,5 @@
 (ns dragon.event.system.impl
   (:require [clojure.core.async :as async]
-            [dragon.event.system.impl :as impl]
             [dragon.event.topic :as topic]
             [taoensso.timbre :as log]))


Button group splits into two pairs of two on smaller screens

--- src/lolitemsets/core.cljs
+++ src/lolitemsets/core.cljs
@@ -305,11 +305,17 @@
                      [objective-checkbox name calc]))
       [number-selector "Champion level" :champ-level 18 1]
       [number-selector "Number of items" :num-items 6 1] [:br]
-      [:div.btn-group.btn-group-justified
+      [:div.btn-group.btn-group-justified.visible-lg-block
         [button-of-command] ; generate
         [dorans-button] ; troll
-        [mirage-button] ; add
+        [mirage-button]              ; add
         [needlessly-large-button]] ; download
+      [:div.btn-group.btn-group-justified.hidden-lg
+       [button-of-command]
+       [dorans-button]]
+      [:div.btn-group.btn-group-justified.hidden-lg
+       [mirage-button]
+       [needlessly-large-button]]
       [:p [:br]
        "Save inside your League of Legends folder in "
        [:code


Fixed tests after upmerge

Fixed tests after upmerge

--- storm-core/test/clj/backtype/storm/supervisor_test.clj
+++ storm-core/test/clj/backtype/storm/supervisor_test.clj
@@ -379,6 +379,7 @@
                                 " '-Djava.library.path='"
                                 " '-Dlogfile.name=" mock-storm-id "-worker-" mock-port ".log'"
                                 " '-Dstorm.home='"
+                                " '-Dstorm.log.dir=/logs'"
                                 " '-Dlogback.configurationFile=/logback/cluster.xml'"
                                 " '-Dstorm.id=" mock-storm-id "'"
                                 " '-Dworker.id=" mock-worker-id "'"


Workspace behaviors no longer triggers incorrect dialogs

Dialogs were being incorrectly triggered by :path.
Opening a workspace behavior with `Settings: Workspace behaviors`
triggered a confusing dialog:
"File deleted: workspace.behaviors
This file seems to have been deleted and we've marked it as unsaved.

Saving workspace behaviors also triggered a dialog to save to disk
which is invalid since these behaviors don't persist to a file.

--- src/lt/objs/settings.cljs
+++ src/lt/objs/settings.cljs
@@ -382,8 +382,7 @@
 (cmd/command {:command :behaviors.modify-workspace
               :desc "Settings: Workspace behaviors"
               :exec (fn []
-                      (cmd/exec! :opener.open-info {:path "workspace.behaviors"
-                                                    :mime "text/x-clojure"
+                      (cmd/exec! :opener.open-info {:mime "text/x-clojure"
                                                     :name "workspace.behaviors"
                                                     :tags [:editor.behaviors :editor.behaviors.workspace]
                                                     :content (:ws-behaviors @workspace/current-ws "")}))})