Get rid of IgnoreError annotation

Get rid of IgnoreError annotation

--- src/caesium/binding.clj
+++ src/caesium/binding.clj
@@ -9,7 +9,7 @@
             [medley.core :as m]
             [clojure.string :as str])
   (:import [jnr.ffi LibraryLoader]
-           [jnr.ffi.annotations In Out Pinned LongLong IgnoreError]
+           [jnr.ffi.annotations In Out Pinned LongLong]
            [jnr.ffi.types size_t]))

 (def ^:private bound-byte-type-syms
@@ -227,9 +227,7 @@
   This has to be a seq and not a map, because the same key (symbol,
   method name) might occur with multiple values (e.g. when binding the
   same char* fn with different JVM byte types)."
-  (->> raw-bound-fns
-       (mapcat permuted-byte-types)
-       (map (fn [[s args]] [(vary-meta s #(assoc % `IgnoreError {})) args]))))
+  (mapcat permuted-byte-types raw-bound-fns))

 (defmacro ^:private defsodium
   []


Use font awesome icons for now; user material design icons in future

--- src-cljs/frontend/components/aside.cljs
+++ src-cljs/frontend/components/aside.cljs
@@ -468,7 +468,7 @@
 (defn nav-icon
   [v1 v2]
   (if (feature/enabled? :ui-v2)
-    [:img.aside-icon {:src (utils/cdn-path (str "/img/inner/icons/Aside-" v2 ".svg"))}]
+    #_[:img.aside-icon {:src (utils/cdn-path (str "/img/inner/icons/Aside-" v2 ".svg"))}]
     [:i.fa {:class v1}]))

 (defn aside-nav [app owner]


light workflows nav when on a workflows related route

--- src-cljs/frontend/components/aside.cljs
+++ src-cljs/frontend/components/aside.cljs
@@ -410,6 +410,12 @@

 (def light-builds? #{:dashboard :build})

+(def light-workflows? #{:route/project-workflows
+                        :route/project-branch-workflows
+                        :route/org-workflows
+                        :route/run})
+
+
 (defn aside-nav-original [{:keys [user current-route owner]}]
   "Original side-nav, preserved for most users as the top-bar-ui-v-1
    is implemented. Case-by-case feature flags too cumbersome as routes change"
@@ -432,8 +438,8 @@
       [:i.material-icons "storage"]
       [:div.nav-label "Builds"]]

-     (when (ld/feature-on? "workflows-poc")
-       [:a.aside-item {:class (when (= :v1-workflow current-route) "current")
+     (when (feature/enabled? :workflows-poc)
+       [:a.aside-item {:class (when (light-workflows? current-route) "current")
                        :data-placement "right"
                        :data-trigger "hover"
                        :title "Workflows"
@@ -553,8 +559,9 @@
       [:i.material-icons "storage"]
       [:div.nav-label "Builds"]]

-     (when (ld/feature-on? "workflows-poc")
-       [:a.aside-item {:class (when (= :v1-workflow current-route) "current")
+     (when (feature/enabled? "workflows-poc")
+       [:a.aside-item {:class (when (light-workflows? current-route)
+                                "current")
                        :data-placement "right"
                        :data-trigger "hover"
                        :title "Workflows"


improve copy on early access page

improve copy on early access page

--- src-cljs/frontend/components/outer.cljs
+++ src-cljs/frontend/components/outer.cljs
@@ -83,8 +83,8 @@
              "We're excited to show you our team features."]
             [:p.early-access-copy
              "To activate your early access, please "
-             (when-not (utils/logged-in? owner) "sign in and ")
-             "let us know about the following info.
+             (when-not (utils/logged-in? owner) "sign in first and")
+             " fill out the following information.
               We'll send you an email confirmation once your account has been granted full access."]
             (when-not (utils/logged-in? owner)
               [:div.calls-to-action
@@ -109,8 +109,8 @@
              company-name]
             [:div.adaptive-placeholder {:tab-index "3"
                                         :ref "employee-count"
-                                        :data-before "How many employees are there?"
-                                        :data-after "Employee Count"
+                                        :data-before "How many teammates do you have?"
+                                        :data-after "Team Size"
                                         :content-editable true
                                         :on-input #(let [value (goog.dom/getRawTextContent (.-target %))
                                                          stripped-value (gstring/stripNewlines value)]


Add missing writer arg for encode-stream passthrough to encode-stream*

--- src/cheshire/custom.clj
+++ src/cheshire/custom.clj
@@ -71,7 +71,7 @@
      (try
        (core/encode-stream obj w (merge opt-map {:ex core-failure}))
        (catch JsonGenerationException _
-         (encode-stream* obj opt-map)))))
+         (encode-stream* obj w opt-map)))))

 (defn encode-smile*
   ([obj]


CLJS-594: declare divide to avoid confusion

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -1412,6 +1412,8 @@
   ([x] x)
   ([x y] (cljs.core/* x y))
   ([x y & more] (reduce * (cljs.core/* x y) more)))
+
+(declare divide)

 (defn /
   "If no denominators are supplied, returns 1/numerator,


Minor coverage fix (hopefully)

Minor coverage fix (hopefully)

--- src/desdemona/lifecycles/logging.clj
+++ src/desdemona/lifecycles/logging.clj
@@ -20,6 +20,6 @@
 (defn add-logging
   "Adds logging output to a task's output-batch."
   [job task]
-  (if-let [entry (first (filter #(= (:onyx/name %) task) (:catalog job)))]
+  (when (seq (filter #(= (:onyx/name %) task) (:catalog job)))
     (update job :lifecycles conj {:lifecycle/task task
                                   :lifecycle/calls ::log-calls})))


optimize PersistentArrayMap IEQuiv implementation

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -5117,7 +5117,22 @@
   (-empty [coll] (-with-meta (.-EMPTY PersistentArrayMap) meta))

   IEquiv
-  (-equiv [coll other] (equiv-map coll other))
+  (-equiv [coll other]
+    (if (implements? IMap other)
+      (let [alen (alength arr)
+            ^not-native other other]
+        (if (== cnt (-count other))
+          (loop [i 0]
+            (if (< i alen)
+              (let [v (-lookup other (aget arr i) lookup-sentinel)]
+                (if-not (identical? v lookup-sentinel)
+                  (if (= (aget arr (inc i)) v)
+                    (recur (+ i 2))
+                    false)
+                  false))
+              true))
+          false))
+      (equiv-map coll other)))

   IHash
   (-hash [coll] (caching-hash coll hash-unordered-coll __hash))


Clean up some whitespace.

Clean up some whitespace.

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -119,8 +119,6 @@

 (defprotocol IPrintable
   (-pr-seq [o opts]))
-
-

 ;;;;;;;;;;;;;;;;;;; fundamentals ;;;;;;;;;;;;;;;
 (defn identical? [x y]
@@ -1433,8 +1431,6 @@
     (flatten1 (map f coll)))
   ([f coll & colls]
     (flatten1 (apply map f coll colls))))
-
-

 (defn filter
   "Returns a lazy sequence of the items in coll for which


now also works in chrome

now also works in chrome

--- src/cljs/moon/core.cljs
+++ src/cljs/moon/core.cljs
@@ -178,7 +178,7 @@
     (aset (aget total "style") "display" "none")
     (aset (aget workout "style") "display" "block")
     (set-html! (by-id "total-header") "Remaining")
-    (.scroll js/window 0)))
+    (.scroll js/window 0 0)))

 (defn start-workout []
   (show-workout)


Add close function to clojure.

Add close function to clojure.

--- src/clojure/nanomsg.clj
+++ src/clojure/nanomsg.clj
@@ -55,6 +55,11 @@
   [^Socket sock & {:keys [blocking] :or {blocking true}}]
   (.recvBytes sock blocking))

+(defn close
+  "Close socket."
+  [^Socket sock]
+  (.close sock))
+
 (defn- resolve-symbols
   []
   (into {} (for [[k v] (Constants/getSymbols)]


Return the given date at midnight

Return the given date at midnight

--- src/karmanaut/utils.clj
+++ src/karmanaut/utils.clj
@@ -17,10 +17,12 @@
 (defn utcnow []
   (Date.))

-(defn utcnow-midnight []
+(defn midnight [dt]
+  "Returns the given datetime at midnight"
   (let [tz (TimeZone/getTimeZone "UTC")
         c (GregorianCalendar. tz)]
     (doto c
+      (.setTime dt)
       (.set Calendar/HOUR_OF_DAY 0)
       (.set Calendar/MINUTE 0)
       (.set Calendar/SECOND 0)


Fix reflection warning

Fix reflection warning

--- src/containium/modules.clj
+++ src/containium/modules.clj
@@ -268,7 +268,7 @@
   ([command manager name channel]
      (action command manager name channel nil))
   ([command manager name channel args]
-     (locking (.intern name)
+     (locking (.intern ^String name)
        (let [agent (get @(:agents manager) name)
              status (when agent (:status @agent))]
          (cond (and (= command :activate) (or (nil? agent)


Removes automated call to init when token is requested.

--- src/loudmoauth/core.clj
+++ src/loudmoauth/core.clj
@@ -190,5 +190,4 @@
 (defn oauth-token
   "Retreive oauth token for use in authentication call"
   []
-  (when-not (:access_token @app-state) (init))
   (:access_token @app-state))


more funcs

more funcs

--- src/lights/my_show.clj
+++ src/lights/my_show.clj
@@ -190,23 +190,33 @@
 ; Reset dimmers to full brightness
 (show/add-effect! :dimmers (global-dimmer-effect 255))

+; 2DO rewrite to connect multiple devices
 (defn bind-midi
   "Bind MIDI devices"
-  []
-  (show/add-midi-control-to-var-mapping
-    "Traktor Kontrol Z1 Input" 0 4 :knob-1 :max 360)
-
-  (show/add-midi-control-to-var-mapping
-    "midi-net" 0 0 :audio-drums :max 30)
-
-  (show/add-midi-control-to-var-mapping
-    "midi-net" 0 2 :audio-bass :max 30)
-
-  (show/add-midi-control-to-var-mapping
-    "midi-net" 0 3 :audio-percussion :min 10 :max 30)
-
-  (show/add-midi-control-to-var-mapping
-    "midi-net" 0 5 :audio-solo :max 30)
+  [interface]
+
+  (if (= interface "z1")
+    (show/add-midi-control-to-var-mapping
+      "Traktor Kontrol Z1 Input" 0 4 :knob-1 :max 360)
+  )
+
+  (if (= interface "uno")
+    (do
+      (show/add-midi-control-to-var-mapping
+        "USB Uno MIDI Interface" 9 0 :audio-drums :max 50)
+
+      (show/add-midi-control-to-var-mapping
+        "USB Uno MIDI Interface" 9 1 :audio-bass :max 50)
+
+      (show/add-midi-control-to-var-mapping
+        "USB Uno MIDI Interface" 9 2 :audio-solo :max 50)
+    )
+  )
+
+  (if (= interface "uno-clock")
+    (show/sync-to-external-clock
+      (afterglow.midi/sync-to-midi-clock "USB Uno MIDI Interface"))
+    )
 )

 ; Main hue, which is used in the show
@@ -259,19 +269,12 @@
   (let [light-param (params/build-oscillated-param
     (oscillators/sawtooth-beat :beat-ratio beat-ratio :down? true) :max :max-lightness)
         hue-param (params/build-oscillated-param
-    (oscillators/square-beat :beat-ratio (* beat-ratio 4) :down? true) :max 60)
+    (oscillators/square-beat :beat-ratio (* beat-ratio 2) :down? true) :max 90)
   ]
     (show/add-effect! :color (global-color-effect
       (params/build-color-param :h :main-hue :s 100 :l light-param :adjust-hue hue-param)))
   )
 )
-
-(defn sync-midi-clock
-  "Sync MIDI clock to Ableton live session over USB Uno"
-  []
-  (show/sync-to-external-clock
-    (afterglow.midi/sync-to-midi-clock "USB Uno MIDI Interface"))
-  )

 (defn reset-beat
   "Reset beat of the show"


indentation

indentation

--- src/lights/my_show.clj
+++ src/lights/my_show.clj
@@ -160,11 +160,11 @@
 (defn light-sawtooth
   "Change light according to sawtooth osc"
   ([beat-ratio]
-      (def light-param (params/build-oscillated-param
-                     (oscillators/sawtooth-beat :beat-ratio beat-ratio :down? true) :max 20))
-      (show/add-effect! :color (global-color-effect
-        (params/build-color-param :h main-hue :s 100 :l light-param)))
-      )
+    (def light-param (params/build-oscillated-param
+      (oscillators/sawtooth-beat :beat-ratio beat-ratio :down? true) :max 20))
+    (show/add-effect! :color (global-color-effect
+      (params/build-color-param :h main-hue :s 100 :l light-param)))
+    )
   ([]
     (light-sawtooth 2))
 )


Removes old commented code

Removes old commented code

--- src/lt/objs/style.cljs
+++ src/lt/objs/style.cljs
@@ -33,8 +33,6 @@
 (object/object* ::styles
                 :init (fn [this]
                         [:div
-                         ;(bound (subatom this :skin)
-                         ;       load-skin)
                          [:style {:type "text/css"}
                           (bound this ->css)
                           ]]))


Increase allowed description length to 512 chars

--- src/kixi/datastore/metadatastore.clj
+++ src/kixi/datastore/metadatastore.clj
@@ -11,7 +11,7 @@
 (s/def ::parent-id ::id)
 (s/def ::pieces-count int?)
 (s/def ::name (s/and string?
-                     #(re-matches #"^[\p{Digit}\p{IsAlphabetic}].{1,30}[\p{Digit}\p{IsAlphabetic}]$" %)))
+                     #(re-matches #"^[\p{Digit}\p{IsAlphabetic}].{1,512}[\p{Digit}\p{IsAlphabetic}]$" %)))
 (s/def ::description string?)
 (s/def ::size-bytes int?)
 (s/def ::source #{"upload" "segmentation"})


replace sliders #528

replace sliders
#528

--- src/cljs/swarmpit/component/service/form_resources.cljs
+++ src/cljs/swarmpit/component/service/form_resources.cljs
@@ -25,15 +25,16 @@
      [:div.Swarmpit-service-slider-title
       (str "CPU  " "(" (cpu-value value) ")")]
      [:div
-      (comp/rc-slider
+      (comp/slider
         {:key          "cpu-reservation"
          :min          0
          :max          2
          :step         0.10
          :defaultValue 0
+         :marks        true
          :value        value
          :style        {:maxWidth "300px"}
-         :onChange     #(state/update-value [:reservation :cpu] (parse-float %) form-value-cursor)})]]))
+         :onChange     (fn [e v] (state/update-value [:reservation :cpu] (parse-float v) form-value-cursor))})]]))

 (defn- form-memory-reservation [value]
   (comp/text-field
@@ -57,15 +58,16 @@
      [:div.Swarmpit-service-slider-title
       (str "CPU  " "(" (cpu-value value) ")")]
      [:div
-      (comp/rc-slider
+      (comp/slider
         {:key          "cpu-limit"
          :min          0
          :max          2
          :step         0.10
          :defaultValue 0
          :value        value
+         :marks        true
          :style        {:maxWidth "300px"}
-         :onChange     #(state/update-value [:limit :cpu] (parse-float %) form-value-cursor)})]]))
+         :onChange     (fn [e v] (state/update-value [:limit :cpu] (parse-float v) form-value-cursor))})]]))

 (defn- form-memory-limit [value]
   (comp/text-field
@@ -101,4 +103,4 @@
          :sm   6}
         (form/subsection "Limit")
         (form-memory-limit (:memory limit))
-        (form-cpu-limit (:cpu limit))))))
+        (form-cpu-limit (:cpu limit))))))


Fixed bug in pom properties parsing.

Fixed bug in pom properties parsing.

Surprisingly, building a transient {} didn’t work, while an (atom {})
did. Not sure why that is, but it works now.

--- src/descent/pom_parser.clj
+++ src/descent/pom_parser.clj
@@ -92,10 +92,11 @@
   [pom]
   (if (pom-has-properties? pom)
     (let [properties (get-properties-from-pom pom)
-          properties-map (transient {})]
+          properties-map (atom {})]
       (doseq [p properties]
-        (assoc! properties-map (keyword (parse-name (:tag p))) (first (:content p))))
-      (persistent! properties-map))
+        ;(println (parse-name (:tag p)) " -> " (first (:content p)))
+        (swap! properties-map assoc (keyword (parse-name (:tag p))) (first (:content p))))
+      (deref properties-map))
     nil))

@@ -181,6 +182,9 @@
         dep-management (process-dependency-management pom)
         deps (process-dependencies-section pom)
         dependencies (merge dep-management deps)]
-    {:project-name project-name :version version :dependencies dependencies}))
+    {:name project-name :version version :dependencies dependencies}))

-;(def p (process-pom "resources/pom.xml"))
+
+
+
+


Add support for non-flattened groups in report

--- src/main/clojure/lazytest/report.clj
+++ src/main/clojure/lazytest/report.clj
@@ -1,6 +1,6 @@
 (ns lazytest.report
   (:use [lazytest.results
-	 :only (success? container? error? pending?)]
+	 :only (success? container? error? pending? skipped?)]
         [lazytest.color :only (colorize)]
         [clojure.stacktrace :only (print-cause-trace)])
   (:import (java.io File)))
@@ -81,16 +81,25 @@
     (do (newline)
 	(print-details r))))

+(defn flatten-results [results-seq]
+  (mapcat (fn [r] (if (and (container? r)
+			   (not (pending? r))
+			   (not (skipped? r)))
+		    (flatten-results (:children r))
+		    (list r)))
+	  results-seq))
+
 (defn report
   "Simple report of test results.  Prints a dot for each passed
   example; prints details for each failure or pending spec.  Uses ANSI
   color if lazytest.color/colorize? is true."
-  [results]
-  (newline)
-  (doseq [r results]
-    (dot-report r))
-  (newline)
-  (print-summary results))
+  [result-groups-seq]
+  (let [results (flatten-results result-groups-seq)]
+    (newline)
+    (doseq [r results]
+      (dot-report r))
+    (newline)
+    (print-summary results)))

 (defn report-and-exit
   "Calls function f (defaults to report) on test result r and


feature(ring-analytics): add data-filtering-middleware-functions support

- Modify request and response data using transients.
- Add 5-arity call to wrap-ring-analytics, to supply filters.

--- systems/ring-analytics/src/containium/systems/ring_analytics.clj
+++ systems/ring-analytics/src/containium/systems/ring_analytics.clj
@@ -22,17 +22,41 @@
 (refer-logging)

+;;; Utils
+
+(defn- dissoc!-body [map _]
+  (dissoc! map :body))
+
+
 ;;; The public system API.

 (defprotocol Analytics
-  (wrap-ring-analytics [this app-name handler]
+  (wrap-ring-analytics
+    [this app-name handler]
+    [this app-name request-filter response-filter handler]
     "Returns a handler that stores the given request, using the given
     app name for the log name. The body is not read by this
-    middleware."))
+    middleware.
+
+    Before storing the request+response, request-filter and response-filter
+    are called with 2 arguments: the corresponding transient map and the
+    opposite (persistent) map, as such:
+    - `(request-filter  (transient request)  response)`
+    - `(response-filter (transient response) request)`
+
+    Both filters functions must return a transient map.
+
+    This allows removal of sensitive or uninteresting data before storing.
+    When no filters are provided, a default filter that removes :body is used."))
+
+
+;;; No-analytics (nil system) implementation

 (extend-type nil
   Analytics
-  (wrap-ring-analytics [this app-name handler] handler))
+  (wrap-ring-analytics
+    ([this app-name handler] handler)
+    ([this app-name request-filter response-filter handler] handler)))

 ;;; ElasticSearch implementation.
@@ -50,26 +74,29 @@

 (defn- wrap-ring-analytics*
-  [{:keys [client logger] :as record} app-name handler]
+  [{:keys [client logger] :as record} app-name request-filter response-filter handler]
   (fn [request]
     (let [started (System/currentTimeMillis)
           response (try (handler request)
                         (catch Throwable t (ex/exit-when-fatal t) t))
           took (- (System/currentTimeMillis) started)
-          processed (-> request
-                        (dissoc :body :async-channel)
-                        (assoc :started (time/format (time/datetime started)
-                                                     :date-hour-minute-second-ms)
-                               :response (if (instance? Throwable response)
-                                           {:message (.getMessage ^Throwable response)
-                                            :stacktrace (with-out-str
-                                                          (print-cause-trace response))
-                                            :class (str (class response))
-                                            :status 500
-                                            :took took}
-                                           (-> response
-                                               (dissoc :body)
-                                               (assoc :took took)))))]
+          processed (-> (transient request)
+                        (request-filter response)
+                        (dissoc! :async-channel)
+                        (assoc! :started (time/format (time/datetime started)
+                                                      :date-hour-minute-second-ms)
+                                :response (if (instance? Throwable response)
+                                            {:message (.getMessage ^Throwable response)
+                                             :stacktrace (with-out-str
+                                                           (print-cause-trace response))
+                                             :class (str (class response))
+                                             :status 500
+                                             :took took}
+                                            (-> (transient response)
+                                                (assoc! :took took)
+                                                (response-filter request)
+                                                (persistent!))))
+                        (persistent!))]
       (try (store-request client app-name processed)
            (catch Throwable t
              (ex/exit-when-fatal t)
@@ -131,7 +158,10 @@
 (defrecord ElasticAnalytics [client logger atat]
   Analytics
   (wrap-ring-analytics [this app-name handler]
-    (wrap-ring-analytics* this app-name handler))
+    (wrap-ring-analytics* this app-name, dissoc!-body   dissoc!-body    handler))
+  (wrap-ring-analytics [this app-name request-filter response-filter handler]
+    (wrap-ring-analytics* this app-name, request-filter response-filter handler))
+
   Stoppable
   (stop [this]
     (info logger "Stopping Analytics based on ElasticSearch.")


`TODO` -> simple comment

`TODO` -> simple comment

--- src/main/om_css/dom.clj
+++ src/main/om_css/dom.clj
@@ -106,7 +106,7 @@
     (str "." (string/replace (munge ns-name) #"\." "_")
       "_" component-name "_" (subs class-name 1))))

-;; TODO: styles is last arg because of thread-last in `defui*`
+;; styles is the last arg because of thread-last in `defui*`
 (defn format-style-classes [ns-name component-name styles]
   (->> styles
     (clojure.core/map


Closes #63

Closes #63

--- src/doctopus/db/schema.clj
+++ src/doctopus/db/schema.clj
@@ -89,8 +89,20 @@
 (defn- create-fts-document-index
   [db-name]
   (let [update-sql "UPDATE documents SET search_vector = to_tsvector('english', name || ' ' || body)"
-        idx-sql "CREATE INDEX fts_idx ON documents USING GIN(search_vector)"]
-    (log/info "Creating FTS Index for the documents table")
+        idx-sql (->> ["DO $$"
+                     "BEGIN"
+                     "IF NOT EXISTS ("
+                     "SELECT 1"
+                     "FROM pg_class c"
+                     "JOIN pg_namespace n ON n.oid = c.relnamespace"
+                     "WHERE c.relname = 'fts_idx'"
+                     "AND n.nspname = 'public'"
+                     ") THEN"
+                     "CREATE INDEX fts_idx ON documents USING GIN(search_vector);"
+                     "END IF;"
+                     "END$$"]
+                    (str/join \newline))]
+    (log/info "Ensuring FTS Index for the documents table")
     (do-sql-with-logging! update-sql db-name)
     (do-sql-with-logging! idx-sql db-name)
     (log/info "Index successfully created")))


commenting out flexbox stuff for now

commenting out flexbox stuff for now

--- src/greenhouse/grid.clj
+++ src/greenhouse/grid.clj
@@ -137,11 +137,11 @@
       [(str "&:nth-of-type(" n "n+1)")
        {:clear :both}]])))

-(defn grid
-  []
-  (list
-    {:display :flex
-     :flex-wrap :wrap}))
+;(defn grid
+;  []
+;  (list
+;    {:display :flex
+;     :flex-wrap :wrap}))

 (defn column
   [& {:keys [ratio offset cycle uncycle gutter]
@@ -164,11 +164,11 @@
         margin-last (if (neg? offset) margin-r 0)
         cycles (cycle-props cycle side margin-r margin-last)]
     (list {
-           :flex col-width
-
-           ;:float side
-           ;:clear :none
-           ;:width (percent col-width)
+           ;:flex col-width
+
+           :float side
+           :clear :none
+           :width (percent col-width)
            (margin side) (percent margin-l)
            (opposite-margin side) (percent margin-r)}
           cycles)))
@@ -188,12 +188,12 @@
                   [(str "&:nth-of-type(" cycle "n+1)")
                    {:clear :both}]]
                  [])]
-    (list {:flex (if width
-                   [[0 0 (px span-width)]]
-                   span-width)
-           ;:float side
-           ;:clear :none
-           ;:width (percent span-width)
+    (list {;:flex (if width
+           ;        [[0 0 (px span-width)]]
+           ;        span-width)
+           :float side
+           :clear :none
+           :width (percent span-width)
            (margin side) (percent margin-l)
            (opposite-margin side) (percent margin-r)}
           cycles)))


Add additional try/catch to retain msg handling in error case

--- components/sente/src/gorillalabs/tesla/component/router.clj
+++ components/sente/src/gorillalabs/tesla/component/router.clj
@@ -14,10 +14,13 @@
            (when event-msg
              (let [{:keys [id event ?reply-fn]} event-msg]
                (go (if-let [event-fn (get @(:events router) id)]
-                     (event-fn event-msg)
-                     (do (log/info "Unhandled event: %s" id)
-                         (when ?reply-fn
-                           (?reply-fn {:umatched-event-as-echoed-from-from-server event}))))))
+                     (try
+                       (event-fn event-msg)
+                       (do (log/info "Unhandled event: %s" id)
+                           (when ?reply-fn
+                             (?reply-fn {:umatched-event-as-echoed-from-from-server event})))
+                     (catch Exception e (log/error  "Caught exception: " (.getMessage e)))))
+                   ))
              (recur (<! event-msg-channel)))))

 (defn register [router-component id callback]


Extract smaller fns.

Extract smaller fns.

--- src/kolmogorov_music/song.clj
+++ src/kolmogorov_music/song.clj
@@ -30,38 +30,47 @@
    :pitch pitch
    :duration duration})

-(defn most-behind [[x & xs :as v]]
+(defn least [[x & xs :as v]]
   (if (= x (apply min v))
     0
-    (inc (most-behind xs))))
+    (inc (least xs))))

 (defn synchronise [v]
   (vec (repeat (count v) (apply max v))))

+(defn increment [v i n]
+  (update-in v [i] (partial + n)))
+
 (defn decode*
-  ([state [a b c d & digits]]
-   (when (or a b c d)
-     (if (zero? (* a b))
-       (decode* (synchronise state) digits)
-       (let [part (most-behind state)
-             duration (/ a b)
-             pitch (+ c d)
-             time (get state part)]
-         (cons (construct time duration pitch)
-               (lazy-seq (->> digits
-                              (decode* (update-in state [part] (partial + duration)))))))))))
+  ([state [a b c d & digits :as remaining?]]
+   (when remaining?
+     (let [index (least state)
+           rest? (zero? (* a b))
+           pitch (when-not rest? (+ c d))
+           duration (if (not rest?) (/ a b) (/ c d))
+           time (get state index)]
+       (cons (construct time duration pitch)
+             (lazy-seq (->> digits
+                            (decode* (increment state index duration)))))))))

-(defn tens [n]
-  (apply * (repeat n (bigint 10))))
+(defn digit-shift [x n]
+  (apply * x (repeat n (bigint 10))))

-(defn code [[{:keys [duration pitch] :as note} & notes]]
-  (if (nil? note)
-    (bigint 0)
-    (let [one (+ (* (tens 3) (if (ratio? duration) (numerator duration) duration))
-                 (* (tens 2) (if (ratio? duration) (denominator duration) 1))
-                 (* (tens 1) (quot pitch 2))
-                 (* (tens 0) (- pitch (quot pitch 2))))]
-      (+ (* (bigint one) (tens (* (bigint 4) (count notes)))) (code notes)))))
+(defn code-pitch [pitch]
+  (let [half (quot pitch 2)]
+    (+ (digit-shift half 1) (- pitch half))))
+
+(defn code-duration [duration]
+  (let [denom (if (ratio? duration) (denominator duration) 1)
+        numer (* denom duration)]
+    (+ (digit-shift numer 1) denom)))
+
+(defn code [[{:keys [duration pitch] :as remaining?} & notes]]
+  (if remaining?
+    (let [encoding (+ (digit-shift (code-duration duration) 2)
+                      (code-pitch pitch)) ]
+      (+ (digit-shift encoding (* 4 (count notes))) (code notes)))
+    0))

 (def row
   (->> (phrase [3/3 3/3 2/3 1/3 3/3]


Just a little bit of logging

Just a little bit of logging

--- src/leiningen/amp/install.clj
+++ src/leiningen/amp/install.clj
@@ -135,7 +135,8 @@
 (defn- install!
   "Uses the Alfresco MMT to install the AMP into the target WAR"
   [amp war]
-  (ModuleManagementTool/main (into-array String ["install" (str amp) (str war)])))
+  (ModuleManagementTool/main (into-array String ["install" (str amp) (str war)]))
+  (println "AMP successfully installed into" war))

 (defn install-amp!
   "Installs the generated AMP into the specified WAR. If the target WAR is not


Added CMR-style temporal range parameter.

--- src/cmr/opendap/ous/query/params/v2.clj
+++ src/cmr/opendap/ous/query/params/v2.clj
@@ -40,7 +40,10 @@
    ;;
    ;; `bounding-box` is provided for CMR/EDSC-compatibility as an alternative
    ;; to using `subset` for spatial-subsetting.
-   bounding-box])
+   bounding-box
+   ;; `temporal` is used to indicate temporal subsetting with starting
+   ;; and ending values being ISO 8601 datetime stamps.
+   temporal])

 (def params-keys
   (set/difference
@@ -63,6 +66,7 @@
   (let [bounding-box (ous-util/->seq (:bounding-box params))
         subset (:subset params)
         granules-array (ous-util/->seq (get params (keyword "granules[]")))
+        temporal-array (ous-util/->seq (get params (keyword "temporal[]")))
         variables-array (ous-util/->seq (get params (keyword "variables[]")))]
     (log/trace "bounding-box:" bounding-box)
     (log/trace "subset:" subset)
@@ -84,7 +88,10 @@
         :bounding-box (if (seq bounding-box)
                        (mapv #(Float/parseFloat %) bounding-box)
                        (when (seq subset)
-                        (ous-util/subset->bounding-box subset)))))))
+                        (ous-util/subset->bounding-box subset)))
+        :temporal (if (not-array? temporal-array)
+                       (ous-util/->seq (:temporal params))
+                       temporal-array)))))

 (defrecord CollectionsParams
   [;; This isn't defined for the OUS Prototype, since it didn't support


Add new instance types

Add new instance types

--- src/exploud/validators.clj
+++ src/exploud/validators.clj
@@ -45,7 +45,10 @@
     "r3.8xlarge"
     "r3.large"
     "r3.xlarge"
-    "t1.micro"})
+    "t1.micro"
+    "t2.micro"
+    "t2.small"
+    "t2.medium"})

 (def availability-zones
   #{"a" "b" "c"})


Adds options param to clojure-test/install!

--- src/flare/clojure_test.clj
+++ src/flare/clojure_test.clj
@@ -1,36 +1,46 @@
 (ns flare.clojure-test
-  (:require [flare.core :refer [diff generate-reports]]
+  (:require [flare.core :as flare]
             [clojure.test :as ct]))

-(defn install! []
+(defn install!
+  ([]
+     (install! {}))
+  ([opts]
+     (defn print-diff
+       [diff]
+       (let [reports (flare/generate-reports diff)]
+         (println "")
+         (doseq [report reports]
+           (println report))))

-  (defn print-diff
-    [diff]
-    (let [reports (generate-reports diff)]
-      (println "")
-      (doseq [report reports]
-        (println report))))
+     (defmethod ct/report :fail [m]
+       (ct/with-test-out
+         (ct/inc-report-counter :fail)
+         (println "\nFAIL in" (ct/testing-vars-str m))
+         (when (seq ct/*testing-contexts*) (println (ct/testing-contexts-str)))
+         (when-let [message (:message m)] (println message))
+         (println "expected:" (pr-str (:expected m)))
+         (println "  actual:" (pr-str (:actual m)))
+         (if-let [diff (::difference m)]
+           (print-diff (::difference m)))))

-  (defmethod ct/report :fail [m]
-    (ct/with-test-out
-      (ct/inc-report-counter :fail)
-      (println "\nFAIL in" (ct/testing-vars-str m))
-      (when (seq ct/*testing-contexts*) (println (ct/testing-contexts-str)))
-      (when-let [message (:message m)] (println message))
-      (println "expected:" (pr-str (:expected m)))
-      (println "  actual:" (pr-str (:actual m)))
-      (if-let [diff (::difference m)]
-        (print-diff (::difference m)))))
+     (defn diff
+       [args]
+       (when (= 2 (count args))
+         (let [args (if (= (:expected opts) :first)
+                      (reverse args)
+                      args)]
+           (apply flare/diff args))))

-  (defmethod ct/assert-expr '=
-    [msg form]
-    (let [args (rest form)]
-      `(let [args# (list ~@args)
-             result# (apply = args#)]
-         (if result#
-           (ct/do-report {:type :pass, :message ~msg,
-                          :expected '~form, :actual (cons '= args#)})
-           (ct/do-report {:type :fail, :message ~msg,
-                          :expected '~form, :actual (list '~'not (cons '~'=== args#))
-                          ::difference (apply diff args#)}))
-         result#))))
+     (defmethod ct/assert-expr '=
+       [msg form]
+       (let [args (rest form)]
+         `(let [args# (list ~@args)
+                result# (apply = args#)]
+            (if result#
+              (ct/do-report {:type :pass, :message ~msg,
+                             :expected '~form, :actual (cons '= args#)})
+              (ct/do-report {:type :fail, :message ~msg,
+                             :expected '~form, :actual (list '~'not (cons '~'=== args#))
+                             ::difference (diff args#)}))
+            result#)))))


fixed some formatting

fixed some formatting

--- src/frontend/renderer.cljs
+++ src/frontend/renderer.cljs
@@ -182,11 +182,11 @@
     om/IDidUpdate
     (did-update [_ _ _]
       (.draggable (js/$ "#progress-track-ball") #js {:axis "x"
-                                                    :containment "#progress-track"
-                                                    :start #(swap! player/app-state assoc
-                                                                  :ball-being-dragged?
-                                                                  true)
-                                                    :stop core/on-drag-stop}))
+                                                     :containment "#progress-track"
+                                                     :start #(swap! player/app-state assoc
+                                                                   :ball-being-dragged?
+                                                                   true)
+                                                     :stop core/on-drag-stop}))
     om/IRender
     (render [this]
       (dom/div nil
@@ -224,8 +224,8 @@
     om/IDidUpdate
     (did-update [_ _ _]
       (.draggable (js/$ "#volume-ball") #js {:axis "x"
-                                                    :containment "#volume"
-                                                    :stop core/on-volume-drag-stop}))
+                                             :containment "#volume"
+                                             :stop core/on-volume-drag-stop}))
     om/IRender
     (render [this]
       (dom/hr #js {:id "volume-bar"}


disabled autocomplete

disabled autocomplete

--- src/frontend/renderer.cljs
+++ src/frontend/renderer.cljs
@@ -51,7 +51,7 @@
     (render [this]
       (if-not (:logged-in? data)
         (dom/form #js {:action ""} "Enter Name: "
-          (dom/input #js {:id "username" :type "text" :ref "username" :autocomplete "off"})
+          (dom/input #js {:id "username" :type "text" :autoComplete "off"})
           (dom/button nil "Join"))))))

 (defn message-form [data owner]
@@ -60,7 +60,7 @@
     (render [this]
       (if (:logged-in? data)
         (dom/form #js {:action "" :ref "message"}
-          (dom/input #js {:id "m" :autocomplete "off" :type "text"})
+          (dom/input #js {:id "m" :autoComplete "off" :type "text"})
           (dom/button nil "Send"))))))

 (om/root users-list-view core/app-state {:target (. js/document (getElementById "userslist"))})


empty is not empty?

empty is not empty?

--- src/fugue/boxes/state.cljs
+++ src/fugue/boxes/state.cljs
@@ -64,11 +64,9 @@
 (defn on-key [state actions key cb]
   (let [old-seq (:key-seq state)
         new-seq (conj old-seq key)]
-    (print new-seq)
-    (print (get popup-options new-seq))
     (cond
       ; Space opens the popup
-      (and (empty old-seq) (= " " key))
+      (and (empty? old-seq) (= " " key))
       (cb (show-popup state))
       ; If there's an action, close the popup and perform it
       (contains? actions new-seq)


update exercise added to backend

update exercise added to backend

--- src/ontrail/mutate.clj
+++ src/ontrail/mutate.clj
@@ -148,8 +148,9 @@
 (defn update-ex [user params]
   (.debug logger (str (:user params) " updating ex " params)) ;; non-safe
   (let [write-result (mc/update-by-id EXERCISE (ObjectId. (:id params))
-                                      {"$set" (assoc (from-user-ex user params)
-                                                :lastModifiedDate (time/now))})]
+                                      {"$set" (dissoc
+                                               (assoc (from-user-ex user params) :lastModifiedDate (time/now))
+                                               :comments)})]
     (.debug logger (str "Updated " (:id params) " with status "  write-result))
     {:result (mr/ok? write-result)
      :message (str "Message id " (:id params) " updated.")}))


quickfix: removed reference to item.view which no longer exists

--- src/listopia/item/handler.clj
+++ src/listopia/item/handler.clj
@@ -1,7 +1,6 @@
 (ns listopia.item.handler
   (:require [listopia.db         :refer [database-url]]
-            [listopia.item.model :as item.model]
-            [listopia.item.view  :as item.view]))
+            [listopia.item.model :as item.model]))

 (defn handle-create-item! [req]


spacing...

spacing...

--- src/overtone/sc/sample.clj
+++ src/overtone/sc/sample.clj
@@ -83,7 +83,6 @@
     (callable-map (merge {:player player} s)
                   player)))

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

 (defmacro defsample [s-name path]


Don't add css and js tags if they're already added.

--- src/com/lemondronor/leaflet_gorilla.clj
+++ src/com/lemondronor/leaflet_gorilla.clj
@@ -77,18 +77,28 @@
    :opacity 1.0})

+(defonce js-tag-id (uuid))
+(defonce css-tag-id (uuid))
+
+
 (def content-template
   "


added a declaration as some IDEs to not cope with defstate

--- components/neo4j/src/gorillalabs/tesla/component/neo4j.clj
+++ components/neo4j/src/gorillalabs/tesla/component/neo4j.clj
@@ -3,6 +3,8 @@
             [clojure.tools.logging :as log]
             [gorillalabs.tesla.component.configuration :as config]
             [mount.core :as mnt]))
+
+(declare graph)

 (defn- start []
   (let [url (config/config config/configuration [:neo4j :url])


WM: Remove minimum width

WM: Remove minimum width

--- src/hatti/views/table.cljs
+++ src/hatti/views/table.cljs
@@ -92,8 +92,7 @@
          :name label :toolTip label :sortable true
          :formatter (partial formatter field language)
          :headerCssClass (get-column-class field)
-         :cssClass (get-column-class field)
-         :minWidth 80})))))
+         :cssClass (get-column-class field)})))))

 (defn- init-sg-pager [grid dataview]
   (let [Pager (.. js/Slick -Controls -Pager)]


Add Compojure app docs

Add Compojure app docs

--- src/honeydash/handlers.clj
+++ src/honeydash/handlers.clj
@@ -1,3 +1,7 @@
+;; A Compojure application which serves static assets and
+;; proxies requests to Honeybadger to overcome browser same
+;; origin policy constraints.
+;; The application is mounted by figwheel
 (ns honeydash.handlers
   (:require [clj-http.client :as client]
             [compojure
@@ -10,7 +14,9 @@

 (def ^:private honeybadger-api-endpoint "https://app.honeybadger.io/v1")

-(defn honeybadger-api-handler [{:keys [uri query-string] :as request}]
+(defn honeybadger-api-handler
+  "Proxies requests to Honeybadger API"
+  [{:keys [uri query-string] :as request}]
   (let [requested-path (clojure.string/replace-first uri "/honeybadger" "")
         url (str honeybadger-api-endpoint requested-path "?" query-string)
         honeybadger-response (client/get url {:accept :json :as :json})]


CMR-3687: Removed unneeded requires

CMR-3687: Removed unneeded requires

--- system-int-test/test/cmr/system_int_test/search/tagging/enable_disable_test.clj
+++ system-int-test/test/cmr/system_int_test/search/tagging/enable_disable_test.clj
@@ -2,16 +2,12 @@
   "Search tag / tag association peristence enable/disable endpoint test"
   (:require
     [clojure.test :refer :all]
-    [clojure.string :as str]
     [cmr.common.util :refer [are2] :as util]
     [cmr.system-int-test.utils.ingest-util :as ingest]
     [cmr.system-int-test.utils.search-util :as search]
-    [cmr.system-int-test.utils.index-util :as index]
-    [cmr.system-int-test.utils.metadata-db-util :as mdb]
     [cmr.system-int-test.utils.tag-util :as tags]
     [cmr.system-int-test.data2.core :as d]
     [cmr.system-int-test.data2.collection :as dc]
-    [cmr.transmit.tag :as tt]
     [cmr.mock-echo.client.echo-util :as e]
     [cmr.system-int-test.system :as s]
     [cmr.transmit.config :as transmit-config]))


Fix merge

Fix merge

--- storm-core/src/clj/backtype/storm/daemon/supervisor.clj
+++ storm-core/src/clj/backtype/storm/daemon/supervisor.clj
@@ -684,7 +684,7 @@
                                      (do
                                        (doseq [id ids]
                                          (shutdown-worker supervisor id))
-                                       (throw (RuntimeException. "Supervisor failed health check. Exiting."))))))))
+                                       (throw (RuntimeException. "Supervisor failed health check. Exiting.")))))))
       ;; Launch a thread that Runs profiler commands . Starts with 30 seconds delay, every 30 seconds
       (schedule-recurring (:event-timer supervisor)
                           30


Add edit entry button.

Add edit entry button.

--- src/lab_notebook/core.cljs
+++ src/lab_notebook/core.cljs
@@ -43,9 +43,16 @@

 (defn item-view [cursor component]
   (reify
-    om/IRender
-    (render [this]
+    om/IInitState
+    (init-state [this]
+      {:editing? false})
+    om/IRenderState
+    (render-state [this state]
       (dom/div #js {:style #js {:marginTop "2em"}}
+        (dom/button #js {:className "btn btn-primary"
+                         :onClick (fn [e]
+                                    (om/set-state! component :editing? true))}
+          "Edit")
         (dom/div nil (:summary cursor))
         (dom/div nil (:date-time cursor))
         (dom/div nil (:notes cursor))))))


lein-release plugin: preparing 0.1.0 release

--- liverepl-server/project.clj
+++ liverepl-server/project.clj
@@ -1,4 +1,4 @@
-(defproject com.brightcove.liverepl/liverepl-server "0.1.0-SNAPSHOT"
+(defproject com.brightcove.liverepl/liverepl-server "0.1.0"
   :description "Brightcove local version of liverepl-server"
   :license {:name "Copyright (C) 2009 David J. Powell.  See GitHub for license."}
   :url "https://github.com/djpowell/liverepl"


Add behavior to use CM rulers - close #892

--- src/lt/objs/editor.cljs
+++ src/lt/objs/editor.cljs
@@ -715,3 +715,15 @@
                         (object/call-behavior-reaction :lt.objs.plugins/load-css
                                                        this
                                                        (filter #(= (files/ext %) "css") paths)))))
+
+(behavior ::set-rulers
+          :triggers #{:object.instant}
+          :type :user
+          :desc "Editor: Set CodeMirror rulers"
+          :params [{:label "Vector of rulers"
+                    :example "[{:color \"#cfc\" :column 100 :lineStyle \"dashed\"}]"}]
+          :reaction (fn [this rulers]
+                      (when-not (.getOption (->cm-ed this) "rulers")
+                        (load/js "core/node_modules/codemirror/addon/display/rulers.js" :sync))
+                      (let [rulers (or rulers [{:lineStyle "dashed" :color "#aff" :column 80}])]
+                        (set-options this {:rulers (clj->js rulers)}))))


need to wrap cljs.js/eval-str *eval-fn* invoke in a try/catch

--- src/main/cljs/cljs/js.cljs
+++ src/main/cljs/cljs/js.cljs
@@ -659,7 +659,11 @@
                                               [::ana/namespaces name])}]
                     (when (:verbose opts)
                       (debug-prn js-source))
-                    (cb {:ns ns :value (*eval-fn* evalm)})))))))))
+                    (let [res (try
+                                {:ns ns :value (*eval-fn* evalm)}
+                                (catch :default cause
+                                  (wrap-error (ana/error aenv "ERROR" cause))))]
+                      (cb res))))))))))
       (:*cljs-ns* bound-vars))))

 (defn eval-str


basic model for s for solve using agents for delayed execution

--- src/tile_game/core.clj
+++ src/tile_game/core.clj
@@ -141,9 +141,11 @@
                              (alter *board* move piece)))
                    (.repaint panel))
                 ([piece & moves]
-                   (doseq [m (cons piece moves)]
-                     (move! m)
-                     (Thread/sleep 100))))]
+                   (prn piece moves)
+                   (move! piece)
+                   (send (agent moves) #(do
+                                         (Thread/sleep 500)
+                                         (apply move! %1)))))]
     (doto panel
       (.setPreferredSize (Dimension. size size))
       (.setFocusable true)
@@ -157,6 +159,7 @@
                            KeyEvent/VK_UP    (dir-move :up)
                            KeyEvent/VK_DOWN  (dir-move :down)
                            KeyEvent/VK_Q     (.dispose #^JFrame frame)
+                           KeyEvent/VK_S     (apply move! (path-to @*board* [0 0]))
                            true))))))
     (doto frame (.setContentPane panel) .pack .show)
     move!))


improved card move

improved card move

--- src/node/game/core.cljs
+++ src/node/game/core.cljs
@@ -24,7 +24,7 @@
   (when card
     (let [dest (if (sequential? to) to [to])]
       (swap! state update-in (cons side dest) #(conj % (assoc card :zone dest)))
-      (swap! state update-in (cons side (:zone card)) (fn [coll] (remove-once #(not= (:title %) (:title card)) coll))))))
+      (swap! state update-in (cons side (:zone card)) (fn [coll] (remove-once #(not= (:cid %) (:cid card)) coll))))))

 (defn trash [state side card]
   (move state side card :discard))
@@ -64,7 +64,8 @@
                                 " (" (if (> delta 0) (str "+" delta) delta) ")."))))

 (defn create-deck [deck]
-  (shuffle (mapcat #(repeat (:qty %) (:card %)) (:cards deck))))
+  (shuffle (mapcat #(map (fn [c] (assoc c :cid (make-cid))) (repeat (:qty %) (:card %)))
+                   (:cards deck))))

 (defn init-game [{:keys [players gameid] :as game}]
   (let [corp (some #(when (= (:side %) "Corp") %) players)
@@ -187,7 +188,7 @@
 (defn runner-install [state side card]
   (when (pay state side :click 1 :credit (:cost card) :memory (:memoryunits card))
     (let [card-def (game.cards/cards (:title card))
-          c (merge card (:data card-def) {:cid (make-cid)})]
+          c (merge card (:data card-def))]
       (when-let [effect (:effect card-def)]
         (effect state side c))
       (move state side c [:rig (keyword (.toLowerCase (:type c)))]))


Bootstrapping stuff

Bootstrapping stuff

--- src/metabase/bootstrap.clj
+++ src/metabase/bootstrap.clj
@@ -16,14 +16,24 @@
 (defn bootstrap
   "Create a User for development purposes. This will load the test data and create permissions for the Test Org."
   []
-  @data/test-db ; migrate our DB + load the test data
+  (migrate :up)
   (bootstrap-user))

 ;; # (INTERNAL)

+(defn- bootstrap-org
+  "Create a new Organization."
+  []
+  (let [org-name (prompt-read-line "Org name" "Default")]
+    (or (sel :one Org :name org-name)
+        (ins Org
+          :name org-name
+          :slug (prompt-read-line "Org slug" "default")
+          :inherits true))))
+
 (defn- bootstrap-user
-  "Create a new User (creating a new Org too if needed)."
+  "Create a new User (creating a new Org too if needed). Org perms between User & Org will be created."
   []
   (let [email (prompt-read-line "User email" "cam@metabase.com")
         ;; create User if needed
@@ -33,12 +43,16 @@
                       :first_name (prompt-read-line "User first name" "Cam")
                       :last_name (prompt-read-line "User last name" "Saul")
                       :password (-> (prompt-read-line "User password" "password")
-                                    cemerick.friend.credentials/hash-bcrypt)))]
+                                    cemerick.friend.credentials/hash-bcrypt)))
+        use-test-org? (prompt-read-line-boolean "Should we use the test data? (User will be added to \"Test Organization\")" "true")
+        org (if use-test-org? (do @data/test-db   ; load the test data reaaallly quick
+                                  @data/test-org)
+                (bootstrap-org))]
     ;; create OrgPerm if needed
-    (or (sel :one OrgPerm :organization_id @data/org-id :user_id (:id user))
+    (or (sel :one OrgPerm :organization_id (:id org) :user_id (:id user))
         (let [admin? (prompt-read-line-boolean "Make user an admin?" "true")]
           (ins OrgPerm
-               :organization_id @data/org-id
+               :organization_id (:id org)
                :user_id (:id user)
                :admin admin?)))
     user))


Delete medications.clj

Delete medications.clj

--- medications/medications.clj
+++ medications/medications.clj
@@ -1,109 +0,0 @@
-(use 'grape.core)
-
-(gts 'medications)
-
-;; Define rules here:
-;; ------------------
-
-(rule 'create_rx! ['substance]
-      {:create (pattern (node 'p1 {:asserts {:kind "'Prescription'" :substance "'&substance'"}}))})
-
-(rule 'add_instruction! ['action]
-      {:read (pattern
-               (node 'p1 {:asserts {:kind "'Prescription'"}})
-               (NAC
-                   (node 'inst {:asserts {:kind "'Instruction'"}})
-                   (edge 'i1 {:label "instruction" :src 'p1 :tar 'inst})
-               )
-              )
-       :create (pattern
-                 (node 'inst {:asserts {:kind "'Instruction'" :action "'&action'"}})
-                 (edge 'i2 {:label "instruction" :src 'p1 :tar 'inst})
-                 )
-       }
-)
-
-(rule 'add_timeframe! ['duration 'frame 'freq]
-      {:read (pattern
-               (node 'i1 {:asserts {:kind "'Instruction'"}})
-               (NAC
-                 (node 'tf1 {:asserts {:kind "'TimeFrame'"}})
-                 (edge 'e {:label "timeframe" :src 'i1 :tar 'tf1})
-               )
-             )
-       :create (pattern
-                 (node 'tf2 {:asserts {:frame "'&frame'" :frequency "'&freq'" :kind "'TimeFrame'"}})
-                 (edge 'e {:label "timeframe" :src 'i1 :tar 'tf2})
-                 (assign "i1.duration=&duration")
-               )
-      }
-)
-
-(rule 'refine_timeframe! ['value 'frame 'freq]
-    {:read (pattern
-               (node 'tf1 {:asserts {:kind "'TimeFrame'"}})
-           )
-     :create (pattern
-               (node 'cp2 {:asserts {:kind "'CompoundPoint'" :value "'&value'"}})
-               (node 'tf2 {:asserts {:kind "'TimeFrame'" :frame "'&frame'" :frequency "'&freq'"}})
-               (edge 'e2 {:label "point" :src 'tf1 :tar 'cp2})
-               (edge 'e3 {:label "refine" :src 'cp2 :tar 'tf2})
-             )
-
-    }
-)
-
-(rule 'add_atomic! ['value]
-    {:read (pattern
-             (node 'tf1 {:asserts {:kind "'TimeFrame'"}})
-           )
-     :create (pattern
-               (node 'ap1 {:asserts {:kind "'AtomicPoint'" :value "'&value'"}})
-               (edge 'e {:label "point" :src 'tf1 :tar 'ap1})
-             )
-     }
-)
-
-(rule 'add_timeframe_dose! ['value 'unit]
-      {:read (pattern
-               (node 'tf {:asserts {:kind "'TimeFrame'"}})
-               (NAC
-                 (node 'd1 {:asserts{:kind "'Dose'"}})
-                 (edge 'e1 {:label "dose" :src 'tf :tar 'd1})
-
-                )
-              )
-       :create (pattern
-                 (node 'd2 {:asserts {:kind "'Dose'" :value "'&value'" :unit "'&unit'"}})
-                 (edge 'e {:label "dose" :src 'tf :tar 'd2})
-                 )
-       }
-)
-
-(rule 'add_point_dose! ['value 'unit]
-      {:read (pattern
-               (node 'ap {:asserts {:kind "'AtomicPoint'"}})
-               (NAC
-                 (node 'd1 {:asserts{:kind "'Dose'"}})
-                 (edge 'e1 {:src 'ap :tar 'd1})
-
-                )
-              )
-       :create (pattern
-                 (node 'd2 {:asserts {:kind "'Dose'" :value "'&value'" :unit "'&unit'"}})
-                 (edge 'e {:label "dose" :src 'ap :tar 'd2})
-                )
-       }
-)
-
-;; Execute rules here:
-;; -------------------
-
-(create_rx! "Aspirin")
-(add_instruction! "take")
-(add_timeframe! 10 "WEEK" "2")
-(refine_timeframe! "1" "DAY" "1")
-(refine_timeframe! "4" "DAY" "1")
-(add_atomic! "8")
-(add_point_dose! "81" "mg")
-(add_point_dose! "81" "mg")


RS | Set session cookie as http-only

RS | Set session cookie as http-only

--- src/objective8/core.clj
+++ src/objective8/core.clj
@@ -124,7 +124,7 @@
       wrap-json-params
       wrap-json-response
       wrap-flash
-      wrap-session))
+      (wrap-session {:cookie-attrs {:http-only true}})))

 (defonce server (atom nil))
 (defonce postgres-connection-pool (atom nil))


Implement version that distributes the reservations of relations over multiple workers actors.

--- src/vacation2/main.clj
+++ src/vacation2/main.clj
@@ -24,6 +24,10 @@
 (def cli-options
   [["-w" "--workers N" "Number of workers"
     ; Workers are called clients in vacation, the option is -c there.
+    :default 20
+    :parse-fn #(Integer/parseInt %)]
+   ["-s" "--secondary-workers N" "Number of secondary workers"
+    ; New, not in vacation.
     :default 20
     :parse-fn #(Integer/parseInt %)]
    ["-n" "--queries N" "Number of queries per relation per reservation"
@@ -69,10 +73,11 @@
     (when (:debug options)
       (def log log-debug))
     (if proceed?
-      (let [options {:n-workers      (:workers options)
-                     :n-reservations (:reservations options)
-                     :n-relations    (:relations options)
-                     :n-queries      (:queries options)}]
+      (let [options {:n-workers           (:workers options)
+                     :n-secondary-workers (:secondary-workers options)
+                     :n-reservations      (:reservations options)
+                     :n-relations         (:relations options)
+                     :n-queries           (:queries options)}]
         (log "options: " options)
         (when (not= (rem (:n-reservations options) (:n-workers options)) 0)
           (println "WARNING: number of reservations is not divisible by number"
@@ -161,7 +166,7 @@
                               timestamp])]
     (base64/str->base64 data)))

-(defn process-reservation
+(defn process-reservation-seq
   [reservation
    {:keys [cars flights rooms]}
    {:keys [n-queries]}]
@@ -186,25 +191,59 @@
         :pnr    pnr)))
   (log "finished reservation" (:id @reservation)))

+(defn process-reservation-par
+  [reservation
+   {:keys [cars flights rooms]}
+   {:keys [n-queries]}
+   workers]
+  "Process a reservation: find a car, flight, and room for the reservation and
+  update the data structures."
+  (dosync
+    (log "start tx for reservation" (:id @reservation))
+    (send (rand-nth workers) :car    cars    reservation n-queries)
+    (send (rand-nth workers) :flight flights reservation n-queries)
+    (send (rand-nth workers) :room   rooms   reservation n-queries)
+    (let [pnr (generate-pnr reservation)]
+      (alter reservation assoc
+        :status :in-process
+        :pnr    pnr)))
+  (log "finished reservation" (:id @reservation)))
+
 ; BEHAVIORS

+(def reserve-relation-behavior
+  (behavior
+    [secondary-worker-id master]
+    [relation-name relation reservation n-queries]
+    (log "reserve" relation-name "for reservation" (:id @reservation)
+      "by secondary worker" secondary-worker-id)
+    (dosync
+      (let [n-people (:n-people @reservation)
+            found-relation
+              (look-for-seats (random-subset n-queries relation) n-people)]
+        (when found-relation
+          (log "reserving" relation-name (:id @found-relation))
+          (reserve-relation reservation found-relation n-people))))
+    (send master :done relation-name (:id @reservation))))
+
 ; In vacation, this corresponds to a client.
-(def worker-behavior
-  (behavior
-    [worker-id master data options]
+(def reservation-behavior
+  (behavior
+    [worker-id master secondary-workers data options]
     [reservation]
     ; Note: as opposed to the vacation benchmark, we only support making
     ; reservations, not deleting customers or updating tables.
     (log "start reservation" (:id @reservation) "by worker" worker-id)
-    (process-reservation reservation data options)
-    (send master :done (:id @reservation))))
+    (process-reservation-par reservation data options secondary-workers)
+    (send master :done :reservation (:id @reservation))))

 (def done? (promise))

 (def master-waiting-behavior
   (behavior
     [n]
-    [_done _reservation-id]
+    [_done _key _id]
+    ; _key is one of :reservation, :car, :flight, :room
     (if (= n 1)
       (do
         (log "done")
@@ -214,17 +253,24 @@

 (def master-initial-behavior
   (behavior
-    [{:keys [n-workers n-reservations] :as options}]
+    [{:keys [n-workers n-secondary-workers n-reservations] :as options}]
     [_start]
     (let [{:keys [reservations cars flights rooms] :as data}
             (initialize-data options)
-          worker-actors
-            (map #(spawn worker-behavior % *actor* data options)
-              (range n-workers))]
+          ; It is important to wrap the two maps below in doall, so that they
+          ; are executed here, where *actor* refers to the master actor, and not
+          ; in another place. Stupid lazy Clojure.
+          secondary-workers
+            (doall (map #(spawn reserve-relation-behavior % *actor*)
+                        (range n-secondary-workers)))
+          reservation-workers
+            (doall (map #(spawn reservation-behavior
+                          % *actor* secondary-workers data options)
+                        (range n-workers)))]
       #_(log-data data)
-      (doseq [[worker reservation] (zip (cycle worker-actors) reservations)]
+      (doseq [[worker reservation] (zip (cycle reservation-workers) reservations)]
         (send worker reservation))
-      (become master-waiting-behavior n-reservations))))
+      (become master-waiting-behavior (* n-reservations 4)))))

 ; MAIN


month from 0-base

month from 0-base

--- src/ontrail/summary.clj
+++ src/ontrail/summary.clj
@@ -76,7 +76,7 @@
   (let [first-day (time/date-time year month 1)
         last-day (-> first-day (.dayOfMonth) (.withMaximumValue))
         year-month-cond {:creationDate {:$gte first-day :$lte last-day}}]
-    (assoc (get-overall-summary-cond user year-month-cond) :year year :month month)))
+    (assoc (get-overall-summary-cond user year-month-cond) :year year :month (- month 1))))

 (defn get-overall-summary [user]
   (.trace logger (str "Getting overall summary: " user))


Another bug in mine finder

Another bug in mine finder

--- src/vindinium/bots.clj
+++ src/vindinium/bots.clj
@@ -407,7 +407,8 @@
      (let [blacklist (set (map key (filter #(< (val %) 0) (enemies-mod-map game id))))
            adj-pos (mine-neighbours (m/board game) id blacklist (m/pos game id))

-           max-paths [(harvest-path-search (m/board game) id (m/life game id) blacklist (m/pos game id))]
+           path (harvest-path-search (m/board game) id (m/life game id) blacklist (m/pos game id))
+           max-paths (when path [path])
            _ (println "mining debug:" max-paths)]
        (->> max-paths
             (map first)
@@ -421,7 +422,6 @@
                                              % (last (butlast path)))
                              adj-pos)
                      min-len (apply min (map count ps))]
-                 (println ps min-len)
                  (map first (filter #(= min-len (count %)) ps)))))
             (distinct)
             (map #(-> [(sim/move->direction (m/pos game id) %) 1])))))))


Making switching environment easier

Making switching environment easier

--- src/name_bazaar/ui/db.cljs
+++ src/name_bazaar/ui/db.cljs
@@ -11,13 +11,28 @@
     [re-frame.core :refer [dispatch]]
     [district0x.ui.utils :as d0x-ui-utils]))

+(def development-config
+  {:node-url "http://localhost:8549"
+   :load-node-addresses? true
+   :server-url "http://localhost:6200"})
+
+(def production-config
+  {:node-url "https://mainnet.infura.io/"
+   :load-node-addresses? false
+   :server-url "https://api.namebazaar.io"})
+
+(def mainnet-deployment-config
+  {:node-url "http://localhost:8545"
+   :load-node-addresses? true
+   :server-url "https://api.namebazaar.io"})
+
 (def default-db
   (merge
     district0x.ui.db/default-db
-    {:node-url "https://mainnet.infura.io/" #_ "http://localhost:8549" #_ "http://localhost:8545"
-     :load-node-addresses? false
-     :server-url #_ "http://localhost:6200" "https://api.namebazaar.io"
-     :active-page (d0x-ui-utils/match-current-location constants/routes)
+    ;development-config
+    production-config
+    ;mainnet-deployment-config
+    {:active-page (d0x-ui-utils/match-current-location constants/routes)
      :smart-contracts smart-contracts
      :now (t/now)


Fix reflection warning

Fix reflection warning

--- modules/reitit-core/src/reitit/impl.cljc
+++ modules/reitit-core/src/reitit/impl.cljc
@@ -179,7 +179,7 @@
                (URLDecoder/decode
                  (if (.contains ^String s "+")
                    (.replace ^String s "+" "%2B")
-                   s)
+                   ^String s)
                  "UTF-8"))
        :cljs (js/decodeURIComponent s))))


improved error message

improved error message

--- src/onyx/state/bookkeeper.clj
+++ src/onyx/state/bookkeeper.clj
@@ -73,7 +73,7 @@
           (throw (ex-info "The Bookie server failed to start because a cookie or
                            ledger already exists for this host. Set
                            :onyx.bookkeeper/delete-server-data? true to format
-                           the Bookie environment."))
+                           the Bookie environment on component shutdown."))
           (throw e)))))
   (stop [{:keys [server server-conf] :as component}]
     (info "Stopping BookKeeper server:")


We've moved beyond 0.4.0...

We've moved beyond 0.4.0...

--- src/overtone/sc/server.clj
+++ src/overtone/sc/server.clj
@@ -12,9 +12,9 @@
   (:require [overtone.util.log :as log]))

 (def OVERTONE-VERSION {:major 0
-                       :minor 4
+                       :minor 5
                        :patch 0
-                       :snapshot false})
+                       :snapshot true})

 (defonce synth-group*   (ref nil))
 (defonce osc-log*       (atom []))


Use helper fn to remove threading awkwardness

--- src/pathfinder/present.clj
+++ src/pathfinder/present.clj
@@ -14,14 +14,16 @@

 (def document-result {:document s/Str})

+(defn validate [data schema] (s/validate schema data))
+
+;;; TODO: need an index json doc to bootstrap ui from
+
 ;;; TODO: we output in latin 1 (on my mac anyway, maybe default
 ;;; encoding?!). This is added to the content-type presumably by ring?

-;;; TODO: generate these presentation functions?
-
 (defn exception [ex]
   (-> {:msg (.getMessage ex)}
-      (->> (s/validate error-result))
+      (validate error-result)
       json/write-str
       response/response
       (response/status 500)
@@ -29,7 +31,7 @@

 (defn document-stash [stash-result]
   (-> {}
-      (->> (s/validate document-stash-result))
+      (validate document-stash-result)
       json/write-str
       response/response
       (response/status 204)
@@ -38,7 +40,7 @@

 (defn query-results [results]
   (-> results
-      (->> (s/validate search-results))
+      (validate search-results)
       json/write-str
       response/response
       (response/status 200)
@@ -46,7 +48,7 @@

 (defn document [document]
   (-> document
-      (->> (s/validate document-result))
+      (validate document-result)
       json/write-str
       response/response
       (response/status 200)


proper content-type headers for dribbble api

--- src/pc/http/routes/api.clj
+++ src/pc/http/routes/api.clj
@@ -102,7 +102,8 @@
   (let [username (get-in req [:params :username])]
     (if (contains? dribbble-user-whitelist username)
       {:body (json/encode (get-dribbble-profile username))
-       :status 200}
+       :status 200
+       :headers {"Content-Type" "application/json; charset=utf-8"}}
       (throw+ {:status 400
                :public-message "Sorry, this user isn't on the whitelist."}))))


Made it run!

Made it run!

--- src/petulant_life/main.clj
+++ src/petulant_life/main.clj
@@ -14,7 +14,16 @@
 (defn destroy []
   (Display/destroy))

+; Running the simulation / graphics.
+(defn run []
+  (loop [running true]
+    (if (and running (not (Display/isCloseRequested)))
+      (do (Display/update)
+          (recur true))
+      nil)))
+
 ; Entry point.
 (defn -main [& args]
   (create)
+  (run)
   (destroy))


Removed debug message

Removed debug message

--- src/polismath/clusters.clj
+++ src/polismath/clusters.clj
@@ -36,10 +36,7 @@
     (map-indexed
       (fn [id position] {:id id :members [] :center (matrix position)})
       ; Have to make sure we don't have identical cluster centers
-      (distinct (rows
-                  (do (println "yhere we are" (get-matrix data))
-                  (get-matrix data))))))
-  )
+      (distinct (rows (get-matrix data))))))

 (defn same-clustering? [clsts1 clsts2 & {:keys [threshold] :or {threshold 0.01}}]


Simplify implementation of Middleware Compose

The implementation of middleware compose is duplicating behavior already
in compose.

`(apply comp [])` returns identity.

--- src/re_frame/handlers.cljs
+++ src/re_frame/handlers.cljs
@@ -30,12 +30,9 @@

   (cond
     (fn? v)       v  ;; assumed to be existing middleware
-    (vector? v)   (let [v (remove nil? (flatten v))
-                        _ (report-middleware-factories v)]   ;; damn error detection! always messes up the code
-                    (cond
-                      (empty? v)       identity     ;; no-op middleware
-                      (= 1 (count v))  (first v)    ;; only one middleware, no composing needed
-                      :else            (apply comp v)))
+    (seq? v)      (let [v (remove nil? (flatten v))]
+                    (report-middleware-factories v)
+                    (apply comp v))
     :else         (warn "re-frame: comp-middleware expects a vector, got: " v)))


(MAINT) Use fs/temp-name instead

(MAINT) Use fs/temp-name instead

--- test/unit/puppetlabs/puppetserver/certificate_authority_test.clj
+++ test/unit/puppetlabs/puppetserver/certificate_authority_test.clj
@@ -1,7 +1,6 @@
 (ns puppetlabs.puppetserver.certificate-authority-test
   (:import (java.io StringReader ByteArrayInputStream ByteArrayOutputStream)
-           (java.security InvalidParameterException)
-           (java.util UUID Date))
+           (java.security InvalidParameterException))
   (:require [puppetlabs.puppetserver.certificate-authority :refer :all]
             [puppetlabs.trapperkeeper.testutils.logging :as logutils]
             [puppetlabs.ssl-utils.core :as utils]
@@ -1077,28 +1076,27 @@
       (is (= #{"puppet" "master"} (set alt-names))))))

 (deftest file-permissions
-  (let [tmpdir (fs/tmpdir)]
-    (testing "A newly created file contains the properly set permissions"
-      (doseq [u all-perms
-              g all-perms
-              o all-perms]
-        (let [tmp-file (str tmpdir (UUID/randomUUID) (.getTime (Date.)))
-              perms (str u g o)]
-          (create-file-with-perms tmp-file perms)
-          (is (= perms (get-file-perms tmp-file)))
-          (fs/delete tmp-file))))
-
-    (testing "Changing the perms of an already created file"
-      (let [perms-list (for [u all-perms
-                             g all-perms
-                             o all-perms]
-                         (str u g o))]
-        (loop [perms perms-list]
-          (when-not (empty? perms)
-            (let [tmp-file (str tmpdir (UUID/randomUUID) (.getTime (Date.)))
-                  [init-perm change-perm] (take 2 perms)]
-              (create-file-with-perms tmp-file init-perm)
-              (set-file-perms tmp-file change-perm)
-              (is (= change-perm (get-file-perms tmp-file)))
-              (fs/delete tmp-file)
-              (recur (nthnext perms 2)))))))))
+  (testing "A newly created file contains the properly set permissions"
+    (doseq [u all-perms
+            g all-perms
+            o all-perms]
+      (let [tmp-file (fs/temp-name "ca-file-perms-test")
+            perms (str u g o)]
+        (create-file-with-perms tmp-file perms)
+        (is (= perms (get-file-perms tmp-file)))
+        (fs/delete tmp-file))))
+
+  (testing "Changing the perms of an already created file"
+    (let [perms-list (for [u all-perms
+                           g all-perms
+                           o all-perms]
+                       (str u g o))]
+      (loop [perms perms-list]
+        (when-not (empty? perms)
+          (let [tmp-file (fs/temp-name "ca-file-perms-test")
+                [init-perm change-perm] (take 2 perms)]
+            (create-file-with-perms tmp-file init-perm)
+            (set-file-perms tmp-file change-perm)
+            (is (= change-perm (get-file-perms tmp-file)))
+            (fs/delete tmp-file)
+            (recur (nthnext perms 2))))))))


cleaning up loops by calling close! on them. necessary? correct?

--- Clojure-Websockets/src/clj/birdwatch/persistence.clj
+++ Clojure-Websockets/src/clj/birdwatch/persistence.clj
@@ -18,7 +18,7 @@
    [clojurewerkz.elastisch.query            :as q]
    [clojurewerkz.elastisch.rest.response    :as esrsp]
    [com.stuartsierra.component :as component]
-   [clojure.core.async :as async :refer [<! <!! >! >!! chan put! alts! timeout go go-loop]]))
+   [clojure.core.async :as async :refer [<! <!! >! >!! chan put! alts! timeout go go-loop close!]]))

 (def conn (esr/connect (:es-address conf)))
 (def native-conn (esn/connect [["127.0.0.1" 9300]] {"cluster.name" "elasticsearch_mn"}))
@@ -129,7 +129,7 @@
              (put! query-results-chan {:uid (:uid q) :result result}))
            (recur)))

-(defrecord Persistence [conf channels]
+(defrecord Persistence [conf channels loops]
   ;; Implement the Lifecycle protocol
   component/Lifecycle

@@ -139,16 +139,14 @@
          ;; and start it running. For example, connect to a
          ;; database, create thread pools, or initialize shared
          ;; state.
-         (let []
-           (run-persistence-loop (:persistence channels))
-           (run-rt-persistence-loop (:rt-persistence channels))
-           (run-percolation-loop (:percolation channels) (:percolation-matches channels))
-           (run-find-missing-loop (:tweet-missing channels) (:missing-tweet-found channels))
-           (run-query-loop (:query channels) (:query-results channels))
-
+         (let [loops {:persistence (run-persistence-loop (:persistence channels))
+                      :rt-persistence (run-rt-persistence-loop (:rt-persistence channels))
+                      :percolation (run-percolation-loop (:percolation channels) (:percolation-matches channels))
+                      :find-missing (run-find-missing-loop (:tweet-missing channels) (:missing-tweet-found channels))
+                      :query (run-query-loop (:query channels) (:query-results channels))}]
            ;; Return an updated version of the component with
            ;; the run-time state assoc'd in.
-           (assoc component :connection conn)))
+           (assoc component :loops loops)))

   (stop [component]
         (log/info "Stopping Persistence Component")
@@ -158,7 +156,10 @@

         ;; Return the component, optionally modified. Remember that if you
         ;; dissoc one of a record's base fields, you get a plain map.
-        (assoc component :connection nil)))
+        (doseq [p-loop (vals loops)]
+          (close! p-loop))
+
+        (assoc component :loops nil)))

 (defn new-persistence [conf]
   (map->Persistence {:conf conf}))


Remove one reflection usage from lamba_util

--- resources/leiningen/new/aws_lambda_serverless/src/lambda_util.clj
+++ resources/leiningen/new/aws_lambda_serverless/src/lambda_util.clj
@@ -13,7 +13,7 @@
   []
   (let [^java.lang.ClassLoader class-loader (.getClassLoader (class manifest-version))
         ;; this causes reflection warning, but works
-        ^java.net.URL url (.findResource class-loader "META-INF/MANIFEST.MF")
+        ^java.net.URL url (.getResource class-loader "META-INF/MANIFEST.MF")
         manifest (when url (new Manifest (.openStream url)))
         attributes (when manifest (.getMainAttributes manifest))]
     (when attributes


reduce token lifetime to 1 day (#1214)

reduce token lifetime to 1 day (#1214)

--- token/src/com/sixsq/slipstream/auth/utils/timestamp.clj
+++ token/src/com/sixsq/slipstream/auth/utils/timestamp.clj
@@ -6,8 +6,7 @@
     [clj-time.coerce :as c]
     [clj-time.format :as f]))

-;; FIXME: Reduce this time to a resonable value.
-(def default-lifetime-minutes (* 7 24 60))                  ;; 1 week
+(def default-lifetime-minutes (* 24 60))                  ;; 1 day

 (def cookie-date-formatter (f/formatter "EEE, dd MMM yyyy HH:mm:ss z"))


add gauss-trig ugen from extras/bhob

add gauss-trig ugen from extras/bhob

--- src/overtone/sc/machinery/ugen/metadata/extras/bhob.clj
+++ src/overtone/sc/machinery/ugen/metadata/extras/bhob.clj
@@ -21,4 +21,9 @@
            {:name "res" :default 0 :doc "Resonance (0 -> 1)"}]
     :doc "Moog Filter."}

-   ])
+   {:name "GaussTrig"
+    :summary "Impulses around a certain frequency"
+    :args [{:name "freq" :default 440  :doc "mean frequency"}
+           {:name "dev" :default 0.3 :doc "random deviation from mean (0 <= dev < 1)"}]
+    :rates #{:ar :kr}
+    :doc "Impulses around a certain frequency"}])


order fns in recipe.clj

order fns in recipe.clj

--- src/whatsoup/recipe.clj
+++ src/whatsoup/recipe.clj
@@ -1,12 +1,6 @@
 (ns whatsoup.recipe
   (:require [clojure.set :as set]
             [clojure.spec.alpha :as spec]))
-
-
-(defn food? [x]
-  (and (keyword? x) (= "food" (namespace x))))
-(defn property? [x]
-  (and (keyword? x) (= "property" (namespace x))))

 ;; Recipes mainly consist of an ordered list of ingredient descriptors.
 ;; These specify one or more `properties` that the ingredient food(s) needs to satisfy.
@@ -26,6 +20,13 @@
                            :* [:any-of :property/gemüse :property/fleisch]]
                           ["Einlage" :* :property/knusprig]]})

+
+(defn food? [x]
+  (and (keyword? x) (= "food" (namespace x))))
+(defn property? [x]
+  (and (keyword? x) (= "property" (namespace x))))
+
+
 (spec/def ::food food?)
 (spec/def ::property property?)
 (spec/def ::food-or-property
@@ -44,6 +45,7 @@
 (spec/def :recipe/name string?)
 (spec/def ::recipe (spec/keys :req [:recipe/name :recipe/ingredients]))

+
 ;; Meals list their ingredient foods, which may be grouped by `role`.
 ;; Ingredients are listed in the same order as in the recipe.
 ;;


Expand and select project tree items

Expand and select project tree items

--- src/net/sekao/nightcode/projects.clj
+++ src/net/sekao/nightcode/projects.clj
@@ -54,4 +54,18 @@
 (defn update-project-tree! [state tree]
   (doto tree
     (.setShowRoot false)
-    (.setRoot (root-node state))))
+    (.setRoot (root-node state)))
+  (let [expansions (:expansion-set state)
+        selection (:selection state)
+        selection-model (.getSelectionModel tree)]
+    ; set expansions and selection
+    (doseq [i (range) :while (< i (.getExpandedItemCount tree))]
+      (let [item (.getTreeItem tree i)
+            path (-> item .getValue .getCanonicalPath)]
+        (when (contains? expansions path)
+          (.setExpanded item true))
+        (when (= selection path)
+          (.select selection-model item))))
+    ; select the first project if there is nothing selected
+    (when (= -1 (.getSelectedIndex selection-model))
+      (.select selection-model (int 0)))))


Don't require user to bring Component into their project.

--- src/onyx/coordinator/distributed.clj
+++ src/onyx/coordinator/distributed.clj
@@ -46,3 +46,9 @@
 (defn coordinator-server [opts]
   (map->CoordinatorServer {:opts opts}))

+(defn start-distributed-coordinator [opts]
+  (component/start (coordinator-server opts)))
+
+(defn stop-distributed-coordinator [coordinator]
+  (component/stop coordinator))
+


Improve peer group handling for outdated commands

--- src/onyx/peer/peer_group_manager.clj
+++ src/onyx/peer/peer_group_manager.clj
@@ -164,13 +164,19 @@
           state
           (keys peer-owners)))

-(defmethod action :restart-peer [state [type peer-owner-id]]
-  (-> state
-      (action [:stop-peer peer-owner-id])
-      (action [:start-peer peer-owner-id])))
+(defmethod action :restart-peer [{:keys [peer-owners] :as state} [type peer-owner-id]]
+  (assert peer-owner-id)
+  (if (get peer-owners peer-owner-id)
+    (-> state
+        (action [:stop-peer peer-owner-id])
+        (action [:start-peer peer-owner-id]))
+    state))

 (defmethod action :restart-vpeer [{:keys [peer-owners] :as state} [type peer-id]]
-  (action state [:restart-peer (get (clojure.set/map-invert peer-owners) peer-id)]))
+  (assert peer-id)
+  (if-let [peer-owner (get (clojure.set/map-invert peer-owners) peer-id)]
+    (action state [:restart-peer peer-owner])
+    state))

 (defmethod action :add-peer [state [type peer-owner-id]]
   (if-not (get-in state [:peer-owners peer-owner-id])


Simplify even more, remove comm-chan

Simplify even more, remove comm-chan

--- src/ecregister/core.clj
+++ src/ecregister/core.clj
@@ -24,39 +24,30 @@
                                                ))
                        "span"]])]

-    (defn stop-listening [active-chan comm-chan log-widget te-name]
+    (defn stop-listening [active-chan keys-chan log-widget te-name]
       (log log-widget "Stopping listening\n")
       (go
        (if (<! active-chan)
          (do
-           (if-let [ c (<! comm-chan)]
-             (do
-               (log log-widget "closed keys channel from comm-chanel\n")
-               (close! c)
-               (>! active-chan false)
-               )
-             )
-           (log log-widget (str "SENDING " (text te-name) "\n"))
-           )
+           ;; important to put it back to channel immediately so others could read
+           (>! active-chan false)
+           (log log-widget (str "SENDING " (text te-name) "\n")))
          (log log-widget "read false from active chan")
          ))
       )
-    (defn start-listening [active-chan comm-chan log-widget te-name]
+    (defn start-listening [active-chan keys-chan log-widget te-name]
       (log log-widget "Starting listening\n")
       (go
-       (>! comm-chan (chan 1))
        (>! active-chan true)
        (loop []
-         (let [keys-chan (<! comm-chan)]
-           (>! comm-chan keys-chan)
-           (let [[v ch] (alts! [keys-chan (timeout 1000)])]
-             (if (not (blank? v))
-               (recur)
-               (do
-                 (log log-widget "timeout reached\n")
-                 (stop-listening active-chan comm-chan log-widget te-name))
-               ))
-           ))))
+         (let [[v ch] (alts! [keys-chan (timeout 800)])]
+              (if (not (blank? v))
+                (recur)
+                (do
+                  (log log-widget "timeout reached\n")
+                  (stop-listening active-chan keys-chan log-widget te-name))
+                ))
+         )))

     ;; It is important in this scheme to return value to the channel as soon as it had been read:
     ;; so that others interested can read back
@@ -64,7 +55,7 @@
     (let [te-name (select form [:#username])
           lb-log (select form [:#log])
           active-chan (chan 1)
-          comm-chan (chan 1)]
+          keys-chan (chan 1)]
       (listen te-name
               :focus-gained (fn [e]
                               (put! active-chan false)
@@ -74,20 +65,18 @@
                           (go
                            (if (<! active-chan)
                              (do
+                               ;; important to put it back to channel immediately so others could read
                                (>! active-chan true)
-                               (log lb-log "in active mode, sending keypress\n")
-                               (let [keys-chan (<! comm-chan)]
-                                 (>! comm-chan keys-chan)
-                                 (>! keys-chan "1")
-                                 ))
+                               (>! keys-chan "1")
+                               )
                              (do
-                               (log lb-log "in not-active mode, initiating listening\n")
-                               (start-listening active-chan comm-chan lb-log te-name))
+                               ;(log lb-log "in not-active mode, initiating listening\n")
+                               (start-listening active-chan keys-chan lb-log te-name))
                              ))
                           )
               :focus-lost (fn [e]
-                            (log lb-log "focus lost, stopping\n")
-                            (stop-listening active-chan comm-chan lb-log te-name)
+                            ;(log lb-log "focus lost, stopping\n")
+                            (stop-listening active-chan keys-chan lb-log te-name)
                             )
               )


Changed paths for laptop

Changed paths for laptop

--- src/ecregister/core.clj
+++ src/ecregister/core.clj
@@ -24,10 +24,10 @@
   (apply swap! state assoc args))
 (defn reset-state []
   (reset! state {:stamp-type :bottom
-                :stamp-path {:bottom "/home/dimka/free-away/avatars/stamp_bot.png"
-                             :top    "/home/dimka/free-away/avatars/stamp_top.png"}
-                :save-dir-orig "/home/dimka/free-away/avatars/orig/"
-                :save-dir-new "/home/dimka/free-away/avatars/new/"
+                :stamp-path {:bottom "/home/dima/projects/free-away/avatars/stamp_bot.png"
+                             :top    "/home/dima/projects/free-away/avatars/stamp_top.png"}
+                :save-dir-orig "/home/dima/projects/free-away/avatars/orig/"
+                :save-dir-new "/home/dima/projects/free-away/avatars/new/"
                 }))

 (defn update-stamped-image [form]


1.3-ifying examples.string

1.3-ifying examples.string

--- src/examples/string.clj
+++ src/examples/string.clj
@@ -1,6 +1,6 @@
 (ns examples.string
-  (:require [clojush] [clojure.contrib.math])
-  (:use [clojush] [clojure.contrib.math]))
+  (:use [clojush]
+	[clojure.math.numeric-tower]))

 ; Tries to get a string with the most unique characters. If there are at least goal, succeeds.
 #_(pushgp :error-function (fn [program]
@@ -34,7 +34,7 @@
                        1)
                     s1
                     s2))
-     (Math/abs (- (count s1) (count s2)))))
+     (abs (- (count s1) (count s2)))))

 (defn string-remove-char
   "Returns s with first instrance of c removed, if c is in s. Otherwise, returns nil"
@@ -42,8 +42,8 @@
   (if (empty? s)
     nil
     (if (= (first s) c)
-      (clojure.contrib.string/drop 1 s)
-      (let [remain (string-remove-char (clojure.contrib.string/drop 1 s) c)]
+      (.substring s 1 (count s))
+      (let [remain (string-remove-char (.substring s 1 (count s)) c)]
         (if (nil? remain)
           nil
           (str (first s) remain))))))
@@ -57,8 +57,8 @@
     (let [first-char (first s1)
           remove-from-s2 (string-remove-char s2 first-char)]
       (if (nil? remove-from-s2)
-        (inc (string-char-counts-difference (clojure.contrib.string/drop 1 s1) s2))
-        (string-char-counts-difference (clojure.contrib.string/drop 1 s1) remove-from-s2)))))
+        (inc (string-char-counts-difference (.substring s1 1 (count s1)) s2))
+        (string-char-counts-difference (.substring s1 1 (count s1)) remove-from-s2)))))

 (define-registered in
@@ -81,7 +81,7 @@
                                                                      (push-item input :string
                                                                                (make-push-state))))
                                     top-string (top-item :string final-state)
-                                    desired-output (let [short (clojure.contrib.string/butlast 2 input)]
+                                    desired-output (let [short (.substring input 0 (max (- (count input) 2) 0))]
                                                      (str short short))]
                                 (if (not (string? top-string))
                                   1000


new version of derive column, seems to work for simple case but need improvement i guess

--- src/grafter/tabular.clj
+++ src/grafter/tabular.clj
@@ -209,6 +209,7 @@

 If no f is supplied the identity function is used, which results in
 the specified column being cloned."
+
   ([dataset new-column-name from-cols]
    (derive-column dataset new-column-name from-cols identity))
   ;; todo support multiple columns/arguments to f.
@@ -329,10 +330,10 @@
            val (:rows (all-columns dataset (arg->vector value-col)))
            table (zipmap keys val)]

-       (fn [row]
-         (let [key-names (map #(resolve-column-id dataset % "this column id doesn't exist!") (arg->vector key-cols))
-               lookup (zipmap key-names (map #(row %) key-names))
-               value-from-row (table lookup)]
+       (fn [key-cells]
+         (let [lookup (zipmap (arg->vector key-cols) (arg->vector key-cells))
+               value-from-row ((table lookup) value-col)
+               ]
            value-from-row)))))


project.clj

project.clj

--- re-view-template/project.clj
+++ re-view-template/project.clj
@@ -1,6 +1,6 @@
 (defproject re-view/lein-template "0.1.0-SNAPSHOT"
-  :description "FIXME: write description"
-  :url "http://example.com/FIXME"
+  :description "Template for creating re-view apps."
+  :url "https://www.github.com/re-view/re-view"
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :eval-in-leiningen true)


spit robots.txt

spit robots.txt

--- src/tamaki_core/server.clj
+++ src/tamaki_core/server.clj
@@ -21,9 +21,12 @@
   (cpy/copy)
   (page/compile-mds)
   (spit (io/file (io/file (-> (read-config) :dest)) "sitemap.xml")
-         (sitemap/create-sitemap (:page-dir (read-config)) (:post-dir (read-config)) (:url (read-config)))
+         (sitemap/create-sitemap (:page-dir (read-config)) (:post-dir (read-config)) (:url (read-config))))
+  (let [url (string/replace (:url (read-config)) #"([^/])$" "$1/")]
+    (spit (io/file (io/file (-> (read-config) :dest)) "robots.txt")
+          (str "User-agent: *\nSitemap: " url "sitemap.xml\nDisallow:" )))
   (page/gen-paginate-page (-> (read-config) :post-dir))
-  (page/compile-postmds (-> (read-config) :post-dir))))
+  (page/compile-postmds (-> (read-config) :post-dir)))

 (defn init [] (tcompile))


Default so-rcvbuf to max-size

Default so-rcvbuf to max-size

--- src/riemann/transport/udp.clj
+++ src/riemann/transport/udp.clj
@@ -163,7 +163,7 @@
          host  (get opts :host "127.0.0.1")
          port  (get opts :port 5555)
          max-size (get opts :max-size 16384)
-         so-rcvbuf (get opts :so-rcvbuf -1)
+         so-rcvbuf (get opts :so-rcvbuf max-size)
          channel-group (get opts :channel-group
                             (channel-group
                               (str "udp-server" host ":" port "(" max-size ")")))


CMR-5512 fix umm>isomends shortname mappings

--- umm-spec-lib/src/cmr/umm_spec/umm_to_xml_mappings/iso19115_2.clj
+++ umm-spec-lib/src/cmr/umm_spec/umm_to_xml_mappings/iso19115_2.clj
@@ -296,7 +296,8 @@
             [:gmd:identifier
               [:gmd:MD_Identifier
                 [:gmd:code (char-string (:ShortName c))]
-                [:gmd:version (char-string (:Version c))]]]
+                [:gmd:codeSpace (char-string "gov.nasa.esdis.umm.shortname")]
+                [:gmd:description (char-string "Short Name")]]]
             (generate-doi c)
             (when-let [collection-data-type (:CollectionDataType c)]
               [:gmd:identifier


command line println -> log/info

command line println -> log/info

--- src/main/clojure/pdok/featured/core.clj
+++ src/main/clojure/pdok/featured/core.clj
@@ -24,10 +24,10 @@
                     (processor/create persistence (config/projectors persistence)))]
     (with-open [s (file-stream json-file)]
       (let [consumed (consume processor (features-from-stream s :dataset dataset-name))]
-        (time (do (println "EVENTS PROCESSED: " (count consumed))
-                  (println "flushing.")
+        (time (do (log/info "Events processed:" (count consumed))
+                  (log/info "Shutting down.")
                   (shutdown processor))))))
-  (println "done.")
+  (log/info "done")
 )

 (def app (->(routes (api/rest-handler nil))
@@ -50,7 +50,7 @@
           features (features-from-stream json)
           consumed (consume processor features)
           ]
-      (time (do (println "EVENTS PROCESSED: " (count consumed))
+      (time (do (log/info "Events processed:" (count consumed))
                 (shutdown processor)
                 ))
       )))


decomp method added to decompress of all notes

--- src/notehub/storage.clj
+++ src/notehub/storage.clj
@@ -131,6 +131,14 @@
         (redis :sadd (str noteID :urls) url)
         url))))

+(defn decomp []
+    (let [ids (map first (partition 2 (redis :hgetall :note)))]
+        (doseq [id ids]
+            (do
+            (println id)
+            (redis :hset :note id (get-note id))
+            ))))
+
 (defn gc [password dry]
   (println (get-setting :admin-pw))
   (when (= password (get-setting :admin-pw))


Remove comment to fix tests

Remove comment to fix tests

Although init-state for mixins still has an open issue (and mentioned in
docstring), still recognize the method in macro.

--- src/om_tools/mixin.cljx
+++ src/om_tools/mixin.cljx
@@ -12,7 +12,7 @@
 #+clj
 (def ^:private mixin-methods
   {'display-name       :getDisplayName
-   ;;'init-state         :getInitialState
+   'init-state         :getInitialState
    'will-mount         :componentWillMount
    'did-mount          :componentDidMount
    'will-unmount       :componentWillUnmount


[fix] Show only alailible parts.

[fix] Show only alailible parts.

--- src/ombs/view/event.clj
+++ src/ombs/view/event.clj
@@ -26,7 +26,7 @@
   [:.name]   (h/content (str author "'s " name))
   [:.date]   (h/content (str date))
   [:.action] (partial acts/action-snip (acts/get-action event))
-  [:.parts] (partial fill-parts parts)
+  [:.parts] (partial fill-parts rest)
   [:.participants] (h/content (str (dbp/get-participants id))) ;TODO: remove str
   )


add handler

add handler

--- src/test_fb/handler.clj
+++ src/test_fb/handler.clj
@@ -1,2 +1,10 @@
 (ns test-fb.handler
-  )
+  (:require [ring.middleware.defaults :refer (wrap-defaults site-defaults secure-site-defaults)]
+            [ring.util.response :refer (not-found response)]
+            [taoensso.timbre :as log]
+            [clojure.string :refer (trim blank?)]
+            [clojure.java.io :as io]
+            ))
+
+(defn app [request]
+  (response "hello world"))


Slide is smart so no bounding necessary

Slide is smart so no bounding necessary

--- src/tile_game/board.clj
+++ src/tile_game/board.clj
@@ -55,12 +55,6 @@
 (defn- adjacent? [board p1 p2]
   (= 1 (coords/distance (tile->coords board p1) (tile->coords board p2))))

-(defn coord-add [board start delta]
-  (let [coords (coords/add start delta)]
-    (if (bounded-coords? board coords)
-      coords
-      start)))
-
 (defn slide-tile [board tile]
   (let [empty-pos (tile->index board 0)
         pos (tile->index board tile)]
@@ -72,7 +66,7 @@

 (defn slide-direction [board direction]
   (->> (dir-delta direction)
-       (coord-add board (tile->coords board 0))
+       (coords/add (tile->coords board 0))
        (coords->tile board)
        (slide-tile board)))


sanitized-ex-data: Use nil instead of empty map

--- src/overseer/worker.clj
+++ src/overseer/worker.clj
@@ -41,14 +41,14 @@
          (into {}))))

 (defn sanitized-ex-data [ex]
-  (filter-serializable (or (ex-data ex) {})))
+  (when-let [data (ex-data ex)]
+    (filter-serializable data)))

 (defn sentry-capture [dsn ex extra-info]
-  (let [extra-info' (or extra-info {})
-        ex-data' (sanitized-ex-data ex)
-        ex-map
+  (let [ex-map
         (-> {:message (.getMessage ex)
-             :extra (merge extra-info' ex-data')}
+             :extra (merge (or extra-info {})
+                           (or (sanitized-ex-data ex) {}))}
             (raven.interface/stacktrace ex))]
     (try (raven/capture dsn ex-map)
       (catch Exception ex'
@@ -72,13 +72,11 @@
   [config job]
   (fn [ex]
     (let [default-handler (->default-exception-handler config job)
-          sanitized (sanitized-ex-data ex)
-          failure-map (if (seq sanitized)
-                        sanitized
-                        {:overseer/status :failed
-                         :overseer/failure {:reason :system/exception
-                                            :exception (class ex)
-                                            :message (.getMessage ex)}})]
+          failure-map (or (sanitized-ex-data ex)
+                          {:overseer/status :failed
+                           :overseer/failure {:reason :system/exception
+                                              :exception (class ex)
+                                              :message (.getMessage ex)}})]
       (default-handler ex)
       failure-map)))


Attach cookie to wf status request

Attach cookie to wf status request

Attach the session cookie to the wf status request by setting
withCredentials value to true on xhr request.

--- src-cljs/frontend/api.cljs
+++ src-cljs/frontend/api.cljs
@@ -79,7 +79,8 @@
              "https://api.circleci.com/query"
              :workflow-status
              api-ch
-             :format :transit))
+             :format :transit
+             :with-credentials true))

 (defn get-user-plans [api-ch]
   (ajax/ajax :get "/api/v1/user/organizations/plans"


Pull more changes from pull request.  Make the file parsing function more readable.

--- src/timetracker/models.clj
+++ src/timetracker/models.clj
@@ -29,38 +29,42 @@
       (fields [:task :time :project_id :duration])
       (sort (array-map :time 1)))))

-(defn process-project [translation-regex code]
+(defn update-task-code [regex-mapping]
   (with-tasks [conn db coll]
     (mc/update db coll
-               {:task {$regex translation-regex}}
-               {$set {:project_id code}}
+               {:task {$regex (:regex regex-mapping)}}
+               {$set {:project_id (:code regex-mapping)}}
                {:multi true})))

-(defn process-file-line [[text code]]
-  (hash-map :text text :code code))
+(defn update-task-codes [regex-mappings]
+  (doseq [regex-mapping regex-mappings]
+    (update-task-code regex-mapping)))

-(defn read-project-file [filename]
+(defn parse-regex-mappings [filename]
   (with-open [rdr (clojure.java.io/reader filename)]
-    (doall (map process-file-line (map #(split % #" ")  (line-seq rdr))))))
+    (doall
+      (for [line (line-seq rdr)
+            :let [[text code] (split line #" ")]
+            :when (and text code)]
+        {:regex text :code code}))))

-(defn update-duration [id duration]
+(defn update-task-duration [id duration]
   (with-tasks [conn db coll]
     (mc/update db coll {:_id id} {$set {:duration duration}} )))

 (defn time-difference [time1 time2]
   (t/in-minutes (t/interval (t-c/from-date time1) (t-c/from-date time2))))

-(defn process-duration [tasks]
+(defn update-task-durations [tasks]
   (let [f (first tasks)
         s (second tasks)
         r (rest tasks)
         d (time-difference (:time f) (:time s))]
     (when (seq r)
-      (update-duration (:_id f) (str d))
-      (process-duration r))))
+      (update-task-duration (:_id f) (str d))
+      (update-task-durations r))))

 (defn process-tasks []
-  (doseq [x (read-project-file "bar.txt")]
-    (process-project (:text x) (:code x)))
-  (process-duration (find-all-tasks)))
+  (update-task-codes (parse-regex-mappings "bar.txt"))
+  (update-task-durations (find-all-tasks)))


add(clean): portfolio

add(clean): portfolio

--- src/portfolio/core.cljs
+++ src/portfolio/core.cljs
@@ -16,7 +16,10 @@

 (defn navbar []
-   [:h2 "HELLO"])
+   [:nav "HELLO"])
+
+(defn footer []
+   [:div.footer "2017"])

 (defn paragraph [ratom]
   (when (> (count (:text @ratom)) 0)
@@ -31,18 +34,14 @@
     [paragraph ratom]]))

 (defn project-card []
-  [:div.site-title "Site Title"])
+  [:div.site-title "My Blog"])

 (defn portfolio-app [props]
   [:div#header (navbar)
-   [:section.your-name
-     [:h4 "Type here: "]
-     (page app-state)]
    [:section.portfolio-app
-     [:h4 "My Blog"]
      [:div.card.card-1 (project-card)]]
-   [:div "Footer"]])
+   [:footer (footer)]])

 ;; -------------------------
 ;; Initialize app


Fix `conn-pool` unnecessary reflection (thanks harob)

--- src/taoensso/carmine/connections.clj
+++ src/taoensso/carmine/connections.clj
@@ -92,8 +92,12 @@
 (def ^:private pool-cache (atom {}))

 (defn conn-pool ^java.io.Closeable [opts & [cached?]]
-  (if (satisfies? IConnectionPool opts)
-    opts ; Pass through pre-made pools
+  (if (and (not (or (nil? opts) (map? opts)))
+           (or (instance? ConnectionPool opts)
+               (instance? NonPooledConnectionPool opts)
+               (satisfies? IConnectionPool opts) ; Slow, check last
+               ))
+    opts ; Pass through pre-made pools (Carmine v1 & custom pool support)
     (if-let [dp (and cached? (@pool-cache opts))]
       @dp
       (locking pool-cache ; Pool creation can be racey even with `delay`