xymon.clj: * xymon: moved host/post option handing to send-line * send-line: new options are now handled: timeout and error-handler. Socket now has a connection timeout.

--- src/riemann/xymon.clj
+++ src/riemann/xymon.clj
@@ -4,7 +4,7 @@
             [clojure.string        :as s]
             [clojure.tools.logging :refer [error]]
             [clojure.math.numeric-tower :refer [ceil]])
-  (:import java.net.Socket))
+  (:import (java.net Socket InetSocketAddress)))

 (defn host->xymon
@@ -70,30 +70,53 @@
     (format "disable %s.%s %s %s"
             host service (int (ceil (/ ttl 60))) description)))

+(defn- send-line-error-handler
+  [e]
+  (error e "cannot reach xymon host"))
+
 (defn send-line
   "Connects to Xymon server, sends line, then closes the connection.
    This is a blocking operation and should happen on a separate thread."
   [opts line]
   (try
-    (with-open [sock   (Socket. (:host opts) (:port opts))
-                writer (io/writer sock)]
-      (.write writer line)
-      (.flush writer))
+    (let [opts (merge
+                {:host "127.0.0.1" :port 1984 :timeout 5
+                 :error-handler send-line-error-handler}
+                opts)
+          addr (InetSocketAddress. (:host opts) (:port opts))
+          sock (Socket.)]
+      (.setSoTimeout sock (:timeout opts))
+      (.connect sock addr (:timeout opts))
+      (with-open [writer (io/writer sock)]
+        (.write writer line)
+        (.flush writer)))
     (catch Exception e
-      (error e "could not reach xymon host"))))
+      ((:error-handler opts) e))))
+
+(defn send-line-with-to
+  [opts line]
+  (try
+    (let [addr (InetSocketAddress. (:host opts) (:port opts))
+          sock (Socket.)]
+      (.connect sock addr (:timeout opts))
+      (.setSoTimeout sock (:timeout opts))
+      (with-open [writer (io/writer sock)]
+        (.write writer line)
+        (.flush writer))
+      (.close sock))
+    (catch Exception e
+      (error e "cannot not reach xymon host"))))

 (defn xymon
   "Returns a function which accepts an event and sends it to Xymon.
    Silently drops events when xymon is down. Attempts to reconnect
    automatically every five seconds. Use:

-   (xymon {:host \"127.0.0.1\" :port 1984})
-
+   (xymon {:host \"127.0.0.1\" :port 1984
+           :timeout 5 :formatter event->status})
    "
   [opts]
-  (let [opts (merge {:host "127.0.0.1"
-                     :port 1984
-                     :formatter event->status} opts)]
+  (let [formatter (or (:formatter opts) event->status)]
     (fn [{:keys [state service] :as event}]
       (when (and state service)
         (let [statusmessage ((:formatter opts) event)]


Expand 'or arguments with index on path

Expand 'or arguments with index on path

or needs to update the ks to include the index within the #or which is
being expanded.  This allows for more correct information about what is
incomplete.  Correct information is needed in order to remove any child
expansions which are failing to complete.

--- src/aero/core.cljc
+++ src/aero/core.cljc
@@ -261,10 +261,11 @@
         (expand-scalar-repeatedly (:form tl) opts env ks)]
     (if incomplete?
       (update expansion ::value rewrap)
-      (loop [[x & xs] value]
+      (loop [[x & xs] value
+             idx 0]
         (let [{:keys [:aero.core/incomplete? :aero.core/value]
                :as expansion}
-              (expand x opts env ks)]
+              (expand x opts env (conj ks idx))]
           (cond
             ;; We skipped a value, we cannot be sure whether it will be true in the future, so return with the remainder to check (including the skipped)
             incomplete?
@@ -282,7 +283,7 @@

             :else
             ;; Falsey value, but not skipped, recur with the rest to try
-            (recur xs)))))))
+            (recur xs (inc idx))))))))

 (defn- assoc-in-kv-seq
   [x ks v]


CMR-387: Removed unused function

CMR-387: Removed unused function

--- src/cmr/search/data/complex_to_simple_converters/spatial.clj
+++ src/cmr/search/data/complex_to_simple_converters/spatial.clj
@@ -57,7 +57,6 @@
                        south-cond
                        (qm/or-conds [am-conds non-am-conds])])))))

-
 (def orbit-param-fields
   "The collection fields that describe the orbit as used in orbital back tracking."
   [:concept-id
@@ -66,14 +65,6 @@
    :inclination-angle
    :number-of-orbits
    :start-circular-latitude])
-
-(defn- fix-vals
-  "Helper function to convert a map with sequences for values into a map with single values."
-  [map-value]
-  (reduce (fn [m key]
-            (update-in m [key] #(first %)))
-          map-value
-          (keys map-value)))

 (defn- orbits-for-context
   "Get the orbit parameters for all the relevant collections."
@@ -97,7 +88,6 @@
                                       :fields orbit-param-fields})
         results (:items (qe/execute-query context orbit-params-query))]
     results))
-

 (defn- resolve-shape-type
   "Convert the 'type' string from a serialized shape to one of 'point', 'line', 'br', or 'poly'.
@@ -163,7 +153,7 @@
          ranges)))

 (defn- crossing-ranges->condition
-  "Createa a search condtion for a given vector of crossing ranges."
+  "Create a search condition for a given vector of crossing ranges."
   [crossing-ranges]
   (qm/or-conds
     (map (fn [[range-start range-end]]


Use the home.user + tmp + UUID as folder name

--- reports/src/reports/exporter.clj
+++ reports/src/reports/exporter.clj
@@ -27,11 +27,16 @@
 ;; criteria = {"surveyId" id}
 ;; options = nil

-(defn- getfile []
-  (io/file (format "/tmp/%s.xlsx" (UUID/randomUUID))))
+(defonce base-path
+  (.getAbsolutePath (io/file (System/getProperty "user.home"))))
+
+(defn- getfile [et id]
+  (let [path (format "%s/tmp/%s" base-path (UUID/randomUUID))
+        _ (.mkdir (io/file path))]
+    (io/file (format "%s/%s-%s.xlsx" path et id))))

 (defn doexport [type base id opts]
   (let [exp (.getExporter (SurveyDataImportExportFactory.) type)
-        f (getfile)]
+        f (getfile type id)]
     (.export exp {"surveyId" id} f base opts) f))


Remove symbol declaration

Remove symbol declaration

--- resources/isometric-rpg/core.clj
+++ resources/isometric-rpg/core.clj
@@ -4,7 +4,7 @@
        \newline
        "Right click on enemies to attack.")

-(declare main-screen npc-health-screen player-health-screen)
+(declare main-screen player-health-screen)

 (defn update-screen!
   [screen entities]


Implement the utility functions

Implement the utility functions

--- src/doctopus/doctopus/tentacle.clj
+++ src/doctopus/doctopus/tentacle.clj
@@ -61,12 +61,13 @@
         (do (binding [fs/*cwd* target-dir]
               (let [html-dir (fs/file output-root)]
                 (apply make-html [html-command html-args (.getPath target-dir)])
-                (save-build-output this html-dir)
-                (log/info "Generated HTML for" name))))
-        (log/error "Couldn't clone source! Argggggg!"))))
+                (check-and-report
+                 (save-build-output this html-dir) name "generated HTML" "generate HTML"))))
+        (report-error "Couldn't clone source! Argggggg!"))))
   (save-build-output [this dir]
-    (let [{:keys [name]} this])
-    (save-to-storage backend name dir))
+    (let [{:keys [name]} this]
+      (check-and-report
+       (save-to-storage backend name dir) name "saved HTML" "save HTML")))
   (get-html-entrypoint [this]
     (str/join "/" ["" "docs" (:name this) (:entry-point this)]))
   (routes [this]


Another tweak to blackrain metadata.

Another tweak to blackrain metadata.

--- src/overtone/sc/machinery/ugen/metadata/extras/blackrain.clj
+++ src/overtone/sc/machinery/ugen/metadata/extras/blackrain.clj
@@ -41,9 +41,9 @@
            {:name "mode"
             :default 0.0
             :doc "Filter mode:
-                < 1 - low pass filter.
-                < 2 - high pass filter.
-                < 3 - bandpass filter.
+                < 1 - low pass filter;
+                < 2 - high pass filter;
+                < 3 - bandpass filter;
                 Defaults to lowpass"}]
    :rates #{:ar}
    :doc "BlackRain's yet 'nother moog impersonation.  Oh yes.  See also: SOS RLPF RHPF BLowPass BLowPass4 BHiPass BHiPass4 BLowShelf BHiShelf BBandPass BBandStop BAllPass IIRFilter"}


test fix

test fix

--- src/metabase/driver/mongo/query_processor.clj
+++ src/metabase/driver/mongo/query_processor.clj
@@ -132,7 +132,7 @@
                  keep-taking? (if limit (fn [_]
                                           (< (count values) limit))
                                   (constantly true))]
-             (->> (i/field-values-lazy-seq @(ns-resolve 'metabase.driver.mongo 'driver) (sel :one Field :id (:id field))) ; resolve driver at runtime to avoid circular deps
+             (->> (i/field-values-lazy-seq @(ns-resolve 'metabase.driver.mongo 'driver) (sel :one Field :id (:field-id field))) ; resolve driver at runtime to avoid circular deps
                   (filter identity)
                   (map hash)
                   (map #(conj! values %))


Add squiggly-clojure

Add squiggly-clojure

--- roles/clojure/files/profiles.clj
+++ roles/clojure/files/profiles.clj
@@ -1,6 +1,7 @@
 {:user {:signing {:gpg-key "james@logi.cl"}

-        :dependencies [[alembic "0.2.1"]
+        :dependencies [[acyclic/squiggly-clojure "0.1.2-SNAPSHOT"]
+                       [alembic "0.2.1"]
                        [clj-stacktrace "0.2.7"]
                        [criterium "0.4.2"]
                        [org.clojure/tools.namespace "0.2.5"]


Renamed v to vis (for visualization).

Renamed v to vis (for visualization).

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -64,31 +64,31 @@

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

-(def v-event-handlers
+(def vis-event-handlers
   {"ago"
-   {:beg (fn [v actx args]
+   {:beg (fn [vis actx args]
            (let [[child-actx] args] 1))
-    :end (fn [v actx args]
+    :end (fn [vis actx args]
            (let [[child-actx result] args] 2))}
    "aclose"
-   {:beg (fn [v actx args]
+   {:beg (fn [vis actx args]
            (let [[ch] args] 1))
-    :end (fn [v actx args]
+    :end (fn [vis actx args]
            (let [[ch result] args] 2))}
    "atake"
-   {:beg (fn [v actx args]
+   {:beg (fn [vis actx args]
            (let [[ch] args] 1))
-    :end (fn [v actx args]
+    :end (fn [vis actx args]
            (let [[ch result] args] 2))}
    "aput"
-   {:beg (fn [v actx args]
+   {:beg (fn [vis actx args]
            (let [[ch msg] args] 1))
-    :end (fn [v actx args]
+    :end (fn [vis actx args]
            (let [[ch msg result] args] 2))}
    "aalts"
-   {:beg (fn [v actx args]
+   {:beg (fn [vis actx args]
            (let [[chs] args] 1))
-    :end (fn [v actx args]
+    :end (fn [vis actx args]
            (let [[chs result] args] 2))}})

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


Invoking vis-event-handler for println'ability.

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -61,7 +61,8 @@
            (let [[chs result] args] 2))}})

 (defn vis-init [cmds cmd-handlers]
-  (let [max-inflight (atom 10)
+  (let [vis {}
+        max-inflight (atom 10)
         event-delay (atom 0)
         event-ch (chan)
         last-id (atom 0)
@@ -71,8 +72,10 @@
       (let [tdv @event-delay]
         (when (> tdv 0)
           (<! (timeout tdv))))
-      (let [[actx event] (<! event-ch)]
-        (println num-events event)
+      (let [[actx event] (<! event-ch)
+            [verb step & args] event
+            vis-event-handler (get (get vis-event-handlers verb) step)]
+        (println num-events event (vis-event-handler vis actx args) args)
         (set-el-innerHTML "event" [num-events event])
         (set-el-innerHTML "vis"
                           (str "<circle cx='"


cassandra: forward correct credentials. fix #138

--- src/io/cyanite/store/cassandra.clj
+++ src/io/cyanite/store/cassandra.clj
@@ -28,7 +28,7 @@
           cluster (if (sequential? cluster) cluster [cluster])
           session (-> {:contact-points cluster}
                       (cond-> (and username password)
-                        (assoc :credentials {:username username
+                        (assoc :credentials {:user username
                                              :password password}))
                       (alia/cluster)
                       (alia/connect (or (:keyspace opts) "metric")))


Fixed bug that caused the index to be overwritten on each add

--- src/clucy/core.clj
+++ src/clucy/core.clj
@@ -26,7 +26,7 @@
 (defn- index-writer
   "Create an IndexWriter."
   [index]
-  (IndexWriter. index *analyzer* true IndexWriter$MaxFieldLength/UNLIMITED))
+  (IndexWriter. index *analyzer* IndexWriter$MaxFieldLength/UNLIMITED))

 (defn- add-field
   "Add a Field to a Document."
@@ -55,7 +55,8 @@
   [index & maps]
   (with-open [writer (index-writer index)]
     (doseq [m maps]
-      (.addDocument writer (map->document m)))))
+      (.addDocument writer (map->document m)))
+    (.optimize writer)))

 (defn- document->map
   "Turn a Document object into a map."


Fixes error where PailSpec args are ignored.

Explicitly adds the file format name when creating the PailSpec.

When a Pail is created, the PailFormatFactory checks to see if there is
a PailSpec arg. If the arg is null or if the name of the PailSpec is
null then a new default PailSpec is created and used.

This necesitates a PailSpec name being explicitly set when options are
present, else a default PailSpec is used and the options are lost.

--- src/main/clojure/clj_pail/core.clj
+++ src/main/clojure/clj_pail/core.clj
@@ -1,5 +1,5 @@
 (ns clj-pail.core
-  (:import (com.backtype.hadoop.pail Pail PailSpec PailStructure)))
+  (:import (com.backtype.hadoop.pail Pail PailSpec PailStructure PailFormatFactory)))

 (defn ^PailSpec spec
@@ -7,7 +7,7 @@
   ([^PailStructure structure]
      (PailSpec. structure))
   ([^PailStructure structure opts]
-     (PailSpec. nil opts structure)))
+     (PailSpec. PailFormatFactory/SEQUENCE_FILE opts structure)))

 (defn ^Pail pail


Improve tailing

Improve tailing

--- test/com/nomistech/clojure_the_language/c_920_io/tailing.clj
+++ test/com/nomistech/clojure_the_language/c_920_io/tailing.clj
@@ -56,21 +56,9 @@

 (fact (let [delay-ms  100
             sleep-ms  (+ delay-ms 10)
-            lines-s   [["I met her in a pool room"
-                        "Her name I didn't catch"
-                        "She looked like something special"
-                        "The kind who'd understand"
-                        "The room was almost spinning"]
-                       ["She pulled another smile"
-                        "She had the grace like pleasure"
-                        "She had a certain style"
-                        "Sunlight on the lino"
-                        "Woke me with a shake"]
-                       ["I looked around to find her"
-                        "But she'd gone"
-                        "Goodbye girl"
-                        "Goodbye girl"
-                        "Goodbye girl"]]
+            lines-s   [["I met" "her" "in a" "pool room"]
+                       ["her name" "I didn't" "catch"]
+                       ["she" "looked" "like" "something special"]]
             file      (let [f (File. "test/_work-dir/plop.log")]
                         ;; Setting up some initial content makes things
                         ;; work as I expect; without this my first line
@@ -84,21 +72,8 @@
         (spit-lines-s file lines-s sleep-ms)
         (stop-tailer-and-channel t-and-c)
         (a/<!! result-ch)
-        => ["I met her in a pool room"
-            "Her name I didn't catch"
-            "She looked like something special"
-            "The kind who'd understand"
-            "The room was almost spinning"
-            "She pulled another smile"
-            "She had the grace like pleasure"
-            "She had a certain style"
-            "Sunlight on the lino"
-            "Woke me with a shake"
-            "I looked around to find her"
-            "But she'd gone"
-            "Goodbye girl"
-            "Goodbye girl"
-            "Goodbye girl"]))
+        => ["I met" "her" "in a" "pool room" "her name" "I didn't" "catch"
+            "she" "looked" "like" "something special"]))

 ;; TODO Check that bug: https://issues.apache.org/jira/browse/IO-399


name some anon functions for ease of debugging

--- src/dalap/walk.clj
+++ src/dalap/walk.clj
@@ -59,14 +59,12 @@
   "Creates a new visitor that calls outer-visitor on the result of
   a call to inner-visitor."
   [inner-visitor outer-visitor]
-
-  (fn [node walker]
+  (fn comp-visitor [node walker]
     (outer-visitor (inner-visitor node walker) walker)))

 (defn wrap-walker
   [visitor wrap-walker-fn]
-
-  (fn [node walker]
+  (fn wrapper [node walker]
     (visitor node (wrap-walker-fn node walker))))

 ;;;


Small fix

Small fix

--- src/nube/app.clj
+++ src/nube/app.clj
@@ -185,9 +185,9 @@
       (println "Rolling back deploy")
       (doseq [instance (load-pending-app-instances app)]
         (let [[host port] instance]
-          (stop-container host port))
+          (stop-container-by-port host port))
         (remove-pending-app-instance app instance))
-      (throw e))))
+      (throw (Exception. "Deploy failed. Rolling back.")))))

 (defn load-app-logs [app]
   (vec


Added a multimethod for registering jobs under a

common namespace

--- src/onyx/job.clj
+++ src/onyx/job.clj
@@ -40,3 +40,5 @@
        triggers (update :triggers into triggers)
        windows (update :windows into windows)
        flow-conditions (update :flow-conditions into flow-conditions)))))
+
+(defmulti register-job (fn [job-name config] job-name))


godoc, with a pretty meaningless and simplistic classifier

--- src/cljs/go.clj
+++ src/cljs/go.clj
@@ -54,6 +54,22 @@
             (when (and line col)
               {:line (biginteger line) :col (biginteger col)}) ))
          (println err)))))
+
+(defn godoc [package name]
+  (let [{:keys [exit err out]} (sh/sh "godoc" package name)
+        out (s/trim out)]
+    (if (and (zero? exit) (not= "No match found." out))
+      (->> (s/split out #"\n\n+")
+           (group-by #(let [[what name s-or-i method ] (s/split % #" ")
+                            name (-> (if (= \( (first name)) method name)
+                                     (s/split #"\(")
+                                     first
+                                     symbol)]
+                        (or
+                         (when (= "type" what)
+                           (some->> s-or-i keyword #{:struct :interface} (vector name)))
+                         [name (keyword what)]))))
+      (println err))))

 (defn go-get [package]
   (let [{:keys [exit err]} (sh/sh "go" "get" package)]


Fix outer-rect impl for rect like shapes.

Now is again aware of rotation value.

Signed-off-by: Andrey Antukh <8e6a32ae7580b30ec348e03f34a0953d9b475a56@niwi.nz>

--- src/uxbox/shapes.cljs
+++ src/uxbox/shapes.cljs
@@ -268,7 +268,8 @@
   [{:keys [group] :as shape}]
   (as-> shape $
     (assoc $ :x (:x1 shape) :y (:y1 shape))
-    (merge $ (size $))))
+    (merge $ (size $))
+    (container-rect $)))

 (defmethod outer-rect' :builtin/line
   [{:keys [x1 y1 x2 y2 group] :as shape}]


First version of factorial-direct.

First version of factorial-direct.

--- src/dsbdp/main.clj
+++ src/dsbdp/main.clj
@@ -80,20 +80,24 @@
           scenario (:scenario options)
           in-data (condp (fn [^String v ^String s] (.startsWith s v)) scenario
                     "no-op" 1
-                    "factorial" 24N
+                    "factorial" 300N
                     "pcap" pcap-byte-array-test-data
                     "nil" nil
                     )
-          proc-fn (create-proc-fn sample-pcap-processing-definition-json)
+          proc-fn (condp = scenario
+                    "pcap-direct" (create-proc-fn sample-pcap-processing-definition-json)
+                    "factorial-direct" factorial)
           fn-mapping (:fn-mapping options)
           pipeline-length (:pipeline-length options)
           pipeline (if (and
                          (not (nil? in-data))
-                         (not= scenario "pcap-direct"))
+                         (not= scenario "pcap-direct")
+                         (not= scenario "factorial-direct"))
                      (create-local-processing-pipeline
                        (condp = scenario
                          "no-op" (create-no-op-proc-fns pipeline-length)
-                         "factorial" (create-factorial-proc-fns pipeline-length)
+                         "factorial" [(fn [i _] (factorial i))]
+                         "factorial#inc" (create-factorial-proc-fns pipeline-length)
                          "pcap-json" [(fn [i _] (proc-fn i))]
                          "pcap-json#inc" (create-proc-fns-vec
                                            fn-mapping
@@ -107,9 +111,11 @@
           in-loop (ProcessingLoop.
                     "InLoop"
                     (cond
-                      (= "pcap-direct" scenario) (fn []
-                                                   (proc-fn in-data)
-                                                   (.inc out-cntr))
+                      (or
+                        (= "pcap-direct" scenario)
+                        (= "factorial-direct")) (fn []
+                                                  (proc-fn in-data)
+                                                  (.inc out-cntr))
                       (not (nil? in-data)) (fn []
                                              (doseq [i (repeat 1000 0)]
                                                (in-fn in-data)


clean-domain-name function

clean-domain-name function

--- src/ads_txt_crawler/domains.clj
+++ src/ads_txt_crawler/domains.clj
@@ -23,25 +23,31 @@
    (clojure.string/starts-with? line "#")
    (clojure.string/blank? line))))

-(defn read-domain-file [fname]
-  ;; read file and return list of non-commented lines
-  ;; - remove commented lines
+(defn clean-domain-name
+  [domain]
   ;; - trim leading and trailing whitespace
   ;; - remove http[s]:// prefixes
   ;; - remove www. prefixes
   ;; - lower case
+  (-> domain
+      (clojure.string/lower-case)
+      (clojure.string/trim)
+      (hostname)
+      (strip-www)))
+
+(defn read-domain-file [fname]
+  ;; read file and return list of non-commented lines
+  ;; - remove commented lines
   (with-open [r (clojure.java.io/reader fname)]
     (doall
      (->> (line-seq r)
           (filter ignore-line)
-          (map #(-> %
-                   (clojure.string/lower-case)
-                   (clojure.string/trim)
-                   (hostname)
-                   (strip-www)
-                   ))))))
+          (map clean-domain-name)))))

 (defn domains
   "For a given file read it's list of domain names and return them"
   [fname]
   (read-domain-file fname))
+
+
+


Delete index, not cap

Delete index, not cap

--- src/icecap/api.clj
+++ src/icecap/api.clj
@@ -30,5 +30,7 @@

 (defn revoke-cap
   "Revokes a capability."
-  [cap & {store :store}]
-  (async/into {} (delete! store cap)))
+  [cap & {store :store kdf :kdf}]
+  (let [{index :index} (crypto/derive kdf cap)
+        chan (delete! store index)]
+    (async/into {} chan)))


use entire grammar

use entire grammar

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -776,9 +776,7 @@
         it2lex (map-subset-by-path lexicon-for-generation [:italiano :italiano])]
     {:name "medium"
      :generate {:lexicon lexicon-for-generation}
-     :grammar (filter #(or (= (:rule %) "s-aux")
-                           (= (:rule %) "vp-aux"))
-                      grammar)
+     :grammar grammar
      :index-fn (fn [spec]
                  (do (log/debug (str "index-fn called with spec: "
                                     (strip-refs


fix typo

fix typo

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -1955,7 +1955,7 @@
    (unify agreement-noun
           common-noun
           countable-noun
-          feminine-noun
+          masculine-noun
           {:synsem {:sem {:human true
                           :pred :man
                           :child false}}})


Setup foundation js correctly

Setup foundation js correctly

--- src/clj/comic_reader/server.clj
+++ src/clj/comic_reader/server.clj
@@ -76,6 +76,7 @@
                   [:input#history_state {:type "hidden"}]
                   (hp/include-js "js/compiled/main.js"
                                  "js/vendor/jquery.js"
+                                 "js/vendor/fastclick.js"
                                  "js/foundation.min.js")]))
   (c/GET "/blank" [] "")
   (c/context "/api/v1" []


fully implement Titanium Ribs

fully implement Titanium Ribs

--- src/clj/game/cards-hardware.clj
+++ src/clj/game/cards-hardware.clj
@@ -598,7 +598,32 @@
     :recurring 2}

    "Titanium Ribs"
-   {:effect (effect (damage :meat 2 {:card card}))}
+   {:events
+    {:pre-resolve-damage
+     {:req (req (and (> (last targets) 0)
+                     (not (and (= (:active-player @state) :corp) (get-in @state [:damage] :damage-choose)))
+                     (not (get-in @state [:damage :damage-replace]))))
+      :effect (req (let [dtype target
+                         dmg (last targets)]
+                     (when (> dmg (count (:hand runner)))
+                       (flatline state))
+                     (when (= dtype :brain)
+                       (swap! state update-in [:runner :brain-damage] #(+ % dmg))
+                       (swap! state update-in [:runner :hand-size-modification] #(- % dmg)))
+                     (swap! state assoc-in [:damage :damage-choose] true)
+                     (show-wait-prompt state :corp "Runner to use Titanium Ribs to choose cards to be trashed")
+                     (resolve-ability state side
+                       {:prompt (msg "Choose " dmg " cards to trash for the " (name dtype) " damage") :player :runner
+                        :choices {:max dmg :req #(and (in-hand? %) (= (:side %) "Runner"))}
+                        :msg (msg "trash " (join ", " (map :title targets)))
+                        :effect (req (swap! state update-in [:damage] dissoc :damage-choose)
+                                     (clear-wait-prompt state :corp)
+                                     (doseq [c targets]
+                                       (trash state side c {:cause dtype :unpreventable true})))}
+                      card nil)
+                      (trigger-event state side :damage dtype nil)))}}
+    :effect (effect (system-msg (str "suffers 2 meat damage from installing Titanium Ribs"))
+                    (damage :meat 2 {:card card}))}

    "Turntable"
    {:in-play [:memory 1]


test for Turntable swapping a scored Mandatory Upgrades away from Corp

--- src/clj/test/cards-hardware.clj
+++ src/clj/test/cards-hardware.clj
@@ -236,3 +236,23 @@
         (is (= 2 (:agenda-point (get-runner))) "Took Project Vitruvius from Corp")
         (is (= 0 (:agenda-point (get-corp))) "Swapped Domestic Sleepers to Corp")
         (is (nil? (:swap (core/get-card state tt))) "Turntable ability disabled")))))
+
+(deftest turntable-mandatory-upgrades
+  "Turntable - Swap a Mandatory Upgrades away from the Corp reduces Corp clicks per turn"
+  (do-game
+    (new-game (default-corp [(qty "Mandatory Upgrades" 1) (qty "Project Vitruvius" 1)])
+              (default-runner [(qty "Turntable" 1)]))
+    (play-from-hand state :corp "Mandatory Upgrades" "New remote")
+    (let [manups (get-content state :remote1 0)]
+      (score-agenda state :corp manups)
+      (is (= 4 (:click-per-turn (get-corp))) "Up to 4 clicks per turn")
+      (take-credits state :corp)
+      (play-from-hand state :runner "Turntable")
+      (let [tt (get-in @state [:runner :rig :hardware 0])]
+        (run-empty-server state "HQ")
+        (prompt-choice :runner "Steal")
+        (is (= 2 (:agenda-point (get-runner))) "Stole Project Vitruvius")
+        (card-ability state :runner tt 0)
+        (prompt-select :runner (find-card "Mandatory Upgrades" (:scored (get-corp))))
+        (is (= 3 (:click-per-turn (get-corp))) "Back down to 3 clicks per turn")
+        (is (nil? (:swap (core/get-card state tt))) "Turntable ability disabled")))))


update Turntable test

update Turntable test

--- src/clj/test/cards-hardware.clj
+++ src/clj/test/cards-hardware.clj
@@ -200,7 +200,6 @@
         (card-ability state :runner tt 0)
         ;; Turntable prompt should be active
         (is (= (:cid tt) (-> @state :runner :prompt first :card :cid)))
-        (prompt-choice :runner "Yes")
         (prompt-select :runner (find-card "Project Vitruvius" (:scored (get-corp))))
         (is (= 2 (:agenda-point (get-runner))) "Took Project Vitruvius from Corp")
         (is (= 0 (:agenda-point (get-corp))) "Swapped Domestic Sleepers to Corp")


Output as string

Output as string

--- src/cljs/cljs_webrepl/core.cljs
+++ src/cljs/cljs_webrepl/core.cljs
@@ -16,7 +16,8 @@
    [cljs.core.async.macros :refer [go go-loop]]))

 (def default-state
-  {:ns      nil
+  {:repl    nil
+   :ns      nil
    :input   ""
    :cursor  0
    :history (sorted-map)})
@@ -66,7 +67,7 @@

 (defn on-repl-print [state num [s]]
   (when num
-    (swap! state update-in [:history num] update :output conj s)))
+    (swap! state update-in [:history num] update :output str s)))

 (defn on-repl-error [state num [err]]
   (when num
@@ -96,22 +97,22 @@
     (close! to-repl)))

 (defn reset-repl! [state]
-  (when-let [repl (:repl @state)]
-    (close! (:from-repl repl))
-    (close! (:to-repl repl)))
+  (when-let [{:keys [from-repl to-repl]} (:repl @state)]
+    (close! from-repl)
+    (close! to-repl))

   (let [{:keys [to-repl from-repl]} (repl-thread/repl-thread)
         to-eval                     (chan)]
-    (repl-event-loop state from-repl)
-    (repl-eval-loop to-eval to-repl from-repl)
     (swap! state #(-> %
                       (merge default-state)
                       (assoc :repl {:to-repl   to-eval
-                                    :from-repl from-repl})))))
+                                    :from-repl from-repl})))
+    (repl-event-loop state from-repl)
+    (repl-eval-loop to-eval to-repl from-repl)))

 (defn eval-str! [expression]
   (let [{:keys [to-repl]} (:repl @state)
-        expression        (some-> expression trim)]
+        expression        (some-> expression str/trim)]
     (when (and (some? to-repl) (some? expression))
       (put! to-repl expression))))

@@ -222,7 +223,7 @@
   [:div.card-output
    [:div.card-data
     (into [:pre.line]
-          (for [line output]
+          (for [line (str/split output #"\n")]
             [:code.line line]))]
    [:hr.border]])

@@ -261,16 +262,6 @@
    [:div.mdl-grid
     [:div.mdl-cell.mdl-cell--12-col
      [:p "REPL initializing..."]]]])
-
-(defn history [{:keys [state] :as props}]
-  ^{:key (count (:history @state))}
-  [scroll-on-update
-   [:div.history
-    [:div.mdl-grid
-     (doall
-      (for [[num history-item] (:history @state)]
-        ^{:key num}
-        [history-card props num history-item]))]]])

 (defn input-field [props]
   (let [state              (:state props)


fixed metadata issue with midje.util's functions

--- src/midje/util.clj
+++ src/midje/util.clj
@@ -5,13 +5,14 @@
 (defmacro expose-testables
   "Enables testing of vars in the target ns which have ^:testable metadata"
   [target-ns]
-  (macro-for [testable-sym (for [[sym var] (ns-interns target-ns)
-                                 :when (:testable (meta var))]
-                             sym) ]
-    `(def ~testable-sym (intern '~target-ns '~testable-sym))))
+  (macro-for [[sym var] (ns-interns target-ns)
+              :when (:testable (meta var))]
+             `(-> (def ~sym ~var)
+                  (alter-meta! merge (meta ~var)))))

-(defmacro testable-privates
+(defmacro testable-privates
   "Intern into the current namespace the symbols from the specified namespace"
   [namespace & symbols]
-  (macro-for [sym symbols]
-    `(def ~sym (intern '~namespace '~sym))))
+  (macro-for [sym symbols, :let [var (ns-resolve namespace sym)]]
+             `(-> (def ~sym ~var)
+                  (alter-meta! merge (meta ~var)))))


Feedback ES coercion

Feedback ES coercion

--- src/ctia/stores/es/feedback.clj
+++ src/ctia/stores/es/feedback.clj
@@ -2,20 +2,28 @@
   (:import java.util.UUID)
   (:require
    [schema.core :as s]
+   [schema.coerce :as c]
+   [ring.swagger.coerce :as sc]
    [ctia.schemas.feedback :refer [Feedback
-                                 NewFeedback
-                                 realize-feedback]]
+                                  NewFeedback
+                                  StoredFeedback
+                                  realize-feedback]]
    [ctia.stores.es.document :refer [create-doc
-                                   delete-doc
-                                   search-docs]]))
+                                    delete-doc
+                                    search-docs]]))

 (def ^{:private true} mapping "feedback")

+(def coerce-stored-feedback
+  (c/coercer! (s/maybe StoredFeedback)
+              sc/json-schema-coercion-matcher))
+
 (defn handle-create-feedback [state realized-new-feedback _ _]
-  (create-doc (:conn state)
-              (:index state)
-              mapping
-              realized-new-feedback))
+  (-> (create-doc (:conn state)
+                  (:index state)
+                  mapping
+                  realized-new-feedback)
+      coerce-stored-feedback))

 (defn handle-delete-feedback [state id]
   (delete-doc (:conn state)
@@ -24,7 +32,8 @@
               id))

 (defn handle-list-feedback [state filter-map]
-  (search-docs (:conn state)
-               (:index state)
-               mapping
-               filter-map))
+  (->> (search-docs (:conn state)
+                    (:index state)
+                    mapping
+                    filter-map)
+       (map coerce-stored-feedback)))


Corrected mistake in path used to obtain application version.

--- src/onix/setup.clj
+++ src/onix/setup.clj
@@ -41,7 +41,7 @@
      (ReporterState/valueOf (env :service-graphite-enabled)))))

 (def version
-  (delay (if-let [path (.getResource (ClassLoader/getSystemClassLoader) "META-INF/maven/userhistoryonix/onix/pom.properties")]
+  (delay (if-let [path (.getResource (ClassLoader/getSystemClassLoader) "META-INF/maven/onix/onix/pom.properties")]
            ((read-file-to-properties path) "version")
            "localhost")))


started refactoring compar strings like number needed strings - to enable highlighting

--- src/unspun/db.cljs
+++ src/unspun/db.cljs
@@ -132,8 +132,8 @@
   [x]
   (Math.round (* 100 x)))

-
-(defn caps-tidy [s]
+(def caps-tidy capitalize)
+#_(defn caps-tidy [s]
   (-> s
       (capitalize)
       (replace #"Us " "US ")
@@ -152,29 +152,39 @@
 (defn n-plural-form [[singular plural]]
   (str "~[" singular "~;" plural "~:;" plural "~]"))

-(defn compare1 [subjects]
+(def compare1
   "The risk of ~a for ~a is ~d%. ")
 (def compare2 "The risk for those ~a is ~a to ~d%.")

-(defn compare-text-vector
-  "Generate text for compare screens"
+(defn compare-text-vector-old
+  "Generate a vector of texts for compare screens. We return a vector rather than a single string to make
+  it easy to apply different formatting to each element."
   ([{:keys [subjects risk exposure baseline-risk relative-risk outcome causative]}]
    (let [brpc (to-pc baseline-risk)
          erpc (to-pc (* baseline-risk relative-risk))]
      (str
-       (caps-tidy (format (compare1 subjects) outcome (second subjects) brpc))
-       (caps-tidy (format compare2 exposure (increased? brpc erpc) erpc))))))
-
-
-(defn nn1 [subjects]
+       (str "The risk of " outcome " for " (second subjects) " is " brpc "%. ")
+       (str "The risk for those " exposure " is " (increased? brpc erpc) " to " erpc "%.")))))
+
+(defn compare-text-vector
+  "Generate a vector of texts for compare screens. We return a vector rather than a single string to make
+  it easy to apply different formatting to each element."
+  ([{:keys [subjects risk exposure baseline-risk relative-risk outcome causative]}]
+   (let [brpc (to-pc baseline-risk)
+         erpc (to-pc (* baseline-risk relative-risk))]
+     (str
+       (str "The risk of " outcome " for " (second subjects) " is " brpc "%. ")
+       (str "The risk for those " exposure " is " (increased? brpc erpc) " to " erpc "%.")))))
+
+#_(defn nn1 [subjects]
   (str "On average, for one <mark-one>~a " (singular-form subjects) "</mark-one> to experience ~a, <mark-group>~d more</mark-group> ~:*" (n-plural-form subjects) " would need to be ~a. "))
-(def nn1-2 "Of these, <mark-anyway>~d</mark-anyway> would experience ~a anyway.")
-
-(defn nn2 [subjects]
+#_(def nn1-2 "Of these, <mark-anyway>~d</mark-anyway> would experience ~a anyway.")
+
+#_(defn nn2 [subjects]
   (str "On average, to find <mark-one>one ~a</mark-one> " (singular-form subjects) " to experience ~a, we would need to take <mark-group>a group of ~d</mark-group> more ~:*" (n-plural-form subjects) " ~a. "))

-(defn nn-text-vector-old
+#_(defn nn-text-vector-old
   "Generate text for number needed screens"
   ([{:keys [subjects risk exposure baseline-risk relative-risk outcome causative]}]
    (let [brpc (to-pc baseline-risk)
@@ -187,7 +197,8 @@
             (caps-tidy (format nn1-2 (anyway relative-risk baseline-risk) outcome)))))))

 (defn nn-text-vector
-  "Generate text for number needed screens"
+  "Generate a vector of texts for number needed screens. We return a vector rather than a single string to make
+  it easy to apply different formatting to each element."
   ([{:keys [subjects risk exposure baseline-risk relative-risk outcome causative]}]
    (let [brpc (to-pc baseline-risk)
          erpc (to-pc (* baseline-risk relative-risk))


rename pushback-reader to push-back-reader, add Closeable type hint for with-open

--- src/main/clojure/clojure/tools/reader/reader_types.clj
+++ src/main/clojure/clojure/tools/reader/reader_types.clj
@@ -182,7 +182,7 @@
 (defprotocol ReaderCoercer
   (to-rdr [rdr]))

-(declare string-reader pushback-reader)
+(declare string-reader push-back-reader)

 (extend-protocol ReaderCoercer
   Object
@@ -204,14 +204,14 @@
   Object
   (to-pbr [rdr buf-len]
     (if (satisfies? Reader rdr)
-      (pushback-reader rdr buf-len)
+      (push-back-reader rdr buf-len)
       (throw (IllegalArgumentException. (str "Argument of type: " (class rdr) " cannot be converted to IPushbackReader")))))
   clojure.tools.reader.reader_types.Reader
-  (to-pbr [rdr buf-len] (pushback-reader rdr buf-len))
+  (to-pbr [rdr buf-len] (push-back-reader rdr buf-len))
   clojure.tools.reader.reader_types.PushbackReader
-  (to-pbr [rdr buf-len] (pushback-reader rdr buf-len))
+  (to-pbr [rdr buf-len] (push-back-reader rdr buf-len))
   String
-  (to-pbr [str buf-len] (pushback-reader str buf-len))
+  (to-pbr [str buf-len] (push-back-reader str buf-len))
   java.io.Reader
   (to-pbr [rdr buf-len] (java.io.PushbackReader. rdr buf-len)))

@@ -318,31 +318,31 @@
   ([^String s]
    (StringReader. s (count s) 0)))

-(defn pushback-reader
+(defn ^Closeable push-back-reader
   "Creates a PushbackReader from a given reader or string"
-  ([rdr] (pushback-reader rdr 1))
+  ([rdr] (push-back-reader rdr 1))
   ([rdr buf-len] (PushbackReader. (to-rdr rdr) (object-array buf-len) buf-len buf-len)))

-(defn string-push-back-reader
+(defn ^Closeable string-push-back-reader
   "Creates a PushbackReader from a given string"
   ([s]
    (string-push-back-reader s 1))
   ([^String s buf-len]
-   (pushback-reader (string-reader s) buf-len)))
-
-(defn input-stream-reader
+   (push-back-reader (string-reader s) buf-len)))
+
+(defn ^Closeable input-stream-reader
   "Creates an InputStreamReader from an InputStream"
   [is]
   (InputStreamReader. is nil))

-(defn input-stream-push-back-reader
+(defn ^Closeable input-stream-push-back-reader
   "Creates a PushbackReader from a given InputStream"
   ([is]
    (input-stream-push-back-reader is 1))
   ([^InputStream is buf-len]
-   (pushback-reader (input-stream-reader is) buf-len)))
-
-(defn indexing-push-back-reader
+   (push-back-reader (input-stream-reader is) buf-len)))
+
+(defn ^Closeable indexing-push-back-reader
   "Creates an IndexingPushbackReader from a given string or PushbackReader"
   ([s-or-rdr]
    (indexing-push-back-reader s-or-rdr 1))
@@ -352,7 +352,7 @@
    (IndexingPushbackReader.
     (to-pbr s-or-rdr buf-len) 1 1 true nil 0 file-name)))

-(defn source-logging-push-back-reader
+(defn ^Closeable source-logging-push-back-reader
   "Creates a SourceLoggingPushbackReader from a given string or PushbackReader"
   ([s-or-rdr]
    (source-logging-push-back-reader s-or-rdr 1))


fixed authorized keys output

fixed authorized keys output

--- src/org/domaindrivenarchitecture/pallet/crate/user.clj
+++ src/org/domaindrivenarchitecture/pallet/crate/user.clj
@@ -35,7 +35,7 @@
       (str ssh-dir "authorized_keys")
       :owner user-name :mode "644"
       :content (string/join
-                 \n
+                 \newline
                  authorized-keys))
       ))


Change output file type from resource to asset

Resources are also input files and cljs task will pass any input dirs to
cljs compiler. Output files contain cljs sources for source-maps. Cljs
compiler will try to compile any cljs files in input folders. This
causes problems if there are multiple cljs tasks as they see each others
output files.

There doesn't seem to be any reason why Cljs output files would have to
input role.

--- src/adzerk/boot_cljs.clj
+++ src/adzerk/boot_cljs.clj
@@ -193,7 +193,10 @@
               ;; builds. Each :output-to js file will depend only on compiled
               ;; namespaces in its own :output-dir, including goog/base.js etc.
               dep-order (reduce into [] (map :dep-order results))]
+          ;; Added as asset (output-only) files so that other cljs tasks
+          ;; don't see these as input files.
+          ;; TODO: Does this cause other problems?
           (-> fileset
-              (core/add-resource tmp-result)
+              (core/add-asset tmp-result)
               (core/add-meta (deps/compiled fileset dep-order))
               core/commit!))))))


fix typo

fix typo

--- src/babel/lexiconfn.cljc
+++ src/babel/lexiconfn.cljc
@@ -823,7 +823,7 @@

 ;; (babel.writer/write-lexicon "en" lexicon)
 (defn write-lexicon
-  "write a lexion (as a map) to a database: inverse of (read-lexicon)."
+  "write a lexicon (as a map) to a database: inverse of (read-lexicon)."
   [language lexicon]
   (transaction
    (truncate-lexicon language)


indent

indent

--- src/ca_recipe/rfi/af.clj
+++ src/ca_recipe/rfi/af.clj
@@ -1,6 +1,7 @@
 (ns ca-recipe.rfi.af)

-(def p1 {:first-name "Michael" :last-name "Bevilacqua"}) (def p2 {:first-name "Pedro" :last-name "Vasquez"})
+(def p1 {:first-name "Michael" :last-name "Bevilacqua"})
+(def p2 {:first-name "Pedro" :last-name "Vasquez"})
 (def p3 {:first-name "Robert" :last-name "Aarons"})
 (def people [p3 p2 p1])


basic module compilation working

basic module compilation working

--- src/clj/cljs/closure.clj
+++ src/clj/cljs/closure.clj
@@ -666,9 +666,10 @@
                         sources)))
         [sources' modules]
         (reduce
-          (fn [[sources ret] [name module-desc]]
-            (let [{:keys [entries output-to depends-on]} module-desc
-                  js-module (JSModule. (clojure.core/name name))
+          (fn [[sources ret] [name {:keys [entries output-to depends-on] :as module-desc}]]
+            (assert (or (= name :cljs-base) (not (empty? entries)))
+              (str "Module " name " does not define any :entries"))
+            (let [js-module (JSModule. (clojure.core/name name))
                   [sources' module-sources]
                   ;; compute inputs for a closure module
                   ;; as well as sources difference
@@ -797,7 +798,7 @@
         sources (if (= :whitespace (:optimizations opts))
                   (cons "var CLOSURE_NO_DEPS = true;" sources)
                   sources)
-        modules (build-modules sources (:modules opts))
+        modules (build-modules sources opts)
         ^List inputs (map (comp :closure-module second) modules)
         ^Result result (.compileModules closure-compiler externs inputs compiler-options)]
     (if (.success result)
@@ -946,9 +947,17 @@
              "\"); } else { console.warn(\"ClojureScript could not load :main, did you forget to specify :asset-path?\"); };</script>');\n")))))

 (defn output-modules
-  ([opts modules]
-    (doseq [{:keys [output-to closure-module]} modules]
-      (spit (io/file output-to) (.toSource ^JSModule closure-module)))))
+  "Given compiler options and a sequence of module name and module description
+   tuples output module sources to disk. Modules description must define
+   :output-to and supply :source entry with the JavaScript source to write
+   to disk."
+  [opts modules]
+  (doseq [[name {:keys [output-to source]}] modules]
+    (assert (not (nil? output-to))
+      (str "Module " name " does not define :output-to"))
+    (assert (not (nil? source))
+      (str "Module " name " did not supply :source"))
+    (spit (io/file output-to) source)))

 (defn ^String rel-output-path
   "Given an IJavaScript which is either in memory, in a jar file,
@@ -1273,7 +1282,7 @@
                              (str ":source-map must name a file when using :whitespace, "
                                   ":simple, or :advanced optimizations"))
                            (doall (map #(source-on-disk all-opts %) js-sources)))
-                         (if (:modules opts)
+                         (if (:modules all-opts)
                            (->>
                              (apply optimize-modules all-opts js-sources)
                              (output-modules all-opts))
@@ -1304,7 +1313,8 @@
      :output-dir "samples/hello/out"
      :modules
      {:hello
-      {:output-to "samples/hello/out/hello.js"}}})
+      {:output-to "samples/hello/out/hello.js"
+       :entries '#{hello.core}}}})
   )

 (defn watch


Guard against NPEs when the :message key isn't present.

--- src/clj/runbld/store.clj
+++ src/clj/runbld/store.clj
@@ -85,12 +85,14 @@
        (create-timestamped-index conn (format "%s-" idx) body)))))

 (defn truncate-message [{:keys [message] :as doc}]
-  (let [bytes (.getBytes message "UTF-8")
-        truncated (if (> (count bytes) MAX_TERM_LENGTH)
-                    (String. (byte-array (take MAX_TERM_LENGTH bytes))
-                             "UTF-8")
-                    message)]
-    (merge doc {:message truncated})))
+  (if message
+    (let [bytes (.getBytes message "UTF-8")
+          truncated (if (> (count bytes) MAX_TERM_LENGTH)
+                      (String. (byte-array (take MAX_TERM_LENGTH bytes))
+                               "UTF-8")
+                      message)]
+      (merge doc {:message truncated}))
+    doc))

 (s/defn create-build-doc :- StoredBuild
   [opts result test-report]


Fixing AI not resetting when starting a new game

--- src/clj/zetawar/app.cljs
+++ src/clj/zetawar/app.cljs
@@ -68,6 +68,12 @@
                          [_  :app/game ?g]
                          [?g :game/factions ?f]]
                        @conn)]
+    ;; TODO: cleanup (relocate?) player stopping
+    ;; Stop existing players (when starting new games)
+    (when players
+      (doseq [[_ player] @players]
+        (when player
+          (players/stop player))))
     (doseq [{:keys [faction/ai faction/color]} factions]
       (let [player-type (if ai ::players/reference-ai ::players/human)
             player (players/new-player app-ctx player-type color)]


Run results of multiple rounds to report file

--- src/clj_gatling/core.clj
+++ src/clj_gatling/core.clj
@@ -33,20 +33,21 @@
 (defn map-request [line]
   (let [start (.toString (:start line))
         end (.toString (:end line))]
-    ["REQUEST" "Scenario name" "0" "" "request_1" start start "1390591841245" end "OK" "\u0020"]))
+    ["REQUEST" "Scenario name" (.toString (:id line)) "" "request_1" start start "1390591841245" end "OK" "\u0020"]))

 (defn map-scenario [line]
   (let [start (.toString (:start line))
         end (.toString (:end line))]
-    ["SCENARIO"	"Scenario name"	"0"	start end]))
+    ["SCENARIO"	"Scenario name"	(.toString (:id line)) start end]))

-(defn create-result [times]
-  (let [header ["RUN" "20140124213040" "basicexamplesimulation" "\u0020"]]
-    [header (map-request (first times)) (map-scenario (first times))]))
+(defn create-result-lines [result]
+  (let [header ["RUN" "20140124213040" "basicexamplesimulation" "\u0020"]
+        reqs-and-scenarios (apply concat (map #(vector (map-request %) (map-scenario %)) result))]
+    (conj reqs-and-scenarios header)))

 (defn -main [threads]
   (let [result (run-simulation (read-string threads))
-        csv (csv/write-csv (create-result result) :delimiter "\t" :end-of-line "\n")]
+        csv (csv/write-csv (create-result-lines result) :delimiter "\t" :end-of-line "\n")]
     (println csv)
     (spit "results/23/simulation.log" csv)
     (create-chart "results")


update to notify-progress

update to notify-progress

--- src/clj_money/import.clj
+++ src/clj_money/import.clj
@@ -156,7 +156,7 @@
     [(map #(io/input-stream (byte-array (:body %))) images)
      source-type]))

-(defn- update-progress
+(defn- notify-progress
   [{:keys [progress-chan progress] :as context}]
   ; this will block until the item is taken off the channel
   ; in the future we may want more flexibility than that, but
@@ -165,12 +165,12 @@
   (>!! progress-chan progress)
   context)

-(defn- inc-and-update-progress
+(defn- inc-and-notify-progress
   [context record-type]
   (-> context
       (update-in [:progress record-type :imported]
                  (fnil inc 0))
-      update-progress))
+      notify-progress))

 (defmulti import-record
   (fn [_ record]
@@ -180,7 +180,7 @@
   [context {:keys [record-type record-count]}]
   (-> context
       (assoc-in [:progress record-type :total] record-count)
-      update-progress))
+      notify-progress))

 (defmethod import-record :account
   [context account]
@@ -225,7 +225,7 @@
       (import-record record)

       (report-progress? record-type)
-      (inc-and-update-progress record-type))))
+      (inc-and-notify-progress record-type))))

 (defn import-data
   "Reads the contents from the specified input and saves


fixed like request url

fixed like request url

--- src/cljs/freeq/list.cljs
+++ src/cljs/freeq/list.cljs
@@ -5,7 +5,7 @@
             [cljs.core.async :refer [<!]]))

 (defn like-request [id]
-  (go (let [response (<! (http/post "/like-request/:id" {:query-params {"id" id}}))]
+  (go (let [response (<! (http/post (str "/like-request/" id)))]
         (go-index)
         )))


Refactor.

Refactor.

--- src/datascript/core.cljs
+++ src/datascript/core.cljs
@@ -3,11 +3,9 @@
     [datascript :refer [combine-cmp case-tree]]))

 (defprotocol ISearch
-  (-search [data pattern callback])
-  (add-record [data e a v])
-  (from-index [data index search callback]))
+  (-search [data pattern callback]))

-(defrecord DB [eav aev ave]
+(defrecord DB [db search-eav search-ave]
   Object
   (toString [this]
     (pr-str* this))
@@ -15,26 +13,36 @@
   ISearch
   (-search [db [e a v] callback]
     (case-tree [e a (some? v)] [
-      (from-index db "eav" [e a v] callback)         ;; e a v
-      (from-index db "eav" [e a nil] callback)       ;; e a _
-      (from-index db "eav" [e nil nil] (fn [data]
+      (search-eav [e a v] callback)                  ;; e a v
+      (search-eav [e a nil] callback)                ;; e a _
+      (search-eav [e nil nil] (fn [data]
         (callback (filter #(= v (.-v %)) data))))    ;; e _ v
-      (from-index db "eav" [e nil nil] callback)     ;; e _ _
-      (from-index db "ave" [a v nil] callback)       ;; _ a v
-      (from-index db "ave" [a nil nil] callback)     ;; _ a _
-      (callback (filter #(= v (.-v %)) eav))         ;; _ _ v
-      (callback "eav")]))                            ;; _ _ _
-  (add-record [_ e a v]
-    (DB.
-      (assoc eav (mapv str [e a v]) (to-array [e a v]))
-      (assoc aev (mapv str [a e v]) (to-array [e a v]))
-      (assoc ave (mapv str [a v e]) (to-array [e a v]))))
-  (from-index [db index search callback]
+      (search-eav [e nil nil] callback)              ;; e _ _
+      (search-ave [a v nil] callback)                ;; _ a v
+      (search-ave [a nil nil] callback)              ;; _ a _
+      (callback (filter #(= v (.-v %)) "eav"))       ;; _ _ v FIXME!
+      (callback "eav")]))                            ;; _ _ _ FIXME!
+)
+
+(defn search-index [index]
+  (fn [search callback]
     (callback (let [search-start search
-                    search-stop  (mapv #(if (nil? %) "\uffff" %) search)
-                    index        ((keyword index) db)]
+                    search-stop  (mapv #(if (nil? %) "\uffff" %) search)]
       (vec (vals (subseq index >= search-start <= search-stop)))))))

+(defn add-record [db e a v]
+  (let [record    (to-array [e a v])
+        indexes   (:db db)
+        ave       (assoc (:ave indexes) (mapv str [a v e]) record)
+        eav       (assoc (:eav indexes) (mapv str [e a v]) record)]
+    (DB. (hash-map :eav eav :ave ave)
+         (search-index eav)
+         (search-index ave))))
+
 (defn init-db []
-  (DB. (sorted-map) (sorted-map) (sorted-map)))
+  (let [ave          (sorted-map)
+        eav          (sorted-map)]
+    (DB. (hash-map :eav eav :ave ave)
+         (search-index eav)
+         (search-index ave))))


Added parameter parsing to integer

Added parameter parsing to integer

--- kuona/src/kuona_api/handler.clj
+++ kuona/src/kuona_api/handler.clj
@@ -49,9 +49,11 @@
   (str base "?page=" page-number))

 (defn get-repository-count [] (store/get-count repositories))
+
 (defn get-repositories
   [search page]
-  (response (store/search repositories search 100 page repository-page-link)))
+  (let [page-number (. Integer parseInt  page)]
+    (response (store/search repositories search 100 page repository-page-link))))

 (defroutes app-routes
   (GET "/" [] (response service-data))


Reworked some macros

Reworked some macros

--- src/hyjinks.clj
+++ src/hyjinks.clj
@@ -23,10 +23,11 @@

 (defn- $lift [& fs] (partial map #(%1 %2) fs))

-(defmacro impl-invoke [record]
-	(let [parted-record (partition-by #(= % 'clojure.lang.IFn) record)
+(defmacro defrecord-ifn [& record-parts]
+	(let [parted-record (partition-by #(= % 'clojure.lang.IFn) record-parts)
 	      paramses (map (fn [n] (map #(symbol (str "_" %)) (range 0 n))) (range 0 21))]
 		(concat
+			(list 'defrecord)
 			(apply concat (take 2 parted-record))
 			(map (fn [params] `(~'invoke [~'this ~@params] (.applyTo ~'this (list ~@params)))) paramses)
 			(list `(~'invoke [~'this ~@(last paramses) ~'more] (.applyTo ~'this (concat (list ~@(last paramses)) ~'more))))
@@ -52,7 +53,7 @@
 	(invoke [this x] (.applyTo this (list x)))
 	(applyTo [this args] (let [tag (first args)] (tag this))))

-(impl-invoke (defrecord Tag [tag-name attrs css items]
+(defrecord-ifn Tag [tag-name attrs css items]
 	java.lang.Object
 	(toString [_]
 		(let [attrs-with-css (if (empty? css) attrs (assoc attrs :style (str css)))]
@@ -62,7 +63,7 @@
 					" />"
 					[">" (map html-escape items) "</" tag-name ">"]))))
 	clojure.lang.IFn
-	(applyTo [this args] (apply extend-tag this args))))
+	(applyTo [this args] (apply extend-tag this args)))

 (defrecord Literal [s] java.lang.Object (toString [_] s))

@@ -237,7 +238,7 @@
 ;; Character Entities

 (defmacro defentity
-	([id] `(def ~id (literal ~(str "&" (name id) ";"))))
+	([id] `(defentity ~id ~id))
 	([id value] `(def ~id (literal ~(str "&" (name value) ";")))))

 (defentity nbsp)


Comment.

Comment.

--- src/cbfg/ago.clj
+++ src/cbfg/ago.clj
@@ -1,8 +1,9 @@
+;; Wrappers around core.async that track parent-child relationships
+;; and provide events.  Useful for building things like visualizations
+;; and simulations.
+
 (ns cbfg.ago
   (:require [cljs.core.async.macros :refer [go]]))
-
-;; CLJS-friendly wrappers around core.async that provide events, so
-;; that users can build things like visualizations / simulations.

 (defmacro actx-top [actx]
   `(first ~actx))


Use value-processor in the new count-words topology.

--- clstreams/src/clstreams/examples/count_words_prc/topology.clj
+++ clstreams/src/clstreams/examples/count_words_prc/topology.clj
@@ -39,21 +39,23 @@
   (-> (TopologyBuilder.)
       (.addSource "src1" (into-array String '("input")))
       (.addProcessor "prc1"
+                     (topology/value-processor
+                      (mapcat #(str/split % #"\W+"))
+                      (filter #(> (count %) 0))
+                      (map str/lower-case))
+                     (into-array String '("src1")))
+      (.addProcessor "prc2"
                      (topology/key-value-processor
-                      (topology/xform-values
-                       (mapcat #(str/split % #"\W+"))
-                       (filter #(> (count %) 0))
-                       (map str/lower-case))
                       (map (fn [[key value]] [value value])))
-                     (into-array String '("src1")))
-      (.addSink "snk1" "words" (into-array String '("prc1")))
+                     (into-array String '("prc1")))
+      (.addSink "snk1" "words" (into-array String '("prc2")))

       (.addSource "src2" (into-array String '("words")))
       (.addStateStore
        (store/map-store "counts")
        ;(make-counts-store)
        (into-array String '()))
-      (.addProcessor "prc2"
+      (.addProcessor "prc3"
                      (topology/transducing-processor
                       (fn [context]
                         (completing
@@ -66,8 +68,8 @@
                            store)))
                       (fn [context] (.getStateStore context "counts")))
                      (into-array String '("src2")))
-      (.connectProcessorAndStateStores "prc2" (into-array String '("counts")))
-      (.addSink "snk2" "output" (into-array String '("prc2")))))
+      (.connectProcessorAndStateStores "prc3" (into-array String '("counts")))
+      (.addSink "snk2" "output" (into-array String '("prc3")))))

 ;; (println "Collector!!!" (.recordCollector ctx))


Make default filterers consistent among tasks Give filterers (default `:content`) to `slug` and `canonical-url`, and change `permalink`'s default filterer to `:content`. This is one step on the road to a consistent content pipeline, as discussed in

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -227,38 +227,39 @@
         (perun/report-info "build-date" "added date-build to %s files" (count updated-files))
       (perun/set-global-meta updated-fs new-global-meta))))

-(defn ^:private default-slug-fn [filename]
-  "Parses `slug` portion out of the filename in the format: YYYY-MM-DD-slug-title.ext
-
-   Jekyll uses the same format by default."
-  (->> (string/split filename #"[-\.]")
-       (drop 3)
-       drop-last
-       (string/join "-")
-       string/lower-case))
+(def ^:private +slug-defaults+
+  {; Parses `slug` portion out of the filename in the format: YYYY-MM-DD-slug-title.ext
+   ; Jekyll uses the same format by default.
+   :slug-fn (fn [filename] (->> (string/split filename #"[-\.]")
+                                (drop 3)
+                                drop-last
+                                (string/join "-")
+                                string/lower-case))
+   :filterer :content})

 (deftask slug
   "Adds :slug key to files metadata. Slug is derived from filename."
-  [s slug-fn SLUGFN code "function to build slug from filename"]
-  (boot/with-pre-wrap fileset
-    (let [slug-fn       (or slug-fn default-slug-fn)
-          files         (perun/get-meta fileset)
+  [s slug-fn  SLUGFN code "function to build slug from filename"
+   _ filterer FILTER code "predicate to use for selecting entries (default: `:content`)"]
+  (boot/with-pre-wrap fileset
+    (let [options       (merge +slug-defaults+ *opts*)
+          slug-fn       (:slug-fn options)
+          files         (filter (:filterer options) (perun/get-meta fileset))
           updated-files (map #(assoc % :slug (-> % :filename slug-fn)) files)]
       (perun/report-debug "slug" "generated slugs" (map :slug updated-files))
       (perun/report-info "slug" "added slugs to %s files" (count updated-files))
       (perun/set-meta fileset updated-files))))

-
 (def ^:private +permalink-defaults+
   {:permalink-fn (fn [m] (perun/absolutize-url (str (:slug m) "/index.html")))
-   :filterer     identity})
+   :filterer     :content})

 (deftask permalink
   "Adds :permalink key to files metadata. Value of key will determine target path.

    Make files permalinked. E.x. about.html will become about/index.html"
   [p permalink-fn PERMALINKFN code "function to build permalink from TmpFile metadata"
-   _ filterer     FILTER      code "predicate to use for selecting entries (default: `identity`)"]
+   _ filterer     FILTER      code "predicate to use for selecting entries (default: `:content`)"]
   (boot/with-pre-wrap fileset
     (let [options       (merge +permalink-defaults+ *opts*)
           files         (filter (:filterer options) (perun/get-meta fileset))
@@ -268,14 +269,18 @@
       (perun/report-info "permalink" "added permalinks to %s files" (count updated-files))
       (perun/merge-meta fileset updated-files))))

+(def ^:private +canonical-url-defaults+
+  {:filterer :content})
+
 (deftask canonical-url
   "Adds :canonical-url key to files metadata.

    The url is concatenation of :base-url in global metadata and files' permaurl.
    The base-url must end with '/'."
-  []
-  (boot/with-pre-wrap fileset
-    (let [files         (perun/get-meta fileset)
+  [_ filterer FILTER code "predicate to use for selecting entries (default: `:content`)"]
+  (boot/with-pre-wrap fileset
+    (let [options       (merge +canonical-url-defaults+ *opts*)
+          files         (filter (:filterer options) (perun/get-meta fileset))
           base-url      (perun/assert-base-url (:base-url (perun/get-global-meta fileset)))
           assoc-can-url
             #(assoc %


Fix indentations and remove unnecessary let & do

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -21,7 +21,6 @@
       (boot/add-resource tmp)
       boot/commit!))

-
 (def +perun-meta-key+ :io.perun)

 (defn ^:private get-perun-meta [fileset]
@@ -48,16 +47,15 @@
                                 (boot/fileset-diff @last-markdown-files)
                                 boot/user-files
                                 (boot/by-ext ["md" "markdown"])
-                                (map #(.getPath (boot/tmp-file %))))]
-            (do
-              (reset! last-markdown-files fileset)
-              (let [parsed-metadata (pod/with-call-in @pod
-                                      (io.perun.markdown/parse-markdown ~markdown-files))
-                    files (get-perun-meta fileset)
-                    initial-metadata (or files {})
-                    final-metadata (merge initial-metadata parsed-metadata)
-                    fs-with-meta (with-perun-meta fileset final-metadata)]
-          fs-with-meta))))))
+                                (map #(.getPath (boot/tmp-file %))))
+            parsed-metadata (pod/with-call-in @pod
+                              (io.perun.markdown/parse-markdown ~markdown-files))
+            files (get-perun-meta fileset)
+            initial-metadata (or files {})
+            final-metadata (merge initial-metadata parsed-metadata)
+            fs-with-meta (with-perun-meta fileset final-metadata)]
+        (reset! last-markdown-files fileset)
+        fs-with-meta))))

 (def ^:private ttr-deps
   '[[time-to-read "0.1.0"]])
@@ -69,10 +67,10 @@
     (boot/with-pre-wrap fileset
       (let [files (get-perun-meta fileset)
             updated-files (pod/with-call-in @pod
-                                (io.perun.ttr/calculate-ttr ~files))
+                            (io.perun.ttr/calculate-ttr ~files))
             fs-with-meta (with-perun-meta fileset updated-files)]
-       (u/dbug "Generated time-to-read:\n%s\n"
-              (pr-str (map :ttr (vals updated-files))))
+        (u/dbug "Generated time-to-read:\n%s\n"
+                (pr-str (map :ttr (vals updated-files))))
         fs-with-meta))))

 (deftask draft


Finished reading 12.1

Finished reading 12.1

--- src/joy/ch12.clj
+++ src/joy/ch12.clj
@@ -57,3 +57,63 @@
       (respond exchange (prn-str headers)))))

 (update-proxy p {"handle" echo-handler})
+
+(defn html-around [o]
+  (proxy [FilterOutputStream]
+      [o]
+    (write [raw-bytes]
+      (proxy-super write
+                   (.getBytes (str "<body"
+                                   (String. raw-bytes)
+                                   ""))))))
+
+(defn listing [file]
+  (-> file .list sort))
+
+(listing (io/file "."))
+
+(listing (io/file "./README.md"))
+
+(defn html-links [root filenames]
+      (string/join
+       (for [file filenames]
+         (str ""
+              file "
"))))
+
+(html-links "." (listing (io/file ".")))
+
+(defn details [file]
+  (str (.getName file) " is "
+       (.length file) " bytes"))
+
+(details (io/file "./README.md"))
+
+(defn uri->file [root uri]
+  (->> uri
+       str
+       URLDecoder/decode
+       (str root)
+       io/file))
+
+(uri->file "." (URI. "/project.clj"))
+(details (uri->file "." (URI. "/project.clj")))
+
+(def fs-handler
+  (fn [_ exchange]
+    (let [uri (.getRequestURI exchange)
+          file (uri->file "." uri)]
+      (if (.isDirectory file)
+        (do (.add (.getResponseHeaders exchange)
+                  "Content-Type" "text/html")
+            (respond html-around
+                     exchange
+                     (html-links (str uri) (listing file))))
+        (respond exchange (details file))))))
+
+(update-proxy p {"handle" fs-handler})


don't log inspects twice

don't log inspects twice

--- src/pc/utils.clj
+++ src/pc/utils.clj
@@ -10,7 +10,8 @@
     `(do
        (let [value# (quote ~value)
              result# ~value]
-         (println value# "is" (with-out-str (clojure.pprint/pprint result#)))
+         (when (= java.io.PrintWriter (type *out*))
+           (println value# "is" (with-out-str (clojure.pprint/pprint result#))))
          (log/infof "%s is %s" value# result#)
          result#)))


Serve plan.org

Serve plan.org

--- src/qcon/web.clj
+++ src/qcon/web.clj
@@ -2,21 +2,22 @@
   (:require
    [bidi.bidi :refer (->Redirect)]
    [jig.bidi :refer (add-bidi-routes)]
+   [clojure.java.io :as io]
    [stencil.core :as stencil]
    [jig.util :refer (satisfying-dependency)]
    jig)
   (:import (jig Lifecycle))
   )

-(defn index-page [loader]
+(defn index-page [loader plan]
   (assert loader "Loader is nil")
   (fn [req]
     (assert (loader "slides.html") (format "Can't find slides.html, loader is %s" loader))
-    {:status 200 :body (stencil/render (loader "slides.html") {:content "Hello QCon!"})}))
+    {:status 200 :body (stencil/render (loader "slides.html") {:content (slurp plan)})}))

-(defn make-handlers [loader]
+(defn make-handlers [loader plan]
   (let [p (promise)]
-    @(deliver p {:index (index-page loader)})))
+    @(deliver p {:index (index-page loader plan)})))

 (defn make-routes [handlers]
   ["/"
@@ -38,8 +39,11 @@
   Lifecycle
   (init [_ system] system)
   (start [_ system]
-    (let [loader (get-template-loader system config)]
+
+    (clojure.pprint/pprint config)
+    (let [loader (get-template-loader system config)
+          plan (io/file (-> config :jig/project :project-file (.getParentFile)) "plan.org")]
       (-> system
           (assoc :loader loader)
-          (add-bidi-routes config (make-routes (make-handlers loader))))))
+          (add-bidi-routes config (make-routes (make-handlers loader plan))))))
   (stop [_ system] system))


Generate double-quoted ... and _ for ClojureScript

--- src/main/workflo/macros/props.cljc
+++ src/main/workflo/macros/props.cljc
@@ -21,11 +21,11 @@
 (s/def ::join-target-model
   (s/with-gen
     (s/and util/capitalized-symbol?
-           #(not= '... %))
+           #(not (some #{%} #{'... ''...})))
     #(s/gen '#{Foo Bar Baz})))

 (s/def ::unlimited-join-recursion
-  '#{...})
+  #{'... ''...})

 (s/def ::limited-join-recursion
   (s/and integer? pos?))
@@ -367,11 +367,14 @@
   (let [kw-name (keyword (:name prop))]
     (case (:type prop)
       :property kw-name
-      :link     [kw-name (:link-id prop)]
+      :link     [kw-name (if (= '_ (:link-id prop))
+                           ''_
+                           (:link-id prop))]
       :join     (let [target (:join-target prop)]
                   {kw-name
                    (cond
-                     (or (number? target) (= '... target)) target
+                     (some #{target} #{'... ''...}) ''...
+                     (number? target) target
                      (vector? target) (into []
                                             (map property-query)
                                             target)


PLD: call default by full designation of mapbox streets

--- src/hatti/constants.cljs
+++ src/hatti/constants.cljs
@@ -25,7 +25,7 @@
 (def map-styles
   [{:style "basic" :name "Mapbox Basic"}
    {:style "outdoors" :name "Mapbox Outdoors"}
-   {:style "streets" :name "Mapbox"}
+   {:style "streets" :name "Mapbox Streets"}
    {:style "bright" :name "Mapbox Bright"}
    {:style "light" :name "Mapbox Light"}
    {:style "dark" :name "Mapbox Dark"}


(SERVER-977) format OutcomeInfo schema def correctly

--- src/clj/puppetlabs/puppetserver/certificate_authority.clj
+++ src/clj/puppetlabs/puppetserver/certificate_authority.clj
@@ -99,7 +99,8 @@

 (def OutcomeInfo
   "Generic map of outcome & message for API consumers"
-  {:outcome (schema/enum :success :not-found :error) :message schema/Str})
+  {:outcome (schema/enum :success :not-found :error)
+   :message schema/Str})

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Definitions


Remove duplication of listing files

Remove duplication of listing files

--- src/silly_image_store/store.clj
+++ src/silly_image_store/store.clj
@@ -9,22 +9,19 @@
   (let [file (apply io/file paths)]
     (if (exists? file) file)))

-
-(defn list-images [& paths]
+(defn- filtered-file-names [filter-fn paths]
   (let [image-directory (apply load-image paths)]
     (if (exists? image-directory)
       (->> image-directory
        .listFiles
-       (filter file?)
+       (filter filter-fn)
        (map filename)))))

+(defn list-images [& paths]
+  (filtered-file-names file? paths))
+
 (defn list-image-dirs [& paths]
-  (let [image-directory (apply load-image paths)]
-    (if (exists? image-directory)
-      (->> image-directory
-       .listFiles
-       (filter (complement file?))
-       (map filename)))))
+  (filtered-file-names (complement file?) paths))

 (defn random-image [basedir]
   (let [random-image-name (rand-nth (list-images basedir))]


Working on 147, bis...

Working on 147, bis...

--- src/project_euler/problem_0147.clj
+++ src/project_euler/problem_0147.clj
@@ -24,3 +24,13 @@

 (defn count-hv-rect [w h]
   (* (count-sub-segments w) (count-sub-segments h)))
+
+(defn count-diag-rect [w h]
+  (let [[w h] (if (< w h) [h w] [w h])
+        h2 (+ h h)]
+    (->> (range 1 h2)
+         (mapcat (fn [h-diag]
+                   (when (> w 1)
+                     (concat
+                      (->> (range 2 (inc (- h2 h-diag)))
+                           (map (fn [w-diag] [[h-diag w-diag] [h-diag w-diag]]))))))))))


`yaml-metadata` should not remove originals, to accomodate `keep-yaml: true`

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -350,7 +350,6 @@
       :passthru-fn content-passthru
       :task-name "yaml-metadata"
       :tracer :io.perun/yaml-metadata
-      :rm-originals true
       :pod pod})))

 (def ^:private ^:deps markdown-deps


request only one day history from mailserver

--- src/status_im/transport/inbox.cljs
+++ src/status_im/transport/inbox.cljs
@@ -28,7 +28,7 @@

 (def one-day (* 24 3600))
 (def seven-days (* 7 one-day))
-(def maximum-number-of-attemps 2)
+(def maximum-number-of-attempts 2)
 (def request-timeout 30)

 (def connection-timeout
@@ -208,7 +208,7 @@
   [now-in-s [topic {:keys [last-request]}]]
   (let [days        (conj
                      (into [] (range (max last-request
-                                          (- now-in-s seven-days))
+                                          (- now-in-s one-day))
                                      now-in-s
                                      one-day))
                      now-in-s)
@@ -372,7 +372,7 @@

 (fx/defn resend-request
   [{:keys [db] :as cofx} {:keys [request-id]}]
-  (if (<= maximum-number-of-attemps
+  (if (<= maximum-number-of-attempts
           (get-in db [:transport.inbox/current-request :attemps]))
     (fx/merge cofx
               {:db (update db :transport.inbox/current-request dissoc :attemps)}


[sum-of-multiples] made function “normal”

Before it was a multi-clause function with a single clause.

--- exercises/sum-of-multiples/src/example.clj
+++ exercises/sum-of-multiples/src/example.clj
@@ -4,7 +4,6 @@
   ([n]   (fn [d] (divides? n d)))
   ([n d] (zero? (rem n d))))

-(defn sum-of-multiples
-  ([multiples n]
-   (reduce (fn [sum x] (cond-> sum (some (divides? x) multiples) (+ x)))
-           0 (range 1 n))))
+(defn sum-of-multiples [multiples n]
+  (reduce (fn [sum x] (cond-> sum (some (divides? x) multiples) (+ x)))
+	  0 (range 1 n)))


CMR-3935: Fixes tests in generate-and-parse

--- umm-spec-lib/src/cmr/umm_spec/test/dif10_expected_conversion.clj
+++ umm-spec-lib/src/cmr/umm_spec/test/dif10_expected_conversion.clj
@@ -260,10 +260,14 @@
   "When converting, the creation date and last revision date will be persisted. Both dates are
   required in DIF10, so use a default date if not present."
   [umm-coll]
-  [(conversion-util/create-date-type
-    (date/with-default-date (date/metadata-create-date umm-coll)) "CREATE")
-   (conversion-util/create-date-type
-    (date/with-default-date (date/metadata-update-date umm-coll)) "UPDATE")])
+  (remove nil? [(conversion-util/create-date-type
+     (date/with-default-date (date/metadata-create-date umm-coll)) "CREATE")
+    (conversion-util/create-date-type
+     (date/with-default-date (date/metadata-update-date umm-coll)) "UPDATE")
+    (when (date/metadata-delete-date umm-coll)
+      (conversion-util/create-date-type (date/metadata-delete-date umm-coll) "DELETE"))
+    (when (date/metadata-review-date umm-coll)
+      (conversion-util/create-date-type (date/metadata-review-date umm-coll) "REVIEW"))]))

 (defn- expected-related-url-get-service
   "Returns related-url with the expected values in GetService"


Add icons toolbox.

Add icons toolbox.

--- frontend/uxbox/ui/workspace/toolboxes.cljs
+++ frontend/uxbox/ui/workspace/toolboxes.cljs
@@ -102,3 +102,45 @@
     :name "layers"
     :mixins [rum/reactive]}))

+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Icons
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn icons-render
+  [own]
+  (let [local (:rum/local own)
+        collid (:collid @local)
+        icons (get-in library/+icon-collections-by-id+ [collid :icons])
+        on-close #(rs/emit! (dw/toggle-toolbox :icons))
+        on-change (fn [e]
+                    (let [value (dom/event->value e)
+                          value (read-string value)]
+                      (swap! local assoc :collid value)))]
+    (html
+     [:div#form-figures.tool-window
+      [:div.tool-window-bar
+       [:div.tool-window-icon i/window]
+       [:span "Icons"]
+       [:div.tool-window-close
+        {:on-click on-close} i/close]]
+      [:div.tool-window-content
+       [:div.figures-catalog
+        ;; extract component: set selector
+        [:select.input-select.small
+         {:on-change on-change :value collid} ; TODO: maybe missing pr-str
+         (for [icon-coll library/+icon-collections+]
+           [:option {:key (str "icon-coll" (:id icon-coll))
+                     :value (pr-str (:id icon-coll))}
+            (:name icon-coll)])]]
+       (for [icon icons]
+         [:div.figure-btn {:key (str "icon" (:id icon))
+                           :class nil #_"selected"
+                           :on-click (constantly nil)}
+          (shapes/render icon)])]])))
+
+(def ^:static icons
+  (util/component
+   {:render icons-render
+    :name "icons-toolbox"
+    :mixins [rum/reactive
+             (mx/local {:collid 1 :builtin true})]}))


update interface w rabble

update interface w rabble

--- server/src/gratefulplace/app.clj
+++ server/src/gratefulplace/app.clj
@@ -1,14 +1,18 @@
 (ns gratefulplace.app
   (:gen-class)
   (:require [gratefulplace.server :as server]
-            [gratefulplace.db.manage :as db]
+            [rabble.db.tasks :as db-tasks]
             [gratefulplace.config :as config]))
+
+(defmacro final
+  [& body]
+  `(do ~@body (System/exit 0)))

 (defn -main
   [cmd]
   (cond
    (= cmd "server") (server/-main)
-   (= cmd "db/reload") (do (println (db/reload)) (System/exit 0))
-   (= cmd "db/seed") (do (println (db/seed)) (System/exit 0))
-   (= cmd "db/migrate") (do (println (db/migrate)) (System/exit 0))
-   (= cmd "config/print-config") (do (config/print-config) (System/exit 0))))+   (= cmd "db/reload") (final (println (db-tasks/reload)))
+   (= cmd "db/seed") (final (println (db-tasks/seed)))
+   (= cmd "db/install-schemas") (final (println (db-tasks/install-schemas)))
+   (= cmd "config/print-config") (final (config/print-config))))


play premove then unset it

play premove then unset it

--- src/chessground/data.cljs
+++ src/chessground/data.cljs
@@ -126,10 +126,12 @@
     state))

 (defn play-premove [state]
-  (or (when-let [[orig dest] (-> state :premovable :current)]
-        (when (can-move? state orig dest)
-          (move-piece state orig dest)))
-      state))
+  (set-premovable-current
+    (or (when-let [[orig dest] (-> state :premovable :current)]
+          (when (can-move? state orig dest)
+            (move-piece state orig dest)))
+        state)
+    nil))

 (defn set-config [state raw-config]
   (let [config (update-in raw-config [:movable :dests] common/stringify-keys)]


Replace vars with atoms for tracking status

--- src/chicken_coop/core.clj
+++ src/chicken_coop/core.clj
@@ -59,18 +59,19 @@
       (Thread/sleep t))))

-(def ^:dynamic status :running)
+(defonce status (atom :running))
+
 (defn update-status!
   [new-status]
   (cond
-    (and (= status :warnings) (= new-status :running))
+    (and (= @status :warnings) (= new-status :running))
       (log "WARNING: won't reduce status to :running from warning")
-    (= status :errors)
+    (= @status :errors)
       (log "WARNING: can't change status once :errors")
     :else
       (do
         (log "Changing status to" new-status)
-        (def status new-status))))
+        (reset! status new-status))))

 (defn max-time-up [max-time start-time]
@@ -224,7 +225,7 @@
                              :errors   [100 50 100 750]}
             status-led (gpio :P8 14 :out)]
         (loop []
-          (blink-led status-led (status-patterns status))
+          (blink-led status-led (status-patterns @status))
           (recur))))

     (loop [timer timer]


Not just parsing profiles.

Not just parsing profiles.

--- src/kixi/hecuba/data.clj
+++ src/kixi/hecuba/data.clj
@@ -3,14 +3,14 @@

 ;; Some utility funcitons

-(defn parse-list [profile key]
-  (if-let [items (get profile key)]
-    (assoc profile key (mapv #(json/parse-string % keyword) items))
-    profile))
+(defn parse-list [m key]
+  (if-let [items (get m key)]
+    (assoc m key (mapv #(json/parse-string % keyword) items))
+    m))

-(defn parse-item [profile key]
-  (if-let [item (get profile key)]
-    (assoc profile key (json/parse-string item keyword))
-    profile))
+(defn parse-item [m key]
+  (if-let [item (get m key)]
+    (assoc m key (json/parse-string item keyword))
+    m))


direct IFn invoke for keywords

direct IFn invoke for keywords

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -706,7 +706,7 @@
          (emits (first args) "." pimpl "(" (comma-sep (cons "null" (rest args))) ")"))

        keyword?
-       (emits f ".call(" (comma-sep (cons "null" args)) ")")
+       (emits f ".cljs$core$IFn$_invoke$arity$" (count args) "(" (comma-sep args) ")")

        variadic-invoke
        (let [mfa (:max-fixed-arity variadic-invoke)]


Updated SSLGenericSocketFactory to accept an empty context

--- src/clj_http/conn_mgr.clj
+++ src/clj_http/conn_mgr.clj
@@ -56,13 +56,14 @@
   "Given a function that returns a new socket, create an
   SSLConnectionSocketFactory that will use that socket."
   ([socket-factory]
-   (SSLGenericSocketFactory socket-factory (SSLContexts/createDefault)))
+   (SSLGenericSocketFactory socket-factory nil))
   ([socket-factory ^SSLContext ssl-context]
-   (proxy [SSLConnectionSocketFactory] [ssl-context]
-     (connectSocket [timeout socket host remoteAddress localAddress context]
-       (let [^SSLConnectionSocketFactory this this] ;; avoid reflection
-         (proxy-super connectSocket timeout (socket-factory) host remoteAddress
-                      localAddress context))))))
+   (let [^SSLContext ssl-context' (or ssl-context (SSLContexts/createDefault))]
+     (proxy [SSLConnectionSocketFactory] [ssl-context']
+       (connectSocket [timeout socket host remoteAddress localAddress context]
+         (let [^SSLConnectionSocketFactory this this] ;; avoid reflection
+           (proxy-super connectSocket timeout (socket-factory) host remoteAddress
+                        localAddress context)))))))

 (defn ^PlainConnectionSocketFactory PlainGenericSocketFactory
   "Given a Function that returns a new socket, create a


simply structure

simply structure

--- src/clj_money/reports.clj
+++ src/clj_money/reports.clj
@@ -414,9 +414,8 @@

 (defn- transform-lot-transactions
   [trans]
-  (->> (:lot-items trans)
-       (map (fn [item]
-              (merge item (select-keys trans [:id :transaction-date]))))))
+  (map #(merge % (select-keys trans [:id :transaction-date]))
+       (:lot-items trans)))

 (defn- append-lot-transactions
   [storage-spec lot]


Specify a radix of 10 to js/parseInt so that it can parse 08 and 09 in date literals

--- src/cljs/cljs/reader.cljs
+++ src/cljs/cljs/reader.cljs
@@ -483,7 +483,7 @@
               (->> V
                    (map #(update-in %2 [0] %)
                         [(constantly nil) #(if (= % "-") "-1" "1")])
-                   (map (fn [v] (map #(js/parseInt %) v))))
+                   (map (fn [v] (map #(js/parseInt % 10) v))))
               offset (* offset-sign (+ (* offset-hours 60) offset-minutes))]
           [(if-not years 1970 y)
            (if-not months 1        (check 1 mo 12 "timestamp month field must be in range 1..12"))


Order subscriptions properly.

Order subscriptions properly.

--- src/cljs/medusa/core.cljs
+++ src/cljs/medusa/core.cljs
@@ -341,15 +341,20 @@
                              (routing/goto :detector-id detector_id
                                            :metric-id metric_id
                                            :from from
-                                           :to to)))]
+                                           :to to)))
+            format (fn [e]
+                     (if (:metric_name e)
+                       [:a.list-group-item {:on-click (partial metric-click e)} (format-metric e)]
+                       [:a.list-group-item {:on-click (partial detector-click e)} (format-detector e)]))]
         (when (seq subscriptions)
-          (html [:div
+          (let [sorted-entries (sort-by (fn [{:keys [detector_name metric_name metrics_filter]}]
+                                          (str detector_name metrics_filter metric_name))
+                                        (concat detector metric))]
+           (html [:div
                  [:label "Your Subscriptions:"]
                  [:div.list-group
-                  (for [d detector]
-                    [:a.list-group-item {:on-click (partial detector-click d)} (format-detector d)])
-                  (for [m metric]
-                    [:a.list-group-item {:on-click (partial metric-click m)} (format-metric m)])]]))))))
+                  (for [e sorted-entries]
+                    (format e))]])))))))

 (defn layout [state owner]
   (reify


new thread management delegated to the main loop (no need to create a thread on the clojure side)

--- src/clojure/yaw/world.clj
+++ src/clojure/yaw/world.clj
@@ -24,10 +24,9 @@
              width  800
              height 600
              vsync true}}]
-  (let [world (World. x y width height vsync)
-        thread (future world)]
-    (.start (Thread. world))
-    (atom {:world world :thread thread
+  (let [world (World. x y width height vsync)]
+    (.launch world)
+    (atom {:world world
            :meshes {:mesh/box (yaw.mesh/box-geometry)
                     :mesh/cone (yaw.mesh/cone-geometry)
                     :mesh/pyramid (yaw.mesh/pyramid-geometry)}


Just print the exception when we can't delete a file

--- boot/pod/src/boot/file.clj
+++ boot/pod/src/boot/file.clj
@@ -29,17 +29,15 @@
 (defmacro guard [& exprs]
   `(try (do ~@exprs) (catch Throwable _#)))

-(def fail
+(def print-ex
   (delay
     (require 'boot.util)
-    (var-get (resolve 'boot.util/fail))))
+    (var-get (resolve 'boot.util/print-ex))))

 (defn delete-file
   [f]
-  (try
-    (io/delete-file f)
-    (catch Exception err
-      (@fail "ERROR deleting '%s': %s" f err))))
+  (try (io/delete-file f)
+       (catch Exception err (@print-ex err))))

 (defn clean! [& files]
   (doseq [f files]


Wait for terminating newline in string-latch tests.

--- test/cli4clj/test/cli_tests.clj
+++ test/cli4clj/test/cli_tests.clj
@@ -96,10 +96,12 @@
         out-string (cli-tests/test-cli-stdout #(cli/start-cli cli-opts) test-cmd-input)]
     (test/is (= (cli-tests/expected-string ["Starting..." "Started." "Finished."]) out-string))))

+
+
 (test/deftest async-cmd-string-latch-stdout-test
   (let [cli-opts {:cmds {:async-foo {:fn async-test-fn}}}
         test-cmd-input ["async-foo"]
-        sl (cli-tests/string-latch ["Finished."])
+        sl (cli-tests/string-latch ["Finished." "\n"])
         out-string (cli-tests/test-cli-stdout #(cli/start-cli cli-opts) test-cmd-input sl)]
     (test/is (= ["Starting..." "\n" "Started." "\n" "Finished." "\n"] (sl)))
     (test/is (= (cli-tests/expected-string ["Starting..." "Started." "Finished."]) out-string))))
@@ -120,7 +122,7 @@
 (test/deftest async-cmd-string-latch-stderr-test
   (let [cli-opts {:cmds {:async-foo {:fn async-test-stderr-fn}}}
         test-cmd-input ["async-foo"]
-        sl (cli-tests/string-latch ["Finished."])
+        sl (cli-tests/string-latch ["Finished." "\n"])
         out-string (cli-tests/test-cli-stderr #(cli/start-cli cli-opts) test-cmd-input sl)]
     (test/is (= ["Starting..." "\n" "Started." "\n" "Finished." "\n"] (sl)))
     (test/is (= (cli-tests/expected-string ["Starting..." "Started." "Finished."]) out-string))))
@@ -133,7 +135,8 @@
         val-2 (atom nil)
         sl (cli-tests/string-latch [["Starting..." #(reset! val-0 %)]
                                     ["Started." (fn [v] (reset! val-1 v))]
-                                    ["Finished." #(reset! val-2 %)]])
+                                    ["Finished." #(reset! val-2 %)]
+                                    "\n"])
         out-string (cli-tests/test-cli-stdout #(cli/start-cli cli-opts) test-cmd-input sl)]
     (test/is (= ["Starting..."] @val-0))
     (test/is (= ["Starting..." "\n" "Started."] @val-1))
@@ -148,7 +151,8 @@
         val-2 (atom nil)
         sl (cli-tests/string-latch ["Starting..."
                                     ["Started."]
-                                    ["Finished." #(reset! val-2 %)]])
+                                    ["Finished." #(reset! val-2 %)]
+                                    "\n"])
         out-string (cli-tests/test-cli-stdout #(cli/start-cli cli-opts) test-cmd-input sl)]
     (test/is (= nil @val-0))
     (test/is (= nil @val-1))


cosmetics

cosmetics

--- src/nml/core.clj
+++ src/nml/core.clj
@@ -10,9 +10,9 @@
 (def parse (insta/parser (clojure.java.io/resource "grammar")))

 (defn nmlget [tree nml key]
-  (let [stmt      (last (filter #(= (nmlname %) nml) (rest tree)))
-        nvsubseq  (last (filter #(= (nmlname %) key) (rest (last stmt))))
-        values    (last nvsubseq)]
+  (let [stmt     (last (filter #(= (nmlname %) nml) (rest tree)))
+        nvsubseq (last (filter #(= (nmlname %) key) (rest (last stmt))))
+        values   (last nvsubseq)]
     (if (nil? values) "" (nmlstr values))))

 (defn nmlname [x]


Add bin-codec tests.

Add bin-codec tests.

--- test/multicodec/codecs_test.clj
+++ test/multicodec/codecs_test.clj
@@ -27,26 +27,25 @@

 (deftest header-codec
-  (let [foo (mock-codec :foo "/foo")]
+  (let [foo (mock-codec :foo "/foo")
+        wrapped (codecs/wrap-headers foo)]
     (testing "codec construction"
-      (let [codec (codecs/wrap-headers foo)]
-        (is (= "/foo" (:header codec))
-            "header should inherit wrapped codec by default"))
-      (let [codec (codecs/wrap-headers foo "/bar")]
-        (is (= "/bar" (:header codec))
+      (is (= "/foo" (:header wrapped))
+          "header should inherit wrapped codec by default")
+      (let [wrapped (codecs/wrap-headers foo "/bar")]
+        (is (= "/bar" (:header wrapped))
             "header should be settable with second arg")))
-    (let [codec (codecs/wrap-headers foo)]
-      (testing "encoding roundtrip"
-        (let [encoded (mc/encode codec 1234)]
-          (is (= "/foo" (mh/read-header! (ByteArrayInputStream. encoded)))
-              "should write codec header to content")
-          (is (= [:foo "1234"] (mc/decode codec encoded))
-              "should read header and delegate to codec")))
-      (testing "bad header"
-        (let [baos (ByteArrayOutputStream.)]
-          (codecs/write-header-encoded! "/bar" foo baos :abc)
-          (is (thrown? RuntimeException
-                       (mc/decode codec (.toByteArray baos)))))))))
+    (testing "encoding roundtrip"
+      (let [encoded (mc/encode wrapped 1234)]
+        (is (= "/foo" (mh/read-header! (ByteArrayInputStream. encoded)))
+            "should write codec header to content")
+        (is (= [:foo "1234"] (mc/decode wrapped encoded))
+            "should read header and delegate to codec")))
+    (testing "bad header"
+      (let [baos (ByteArrayOutputStream.)]
+        (codecs/write-header-encoded! "/bar" foo baos :abc)
+        (is (thrown? RuntimeException
+                     (mc/decode wrapped (.toByteArray baos))))))))

 (deftest multiplex-codec
@@ -73,3 +72,21 @@
         (.write baos (.getBytes "abcd"))
         (is (thrown? RuntimeException
                      (mc/decode mux (.toByteArray baos))))))))
+
+
+(deftest bin-codec
+  (let [bin (codecs/bin-codec)
+        content (byte-array 10)]
+    (.nextBytes (java.security.SecureRandom.) content)
+    (let [encoded (mc/encode bin content)]
+      (testing "encoding"
+        (is (= (count encoded) (count content))
+            "should encode bytes one-to-one")
+        (is (every? true? (map = content encoded))
+            "should return same bytes as encoded"))
+      (testing "decoding"
+        (let [decoded (mc/decode bin encoded)]
+          (is (= (count decoded) (count content))
+              "should decode bytes one-to-one")
+          (is (every? true? (map = content decoded))
+              "should decode same bytes as content"))))))


renaming test

renaming test

--- test/cljs/ohds/component-test.cljs
+++ test/cljs/ohds/component-test.cljs
@@ -4,7 +4,7 @@
             [reagent.core :as reagent :refer [atom]]
             [ohds.components :as c]))

-(deftest example-passing-test
+(deftest hamburger-menu-test
   (let [h (c/hamburger)]
     (is (= (get h 0) :button))
     (is (= (first (get h 2)) :span))


clean up notices a bit

clean up notices a bit

--- frontend/components/build.cljs
+++ frontend/components/build.cljs
@@ -91,20 +91,24 @@
       (html
        (let [build-data (:build-data data)
              project-data (:project-data data)
+             plan (:plan project-data)
+             project (:project project-data)
              build (:build build-data)
              controls-ch (get-in opts [:comms :controls])]
          [:div.row-fluid
           [:div.offset1.span10
            [:div (common/messages (:messages build))]
            [:div (report-error build controls-ch)]
-           (when (and (:plan project-data) (show-trial-notice? (:plan project-data)))
-             (om/build project-common/trial-notice (:plan project-data) {:opts opts}))
-           (when (and (:project project-data)
-                      (project-common/show-enable-notice (:project project-data)))
-             (om/build project-common/enable-notice (:project project-data) {:opts opts}))
-           (when (and (:project project-data)
-                      (project-common/show-follow-notice (:project project-data)))
-             (om/build project-common/follow-notice (:project project-data) {:opts opts}))
+
+           (when (and plan (show-trial-notice? plan))
+             (om/build project-common/trial-notice plan {:opts opts}))
+
+           (when (and project (project-common/show-enable-notice project))
+             (om/build project-common/enable-notice project {:opts opts}))
+
+           (when (and project (project-common/show-follow-notice project))
+             (om/build project-common/follow-notice project {:opts opts}))
+
            (when (build-model/display-build-invite build)
              (om/build build-invites/build-invites
                        (:invite-data build-data)


changing site title

changing site title

--- src/pc/views/content.clj
+++ src/pc/views/content.clj
@@ -25,7 +25,7 @@
 (defn layout [view-data & content]
   [:html
    [:head
-    [:title "Precursor - Mockups from the future"]
+    [:title "Precursor - Simple collaborative prototyping"]
     [:meta {:name "viewport" :content "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"}]
     [:link.css-styles {:rel "stylesheet", :href (str "/css/app.css?rand=" (Math/random))}]
     [:link {:rel "stylesheet" :href "https://fonts.googleapis.com/css?family=Roboto:500,900,100,300,700,400" :type "text/css"}]


Add wort.core as library to handler

Add wort.core as library to handler

--- functions/src/wort/handler.clj
+++ functions/src/wort/handler.clj
@@ -2,6 +2,7 @@
   (:require [compojure.core :refer :all]
             [compojure.route :as route]
             [ring.util.response :as resp]
+            [wort.core :as core]
             [ring.middleware.defaults :refer [wrap-defaults site-defaults]]))

 (defroutes app-routes


Minor adjustments

Minor adjustments

--- src/re_com/dropdown.cljs
+++ src/re_com/dropdown.cljs
@@ -254,7 +254,7 @@
       {:id \"US\" :label \"United States\"  :group \"Group 1\"}
       {:id \"GB\" :label \"United Kingdom\" :group \"Group 1\"}
       {:id \"AF\" :label \"Afghanistan\"    :group \"Group 2\"}]"
-  [& {:keys [model choices regex-filter? debounce-delay]
+  [& {:keys [choices model regex-filter? debounce-delay]
       :or {debounce-delay 250}
       :as args}]
   {:pre [(validate-args-macro single-dropdown-args-desc args "single-dropdown")]}
@@ -276,7 +276,7 @@
                           (load-choices text regex-filter? debounce?)
                           (reset! filter-text text))]
     (load-choices "" regex-filter? false)
-    (fn [& {:keys [choices model on-change id-fn label-fn group-fn render-fn disabled? filter-box? regex-filter? placeholder title? width max-height tab-index class style attr]
+    (fn [& {:keys [choices model on-change id-fn label-fn group-fn render-fn disabled? filter-box? regex-filter? placeholder title? width max-height tab-index debounce-delay class style attr]
             :or {id-fn :id label-fn :label group-fn :group render-fn label-fn}
             :as args}]
       {:pre [(validate-args-macro single-dropdown-args-desc args "single-dropdown")]}


Changed arg order of dropdown

Changed arg order of dropdown

--- src/re_com/dropdown.cljs
+++ src/re_com/dropdown.cljs
@@ -191,11 +191,11 @@

 (def single-dropdown-args-desc
   [{:name :choices       :required true                   :type "vector of choices | atom"      :validate-fn vector-of-maps?   :description [:span "Each is expected to have an id, label and, optionally, a group, provided by " [:code ":id-fn"] ", " [:code ":label-fn"] " & " [:code ":group-fn"]]}
+   {:name :model         :required true                   :type "the id of a choice | atom"                                    :description [:span "the id of the selected choice. If nil, " [:code ":placeholder"] " text is shown"]}
+   {:name :on-change     :required true                   :type "id -> nil"                     :validate-fn fn?               :description [:span "called when a new choice is selected. Passed the id of new choice"] }
    {:name :id-fn         :required false :default :id     :type "choice -> anything"            :validate-fn ifn?              :description [:span "given an element of " [:code ":choices"] ", returns its unique identifier (aka id)"]}
    {:name :label-fn      :required false :default :label  :type "choice -> string | hiccup"     :validate-fn ifn?              :description [:span "given an element of " [:code ":choices"] ", returns its displayable label"]}
    {:name :group-fn      :required false :default :group  :type "choice -> anything"            :validate-fn ifn?              :description [:span "given an element of " [:code ":choices"] ", returns its group identifier"]}
-   {:name :model         :required true                   :type "the id of a choice | atom"                                    :description [:span "the id of the selected choice. If nil, " [:code ":placeholder"] " text is shown"]}
-   {:name :on-change     :required true                   :type "id -> nil"                     :validate-fn fn?               :description [:span "called when a new choice is selected. Passed the id of new choice"] }
    {:name :disabled?     :required false :default false   :type "boolean | atom"                                               :description "if true, no user selection is allowed"}
    {:name :filter-box?   :required false :default false   :type "boolean"                                                      :description "if true, a filter text field is placed at the top of the dropdown"}
    {:name :regex-filter? :required false :default false   :type "boolean | atom"                                               :description "if true, the filter text field will support JavaScript regular expressions. If false, just plain text"}