Release version 0.9.10.0-beta6.

Release version 0.9.10.0-beta6.

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject onyx-cheat-sheet "0.9.10.0-SNAPSHOT"
+(defproject onyx-cheat-sheet "0.9.10.0-beta6"
   :description "Cheat sheet for Onyx"
   :url "https://github.com/onyx-platform/onyx-cheat-sheet"
   :license {:name "Eclipse Public License"
@@ -16,7 +16,7 @@
                  [compojure "1.4.0"]
                  [enlive "1.1.6"]
                  ^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}}
-                 [org.onyxplatform/onyx "0.9.10-beta5"]
+                 [org.onyxplatform/onyx "0.9.10-beta6"]
                  [prismatic/om-tools "0.4.0"]
                  [markdown-clj "0.9.77"]
                  [org.omcljs/om "0.9.0"]


up fun-utils

up fun-utils

--- project.clj
+++ project.clj
@@ -11,7 +11,7 @@
                 *assert* false}

   :dependencies [
-                  [fun-utils "0.3.6"]
+                  [fun-utils "0.4.0"]
                   [org.clojure/tools.logging "0.2.3"]
                   [org.iq80.snappy/snappy "0.3"]
                   [org.clojure/core.async "0.1.267.0-0d7780-alpha"]


Added criterium performance testing library and some options to enable performance testing and profiling.

--- project.clj
+++ project.clj
@@ -44,11 +44,27 @@
                          project-dependencies)
   :plugins [[lein-shell "0.4.0"]]
   :repl-options {:init-ns user}
+
+
   :jvm-opts ["-XX:PermSize=256m" "-XX:MaxPermSize=256m"]
+
+  ;; Uncomment this for performance testing or profiling
+  ; :jvm-opts ^:replace ["-server"
+  ;                      "-XX:PermSize=256m"
+  ;                      "-XX:MaxPermSize=256m"
+  ;                      ;; Use the following to enable JMX profiling with visualvm
+  ;                      ; "-Dcom.sun.management.jmxremote"
+  ;                      ; "-Dcom.sun.management.jmxremote.ssl=false"
+  ;                      ; "-Dcom.sun.management.jmxremote.authenticate=false"
+  ;                      ; "-Dcom.sun.management.jmxremote.port=1098"
+  ;                      ]
+
+
   :profiles
   {:dev {:dependencies [[org.clojure/tools.namespace "0.2.4"]
                         [org.clojars.gjahad/debug-repl "0.3.3"]
-                        [pjstadig/humane-test-output "0.6.0"]]
+                        [pjstadig/humane-test-output "0.6.0"]
+                        [criterium "0.4.3"]]
          :source-paths ["src" "dev" "test"]
          :injections [(require 'pjstadig.humane-test-output)
                       (pjstadig.humane-test-output/activate!)]}


update cljs -> 0.0-3149 and logback-classic -> 1.1.3

--- project.clj
+++ project.clj
@@ -5,11 +5,11 @@
             :url "http://www.eclipse.org/legal/epl-v10.html"}

   :dependencies [[org.clojure/clojure "1.7.0-alpha5"]
-                 [org.clojure/clojurescript "0.0-3126"]
+                 [org.clojure/clojurescript "0.0-3149"]
                  [org.clojure/core.async "0.1.346.0-17112a-alpha"]
                  [com.stuartsierra/component "0.2.3"]
                  [environ "1.0.0"]
-                 [ch.qos.logback/logback-classic "1.1.2"]
+                 [ch.qos.logback/logback-classic "1.1.3"]
                  [org.clojure/tools.logging "0.3.1"]

                  [ring/ring-core "1.3.2"]


Update dependencies

Update dependencies

--- project.clj
+++ project.clj
@@ -4,10 +4,10 @@
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.10.0"]
-                 [org.clojure/math.combinatorics "0.1.4"]
+                 [org.clojure/math.combinatorics "0.1.5"]
                  [org.clojure/math.numeric-tower "0.0.4"]
                  [dorothy "0.0.7"]]
   :profiles {:dev {:source-paths ["dev/src"]
                    :dependencies [[orchestra "2019.02.06-1"]
                                   [org.clojure/tools.namespace "0.2.11"]]
-                   :plugins [[lein-eftest "0.5.4"]]}})
+                   :plugins [[lein-eftest "0.5.7"]]}})


Update dependency.

Update dependency.

--- project.clj
+++ project.clj
@@ -121,7 +121,7 @@
         ;; Runs bikeshed, kibit and eastwood https://github.com/itang/lein-checkall
         [lein-checkall "0.1.1"]
         ;; pretty-print the lein project map https://github.com/technomancy/leiningen/tree/master/lein-pprint
-        [lein-pprint "1.2.0"]
+        [lein-pprint "1.3.2"]
         ;; Check for outdated dependencies https://github.com/xsc/lein-ancient
         [lein-ancient "0.6.15"]
         ;; Catch spelling mistakes in docs and docstrings https://github.com/cldwalker/lein-spell


0.19.0 release.

0.19.0 release.

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject active-clojure "0.19.0-SNAPSHOT"
+(defproject active-clojure "0.19.0"
   :description "Active Clojure: Various Clojure utilities in use at Active Group"
   :url "http://github.com/active-group/active-clojure"
   :license {:name "Eclipse Public License"


Version 0.4.68-SNAPSHOT

Version 0.4.68-SNAPSHOT

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject yetibot.core "0.4.67"
+(defproject yetibot.core "0.4.68-SNAPSHOT"
   :description "Core yetibot utilities, extracted for shared use among yetibot
                 and its various plugins"
   :url "https://github.com/yetibot/yetibot.core"


(SERVER-484) Update version to 2.0.0

(SERVER-484) Update version to 2.0.0

This commit bumps the version to the 2.0.0 identifier.

--- project.clj
+++ project.clj
@@ -1,7 +1,7 @@
 (def tk-version "1.0.1")
 (def tk-jetty-version "1.1.1")
 (def ks-version "1.0.0")
-(def ps-version "2.0.0-SNAPSHOT")
+(def ps-version "2.0.0")

 (defn deploy-info
   [url]


Version 29-SNAPSHOT

Version 29-SNAPSHOT

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject clojars-web "28"
+(defproject clojars-web "29-SNAPSHOT"
   :min-lein-version "2.0.0"
   :dependencies [[org.clojure/clojure "1.7.0"]
                  [org.clojure/tools.cli "0.2.1"]


lein-release plugin: preparing 0.4.1 release

--- project.clj
+++ project.clj
@@ -1,7 +1,7 @@
 (def ks-version "1.0.0")
 (def tk-version "1.0.1")

-(defproject puppetlabs/http-client "0.4.1-SNAPSHOT"
+(defproject puppetlabs/http-client "0.4.1"
   :description "HTTP client wrapper"
   :license {:name "Apache License, Version 2.0"
             :url "http://www.apache.org/licenses/LICENSE-2.0.html"}


thelmuth/check-GO-probabilities

thelmuth/check-GO-probabilities

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject lspector/clojush "1.3.34"
+(defproject lspector/clojush "1.3.35"
             :description "The Push programming language and the PushGP genetic
                           programming system implemented in Clojure.
                           See http://hampshire.edu/lspector/push.html"


CMR-5276 bumps sizing microversion

CMR-5276 bumps sizing microversion

--- project.clj
+++ project.clj
@@ -36,7 +36,7 @@
     [gov.nasa.earthdata/cmr-mission-control "0.1.0"]
     [gov.nasa.earthdata/cmr-ous-plugin "0.3.0-SNAPSHOT"]
     [gov.nasa.earthdata/cmr-site-templates "0.1.0"]
-    [gov.nasa.earthdata/cmr-sizing-plugin "0.2.1-SNAPSHOT"]
+    [gov.nasa.earthdata/cmr-sizing-plugin "0.2.2-SNAPSHOT"]
     [http-kit "2.3.0"]
     [markdown-clj "1.0.5"]
     [metosin/reitit-core "0.2.9"]


bump to wip6

bump to wip6

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject yieldbot/elephantdb "0.2.0-wip5"
+(defproject yieldbot/elephantdb "0.2.0-wip6"
   :source-path "src/clj"
   :java-source-path "src/jvm"
   :javac-options {:debug "true" :fork "true"}


lein-release plugin: bumped version from 0.25 to 0.26-SNAPSHOT for next development cycle

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject tyranitar "0.25"
+(defproject tyranitar "0.26-SNAPSHOT"
   :description "Tyranitar service"
   :url "http://wikis.in.nokia.com/NokiaMusicArchitecture/Tyranitar"


lein-release plugin: bumped version from 0.1.22 to 0.1.23-SNAPSHOT for next development cycle

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject yetibot.core "0.1.22"
+(defproject yetibot.core "0.1.23-SNAPSHOT"
   :description "Core yetibot utilities, extracted for shared use among yetibot
                 and its various plugins"
   :url "https://github.com/devth/yetibot.core"


Suppress warnings when doing doc, etc.

Suppress warnings when doing doc, etc.

--- planck-cljs/src/planck/repl.cljs
+++ planck-cljs/src/planck/repl.cljs
@@ -985,12 +985,13 @@

 (defn- get-var
   [env sym]
-  (let [var (or (with-compiler-env st (resolve-var env sym))
-                (some #(get-macro-var env sym %) (all-macros-ns)))]
-    (when var
-      (if (= (namespace (:name var)) (str (:ns var)))
-        (update var :name #(symbol (name %)))
-        var))))
+  (binding [ana/*cljs-warning-handlers* nil]
+    (let [var (or (with-compiler-env st (resolve-var env sym))
+                  (some #(get-macro-var env sym %) (all-macros-ns)))]
+      (when var
+        (if (= (namespace (:name var)) (str (:ns var)))
+          (update var :name #(symbol (name %)))
+          var)))))

 (defn- get-file-source
   [filepath]


photos display

photos display

--- rn-app/src/cljs/meo/ui/photos.cljs
+++ rn-app/src/cljs/meo/ui/photos.cljs
@@ -1,6 +1,7 @@
 (ns meo.ui.photos
   (:require [reagent.core :as r]
-            [meo.ui.shared :refer [view text touchable-highlight cam-roll scroll]]
+            [meo.ui.shared :refer [view text touchable-highlight cam-roll
+                                   scroll map-view mapbox-style-url image]]
             [re-frame.core :refer [reg-sub subscribe]]))

 (def defaults {:background-color "lightgreen"
@@ -13,9 +14,7 @@
 (defn photos-page [local put-fn]
   [scroll {:style {:flex-direction "column"
                    :padding-top    10
-                   :padding-bottom 10
-                   :padding-left   10
-                   :padding-right  10}}
+                   :padding-bottom 10}}

    [view {:style {:flex-direction "row"
                   :padding-top    10
@@ -24,7 +23,7 @@
                   :padding-right  10}}
     [touchable-highlight
      {:style    defaults
-      :on-press #(let [params (clj->js {:first     100
+      :on-press #(let [params (clj->js {:first     20
                                         :assetType "All"})
                        photos-promise (.getPhotos cam-roll params)]
                    (.then photos-promise
@@ -37,18 +36,39 @@
       "get photos"]]]

    (for [photo (:edges (:photos @local))]
-     [view {:style {:padding-top    10
-                    :padding-bottom 10
-                    :padding-left   10
-                    :padding-right  10}}
-      [text {:style {:color       "#777"
-                     :text-align  "center"
-                     :font-size   10
-                     :font-weight "bold"}}
-       (str photo)]])
+     (let [node (:node photo)
+           loc (:location node)
+           img (:image node)]
+       [view {:style {:padding-top    10
+                      :padding-bottom 10
+                      :margin-bottom  10
+                      :width          "100%"
+                      :display        :flex
+                      :flex-direction :row}}
+        [image {:style  {:width     160
+                         :height    160
+                         :max-width 160
+                         :max-height 160}
+                :source {:uri (:uri img)}}]
+        (when (:latitude loc)
+          [map-view {:showUserLocation true
+                     :centerCoordinate [(:longitude loc) (:latitude loc)]
+                     :scrollEnabled    false
+                     :rotateEnabled    false
+                     :styleURL         (get mapbox-style-url (:map-style @local))
+                     :style            {:width  200
+                                        :flex   2
+                                        :height 160}
+                     :zoomLevel        15}])
+        #_[text {:style {:color       "#777"
+                         :text-align  "center"
+                         :width       150
+                         :font-size   10
+                         :font-weight "bold"}}
+           (str (:uri img))]]))

    [text {:style {:color       "#777"
                   :text-align  "center"
                   :font-size   10
                   :font-weight "bold"}}
-    (str (dissoc (:photos @local) :edges))]])+    (str (dissoc (:photos @local) :edges))]])


matcher-combinators: Add examples from documentation

--- test/com/nomistech/clojure_the_language/c_800_libraries/s_106_matcher_combinators/matcher_generators_test.clj
+++ test/com/nomistech/clojure_the_language/c_800_libraries/s_106_matcher_combinators/matcher_generators_test.clj
@@ -2,7 +2,8 @@
   (:require
    [clojure.test :refer [deftest is testing]]
    [matcher-combinators.matchers :as m]
-   [matcher-combinators.test]))
+   [matcher-combinators.test] ; adds support for `match?` and `thrown-match?` in `is` expressions
+   ))

 ;;;; ++use-of-mismatch++
 ;;;; We use `m/mismatch` to demo what would otherwise be failing tests.
@@ -75,3 +76,77 @@
   (is (thrown-match? clojure.lang.ExceptionInfo
                      {:foo 1}
                      (throw (ex-info "Boom!" {:foo 1 :bar 2})))))
+
+;;;; ___________________________________________________________________________
+
+;;;; From docs
+
+(deftest test-matching-with-explicit-matchers
+  (is (match? (m/equals 37) (+ 29 8)))
+  (is (match? (m/regex #"fox") "The quick brown fox jumps over the lazy dog")))
+
+(deftest test-matching-scalars
+  ;; most scalar values are interpreted as an `equals` matcher
+  (is (match? 37 (+ 29 8)))
+  (is (match? "this string" (str "this" " " "string")))
+  (is (match? :this/keyword (keyword "this" "keyword")))
+  ;; regular expressions are handled specially
+  (is (match? #"fox" "The quick brown fox jumps over the lazy dog")))
+
+(deftest test-matching-sequences
+  ;; A sequence is interpreted as an `equals` matcher, which specifies
+  ;; count and order of matching elements. The elements, themselves,
+  ;; are matched based on their types.
+  (is (match? [1 3] [1 3]))
+  (is (match? [1 odd?] [1 3]))
+  (is (match? [#"red" #"violet"] ["Roses are red" "Violets are ... violet"]))
+
+  ;; use m/prefix when you only care about the first n items
+  (is (match? (m/prefix [odd? 3]) [1 3 5]))
+
+  ;; use m/in-any-order when order doesn't matter
+  (is (match? (m/in-any-order [odd? odd? even?]) [1 2 3]))
+
+  ;; NOTE: in-any-order is O(n!) because it compares every expected element
+  ;; with every actual element in order to find a best-match for each one,
+  ;; removing matched elements from both sequences as it goes.
+  ;; Avoid applying this to long sequences.
+  )
+
+(deftest test-matching-sets
+  ;; A set is also interpreted as an `equals` matcher.
+  (is (match? #{1 2 3} #{3 2 1}))
+  (is (match? #{odd? even?} #{1 2}))
+  ;; use m/set-equals to repeat predicates
+  (is (match? (m/set-equals [odd? odd? even?]) #{1 2 3}))
+
+  ;; NOTE: matching sets is an O(n!) operation because it compares every
+  ;; expected element with every actual element in order to find a best-match
+  ;; for each one, removing matched elements from both sets as it goes.
+  ;; Avoid applying this to large sets.
+  )
+
+(deftest test-matching-maps
+  ;; A map is interpreted as an `embeds` matcher, which ignores
+  ;; un-specified keys
+  (is (match? {:name/first "Alfredo"}
+              {:name/first  "Alfredo"
+               :name/last   "da Rocha Viana"
+               :name/suffix "Jr."})))
+
+(deftest test-matching-nested-datastructures
+  ;; Maps, sequences, and sets follow the same semantics whether at
+  ;; the top level or nested within a structure.
+  (is (match? {:band/members [{:name/first "Alfredo"}
+                              {:name/first "Benedito"}]}
+              {:band/members [{:name/first  "Alfredo"
+                               :name/last   "da Rocha Viana"
+                               :name/suffix "Jr."}
+                              {:name/first "Benedito"
+                               :name/last  "Lacerda"}]
+               :band/recordings []})))
+
+(deftest exception-matching
+  (is (thrown-match? clojure.lang.ExceptionInfo
+                     {:foo 1}
+                     (throw (ex-info "Boom!" {:foo 1 :bar 2})))))


Rename to vis-svg-arrow.

Rename to vis-svg-arrow.

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -200,7 +200,7 @@

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

-(defn vis-arrow [class x1 y1 x2 y2 stroke]
+(defn vis-svg-arrow [class x1 y1 x2 y2 stroke]
   ["<line class='" class "' x1='" x1 "' y1='" y1 "' x2='" x2 "' y2='" y2
    "' stroke='" stroke "' stroke-width='1' marker-end='url(#triangle)'/>"])

@@ -241,17 +241,17 @@
                    [(case (:delta delta)
                       :put (when (get chs (:ch delta))
                              ["<g transform='translate(500," ay ")'>"
-                              (vis-arrow "delta" 0 0 100 (- cy ay) "green") "</g>"])
+                              (vis-svg-arrow "delta" 0 0 100 (- cy ay) "green") "</g>"])
                       :take (when (get chs (:ch delta))
                               ["<g transform='translate(600," cy ")'>"
-                               (vis-arrow "delta" 0 0 -100 (- ay cy)
+                               (vis-svg-arrow "delta" 0 0 -100 (- ay cy)
                                           (if (:msg delta) "green" "black")) "</g>"])
                       :actx-start (when (> childy line-height)
                                     ["<g transform='translate(30," ay ")'>"
-                                     (vis-arrow "delta" 0 0 30 (- childy ay) "green") "</g>"])
+                                     (vis-svg-arrow "delta" 0 0 30 (- childy ay) "green") "</g>"])
                       :actx-end (when (> childy line-height)
                                   ["<g transform='translate(60," childy ")'>"
-                                   (vis-arrow "delta" 0 0 -40 0 "black") "</g>"])
+                                   (vis-svg-arrow "delta" 0 0 -40 0 "black") "</g>"])
                       nil)
                     (when (:ch-name delta)
                       ["<text class='ch-name' x='540' y='" (* 0.5 (+ ay cy))


delete only takes id

delete only takes id

--- src/es/systems.clj
+++ src/es/systems.clj
@@ -49,8 +49,8 @@

 (defn delete
    "delete a system from ES"
-   [id system]
-  (doc/delete index "system" id system))
+   [id]
+  (doc/delete index "system" id))

 (defn get
    "Grabs a system by an id"


running exception-generator in alphabetical order of lexicon to make diagnosis by log messages easier

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -1325,10 +1325,10 @@
 (defn exception-generator [lexicon]
   (reduce
    concat
-   (map (fn [lexeme-kv]
-          (let [k (first lexeme-kv)
-                lexemes (second lexeme-kv)]
-            (if lexeme-kv
+   (map (fn [k]
+          (let [lexemes (get lexicon k)
+                lexeme-kv [k lexemes]]
+            (if lexemes
               (let [result (mapcat (fn [path-and-merge-fn]
                                      (let [path (:path path-and-merge-fn)
                                            surface-form-fn (if (:surface-form path-and-merge-fn)
@@ -1338,6 +1338,7 @@
                                            merge-fn (:merge-fn path-and-merge-fn)]
                                        ;; a lexeme-kv is a pair of a key and value. The key is a string (the word's surface form)
                                        ;; and the value is a list of lexemes for that string.
+                                       (log/debug (str "lexeme key:" k))
                                        (log/debug (str (first lexeme-kv) " generating exception for path: " path))
                                        (mapcat (fn [lexeme]
                                                  ;; this is where a unify/dissoc that supported
@@ -1617,7 +1618,7 @@
                                         :italiano {:agr {:number :plur}}})}
                                     ])]
                 result))))
-        lexicon)))
+        (sort (keys lexicon)))))

 (defn phonize2 [lexicon]
   (into {}


Let completion use the default printing

Let completion use the default printing

--- src/clj/reply/eval_modes/nrepl.clj
+++ src/clj/reply/eval_modes/nrepl.clj
@@ -101,8 +101,6 @@
     (execute-with-client
       client
       {:value (partial reset! results)
-       :out print
-       :err (constantly nil)
        :session session}
       (pr-str `(binding [*ns* (symbol ~(deref current-ns))] ~form)))
     (read-string @results)))


Destructure more

Destructure more

--- src/clj/reply/evaluation/nrepl.clj
+++ src/clj/reply/evaluation/nrepl.clj
@@ -10,11 +10,12 @@
 (defn execute-with-connection [connection form]
   (let [response-fn ((:send connection) form)]
     (reset! current-command response-fn)
-    (for [{:keys [ns] :as res} (nrepl/response-seq response-fn)]
+    (for [{:keys [ns value out err] :as res} (nrepl/response-seq response-fn)]
       (do
-        (when (:value res) (print (:value res)))
-        (when (:out res) (print (:out res)))
-        (when (:err res) (print (:err res)))
+        (when value (print value))
+        (when out (print out))
+        (when err (print err))
+        (flush)
         ns))))

 (defn run-repl


defthm is next

defthm is next

--- src/latte/prop.clj
+++ src/latte/prop.clj
@@ -18,8 +18,10 @@
 ;;   "Ex falso sequitur quolibet
 ;;    (proof by contradiction)."
 ;;   [[A :type]]
-;;   (--> absurd A)
-;;   :by (lambda [x : absurd] (absurd A)))
+;;   (--> absurd A))
+
+;; (proof ex-falso :term
+;;   (lambda [x : absurd] (absurd A)))

 (defterm neg
   "Logical negation."


Improved understandability of (load-facts) explanation of how to list all ns's

--- src/midje/repl.clj
+++ src/midje/repl.clj
@@ -91,7 +91,8 @@
                 :else
                 (do
                   (print (color/note (str "Loading " (str/join ", " (take 3 namespaces)))))
-                  (if (> (count namespaces) 3) (print (color/note "... (use :verbose) for more")))
+                  (when (> (count namespaces) 3)
+                    (print (color/note "... \nCall (load-facts :verbose) for a full list of loaded namespaces.")))
                   (println)))
           (report-check-group
            (dorun (map #(require % :reload) namespaces))))))


Don't retain heads in side-effectful iterations

Replace forms iterating over collections for the purpose of side-effects
with alternatives which don't retain heads of collections.

--- src/mount/core.clj
+++ src/mount/core.clj
@@ -119,8 +119,7 @@
   (let [done (atom [])]
     (->> states
          (sort-by (comp :order meta) order)
-         (map #(fun % (meta %) done))
-         doall)
+         (run! #(fun % (meta %) done)))
     @done))

 (defn- merge-lifecycles
@@ -160,17 +159,17 @@

 (defn stop [& states]
   (let [states (or states (find-all-states))
-        _ (doall (map unsub states))     ;; unmark substitutions marked by "start-with"
+        _ (run! unsub states)     ;; unmark substitutions marked by "start-with"
         stopped (bring states down >)]
-    (doall (map rollback! states))       ;; restore to origin from "start-with"
+    (run! rollback! states)       ;; restore to origin from "start-with"
     {:stopped stopped}))

 (defn stop-except [& states]
   (let [all (set (find-all-states))
         states (remove (set states) all)
-        _ (doall (map unsub states))     ;; unmark substitutions marked by "start-with"
+        _ (run! unsub states)     ;; unmark substitutions marked by "start-with"
         stopped (bring states down >)]
-    (doall (map rollback! states))       ;; restore to origin from "start-with"
+    (run! rollback! states)       ;; restore to origin from "start-with"
     {:stopped stopped}))

 (defn start-with-args [xs & states]
@@ -180,9 +179,8 @@
     (start)))

 (defn start-with [with]
-  (doall
-    (for [[from to] with]
-      (substitute! from to)))
+  (doseq [[from to] with]
+    (substitute! from to))
   (start))

 (defn start-without [& states]


minor fixes

minor fixes

--- src/unifn/core.clj
+++ src/unifn/core.clj
@@ -18,28 +18,23 @@
   (merge arg {:unifn/status :error
               :unifn/message (str "Could not resolve " f)}))

-
 (defn apply-fn [f arg]
-  (assoc
+  (assoc
    (cond->
-       (if-let [errors (s/explain-data (:unifn/fn f) arg)]
-         (merge arg
-                {:unifn/status :error
-                 :unifn/message (str "pre condition failed for " f)
-                 :unifn/problems errors})
-
-         (if (:unifn/safe? arg)
-           (try
-             (assoc (*apply-fn f arg) :unifn/event (:unifn/fn f))
-             (catch Exception e
-               (merge arg
-                      {:unifn/status :error
-                       :unifn/stacktrace (with-out-str (stacktrace/print-stack-trace e))})))
-           (assoc (*apply-fn f arg) :unifn/event (:unifn/fn f))))
+       (if (:unifn/safe? arg)
+         (try
+           (assoc (*apply-fn f arg) :unifn/event (:unifn/fn f))
+           (catch Exception e
+             (merge arg
+                    {:unifn/status :error
+                     :unifn/stacktrace (with-out-str (stacktrace/print-stack-trace e))})))
+         (assoc (*apply-fn f arg) :unifn/event (:unifn/fn f)))
      (:unifn/trace? arg) (update :unifn/trace (fn [x] (if x (conj x (:unifn/fn f)) [(:unifn/fn f)]))))
    :unifn/event (:unifn/fn f)))

-(s/def :unifn/pipe (s/keys :req [:unifn/pipe]))
+(s/def :unifn/pipe-cfg (s/keys :req [:unifn/pipe]))
+(s/def :unifn/pipe-arg (s/keys :req [:unifn/pipe]))
+
 (defmethod *apply-fn :unifn/pipe
   [f arg]
   (loop [[f & fs] (:unifn/pipe f)


Added test for not-empty?

Added test for not-empty?

--- test/cooljure/core_test.clj
+++ test/cooljure/core_test.clj
@@ -46,4 +46,9 @@
 (deftest not-empty-tst
   (testing "basic usage"
     (is (every?     not-empty? ["1" [1] '(1) {:1 1} #{1} ] ))
-    (is (not-any?   not-empty? ["" [] () '() {} #{} nil] )) ))
+    (is (not-any?   not-empty? ["" [] () '() {} #{} nil] ))
+
+    (is (= [true true true true true]
+            (map not-empty? ["1" [1] '(1) {:1 1} #{1} ] ) ))
+    (is (= [false false false false false false false ]
+            (map not-empty? ["" [] () '() {} #{} nil] ) ))))


Test for basic NN configuration with split and combine

--- test/cortex/wiring_test.clj
+++ test/cortex/wiring_test.clj
@@ -45,3 +45,15 @@
        (is (= 20 (output m)))
        (is (m/equals [] (input-gradient m))))))

+(deftest test-split-combine-network
+  (testing "Testing backprop with split and combine using addition"
+     (let [m (stack-module
+               [(layers/split [(layers/linear [[2 0 0] [0 2 0] [0 0 -1]] [0 0 0])
+                               (layers/linear [[2 0 0] [0 -2 0] [0 0 2]] [0 0 0])])
+                (layers/combine m/add (fn [inputs output] output))])
+           input [10 100 1000]
+           m (forward m input)
+           m (backward m input [1 1 1])]
+       (is (m/equals [40 0 1000] (output m)))
+       (is (m/equals [4 0 1] (input-gradient m))))))
+


cjl - Valid position helper

cjl - Valid position helper

--- src/icfp2015/board.clj
+++ src/icfp2015/board.clj
@@ -38,6 +38,9 @@
   (let [in-board? (fn [[x y]] (and (>= x 0) (< x width) (>= y 0) (< y height)))]
     (every? in-board? (:members current-unit))))

+(defn valid-position? [board]
+  (and (not (has-collision? board)) (current-unit-in-bounds? board)))
+
 ; these are possible commands
 ; [ [:move :west] [:move :east] [:move :southwest] [:move :southeast]
 ;   [:rotate :clockwise] [:rotate :counterclockwise] ]


fix indentation

fix indentation

--- src/java_time/data.clj
+++ src/java_time/data.clj
@@ -89,8 +89,8 @@

         {`p/nav  (fn [_ k v]
                    (case k
-                     :before? (.isBefore lt v)
-                     :after?  (.isAfter  lt v)
+                     :before?    (.isBefore lt v)
+                     :after?     (.isAfter  lt v)
                      :iso-format (.format DateTimeFormatter/ISO_TIME lt)
                      :format     (.format (dt-formatter v) lt)
                      nil))})))
@@ -112,8 +112,8 @@
                     :iso-format (.format DateTimeFormatter/ISO_DATE ld)
                     :format     (.format (dt-formatter v) ld)
                     :julian     (julian-field ld v)
-                    :instant  (-> (.atStartOfDay ld)
-                                  (.toInstant (or (zone-offset v) @system-offset)))
+                    :instant    (-> (.atStartOfDay ld)
+                                    (.toInstant (or (zone-offset v) @system-offset)))
                     :weekday    weekday
                     :year-month ym
                     nil))})))
@@ -198,10 +198,10 @@
                  :nano   epoch-nano}}
         {`p/nav (fn [_ k v]
                   (case k
-                    :before?    (.isBefore inst v)
-                    :after?     (.isAfter  inst v)
-                    :iso-format (.format DateTimeFormatter/ISO_INSTANT inst)
-                    :format     (.format ^DateTimeFormatter v inst)
+                    :before?         (.isBefore inst v)
+                    :after?          (.isAfter  inst v)
+                    :iso-format      (.format DateTimeFormatter/ISO_INSTANT inst)
+                    :format          (.format ^DateTimeFormatter v inst)
                     :local-time      (LocalTime/ofInstant      inst  (or (zone-id v) @system-zone))
                     :local-date      (LocalDate/ofInstant      inst  (or (zone-id v) @system-zone))
                     :local-datetime  (LocalDateTime/ofInstant  inst  (or (zone-id v) @system-zone))


fix up the identification of datetime fields in the `format-cell` function.

--- src/metabase/pulse.clj
+++ src/metabase/pulse.clj
@@ -151,7 +151,7 @@
 (defn- format-cell
   [value col]
   (cond
-    (instance? Date value) (format-timestamp (.getTime ^Date value) col)
+    (datetime-field? col) (format-timestamp (.getTime ^Date (u/->Timestamp value)) col)
     (and (number? value) (not (datetime-field? col))) (format-number value)
     :else (str value)))


Fixing the title setting in case of zero length ex title

--- src/ontrail/mutate.clj
+++ src/ontrail/mutate.clj
@@ -28,7 +28,7 @@
         duration (parse-duration (:duration user-ex))
         bare-ex {:duration duration
                  :sport (:sport user-ex)
-                 :title (if (> 0 (count (:title user-ex))) (:title user-ex) (:sport user-ex))
+                 :title (if (> (count (:title user-ex)) 0) (:title user-ex) (:sport user-ex))
                  :creationDate creation-date
                  :lastModifiedDate last-modified
                  :user user}


robust against nulls and non-numbers in db)

--- src/ontrail/weekly.clj
+++ src/ontrail/weekly.clj
@@ -52,9 +52,13 @@
     (mq/find {:user user :creationDate {:$gte start :$lte end}})
     (mq/sort {:lastModifiedDate 1})))

+(defn get-entry [coll kw]
+  (if (and (contains? coll kw) (not= nil (kw coll)) (number? (kw coll)))
+    (kw coll)
+    0))
+
 (defn accumulate [totals result]
-  (let [get-entry #(if (contains? %1 %2) (%1 %2) 0)
-        acc #(+ (get-entry totals %1) (get-entry result %2))
+  (let [acc #(+ (get-entry totals %1) (get-entry result %2))
         kw-all-distance (keyword "distance_Kaikki")
         kw-all-duration (keyword "duration_Kaikki")
         kw-sport-distance (keyword (str "distance_" (:sport result)))


display clip-count

display clip-count

--- src/pc/views/admin.clj
+++ src/pc/views/admin.clj
@@ -395,6 +395,10 @@
   [attr value]
   "")

+(defmethod render-cust-prop :cust/clips
+  [attr value]
+  (str (count value) ", " (count (filter :clip/important? value)) " important"))
+
 (defmethod render-cust-prop :google-account/avatar
   [attr value]
   [:img {:src value :width 100 :height 100}])


Add predicate for checking if coordinates are within a bounding box

--- src/rp/util/number.clj
+++ src/rp/util/number.clj
@@ -14,3 +14,8 @@
   [x]
   (and (number? x)
        (<= -90 x 90)))
+
+(defn within-bounding-box?
+  [[lng1 lat1 lng2 lat2] [longitude latitude]]
+  (and (<= lng1 longitude lng2)
+       (<= lat1 latitude lat2)))


Add docstring for `resolve`

Add docstring for `resolve`

--- src-cljs/frontend/send/resolve.cljs
+++ src-cljs/frontend/send/resolve.cljs
@@ -28,7 +28,46 @@
        (doto to (put! v) (close!)))))
   to)

-(defn resolve [env query-or-ast channel]
+(defn resolve
+  "Takes an env map, a query or a query ast, and a channel. Resolves the query
+  using the resolver functions in the map at `(:resolvers env)`, and streams the
+  results onto the channel. It's like a parser, but it's asynchronous, so it can
+  be used to fetch data from a server.
+
+  The resolver map is a map of query keys and sets of query keys to functions.
+  When the map key is a single query key, the function should resolve to the
+  value for that key. When the map key is a set of keys, the function should
+  resolve to a map giving a value to each of those query keys. (This makes it
+  easy to implement several query keys with a single function, rather than
+  writing it out multiple times.)
+
+  To resolve to a value, the function must return one of the following:
+
+  * The simple value,
+  * A (Promesa) promise of the value,
+  * A core.async channel which will carry the value (or several values) and then close, or
+  * A (Promesa) promise of such a channel.
+
+  A resolver function takes two args: the env map and the ast of the query node
+  that's being resolved.
+
+  resolve returns `channel` and will put the novelty onto that channel. The
+  novelty will come in pieces, streaming in as promises resolve (that is, as API
+  calls finish). Each piece of novelty will be in a form that matches the
+  original query, so it will be suitable to be merged into the app state using
+  that query. For instance, the query
+  `[{:app/current-user [:user/name :user/favorite-color]}] might yield the
+  following separate maps on the channel:
+
+  * `{:app/current-user {:user/name \"Sarah\"}`
+  * `{:app/current-user {:user/favorite-color :color/red}
+  * `nil` (channel closed)
+
+  Rather than wait for the entire query to be fulfilled, this allows the app to
+  display data as it becomes available.
+
+  See the tests for examples."
+  [env query-or-ast channel]
   (let [ast (if (vector? query-or-ast)
               (om/query->ast query-or-ast)
               query-or-ast)


Update data->tree for map -> ::entity

Update data->tree for map -> ::entity

--- test/tst/tupelo/forest.cljc
+++ test/tst/tupelo/forest.cljc
@@ -1241,8 +1241,7 @@
                                                :kids [#:tupelo.forest{:value 1, :index nil, :kids []}]}
                                #:tupelo.forest{:tag  :tupelo.forest/entry, :key :b,
                                                :kids [#:tupelo.forest{:tag  :tupelo.forest/entity, :index nil,
-                                                                      :kids [#:tupelo.forest{:tag  :tupelo.forest/entry,
-                                                                                :key  :c,
+                                                                      :kids [#:tupelo.forest{:tag  :tupelo.forest/entry, :key  :c,
                                                                                :kids [#:tupelo.forest{:value 3, :index nil, :kids []}]}]}]}]})
       (is= bush-3
         [#:tupelo.forest{:tag :tupelo.forest/entity, :index nil}


Made op-buf performance measurement tool

--- src/tree/messaging.clj
+++ src/tree/messaging.clj
@@ -16,8 +16,6 @@
 (defprotocol IOperation
   (affects-key [op] "Which key this affects--currently must be a single key")
   (apply-op [op tree] "Applies the operation to the tree"))
-
-(declare insert delete)

 (defrecord InsertOp [key]
   IOperation
@@ -70,7 +68,7 @@
                      [(subvec msgs 0 negative-binsearch-result) ;not found, exclusive
                       (subvec msgs negative-binsearch-result)]
                      [(subvec msgs 0 (inc binsearch-result)) ;found, inclusive
-                      (subvec (inc binsearch-result))])
+                      (subvec msgs (inc binsearch-result))])

                    on-the-last-child? (empty? children)

@@ -96,8 +94,34 @@
                  (recur children (conj rebuilt-children new-child) extra-msgs)))))))))

 (defn insert
-  (tree key)
+  [tree key]
   (enqueue tree [(->InsertOp key)]))
+
+(comment
+  (defn trial
+    []
+    (let [tree (-> (apply core/b-tree (range 10000))
+                (core/flush-tree)
+                :tree)
+          new-keys (repeatedly 30 #(- (rand-int 1000) 500))
+          reg (-> (reduce core/insert tree new-keys)
+                  (core/flush-tree)
+                  :stats
+                  :writes)
+          op-bufs (-> (reduce insert tree new-keys)
+                      (core/flush-tree)
+                      :stats
+                      :writes)]
+      (float (/ op-bufs reg))))
+
+
+  (let [trials (sort (repeatedly 100 trial))]
+    (println "avg" (/ (apply + trials) (count trials)))
+    (doseq [quantile [0 24 49 74 99]]
+      (println "Quantile" quantile "was" (nth trials quantile))
+      )
+    )
+  )

 (clojure.pprint/pprint
   (-> (apply core/b-tree (range 30))


Croak if there is not context in a panel

but we want to extract one

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/contrib/gui/editors/context_editor/context_editor.clj
+++ src/conexp/contrib/gui/editors/context_editor/context_editor.clj
@@ -300,7 +300,8 @@
     editor widget represented by the given panel."
     [panel]
     (let [widget (@panels panel)]
-      (when widget
+      (if-not widget
+        (unsupported-operation "There is no formal context in this panel")
         (get-context (get-ectx widget)))))

   (defn set-context-in-panel


CMR-1863 Updates ISO 19115-2 mapping to use char-string(-from).

--- 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
@@ -92,7 +92,7 @@
        [:gmd:measureIdentification
         [:gmd:MD_Identifier
          [:gmd:code
-          [:gco:CharacterString "PrecisionOfSeconds"]]]]
+          (char-string "PrecisionOfSeconds")]]]
        [:gmd:result
         [:gmd:DQ_QuantitativeResult
          [:gmd:valueUnit ""]
@@ -107,8 +107,8 @@
          [:gmi:identifier
           [:gmd:MD_Identifier
            [:gmd:code
-            [:gco:CharacterString (xpath "ShortName")]]
+            (char-string-from "ShortName")]
            [:gmd:description
-            [:gco:CharacterString (xpath "LongName")]]]]
-         [:gmi:description [:gco:CharacterString (xpath "Type")]]
+            (char-string-from "LongName")]]]
+         [:gmi:description (char-string-from "Type")]
          [:gmi:instrument {:gco:nilReason "not implemented"}]]])]]])


fix major bug caused by transitioning to deftype

--- src/duratom/core.clj
+++ src/duratom/core.clj
@@ -14,11 +14,6 @@

 (deftype Duratom
   [storage-backend underlying-atom lock release]
-
-  storage/IStorageBackend
-  (cleanup [_]
-    (storage/cleanup storage-backend)
-    (release true)) ;; the only place where this is called with an argument

   IAtom
   (swap [_ f]
@@ -82,7 +77,7 @@
   (.write w (-> dura class .getName))
   (.write w (format " 0x%x " (System/identityHashCode dura)))
   (.write w " {:status :ready, :val ")
-  (.write w (-> dura :underlying-atom deref pr-str))
+  (.write w (-> (.-underlying_atom dura) deref pr-str))
   (.write w "}")
   )

@@ -114,7 +109,10 @@
   "Convenience fn for cleaning up the persistent storage of a duratom.
   In absence of this fn, one would have to go via `duratom.backends`."
   [^Duratom dura]
-  (.cleanup dura))
+  (let [storage (.-storage_backend dura)
+        release (.-release dura)]
+    (storage/cleanup storage)
+    (release true)))

 (defn file-atom


Only allow one digit number input

Only allow one digit number input

--- src/sudoku/core.cljs
+++ src/sudoku/core.cljs
@@ -21,8 +21,10 @@
     :min 0
     :max 9
     :on-change (fn [e]
-                 (swap! board s/set-value-at coords
-                        (int (.-target.value e))))}])
+                 (let [new-value (.-target.value e)]
+                   (when (< (count (str new-value)) 2)
+                     (swap! board s/set-value-at coords
+                            (int new-value)))))}])

 (defn unchangeable-number [value]
   [:span.unchangeable value])


keys declarations added

keys declarations added


removed the rest of the references to client-id

--- src/frontend/server-interface.cljs
+++ src/frontend/server-interface.cljs
@@ -162,19 +162,18 @@
   (fn [id]
     (println "upload cancelled!")
     (let [current-uploads-info (:current-uploads-info @app-state/app-state)
-          uploads (:uploads @app-state/app-state)
-          client-id (.-clientid (get current-uploads-info id))]
+          uploads (:uploads @app-state/app-state)]
       (swap! app-state/app-state
              merge
              {:current-uploads-info (dissoc current-uploads-info id)
-              :uploads (dissoc uploads client-id)}))))
+              :uploads (dissoc uploads id)}))))

 (.on app-state/socket "track-order-change"
   (fn [track-order]
     (swap! app-state/app-state assoc :track-order (js->clj track-order))))

 (.on app-state/socket "upload-complete"
-  (fn [music-info track-order track-id-hashes client-id]
+  (fn [music-info track-order track-id-hashes]
     (println "Received upload-complete signal:"
              "music-info:" music-info
              "track-order:" track-order)


Get profiles.

Get profiles.

Again, via a fetch each time rather than stuffing them in the entity and
just reading the entity out.

--- src/kixi/hecuba/api/properties.clj
+++ src/kixi/hecuba/api/properties.clj
@@ -39,27 +39,31 @@
           devices)
     []))

+(defn- get-profiles [entity_id session]
+  (db/execute session (hayt/select :profiles (hayt/where [[= :entity_id entity_id]]))))
+
 (defn index-handle-ok [store ctx]
   (db/with-session [session (:hecuba-session store)]
-    (let [request (:request ctx)]
-      (let [coll (->> (db/execute session
-                                  (if-let [project_id (project_id-from ctx)]
-                                    (hayt/select :entities (hayt/where [[= :project_id project_id]]))
-                                    (hayt/select :entities)))
-                      (map #(assoc %
-                              :property_data (if-let [property_data (:property_data %)]
-                                               (-> property_data
-                                                   (json/parse-string keyword)
-                                                   tech-icons)
-                                               {})
-                              :photos (if-let [photos (:photos %)] (mapv (fn [p] (json/parse-string p keyword)) photos) [])
-                              :documents (if-let [docs (:documents %)] (mapv (fn [d] (json/parse-string d keyword)) docs) [])
-                              :devices (if-let [devices (:devices %)]
-                                         (property-devices (:id %) session))
-                              :href (format entity-resource (:id %)))))
-            scoll (sort-by :property_code coll)]
-        ;; (log/debugf "Properties: %s" scoll)
-        scoll))))
+    (let [request (:request ctx)
+          coll    (->> (db/execute session
+                                   (if-let [project_id (project_id-from ctx)]
+                                     (hayt/select :entities (hayt/where [[= :project_id project_id]]))
+                                     (hayt/select :entities)))
+                       (map #(assoc %
+                               :property_data (if-let [property_data (:property_data %)]
+                                                (-> property_data
+                                                    (json/parse-string keyword)
+                                                    tech-icons)
+                                                {})
+                               :photos (if-let [photos (:photos %)] (mapv (fn [p] (json/parse-string p keyword)) photos) [])
+                               :documents (if-let [docs (:documents %)] (mapv (fn [d] (json/parse-string d keyword)) docs) [])
+                               :devices (if-let [devices (:devices %)]
+                                          (property-devices (:id %) session))
+                               :profiles (get-profiles (:id %) session)
+                               :href (format entity-resource (:id %)))))
+          scoll   (sort-by :property_code coll)]
+      ;; (log/debugf "Properties: %s" scoll)
+      scoll)))

 (defresource index [store]
   :allowed-methods #{:get}


Fix hourly rollups.

Fix hourly rollups.

--- src/kixi/hecuba/data/calculate.clj
+++ src/kixi/hecuba/data/calculate.clj
@@ -98,7 +98,7 @@
                        "CUMULATIVE" (fn [measurements] (reduce + measurements))
                        "INSTANT"    (fn [measurements] (/ (reduce + measurements) (count measurements)))
                        "PULSE"      (fn [measurements] (reduce + measurements)))]
-    (when-not (and (empty? measurements) (empty? filtered))
+    (when-not (empty? filtered)
       (let [invalid (/ (count filtered) (count measurements))]
         (when-not (and (not= invalid 1) (> invalid 0.10))
           (upsert! commander :hourly-rollups {:value (str (funct filtered))


Change how we load template resources so it works from files and jars.

--- src/posthere/static_templating.clj
+++ src/posthere/static_templating.clj
@@ -14,7 +14,7 @@
   ["index" "faq" "terms" "privacy"])

 (defn partial-for [page-partial]
-  (slurp (str "src/" template-dir "_" page-partial ".html")))
+  (slurp (clojure.java.io/resource (str template-dir "_" page-partial ".html"))))

 (deftemplate layout-page layout [page-partial]
   ;; use Enlive to combine the layout and the page partial into a HTMl page


Use readable/value-string on all parts of output

--- src/structural_typing/preds.clj
+++ src/structural_typing/preds.clj
@@ -10,8 +10,8 @@
 (defn- should-be [format-string expected]
   #(format format-string,
            (oopsie/friendly-path %)
-           (pr-str expected)
-           (pr-str (:leaf-value %))))
+           (readable/value-string expected)
+           (readable/value-string (:leaf-value %))))

 (defn- compose-predicate [name pred fmt-fn]
   (->> pred


Replace postgres with mongo in the circle node group

--- src/circle/backend/nodes/circle.clj
+++ src/circle/backend/nodes/circle.clj
@@ -44,7 +44,7 @@
                                                      ;; reliability
                                                      :aptitude {:url "http://us.archive.ubuntu.com/ubuntu/"
                                                                 :scopes ["main" "natty-updates" "universe" "multiverse"]}) ;; TODO the natty is specific to 11.04, change later.
-                             (package/packages :aptitude ["nginx" "htop"])
+                             (package/packages :aptitude ["nginx" "htop" "mongodb"])
                              (java/java :sun :jdk)
                              (git/git)
                              (nginx/site "circle"
@@ -56,37 +56,17 @@
                                                                       "X-Forwarded-For" "\\$proxy_add_x_forwarded_for"
                                                                       "Host" "\\$http_host"}}])
                              (nginx/site "default" :action :disable)
-                             (service/service "nginx" :action :enable)
-                             (postgres/settings (postgres/settings-map {:permissions [{:connection-type "local" :database "all" :user "all" :auth-method "trust"}
-                                                                                {:connection-type "host" :database "all" :user "all" :ip-mask "127.0.0.1/32" :auth-method "trust"}
-                                                                                {:connection-type "host" :database "all" :user "all" :ip-mask "::1/128" :auth-method "trust"}]}))
-
-                             (postgres/postgres)
-                             (postgres/initdb)
-                             (postgres/hba-conf)
-                             (postgres/service :action :restart)
-                             (postgres/create-database "circleci")
+                             (service/service "nginx" :action :enable)
                              ;;users
                              (thread-expr/let->
                               [home (str "/home/" (-> session :user :username))]
-                              ;; (user/user "circle"
-                              ;;            :action :create
-                              ;;            :shell :bash
-                              ;;            :create-home true
-                              ;;            :groups #{"circle"})
                               (directory/directory  (str home "/.ssh/")
                                                    :create :action
-                                                   :path true
-                                                   ;; :owner "circle"
-                                                   ;; :group "circle"
-                                                   )
+                                                   :path true)
                               (ssh-key/install-key "ubuntu"
                                                    "id_rsa"
                                                    (slurp "www.id_rsa")
                                                    (slurp "www.id_rsa.pub"))
-                              ;; (ssh-key/authorize-key "circle"
-                              ;;                        (slurp "www.id_rsa.pub"))
-                              (pallet.crate.network-service/wait-for-port-listen 5432)
                               (lein/lein)
                               (remote-file/remote-file (str home "/.ssh/config") :content "Host github.com\n\tStrictHostKeyChecking no\n"
                                                        ;; :owner "circle"
@@ -94,10 +74,7 @@
                                                        :mode "644")
                               (directory/directory (str home "/.pallet/")
                                                    :create :action
-                                                   :path true
-                                                   ;; :owner "circle"
-                                                   ;; :group "circle"
-                                                   )
+                                                   :path true)
                               (remote-file/remote-file (str home "/.pallet/config.clj") :local-file "src/circle/pallet_config.clj" :no-versioning true))))}))

 (defn start


Make little refactoring on subscene source

--- src/clj/subman/sources/subscene.clj
+++ src/clj/subman/sources/subscene.clj
@@ -1,5 +1,6 @@
 (ns subman.sources.subscene
-  (:require [net.cgrand.enlive-html :as html]
+  (:require [swiss.arrows :refer [-<>>]]
+            [net.cgrand.enlive-html :as html]
             [subman.helpers :as helpers]
             [subman.const :as const]))

@@ -57,12 +58,12 @@

 (defn get-release-page-result
   "Get release page result"
-  [page] (->> (get-page-url page)
-              helpers/fetch
-              (#(html/select % [:table :td.a1 :a]))
-              (map #(-> %
-                        :attrs
-                        :href
-                        make-url))
-              set
-              (map create-subtitle)))
+  [page] (-<>> (get-page-url page)
+               helpers/fetch
+               (html/select <> [:table :td.a1 :a])
+               (map #(-> %
+                         :attrs
+                         :href
+                         make-url))
+               set
+               (map create-subtitle)))


Don't pass dispatch fn everywhere

Don't pass dispatch fn everywhere

--- src/cljs/asciinema_player/core.cljs
+++ src/cljs/asciinema_player/core.cljs
@@ -33,6 +33,9 @@
   "Returns Reagent atom with fresh player state."
   [& args]
   (atom (apply make-player args)))
+
+(defn dispatch [state event]
+  (put! (:event-ch state) event))

 (defn elapsed-time-since
   "Returns wall time (in seconds) elapsed since then."
@@ -120,7 +123,7 @@
   "The heart of the player. Coordinates dispatching of state update events like
   terminal line updating, time reporting and cursor blinking.
   Returns function which stops the playback and returns time of the playback."
-  [state dispatch]
+  [state]
   (let [start (js/Date.)
         start-at (:start-at state)
         speed (:speed state)
@@ -137,18 +140,18 @@
         (let [[v c] (alts! [screen-state-chan timer-chan cursor-blink-chan stop-playback-chan])]
           (condp = c
             timer-chan (let [t (+ start-at (elapsed-time))]
-                         (dispatch [:update-state assoc :current-time t])
+                         (dispatch state [:update-state assoc :current-time t])
                          (recur cursor-blink-chan))
             cursor-blink-chan (do
-                                (dispatch [:update-state assoc-in [:cursor :on] v])
+                                (dispatch state [:update-state assoc-in [:cursor :on] v])
                                 (recur cursor-blink-chan))
             screen-state-chan (if v
                                 (do
-                                  (dispatch [:update-state #(-> % (update-screen v) reset-blink)])
+                                  (dispatch state [:update-state #(-> % (update-screen v) reset-blink)])
                                   (recur (make-cursor-blink-chan)))
-                                (dispatch [:finished]))
+                                (dispatch state [:finished]))
             stop-playback-chan nil))) ; do nothing, break the loop
-      (dispatch [:update-state reset-blink]))
+      (dispatch state [:update-state reset-blink]))
     (-> state
         (update-screen (screen-state-at (:frames state) start-at))
         (assoc :stop stop-fn))))
@@ -165,12 +168,12 @@
   "Fetches asciicast JSON file, setting :loading to true at the start,
   dispatching :asciicast-response event on success, :bad-response event on
   failure."
-  [state dispatch]
+  [state]
   (let [url (:asciicast-url state)]
     (GET url
          {:response-format :raw
-          :handler #(dispatch [:asciicast-response %])
-          :error-handler #(dispatch [:bad-response %])})
+          :handler #(dispatch state [:asciicast-response %])
+          :error-handler #(dispatch state [:bad-response %])})
     (assoc state :loading true)))

 (defn new-position
@@ -180,16 +183,16 @@

 (defn handle-toggle-play
   "Toggles the playback. Fetches frames if they were not loaded yet."
-  [state dispatch]
+  [state]
   (if (contains? state :frames)
     (if (contains? state :stop)
       (stop-playback state)
-      (start-playback state dispatch))
-    (fetch-asciicast state dispatch)))
+      (start-playback state))
+    (fetch-asciicast state)))

 (defn handle-seek
   "Jumps to a given position (in seconds)."
-  [state dispatch [position]]
+  [state [position]]
   (let [new-time (* position (:duration state))
         screen-state (screen-state-at (:frames state) new-time)
         playing? (contains? state :stop)]
@@ -199,27 +202,27 @@
                         (assoc :current-time new-time :start-at new-time)
                         (update-screen screen-state))]
       (if playing?
-        (start-playback new-state dispatch)
+        (start-playback new-state)
         new-state))))

 (defn handle-rewind
   "Rewinds the playback by 5 seconds."
-  [state dispatch]
+  [state]
   (let [position (new-position (:current-time state) (:duration state) -5)]
-    (handle-seek state dispatch [position])))
+    (handle-seek state [position])))

 (defn handle-fast-forward
   "Fast-forwards the playback by 5 seconds."
-  [state dispatch]
+  [state]
   (let [position (new-position (:current-time state) (:duration state) 5)]
-    (handle-seek state dispatch [position])))
+    (handle-seek state [position])))

 (defn handle-finished
   "Prepares player to be ready for playback from the beginning. Starts the
   playback immediately when loop option is true."
-  [state dispatch]
+  [state]
   (when (:loop state)
-    (dispatch [:toggle-play]))
+    (dispatch state [:toggle-play]))
   (-> state
       (dissoc :stop)
       (assoc :start-at 0)
@@ -233,13 +236,13 @@

 (defn handle-speed-change
   "Alters the speed of the playback by applying change-fn to the current speed."
-  [change-fn state dispatch]
+  [change-fn state]
   (if-let [stop (:stop state)]
     (let [t (stop)]
       (-> state
           (update-in [:start-at] + t)
           (update-in [:speed] change-fn)
-          (start-playback dispatch)))
+          start-playback))
     (update-in state [:speed] change-fn)))

 (defn- fix-line-diff-keys [line-diff]
@@ -277,12 +280,12 @@
   {:lines (vt/compact-lines lines)
    :cursor cursor})

-(defmulti initialize-asciicast (fn [dispatch state asciicast]
+(defmulti initialize-asciicast (fn [state asciicast]
                                  (if (vector? asciicast)
                                    0
                                    (:version asciicast))))

-(defmethod initialize-asciicast 0 [dispatch state asciicast]
+(defmethod initialize-asciicast 0 [state asciicast]
   (let [frame-0-lines (-> asciicast first last :lines)
         width (->> frame-0-lines vals first (map #(count (first %))) (reduce +))
         height (count frame-0-lines)]
@@ -294,7 +297,7 @@
            :duration (reduce #(+ %1 (first %2)) 0 asciicast)
            :frames (build-v0-frames asciicast))))

-(defmethod initialize-asciicast 1 [dispatch state asciicast]
+(defmethod initialize-asciicast 1 [state asciicast]
   (assoc state
          :loading false
          :width (or (:width state) (:width asciicast))
@@ -303,27 +306,27 @@
          :duration (reduce #(+ %1 (first %2)) 0 (:stdout asciicast))
          :frames (build-v1-frames asciicast)))

-(defmethod initialize-asciicast :default [dispatch state asciicast]
+(defmethod initialize-asciicast :default [state asciicast]
   (throw (str "unsupported asciicast version: " (:version asciicast))))

 (defn handle-asciicast-response
   "Merges asciicast frames into player state, hides loading indicator and starts the
   playback."
-  [state dispatch [json]]
-  (dispatch [:toggle-play])
+  [state [json]]
+  (dispatch state [:toggle-play])
   (let [asciicast (-> json
                       js/JSON.parse
                       (util/faster-js->clj :keywordize-keys true))]
-    (initialize-asciicast dispatch state asciicast)))
-
-(defn handle-bad-response [state dispatch resp]
+    (initialize-asciicast state asciicast)))
+
+(defn handle-bad-response [state resp]
   (print "error fetching asciicast file:")
   (prn resp)
   (assoc state :loading false))

 (defn handle-update-state
   "Applies given function (with args) to the player state."
-  [state _ [f & args]]
+  [state [f & args]]
   (apply f state args))

 (def event-handlers {:toggle-play handle-toggle-play
@@ -339,9 +342,9 @@

 (defn process-event
   "Finds handler for the given event and applies it to the player state."
-  [state dispatch [event-name & args]]
+  [state [event-name & args]]
   (if-let [handler (get event-handlers event-name)]
-    (handler state dispatch args)
+    (handler state args)
     (do
       (print "unhandled event:" event-name)
       state)))
@@ -374,27 +377,28 @@
   [state]
   (let [events (chan)
         mouse-moves (chan (dropping-buffer 1))
-        user-activity (activity-chan mouse-moves 3000)
-        dispatch (fn [[event-name & args :as event]]
-                   (if (= event-name :mouse-move)
-                     (put! mouse-moves true)
-                     (put! events event))
-                   nil)]
+        user-activity (activity-chan mouse-moves 3000)]
     (go-loop []
-      (swap! state process-event dispatch (<! events))
-      (recur))
+      (let [[event-name & _ :as event] (<! events)]
+        (if (= event-name :mouse-move)
+          (put! mouse-moves true)
+          (swap! state process-event event))
+        (recur)))
     (go-loop []
       (swap! state assoc :show-hud (<! user-activity))
       (recur))
     (when (:auto-play @state)
-      (dispatch [:toggle-play]))
-    dispatch))
+      (put! events [:toggle-play]))
+    (swap! state assoc :event-ch events)))

 (defn create-player-with-state
   "Creates the player with given state, mounting top Reagent component in DOM."
   [state dom-node]
-  (let [dispatch (start-event-loop! state)]
-    (reagent/render-component [view/player state dispatch] dom-node)
+  (let [view-event-handler (fn [event]
+                             (dispatch @state event)
+                             nil)]
+    (start-event-loop! state)
+    (reagent/render-component [view/player state view-event-handler] dom-node)
     nil)) ; TODO: return JS object with control functions (play/pause) here

 (defn create-player


Do a better job of not leaking waypoints

--- src/cljs/comic_reader/ui/image.cljs
+++ src/cljs/comic_reader/ui/image.cljs
@@ -46,18 +46,21 @@
                                             (set-current-comic))})]
       (set-waypoints! [wp-up wp-down]))))

+(defn replace-waypoints [waypoints new-waypoints]
+  (doseq [wp waypoints]
+    (.destroy wp) )
+  new-waypoints)
+
 (defn comic-image [set-current-comic tag]
-  (let [waypoints (atom nil)]
+  (let [waypoints (atom nil)
+        set-waypoints! #(swap! waypoints replace-waypoints %)]
     (reagent/create-class
      {:display-name "comic-image"
       :component-did-mount
       (make-img-did-mount
-       #(reset! waypoints %)
+       set-waypoints!
        set-current-comic)
-      :component-will-unmount
-      (fn []
-        (map #(.destroy %) @waypoints)
-        (reset! waypoints nil))
+      :component-will-unmount #(set-waypoints! nil)
       :reagent-render
       (fn [_ tag]
         (if (= tag :loading)


adding key called for by reagant/react

adding key called for by reagant/react

--- src/cljs/early_vote_site/views.cljs
+++ src/cljs/early_vote_site/views.cljs
@@ -8,7 +8,7 @@

 (defn state-select-row
   [state]
-  [:option {:value (:fips-code state)} (:state-name state)])
+  [:option {:value (:fips-code state) :key (:fips-code state)} (:state-name state)])

 (def form
   [:form {:name "create-election-form" :class "form-inline"}


More notes on clojure.spec

More notes on clojure.spec

--- test/com/nomistech/clojure_the_language/c_200_clojure_basics/s_600_clojure_spec/ss_examples_from_clojure_org.clj
+++ test/com/nomistech/clojure_the_language/c_200_clojure_basics/s_600_clojure_spec/ss_examples_from_clojure_org.clj
@@ -27,3 +27,155 @@
   (fact (s/valid? #{:club :diamond :heart :spade} :club) => true)
   (fact (s/valid? #{:club :diamond :heart :spade} 42) => false)
   (fact (s/valid? #{42} 42) => true))
+
+;;;; ___________________________________________________________________________
+;;;; Registry
+
+;;;; Spec provides a central registry for globally declaring reusable specs.
+;;;; The registry associates a namespaced keyword with a specification.
+
+;;;; You will see later that registered specs can (and should) be used anywhere
+;;;; we compose specs.
+
+(s/def ::date inst?)
+(s/def ::suit #{:club :diamond :heart :spade})
+
+(fact (s/valid? ::date (Date.)) => true)
+(fact (s/conform ::suit :club) => :club)
+
+;;;; Once a spec has been added to the registry, doc knows how to find it and
+;;;; print it as well:
+
+;; (clojure.repl/doc ::date)
+;; =prints=>
+;; -------------------------
+;; :xxxx.yyyy.zzzz/date
+;; Spec
+;;   inst?
+;; => nil
+
+;;;; ___________________________________________________________________________
+;;;; Composing predicates
+
+;;;; The simplest way to compose specs is with `s/and` and `s/or`
+
+(s/def ::big-even
+  (s/and int?
+         even?
+         #(> % 1000)))
+
+(fact (s/valid? ::big-even :foo) => false)
+(fact (s/valid? ::big-even 10) => false)
+(fact (s/valid? ::big-even 100000) => true)
+
+(s/def ::name-or-id (s/or :name string?
+                          :id   int?))
+
+(fact (s/valid? ::name-or-id "abc") => true)
+(fact (s/valid? ::name-or-id 100) => true)
+(fact (s/valid? ::name-or-id :foo) => false)
+
+;;;; With `s/or`, each choice is annotated with a tag (here, between :name
+;;;; and :id) and those tags give the branches names that can be used to
+;;;; understand or enrich the data returned from conform and other spec
+;;;; functions.
+
+(fact (s/conform ::name-or-id "abc") => [:name "abc"])
+(fact (s/conform ::name-or-id 100) => [:id 100])
+
+;;;; ___________________________________________________________________________
+;;;; `s/nilable`
+
+;;;; Many predicates that check an instance’s type do not allow nil as a valid
+;;;; value (string?, number?, keyword?, etc). To include nil as a valid value,
+;;;; use the provided function `nilable` to make a spec:
+
+(fact (s/valid? string? nil) => false)
+(fact (s/valid? (s/nilable string?) nil) => true)
+
+;;;; ___________________________________________________________________________
+;;;; `s/explain`
+
+;;;; `explain` reports (to `*out*`) why a value does not conform to a spec.
+
+;; (s/explain ::suit 42)
+;; =prints=>
+;; val: 42 fails spec: ::suit predicate: #{:spade :heart :diamond :club}
+;; => nil
+
+;; (s/explain ::suit :club)
+;; =prints=>
+;; Success!
+;; => nil
+
+;; (s/explain ::big-even 5)
+;; =prints=>
+;; val: 5 fails spec: ::big-even predicate: even?
+
+;; (s/explain ::name-or-id :foo)
+;; =prints=>
+;; val: :foo fails spec: ::name-or-id at: [:name] predicate: string?
+;; val: :foo fails spec: ::name-or-id at: [:id] predicate: int?
+
+
+;; (s/explain-str ::suit 42)
+;; => "val: 42 fails spec: :xxxx.yyyy.zzzz//suit predicate: #{:spade :heart :diamond :club}\n"
+
+
+(fact (s/explain-data ::suit 42)
+  => {::s/problems [{:path []
+                  :pred #{:spade :heart :diamond :club}
+                  :val 42
+                  :via [::suit]
+                  :in []}]
+      ::s/spec ::suit
+      ::s/value 42})
+
+
+;;;; Temp notes on functions in Midje
+(fact [clojure.core/string?] => (just [(exactly clojure.core/string?)]))
+(fact {:a clojure.core/string?} => (just {:a (exactly clojure.core/string?)}))
+
+;; (s/explain-data ::name-or-id :foo)
+;; =>
+;; #:clojure.spec.alpha{:problems [{:path [:name]
+;;                                    :pred clojure.core/string?
+;;                                    :val :foo
+;;                                    :via [::name-or-id]
+;;                                    :in []}
+;;                                   {:path [:id]
+;;                                    :pred clojure.core/int?
+;;                                    :val :foo
+;;                                    :via [::name-or-id]
+;;                                    :in []}]
+;;                        :spec ::name-or-id
+;;                        :value :foo}
+
+(fact (s/explain-data ::name-or-id :foo)
+  =>
+  (just
+   {::s/problems (just
+                 [(just
+                   {:path [:name]
+                    ;; FIXME What's wrong here? (See temp notes above.)
+                    ;; :pred (exactly clojure.core/string?)
+                    :pred anything
+                    :val :foo
+                    :via [::name-or-id]
+                    :in []})
+                  (just
+                   {:path [:id]
+                    ;; FIXME What's wrong here? (See temp notes above.)
+                    ;; :pred (exactly clojure.core/int?)
+                    :pred anything
+                    :val :foo
+                    :via [::name-or-id]
+                    :in []})])
+    ::s/spec ::name-or-id
+    ::s/value :foo}))
+
+;;;; ___________________________________________________________________________
+;;;; TODO When you have finished going through https://clojure.org/guides/spec
+;;;;      take a look at Malcolm Sparks's blog post at
+;;;;      https://juxt.pro/blog/posts/parsing-with-clojure-spec.html
+;;;;      (and do so in a separate file).


Update pg driver

Update pg driver

--- integration-tests/apps/tx/project.clj
+++ integration-tests/apps/tx/project.clj
@@ -6,6 +6,6 @@
                  [com.h2database/h2 "1.3.160"]
                  [org.clojars.gukjoon/ojdbc "1.4"]
                  [mysql/mysql-connector-java "5.1.22"]
-                 [postgresql "9.0-801.jdbc4"]
+                 [postgresql "9.1-901.jdbc4"]
                  [net.sourceforge.jtds/jtds "1.2.4"]]
-  :immutant {:swank-port 4005})+  :immutant {:swank-port 4005})


Removed comment (it was wrong)

Removed comment (it was wrong)

--- lein-template/src/leiningen/new/modular/dev.clj
+++ lein-template/src/leiningen/new/modular/dev.clj
@@ -19,8 +19,6 @@
   "Create a development system"
   []
   (let [config (config)
-        ;; System can be referred to by dev 'tools' components (to help
-        ;; debugging)
         s-map (->
                (new-base-system-map config)
                (assoc


Update dialog to hide from screen readers when hidden

--- src/main/untangled/ui/elements.cljc
+++ src/main/untangled/ui/elements.cljc
@@ -462,13 +462,13 @@
           state        (when visible " is-active")
           user-classes (get props :className "")
           classes      (str user-classes " c-dialog" state (when full-screen " c-dialog--fullscreen"))
-          dialog-dom   (dom/div #js {:key (str key "-dialog") :className classes}
+          dialog-dom   (dom/div #js {:key (str key "-dialog") :className classes :aria-hidden (if visible false true)}
                          (dom/div #js {:className "c-dialog__card" :ref "dialogCard" :tabIndex (if visible 0 -1)}
             (when title title)
             (when content content)
                            (when actions actions)))]
       (if modal
-        (dom/div #js {:key key}
+        (dom/div #js {:key key :aria-hidden (if visible false true)}
           dialog-dom
           (dom/div #js {:onKeyPress (fn [evt] ; FIXME: This does not work
                                       (when (and visible onClose (untangled.events/escape-key? evt))


fix reflection warning.

fix reflection warning.

--- src/metabase/sync_database/sync.clj
+++ src/metabase/sync_database/sync.clj
@@ -10,9 +10,6 @@
             [metabase.models.raw-table :as raw-table]
             [metabase.models.table :as table]
             [metabase.util :as u]))
-
-
-(def ^:private ^:dynamic *sync-dynamic* false)

 (defn- save-fks!


Extracted intermediate downward-scale term.

--- src/overtunes/songs/variatio-12.clj
+++ src/overtunes/songs/variatio-12.clj
@@ -6,7 +6,8 @@
 (defn sum-n [series n] (reduce + (take n series)))
 (defn scale [intervals]
   #(if (neg? %)
-     (- ((scale (reverse intervals)) (- %)))
+     (let [downward-scale (comp - (scale (reverse intervals)))]
+       (-> % - downward-scale))
      (sum-n (cycle intervals) %)))

 (def major (scale [2 2 1 2 2 2 1]))


Removes env reader function since it is not used anymore

--- src/billbo/env.clj
+++ src/billbo/env.clj
@@ -1,7 +0,0 @@
-(ns billbo.env)
-
-(defn read-env [property-name]
-  (let [value (System/getenv property-name)]
-    (if (nil? value)
-      (throw (IllegalStateException. (str "Could not find property " property-name " in the environment")))
-      value)))


Alias clojure.pprint/print-table

Alias clojure.pprint/print-table

--- roles/clojure/files/profiles.clj
+++ roles/clojure/files/profiles.clj
@@ -35,6 +35,7 @@
                        ^:lazy cemerick.pomegranate/resources
                        ^:lazy clojure.java.shell/sh
                        ^:lazy clojure.pprint/pprint
+                       ^:lazy clojure.pprint/print-table
                        clojure.repl/apropos
                        clojure.repl/dir
                        clojure.repl/doc


remove useless target from link in menu

remove useless target from link in menu

--- src-cljs/frontend/components/document_access.cljs
+++ src-cljs/frontend/components/document_access.cljs
@@ -52,7 +52,7 @@
                  [:p.make
                   "Anything you prototype here will only be visible to you.
                   You can try to request access or even "
-                  [:a {:href "/new" :target "_self"} "create your own"]
+                  [:a {:href "/new"} "create your own"]
                   " document."]
                  [:a.menu-cta
                   {:on-click #(cast! :permission-requested {:doc-id doc-id})


Check type of a freesound sample before downloading

--- src/overtone/samples/freesound.clj
+++ src/overtone/samples/freesound.clj
@@ -13,6 +13,8 @@

 (def ^:dynamic *api-key* "47efd585321048819a2328721507ee23")

+(def supported-file-types ["wav" "aiff"])
+
 (defrecord-ifn FreesoundSample
   [id size n-channels rate status path args name freesound-id]
   samp/sample-player
@@ -86,9 +88,13 @@
   id. Returns the path to a cached local copy of the audio file."
   [id]
   (let [info (freesound-info id)
+        type (:type info)
         name (:original_filename info)
         url  (sound-serve-url id)]
-    (asset/asset-path url name)))
+    (if (or (not type)
+            (some #{type} supported-file-types))
+      (asset/asset-path url name)
+      (throw (Exception. (str "Invalid sample type: \"" type "\", only " supported-file-types " are supported."))))))

 (defn freesound-sample
   "Download, cache and persist the freesound audio file specified by


add refresh-on-search support with refresh parameter in the request settings

--- src/bzzz/index.clj
+++ src/bzzz/index.clj
@@ -137,8 +137,10 @@
   (use-writer index (fn [^IndexWriter writer] (.deleteAll writer))))

 (defn search
-  [& {:keys [index query page size explain]
-      :or {page 0, size 20, explain false}}]
+  [& {:keys [index query page size explain refresh]
+      :or {page 0, size 20, explain false refresh false}}]
+  (if refresh
+    (refresh-search-managers))
   (use-searcher index
                 (fn [^IndexSearcher searcher]
                   (let [ms-start (time-ms)


Put test dependencies where they belong

Put test dependencies where they belong


(MAINT) make tests less stupid

(MAINT) make tests less stupid

--- test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_test.clj
+++ test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_test.clj
@@ -77,6 +77,18 @@
       (assoc :ssl-cert "./dev-resources/config/jetty/ssl/certs/unauthorized.pem")
       (assoc :ssl-key "./dev-resources/config/jetty/ssl/private_keys/unauthorized.pem")))

+(def hello-path "/hi_world")
+(def hello-body "Hi World")
+(defn hello-handler
+  [req]
+  {:status 200 :body hello-body})
+
+(tk-core/defservice hello-webservice
+  [[:WebserverService add-ring-handler]]
+  (init [this context]
+        (add-ring-handler hello-handler hello-path)
+        context))
+
 (defn validate-ring-handler
   ([base-url config]
     (validate-ring-handler base-url config {:as :text} :default))
@@ -84,38 +96,28 @@
    (validate-ring-handler base-url config http-get-options :default))
   ([base-url config http-get-options server-id]
     (with-app-with-config app
-      [jetty9-service]
+      [jetty9-service
+       hello-webservice]
       config
-      (let [s                   (tk-app/get-service app :WebserverService)
-            add-ring-handler    (partial add-ring-handler s)
-            body                "Hi World"
-            path                "/hi_world"
-            ring-handler        (fn [req] {:status 200 :body body})]
-        (add-ring-handler ring-handler path {:server-id server-id})
-        (let [response (http-get
-                         (format "%s%s/" base-url path)
-                         http-get-options)]
-          (is (= (:status response) 200))
-          (is (= (:body response) body)))))))
+      (let [response (http-get
+                      (format "%s%s/" base-url hello-path)
+                      http-get-options)]
+        (is (= (:status response) 200))
+        (is (= (:body response) hello-body))))))

 (defn validate-ring-handler-default
   ([base-url config]
    (validate-ring-handler-default base-url config {:as :text}))
   ([base-url config http-get-options]
    (with-app-with-config app
-     [jetty9-service]
+     [jetty9-service
+      hello-webservice]
      config
-     (let [s                   (tk-app/get-service app :WebserverService)
-           add-ring-handler    (partial add-ring-handler s)
-           body                "Hi World"
-           path                "/hi_world"
-           ring-handler        (fn [req] {:status 200 :body body})]
-       (add-ring-handler ring-handler path)
-       (let [response (http-get
-                         (format "%s%s/" base-url path)
-                         http-get-options)]
-         (is (= (:status response) 200))
-         (is (= (:body response) body)))))))
+     (let [response (http-get
+                     (format "%s%s/" base-url hello-path)
+                     http-get-options)]
+       (is (= (:status response) 200))
+       (is (= (:body response) hello-body))))))

 (deftest basic-ring-test
   (testing "ring request over http succeeds"
@@ -156,18 +158,15 @@
       [jetty9-service]
       jetty-multiserver-plaintext-config
       (let [s                (tk-app/get-service app :WebserverService)
-            add-ring-handler (partial add-ring-handler s)
-            body             "Hi World"
-            path             "/hi_world"
-            ring-handler (fn [req] {:status 200 :body body})]
-        (add-ring-handler ring-handler path {:server-id :foo})
-        (add-ring-handler ring-handler path {:server-id :bar})
+            add-ring-handler (partial add-ring-handler s)]
+        (add-ring-handler hello-handler hello-path {:server-id :foo})
+        (add-ring-handler hello-handler hello-path {:server-id :bar})
         (let [response1 (http-get "http://localhost:8080/hi_world/" {:as :text})
               response2 (http-get "http://localhost:8085/hi_world/" {:as :text})]
           (is (= (:status response1) 200))
           (is (= (:status response2) 200))
-          (is (= (:body response1) body))
-          (is (= (:body response2) body)))
+          (is (= (:body response1) hello-body))
+          (is (= (:body response2) hello-body)))

         (testing "one jetty mbean container is registered per server"
           (is (= 2 (count (testutils/get-jetty-mbean-object-names))))))))
@@ -531,17 +530,12 @@
   (testing (str "request to Jetty fails with a 413 error if the request header "
                 "is too large and a larger one is not set")
     (with-app-with-config app
-      [jetty9-service]
+      [jetty9-service
+       hello-webservice]
       jetty-plaintext-config
-      (let [s                   (tk-app/get-service app :WebserverService)
-            add-ring-handler    (partial add-ring-handler s)
-            body                "Hi World"
-            path                "/hi_world"
-            ring-handler        (fn [req] {:status 200 :body body})]
-        (add-ring-handler ring-handler path)
-        (let [response (http-get "http://localhost:8080/hi_world" {:headers {"Cookie" absurdly-large-cookie}
-                                                                   :as      :text})]
-          (is (= (:status response) 413))))))
+      (let [response (http-get "http://localhost:8080/hi_world" {:headers {"Cookie" absurdly-large-cookie}
+                                                                 :as :text})]
+        (is (= (:status response) 413)))))

   (testing (str "request to Jetty succeeds with a large cookie if the request header "
                 "size is properly set")
@@ -562,17 +556,12 @@
 (deftest default-server-test
   (testing "handler added to user-specified default server if no server-id is given"
     (with-app-with-config app
-      [jetty9-service]
+      [jetty9-service
+       hello-webservice]
       default-server-config
-      (let [s                (tk-app/get-service app :WebserverService)
-            add-ring-handler (partial add-ring-handler s)
-            body             "Hi World"
-            path             "/hi_world"
-            ring-handler     (fn [req] {:status 200 :body body})]
-        (add-ring-handler ring-handler path)
-        (let [response (http-get "http://localhost:9000/hi_world")]
-          (is (= 200 (:status response)))
-          (is (= (:body response) body))))))
+      (let [response (http-get "http://localhost:9000/hi_world")]
+        (is (= 200 (:status response)))
+        (is (= (:body response) hello-body)))))

   (testing (str "exception thrown if user does not specify a "
                 "default server and no server-id is given")
@@ -580,12 +569,9 @@
       [jetty9-service]
       no-default-config
       (let [s                (tk-app/get-service app :WebserverService)
-            add-ring-handler (partial add-ring-handler s)
-            body             "Hi World"
-            path             "/hi_world"
-            ring-handler     (fn [req] {:status 200 :body body})]
+            add-ring-handler (partial add-ring-handler s)]
         (is (thrown? IllegalArgumentException
-                     (add-ring-handler ring-handler path)))))))
+                     (add-ring-handler hello-handler hello-path)))))))

 (deftest static-content-config-test
   (let [logback (slurp "./dev-resources/logback.xml")]
@@ -656,20 +642,17 @@
   (testing "request logging occurs when :access-log-config is configured"
     (with-app-with-config
       app
-      [jetty9-service]
+      [jetty9-service
+       hello-webservice]
       {:webserver {:port 8080
                    :access-log-config
                          "./dev-resources/puppetlabs/trapperkeeper/services/webserver/request-logging.xml"}}
-      (let [s (tk-app/get-service app :WebserverService)
-            add-ring-handler (partial add-ring-handler s)
-            ring-handler (fn [req] {:status 200 :body "Hello, World!"})]
-        (add-ring-handler ring-handler "/hello")
-        (http-get "http://localhost:8080/hello/")
-        ; Logging is done in a separate thread from Jetty and this test. As a result,
-        ; we have to sleep the thread to avoid a race condition.
-        (Thread/sleep 10)
-        (let [list (TestListAppender/list)]
-          (is (re-find #"\"GET /hello/ HTTP/1.1\" 200 13\n" (first list))))))))
+      (http-get "http://localhost:8080/hi_world/")
+      ; Logging is done in a separate thread from Jetty and this test. As a result,
+      ; we have to sleep the thread to avoid a race condition.
+      (Thread/sleep 10)
+      (let [list (TestListAppender/list)]
+        (is (re-find #"\"GET /hi_world/ HTTP/1.1\" 200 8\n" (first list)))))))

 (deftest graceful-shutdown-test
   (testing "jetty9 webservers shut down gracefully by default"
@@ -761,27 +744,21 @@
   (testing "SSLv3 is not supported by default"
     (with-app-with-config
       app
-      [jetty9-service]
+      [jetty9-service
+       hello-webservice]
       jetty-ssl-pem-config
-      (let [s                (tk-app/get-service app :WebserverService)
-            add-ring-handler (partial add-ring-handler s)
-            ring-handler     (fn [_] {:status 200 :body "Hello, World!"})]
-        (add-ring-handler ring-handler "/hello")
-        (is (thrown?
-              ConnectionClosedException
-              (http-get "https://localhost:8081/hello" (merge default-options-for-https-client
-                                                              {:ssl-protocols ["SSLv3"]})))))))
+      (is (thrown?
+           ConnectionClosedException
+           (http-get "https://localhost:8081/hi_world" (merge default-options-for-https-client
+                                                              {:ssl-protocols ["SSLv3"]}))))))
   (testing "SSLv3 is supported when configured"
     (with-test-logging
      (with-app-with-config
       app
-      [jetty9-service]
+      [jetty9-service
+       hello-webservice]
       (assoc-in jetty-ssl-pem-config [:webserver :ssl-protocols] ["SSLv3"])
-      (let [s (tk-app/get-service app :WebserverService)
-            add-ring-handler (partial add-ring-handler s)
-            ring-handler (fn [_] {:status 200 :body "Hello, World!"})]
-        (add-ring-handler ring-handler "/hello")
-        (let [response (http-get "https://localhost:8081/hello" (merge default-options-for-https-client
-                                                                       {:ssl-protocols ["SSLv3"]}))]
-          (is (= (:status response) 200))
-          (is (= (:body response) "Hello, World!"))))))))
+       (let [response (http-get "https://localhost:8081/hi_world" (merge default-options-for-https-client
+                                                                         {:ssl-protocols ["SSLv3"]}))]
+         (is (= (:status response) 200))
+         (is (= (:body response) "Hi World")))))))


Using map instead of mapv.

Using map instead of mapv.

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -147,8 +147,8 @@

 (defn vis-html-loop-state
   ([vis loop-state]
-     (interpose ", " (mapv (fn [x] [(vis-html-loop-state vis (first x) (second x))])
-                           loop-state)))
+     (interpose ", " (map (fn [x] [(vis-html-loop-state vis (first x) (second x))])
+                          loop-state)))
   ([vis name val]
      (let [name-parts (string/split (str name) #"-")]
        (cond (= "ch" (last name-parts)) [name " " (vis-html-ch vis val)]


Correct hash-map to (into {})

Correct hash-map to (into {})

--- src/rdf_path_examples/examples.clj
+++ src/rdf_path_examples/examples.clj
@@ -43,11 +43,10 @@
   [^Model examples]
   (if (.isEmpty examples)
     {}
-    (-> examples
-        model->json-ld
-        JsonUtils/fromString
-        (json-ld/compact example-context)
-        hash-map)))
+    (into {} (-> examples
+                 model->json-ld
+                 JsonUtils/fromString
+                 (json-ld/compact example-context)))))

 (defmulti generate-examples
   "Generate examples of RDF paths using the chosen selection method."


Indentation fix

Indentation fix

--- src/refactor_nrepl/find_symbol.clj
+++ src/refactor_nrepl/find_symbol.clj
@@ -94,8 +94,8 @@
                  (conj info
                        (.getCanonicalPath file)
                        (match file-content
-                              (first info)
-                              (second info))))]
+                         (first info)
+                         (second info))))]
     (when (seq locs) (map gather locs))))

 (defn- find-global-symbol [file ns var-name clj-dir]
@@ -135,8 +135,8 @@
                     var-name
                     (.getCanonicalPath (java.io.File. file))
                     (match file-content
-                           (first %)
-                           (second %)))
+                      (first %)
+                      (second %)))
              (find-nodes [top-level-form-ast]
                          #(and (#{:local :binding} (:op %))
                                (= local-var-name (-> % :name))


Refactor using suggestion from kibit

Refactor using suggestion from kibit

--- src/refactor_nrepl/ns/clean_ns.clj
+++ src/refactor_nrepl/ns/clean_ns.clj
@@ -32,8 +32,7 @@
   use-form)

 (defn- validate [ns-form]
-  (-> (get-ns-component ns-form :use)
-      assert-no-exclude-clause)
+  (assert-no-exclude-clause (get-ns-component ns-form :use))
   ns-form)

 (defn read-ns-form


More on hypergraph transversals

More on hypergraph transversals

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/contrib/experimental/min-hyp-trans.clj
+++ src/conexp/contrib/experimental/min-hyp-trans.clj
@@ -12,9 +12,29 @@

 ;;;

+(defn binomial [n k]
+  (prod i 1 k
+    (/ (- n (- k i))
+       i)))
+
 (defn all-contexts-by-type [p q]
   (let [bits (selections [0 1] (* p q))]
     (map #(make-context-from-matrix p q %) bits)))
+
+;;;
+
+(defn E-int [n m]
+  (sum q 0 m
+       (* (binomial m q)
+          (sum r 0 n
+               (* (binomial n r)
+                  (expt 2 (- (* r q)))
+                  (expt (- 1 (expt 2 (- r)))
+                        (- m q))
+                  (expt (- 1 (expt 2 (- q)))
+                        (- n r)))))))
+
+;;;

 (defn min-hypergraph-transversal? [ctx Q]
   (boolean
@@ -38,22 +58,22 @@
   (if (>= j k)
     (let [p (conj p (+ n 1))]
       (reduce *
-              1N
-              (map #(expt (- (expt 2N k) 1N k (- %))
+              1.0
+              (map #(expt (- (expt 2.0 k) 1.0 k (- %))
                           (- (nth p (+ % 1))
                              (nth p %)
-                             1N))
+                             1.0))
                    (range 0 (+ k 1)))))
     (reduce +
-            0N
+            0.0
             (map #(minhypt-sum$ n k (inc j) (conj p %))
                  (range (+ 1 (nth p j))
                         (+ n (- k) (+ j 1) 1))))))

 (defn minhypt-sum [n m k]
   (let [sums (minhypt-sum$ n k 0 [0])]
-    (* (reduce * 1N (range 1N (+ 1 k)))
-       (expt 2N (* n (- m k)))
+    (* (reduce * 1.0 (range 1.0 (+ 1 k)))
+       (expt 2.0 (* n (- m k)))
        sums)))

 (defn mean-minhypt-sum$ [n k j p]
@@ -75,12 +95,7 @@
   (* (reduce * 1.0 (range 1.0 (+ 1.0 k)))
      (mean-minhypt-sum$ n k 0.0 [0.0])))

-(defn binomial [n k]
-  (prod i 1 k
-    (/ (- n (- k i))
-       i)))
-
-(defn expected-number-of-proper-premises [n m]
+(defn E-pp [n m]
   (* (expt 0.5 n)
      (sum k 0 m
        (* (binomial (- m 1) k)


Clarify change with a comment.

Clarify change with a comment.

--- src/clucy/core.clj
+++ src/clucy/core.clj
@@ -143,7 +143,7 @@
      (let [m (-> (into {}
                    (for [f (.getFields document)]
                      [(keyword (.name f)) (.stringValue f)])))
-           fragments (highlighter m)
+           fragments (highlighter m) ; so that we can highlight :_content
            m (dissoc m :_content)]
        (with-meta
          m


only update package if its in def of the target project

--- src/leiningen/leinsync/packages.clj
+++ src/leiningen/leinsync/packages.clj
@@ -62,14 +62,18 @@
     (catch Exception e
       (m/info "**** [Error] when updating a file of the folder:" folder-name (.getMessage e)))))

+(defn should-update-package? [package target-projects-desc]
+  (contains? (set (get-in target-projects-desc package-def)) package))
+
 (defn update-package! [package target-project source-project-desc target-projects-desc]
-  (let [package-path (get-package-path package)]
-    (doseq [[folder-name src-package-files] (make-sync-work-unit package-path source-project-desc target-projects-desc)]
-      (delete-package-files-of-target-project target-project folder-name package-path)
-      (write-package-files-from-source-to-target-project folder-name package-path src-package-files target-project))))
+  (when (should-update-package? package target-projects-desc)
+    (m/info "\n* Update package" package "to the project" (str/upper-case target-project))
+    (let [package-path (get-package-path package)]
+      (doseq [[folder-name src-package-files] (make-sync-work-unit package-path source-project-desc target-projects-desc)]
+        (delete-package-files-of-target-project target-project folder-name package-path)
+        (write-package-files-from-source-to-target-project folder-name package-path src-package-files target-project)))))

 (defn update-packages! [packages source-project-desc target-projects-desc]
   (m/info "\n*********************** UPDATE PACKAGES ***********************\n*")
   (doseq [[package target-project] packages]
-    (m/info "\n* Update package" package "to the project" (str/upper-case target-project))
     (update-package! package target-project source-project-desc ((keyword target-project) target-projects-desc))))


fix: linting and variable name

fix: linting and variable name

--- src/status_im/mailserver/core.cljs
+++ src/status_im/mailserver/core.cljs
@@ -529,13 +529,13 @@
              ;; instead of using pos?
              (not (zero? (:peers-count db))))
     (if-let [preferred-mailserver (preferred-mailserver-id db)]
-      (let [error-dismissed (connection-error-dismissed db)
+      (let [error-dismissed? (connection-error-dismissed db)
             current-fleet (node/current-fleet-key db)]
         ;; Error connecting to the mail server
         {:db
          (update-mailserver-state db :error)
          :ui/show-confirmation
-         (when-not error-dismissed
+         (when-not error-dismissed?
            {:title               (i18n/label :t/mailserver-error-title)
             :content             (i18n/label :t/mailserver-error-content)
             :confirm-button-text (i18n/label :t/mailserver-pick-another)
@@ -1179,12 +1179,12 @@
         mailserver-id (:mailserver/current-id db)
         pinned-mailservers (get-in db [:multiaccount :pinned-mailservers])]
     (fx/merge cofx
-      (multiaccounts.update/multiaccount-update
-        :pinned-mailservers (assoc pinned-mailservers
-                              current-fleet
-                              mailserver-id)
-        {})
-      (dismiss-connection-error false))))
+              (multiaccounts.update/multiaccount-update
+               :pinned-mailservers (assoc pinned-mailservers
+                                          current-fleet
+                                          mailserver-id)
+               {})
+              (dismiss-connection-error false))))

 (fx/defn load-gaps-fx [{:keys [db] :as cofx} chat-id]
   (when-not (get-in db [:gaps-loaded? chat-id])


disable forceBalance in demo editor at init

--- site/src/parinfer_site/core.cljs
+++ site/src/parinfer_site/core.cljs
@@ -286,7 +286,8 @@
     (editor-ui/render! :demo)
     (.setValue cm demo-example)
     (swap! state assoc-in [:demo :mode] :smart-mode)
-    (js/parinferCodeMirror.setMode cm "smart")))
+    (js/parinferCodeMirror.setMode cm "smart")
+    (js/parinferCodeMirror.setOptions cm #js{:forceBalance false})))

 (defn state-viewer
   [{:keys [postline-states cursor-line]} owner]


Windows doesn't support HUP signal, avoid registering a HUP handler on Windows.

--- src/io/cyanite.clj
+++ src/io/cyanite.clj
@@ -95,10 +95,11 @@
         (info "all components shut down")
         (System/exit 0))

-      (with-handler :hup
-        (info "caught SIGHUP, reloading")
-        (swap! system (comp component/start-system
-                            component/stop-system)))
+      (if (not (.contains (System/getProperty "os.name") "Windows"))
+        (with-handler :hup
+          (info "caught SIGHUP, reloading")
+          (swap! system (comp component/start-system
+                              component/stop-system))))

       (info "ready to start the system")
       (swap! system component/start-system)))


fix up some indenting and tweak return value of (execute-and-send) to return the :id of the EmailReportExecutions.

--- src/metabase/tasks/email_report.clj
+++ src/metabase/tasks/email_report.clj
@@ -27,18 +27,20 @@
                                                  (where {:id [in (subselect EmailReportRecipients
                                                                    (fields :user_id)
                                                                    (where {:emailreport_id report-id}))]}))))
-        query-execution (ins EmailReportExecutions
-                          :report_id report-id
-                          :organization_id (:organization_id email-report)
-                          :details email-report
-                          :status "running"
-                          :created_at (u/new-sql-timestamp)
-                          :started_at (u/new-sql-timestamp)
-                          :error ""
-                          :sent_email "")]
-    (log/debug (format "Starting EmailReport Execution: %d" (:id query-execution)))
-    (execute query-execution)
-    (log/debug (format "Finished EmailReport Execution: %d" (:id query-execution)))))
+        report-execution (ins EmailReportExecutions
+                           :report_id report-id
+                           :organization_id (:organization_id email-report)
+                           :details email-report
+                           :status "running"
+                           :created_at (u/new-sql-timestamp)
+                           :started_at (u/new-sql-timestamp)
+                           :error ""
+                           :sent_email "")]
+    (log/debug (format "Starting EmailReport Execution: %d" (:id report-execution)))
+    (execute report-execution)
+    (log/debug (format "Finished EmailReport Execution: %d" (:id report-execution)))
+    ;; return the id of the report-execution
+    (:id report-execution)))

 (defn- execute


updated the mock request against root to include the X-Forwarded-Proto value of https #6

--- test/bitfondue/handler_test.clj
+++ test/bitfondue/handler_test.clj
@@ -4,6 +4,6 @@
   (:use midje.sweet))

 (fact "The root route / is returning a 200 status code"
-  (->> (mock/request :get "/")
+  (->> (mock/header (mock/request :get "/") "X-Forwarded-Proto" "https")
        app
        :status) => 200)


add transaction tables to reset logic

add transaction tables to reset logic

--- test/clj_money/test_helpers.clj
+++ test/clj_money/test_helpers.clj
@@ -4,7 +4,9 @@
             [clojure.tools.logging :as log]
             [clj-money.validation :as validation]))

-(def all-tables ["accounts"
+(def all-tables ["transaction_items"
+                 "transactions"
+                 "accounts"
                  "entities"
                  "users"])


Changes print formatting statement, removing some characters

--- 06-code-golf/tf-06.clj
+++ 06-code-golf/tf-06.clj
@@ -6,4 +6,4 @@
                 (remove
                   #(contains? (set (.split (slurp "../stop_words.txt") ",")) %)
                   (re-seq #"[a-z]{2,}" (.toLowerCase (slurp (first *command-line-args*))))))))]
-  (printf "%s - %d\n" (first c) (nth c 1)))
+  (println (first c) "-" (nth c 1)))


(maint) fix import

(maint) fix import

--- src/puppetlabs/cthun/websockets.clj
+++ src/puppetlabs/cthun/websockets.clj
@@ -1,7 +1,7 @@
 (ns puppetlabs.cthun.websockets
   (:import (org.eclipse.jetty.server
             Server ServerConnector ConnectionFactory HttpConnectionFactory
-            Connector HttpConfiguration Request)
+            Connector HttpConfiguration Request))
   (:require  [clojure.tools.logging :as log]
              [ring.adapter.jetty9 :as jetty-adapter]
              [cheshire.core :as cheshire]