Added docstrings to non-obvious functions.

--- src/validation_benchmark/core.clj
+++ src/validation_benchmark/core.clj
@@ -10,11 +10,16 @@
   (:gen-class))

-(defn assert-result [f msg]
+(defn assert-result
+  "Wraps benchmark function to assert it always returns `true`.
+
+  `msg` is formatted with the arguments passed to benchmark function,
+  and used as a custom assertion failure message."
+  [f msg]
   (fn [& args]
     (let [r (apply f args)]
       (assert r (format msg args))
-      r)))
+      nil)))

 (defn final-summary [groups results chart-path]
@@ -64,7 +69,21 @@
             (into {}))])))

-(defn prepare-benchmarks [alternatives inputs]
+(defn prepare-benchmarks
+  "Builds runtime benchmark data.
+
+  Canonical benchmark data is stored in `tests.edn`. Output of
+  this function has the shape below:
+
+      {:<library-name> {<benchmark-name> {:valid {:fn [...]
+                                                  :inputs (fn [...] ...)},
+                                          :invalid {:fn [...]
+                                                    :inputs (fn [...] ...)}}
+       ..rest..}
+
+  Benchmark functions are called with each input. They either return `nil`
+  or throw an `AssertionError`. Throwing means a defect in the code."
+  [alternatives inputs]
   (->> (for [[lib-name lib-ns] alternatives]
          [lib-name
           (->> (for [[test-name test-data] inputs]
@@ -81,7 +100,10 @@
       (require [lib-ns])))

-(defn run-benchmarks [benchmarks bench-fn]
+(defn run-benchmarks
+  "Replaces benchmark function & inputs with the results of running the
+  benchmark."
+  [benchmarks bench-fn]
   (let [flattened (for [[lib-name lib-data] benchmarks
                         [test-name test-data] lib-data
                         [valid? {test-fn :fn inputs :inputs}] test-data]


Rename 'alpaca' to 'make-schedule'

Rename 'alpaca' to 'make-schedule'

Dammit, placeholder names I make because I can't brain at night

--- src/eddy/schedule.clj
+++ src/eddy/schedule.clj
@@ -41,7 +41,7 @@
                    (throw (IllegalArgumentException. "Interval syntax invalid")))]
     (map #(cons (symbol namespace (first %)) (rest %)) operands)))

-(defn alpaca [interval-data]
+(defn make-schedule [interval-data]
   (let [operator (first interval-data)
         namespace (interval-class operator)
         operands (interval-operands namespace (next interval-data))]
@@ -53,7 +53,7 @@
   `(triggers/build
     (triggers/with-identity (triggers/key ~job-key))
     (triggers/start-now)
-    (triggers/with-schedule ~(alpaca interval))))
+    (triggers/with-schedule ~(make-schedule interval))))

 (defn schedule-jobs [& jobs]
   (let [scheduler (-> (quartzite/initialize) quartzite/start)]


project.clj description and url update.

project.clj description and url update.

--- pp-server/project.clj
+++ pp-server/project.clj
@@ -1,6 +1,6 @@
 (defproject pp-server "0.1.0-SNAPSHOT"
-  :description "FIXME: write description"
-  :url "http://example.com/FIXME"
+  :description "pretty-printer server side for pretty-print.net"
+  :url "http://pretty-print.net"
   :min-lein-version "2.0.0"
   :dependencies [[org.clojure/clojure "1.6.0"]
                  [compojure "1.3.1"]


[#218] Remove commented code

[#218] Remove commented code

--- priv/clojure/core.clj
+++ priv/clojure/core.clj
@@ -597,7 +597,8 @@
   [& body]
   (list 'new 'clojerl.LazySeq (list* '^{:once true} fn* [] body)))

-#_((defn ^clojure.lang.ChunkBuffer chunk-buffer ^clojure.lang.ChunkBuffer [capacity]
+#_(
+   (defn ^clojure.lang.ChunkBuffer chunk-buffer ^clojure.lang.ChunkBuffer [capacity]
      (throw "unimplemented chunked seq")
      #_(clojure.lang.ChunkBuffer. capacity))

@@ -705,24 +706,6 @@
      (if (next more)
        (recur y (first more) (next more))
        (clj_core/equiv.e y (first more)))
-     false)))
-
-;equals-based
-#_(defn =
-  "Equality. Returns true if x equals y, false if not. Same as Java
-  x.equals(y) except it also works for nil. Boxed numbers must have
-  same type. Clojure's immutable data structures define equals() (and
-  thus =) as a value, not an identity, comparison."
-  {:inline '(fn [x y] `(. clojure.lang.Util equals ~x ~y))
-   :inline-arities #{2}
-   :added "1.0"}
-  ([x] true)
-  ([x y] (clojure.lang.Util/equals x y))
-  ([x y & more]
-   (if (= x y)
-     (if (next more)
-       (recur y (first more) (next more))
-       (= y (first more)))
      false)))

 (defn not=
@@ -3308,128 +3291,6 @@
                (/ (- stop# start#) 1000000.0)
                " msecs"))
      ret#))
-
-
-#_(
-   (import '(java.lang.reflect Array))
-
-  (defn alength
-    "Returns the length of the Java array. Works on arrays of all
-  types."
-    {:inline '(fn [a] `(. clojure.lang.RT (alength ~a)))
-     :added "1.0"}
-    [array] (. clojure.lang.RT (alength array)))
-
-  (defn aclone
-    "Returns a clone of the Java array. Works on arrays of known
-  types."
-    {:inline '(fn [a] `(. clojure.lang.RT (aclone ~a)))
-     :added "1.0"}
-    [array] (. clojure.lang.RT (aclone array)))
-
-  (defn aget
-    "Returns the value at the index/indices. Works on Java arrays of all
-  types."
-    {:inline '(fn [a i] `(. clojure.lang.RT (aget ~a (int ~i))))
-     :inline-arities #{2}
-     :added "1.0"}
-    ([array idx]
-     (clojure.lang.Reflector/prepRet (.getComponentType (class array)) (. Array (get array idx))))
-    ([array idx & idxs]
-     (apply aget (aget array idx) idxs)))
-
-  (defn aset
-    "Sets the value at the index/indices. Works on Java arrays of
-  reference types. Returns val."
-    {:inline '(fn [a i v] `(. clojure.lang.RT (aset ~a (int ~i) ~v)))
-     :inline-arities #{3}
-     :added "1.0"}
-    ([array idx val]
-     (. Array (set array idx val))
-     val)
-    ([array idx idx2 & idxv]
-     (apply aset (aget array idx) idx2 idxv)))
-
-  (defmacro
-    ^{:private true}
-    def-aset [name method coerce]
-    `(defn ~name
-       {:arglists '([~'array ~'idx ~'val] [~'array ~'idx ~'idx2 & ~'idxv])}
-       ([array# idx# val#]
-        (. Array (~method array# idx# (~coerce val#)))
-        val#)
-       ([array# idx# idx2# & idxv#]
-        (apply ~name (aget array# idx#) idx2# idxv#))))
-
-  (def-aset
-    ^{:doc "Sets the value at the index/indices. Works on arrays of int. Returns val."
-      :added "1.0"}
-    aset-int setInt int)
-
-  (def-aset
-    ^{:doc "Sets the value at the index/indices. Works on arrays of long. Returns val."
-      :added "1.0"}
-    aset-long setLong long)
-
-  (def-aset
-    ^{:doc "Sets the value at the index/indices. Works on arrays of boolean. Returns val."
-      :added "1.0"}
-    aset-boolean setBoolean boolean)
-
-  (def-aset
-    ^{:doc "Sets the value at the index/indices. Works on arrays of float. Returns val."
-      :added "1.0"}
-    aset-float setFloat float)
-
-  (def-aset
-    ^{:doc "Sets the value at the index/indices. Works on arrays of double. Returns val."
-      :added "1.0"}
-    aset-double setDouble double)
-
-  (def-aset
-    ^{:doc "Sets the value at the index/indices. Works on arrays of short. Returns val."
-      :added "1.0"}
-    aset-short setShort short)
-
-  (def-aset
-    ^{:doc "Sets the value at the index/indices. Works on arrays of byte. Returns val."
-      :added "1.0"}
-    aset-byte setByte byte)
-
-  (def-aset
-    ^{:doc "Sets the value at the index/indices. Works on arrays of char. Returns val."
-      :added "1.0"}
-    aset-char setChar char)
-
-  (defn make-array
-    "Creates and returns an array of instances of the specified class of
-  the specified dimension(s).  Note that a class object is required.
-  Class objects can be obtained by using their imported or
-  fully-qualified name.  Class objects for the primitive types can be
-  obtained using, e.g., Integer/TYPE."
-    {:added "1.0"}
-    ([^Class type len]
-     (. Array (newInstance type (int len))))
-    ([^Class type dim & more-dims]
-     (let [dims (cons dim more-dims)
-           ^"[I" dimarray (make-array (. Integer TYPE)  (count dims))]
-       (dotimes [i (alength dimarray)]
-         (aset-int dimarray i (nth dims i)))
-       (. Array (newInstance type dimarray)))))
-
-  (defn to-array-2d
-    "Returns a (potentially-ragged) 2-dimensional array of Objects
-  containing the contents of coll, which can be any Collection of any
-  Collection."
-    {:tag "[[Ljava.lang.Object;"
-     :added "1.0"}
-    [^java.util.Collection coll]
-    (let [ret (make-array (. Class (forName "[Ljava.lang.Object;")) (. coll (size)))]
-      (loop [i 0 xs (seq coll)]
-        (when xs
-          (aset ret i (to-array (first xs)))
-          (recur (inc i) (next xs))))
-      ret)))

 (defn macroexpand-1
   "If form represents a macro form, returns its expansion,
@@ -4332,23 +4193,7 @@
   (throw "unsupported refs")
   #_`(sync nil ~@exprs))

-#_ ((defmacro with-precision
-      "Sets the precision and rounding mode to be used for BigDecimal operations.
-
-  Usage: (with-precision 10 (/ 1M 3))
-  or:    (with-precision 10 :rounding HALF_DOWN (/ 1M 3))
-
-  The rounding mode is one of CEILING, FLOOR, HALF_UP, HALF_DOWN,
-  HALF_EVEN, UP, DOWN and UNNECESSARY; it defaults to HALF_UP."
-      {:added "1.0"}
-      [precision & exprs]
-      (let [[body rm] (if (= (first exprs) :rounding)
-                        [(next (next exprs))
-                         `((. java.math.RoundingMode ~(second exprs)))]
-                        [exprs nil])]
-        `(binding [*math-context* (java.math.MathContext. ~precision ~@rm)]
-           ~@body)))
-
+#_ (
     (defn mk-bound-fn
       {:private true}
       [^clojure.lang.Sorted sc test key]
@@ -4469,165 +4314,12 @@
   ([sep coll]
    (drop 1 (interleave (repeat sep) coll))))

-#_(defmacro definline
-  "Experimental - like defmacro, except defines a named function whose
-  body is the expansion, calls to which may be expanded inline as if
-  it were a macro. Cannot be used with variadic (&) args."
-  {:added "1.0"}
-  [name & decl]
-  (let [[pre-args [args expr]] (split-with (comp not vector?) decl)]
-    `(do
-       (defn ~name ~@pre-args ~args ~(apply (eval (list `fn args expr)) args))
-       (alter-meta! (var ~name) assoc :inline '(fn ~name ~args ~expr))
-       (var ~name))))
-
 (defn empty
   "Returns an empty collection of the same category as coll, or nil"
   {:added "1.0"}
   [coll]
   (when (satisfies? clojerl.IColl coll)
     (clj_core/empty.e coll)))
-
-#_ ((defmacro amap
-      "Maps an expression across an array a, using an index named idx, and
-  return value named ret, initialized to a clone of a, then setting
-  each element of ret to the evaluation of expr, returning the new
-  array ret."
-      {:added "1.0"}
-      [a idx ret expr]
-      `(let [a# ~a
-             ~ret (aclone a#)]
-         (loop  [~idx 0]
-           (if (< ~idx  (alength a#))
-             (do
-               (aset ~ret ~idx ~expr)
-               (recur (inc ~idx)))
-             ~ret))))
-
-    (defmacro areduce
-      "Reduces an expression across an array a, using an index named idx,
-  and return value named ret, initialized to init, setting ret to the
-  evaluation of expr at each step, returning ret."
-      {:added "1.0"}
-      [a idx ret init expr]
-      `(let [a# ~a l# (alength a#)]
-         (loop  [~idx 0 ~ret ~init]
-           (if (< ~idx l#)
-             (recur (inc-int ~idx) ~expr)
-             ~ret))))
-
-    (defn float-array
-      "Creates an array of floats"
-      {:inline '(fn [& args] `(. clojure.lang.Numbers float_array ~@args))
-       :inline-arities #{1 2}
-       :added "1.0"}
-      ([size-or-seq] (. clojure.lang.Numbers float_array size-or-seq))
-      ([size init-val-or-seq] (. clojure.lang.Numbers float_array size init-val-or-seq)))
-
-    (defn boolean-array
-      "Creates an array of booleans"
-      {:inline '(fn [& args] `(. clojure.lang.Numbers boolean_array ~@args))
-       :inline-arities #{1 2}
-       :added "1.1"}
-      ([size-or-seq] (. clojure.lang.Numbers boolean_array size-or-seq))
-      ([size init-val-or-seq] (. clojure.lang.Numbers boolean_array size init-val-or-seq)))
-
-    (defn byte-array
-      "Creates an array of bytes"
-      {:inline '(fn [& args] `(. clojure.lang.Numbers byte_array ~@args))
-       :inline-arities #{1 2}
-       :added "1.1"}
-      ([size-or-seq] (. clojure.lang.Numbers byte_array size-or-seq))
-      ([size init-val-or-seq] (. clojure.lang.Numbers byte_array size init-val-or-seq)))
-
-    (defn char-array
-      "Creates an array of chars"
-      {:inline '(fn [& args] `(. clojure.lang.Numbers char_array ~@args))
-       :inline-arities #{1 2}
-       :added "1.1"}
-      ([size-or-seq] (. clojure.lang.Numbers char_array size-or-seq))
-      ([size init-val-or-seq] (. clojure.lang.Numbers char_array size init-val-or-seq)))
-
-    (defn short-array
-      "Creates an array of shorts"
-      {:inline '(fn [& args] `(. clojure.lang.Numbers short_array ~@args))
-       :inline-arities #{1 2}
-       :added "1.1"}
-      ([size-or-seq] (. clojure.lang.Numbers short_array size-or-seq))
-      ([size init-val-or-seq] (. clojure.lang.Numbers short_array size init-val-or-seq)))
-
-    (defn double-array
-      "Creates an array of doubles"
-      {:inline '(fn [& args] `(. clojure.lang.Numbers double_array ~@args))
-       :inline-arities #{1 2}
-       :added "1.0"}
-      ([size-or-seq] (. clojure.lang.Numbers double_array size-or-seq))
-      ([size init-val-or-seq] (. clojure.lang.Numbers double_array size init-val-or-seq)))
-
-    (defn object-array
-      "Creates an array of objects"
-      {:inline '(fn [arg] `(. clojure.lang.RT object_array ~arg))
-       :inline-arities #{1}
-       :added "1.2"}
-      ([size-or-seq] (. clojure.lang.RT object_array size-or-seq)))
-
-    (defn int-array
-      "Creates an array of ints"
-      {:inline '(fn [& args] `(. clojure.lang.Numbers int_array ~@args))
-       :inline-arities #{1 2}
-       :added "1.0"}
-      ([size-or-seq] (. clojure.lang.Numbers int_array size-or-seq))
-      ([size init-val-or-seq] (. clojure.lang.Numbers int_array size init-val-or-seq)))
-
-    (defn long-array
-      "Creates an array of longs"
-      {:inline '(fn [& args] `(. clojure.lang.Numbers long_array ~@args))
-       :inline-arities #{1 2}
-       :added "1.0"}
-      ([size-or-seq] (. clojure.lang.Numbers long_array size-or-seq))
-      ([size init-val-or-seq] (. clojure.lang.Numbers long_array size init-val-or-seq)))
-
-    (definline booleans
-      "Casts to boolean[]"
-      {:added "1.1"}
-      [xs] `(. clojure.lang.Numbers booleans ~xs))
-
-    (definline bytes
-      "Casts to bytes[]"
-      {:added "1.1"}
-      [xs] `(. clojure.lang.Numbers bytes ~xs))
-
-    (definline chars
-      "Casts to chars[]"
-      {:added "1.1"}
-      [xs] `(. clojure.lang.Numbers chars ~xs))
-
-    (definline shorts
-      "Casts to shorts[]"
-      {:added "1.1"}
-      [xs] `(. clojure.lang.Numbers shorts ~xs))
-
-    (definline floats
-      "Casts to float[]"
-      {:added "1.0"}
-      [xs] `(. clojure.lang.Numbers floats ~xs))
-
-    (definline ints
-      "Casts to int[]"
-      {:added "1.0"}
-      [xs] `(. clojure.lang.Numbers ints ~xs))
-
-    (definline doubles
-      "Casts to double[]"
-      {:added "1.0"}
-      [xs] `(. clojure.lang.Numbers doubles ~xs))
-
-    (definline longs
-      "Casts to long[]"
-      {:added "1.0"}
-      [xs] `(. clojure.lang.Numbers longs ~xs)))
-
-#_(import '(java.util.concurrent BlockingQueue LinkedBlockingQueue))

 (defn seque
   "Creates a queued seq on another (presumably lazy) seq s. The queued
@@ -4679,26 +4371,6 @@
   "Returns true if x is an instance of Class"
   {:added "1.0"}
   [x]
-  (throw "unsupported class"))
-
-(defn- is-annotation? [c]
-  (throw "unsupported class"))
-
-(defn- is-runtime-annotation? [^Class c]
-  (throw "unsupported class"))
-
-(defn- descriptor [^Class c]
-  (throw "unsupported class"))
-
-(declare process-annotation)
-(defn- add-annotation [^clojure.asm.AnnotationVisitor av name v]
-  (throw "unsupported class"))
-
-(defn- process-annotation [av v]
-  (throw "unsupported class"))
-
-(defn- add-annotations
-  [& _]
   (throw "unsupported class"))

 (defn alter-var-root


Remove debug printlns from draw ns.

Remove debug printlns from draw ns.

--- src/uxbox/ui/workspace/canvas/draw.cljs
+++ src/uxbox/ui/workspace/canvas/draw.cljs
@@ -45,8 +45,6 @@
   (letfn [(init-shape [shape]
             (let [{:keys [x y] :as point} @wb/mouse-canvas-a
                   shape (sh/-initialize shape {:x1 x :y1 y :x2 x :y2 y})]
-
-              (println "start" point)
               (reset! +drawing-shape+ shape)
               (reset! +drawing-position+ (assoc point :lock false))

@@ -59,7 +57,6 @@
                   (rx/subscribe $ on-value nil on-complete)))))

           (on-value [[point ctrl?]]
-            (println "on-value" ctrl? point)
             (reset! +drawing-position+ (assoc point :lock ctrl?)))

           (on-complete []


62 chrome profile: removed /Default

62 chrome profile: removed /Default

--- src/etaoin/driver.clj
+++ src/etaoin/driver.clj
@@ -32,6 +32,7 @@
   https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol
 "
   (:require [etaoin.util :refer [defmethods deep-merge]]
+            [clojure.string :as string]
             [clojure.tools.logging :as log]))

 (defn dispatch-driver
@@ -139,9 +140,15 @@

 (defmethod set-profile
   :chrome
+  ;; Chrome ignores the last `/Default` folder in the profile path
+  ;; (it adds it to the path internally). But on the
+  ;; `chrome://version/` page, it shows it with trailing `/Default`.
+  ;; So it would be better to remove that part manually
+  ;; in case somebody would copy and paste the profile path from there.
   [driver profile]
-  (set-options-args driver [(format "--user-data-dir=%s" profile)]))
-
+  (let [default #"(\\|/)Default$"
+        p (string/replace profile default "")]
+    (set-options-args driver [(format "--user-data-dir=%s" p)])))

 (defmethod set-profile
   :firefox


Extend ofx-clj methods to be able to parse credit card transacntions

--- src/expenses/card.clj
+++ src/expenses/card.clj
@@ -1,7 +1,9 @@
 (ns expenses.card
   (:require [expenses.financial-record :refer :all]
             [ofx-clj.core :as ofx])
-  (:import [net.sf.ofx4j.domain.data.creditcard CreditCardResponseMessageSet]))
+  (:import [net.sf.ofx4j.domain.data.creditcard CreditCardResponseMessageSet
+                                                CreditCardStatementResponseTransaction
+                                                CreditCardStatementResponse]))

 (def the-file "resources/card/faturaCartao.ofx")

@@ -12,4 +14,21 @@
                   :version .getVersion
                   :mesages [.getResponseMessages #(map ofx/parse-data %)]))

+(defmethod ofx/parse-data CreditCardStatementResponseTransaction
+  [transaction]
+  (ofx/obj-to-map transaction
+                  :message [.getMessage ofx/parse-data]
+                  :wrapped-message [.getWrappedMessage ofx/parse-data]))
+
+(defmethod ofx/parse-data CreditCardStatementResponse
+  [response]
+  (ofx/obj-to-map response
+                  :account [.getAccount ofx/parse-data]
+                  :available-balance [.getAvailableBalance ofx/parse-data]
+                  :currency-code .getCurrencyCode
+                  :ledger-balance [.getLedgerBalance ofx/parse-data]
+                  :marketing-info .getMarketingInfo
+                  :response-message-name .getResponseMessageName
+                  :transaction-list [.getTransactionList ofx/parse-data]))
+
 (ofx/parse the-file)


Start generating some methods in the final output

--- src/googlica/core.clj
+++ src/googlica/core.clj
@@ -31,8 +31,8 @@
     ~(symbol (str "googlica." name "." version)) ;; HACK: instead of having the ns as string, we should probably read it from the current one
     ~(str desc "\n\nDocumentation link: " docs-link)
     (:gen-class)
-    (:require [clj-http.client :as http]
-              [clojure.string :as str])))
+    (:require [clj-http.client :as ~'http]
+              [clojure.string :as ~'str])))

 ;; TODO move util generation to another function or a dedicated namespace
 (defn generate-global-vars
@@ -147,7 +147,10 @@
                           (f/pprint {:width 100}) ;; Fipp pretty prints clojure code nicely
                           with-out-str)]
     (->> [[(generate-ns-sexp name version description documentationLink)]
-          (generate-global-vars rootUrl servicePath)]
+          (generate-global-vars rootUrl servicePath)
+          [(generate-function-from-method
+            (-> storage-model :resources :buckets :methods :insert))
+           (generate-function-from-method storage-object-get)]]
           ;;(mapv generate-function-from-method ;; TODO get all the methods)])))
          (apply concat) ;; <- this is for flattening the methods
          (mapv symbols->str)


Fix parse by returning the file returned by the parser.

--- src/incise/parsers/core.clj
+++ src/incise/parsers/core.clj
@@ -49,4 +49,6 @@
         current-parsers @parsers]
     (when (contains? current-parsers ext)
       (info "Parsing" (.getPath handle))
-      (info "Wrote" (.getPath ((current-parsers ext) handle))))))
+      (let [parsed-file ((current-parsers ext) handle)]
+        (info "Wrote" (.getPath parsed-file))
+        parsed-file))))


fix another emacs print-length case

fix another emacs print-length case

--- src/main/shadow/cljs/build_report.clj
+++ src/main/shadow/cljs/build_report.clj
@@ -239,7 +239,9 @@
            [:meta {:charset "utf-8"}]]
           [:body
            [:div#root]
-           (assets/js-queue :none 'shadow.cljs.build-report.ui/init bundle-info)
+           (binding [*print-length* nil
+                     *print-namespace-maps* nil]
+             (assets/js-queue :none 'shadow.cljs.build-report.ui/init bundle-info))
            [:style
             (slurp (io/resource "shadow/cljs/build_report/dist/css/main.css"))]
            [:script {:type "text/javascript"}


add quick hack to make CI fail with bad targets

since there are no test builds for some targets errors may get
lost. the namespaces should at least load properly, no clue
how to validate builds properly though.

--- test-project/src/main/test/runnable.clj
+++ test-project/src/main/test/runnable.clj
@@ -1,4 +1,18 @@
-(ns test.runnable)
+(ns test.runnable
+  (:require
+    ;; FIXME: there should be proper test builds for each or these
+    ;; for now just testing if the targets actually load properly
+    [shadow.build.targets.azure-app]
+    [shadow.build.targets.bootstrap]
+    [shadow.build.targets.browser]
+    [shadow.build.targets.browser-test]
+    [shadow.build.targets.chrome-extension]
+    [shadow.build.targets.karma]
+    [shadow.build.targets.node-library]
+    [shadow.build.targets.node-script]
+    [shadow.build.targets.node-test]
+    [shadow.build.targets.npm-module]
+    [shadow.build.targets.react-native]))

 (defn foo []
   (prn :foo))


multilingual fix

multilingual fix

--- src-clj/acha/achievement.clj
+++ src-clj/acha/achievement.clj
@@ -216,8 +216,10 @@
 (def multilingual
   [:multilingual
    (fn [commit-info]
-     (>= (+ (map #(if (% commit-info) 1 0)
-      (vals (map make-language-scanner language-table)))) 5))])
+     (when (>= (+ (map #(if (% commit-info) 1 0)
+      (vals (map make-language-scanner language-table)))) 5)
+       {:username (:author commit-info)
+        :time (:time commit-info)}))])
 (def commenter
   [:commenter
    (fn [commit-info]


fixed test

fixed test

--- test/asset_minifier/core_test.clj
+++ test/asset_minifier/core_test.clj
@@ -118,7 +118,4 @@
          :compressed-size 1265,
          :gzipped-size 600
          :warnings
-         ["JSC_UNDEFINED_EXTERN_VAR_ERROR. name hljs is not defined in the externs. at test/resources/js/externs.js line 1 : 0"
-          "JSC_INEXISTENT_PROPERTY. Property test never defined on RegExp at test/resources/js/input2.js line 3 : 50"
-          "JSC_WRONG_ARGUMENT_COUNT. Function renderPreview: called with 0 argument(s). Function requires at least 1 argument(s) and no more than 1 argument(s). at test/resources/js/input2.js line 13 : 40"
-          "JSC_INEXISTENT_PROPERTY. Property getTime never defined on Date at test/resources/js/input2.js line 85 : 85"]})))
+         ["JSC_UNDEFINED_EXTERN_VAR_ERROR. name hljs is not defined in the externs. at test/resources/js/externs.js line 1 : 0"]})))


Add more tests.

Add more tests.

--- test/boilerpipe_clj/core_test.clj
+++ test/boilerpipe_clj/core_test.clj
@@ -1,13 +1,29 @@
 (ns boilerpipe-clj.core-test
-  (:use clojure.test
-        boilerpipe-clj.core))
+  (:require [clojure.test :refer :all]
+            [boilerpipe-clj.core :refer :all]
+            [boilerpipe-clj.extractors :as ext]))

 (defonce test-article
   (slurp "./test/boilerpipe_clj/resources/greenspun-test.html"))

+(def extractors [ext/default-extractor
+                 ext/article-extractor
+                 ext/article-sentence-extractor])
+
+;; TODO: Why does lein test say it tests 6400 assertions?
 (deftest get-text-extraction
-  (testing "that get-text extracts something from an article"
+  (testing "get-text extracts something from an article
+            without a provided extractor"
     (let [res (get-text test-article)]
       (is (and
             (not= res "")
-            (not= res nil))))))
+            (not= res nil)))))
+  (testing "All the available extractors extract something
+           from the article"
+    (doseq [ext extractors
+            res (get-text test-article ext)]
+      (is (and (not= res "")
+               (not (nil? res)))))))
+
+;; TODO: Test wrap-paragraphs and get-text-as-html
+;; TODO: More fine grained tests for the extractors.  Not sure what these tests would look like.


Fix tests for cljs

Fix tests for cljs

--- test/cljc/reitit/swagger_test.clj
+++ test/cljc/reitit/swagger_test.clj
@@ -4,7 +4,8 @@
             [reitit.swagger :as swagger]
             [reitit.ring.coercion :as rrc]
             [reitit.coercion.spec :as spec]
-            [reitit.coercion.schema :as schema]))
+            [reitit.coercion.schema :as schema]
+            [schema.core :refer [Int]]))

 (def app
   (ring/ring-handler
@@ -18,14 +19,6 @@
                :handler swagger/swagger-spec-handler}}]

        ["/spec" {:coercion spec/coercion}
-
-        ["/minus"
-         {:get {:summary "minus"
-                :parameters {:query {:x int?, :y int?}}
-                :responses {200 {:body {:total int?}}}
-                :handler (fn [{{{:keys [x y]} :query} :parameters}]
-                           {:status 200, :body {:total (- x y)}})}}]
-
         ["/plus"
          {:get {:summary "plus"
                 :parameters {:query {:x int?, :y int?}}
@@ -34,18 +27,10 @@
                            {:status 200, :body {:total (+ x y)}})}}]]

        ["/schema" {:coercion schema/coercion}
-
-        ["/minus"
-         {:get {:summary "minus"
-                :parameters {:query {:x Long, :y Long}}
-                :responses {200 {:body {:total Long}}}
-                :handler (fn [{{{:keys [x y]} :query} :parameters}]
-                           {:status 200, :body {:total (- x y)}})}}]
-
         ["/plus"
          {:get {:summary "plus"
-                :parameters {:query {:x Long, :y Long}}
-                :responses {200 {:body {:total Long}}}
+                :parameters {:query {:x Int, :y Int}}
+                :responses {200 {:body {:total Int}}}
                 :handler (fn [{{{:keys [x y]} :query} :parameters}]
                            {:status 200, :body {:total (+ x y)}})}}]]]

@@ -61,22 +46,12 @@
              (app
                {:request-method :get
                 :uri "/api/spec/plus"
-                :query-params {:x "2", :y "1"}})))
-      (is (= {:body {:total 1}, :status 200}
-             (app
-               {:request-method :get
-                :uri "/api/spec/minus"
                 :query-params {:x "2", :y "1"}}))))
     (testing "schema"
       (is (= {:body {:total 3}, :status 200}
              (app
                {:request-method :get
                 :uri "/api/schema/plus"
-                :query-params {:x "2", :y "1"}})))
-      (is (= {:body {:total 1}, :status 200}
-             (app
-               {:request-method :get
-                :uri "/api/schema/minus"
                 :query-params {:x "2", :y "1"}})))))
   (testing "swagger-spec"
     (let [spec (:body (app
@@ -84,30 +59,7 @@
                          :uri "/api/swagger.json"}))]
       (is (= {:x-id ::math
               :info {:title "my-api"}
-              :paths {
-                      ;; schema doesn't yet generate parameter data
-                      "/api/schema/minus" {:get {:summary "minus"}}
-                      "/api/schema/plus" {:get {:summary "plus"}}
-
-                      ;; spec does!
-                      "/api/spec/minus" {:get {:parameters [{:description ""
-                                                             :format "int64"
-                                                             :in "query"
-                                                             :name "x"
-                                                             :required true
-                                                             :type "integer"}
-                                                            {:description ""
-                                                             :format "int64"
-                                                             :in "query"
-                                                             :name "y"
-                                                             :required true
-                                                             :type "integer"}]
-                                               :responses {200 {:description ""
-                                                                :schema {:properties {"total" {:format "int64"
-                                                                                :type "integer"}}
-                                                                         :required ["total"]
-                                                                         :type "object"}}}
-                                               :summary "minus"}}
+              :paths {"/api/schema/plus" {:get {:summary "plus"}} ;; TODO: implement!
                       "/api/spec/plus" {:get {:parameters [{:description ""
                                                             :format "int64"
                                                             :in "query"


s/{:pred :mangiare}/{:pred :eat}/

s/{:pred :mangiare}/{:pred :eat}/

--- test/babel/test/fr.cljc
+++ test/babel/test/fr.cljc
@@ -288,7 +288,7 @@
     (is (not (nil? result)))
     (is (= (get-in (first result)
                    [:synsem :sem :pred])
-           :mangiare))
+           :eat))
     (is (= (get-in (first result)
                    [:synsem :infl])
            :present))))


Fix answers of pileup test

Fix answers of pileup test


use sam/slurp and bam/slurp

use sam/slurp and bam/slurp

--- test/cljam/t_sorter.clj
+++ test/cljam/t_sorter.clj
@@ -77,12 +77,12 @@
         (with-reader sorter/sort-order tmp-queryname-sorted-sam-file-2) =future=> sorter/order-queryname
         (with-reader sorter/sort-order tmp-queryname-sorted-bam-file-2) =future=> sorter/order-queryname
         ;; compare generated files
-        (= (slurp tmp-coordinate-sorted-sam-file)
-           (slurp tmp-coordinate-sorted-sam-file-2)) => truthy
-        (= (slurp tmp-coordinate-sorted-bam-file)
-           (slurp tmp-coordinate-sorted-bam-file-2)) => truthy
-        (= (slurp tmp-queryname-sorted-sam-file)
-           (slurp tmp-queryname-sorted-sam-file-2)) =future=> truthy
-        (= (slurp tmp-queryname-sorted-bam-file)
-           (slurp tmp-queryname-sorted-bam-file-2)) =future=> truthy
+        (= (sam/slurp tmp-coordinate-sorted-sam-file)
+           (sam/slurp tmp-coordinate-sorted-sam-file-2)) => truthy
+        (= (bam/slurp tmp-coordinate-sorted-bam-file)
+           (bam/slurp tmp-coordinate-sorted-bam-file-2)) => truthy
+        (= (sam/slurp tmp-queryname-sorted-sam-file)
+           (sam/slurp tmp-queryname-sorted-sam-file-2)) =future=> truthy
+        (= (bam/slurp tmp-queryname-sorted-bam-file)
+           (bam/slurp tmp-queryname-sorted-bam-file-2)) =future=> truthy
         ))


Revert "Restored test server code"

Revert "Restored test server code"

This reverts commit ffda7f6259f19e363b27c8d684e9455728157435.

--- src/server_dev/hyjinks/server/dev.clj
+++ src/server_dev/hyjinks/server/dev.clj
@@ -1,21 +1,10 @@
 (ns hyjinks.server.dev
-  (:require [ring.util.response :refer [response]]
+  (:require [ring.util.response :refer [file-response]]
             [compojure.core :refer [defroutes GET]]
-            [compojure.route :refer [resources]]
-            [hyjinks.core :refer [tag->string html head title import-js body div css]]))
-
-(def page-frame
-  (tag->string
-    (html
-      (head
-        (title "Hyjinks Test Page")
-        (import-js "js/compiled/hyjinks_browser.js"))
-      (body
-        (div {:id "results"} (css :font-size "30px" :font-weight "bold"))
-        (div "Look at console for detailed results.")))))
+            [compojure.route :refer [resources]]))

 (defroutes app-routes
-  (GET "/" [] (response page-frame))
+  (GET "/" [] (file-response "resources/public/index.html"))
   (resources "/"))

 (def app #'app-routes)


increase responsiveness in scaling down (#1154)

--- waiter/integration/waiter/autoscaling_test.clj
+++ waiter/integration/waiter/autoscaling_test.clj
@@ -155,7 +155,7 @@
                          :x-waiter-max-instances 5
                          :x-waiter-min-instances 1
                          :x-waiter-name (rand-name)
-                         :x-waiter-scale-down-factor 0.25
+                         :x-waiter-scale-down-factor 0.99
                          :x-waiter-scale-up-factor 0.99}
           request-fn (fn [target-url cookies]
                        (make-kitchen-request target-url extra-headers :cookies cookies))
@@ -170,7 +170,7 @@
           (run-scale-service-requests
             waiter-url cookies request-fn requests-per-thread delay-secs service-id
             num-threads expected-instances))
-        (let [num-threads 6
+        (let [num-threads 5
               expected-instances (int (Math/ceil (/ (* 1.0 num-threads) concurrency-level)))]
           (run-scale-service-requests
             waiter-url cookies request-fn requests-per-thread delay-secs service-id


Remove prn.

Remove prn.

--- test/onyx/plugin/datomic_test.clj
+++ test/onyx/plugin/datomic_test.clj
@@ -105,7 +105,6 @@
              [(<= ?x 5)]])

 (defn my-test-query [{:keys [datoms] :as segment}]
-  (prn "--> " segment)
   {:names (d/q query datoms)})

 (def workflow {:partition-datoms {:load-datoms {:datomic-query :out}}})


cleanup dead code

cleanup dead code

--- src/babel/english/writer.clj
+++ src/babel/english/writer.clj
@@ -3,7 +3,6 @@

 (require '[babel.config :refer [language-to-root-spec]])
 (require '[babel.directory :refer [models]])
-(require '[babel.english.grammar :refer [small-plus-vp-pronoun small-plus-plus-np]])
 (require '[babel.english.lexicon :refer [lexicon]])
 (require '[babel.english.morphology :refer [fo]])
 (require '[babel.generate :refer [generate]])
@@ -18,10 +17,6 @@

 (defn rewrite-lexicon []
   (write-lexicon "en" @lexicon))
-
-(defn expression [spec]
-  (let [spec (if spec spec :top)]
-    (generate small-plus-plus-np spec)))

 (defn translate [source-language-short-name & [root]]
   "Generate translations from source language (e.g. 'it' for Italian) into English.


(maint) increase pool test timeouts

(maint) increase pool test timeouts

--- test/puppetlabs/jdbc_util/pool_test.clj
+++ test/puppetlabs/jdbc_util/pool_test.clj
@@ -137,9 +137,9 @@
                                 (throw (RuntimeException. "test exception")))
                               10000)]
           (is (= false (pool/init-complete? wrapped)))
-          (is (= false (pool/block-until-ready wrapped 100)))
-          (deliver ready true)
-          (is (pool/block-until-ready wrapped 100))
+          (is (= false (pool/block-until-ready wrapped 500)))
+          (deliver ready true)
+          (is (pool/block-until-ready wrapped 500))
           (is (pool/init-complete? wrapped)))))

     (testing "cancel-init cancels the init"
@@ -157,7 +157,7 @@
                               config (fn [_] (deref ready)) 10000)]
           (is (= false (pool/init-complete? wrapped)))
           (deliver ready true)
-          (is (pool/block-until-ready wrapped 100))
+          (is (pool/block-until-ready wrapped 500))
           (is (pool/init-complete? wrapped))
           (is (= false (pool/cancel-init wrapped))))))

@@ -171,7 +171,7 @@
                               10000)]
           (is (= false (pool/init-complete? wrapped)))
           (deliver ready true)
-          (is (pool/block-until-ready wrapped 100))
+          (is (pool/block-until-ready wrapped 500))
           (is (pool/init-complete? wrapped))
           (is (= false (pool/cancel-init wrapped))))))

@@ -188,7 +188,7 @@
                                 (fn [_] (deref ready)) 10000)]
             (is (= false (pool/init-complete? wrapped)))
             (deliver ready true)
-            (is (pool/block-until-ready wrapped 100))
+            (is (pool/block-until-ready wrapped 500))
             (is (pool/init-complete? wrapped))
             (is (= false (pool/cancel-init wrapped)))))))))


Bootstrap request working!

Bootstrap request working!

--- src/catalysis/client/ws.cljs
+++ src/catalysis/client/ws.cljs
@@ -31,8 +31,7 @@
 ;; Set up push message handler

 ; Dispatch on event key which is 1st elem in vector
-(defmulti push-msg-handler
-  (fn [[id _]] id))
+(defmulti push-msg-handler first)

 (defmethod event-msg-handler :chsk/recv
   [{:as ev-msg :keys [?data]}]
@@ -46,12 +45,15 @@
   [[_ tx-data]]
   (datsync/apply-remote-tx! db/conn tx-data))

-(defmethod event-msg-handler :datsync.client/bootstrap
+(defmethod push-msg-handler :datsync.client/bootstrap
   [[_ tx-data]]
   ;; Possibly falg some state somewhere saying bootstrap has taken place?
+  (println "Recieved tx")
+  ;(doseq [x-form (remove :db/id tx-data)]
+    ;(println "    " x-form))
   (datsync/apply-remote-tx! db/conn tx-data))

-;; ## TODO Add any custom handlers here!
+;; TODO Add any custom handlers here!

@@ -59,7 +61,8 @@
 ;; ## First up Sente, define send-tx!, and hook up message handler router

 (defrecord DBFn [lang params code])
-(cljs.reader/register-tag-parser! 'db/fn map->DBFn)
+;(defn tagged-fn [:datsync.server/db-fn])
+(cljs.reader/register-tag-parser! 'db/fn pr-str)

 (let [packer (sente-transit/get-flexi-packer :edn)
       {:keys [chsk ch-recv send-fn state]}
@@ -72,10 +75,7 @@
 (defn send-tx! [conn tx]
   (chsk-send! [:datsync.client/tx (datsync/datomic-tx conn tx)]))

-;; Wrap for logging, catching, etc:
-(defn event-msg-handler* [{:as ev-msg :keys [id ?data event]}]
-  (event-msg-handler ev-msg))

-(sente/start-chsk-router! ch-chsk event-msg-handler*)
+(sente/start-chsk-router! ch-chsk event-msg-handler)


Fix the link

Fix the link

--- src/circleci/views/index.clj
+++ src/circleci/views/index.clj
@@ -11,7 +11,7 @@
      [:div#intro
       [:h1 "Continuous Integration for Heroku"]
       [:p "CircleCI runs automated tests, manages integration branches and deploys to production, all with ease"]
-      [:a.call_to_action {:href "/pricing"} "Get started now"]]
+      [:a.call_to_action {:href "/signup"} "Get started now"]]
      [:div#slider
       [:div.slider_images
        (for [img ["img/screenshot_01.jpg"


replace nils func

replace nils func

--- src/clj/salava/badge/pdf.clj
+++ src/clj/salava/badge/pdf.clj
@@ -13,6 +13,15 @@

 (defqueries "sql/badge/main.sql")

+(defn replace-nils [data]
+  (clojure.walk/postwalk
+    (fn [d]
+      (if (map? d)
+        (let [m (into {} (map (fn [k v] (if (blank? (str v)) {k "-"}{k v})) (keys d) (vals d)))]
+          (when (seq m) m))
+        d))
+    data))
+
 (defn pdf-generator-helper [ctx user-id input]
   (let [badges-for-export (user-badges-to-export ctx user-id)
         filtered-badges (filter (fn [b] (some #(= % (:id b)) input)) badges-for-export)
@@ -25,9 +34,7 @@
                          (assoc :qr_code (str->qr-base64 (badge-url ctx (:id %1)))
                            :endorsements (vec (select-badge-endorsements {:id (:badge_id %1)} (u/get-db ctx)))
                            :content %2)) badge-with-content temp)]
-    (dump badges)
-
-    badges))
+    (replace-nils badges)))

 (defn generatePDF [ctx user-id input lang]
   (let [data-dir (get-in ctx [:config :core :data-dir])


Delete debugging println.

Delete debugging println.

--- src/clojure/typos/native.clj
+++ src/clojure/typos/native.clj
@@ -50,7 +50,6 @@
   [libname]
   (let [f (File/createTempFile libname ".so")
         specific-path (s/join "/" [(native-dir) libname])]
-    (println specific-path)
     (try
       (with-open [r (io/input-stream (io/resource specific-path))]
         (io/copy r f)


add tables to the ui

add tables to the ui

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/aurora/editor/ui.cljs
+++ src/aurora/editor/ui.cljs
@@ -3,6 +3,7 @@
             [aurora.compiler :as compiler]
             [aurora.ast :as ast]
             [aurora.jsth :as jsth]
+            [aurora.runtime.table :as table]
             [cljs.reader :as reader]
             [aurora.editor.cursors :refer [mutable? cursor cursors overlay-cursor value-cursor
                                            cursor->id cursor->path swap!]]
@@ -204,6 +205,7 @@
 (defn datatype-name [x]
   (cond
    (#{:ref/id :ref/js} (:type x)) "ref"
+   (satisfies? table/ITable x) "table"
    (or (true? x) (false? x)) "boolean"
    (keyword? x) "keyword"
    (number? x) "number"
@@ -338,14 +340,12 @@
                         (add-step|swap! cursor "foo"))}
     "string"]
    [:button {:onClick (fn []
-                        (add-step|swap! cursor true))}
-    "boolean"]
-   [:button {:onClick (fn []
-                        (add-step|swap! cursor [1 2 3]))}
-    "list"]
-   [:button {:onClick (fn []
-                        (add-step|swap! cursor {"name" "aurora"
-                                                "awesomeness" 100000000}))}
+                        (add-step|swap! cursor {"headers" ["a" "b"]
+                                                "columns" [{:type :ref/js
+                                                            :js "aurora.runtime.table.identity_column"}
+                                                           {:type :ref/js
+                                                            :js "aurora.runtime.table.identity_column"}]
+                                                "rows" [[1 2] [3 4]]}))}
     "table"]])

 (defdom ref-inserter [page cursor]
@@ -511,18 +511,33 @@
 ;; Representations
 ;;*********************************************************

+(defdom table-map-ui [table]
+  [:table {:className "table"
+           :onContextMenu (ref-menu table)}
+   [:thead
+    [:tr
+     (each [k (@table "headers")]
+           [:th (item-ui (conj table ["headers" index]))])]
+    [:tbody
+     (each [row (@table "rows")]
+           [:tr
+            (let [path ["rows" index]]
+              (each [v row]
+                    [:td (item-ui (conj table (conj path index)))]))])]]])
+
 (defdom table-ui [table]
-  (let [ks (keys @table)]
-    [:table {:className "table"
-             :onContextMenu (ref-menu table)}
-     [:thead
-      [:tr
-       (each [k ks]
-             [:th (item-ui (conj table [{::key k}]))])]
-      [:tbody
-       [:tr
-        (each [v (vals @table)]
-              [:td (item-ui (conj table (nth ks index)))])]]]]))
+  [:table {:className "table"
+           :onContextMenu (ref-menu table)}
+   [:thead
+    [:tr
+     (each [k (table/headers @table)]
+           [:th k])]
+    [:tbody
+     (each [row (table/-rows @table)]
+           [:tr
+            (let [path ["rows" index]]
+              (each [v row]
+                    [:td (row index)]))])]]])

 (defdom list-ui [list]
@@ -590,7 +605,9 @@
              "list" (fn [x]
                       (list-ui x))
              "table" (fn [x]
-                       (table-ui x))}))
+                       (if (map? @x)
+                         (table-map-ui x)
+                         (table-ui x)))}))

 ;;*********************************************************
 ;; Aurora state
@@ -742,7 +759,9 @@
 ;;*********************************************************

 (def run-stack (atom nil))
-(def cur-state (atom {"counter" 0}))
+(def cur-state (atom (table/table ["counter"]
+                                  [table/identity-column]
+                                  [[0]])))
 (def prev nil)

 (defn run-index [index notebook page state]


Updating version for 1.61.4-SNAPSHOT

Updating version for 1.61.4-SNAPSHOT

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.61.3"
+(defproject cook "1.61.4-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.10.3"]


refactoring, %r and %i reuse %w and %q

refactoring, %r and %i reuse %w and %q

--- src/minimaliterals/core.clj
+++ src/minimaliterals/core.clj
@@ -14,10 +14,10 @@
 (defmacro %r
   "regexp litteral, e.g.: (%r fo+ .*) => #\"fo+ .*\""
   [& els]
-  `(re-pattern (cs/join " " '~els)))
+  `(re-pattern (%q ~@els)))

 (defmacro %i
   "keywords list litteral, e.g.: (%i foo bar qux) => '(:foo :bar :qux)"
   [& els]
-  ;; we need to use this because (keyword '1) is nil
-  `(map #(keyword (str %)) '~els))
+  ;; we need to first transform to string because (keyword '1) is nil
+  `(map keyword (%w ~@els)))


Change /result to /info

Change /result to /info

--- src/beebster_clj/core.clj
+++ src/beebster_clj/core.clj
@@ -66,9 +66,9 @@
   (apply str  "get_iplayer " mode "1" " -g  --nocopyright --output=\"$HOME/Videos\"" " " index))

 (defn get-url
-  "return /result url string concatenated with index"
+  "return /info url string concatenated with index"
   [index]
-  (apply str "/result?index=" index))
+  (apply str "/info?index=" index))

 (defn iplayer-search-resultstring
   "run external command with given args list."


Parallel fetcher as a function argument

Parallel fetcher as a function argument

--- src/cyanite_fetcher/core.clj
+++ src/cyanite_fetcher/core.clj
@@ -148,15 +148,15 @@

 (defn c-get-data
   "Get data from C*."
-  [host paths tenant rollup period from to]
+  [f-par-fetch host paths tenant rollup period from to]
   (println "Connecting to Cassandra...")
   (let [cluster (alia/cluster {:contact-points [host]})
         session (alia/connect keyspace cluster)
         fetch! (fetchq session)]
     (println "Getting data form Cassandra...")
     (try
-      (let [data (time (doall (par-fetch session fetch! paths tenant
-                                         rollup period from to)))]
+      (let [data (time (doall (f-par-fetch session fetch! paths tenant
+                                           rollup period from to)))]
         (newline)
         data)
       (catch Exception e
@@ -380,7 +380,7 @@
     (println "Period:" period)
     (newline)
     (let [paths (es-get-paths eshost path tenant)
-          data (c-get-data chost paths tenant rollup period from to)
+          data (c-get-data par-fetch chost paths tenant rollup period from to)
           ;;fdata (flatter data (fn [data] (r/reduce into [] data)) "r/reduce")
           ]
       ;;(flatter data (fn [data] (reduce into data)) "reduce")


use keypin options when reading config to override loggers

--- src/bract/core/config.clj
+++ src/bract/core/config.clj
@@ -104,14 +104,17 @@
 (defn resolve-config
   "Given a collection of config filenames, read and resolve config as a map and return it."
   [context config-filenames]
-  (if (contains? context ctx-config)
-    (let [pre-config (ctx-config context)]
-      (as-> config-filenames <>
-        (keypin/read-config <> {:realize? false})  ; read config, but do not relalize (i.e. evaluate variables)
-        (kputil/clojurize-data <>)
-        (merge pre-config <>)                      ; merge config onto the pre-existing config
-        (keypin/realize-config <>)
-        (kputil/clojurize-data <>)))
-    (-> config-filenames
-      keypin/read-config
-      kputil/clojurize-data)))
+  (let [keypin-opts {:info-logger  #(echo/echo "[keypin] [info]" %)
+                     :error-logger #(echo/echo "[keypin] [error]" %)}]
+    (if (contains? context ctx-config)
+      (let [pre-config (ctx-config context)]
+        (as-> config-filenames <>
+          (keypin/read-config <> (assoc keypin-opts
+                                   :realize? false)) ; read config, but do not relalize (i.e. evaluate variables)
+          (kputil/clojurize-data <>)
+          (merge pre-config <>)                      ; merge config onto the pre-existing config
+          (keypin/realize-config <> keypin-opts)
+          (kputil/clojurize-data <>)))
+      (-> config-filenames
+        (keypin/read-config keypin-opts)
+        kputil/clojurize-data))))


Addapt cipher implementations to little protocol changes introduced in previous commits.

--- src/buddy/core/crypto.clj
+++ src/buddy/core/crypto.clj
@@ -121,7 +121,12 @@
   (let [modefactory (get *supported-modes* mode)
         enginefactory (get *supported-block-ciphers* alg)
         engine (modefactory (enginefactory))]
-    (reify Cipher
+    (reify
+      BlockCipher
+      (get-block-size [_]
+        (.getBlockSize engine))
+
+      Cipher
       (initialize! [_ params]
         (initialize-cipher! engine params))
       (process-block! [_ input]
@@ -133,7 +138,9 @@
   {:pre [(algorithm-supported? :stream alg)]}
   (let [enginefactory (get *supported-stream-ciphers* alg)
         engine (enginefactory)]
-    (reify Cipher
+    (reify
+      StreamCipher ;; Mark only
+      Cipher
       (initialize! [_ params]
         (initialize-cipher! engine params))
       (process-block! [_ input]


fix: minor refactor

fix: minor refactor

--- src/bulk_trader/core.cljs
+++ src/bulk_trader/core.cljs
@@ -18,8 +18,17 @@
         (let [checked (.-checked (aget (.-children (aget (.-children (aget children i)) 0)) 0))]
           (if checked i (recur (dec i))))))))

+(defn trader-view [trader owner]
+  (reify om/IRender
+    (render [this]
+      (dom/div "radio"
+               (dom/label "form-group"
+                          (dom/input #js {:type "radio" :name "optionRadios"
+                                          :value (:v trader)}
+                                     (:n trader)))))))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; event-handlers
+;; event-handlers and views

 (defn e-login [e]
   (let [trader (find-selected-trader e)
@@ -28,23 +37,12 @@
                                        ;; (= 1 trader) (icici/login)
                                        )]
     (if logged-in?
-      (.log js/console "Congratulations! Logged in successfully, to trader: " trader-name)
+      (do (.log js/console "Congratulations! Logged in successfully, to trader: " trader-name)
+          )
       (js/alert "Login failed! Please try again."))

     ;; return "false" is deprecated
     (.preventDefault e)))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; views
-
-(defn v-trader-view [trader owner]
-  (reify om/IRender
-    (render [this]
-      (dom/div "radio"
-               (dom/label "form-group"
-                          (dom/input #js {:type "radio" :name "optionRadios"
-                                          :value (:v trader)}
-                                     (:n trader)))))))

 (defn v-login [traders owner]
   (reify om/IRender
@@ -52,7 +50,7 @@
       (dom/form #js {:action "#"}
                (dom/h3 nil "Select Trader")
                (apply dom/div "radio"
-                      (om/build-all v-trader-view traders))
+                      (om/build-all trader-view traders))
                (dom/div nil
                         (dom/label nil
                                    (dom/button #js {:className "btn btn-default"


tighten up the args and iterations

tighten up the args and iterations

--- src/cap_and_send/core.clj
+++ src/cap_and_send/core.clj
@@ -14,8 +14,8 @@
 (defn- delete-file [file] ""
   (fs/delete file))

-(defn- do-cap [cap-frame-cnt fps frame-dir] ""
-  (println "doing capture with total frames: " cap-frame-cnt
+(defn- do-cap [cap-time-secs fps frame-dir] ""
+  (println "doing capture with total time: " cap-time-secs
            " fps: " fps
            " into frame dir: " frame-dir)
   (let [in ["streamer"
@@ -26,14 +26,14 @@
             "-j"
             "100"
             "-t"
-            cap-frame-cnt
+            (str (* (read-string fps) (read-string cap-time-secs)))
             "-r"
             fps]]
     (try
-      (println "in: " in)
+      (println "cap in: " in)
       (apply sh in)
       (catch Throwable t
-        (println "error: " (.getMessage t))))))
+        (println "cap error: " t (.getMessage t))))))

 (defn- get-clip-number [frame-file] ""
   (let [name (.getName frame-file)
@@ -92,16 +92,22 @@

 (defn -main
   "I don't do a whole lot ... yet."
-  [cap-frame-cnt clip-interval fps frame-dir clip-dir intermediate-dir s3-upload-dir]
+  [cap-time-secs clip-interval-ms fps frame-dir clip-dir intermediate-dir s3-upload-dir]
   (do (clear-dir frame-dir)
       (clear-dir clip-dir)
       (clear-dir intermediate-dir)
       (clear-dir s3-upload-dir)

-      (future (do-cap cap-frame-cnt fps frame-dir))
-      (dotimes [i 100]
-        (do
-          (Thread/sleep (read-string clip-interval))
-          (do-clip fps frame-dir clip-dir (str s3-upload-dir "/" i ".mp4"))
-          ))
+      (future (do-cap cap-time-secs fps frame-dir))
+      (let [clips-iterations (int
+                               (/
+                                (read-string cap-time-secs)
+                                 (/
+                                   (read-string clip-interval-ms)
+                                   1000)))]
+        (dotimes [i clips-iterations]
+          (do
+            (Thread/sleep (read-string clip-interval-ms))
+            (do-clip fps frame-dir clip-dir (str s3-upload-dir "/" i ".mp4"))
+            )))
       ))


Added a pretty print function

Added a pretty print function

--- src/cassidy/xmlrunoff.clj
+++ src/cassidy/xmlrunoff.clj
@@ -1,5 +1,6 @@
 (ns cassidy.xmlrunoff
-  (:require [saxon :refer [compile-xml compile-xslt query]]))
+  (:require [saxon :refer [compile-xml compile-xslt query]]
+            [clojure.java.io :as io]))

 (def saxon-testfile (compile-xml (java.io.File. "resources/testshon.html")))
@@ -23,3 +24,7 @@
   (let [node-name (context-node-name shon-node)]
     (if (seq node-name)
       (keyword node-name))))
+
+(defn pretty-print [xml]
+  (let [identity-xform (compile-xslt (io/resource "Identity.xslt"))]
+    (println (str (identity-xform (compile-xml xml))))))


ignoring exit code for restart

ignoring exit code for restart

--- src/celestial/dnsmasq.clj
+++ src/celestial/dnsmasq.clj
@@ -5,20 +5,22 @@
     [clojure.core.strint :only (<<)]
     [celestial.ssh :only (execute step)]))

-(def restart (step :restart-service "sudo service dnsmasq restart"))
+(defn ignore-code [s]
+  (with-meta s (merge (meta s) {:ignore-code true})))
+
+(def restart
+  (step :restart-service "sudo service dnsmasq stop" "sudo service dnsmasq start"))

 (defn add-host [{:keys [hostname ip_address dnsmasq]}]
   (execute dnsmasq
-      (step :add-host (<< "echo '~{ip_address} ~{hostname}' | sudo tee -a /etc/hosts >>/dev/null" ))
-       restart
-      ))
+      (step :add-host (<< "echo '~{ip_address} ~{hostname}' | sudo tee -a /etc/hosts >> /dev/null" ))
+      (ignore-code restart)))

 (defn remove-host [{:keys [hostname ip_address dnsmasq]}]
   (execute dnsmasq
     (step :remove-host (<< "sudo sed -ie \"\\|^~{ip_address} ~{hostname}\\$|d\" /etc/hosts"))
-     restart
-        ))
+    (ignore-code restart)))

 ; (add-host "foo" "192.168.20.90")
 ; (remove-host "foo" "192.168.20.90")


Make find targets recursive

Make find targets recursive

--- src/obb_rules/ai/common.clj
+++ src/obb_rules/ai/common.clj
@@ -47,7 +47,8 @@
         result (process player game attacker raw-action)]
     (if (result/failed? result)
       targets
-      (conj targets (build-target player result raw-action distance)))))
+      (let [targets (conj targets (build-target player result raw-action distance))]
+        (recur game attacker targets next-coordinate (+ 1 distance))))))

 (defn attack-options
   "Returns a collection of possible options for attack


CLJS-1213: cljs.analyzer incorrectly marks all defs as tests when eliding test metadata

fix the cond-> to actually check for :test presence.

--- src/clj/cljs/analyzer.clj
+++ src/clj/cljs/analyzer.clj
@@ -856,9 +856,10 @@
       (swap! env/*compiler* assoc-in [::namespaces ns-name :defs sym]
         (merge
           {:name var-name}
-          ;; elide test metadata, as it includes non-valid EDN - David
+          ;; remove actual test metadata, as it includes non-valid EDN and
+          ;; cannot be present in analysis cached to disk - David
           (cond-> sym-meta
-            :test (-> (dissoc :test) (assoc :test true)))
+            (:test sym-meta) (assoc :test true))
           {:meta (-> sym-meta
                    (dissoc :test)
                    (update-in [:file]


fn arity warnings should be enable by default

--- src/clj/cljs/analyzer.clj
+++ src/clj/cljs/analyzer.clj
@@ -29,6 +29,7 @@
    :redef true
    :dynamic true
    :fn-var true
+   :fn-arity true
    :fn-deprecated true
    :protocol-deprecated true})

@@ -48,10 +49,11 @@

 (defmacro no-warn [& body]
   `(binding [*cljs-warnings*
-             {:redef false
+             {:undeclared false
+              :redef false
               :dynamic false
+              :fn-var false
               :fn-arity false
-              :fn-var false
               :fn-deprecated false
               :protocol-deprecated false}]
      ~@body))


CLJS-389: Compiler emits throw string

CLJS-389: Compiler emits throw string

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -465,7 +465,7 @@
                 (emitln "return " n ".call(this" (if (zero? pcnt) nil
                                                      (list "," (comma-sep (take pcnt maxparams)))) ");"))))
           (emitln "}")
-          (emitln "throw('Invalid arity: ' + arguments.length);")
+          (emitln "throw(new Error('Invalid arity: ' + arguments.length));")
           (emitln "};")
           (when variadic
             (emitln mname ".cljs$lang$maxFixedArity = " max-fixed-arity ";")


duplicated work - also done in studio setup fn

--- src/overtone/studio/rig.clj
+++ src/overtone/studio/rig.clj
@@ -266,10 +266,6 @@
   [inst & ctls]
   (apply node-control (:group inst) (id-mapper ctls)))

-(if (and (nil? @inst-group*)
-         (connected?))
-  (dosync (ref-set inst-group* (group :head (root-group)))))
-
 (defonce session* (ref
                     {:metro (metronome 120)
                      :tracks {}


* src/clj/cljs/compiler.clj: preserve tag information on the form of invoke exprs

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -1359,7 +1359,7 @@
            (warning env
              (str "WARNING: Wrong number of args (" argc ") passed to " name)))))
      {:env env :op :invoke :form form :f fexpr :args argexprs
-      :tag (-> fexpr :info :tag) :children (into [fexpr] argexprs)})))
+      :tag (or (-> fexpr :info :tag) (-> form meta :tag)) :children (into [fexpr] argexprs)})))

 (defn analyze-symbol
   "Finds the var associated with sym"


Clean-Up

Clean-Up

--- src/cljs/drawer/core.cljs
+++ src/cljs/drawer/core.cljs
@@ -67,9 +67,7 @@
     (if (= (get-in state [:info :selected]) obj-name)
       (set! (.-strokeStyle context) "#f00")
       (set! (.-strokeStyle context) "#000"))
-    (canvas/draw-object obj context))
-  ;;(gui/redraw-object-list state)
-  )
+    (canvas/draw-object obj context)))

 (defn- run-loop
   "Runs the redrawing loop."


Start using om properly.  (Still baby steps).

--- src/cljs/primes/core.cljs
+++ src/cljs/primes/core.cljs
@@ -11,19 +11,41 @@

 (ns primes.core.core
-  (:require [om.core :as om :include-macros true]
+  (:require [clojure.string :as str]
+            [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]
             [degel.primes.numbers :as nums]))

 (enable-console-print!)

-(def app-state (atom {:title "Integer sets"
-                      :integer-sets (nums/group-signatures 1000)}))
+(def app-state (atom {:title "Integer composite groups"
+                      :integer-sets (nums/group-signatures 100)}))

-(om/root
-  (fn [app owner]
-    (apply dom/ul nil
-           (map #(dom/li nil (str %))
-                (:integer-sets app))))
-  app-state
-  {:target (. js/document (getElementById "app"))})
+
+(defn sort-groups [number-groups]
+  (sort-by (comp count second) >
+           (sort-by (comp first second) < number-groups)))
+
+(defn group-view [[signature numbers] owner]
+  (reify
+    om/IRender
+    (render [this]
+      (dom/li nil
+              (dom/b nil (str/join ", " signature))
+              ": "
+              (dom/small nil (dom/i nil (str/join ", " numbers)))))))
+
+(defn groups-view [app owner]
+  (reify
+    om/IRender
+    (render [this]
+      (dom/div nil
+               (dom/h1 nil (:title app))
+               (dom/button nil "show more")
+               (dom/h2 nil (:title app))
+               (apply dom/ul nil
+                      (om/build-all group-view (sort-groups (:integer-sets app))))))))
+
+(om/root groups-view
+         app-state
+         {:target (. js/document (getElementById "app"))})


Fix constant generation for cljs.

Fix constant generation for cljs.

--- src/cljs/quil/sketch.cljs
+++ src/cljs/quil/sketch.cljs
@@ -11,7 +11,7 @@

 (defn current-applet [] *applet*)

-(u/generate-quil-constants
+(u/generate-quil-constants :cljs
   rendering-modes (:java2d :p2d :p3d :opengl))

 (defn resolve-renderer [mode]


WIP on storm revival

WIP on storm revival

--- src/polismath/stormspec.clj
+++ src/polismath/stormspec.clj
@@ -1,9 +1,8 @@
-(ns polismath.storm-spec
+(ns polismath.stormspec
   (:import [backtype.storm StormSubmitter LocalCluster])
-  (:require [incanter.core :as ic.core])
   (:use [backtype.storm clojure config]
-        polismath.matrix-utils
-        polismath.pca
+        polismath.named-matrix
+        polismath.conversation
         polismath.simulation)
   (:gen-class))

@@ -35,41 +34,20 @@
             new-value (apply update-fn value inputs)]
         (assoc data conv-id new-value)))))

-; This is a little bit of a hack. Need to get pca working on matrices with just a couple of elements still...
-;(def init-matrix (->RatingMatrix ["p1" "p2" "p3"] ["c1" "c2" "c3"] [[1 1 0] [0 1 -1] [0 -1 1]]))
-; this might actually be really bad for structural sharing (keeping a head around); don't understand all of
-; the intricacies of structural sharing though
-(def init-matrix (named-matrix))

-(defbolt rating-matrix ["conv-id" "rating-matrix"] {:prepare true}
+(defbolt conv-update ["conv"] {:prepare true}
   [conf context collector]
-  (let [data (atom {})]
+  (let [convs (atom {})]
     (bolt (execute [tuple]
       (let [[conv-id reaction] (.getValues tuple)]
-        (swap! data
-               (data-updater #(update-nmat % [reaction]) #(identity init-matrix))
-               conv-id)
+        (swap! convs
+               (data-updater
+                 #(conv-update % [reaction]) hash-map)
+                 conv-id)
         (emit-bolt! collector
-                    [conv-id (ic.core/matrix (:matrix (get @data conv-id)))]
-                    :anchor tuple))))))
-
-
-(defbolt ptpt-pca ["conv-id" "pcs" "proj"] {:prepare true}
-  [conf context collector]
-  ; If nothing exists yet, creating an empty matrix
-  (let [data (atom {})
-        n-comps 2]
-    (bolt (execute [tuple]
-      (let [[conv-id rating-matrix] (.getValues tuple)]
-        (swap! data (data-updater #(powerit-pca rating-matrix n-comps :start-vectors % :iters 5)) conv-id)
-        (let [pcs (get @data conv-id)
-              proj (pca-project rating-matrix pcs)]
-          (emit-bolt! collector [conv-id pcs proj])))))))
-
-
-;(defbolt clusters ["clusters"] {:prepare true}
-  ;[conf context collector]
-  ;(let [
+                    [(get @data conv-id)]
+                    :anchor tuple)
+        (ack! collector tuple))))))

 (defn mk-topology []
@@ -77,11 +55,9 @@
     ; Spouts:
     {"1" (spout-spec reaction-spout)}
     ; Bolts:
-    {"2" (bolt-spec {"1"  ["conv-id"]}
-                    rating-matrix)
-     "3" (bolt-spec {"2" ["conv-id"]}
-                    ptpt-pca)
-     }))
+    {"2" (bolt-spec
+           {"1"  ["conv-id"]}
+           conv-update)}))

 (defn run-local! []


Fix spec

Fix spec

--- src/discuss/utils/specs.cljs
+++ src/discuss/utils/specs.cljs
@@ -5,13 +5,8 @@
 (s/fdef discuss.utils.common/trim-all
         :args (s/cat :str string?)
         :ret string?
-        :fn #(> (-> % :ret count) (-> % :args :str count)))
+        :fn #(<= (-> % :ret count) (-> % :args :str count)))

-(stest/instrument 'discuss.utils.common/trim-all)
+;; (stest/instrument 'discuss.utils.common/trim-all)
 ;; (s/exercise-fn `discuss.utils.common/trim-all)
 ;; (stest/abbrev-result (first (stest/check `discuss.utils.common/trim-all)))
-
-;; (map #(-> % :clojure.test.check/ret pprint/pprint) (stest/check `discuss.utils.common/trim-all))
-
-;; (require '[discuss.utils.common-test])
-;; (discuss.utils.common-test/check' (stest/check `discuss.utils.common/trim-all))


[execute/run] Error in error-handling code. (#124)

--- src/cortex/nn/execute.clj
+++ src/cortex/nn/execute.clj
@@ -361,7 +361,9 @@
           batches (->> (dataset-batches dataset batch-size)
                        (map (partial graph/augment-streams (network/network->graph network))))
           _ (when (empty? batches)
-              (throw (ex-info "Batches were empty, perhaps batch-size > (count dataset)?")))
+              (throw (ex-info "Batches were empty, perhaps batch-size > (count dataset)?"
+                              {:batch-size batch-size
+                               :dataset-count (count dataset)})))

           batch-buffers (batch-buffers network (first batches) false)
           stream->buffer-map (zipmap (keys batch-buffers)


Add support for preconditions, example

Add support for preconditions, example

--- src/detritus/variants.clj
+++ src/detritus/variants.clj
@@ -2,25 +2,31 @@
   (:require [detritus.update :refer [take-when]]))

 (defmacro defvariant
-  {:doc "Defines a variant constructor with a namespace qualified tag, and keyword named members."
-   :arglists '([name doc-string? attr-map? members])}
+  "Defines a variant constructor with a namespace qualified tag, and keyword
+  named members. Preconditions on members may be specified by the pre-map.
+
+  Ex. (defvariant test \"A demo variant\" [a b]
+        {:pre [(number? a) (vector? b)]})"
+  {:arglists '([name doc-string? attr-map? members pre-map?])}
   [vname & args]
   (let [;; Parse direct args
-        [?docstring args] (take-when string? "" args)
-        [?attr-map args]  (take-when map? {} args)
-        members           (first args)
-
+        [?docstring args]    (take-when string? "" args)
+        [?attr-map args]     (take-when map? {} args)
+        [members args]       (take-when vector? nil args)
+        [?pre-map args] (take-when map? {} args)
+
         ;; FIXME inline guards are a bad habit of mine
-        _                 (assert (vector? members) "Members is not a vector!")
-        _                 (assert (every? symbol? members) "Members may contain only symbols!")
+        _                    (assert (vector? members) "Members is not a vector!")
+        _                    (assert (every? symbol? members) "Members may contain only symbols!")

         ;; Build used datastructures
-        kw-members        (map (comp keyword name) members)
-        kw-tag            (keyword (name (ns-name *ns*))
-                                   (name vname))
-        ?attr-map         (assoc ?attr-map
-                                 :variant true
-                                 :variant/members kw-members
-                                 :variant/tag kw-tag)]
-    `(defn ~vname ~?docstring ~?attr-map ~members
-       [~kw-tag (hash-map ~@(interleave kw-members members))])))
+        kw-members           (map (comp keyword name) members)
+        kw-tag               (keyword (name (ns-name *ns*))
+                                      (name vname))
+        ?attr-map            (assoc ?attr-map
+                                    :variant true
+                                    :variant/members kw-members
+                                    :variant/tag kw-tag)]
+  `(defn ~vname ~?docstring ~?attr-map ~members
+     ~?pre-map
+     [~kw-tag (hash-map ~@(interleave kw-members members))])))


intolerant of abbreviations

intolerant of abbreviations

--- src/ophion/search.clj
+++ src/ophion/search.clj
@@ -82,7 +82,7 @@

 (defn multi-term
   [term]
-  {:aggs
+  {:aggregations
    {(keyword term)
     {:terms
      {:field (str term ".keyword")


add docstring

add docstring

--- src/overtone/util.clj
+++ src/overtone/util.clj
@@ -100,7 +100,9 @@
         (log/debug "Handler Exception - got args:" args"\n"
                    (with-out-str (.printStackTrace e)))))))

-(defn map-vals [f m]
+(defn map-vals
+  "Takes a map m and returns a new map with all of m's values mapped through f"
+  [f m]
   (zipmap (keys m)
           (map f (vals m))))


Document core namespace.

Document core namespace.

--- src/fhofherr/simple/core.clj
+++ src/fhofherr/simple/core.clj
@@ -1,4 +1,5 @@
 (ns fhofherr.simple.core
+  "Simple CI's application core."
   (:require [fhofherr.simple.core.dsl] ; Required to pass it to load-config
             [fhofherr.simple.core [config :as config]
              [job-fn :as job-fn]
@@ -7,6 +8,7 @@
              [job-execution-context :as ex-ctx]]))

 (defn load-core
+  "Bootstrap Simple CI using the `config-file` contained in `project-dir`."
   [project-dir config-file]
   (let [js (as-> (str project-dir "/" config-file) $
                  (config/load-config (the-ns 'fhofherr.simple.core.dsl) $)
@@ -17,11 +19,14 @@
      :project-dir project-dir}))

 (defn has-job?
+  "Check if the `core` has a job named `job-name`."
   [core job-name]
   (contains? (:jobs core) (name job-name)))

 (defn start-job!
+  "Start the job named `job-name`."
   [core job-name]
+  {:pre [(has-job? core job-name)]}
   (if-let [jd (get-in core [:jobs (name job-name)])]
     (as-> core $
           (:project-dir $)


Draft, not working, improvements

Draft, not working, improvements


Refactor a bit and add init function

Refactor a bit and add init function

--- src/golden_kestrel/core.cljs
+++ src/golden_kestrel/core.cljs
@@ -1,6 +1,7 @@
-(ns embed-om.core
-  (:require [om.core :as om :include-macros true]
-            [om.dom :as dom :include-macros true]))
+(ns golden-kestrel.core
+  (:require
+    [om.core :as om :include-macros true]
+    [om.dom :as dom :include-macros true]))

 (enable-console-print!)

@@ -9,8 +10,7 @@
          :badge-details ""
          :popover "right"
          :hide-no-mentions true
-         :message "such interactivity, much donut, wow"
-         :doi "10.1038/nature.2012.9872"}))
+         :doi "10.1038/nature.2014.14583"}))

 (defn update-app
   [data item e]
@@ -40,61 +40,70 @@
            nil))

 (defn embed-form [data owner]
-  (dom/div nil
-           (dom/div #js {:className "form-control"}
-             (dom/label nil "Badge type")
-             (dom/select #js {:ref "badgeType"
-                              :value (:badge-type data)
-                              :defaultValue (:badge-type data)
-                              :onChange (partial update-app data :badge-type)}
-                         (dom/option #js {:value ""} "Default")
-                         (dom/option #js {:value "1"} "1")
-                         (dom/option #js {:value "4"} "4")
-                         (dom/option #js {:value "donut"} "Donut")
-                         (dom/option #js {:value "medium-donut"} "Medium donut")
-                         (dom/option #js {:value "large-donut"} "Large donut")))
-           (dom/div #js {:className "form-control"}
-                    (dom/label nil "Popover")
-                    (dom/select #js {:ref "popover"
-                                     :value (:popover data)
-                                     :defaultValue (if (= "" (:badge-details data)) (:popover data) "")
-                                     :onChange (partial update-app data :popover)}
-                                (dom/option #js {:value ""} "None")
-                                (dom/option #js {:value "top"} "Top")
-                                (dom/option #js {:value "right"} "Right")
-                                (dom/option #js {:value "bottom"} "Bottom")
-                                (dom/option #js {:value "left"} "Left")))
-           (dom/div #js {:className "form-control"}
-             (dom/label nil "Details")
-             (dom/select #js {:ref "details"
-                              :value (:badge-details data)
-                              :defaultValue (if (= "" (:popover data)) (:badge-details data) "")
-                              :onChange (partial update-app data :badge-details)}
-                         (dom/option #js {:value ""} "None")
-                         (dom/option #js {:value "right"} "Right")))
-           (dom/div #js {:className "form-control"}
-             (dom/label nil "Hide no mentions?")
-             (dom/input #js {:ref "hideNoMentions"
-                             :type "checkbox"
-                             :checked (:hide-no-mentions data)
-                             :onChange (partial update-app data :hide-no-mentions)} nil))
-           (dom/div #js {:className "form-control"}
-             (dom/label nil "DOI")
-             (dom/input #js {:ref "doi"
-                             :type "text"
-                             :size "40"
-                             :defaultValue (:doi data)
-                             :onChange (partial update-app data :doi)} nil))))
+  (let [change-data (partial update-app data)]
+    (dom/div
+      nil
+      (dom/div #js {:className "form-control"}
+               (dom/label nil "Badge type")
+               (dom/select #js {:ref "badgeType"
+                                :value (:badge-type data)
+                                :defaultValue (:badge-type data)
+                                :onChange (partial change-data :badge-type)}
+                           (dom/option #js {:value ""} "Default")
+                           (dom/option #js {:value "1"} "1")
+                           (dom/option #js {:value "4"} "4")
+                           (dom/option #js {:value "donut"} "Donut")
+                           (dom/option #js {:value "medium-donut"} "Medium donut")
+                           (dom/option #js {:value "large-donut"} "Large donut")))
+      (dom/div #js {:className "form-control"}
+               (dom/label nil "Popover")
+               (dom/select #js {:ref "popover"
+                                :value (:popover data)
+                                :defaultValue (if (= "" (:badge-details data))
+                                                (:popover data)
+                                                "")
+                                :onChange (partial change-data :popover)}
+                           (dom/option #js {:value ""} "None")
+                           (dom/option #js {:value "top"} "Top")
+                           (dom/option #js {:value "right"} "Right")
+                           (dom/option #js {:value "bottom"} "Bottom")
+                           (dom/option #js {:value "left"} "Left")))
+      (dom/div #js {:className "form-control"}
+               (dom/label nil "Details")
+               (dom/select #js {:ref "details"
+                                :value (:badge-details data)
+                                :defaultValue (if (= "" (:popover data))
+                                                (:badge-details data)
+                                                "")
+                                :onChange (partial change-data :badge-details)}
+                           (dom/option #js {:value ""} "None")
+                           (dom/option #js {:value "right"} "Right")))
+      (dom/div #js {:className "form-control"}
+               (dom/label nil "Hide no mentions?")
+               (dom/input #js {:ref "hideNoMentions"
+                               :type "checkbox"
+                               :checked (:hide-no-mentions data)
+                               :onChange (partial change-data :hide-no-mentions)}
+                          nil))
+      (dom/div #js {:className "form-control"}
+               (dom/label nil "DOI")
+               (dom/input #js {:ref "doi"
+                               :type "text"
+                               :size "40"
+                               :defaultValue (:doi data)
+                               :onChange (partial change-data :doi)} nil)))))

-(om/root
- app-state
- (fn [app owner]
-   (om/component (embed-form app owner)))
- (. js/document (getElementById "embed-form")))
+(defn ^:export init
+  []
+  (om/root
+    app-state
+    (fn [app owner]
+      (om/component (embed-form app owner)))
+    (. js/document (getElementById "embed-form")))

-(om/root
- app-state
- (fn [app owner]
-   (js/setTimeout js/_altmetric_embed_init 500)
-   (om/component (embed app)))
- (. js/document (getElementById "embed-example")))
+  (om/root
+    app-state
+    (fn [app owner]
+      (js/setTimeout js/_altmetric_embed_init 500)
+      (om/component (embed app)))
+    (. js/document (getElementById "embed-example"))))


Depend on munge not urlencode

Depend on munge not urlencode

--- src/grimoire/api/fs/impl.clj
+++ src/grimoire/api/fs/impl.clj
@@ -6,8 +6,7 @@
             [grimoire.things :as t]
             [grimoire.api.fs :refer [Config?]]
             [detritus.variants :as v]
-            [clojure.java.io :as io]
-            [cemerick.url :as url]))
+            [clojure.java.io :as io]))

 (defn file?
   [h]
@@ -47,7 +46,7 @@
                  (:notes)    "/notes.md"
                  nil)
         n      (if (= ::t/def (v/tag thing))
-                 (url/url-encode (t/thing->name thing))
+                 (util/munge (t/thing->name thing))
                  (t/thing->name thing))
         h      (io/file p (str n e))]
     h))


prime num example

prime num example

--- src/thinking/recursion.cljc
+++ src/thinking/recursion.cljc
@@ -6,9 +6,16 @@
 (def factorial
   (fn [n]
     (loop [cnt n acc 1]
-       (if (zero? cnt)
-            acc
-          (recur (dec cnt) (* acc cnt))))))
+      (if (zero? cnt)
+        acc
+        (recur (dec cnt) (* acc cnt))))))
+
+(defn prime?
+  [num]
+  (loop [start-num 2]
+    (if (> start-num (Math/sqrt num)) true
+        (if (= (rem num start-num) 0) false
+            (recur (inc start-num))))))

 (defn find-needle [needle haystack]
   (loop [needle needle


Story ID: RPC-174 use getTextContent, instead of .innerHtml for better compatibility

--- src/untangled/test/dom.cljs
+++ src/untangled/test/dom.cljs
@@ -73,13 +73,14 @@
                   selector (str/join ["[" attr "=" value "]"])]
               (or (.querySelector element selector) nil)))))

+
 (defn has-visible-text
   "A test assertion that uses find-element to process search-kind and search-param on the given dom, then
   asserts (cljs.test/is) that the given element has the given text."
   [text-or-regex search-kind search-param dom]
   (if-let [ele (find-element search-kind search-param dom)]
     (if-not (node-contains-text? text-or-regex ele)
-      (t/do-report {:type :fail :actual (.-innerHTML ele) :expected text-or-regex})
+      (t/do-report {:type :fail :actual (gd/getTextContent ele) :expected text-or-regex})
       (t/do-report {:type :pass })
       )
     (t/do-report {:type     :error :message (str "Could not find element " search-kind search-param)


Add the ability to specify the user id on user service.

--- src/uxbox/services/auth.clj
+++ src/uxbox/services/auth.clj
@@ -7,6 +7,7 @@
 (ns uxbox.services.auth
   (:require [mount.core :as mount :refer (defstate)]
             [suricatta.core :as sc]
+            [clj-uuid :as uuid]
             [buddy.hashers :as hashers]
             [buddy.sign.jwe :as jwe]
             [buddy.core.nonce :as nonce]
@@ -39,7 +40,8 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (def +user-schema+
-  {:username [us/required us/string]
+  {:id [us/uuid]
+   :username [us/required us/string]
    :email [us/required us/email]
    :password [us/required us/string]})

@@ -48,11 +50,12 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (defn create-user
-  [conn {:keys [username password email] :as data}]
-  (let [sql (str "INSERT INTO users (username, email, password)"
-                 " VALUES (?, ?, ?) RETURNING *;")
-        ;; password (hashers/encrypt password)
-        sqlv [sql username email password]]
+  [conn {:keys [id username password email] :as data}]
+  {:pre [(us/validate! data +user-schema+)]}
+  (let [sql (str "INSERT INTO users (id, username, email, password)"
+                 " VALUES (?, ?, ?, ?) RETURNING *;")
+        id (or id (uuid/v4))
+        sqlv [sql id username email password]]
     (some-> (sc/fetch-one conn sqlv)
             (usc/normalize-attrs))))


in a stable state

in a stable state

--- src/epicea/typed/core.clj
+++ src/epicea/typed/core.clj
@@ -5,22 +5,34 @@
             [epicea.utils.access :as access] :reload-all))

 (spec/def ::unspecified nil?)
+
 (spec/def ::bool boolean?)
 (spec/def ::float float?)
 (spec/def ::double double?)
 (spec/def ::long #(instance? java.lang.Long %))
-(spec/def ::int #(instance? java.lang.Integer %))
+(spec/def ::int #(or (instance? java.lang.Integer %)
+                     (int? %)))
+
+(spec/def ::primitive-value
+  (spec/or
+   :bool ::bool
+   :float ::float
+   :double ::double
+   :long ::long
+   :int ::int))
+
 (spec/def ::primitive (spec/or
                        :bool (partial = :bool)
                        :float (partial = :float)
                        :long (partial = :long)
                        :double (partial = :double)
                        :int (partial = :int)))
+
 (spec/def ::dynamic (partial = :dynamic))

 (spec/def ::number (spec/or :type #(or (= % :number)
                                        (= % :double))
-                            :literal number?))
+                            :value number?))
 (spec/def ::count number?)
 (spec/def ::key keyword?)

@@ -64,8 +76,9 @@
                    :header (spec/? ::sized-type)
                    :data ::sized-type))

-(spec/def ::type (spec/or :sized-type ::sized-type
-                          :primitive ::primitive
+(spec/def ::type (spec/or :primitive ::primitive
+                          :primitive-value ::primitive-value
+                          :sized-type ::sized-type
                           :array ::array
                           :dynamic ::dynamic))

@@ -155,10 +168,30 @@

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Compilable

-(defn compile-expr [argmap expr cb]
-  (cb argmap [:compiled expr]))
+(defn expr-access [i]
+  (access/vector-accessor i {:default-parent [nil nil]}))
+(def expr-type (expr-access 0))
+(def expr-value (expr-access 1))
+
+(defmultiple compile-expr (fn [argmap expr cb]
+                            (access/getx expr-type expr))
+  (:default
+   [argmap expr cb]
+   (cb argmap {:type (spec/conform ::type (access/getx expr-value expr))
+               :repr expr})))

 (def empty-argmap {})
+
+
+(defn value? [x]
+  (and (map? x)
+       (contains? x :type)
+       (contains? x :repr)))
+
+(defn check-is-value [x]
+  (if (not (value? x))
+    (throw (RuntimeException.
+            (str "Invalid value: " x)))))

 (defn compile-exprs [argmap exprs cb]
   (cond
@@ -166,8 +199,12 @@
     (empty? (rest exprs)) (compile-expr argmap (first exprs) cb)
     :default (compile-expr
               argmap (first exprs)
-              (fn [new-argmap _]
+              (fn [new-argmap x]
+                (check-is-value x)
                 (compile-exprs new-argmap (rest exprs) cb)))))
+
+(defn export-typed-value [value]
+  [:export value])

 (defmacro with-typed [& args]
   (let [parsed (spec/conform ::exprs args)]
@@ -176,7 +213,8 @@
               (str "Failed to parsed typed: "
                    (spec/explain-str ::exprs args))))
       (compile-exprs empty-argmap parsed (fn [final-argmap final-value]
-                                           [:final final-value])))))
+                                           (check-is-value final-value)
+                                           (export-typed-value final-value))))))

-(macroexpand '(with-typed 9 (+ 4 5)))
+(macroexpand '(with-typed 9 4 5 6))


Was being too clever for my own good when creating mailto link

--- src/foreclojure/utils.clj
+++ src/foreclojure/utils.clj
@@ -174,7 +174,7 @@
          (let [email "team@4clojure.com"]
            [:span
             [:a#contact {:href (str "mailto:" email)} "Contact us"]
-            (str `(~email))])]
+            (str " (" email ")")])]
         (javascript-tag
          " var _gaq = _gaq || [];
         _gaq.push(['_setAccount', 'UA-22844856-1']);


Mention input->screen in docstring

Mention input->screen in docstring

--- src/play_clj/core.clj
+++ src/play_clj/core.clj
@@ -148,6 +148,7 @@
         entities))

     ; input functions
+    ; Tip: convert :input-x and :input-y to screen coordinates with input->screen
     (defscreen my-screen
       :on-key-down ; a key was pressed
       (fn [screen entities]


Add dynamic var binding to `pmap`

Add dynamic var binding to `pmap`

--- src/promesa/exec.cljc
+++ src/promesa/exec.cljc
@@ -12,6 +12,7 @@
             #?(:cljs [goog.object :as gobj]))
   #?(:clj
      (:import
+      clojure.lang.Var
       java.lang.AutoCloseable
       java.util.concurrent.Callable
       java.util.concurrent.CompletableFuture
@@ -122,22 +123,22 @@
   [f]
   #?(:cljs f
      :clj
-     (let [frame (clojure.lang.Var/cloneThreadBindingFrame)]
+     (let [frame (Var/cloneThreadBindingFrame)]
        (fn
          ([]
-          (clojure.lang.Var/resetThreadBindingFrame frame)
+          (Var/resetThreadBindingFrame frame)
           (f))
          ([x]
-          (clojure.lang.Var/resetThreadBindingFrame frame)
+          (Var/resetThreadBindingFrame frame)
           (f x))
          ([x y]
-          (clojure.lang.Var/resetThreadBindingFrame frame)
+          (Var/resetThreadBindingFrame frame)
           (f x y))
          ([x y z]
-          (clojure.lang.Var/resetThreadBindingFrame frame)
+          (Var/resetThreadBindingFrame frame)
           (f x y z))
          ([x y z & args]
-          (clojure.lang.Var/resetThreadBindingFrame frame)
+          (Var/resetThreadBindingFrame frame)
           (apply f x y z args))))))

 ;; --- Public API
@@ -531,9 +532,12 @@
   notification is removed."
   {:experimental true}
   ([f coll]
-   (let [executor (resolve-executor *default-executor*)]
+   (let [executor (resolve-executor *default-executor*)
+         frame    (Var/cloneThreadBindingFrame)]
      (->> coll
-          (map (fn [o] (pt/-submit! executor #(f o))))
+          (map (fn [o] (pt/-submit! executor #(do
+                                                (Var/resetThreadBindingFrame frame)
+                                                (f o)))))
           (clojure.lang.RT/iter)
           (clojure.lang.RT/chunkIteratorSeq)
           (map (fn [o] (.get ^CompletableFuture o))))))


Add puget.printer/with-color macro.

Add puget.printer/with-color macro.

--- src/puget/printer.clj
+++ src/puget/printer.clj
@@ -39,6 +39,13 @@
    :function-symbol [:bold :blue]
    :class-delimiter [:blue]
    :class-name      [:bold :blue]})
+
+
+(defmacro with-color
+  "Executes the given bodies with colored output enabled."
+  [& body]
+  `(binding [*colored-output* true]
+     ~@body))


WIP Reinstated private-time-input. Displaying time range widget, but not working properly. Added new demos for ranges. Note one test is failing.

--- src/re_demo/time.cljs
+++ src/re_demo/time.cljs
@@ -213,7 +213,8 @@
                    [:pre [:code time-input-code]]
                    [:ul
                      [:li "Note that "[:code ":model"] " is (optionally an atom on) a vector of TWO integers"]
-                     [:li [:code ":to-label \"-\""] " puts a dash between the From and To input boxes"]]
+                     [:li [:code ":to-label \"From:\""] " puts a label before the From input box"]
+                     [:li [:code ":to-label \"To:\""] " puts a label before the To input box"]]
                    [:label "Demo -"]
                    time-input-demo]]])))


lein: eastwood bump

lein: eastwood bump

--- lein_profiles.clj
+++ lein_profiles.clj
@@ -1,7 +1,7 @@
 {:user {:plugins [
                   [lein-ring "0.8.13"]
                   [lein-ancient "0.5.5"]
-                  [jonase/eastwood "0.1.4"]
+                  [jonase/eastwood "0.1.5"]
                   [cider/cider-nrepl "0.7.0"]
                   ]}}
 {:dev {:dependencies


lein: lein-ancient bump

lein: lein-ancient bump

--- lein_profiles.clj
+++ lein_profiles.clj
@@ -1,6 +1,6 @@
 {:user {:plugins [
                   [lein-ring "0.9.3"]
-                  [lein-ancient "0.6.5"]
+                  [lein-ancient "0.6.6"]
                   [jonase/eastwood "0.2.1"]
                   [cider/cider-nrepl "0.9.0-SNAPSHOT"]
                   ]}}


Day 10 completed

Day 10 completed

--- src/adventofcode/solutions.clj
+++ src/adventofcode/solutions.clj
@@ -289,7 +289,9 @@
             (route-len (first all-routes))
             (rest all-routes))))

-(defn day10 [input iterations]
+(defn day10
+  "My input was '1113222113' and 40 and 50 iterations for parts 1 and 2 respectively"
+  [input iterations]
   (count
     (nth
       (iterate


removed tracknum from music-info

removed tracknum from music-info

--- src/server/rooms.cljs
+++ src/server/rooms.cljs
@@ -165,8 +165,7 @@
                         music-info {:tags tags
                                     :username username
                                     :originalfilename original-file-name
-                                    :id track-id
-                                    :tracknum track-num}
+                                    :id track-id}
                         music-info-json (transit/write writer music-info)]
                     (.hset redis-client (str "room:" room ":music-info")
                                         track-id


Something?

Something?

--- src/stratus/core.cljs
+++ src/stratus/core.cljs
@@ -8,6 +8,7 @@

 (def app-state (atom {:number 1 :article [ {:text "Hello, world!"}
                                            {:text "This is a new Paragraph."} ]}))
+(def states (atom [@app-state]))

 (defcomponent input [data owner]
   (init_state [this]


Fixed marks in export

Fixed marks in export

--- src/tango/export2.clj
+++ src/tango/export2.clj
@@ -152,7 +152,7 @@
     {:adjudicator/number 5}]},
   :round/dances [{:dance/name "Medium"} {:dance/name "Medium"}]}])

-(defn activity-result [] ()first )
+(defn activity-result [] (first (activities-with-result) ) )

 (defn make-file-name-with-timestamp
@@ -198,23 +198,25 @@
     :result/adjudicator {:adjudicator/number 1},
     :result/participant {:participant/number 144}}])

-(defn get-marks [result-facts]
-  (vec (map #(:result/mark-x %) result-facts)))
-
 (defn get-dancers [result-facts]
-  (apply hash-set (map #(get-in % [:result/participant :participant/number]) result-facts)))
-
-
-(defn get-results-for-dancer [result-facts dancer-number]
-  (let [dancer-result-facts (filter
-                             #(= dancer-number (get-in % [:result/participant :participant/number]))
-                             result-facts)]
-    {:dancer-number dancer-number
-     :marks (get-marks dancer-result-facts)}))
-
-(defn result-facts->result-array [result-facts]
-  (let [dancer-numbers (get-dancers result-facts)]
-    (vec (map #(get-results-for-dancer result-facts %) dancer-numbers ))))
+  (vec (sort  (apply hash-set (map #(get-in % [:result/participant :participant/number]) result-facts)))))
+
+(defn get-mark [result-facts dancer-number adjudicator-number]
+  (let [marks (filterv #(= dancer-number (get-in % [:result/participant :participant/number]))
+                       (filter #(= adjudicator-number (get-in % [:result/adjudicator :adjudicator/number])) result-facts))]
+    (if (empty? marks)
+      false
+      (get (first marks) :result/mark-x false))))
+
+(defn get-marks-for-dancer [result-facts adjudicator-numbers dancer-number]
+  (mapv (partial get-mark result-facts dancer-number) adjudicator-numbers))
+
+(defn result-facts->result-array [result-facts adjudicators]
+  (let [adjudicator-numbers (map :adjudicator/number adjudicators)
+        dancer-numbers (get-dancers result-facts)]
+    (mapv #(hash-map :dancer-number %
+                     :marks (get-marks-for-dancer result-facts adjudicator-numbers %))
+          dancer-numbers)))

 (defn activity-result->class-result [activity-result]
   {:class-name (:activity/name activity-result)
@@ -225,8 +227,37 @@
                                 (get-in activity-result [:round/panel :adjudicator-panel/adjudicators])))
             :dances (vec (map #(hash-map :name (:dance/name %))
                                 (get-in activity-result [:round/dances])))
-            :result-array (result-facts->result-array (:result/_activity activity-result))
-            }})
+            :result-array (result-facts->result-array (:result/_activity activity-result)
+                                                      (get-in activity-result
+                                                              [:round/panel
+                                                               :adjudicator-panel/adjudicators]))}})
+
+(def adjudicators
+  [{:adjudicator/number 1}
+   {:adjudicator/number 2}
+   {:adjudicator/number 3}
+   {:adjudicator/number 4}])
+
+(def result-facts
+  [{:result/mark-x true,
+    :result/adjudicator {:adjudicator/number 1},
+    :result/participant {:participant/number 143}}
+   {:result/mark-x true,
+    :result/adjudicator {:adjudicator/number 1},
+    :result/participant {:participant/number 141}}
+   {:result/mark-x false,
+    :result/adjudicator {:adjudicator/number 2},
+    :result/participant {:participant/number 141}}
+   {:result/mark-x false,
+    :result/adjudicator {:adjudicator/number 3},
+    :result/participant {:participant/number 141}}
+   {:result/mark-x true,
+    :result/adjudicator {:adjudicator/number 4},
+    :result/participant {:participant/number 141}}
+   {:result/mark-x true,
+    :result/adjudicator {:adjudicator/number 1},
+    :result/participant {:participant/number 144}}])
+

 ;; Provides useful Timbre aliases in this ns
 (log/refer-timbre)