cleaned up message statements

cleaned up message statements

--- src/strictly_specking/core.clj
+++ src/strictly_specking/core.clj
@@ -2,6 +2,9 @@
   (:require
    [strictly-specking.parse-spec]
    [strictly-specking.strict-keys :as strict-impl]
+   [strictly-specking.ansi-util :as cl :refer [color]]
+   [strictly-specking.annotated-pprint :as annot]
+   [clansi.core :refer [with-ansi]]
    [clojure.pprint :as pp]
    [clojure.string :as string]
    [clojure.set :as set]
@@ -82,15 +85,6 @@
     `(strictly-specking.strict-keys/strict-mapkeys-impl
       (strictly-specking.parse-spec/parse-keys-args ~@args) ~form)))

-
-
-
-
-
-
-
-
-
 ;; * moving from errors to messages

 ;; ** filtering errors
@@ -105,6 +99,8 @@
                                                   :id 1
                                                   :source-path 2
                                                   }]))
+
+;; *** detect missing-keys

 (defn missing-keys [error]
   (when (and (sequential? (:pred error))
@@ -121,6 +117,9 @@
                  :via [:fig-opt/builds :fig-opt/builds :fig-opt/build-config :fig-opt/build-config],
                  :in [0]})

+;; *** mark errors with a type
+
+
 (defn error-type [error]
   (cond
     (error ::unknown-key)      ::unknown-key
@@ -134,10 +133,14 @@
 (defn add-error-type [error]
   (assoc error ::error-type (error-type error)))

+;; *** parse out and added missing keys data on error
+
 (defn add-required-keys [error]
   (if-let [missing-required-keys (missing-keys error)]
     (assoc error ::missing-keys (missing-keys error))
     error))
+
+;; *** apply initial data transforms on errors

 (defn filter-errors [problems]
   (->> problems
@@ -145,6 +148,8 @@
        (map add-required-keys)
        (map add-error-type)))

+
+;; *** combine errors for single location
 ;; Sometimes there are multiple errors on the same path location

 (defn combined-or-pred [errors]
@@ -189,6 +194,14 @@
       fixed-errs)
     errors))

+(defn prepare-errors [explain-data validated-data]
+  (->> explain-data
+       ::s/problems
+       filter-errors
+       (map #(assoc % ::root-data validated-data))
+       sort-errors
+       combined-or-pred
+       corrections-overide-missing-required))

 #_(->> terrors
       ::s/problems
@@ -224,7 +237,6 @@
 ;; this will provide a more meaningful description of whats gone wrong
 ;; will delegete to a ns/key based error message if available

-;; temporary copy from spec until public fns make it into api
 ;; *** TODO this needs to be refined to the default error
 ;; must keep in mind that the error is going to be displayed below
 (defn message-default-str
@@ -259,10 +271,15 @@

 (def type-lookup->str (some-fn symbol-type-table pr-str))

+(defn resovlable-predicate? [x]
+  (or (symbol-type-table x)
+   (and
+    (sequential? x)
+    (= 1 (count x))
+    (symbol-type-table (first x)))))
+
 (defn pred-symbol->str [x]
-  (if-let [res (and (sequential? x)
-                    (= 1 (count x))
-                    (symbol-type-table (first x)))]
+  (if-let [res (resovlable-predicate? x)]
     res
     (type-lookup->str x)))

@@ -272,20 +289,36 @@
 (defn format-predicate-str [{:keys [pred val]}]
   (cond
     (seq-with-first 'or pred)
-    (str "It should satisfy one of: "  (string/join " | " (map (some-fn symbol-type-table str) (rest pred))))
+    (str (if (every? symbol-type-table (rest pred))
+           "It should be one of: "
+           "It should satisfy one of: ")
+         (string/join " | "
+                      (map #(color % :good-pred)
+                           (map (some-fn symbol-type-table str) (rest pred)))))
     (seq-with-first '+ pred)
-    (str "It should be a non-empty sequence of: " (pred-symbol->str (rest pred)))
+    (str "It should be a non-empty sequence of: " (color
+                                                   (pred-symbol->str (rest pred))
+                                                   :good-pred))
     (seq-with-first '* pred)
-    (str "It should be a sequence of: " (pred-symbol->str (rest pred)))
+    (str "It should be a sequence of: " (color (pred-symbol->str (rest pred)) :good-pred))
     :else
-    (str "It should satisfy "          (pred-symbol->str pred))))
-
-(defn format-seq-with-and [s]
-  (let [f (pr-str (first s))]
+    (str (if (resovlable-predicate? pred)
+           "It should be a "
+           "It should satisfy ")
+         (color (pred-symbol->str pred) :good-pred))))
+
+(defn format-seq-with-end [s end]
+  (let [f (color (pr-str (first s)) :focus-key)]
     (condp = (count s)
       1 f
-      2 (str f " and " (pr-str (second s)))
-      3 (str f ", " (format-seq-with-and (rest s))))))
+      2 (str f " " end " "(color (pr-str (second s)) :focus-key))
+      (str f ", " (format-seq-with-end (rest s) end)))))
+
+(defn format-seq-with-and [s]
+  (format-seq-with-end s 'and))
+
+(defn format-seq-with-or [s]
+  (format-seq-with-end s 'or))

 (defn format-summarized-value [v]
   (string/trim-newline
@@ -294,71 +327,209 @@
                *print-level* 2]
        (pp/pprint v)))))

+;; *** TODO figure out how to identify where to point to
+
+;; might not need this yet
+
+(defn parent [e]
+  (get-in (::root-data e) (butlast (:in e))))
+
+(defn current [e]
+  (get-in (::root-data e) (:in e)))
+
+(defn parent-pred [pred]
+  #(pred (parent %)))
+
+(def parent-sequence? (parent-pred sequential?))
+(def parent-vector? (parent-pred vector?))
+(def parent-map? (parent-pred map?))
+(def parent-set? (parent-pred set?))
+(def parent-coll? (parent-pred coll?))
+
 (defmulti error-message ::error-type)

 (defmethod error-message :default [e]
   (message-default-str e #_(select-keys e [:pred :path :val :reason :via :in])))

+(defn parent-type-str [e]
+  (cond
+    (parent-map? e)      "Map"
+    (parent-set? e)      "Set"
+    (parent-vector? e)   "Vector"
+    (parent-sequence? e) "Sequence"))
+
 (defn bad-value-message [{:keys [path pred val reason via in] :as e}]
   (let [k (last in)]
-    (if
-      (and (integer? k)
-           (< 1 (count in)))
-      ;; *** this is very dicey it might be a map in this case, no way to tell right now
-      ;; if we hade the original structure we could test for this
-      ;; also we may have pointers into the sequence structure at some point
-      ;; and then this will be obviated
-      (str "The sequence at key " (second (reverse in)) " has the wrong value "
-           (format-summarized-value val)  " at index " (pr-str k)
-           ". " (format-predicate-str e))
-      (str "The key " (pr-str k) " has the wrong value "
-           (format-summarized-value val) ". " (format-predicate-str e))))
-#_  (pp/pprint e)
-)
+    (cond
+      (parent-map? e)
+      (str "The key " (color (pr-str k) :focus-key)
+           " has the wrong value "
+           (color (format-summarized-value val) :bad-value)
+           ".\n  " (format-predicate-str e))
+      (parent-coll? e)
+      (str "The " (parent-type-str e)
+           " at " (color (pr-str (vec (butlast in))) :focus-path)
+           " contains bad value "
+           (color (format-summarized-value val) :bad-value)
+           ".\n  " (format-predicate-str e))
+      :else
+      (str "The key " (color (pr-str k) :focus-key)
+           " has the wrong value "
+           (color (format-summarized-value val) :bad-value)
+           ".\n  " (format-predicate-str e)))))

 (defmethod error-message ::bad-value [e] (bad-value-message e))
 (defmethod error-message ::bad-value-comb-pred [e] (bad-value-message e))

 (defmethod error-message ::should-not-be-empty [{:keys [path pred val reason via in] :as e}]
-  (str "The value " (pr-str val) " at key " (last in) " should not be empty. "
+  (str "The value " (color (pr-str val) :bad-value)
+       " at key " (color (last in) :focus-key)
+       " should not be empty.\n  "
        (format-predicate-str (update-in e [:pred] (fn [x] (list '+ x))))))

 (defmethod error-message ::unknown-key [{:keys [path pred val reason via in] :as e}]
-  (str "Found unrecognized key " (::unknown-key e) " at path " (pr-str in)))
+  (str "Found unrecognized key " (color (::unknown-key e) :error-key)
+       " at path " (color (pr-str in) :focus-path) "\n"
+       "  Must be one of: " (format-seq-with-or pred)))

 (defmethod error-message ::missing-required-keys [{:keys [path pred val reason via in] :as e}]
-  (pp/pprint e)
   (when-let [kys (not-empty (::missing-keys e))]
     (if (< 1 (count kys))
-      (str "Is missing required keys " (format-seq-with-and kys) " at path " (pr-str in))
-      (str "Is missing required key " (format-seq-with-and kys) " at path " (pr-str in)))))
+      (str "Missing required keys " (format-seq-with-and kys) " at path " (color (pr-str in) :focus-path))
+      (str "Missing required key "  (format-seq-with-and kys) " at path " (color (pr-str in) :focus-path)))))

 ;; *** TODO ::wrong-key
+;; upon reflection misspelling and wrong keys should have multiple options for correction
+;; we probably should move ::correct-key to ::correct-keys
+;; but the scores of the top choices should be close and in order
+
+(defmethod error-message ::wrong-key [{:keys [path pred val reason via in] :as e}]
+  (str "The key " (color (::wrong-key e) :error-key)
+       " is unrecognized. Perhaps you meant "
+       (color (::correct-key e) :correct-key)
+       "?"))

 ;; *** TODO ::misspelled-key
-
-#_ (def terr (s/explain-data :fig-opt/builds [{:compiler 1
-                                               :id 1
-                                               :asdfasdf [1]
-                                               :cowabunga ["asdf"]
-                                               }]))
-
-#_(->> terr
-      ::s/problems
-      filter-errors
-      combined-or-pred
-      corrections-overide-missing-required
-      sort-errors
-      (mapv error-message)
-      (map println))
-
-
-
-
-
-;; TODO: fill in the rest of the error types
-
-;; start on using pprint to print contextual errors
+;; upon reflection misspelling and wrong keys should have multiple options for correction
+;; we probably should move ::correct-key to ::correct-keys
+
+(defmethod error-message ::misspelled-key [{:keys [path pred val reason via in] :as e}]
+  (str "The key " (color (::misspelled-key e) :error-key)
+       " is misspelled. It should probably be "
+       (color (::correct-key e) :correct-key)))
+
+;; *** TODO: fill in the rest of the error types
+
+(defmulti inline-message ::error-type)
+
+(defmethod inline-message :default [e] (str "The key " (-> e :in last) " has a problem"))
+(defmethod inline-message ::bad-value [e]
+  (str "The key " (-> e :in last) " has a bad value"))
+
+(defmethod inline-message ::bad-value-comb-pred [e]
+  (str "The key " (-> e :in last) " has a bad value"))
+
+(defmethod inline-message ::should-not-be-empty [e]
+  (str "The key " (-> e :in last) " should not be empty"))
+
+(defmethod inline-message ::unknown-key [e]
+  (str "The key " (::unknown-key e) " is unrecognized"))
+
+;; this is interestion I need to add a key
+#_(defmethod inline-message ::missing-required-keys [e]
+  (str "XXXXX "
+       (-> e :in last)
+       " is missing"))
+
+(defmethod inline-message ::wrong-key [e]
+  (str "The key " (-> e ::wrong-key) " should probably be " (::correct-key e)))
+
+(defmethod inline-message ::misspelled-key [e]
+  (str "The key " (-> e ::misspelled-key) " should probably be " (::correct-key e)))
+
+
+;; *** use pprint to print contextual errors
+
+(defn pprint-sparse-path
+  ([data path key-message-map colors]
+   (pp/with-pprint-dispatch annot/error-path-dispatch
+     (pp/pprint
+      (annot/annotate-path-only
+       data
+       path
+       {:abbrev true
+        :comments (into {}
+                        (map (fn [[k message]]
+                               [k
+                                (merge {:key-colors     [:error-key]
+                                        :value-colors   [:reset]
+                                        :comment-colors [:pointer]
+                                        :comment message}
+                                       colors)])
+                             key-message-map))}))))
+  ([data path key-message-map]
+   (pprint-sparse-path data path key-message-map {})))
+
+;; *** pprint inline message
+
+(defmulti pprint-inline-message ::error-type)
+
+(defmethod pprint-inline-message :default [e]
+  (pprint-sparse-path (::root-data e) (butlast (:in e))
+                      {(last (:in e)) (inline-message e)}
+                      {:key-colors [:highlight]
+                       :value-colors [:bad-value]}))
+
+(defmethod pprint-inline-message ::unknown-key [e]
+  (pprint-sparse-path (::root-data e) (:in e)
+                      {(::unknown-key e) (inline-message e)}))
+
+(defmethod pprint-inline-message ::misspelled-key [e]
+  (pprint-sparse-path (::root-data e) (:in e)
+                      {(::misspelled-key e) (inline-message e)}))
+
+(defmethod pprint-inline-message ::wrong-key [e]
+  (pprint-sparse-path (::root-data e) (:in e)
+                      {(::wrong-key e) (inline-message e)}))
+
+(defmethod pprint-inline-message ::missing-required-keys [e]
+  (pprint-sparse-path (reduce #(assoc-in %1 (conj (vec (:in e)) %2)
+                                         '...)
+                              (::root-data e)
+                              (::missing-keys e))
+                      (:in e)
+                      (into {}
+                            (map (fn [k]
+                                   [k (str "The required key " (pr-str k) " is missing")]))
+                            (::missing-keys e))))
+
+(defn test-print [error]
+  (println (color "---------------------------------\n" :header))
+  (println (error-message error))
+  (println "\n")
+  ;; could should indent this
+  (pprint-inline-message error)
+  (println "\n")
+  (println (color "---------------------------------\n" :footer))
+  )
+
+(do
+  (def structer [{:compiler 1
+                :id 1
+                :asdfasdf [1 2]
+                ;:source-paths [""]
+                }])
+
+  (def terr (s/explain-data :fig-opt/builds structer))
+
+  (with-ansi
+    (->>
+     (prepare-errors terr structer )
+     #_(map pprint-inline-message)
+     (mapv test-print)
+     #_ (mapv error-message)
+     #_ (map println)))
+  )

 ;; pprint is in annotated-pprint.clj


remove inspect

remove inspect

--- src/pc/http/datomic2.clj
+++ src/pc/http/datomic2.clj
@@ -94,7 +94,7 @@
   [db document-id scope {:keys [remainder multiple]} [type e a v :as transaction]]
   (cond (= scope :admin) true
         (= scope :read) (and (= remainder (mod e multiple))
-                             (not (pc.utils/inspect (web-peer/taken-id? db document-id e))))))
+                             (not (web-peer/taken-id? db document-id e)))))

 (defn remove-float-conflicts [txes]
   (vals (reduce (fn [tx-index [type e a v :as tx]]


added fallen asleep

added fallen asleep

--- src/babel/english/lexicon-verbcoach.clj
+++ src/babel/english/lexicon-verbcoach.clj
@@ -702,7 +702,8 @@
                         :2 '()}}
       :english {:participle "falling asleep"
                 :present {:3sing "falls asleep"}
-                :past "fell asleep"}})
+                :past "fell asleep"
+                :past-participle "fallen-asleep"}})

    "father" {:synsem {:cat :noun
                       :agr {:gender :masc}


Comment correction

Comment correction

--- src/polismath/conversation.clj
+++ src/polismath/conversation.clj
@@ -92,7 +92,7 @@

    :in-conv     (plmb/fnk [conv user-vote-counts n-cmts]
                   "This keeps track of which ptpts are in the conversation (to be considered
-                  for base-clustering) based on home many votes they have. Once a ptpt is in,
+                  for base-clustering) based on how many votes they have. Once a ptpt is in,
                   they will remain in."
                   (as-> (or (:in-conv conv) #{}) in-conv
                     ; Start with whatever you have, and join it with anything that meets the criteria


Add docstrings to primary APIs

Add docstrings to primary APIs

--- src/pinpointer/core.cljc
+++ src/pinpointer/core.cljc
@@ -142,6 +142,9 @@
 (defonce ^:private last-explain-data (atom nil))

 (defn pinpoint-out
+  "A plugin implementation of s/*explain-out*.
+
+  Takes the same options as pinpoint."
   ([ed] (pinpoint-out ed {}))
   ([ed {:keys [width colorize fallback-on-error] :as opts
         :or {width 70, fallback-on-error true}}]
@@ -173,6 +176,12 @@
      (println "Success!!"))))

 (defn pinpoint
+  "Given a spec and a value that fails to conform, reports the spec error(s) in a human-friendly manner.
+
+  The opts map may have the following keys:
+    :width - Number of columns to try to wrap the report at. Defaults to 70.
+    :colorize - Can either be a keyword :ansi, :none or a fn that takes a color keyword and a string, and returns the colorized string. Defaults to :none.
+    :fallback-on-error - If set to true, falls back to s/explain-printer in case of an error during the analysis. Otherwise, throws the error. Defaults to true."
   ([spec x] (pinpoint spec x {}))
   ([spec x opts]
    (pinpoint-out (s/explain-data spec x) opts)))


remove newline at end of file

remove newline at end of file

--- src/clj/lambdacd/steps/control_flow.clj
+++ src/clj/lambdacd/steps/control_flow.clj
@@ -123,4 +123,4 @@
           temp-dir (utils/create-temp-dir home-dir)
           new-args  (assoc args :cwd temp-dir)]
       (utils/with-temp temp-dir
-                       (run-steps-in-sequence new-args ctx steps)))) )
+                       (run-steps-in-sequence new-args ctx steps)))) )


Remove collada.cljs, it's glTF now

Remove collada.cljs, it's glTF now

--- src/cljs/gampg/learn_gamma/collada.cljs
+++ src/cljs/gampg/learn_gamma/collada.cljs
@@ -1,360 +0,0 @@
-(ns ^:figwheel-load gampg.learn-gamma.collada
-    (:require [gamma.api :as g]
-              [gamma.program :as p]
-              [gamma.tools :as gt]
-              [gamma-driver.drivers.basic :as driver]
-              [gamma-driver.protocols :as dp]
-              [gampg.gltf :as gltf]
-              [goog.Uri]
-              [goog.webgl :as ggl]
-              [thi.ng.geom.core :as geom]
-              [thi.ng.geom.core.matrix :as mat :refer [M44]]
-              [thi.ng.geom.webgl.arrays :as arrays])
-    (:import [goog.net XhrIo]))
-
-
-
-(def title
-  "Loading a Collada model (by not loading it).")
-
-(def u-p-matrix
-  (g/uniform "uPMatrix" :mat4))
-
-(def u-mv-matrix
-  (g/uniform "uMVMatrix" :mat4))
-
-(def u-n-matrix
-  (g/uniform "uNMatrix" :mat3))
-
-(def u-ambient-color
-  (g/uniform "uAmbientColor" :vec3))
-
-(def u-lighting-direction
-  (g/uniform "uLightingDirection" :vec3))
-
-(def u-directional-color
-  (g/uniform "uDirectionalColor" :vec3))
-
-(def u-use-lighting
-  (g/uniform "uUseLighting" :bool))
-
-(def a-position
-  (g/attribute "aVertexPosition" :vec3))
-
-(def a-vertex-normal
-  (g/attribute "aVertexNormal" :vec3))
-
-(def a-texture-coord
-  (g/attribute "aTextureCoord" :vec2))
-
-(def v-texture-coord
-  (g/varying "vTextureCoord" :vec2 :mediump))
-
-(def v-light-weighting
-  (g/varying "vLightWeighting" :vec3 :mediump))
-
-(def u-sampler
-  (g/uniform "uSampler" :sampler2D))
-
-(def u-diffuse
-  (g/uniform "uDiffuse" :vec4))
-
-(def v-normal
-  (g/varying "v_normal" :vec3 :highp))
-
-(def a-tex-coord-0
-  (g/attribute "a_texcoord0" :vec2))
-
-(def v-tex-coord-0
-  (g/varying "v_texcoord0" :vec2 :highp))
-
-;; precision highp float;
-;; varying vec3 v_normal;
-;; uniform vec4 u_diffuse;
-;; void main(void) {
-;; vec3 normal = normalize(v_normal);
-;; vec4 color = vec4(0., 0., 0., 0.);
-;; vec4 diffuse = vec4(0., 0., 0., 1.);
-;; diffuse = u_diffuse;
-;; diffuse.xyz *= max(dot(normal,vec3(0.,0.,1.)), 0.);
-;; color.xyz += diffuse.xyz;
-;; color = vec4(color.rgb * diffuse.a, diffuse.a);
-;; gl_FragColor = color;
-;; }
-
-
-(def u-light-angle
-  (g/uniform "uLightAngle" :vec3))
-
-(def program-diffuse-flat
-  (p/program
-   {:vertex-shader   {(g/gl-position) (-> u-p-matrix
-                                          (g/* u-mv-matrix)
-                                          (g/* (g/vec4 a-position 1)))}
-    :fragment-shader {(g/gl-frag-color) u-diffuse}
-    :precision {:float :mediump}}))
-
-(def program-texture-flat
-  (p/program
-   {:vertex-shader   {(g/gl-position) (-> u-p-matrix
-                                          (g/* u-mv-matrix)
-                                          (g/* (g/vec4 a-position 1)))
-                      v-normal        (g/* u-n-matrix a-vertex-normal)
-                      v-tex-coord-0   a-tex-coord-0}
-    :fragment-shader (let [sampler   u-sampler
-                           l-diffuse (g/texture2D sampler v-tex-coord-0)]
-                       {(g/gl-frag-color) l-diffuse})
-    :precision {:float :mediump}}))
-
-(def program-diffuse-light
-  (p/program
-   {:vertex-shader   {(g/gl-position) (-> u-p-matrix
-                                          (g/* u-mv-matrix)
-                                          (g/* (g/vec4 a-position 1)))
-                      v-normal        (g/* u-n-matrix a-vertex-normal)}
-    :fragment-shader (let [l-normal    (g/normalize v-normal)
-                           l-diffuse   (g/vec4 (g/* (g/swizzle u-diffuse :xyz)
-                                                    (g/max (g/dot l-normal u-light-angle) 0))
-                                               1)
-                           l-color     u-ambient-color
-                           l-color     (g/vec4 (g/+ (g/swizzle l-color :xyz)
-                                                    (g/swizzle l-diffuse :xyz))
-                                               1)]
-                       {(g/gl-frag-color) l-color})
-    :precision {:float :mediump}}))
-
-(def program-texture-light
-  (p/program
-   {:vertex-shader   {(g/gl-position) (-> u-p-matrix
-                                          (g/* u-mv-matrix)
-                                          (g/* (g/vec4 a-position 1)))
-                      v-normal        (g/* u-n-matrix a-vertex-normal)
-                      v-tex-coord-0   a-tex-coord-0}
-    :fragment-shader (let [sampler   u-sampler
-                           texture   (g/texture2D sampler v-tex-coord-0)
-                           l-diffuse (g/vec4 (g/* (g/swizzle texture :xyz)
-                                                  (g/max (g/dot (g/normalize v-normal) u-light-angle) 0.5))
-                                             1)
-                           l-color   (g/vec4 (g/* (g/swizzle u-ambient-color :rgb)
-                                                  (g/swizzle l-diffuse :rgb))
-                                             (g/swizzle l-diffuse :a))]
-                       {(g/gl-frag-color) l-color})
-    :precision {:float :mediump}}))
-
-(defn get-perspective-matrix
-  "Be sure to
-   1. pass the WIDTH and HEIGHT of the canvas *node*, not
-      the GL context
-   2. (set! (.-width/height canvas-node)
-      width/height), respectively, or you may see no results, or strange
-      results"
-  [width height]
-  (mat/perspective 45 (/ width height) 0.1 100))
-
-(defn get-normal-matrix [mv]
-  (-> mv
-      (geom/invert)
-      (geom/transpose)
-      (mat/matrix44->matrix33)))
-
-(defn get-data [now p mv vertices normals diffuse texture texture-coords]
-  (assert (and p mv vertices normals) (str "Inputs cannot be null: " [(boolean p)
-                                                                      (boolean mv)
-                                                                      (boolean vertices)
-                                                                      (boolean normals)]))
-  (let [[x y z] [(js/Math.sin now)
-                 (js/Math.cos now)
-                 (js/Math.sin (* now 2))]]
-    {u-p-matrix           p
-     u-mv-matrix          mv
-     u-n-matrix           (get-normal-matrix mv)
-     u-ambient-color      [0.5 0.5 0.5]
-     u-lighting-direction [-0.25 0.25 1]
-     u-directional-color  [0 0 0]
-     u-use-lighting       true
-     u-diffuse            (or diffuse [1 1 0 1])
-     u-light-angle        [x y z]
-     a-position           vertices
-     a-vertex-normal      normals
-     u-sampler            texture
-     a-tex-coord-0        texture-coords}))
-
-(defn make-driver [gl]
-  (driver/basic-driver gl))
-
-(defn reset-gl-canvas! [canvas-node]
-  (let [gl     (.getContext canvas-node "webgl")
-        width  (.-clientWidth canvas-node)
-        height (.-clientHeight canvas-node)]
-    ;; Set the width/height (in terms of GL-resolution) to actual
-    ;; canvas-element width/height (or else you'll see blurry results)
-    (set! (.-width canvas-node) width)
-    (set! (.-height canvas-node) height)
-    ;; Setup GL Canvas
-    (.viewport gl 0 0 width height)))
-
-;; js/window.requestAnimationFrame doesn't take arguments, so we have
-;; to store the state elsewhere - in this atom, for example.
-(defn app-state [width height]
-  {:last-rendered 0
-   :scene         {:rotation 0
-                   :mv       (mat/matrix44)
-                   :p        (get-perspective-matrix width height)}})
-
-(defn draw-fn [gl driver]
-  (fn [state]
-    (.clear gl (bit-or (.-COLOR_BUFFER_BIT gl) (.-DEPTH_BUFFER_BIT gl)))
-    (let [now             (/ (.getTime (js/Date.)) 1000)
-          rot             (* js/Math.PI (js/Math.sin now))
-          {:keys
-           [p mv
-            texture edn]} (:scene state)
-          mouse-x         (get-in state [:mouse 0] 0)
-          mouse-y         (get-in state [:mouse 1] 0)
-          scale           (/ (get-in state [:scroll] 1000) 1000)
-          gltf            (:gltf state)
-          scene           (get-in gltf [:scenes (:scene gltf)])
-          render-node     (fn render-node [[node-name node] mv]
-                            (let [mv (geom/* mv (:matrix node))]
-                              (doseq [mesh (:meshes node)]
-                                (doseq [mesh (:primitives mesh)]
-                                  (let [vertices         (get-in mesh [:attributes :p :data])
-                                        p-stride         (get-in mesh [:attributes :p :byteStride])
-                                        tex-coord-0      (get-in mesh [:attributes :tex-coord-0 :data])
-                                        normals          (get-in mesh [:attributes :normal :data])
-                                        n-stride         (get-in mesh [:attributes :normal :byteStride])
-                                        indices          (get-in mesh [:indices])
-                                        material         (get-in mesh [:material :values :diffuse])
-                                        ;; If diffuse is a vector,
-                                        ;; it's a color, otherwise if
-                                        ;; it's a map it's a texture
-                                        texture-program? (map? material)
-                                        diffuse          (if texture-program?
-                                                           (:data material)
-                                                           material)
-                                        sampler          (:sampler material)
-                                        draw-count       (:count indices)
-                                        program          (if texture-program?
-                                                           (get-in state [:runtime :programs 3])
-                                                           (get-in state [:runtime :programs 1]))
-                                        scene-data       (when normals
-                                                           (select-keys (get-data now
-                                                                                p mv
-                                                                                vertices
-                                                                                normals
-                                                                                diffuse
-                                                                                material
-                                                                                tex-coord-0)
-                                                                        (:inputs program)))]
-                                    ;;(js/console.log (clj->js diffuse))
-                                    ;;(js/console.log (clj->js scene-data))
-                                    ;;(js/console.log (clj->js program))
-                                    ;; Check for normals so we don't try to draw e.g. lines right now.
-                                    (when normals
-                                      (try
-                                        (driver/draw-elements driver program
-                                                              (assoc scene-data
-                                                                     {:tag :element-index} indices)
-                                                              {:draw-mode (:draw-mode mesh)
-                                                               :count     draw-count})
-                                        (catch js/Error e
-                                          nil))))))
-                              (doseq [child (vals (:children node))]
-                                (render-node [(:name child) child] mv))))]
-      (doseq [node (:nodes scene)]
-        (render-node [(:name node) node] (-> mv
-                                             (geom/translate [0 0 -7])
-                                             (geom/scale scale scale scale)
-                                             (geom/rotate-around-axis [0 1 0] (/ mouse-x 50))
-                                             (geom/rotate-around-axis [0 0 1] (- (/ mouse-y 50)))))))))
-
-(def manual-step-frame-by-frame?
-  false)
-
-(defn animate [draw-fn step-fn current-value]
-  (js/requestAnimationFrame
-   (fn [time]
-     (let [next-value (step-fn time current-value)]
-       (draw-fn next-value)
-       (when-let [ext (.getExtension (.-glHandle js/window) "GLI_frame_terminator")]
-         ;; Useful for WebGL inspector until we have Gamma-Inspector
-         (.frameTerminator ext))
-       (if manual-step-frame-by-frame?
-         (set! (.-tick js/window)
-               #(animate draw-fn step-fn next-value))
-         (animate draw-fn step-fn next-value))))))
-
-(defn tick
-  "Takes the old world value and produces a new world value, suitable
-  for rendering"
-  [time state]
-  ;; We get the elapsed time since the last render to compensate for
-  ;; lag, etc.
-  (let [time-now  (.getTime (js/Date.))
-        elapsed   (- time-now (:last-rendered state))
-        scroll    (.-mouseScroll js/window)]
-    (set! (.-mouseScroll js/window) 0)
-    (-> state
-        (assoc-in [:runtime :current-program] (.-mouseClick js/window))
-        (assoc-in [:mouse] (.-mousePos js/window))
-        (update-in [:scroll] + scroll)
-        (assoc-in [:last-rendered] time-now))))
-
-(defn http-get [url cb]
-  (XhrIo.send (str url)
-              (fn [e]
-                (let [xhr (.-target e)]
-                  (cb (.getResponseText xhr))))))
-
-(defn install-event-listeners! [document node starting-program]
-  (document.addEventListener "mousemove"
-                             (fn [event]
-                               (set! (.-mousePos js/window)
-                                     [(.-pageX event)
-                                      (.-pageY event)])))
-  (document.addEventListener "click"
-                             (fn [event]
-                               (set! (.-mouseClick js/window)
-                                     (inc (or (.-mouseClick js/window) starting-program)))))
-  (.addEventListener node "mousewheel"
-                     (fn [event]
-                       (.preventDefault event)
-                       (set! (.-mouseScroll js/window) (.-deltaY event)))))
-
-;; This uses some gross global-state (js/window.mousePos,
-;; js/window.mouseClick, js/window.mouseScroll). In a real app it
-;; would be part of the event loop and be all local state.
-(defn main [gl node]
-  (let [width            (.-clientWidth node)
-        height           (.-clientHeight node)
-        driver           (make-driver gl)
-        starting-program 0
-        programs         (mapv #(dp/program driver %)
-                               [program-diffuse-flat
-                                program-diffuse-light
-                                program-texture-flat
-                                program-texture-light])
-        state            (-> (app-state width height)
-                             (assoc-in [:runtime :programs] programs)
-                             (assoc-in [:runtime :current-program] 0))]
-    (reset-gl-canvas! node)
-    (.enable gl (.-DEPTH_TEST gl))
-    (.clearColor gl 0 0 0 1)
-    (.clear gl (bit-or (.-COLOR_BUFFER_BIT gl) (.-DEPTH_BUFFER_BIT gl)))
-    (set! (.-mouseClick js/window) starting-program)
-    (set! (.-mouseScroll js/window) 1000)
-    (install-event-listeners! js/document node starting-program)
-    (http-get "/models/duck.gltf"
-              (fn [data]
-                (set! (.-glHandle js/window) gl)
-                (let [json (js/JSON.parse data)
-                      _ (set! (.-gltfStuff js/window) json)
-                      edn  (js->clj json :keywordize-keys true)
-                      gltf (gltf/process-gltf edn)]
-                  (set! (.-processedGLTF js/window) (clj->js gltf))
-                  (set! (.-processedGLTFEDN js/window) gltf)
-                  (set! (.-debugRedraw js/window) (fn []
-                                                    (animate (draw-fn gl driver) tick (-> state
-                                                                                (assoc-in [:gltf] gltf)))))
-                  (animate (draw-fn gl driver) tick (-> state
-                                                                (assoc-in [:gltf] gltf))))))))


Actually fix: only return the first 3 lines of input when JSON fails to parse

Fix devth/yetibot#442

--- src/yetibot/core/util/http.clj
+++ src/yetibot/core/util/http.clj
@@ -29,7 +29,8 @@
       (json/read-json raw)
       (catch Exception e
         (error "Exception trying to fetch json" args)
-        (throw (Exception. (str "Unable to parse JSON from response:" raw)))))))
+        (let [limited-raw (str (limit-and-trim-string-lines 3 raw) "...")]
+          (throw (Exception. (str "Unable to parse JSON from response:" limited-raw))))))))

 (defn fetch-xml [& args]
   (let [raw (apply fetch args)]


Use React.createElement throughout

Use React.createElement throughout

--- src/reagent/impl/template.cljs
+++ src/reagent/impl/template.cljs
@@ -131,14 +131,13 @@
         argv (.' inprops :argv)
         props (nth argv 1 nil)
         hasprops (or (nil? props) (map? props))
-        jsargs (convert-args argv
+        jsprops (convert-props (if hasprops props) id-class)
+        jsargs (convert-args argv comp jsprops
                              (if hasprops 2 1)
-                             (inc (.' inprops :level)))
-        jsprops (convert-props (if hasprops props) id-class)]
+                             (inc (.' inprops :level)))]
     (when-not (nil? input-setup)
       (input-setup this jsprops))
-    (aset jsargs 0 jsprops)
-    (.apply comp nil jsargs)))
+    (.apply (.' js/React :createElement) nil jsargs)))

 (defn wrapped-should-update [c nextprops nextstate]
   (or util/*always-update*
@@ -168,12 +167,11 @@

 (defn parse-tag [hiccup-tag]
   (let [[tag id class] (->> hiccup-tag name (re-matches re-tag) next)
-        comp (aget (.' js/React :DOM) tag)
         class' (when class
                  (string/replace class #"\." " "))]
-    (assert comp (str "Unknown tag: '" hiccup-tag "'"))
-    [comp (when (or id class')
-            [id class'])]))
+    (assert tag (str "Unknown tag: '" hiccup-tag "'"))
+    [tag (when (or id class')
+           [id class'])]))

 (defn get-wrapper [tag]
   (let [[comp id-class] (parse-tag tag)]
@@ -255,12 +253,12 @@
       (aset a i (as-component (aget a i) level')))
     a))

-(defn convert-args [argv first-child level]
+(defn convert-args [argv comp jsprops first-child level]
   (if (== (count argv) (inc first-child))
     ;; Optimize common case of one child
-    #js[nil (as-component (nth argv first-child) level)]
+    #js[comp jsprops (as-component (nth argv first-child) level)]
     (reduce-kv (fn [a k v]
                  (when (>= k first-child)
                    (.push a (as-component v level)))
                  a)
-               #js[nil] argv)))
+               #js[comp jsprops] argv)))


Incorporate feedback

Incorporate feedback

--- src/riemann/influxdb.clj
+++ src/riemann/influxdb.clj
@@ -5,6 +5,7 @@
     [cheshire.core :as json]
     [clj-http.client :as http]
     [clojure.set :as set]
+    [clojure.string :as str]
     [riemann.common :refer [unix-to-iso8601]]))

@@ -15,9 +16,7 @@
   #{:host :service :time :metric :tags :ttl})

 (defn replace-disallowed-9 [field]
-  (clojure.string/replace
-    (clojure.string/replace
-      (clojure.string/replace field " " "\\ ") "=" "\\=") "," "\\,"))
+  (str/escape field {\space "\\ ", \= "\\=", \, "\\,"}))

 (defn kv-encode-9 [kv]
   (clojure.string/join "," (map (fn [[key value]]
@@ -34,7 +33,7 @@
   ; encode {"points" [{"name" "xyzzy", "time" "2015-06-26T07:06:45.000Z", "tags" {"host" "h"}, "fields" {"value" 0.6514667122989345, "state" "ok", "description" "at 2015-06-26 09:06:45 +0200"}}], "database" "foo"}
   ; [{"name" "xyzzy", "time" "2015-06-26T07:06:45.000Z", "tags" {"host" "h"}, "fields" {"value" 0.6514667122989345, "state" "ok", "description" "at 2015-06-26 09:06:45 +0200"}}]
   ; {"name" "xyzzy", "time" "2015-06-26T07:06:45.000Z", "tags" {"host" "h"}, "fields" {"value" 0.6514667122989345, "state" "ok", "description" "at 2015-06-26 09:06:45 +0200"}}
-  (clojure.string/join (pmap lineprotocol-encode-9 (get events "points"))))
+  (clojure.string/join (map lineprotocol-encode-9 (get events "points"))))

 (defn event-tags
   "Generates a map of InfluxDB tags from a Riemann event. Any fields in the


Dubbel and rodeo

Dubbel and rodeo

--- src/skidskytte/namer.clj
+++ src/skidskytte/namer.clj
@@ -21,6 +21,7 @@
                 "curling"
                 "cykel"
                 "dart"
+                "dubbel"
                 "dyknings"
                 "diskus"
                 "dragkamps"
@@ -144,6 +145,7 @@
                 "polo"
                 "rally"
                 "rodd"
+                "rodeo"
                 "rodel"
                 "rugby"
                 "segling"


[#3459] Done button in Recipient screen clickable area whole row

--- src/status_im/ui/screens/wallet/components/views.cljs
+++ src/status_im/ui/screens/wallet/components/views.cljs
@@ -147,8 +147,9 @@
                                  :on-change-text      #(reset! content %)
                                  :accessibility-label :recipient-address-input}]]
         [bottom-buttons/bottom-button
-         [button/button {:disabled? (string/blank? @content)
-                         :on-press  #(re-frame/dispatch [:wallet/fill-request-from-url @content])}
+         [button/button {:disabled?    (string/blank? @content)
+                         :on-press     #(re-frame/dispatch [:wallet/fill-request-from-url @content])
+                         :fit-to-text? false}
           (i18n/label :t/done)]]]])))

 (defn recipient-qr-code []


Small bug in pretty printer component has been fix

--- utils/src/clj/hellhound/components/pretty_printer.clj
+++ utils/src/clj/hellhound/components/pretty_printer.clj
@@ -7,4 +7,5 @@
   [component v]
   (logger/debug "PrettyPrinter-START: -----------------------------------------")
   (clojure.pprint/pprint v)
-  (logger/debug "PrettyPrinter-END: -------------------------------------------"))
+  (logger/debug "PrettyPrinter-END: -------------------------------------------")
+  v)


fixing reference to a plug-in that does not yet exist

--- libs/examples/project.clj
+++ libs/examples/project.clj
@@ -4,7 +4,7 @@
   :permacode-paths ["src"]
   :dependencies [[org.clojure/clojure "1.8.0"]
                  [axiom-clj/permacode "MONOLITH-SNAPSHOT"]]
-  :plugins [[axiom-clj/lein-axiom "MONOLITH-SNAPSHOT"]]
+  :xxx-plugins [[axiom-clj/lein-axiom "MONOLITH-SNAPSHOT"]]
   :profiles {:dev {:dependencies [[midje "1.7.0"]
                                   [axiom-clj/cloudlog "MONOLITH-SNAPSHOT"]]}
              ;; You can add dependencies that apply to `lein midje` below.


Moar idiomatic Clojure

Moar idiomatic Clojure

--- src/sinusoides/components.cljs
+++ src/sinusoides/components.cljs
@@ -73,7 +73,7 @@
        [:div {:id "desc"
               :dangerouslySetInnerHTML
               {:__html (md->html (:desc p))}}]
-       [:a {:class "link" :href (:link p)} "Link"]]
+       ([:a {:class "link" :href (:link p)} "Link"]])
       [:div {:id "footer"}
        (if-let [id (get-in entries [(- idx 1) :slug])]
          [:a {:class "prev enabled" :href (routes/do- {:id id})}]
@@ -130,10 +130,9 @@
   (letfn
       [(filter-entries []
          (let [lang-filters (get-in @do [:filter :languages])]
-           (apply vector (filter
-                           #(or (empty? lang-filters)
-                              (contains? lang-filters (:lang %)))
-                           (:entries @do)))))
+           (vec (filter #(or (empty? lang-filters)
+                           (contains? lang-filters (:lang %)))
+                  (:entries @do)))))

        (find-entry [entries id]
          (first (filter #(= id (:slug (% 1)))


Rewrite transactions code.

Rewrite transactions code.

Them now return a vector of affected eids.

--- src/continuo/postgresql/transaction.clj
+++ src/continuo/postgresql/transaction.clj
@@ -51,7 +51,7 @@
        (get @*eid-map* index)))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Transaction Identifier
+;; Locks
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (defn hold-lock
@@ -83,20 +83,24 @@
 (defmethod -apply-fact :db/add
   [conn txid [type eid attr val :as fact]]
   (let [table (attrs/normalize-attrname attr "user")
+        eid (impl/-resolve-eid eid)
         current-value (current-attr-value conn fact)]
     (if current-value
-      (when (not= current-value val)
-        (let [tmpl (str "UPDATE TABLE {{table}} "
-                        "  SET modified_at=current_timestamp, "
-                        "      content=?, txid=?"
-                        "  WHERE eid=?")
-              sql (tmpl/render-string tmpl {:table table})]
-          (sc/execute conn [sql val txid eid])))
-      (let [tmpl  (str "INSERT INTO {{table}} "
-                       "  (eid, txid, modified_at, content)"
-                       "  VALUES (?,?,current_timestamp,?)")
+      (do
+        (when (not= current-value val)
+          (let [tmpl (str "UPDATE TABLE {{table}} "
+                          "  SET modified_at=current_timestamp, "
+                          "      content=?, txid=?"
+                          "  WHERE eid=?")
+                sql (tmpl/render-string tmpl {:table table})]
+            (sc/execute conn [sql val txid eid])))
+        eid)
+      (let [tmpl (str "INSERT INTO {{table}} "
+                      "  (eid, txid, modified_at, content)"
+                      "  VALUES (?,?,current_timestamp,?)")
             sql (tmpl/render-string tmpl {:table table})]
-        (sc/execute conn [sql eid txid val])))))
+        (sc/execute conn [sql eid txid val])
+        eid))))

 (defmethod -apply-fact :db/retract
   [conn txid [type eid attr val]]
@@ -113,21 +117,20 @@
         data (codecs/data->bytes facts)]
     (sc/execute conn [sql txid data])))

-(defn run-tx
+(defn run-transaction
   "Given an connection and seq of operation objects,
   execute them in serie."
   [conn facts]
-  (let [txid (get-next-txid conn)]
-    (-apply-tx conn txid facts)
-    (run! #(-apply-fact conn txid %) facts)))
-
-(defn run-in-tx
-  [conn continuation]
-  (sc/atomic conn
-    (hold-lock conn)
-    (continuation conn)))
+  (binding [*eid-map* (volatile! {})]
+    (let [txid (get-next-txid conn)]
+      (-apply-tx conn txid facts)
+      (let [ids (reduce #(conj %1 (-apply-fact conn txid %)) facts)]
+        (filterv identity ids)))))

 (defn transact
   [tx facts]
-  (let [conn (impl/-get-connection tx)]
-    (run-in-tx conn #(run-tx % facts))))
+  (exec/submit
+   #(let [conn (impl/-get-connection tx)]
+      (sc/atomic conn
+        (hold-lock conn)
+        (run-transaction conn facts)))))


update repo stats

update repo stats

--- src/thi/ng/site/main/core.cljs
+++ src/thi/ng/site/main/core.cljs
@@ -14,7 +14,7 @@
 (def projects
   {:babel    {:name    "thi.ng/babel"
               :version "0.3.2.1"
-              :stars   30
+              :stars   46
               :lit     true
               :loc     98
               :tags    ["template" "literate programming" "emacs" "clojure" "clojurescript"]
@@ -22,8 +22,8 @@
               :bg-pos  "50% 65%"
               :desc    "Project template for polyglot, literate programming with Emacs & Org-mode"}
    :color    {:name    "thi.ng/color"
-              :version "1.0.0"
-              :stars   21
+              :version "1.0.1"
+              :stars   27
               :lit     true
               :loc     1742
               :tags    ["color" "dataviz" "interop" "conversion" "clojure" "clojurescript"]
@@ -50,7 +50,7 @@
               :desc    "DOM generation, manipulation, async event bus and browser utilities"}
    :dstruct  {:name    "thi.ng/dstruct"
               :version "0.1.2"
-              :stars   1
+              :stars   6
               :lit     true
               :loc     960
               :tags    ["graph" "collections" "binary" "streams" "clojure" "clojurescript"]
@@ -59,7 +59,7 @@
               :desc    "Data structures & utilities: Disjoint sets, Interval Trees, collection helpers, binary data I/O"}
    :fourier  {:name    "thi.ng/fourier"
               :version "0.1.0"
-              :stars   0
+              :stars   5
               :lit     true
               :loc     392
               :tags    ["audio" "analysis" "dataviz" "clojure"]
@@ -68,7 +68,7 @@
               :desc    "Audio frequency analysis & visualization"}
    :geom     {:name    "thi.ng/geom"
               :version "0.0.908"
-              :stars   182
+              :stars   223
               :lit     true
               :loc     14784
               :tags    ["2d" "3d" "math" "analysis" "animation" "fabrication" "dataviz" "generative" "mesh" "svg" "matrix" "physics" "voxel" "webgl" "clojure" "clojurescript"]
@@ -102,7 +102,7 @@
                          :desc "WebGL rendering, shader lib & type conversions"}]}
    :fabric   {:name    "thi.ng/fabric"
               :version "0.0.376"
-              :stars   19
+              :stars   38
               :lit     true
               :loc     4796
               :tags    ["dsl" "declarative" "async" "graph" "linked data" "query" "parser" "server" "dataviz" "clojure" "clojurescript"]
@@ -121,7 +121,7 @@
                          :desc "linked data server & query enpoint"}]}
    :luxor    {:name    "thi.ng/luxor"
               :version "0.3.1"
-              :stars   56
+              :stars   61
               :lit     true
               :loc     1309
               :tags    ["dsl" "3d" "graph" "conversion" "rendering" "clojure" "luxrender"]
@@ -130,7 +130,7 @@
               :desc    "Scene graph compiler, generator & mesh exporter for rendering with Luxrender"}
    :math     {:name    "thi.ng/math"
               :version "0.1.4"
-              :stars   3
+              :stars   4
               :lit     true
               :loc     906
               :tags    ["interpolation" "math" "macros" "noise" "binary" "interop" "clojure" "clojurescript"]
@@ -139,7 +139,7 @@
               :desc    "Useful math ops, noise functions, bit manipulation and macro definitions to simplify complex equations"}
    :morpho   {:name    "thi.ng/morphogen"
               :version "0.1.1"
-              :stars   74
+              :stars   85
               :lit     true
               :loc     895
               :tags    ["dsl" "generative" "fabrication" "3d" "mesh" "clojure" "clojurescript"]
@@ -148,7 +148,7 @@
               :desc    "3d form evolution through tree-based transformations"}
    :ndarray  {:name    "thi.ng/ndarray"
               :version "0.3.0"
-              :stars   9
+              :stars   13
               :lit     true
               :loc     813
               :tags    ["matrix" "math" "2d" "3d" "4d" "macros" "clojure" "clojurescript"]
@@ -157,7 +157,7 @@
               :desc    "Multidimensional primitive arrays with almost zero-cost view transformations, isoline extraction"}
    :raymarch {:name    "thi.ng/raymarchcl"
               :version "0.1.0"
-              :stars   106
+              :stars   111
               :loc     894
               :tags    ["rendering" "voxel" "opencl"  "clojure"]
               :bg-uri  "raymarchcl/hero.jpg"
@@ -166,7 +166,7 @@
                         [:a {:href "http://thi.ng/simplecl"} "thi.ng/simplecl"]]}
    :sgraph   {:name    "thi.ng/shadergraph"
               :version "0.1.1"
-              :stars   11
+              :stars   14
               :lit     true
               :loc     554
               :tags    ["rendering" "graph" "gpu" "webgl" "macros" "clojurescript"]
@@ -175,7 +175,7 @@
               :desc    "Composable WebGL / GLSL shader library & dependency graph resolution"}
    :simplecl {:name    "thi.ng/simplecl"
               :version "0.2.2"
-              :stars   11
+              :stars   13
               :loc     701
               :tags    ["dsl" "interop" "opencl" "gpu" "clojure"]
               :bg-uri  "simplecl/hero.jpg"
@@ -192,7 +192,7 @@
               :desc    "Extensible string formatting, date formatting, number parsers"}
    :structg  {:name    "thi.ng/structgen"
               :version "0.2.1"
-              :stars   4
+              :stars   5
               :loc     507
               :tags    ["interop" "binary" "parser" "conversion" "opencl"]
               :bg-uri  "structgen/hero.jpg"
@@ -200,7 +200,7 @@
               :desc    "Interop library for working with native C structs and binary formats"}
    :trio     {:name    "thi.ng/trio"
               :version "0.1.0"
-              :stars   39
+              :stars   40
               :lit     true
               :loc     3066
               :tags    ["dsl" "graph" "linked data" "parser" "query" "declarative"]
@@ -218,7 +218,7 @@
               :desc    "Clojurescript wrapper & convenience functions for JavaScript typed arrays"}
    :tweeny   {:name    "thi.ng/tweeny"
               :version "0.1.0-SNAPSHOT"
-              :stars   5
+              :stars   10
               :loc     122
               :tags    ["interpolation" "animation" "math" "clojure" "clojurescript"]
               :bg-uri  "tweeny/hero.jpg"
@@ -226,7 +226,7 @@
               :desc    "Keyframe interpolation of arbitrary nested values, completely customizable"}
    :validate {:name    "thi.ng/validate"
               :version "0.1.3"
-              :stars   20
+              :stars   22
               :loc     383
               :tags    ["dsl" "validation" "declarative" "collections" "clojure" "clojurescript"]
               :bg-uri  "validate/hero.jpg"


Refactor dom minification

Refactor dom minification

--- src/discuss/references/integration.cljs
+++ src/discuss/references/integration.cljs
@@ -38,15 +38,9 @@
 (defn- minify-doms
   "Removes dom-elements, which can never be used as a reference."
   [doms]
-  (remove #(or (= "script" (lower-case (.-nodeName %)))
-               (= "path" (lower-case (.-nodeName %)))
-               (= "svg" (lower-case (.-nodeName %)))
-               (= "circle" (lower-case (.-nodeName %)))
-               (= "html" (lower-case (.-nodeName %)))
-               (= "head" (lower-case (.-nodeName %)))
-               (= "meta" (lower-case (.-nodeName %)))
-               (= "button" (lower-case (.-nodeName %))))
-          doms))
+  (let [tags #{"script" "path" "svg" "circle" "html" "head" "meta" "link" "img"
+               "input" "label" "hr" "title" "button"}]
+    (remove #(contains? tags (lower-case (.-nodeName %))) doms)))

 (defn- get-parent
   "Assuming that the last occurence of my reference is the closest parent of it, this function will return it."


Support running story commands from the console.

--- src/tryclojure/models/eval.clj
+++ src/tryclojure/models/eval.clj
@@ -61,3 +61,9 @@
       "Are you sitting comfortably? Then, we shall begin.")
     (throw (Exception. "You must specify the name of the story you want to load."))))

+(defmethod run-story-command :default [command expr] ;; normal command
+  (if (nil? story)
+    (throw (Exception. "Type 'hear --story--' to begin."))
+    (story/run-command story expr)))
+
+;; utils


[#2861] Adapt tests

[#2861] Adapt tests

--- backend/test/akvo/lumen/lib/transformation_test.clj
+++ backend/test/akvo/lumen/lib/transformation_test.clj
@@ -729,7 +729,7 @@
       (is (= new-derived-column
              (keywordize-keys (last columns))))
       (let [applied-tx (keywordize-keys (last transformations))]
-        (is (= (keywordize-keys tx) (select-keys applied-tx [:op :args])))
+        (is (= (dissoc (keywordize-keys tx) :namespace) (select-keys applied-tx [:op :args])))
         (is (= {:d1
 	        {:after
 	         new-derived-column,
@@ -772,7 +772,7 @@
       (is (= new-derived-column
              (keywordize-keys (last columns))))
       (let [applied-tx (keywordize-keys (last transformations))]
-        (is (= (keywordize-keys tx) (select-keys applied-tx [:op :args])))
+        (is (= (dissoc (keywordize-keys tx) :namespace) (select-keys applied-tx [:op :args])))
         (is (= {:d1
 	        {:after
 	         new-derived-column,


Spell out basic parts of delete query

Spell out basic parts of delete query

--- src/clojure/clojurewerkz/cassaforte/new_query_api.clj
+++ src/clojure/clojurewerkz/cassaforte/new_query_api.clj
@@ -201,7 +201,7 @@
   []
   [:filtering nil])

-(defn- from
+(defn from
   [^String table-name]
   [:from table-name])

@@ -477,10 +477,40 @@
 ;; Delete Query
 ;;

-(comment
+(let [order {:what-columns 1
+             :from         2
+             :where        3}
+      renderers
+      {:where        (fn where-query [query-builder m]
+                       (let [[first-clause & more-clauses] (to-clauses m)
+                             query-builder                  (.where query-builder first-clause)]
+                         (doseq [clause more-clauses]
+                           (.and query-builder clause))
+                         query-builder))
+
+       :from         (fn from-query [query-builder table-name]
+                       (println query-builder)
+                       (.from query-builder (name table-name)))
+
+       :what-columns (fn [query-builder columns]
+                       (reduce (fn [builder column]
+                                 (if (or (keyword? column) (string? column)) ;; Most likely same bug above
+                                   (.column builder (name column))
+                                   (column builder)))
+                               query-builder
+                               columns)
+
+                       )}]
+
   (defn delete
-    [table-name & ]
-    (->> statements)
+    [table-name & statements]
+    (->> (conj statements (from (name table-name)))
+         (sort-by #(get order (first %)))
+         (reduce (fn [builder [statement-name statement-args]]
+                   (println statement-name)
+                   ((get renderers statement-name) builder statement-args))
+                 (QueryBuilder/delete))
+         (.toString))
     ))


Remove some unused functions

Remove some unused functions

--- src/cljs/pinaclj_rich_text_editor/strong_text.cljs
+++ src/cljs/pinaclj_rich_text_editor/strong_text.cljs
@@ -28,9 +28,6 @@
            :doc-loc (->> loc (insert-node new-node position))
            :selection-focus [new-key nil 0])))

-(defn- move-right [[parent text-node _]]
-  [parent (inc text-node) 0])
-
 (defn- text-node-index [text-node-loc]
   (count (zip/lefts text-node-loc)))

@@ -45,15 +42,6 @@
     [(key-of (zip/up loc)) (text-node-index loc) 0]
     [(key-of loc) 0 0]))

-(defn- cut-at
-  ([[tag attrs text-node] start end]
-   [tag attrs (subs text-node start end)])
-  ([[tag attrs text-node] start]
-   [tag attrs (subs text-node start)]))
-
-(defn- child-node-of-tag [loc parent-tag]
-  (last (take-while #(and (not (nil? %)) (not= parent-tag (hiccup/tag (zip/node %)))) (iterate zip/up loc))))
-
 (defn- node-with-tag [loc tag]
   (some #(when (= tag (hiccup/tag (zip/node %))) %) (take-while #(not (nil? %)) (iterate zip/up loc))))

@@ -61,7 +49,6 @@
   (if (vector? node)
     (hiccup/set-attr node :key (if key-fn (key-fn) 2))
     node))
-

 (defn- tags-between [parent-tag loc]
   (take-while #(not= parent-tag %) (reverse (zipper/tag-path loc))))


feat(aoc): add day6 part 2, refactor part 1 and 2 into functions

--- clojure/adventofcode/src/adventofcode/days/day6.clj
+++ clojure/adventofcode/src/adventofcode/days/day6.clj
@@ -4,11 +4,25 @@
 (defn input [path]
   (line-seq (io/reader path)))

-(doseq [x (apply map vector (input "././files/day6_input.txt"))]
-  (->> (frequencies x)
-       (sort-by val)
-       (reverse)
-       (ffirst)
-       (prn)))
+(defn part1
+  "http://adventofcode.com/2016/day/6"
+  []
+  (doseq [x (apply map vector (input "././files/day6_input.txt"))]
+    (->> (frequencies x)
+         (sort-by val)
+         (reverse)
+         (ffirst)
+         (prn))))

 ; => \w \k \b \v \m \i \k \b
+
+(defn part2
+  "http://adventofcode.com/2016/day/6"
+  []
+  (doseq [x (apply map vector (input "././files/day6_input.txt"))]
+    (->> (frequencies x)
+         (sort-by val)
+         (ffirst)
+         (prn))))
+
+; => \e \v \a \k \w \a \g \a


ensure that options name matches between script and compiler driver file

--- panc/src/main/clojure/org/quattor/pan/pan_compiler.clj
+++ panc/src/main/clojure/org/quattor/pan/pan_compiler.clj
@@ -56,31 +56,36 @@

 (defn -main [& args]
-  (let [[options files banner]
-        (cli args
-             ["--debug" "enable all debugging" :default false :flag true]
-             ["--debug-ns-include" "ns regex for debugging"]
-             ["--debug-ns-exclude" "ns regex to exclude debugging"]
-             ["--initial-data" "set root element (must be nlist)"]
-             ["--include-path" "template lookup path"]
-             ["--session-dir" "session directory"]
-             ["--output-dir" "output directory" ]
-             ["--formats" "generated output formats" :default "pan,dep"]
-             ["--compress" "compress output" :default false :flag true]
-             ["--jvm-options" "options for JVM"]
-             ["--max-iteration" "set max. no. of iterations" :default 10000]
-             ["--max-recursion" "set max. depth of recursion" :default 10]
-             ["--logging" "set logging types"]
-             ["--log-file" "specify log file"]
-             ["--warnings" "off, on, fatal" :default "on" ]
-             ["-v" "--verbose" "show statistics and progress" :default false :flag true]
-             ["-h" "--help" "print command help" :default false :flag true]
-             )]
-    (when (:help options)
-      (println banner)
-      (System/exit 0))
-    (let [results (build-profiles options files)]
-      (if-let [errors (.formatErrors results)]
-        (println errors)
-        "")
-      (println (.formatStats results)))))
+  (try
+    (let [[options files banner]
+          (cli args
+               ["--debug" "enable all debugging" :default false :flag true]
+               ["--debug-ns-include" "ns regex for debugging"]
+               ["--debug-ns-exclude" "ns regex to exclude debugging"]
+               ["--initial-data" "set root element (must be nlist)"]
+               ["--include-path" "template lookup path"]
+               ["--session-dir" "session directory"]
+               ["--output-dir" "output directory" ]
+               ["--formats" "generated output formats" :default "pan,dep"]
+               ["--compress" "compress output" :default false :flag true]
+               ["--java-opts" "options for JVM"]
+               ["--max-iteration" "set max. no. of iterations" :default 10000]
+               ["--max-recursion" "set max. depth of recursion" :default 10]
+               ["--logging" "set logging types"]
+               ["--log-file" "specify log file"]
+               ["--warnings" "off, on, fatal" :default "on" ]
+               ["-v" "--verbose" "show statistics and progress" :default false :flag true]
+               ["-h" "--help" "print command help" :default false :flag true]
+               )]
+      (when (:help options)
+        (println banner)
+        (System/exit 0))
+      (let [results (build-profiles options files)]
+        (if-let [errors (.formatErrors results)]
+          (println errors)
+          "")
+        (println (.formatStats results))))
+    (catch Exception e
+      (println (.getMessage e))
+      (System/exit 1))))
+


core: fix `lua-local` vector keys bug

core: fix `lua-local` vector keys bug

--- src/taoensso/carmine.clj
+++ src/taoensso/carmine.clj
@@ -217,7 +217,7 @@
         [key-vars arg-vars var-vals] (script-prep-vars keys args)
         script* (script-subst-vars script key-vars arg-vars)
         sha     (script-hash script*)
-        evalsha (fn [] (apply evalsha sha (count key-vars) var-vals))]
+        evalsha (fn [] (apply evalsha sha (count keys) var-vals))]
     (if (contains? @scripts-loaded-locally [conn-spec sha]) (evalsha)
       (do (with-replies (parse nil (script-load script*)))
           (swap! scripts-loaded-locally conj [conn-spec sha])


added cpp folder

added cpp folder

--- dde-example/src/dde_example/excel.clj
+++ dde-example/src/dde_example/excel.clj
@@ -12,7 +12,11 @@

   (dde/request excel-conv "R1C1")

-  (dde/poke excel-conv "R1C1" "new val")
+  (dde/poke excel-conv "R1C1" "changed Val")
+
+  (dde/startAdvice excel-conv "R1C1")
+
+


Minor nits

Minor nits

--- src/tenor/constructs.clj
+++ src/tenor/constructs.clj
@@ -18,27 +18,27 @@

 ;; --- Time Signature --- ;;

-(defn time-signature [note-count & [sig]]
-  "Decompose a measure into randomly spaced out beats,
+(defn generate-meter [beat-count & [sig]]
+  "Decompose a measure into a random meter of beats,
   within the time signature's note count."
   (cond
-    (> note-count 3)
+    (> beat-count 3)
     (let [beat (rand-nth [2 3 4])
           sig (conj (or sig '()) beat)]
-      (time-signature (- note-count beat) sig))
-    (and (<= note-count 3) (> note-count 0))
-    (let [sig (conj (or sig '()) note-count)]
-      (time-signature 0 sig))
+      (generate-meter (- beat-count beat) sig))
+    (and (<= beat-count 3) (> beat-count 0))
+    (let [sig (conj (or sig '()) beat-count)]
+      (generate-meter 0 sig))
     :else sig))

 ;; --- Beats --- ;;;

-(defn segment-beat [note-count note-value
+(defn segment-beat [beat-count note-value
                     & {:keys [sparseness]
                        :or {sparseness 1}}]
   "Break a beat down into sixteenth-note positions and
   assign notes and rests to each position by iteration."
-  (let [sixteenth-count (* (/ 16 note-value) note-count)
+  (let [sixteenth-count (* (/ 16 note-value) beat-count)
         notes (range 1 (inc sixteenth-count))
         distribution (cons true (repeat sparseness false))]
     (filter
@@ -75,7 +75,7 @@
                        :note-value note-value
                        :sparseness sparseness))))

-(defn string-measures [measures note-count
+(defn string-measures [measures beat-count
                        & {:keys [running-string running-count]
                           :or {running-string '() running-count 0}}]
   "String multiple measures together into a single piece."
@@ -84,9 +84,9 @@
     (let [running-string (concat
                            running-string
                            (map #(+ running-count %) (first measures)))
-          running-count (+ running-count note-count)]
+          running-count (+ running-count beat-count)]
       (string-measures (rest measures)
-                       note-count
+                       beat-count
                        :running-string running-string
                        :running-count running-count))))

@@ -129,22 +129,22 @@
   and musical notes as values."
   (map #(hash-map :pos %1, :note %2) entity intervals))

-(defn generate-piece [measure-count note-count note-value sparseness]
+(defn generate-piece [measure-count beat-count note-value sparseness]
   "Generate a musical piece with measure-count measures,
-  each of time signature with note-count and note-value."
-  (let [time-sig (time-signature note-count)
+  each of time signature with beat-count and note-value."
+  (let [time-sig (generate-meter beat-count)
         segmented (segment-measure time-sig note-value sparseness)
         piece (repeat measure-count segmented)]
-    (string-measures piece note-count)))
+    (string-measures piece beat-count)))

-(defn generate-entity-map [construct-melody measure-count note-count
+(defn generate-entity-map [construct-melody measure-count beat-count
                             & {:keys [note-value sparseness scale]
                                :or {note-value 16
                                     sparseness 1
                                     scale (generate-random-scale)}}]
   "Take a function to construct a melody, measure count, note count and note value,
   and generate a measure map of the melody and rhythm using map-entity."
-  (let [piece (generate-piece measure-count note-count note-value sparseness)
+  (let [piece (generate-piece measure-count beat-count note-value sparseness)
         scale-intervals (intervals->notes
                           (generate-intervals construct-melody scale (count piece)) scale)]
   (map-entity piece scale-intervals)))


Make note-value and sparseness optional parameters

--- src/tenor/constructs.clj
+++ src/tenor/constructs.clj
@@ -129,7 +129,9 @@
   and musical notes as values."
   (map #(hash-map :pos %1, :note %2) entity intervals))

-(defn generate-piece [measure-count beat-count note-value sparseness]
+(defn generate-piece [measure-count beat-count
+                      & {:keys [note-value sparseness]
+                         :or {note-value 16 sparseness 1}}]
   "Generate a musical piece with measure-count measures,
   each of time signature with beat-count and note-value."
   (let [time-sig (generate-meter beat-count)


accept new compiler options

accept new compiler options

--- sidecar/src/figwheel_sidecar/schemas/cljs_options.clj
+++ sidecar/src/figwheel_sidecar/schemas/cljs_options.clj
@@ -623,6 +623,11 @@

   :language-in :es6
   :rewrite-polyfills true")
+
+(def-key ::aot-cache boolean?
+  "A boolean value to disable or enable global caching of compiled assets.
+
+  :aot-cache false")

 (def-key ::checked-arrays (s/or :keyval #{:warn :error}
                                 :false   false?
@@ -1079,4 +1084,27 @@
      ::warnings
      ::fn-invoke-direct
      ::rewrite-polyfills
-     ::checked-arrays])))
+     ::checked-arrays
+     ::aot-cache
+
+     ;; these need definitions above
+     ::closure-variable-map-out
+     ::closure-generate-exports
+     ::closure-module-roots
+     ::rename-prefix
+     ::closure-property-map-in
+     ::ignore-js-module-exts
+     ::closure-property-map-out
+     ::stable-names
+     ::watch-error-fn
+     ::browser-repl
+     ::opts-cache
+     ::watch
+     ::cache-analysis-format
+     ::rename-prefix-namespace
+     ::closure-variable-map-in
+     ::use-only-custom-externs
+
+
+     ]
+    )))


Use a Generator record rather than a simple map. Refs #19

Signed-off-by: Reid Draper <1f4d9895740d1b07c3b2f21f4b03e23d1086f158@gmail.com>

--- src/main/clojure/clojure/test/check/generators.clj
+++ src/main/clojure/clojure/test/check/generators.clj
@@ -173,9 +173,11 @@
 ;; (internal functions)
 ;; ---------------------------------------------------------------------------

+(defrecord Generator [gen])
+
 (defn make-gen
-  ([generator-fn]
-   {:gen generator-fn}))
+  [generator-fn]
+  (Generator. generator-fn))

 (defn call-gen
   {:no-doc true}


Added integration tests for root routes.

--- dev-resources/src/cmr/opendap/dev.clj
+++ dev-resources/src/cmr/opendap/dev.clj
@@ -4,6 +4,7 @@
     [clojure.java.io :as io]
     [clojure.pprint :refer [pprint]]
     [clojure.set :as set]
+    [clojure.string :as string]
     [clojure.tools.namespace.repl :as repl]
     [clojusc.dev.system.core :as system-api]
     [clojusc.twig :as logger]


fixing test

fixing test

--- test/celestial/test/puppet.clj
+++ test/celestial/test/puppet.clj
@@ -8,4 +8,6 @@

 (fact "puppet provision type construction"
   (pconstruct redis-type redis-prox-spec) =>
-     (contains {:type (assoc redis-type :hostname "red1")}))
+     (contains (get-in redis-prox-spec [:puppet-std :dev] )))
+
+


Adds todos and fixtures folder.

Adds todos and fixtures folder.

--- test/clj_spotify/core_test.clj
+++ test/clj_spotify/core_test.clj
@@ -1,6 +1,10 @@
 (ns clj-spotify.core-test
   (:require [clojure.test :refer :all]
             [clj-spotify.core :refer :all]))
+
+;TODO - Create fixtures for json responses.
+;TODO - Use spotifys client credentials flow to get token to perform tests.
+;TODO - Encrypt client_id,client_secret to use with travis.

 (def correct-map {:test-key "test-value" :test-map {:a "a"} :test-vector [1 2 3] :test-null nil})


bug #6135 - made place for recovery phrase error tooltip on desktop

Signed-off-by: Goran Jovic <fc686822162e6f379ea05b6f92d78d206147085c@gmail.com>

--- src/status_im/ui/screens/accounts/recover/styles.cljs
+++ src/status_im/ui/screens/accounts/recover/styles.cljs
@@ -1,12 +1,14 @@
 (ns status-im.ui.screens.accounts.recover.styles
+  (:require-macros [status-im.utils.styles :refer [defstyle]])
   (:require [status-im.ui.components.colors :as colors]))

 (def screen-container
   {:flex             1
    :background-color colors/white})

-(def inputs-container
-  {:margin 16})
+(defstyle inputs-container
+  {:margin  16
+   :desktop {:padding-top 15}})

 (def password-input
   {:margin-top 10})


Idiomaticify highest index finding

Idiomaticify highest index finding

--- src/bejeweled_bot/core.clj
+++ src/bejeweled_bot/core.clj
@@ -39,21 +39,10 @@
   (def floatArr (make-array Float/TYPE (.total result)))
   (.get result 0 0 floatArr)

-  ;please refactor
-  (def derp
-    (reduce
-    (fn [acc x]
-      {:max (max (:max acc) x)
-        :idx (cond
-               (> x (acc :max)) (acc :currIdx)
-               :else (acc :idx))
-        :currIdx (+ (acc :currIdx) 1)
-        })
-    {:max 0 :idx 0 :currIdx 0}
-    floatArr))
+  (def highest-index (first (apply max-key second (map vector (range) floatArr))))

-  (def row (Math/floor (/ (:idx derp) cols)))
-  (def col (mod (:idx derp) cols))
+  (def row (Math/floor (/ (:idx highest-index) cols)))
+  (def col (mod (:idx highest-index) cols))

   (def seees (sample-pixels col row (+ col targetCols) (+ row targetRows) displayImg))
   (println (solve (rgb-to-gems seees)))


add test assertion

add test assertion

--- test/tamaki/post/post_test.clj
+++ test/tamaki/post/post_test.clj
@@ -2,7 +2,8 @@
   (:require [clojure.test :refer :all]
             [clojure.java.io :as io]
             [me.raynes.fs :as fs]
-            [tamaki.post.post :as tpost]))
+            [tamaki.post.post :as tpost])
+  (:import (java.text SimpleDateFormat)))

 (deftest loading-posts
   (testing "find the post files "
@@ -23,6 +24,7 @@
                 renderers)
         post (first posts)]
     (testing "create map"
+        (is (= (.parse (new SimpleDateFormat "yyyy-MM-dd") "2015-05-28") (:date post)))
         (is (= "/posts/2015/05/28/foobar3.html" (:current post)))
         (is (= "/posts/2015/01/29/foobar2.html" (:next post)))
         (is (= (str build "/posts/2015/05/28/foobar3.html") (:output post))))


[Fixes #9510] Fix timestamp placement for text elements

Signed-off-by: Andrea Maria Piana <39e16ece3c2d27e1889178b15ddb376e524032f8@gmail.com>

--- src/status_im/ui/screens/chat/message/message.cljs
+++ src/status_im/ui/screens/chat/message/message.cljs
@@ -139,9 +139,18 @@
                                   outgoing] :as message}

                           tree]
-  (conj (reduce (fn [acc e] (render-block message acc e)) [react/view {}] tree)
-        [react/text {:style (style/message-timestamp-placeholder outgoing)}
-         (str "  " timestamp-str)]))
+  (let [elements (reduce (fn [acc e] (render-block message acc e)) [react/view {}] tree)
+        timestamp [react/text {:style (style/message-timestamp-placeholder outgoing)}
+                   (str "  " timestamp-str)]
+        last-element (peek elements)]
+      ;; Using `nth` here as slightly faster than `first`, roughly 30%
+      ;; It's worth considering pure js structures for this code path as
+      ;; it's perfomance critical
+    (if (= react/text-class (nth last-element 0))
+      ;; Append timestamp to last text
+      (conj (pop elements) (conj last-element timestamp))
+      ;; Append timestamp to new block
+      (conj elements timestamp))))

 (defn text-message
   [{:keys [chat-id message-id content


Tweaks.

Tweaks.

--- from-repl.clj
+++ from-repl.clj
@@ -13,5 +13,5 @@
                           (File. dir "presentation.html")
                           reveal-js)))

-(render-site "HTML/03_forms_controls_inputs")
-(render-site "HTML/05_building_sites_with_Bootstrap")
+(render-site "HTML/02_forms_controls_inputs")
+;;(render-site "HTML/05_building_sites_with_Bootstrap")


code tidy.

code tidy.

--- src/metabase/driver/query_processor.clj
+++ src/metabase/driver/query_processor.clj
@@ -62,9 +62,9 @@

 (defn- pre-expand [qp]
   (fn [query]
-    (if (structured-query? query)
-      (qp (resolve/resolve (expand/expand query)))
-      (qp query))))
+    (qp (if (structured-query? query)
+          (resolve/resolve (expand/expand query))
+          query))))

 (defn- post-add-row-count-and-status


Fixing a typo.

Fixing a typo.

--- storm-core/test/clj/backtype/storm/nimbus_test.clj
+++ storm-core/test/clj/backtype/storm/nimbus_test.clj
@@ -20,7 +20,7 @@
   (:require [backtype.storm [converter :as converter]])
   (:import [backtype.storm.testing TestWordCounter TestWordSpout TestGlobalCount
             TestAggregatesCounter TestPlannerSpout TestPlannerBolt]
-           [backtype.storm.nimbus InMemoryTopologyAcitonNotifier])
+           [backtype.storm.nimbus InMemoryTopologyActionNotifier])
   (:import [backtype.storm.scheduler INimbus])
   (:import [backtype.storm.nimbus ILeaderElector NimbusInfo])
   (:import [backtype.storm.generated Credentials NotAliveException SubmitOptions
@@ -1341,10 +1341,10 @@
                         STORM-CLUSTER-MODE "local"
                         STORM-ZOOKEEPER-PORT zk-port
                         STORM-LOCAL-DIR nimbus-dir
-                        NIMBUS-TOPOLOGY-ACTION-NOTIFIER-PLUGIN (.getName InMemoryTopologyAcitonNotifier)}))
+                        NIMBUS-TOPOLOGY-ACTION-NOTIFIER-PLUGIN (.getName InMemoryTopologyActionNotifier)}))
           (bind cluster-state (cluster/mk-storm-cluster-state conf))
           (bind nimbus (nimbus/service-handler conf (nimbus/standalone-nimbus)))
-          (bind notifier (InMemoryTopologyAcitonNotifier.))
+          (bind notifier (InMemoryTopologyActionNotifier.))
           (sleep-secs 1)
           (bind topology (thrift/mk-topology
                            {"1" (thrift/mk-spout-spec (TestPlannerSpout. true) :parallelism-hint 3)}


when user leaves group, remove threads for group

--- src/chat/client/store.cljs
+++ src/chat/client/store.cljs
@@ -386,6 +386,9 @@
   (transact! [:groups] (flip assoc (group :id) group)))

 (defn remove-group! [group]
+  (let [group-threads (get-in @app-state [:group-threads (group :id)])]
+    (transact! [:threads] #(apply dissoc % group-threads)))
+  (transact! [:group-threads] (flip dissoc (group :id)))
   (transact! [:groups] (flip dissoc (group :id))))

 (defn become-group-admin! [group-id]


document chess data format

document chess data format

--- src/chessground/chess.cljs
+++ src/chessground/chess.cljs
@@ -1,8 +1,12 @@
 (ns chessground.chess
   "Immutable board data. Does not implement chess rules"
   (:require [chessground.common :refer [pp]]
-            [chessground.fen :as forsyth]
-            [clojure.string :refer [lower-case]]))
+            [chessground.fen :as forsyth]))
+
+; Representation of a chess game:
+; {:pieces {:a1 {:color :white :role :rook}
+;           :b1 {:color :white :role :knight}
+;          }}

 (def colors [:white :black])


Use shallow clones for improved performance

--- src/circle/backend/git.clj
+++ src/circle/backend/git.clj
@@ -83,7 +83,7 @@
     ;; with-repo-lock.
     (fs/mkdirs path)
     (git-fn* (sh/q
-              (git clone ~url "."))
+              (git clone --depth=1 ~url "."))
              :ssh-key
              ssh-key
              :repo path)))


Hotfix

Hotfix

--- src/word_keeper/core.clj
+++ src/word_keeper/core.clj
@@ -33,8 +33,8 @@
 (defroutes routes
   (GET "/" [] action-index)
   (context "/api/translations/:uid" [uid]
-           (POST / [] #(flat-user-translations % uid))
-           (GET / [] #(post-translation % uid)))
+           (GET / [] #(flat-user-translations % uid))
+           (POST / [] #(post-translation % uid)))
   (GET "/vocabulary" [] (-> action-vocabulary auth-middleware))
   (GET "/signin" [] action-signin)
   (GET "/signout" [] action-signout)


Atomic words tab in the navbar

Atomic words tab in the navbar

--- src/zg/html_renderer.clj
+++ src/zg/html_renderer.clj
@@ -37,12 +37,19 @@
     []
     [:div "

Author: Pavel Tisnovsky <ptisnovs@redhat.com&gt"])

+(defn mode->str
+    "The actual zg mode (a keyword) is transformed into string that will be used in URL"
+    [mode]
+    (condp = mode
+        :whitelist    "whitelist"
+        :blacklist    "blacklist"
+        :atomic-typos "atomic-typos"
+                      "whitelist")) ; default
+
 (defn search-href
     "Generator of href destination for the 'search' input field."
     [url-prefix mode]
-    (if (= mode :whitelist)
-        (str url-prefix "whitelist")
-        (str url-prefix "blacklist")))
+    (str url-prefix (mode->str mode)))

 (defn render-search-field
     "Renders search box on the top side of HTML page."
@@ -106,6 +113,7 @@
                         [:ul {:class "nav navbar-nav"}
                             [:li (tab-class :whitelist mode) [:a {:href (str url-prefix "whitelist")} "Whitelist"]]
                             [:li (tab-class :blacklist mode) [:a {:href (str url-prefix "blacklist")} "Blacklist"]]
+                            [:li (tab-class :atomic-typos mode) [:a {:href (str url-prefix "atomic-typos")} "Atomic typos"]]
                         ]
                     ]
                 ] ; col-md-7 ends


tidy docstrings

tidy docstrings

--- src/overtone/sc/machinery/allocator.clj
+++ src/overtone/sc/machinery/allocator.clj
@@ -1,5 +1,7 @@
-(ns
-    ^{:doc "ID allocator system. Used to return new unique integer IDs in a threadsafe manner. IDs may be freed and therefore reused. Allows action fns to be executed in synchronisation with allocation and deallocation."
+(ns ^{:doc "ID allocator system. Used to return new unique integer IDs
+            in a threadsafe manner. IDs may be freed and therefore
+            reused. Allows action fns to be executed in synchronisation
+            with allocation and deallocation."
       :author "Sam Aaron"}
   overtone.sc.machinery.allocator
   (:use [overtone.sc defaults]
@@ -26,10 +28,11 @@
    :control-bus  (ref (mk-bitset (sc-arg-default :max-control-bus)))})

 (defn- fill-gaps
-  "Returns a new vector similar to bs except filled with with size consecutive vals from idx
+  "Returns a new vector similar to bs except filled with with size
+   consecutive vals from idx

-  example: (fill with 3 from idx 1 for 2 vals)
-  (fill-gaps [1 0 0 0 1] 1 2 3) ;=> [1 3 3 0 1]"
+   example: (fill with 3 from idx 1 for 2 vals)
+   (fill-gaps [1 0 0 0 1] 1 2 3) ;=> [1 3 3 0 1]"
   [bs idx size val]
   (loop [bs bs
          idx idx
@@ -39,8 +42,8 @@
       bs)))

 (defn- find-gap
-  "Returns index of the first gap in vector bs with specified size where gap is
-  defined as a falsey value.
+  "Returns index of the first gap in vector bs with specified size where
+   gap is defined as a falsey value.

   example:
   (find-gap [true false true false false false true] 3) ;=> 3"
@@ -57,8 +60,8 @@
 (defonce action-fn-executor* (agent nil))

 (defn- execute-action-fn
-  "Execute action-fn and catch all exceptions - outputting them to the error
-  log. All actions are executed in sequence."
+  "Execute action-fn and catch all exceptions - outputting them to the
+   error log. All actions are executed in sequence."
   [action-fn caller-name]
   (send action-fn-executor* (fn [_]
                               (try
@@ -68,14 +71,15 @@
                                 (finally nil)))))

 (defn alloc-id
-  "Allocate a new ID for the type corresponding to key. Takes an optional
-  action-fn which it will evaluate in transaction with the allocation of the id.
-  Therefore there is no possibility of interleaving concurrent allocation of ids
-  and the execution of associated action-fns. Execution of action-fn is also
-  synchronised with the execution of free-id action-fns. Action-fn takes one
-  param - the newly allocated id.
+  "Allocate a new ID for the type corresponding to key. Takes an
+   optional action-fn which it will evaluate in transaction with the
+   allocation of the id.  Therefore there is no possibility of
+   interleaving concurrent allocation of ids and the execution of
+   associated action-fns. Execution of action-fn is also synchronised
+   with the execution of free-id action-fns. Action-fn takes one param -
+   the newly allocated id.

-  Returns newly allocated id."
+   Returns newly allocated id."
   ([k] (alloc-id k 1 nil))
   ([k size] (alloc-id k size nil))
   ([k size action-fn]
@@ -92,13 +96,14 @@
 (defonce _root-group_ (alloc-id :node))

 (defn free-id
-  "Free the ID of type key. Takes an optional action-fn which it will evaluate
-  in transaction with the freeing of the id. (Evaluation happens within an agent
-  so there's no need to worry about the transaction retrying multiple times).
-  Therefore there is no possibility of interleaving concurrent freeing of ids
-  and execution of associated action-fns. Execution of action-fn is also
-  synchronised with the execution of alloc-id action-fns (they all use the same
-  agent)."
+  "Free the ID of type key. Takes an optional action-fn which it will
+   evaluate in transaction with the freeing of the id. (Evaluation
+   happens within an agent so there's no need to worry about the
+   transaction retrying multiple times).  Therefore there is no
+   possibility of interleaving concurrent freeing of ids and execution
+   of associated action-fns. Execution of action-fn is also synchronised
+   with the execution of alloc-id action-fns (they all use the same
+   agent)."
   ([k id] (free-id k id 1 nil))
   ([k id size] (free-id k id size nil))
   ([k id size action-fn]


(PDB-4626) date_trunc uses different semantics

The query to determine which partitions to create in advance of the
migration uses the postgresql function date_trunc, which will work and
match the trigger and other code if you do not attempt to coerce to UTC
at the same time.

Tested by switching my local machine to CET (UTC+01:00) and running the
tests, to match the customer use-case.

--- src/puppetlabs/puppetdb/scf/migrate.clj
+++ src/puppetlabs/puppetdb/scf/migrate.clj
@@ -1668,7 +1668,7 @@
    ;; pre-create partitions
    (log/info (trs "Creating partitions based on unique days in resource_events"))
    (jdbc/call-with-query-rows
-    ["select distinct date_trunc('day', \"timestamp\" AT TIME ZONE 'UTC') as rowdate
+    ["select distinct date_trunc('day', \"timestamp\") as rowdate
       from resource_events_premigrate"]
     (fn [rows]
       (doseq [row rows]


build queue-view doesn't need component state

--- src-cljs/core.cljs
+++ src-cljs/core.cljs
@@ -254,8 +254,8 @@
                (dom/h2 nil "results")
                (om/build results-view app {:init-state state})
                (dom/h2 nil "queue")
-               (om/build queue-view app {:init-state state})
-               (om/build player-view app )
+               (om/build queue-view app)
+               (om/build player-view app)
                ))))

 (defn init []


fix(repl send): prevent throwing an exception inside an exception

--- ccw.core/src/clj/ccw/editors/clojure/editor_common.clj
+++ ccw.core/src/clj/ccw/editors/clojure/editor_common.clj
@@ -66,7 +66,7 @@
       .client
       (repl/message message))
     (catch Exception e
-      (ccw.CCWPlugin/logError (str "exception while sending message " message " to connection " (.getUnsafeConnection safe-connection)) e)
+      (ccw.CCWPlugin/logError (str "exception while sending message " message " to connection " safe-connection) e)
       (when (instance? java.net.SocketException e)
         (.connectionLost safe-connection))
       nil)))


Disable elements from the dashbaord header.

--- src/uxbox/main/ui/dashboard/header.cljs
+++ src/uxbox/main/ui/dashboard/header.cljs
@@ -41,7 +41,7 @@
      [:ul.main-nav
       [:li {:class (when projects? "current")}
        (header-link :dashboard/projects (tr "ds.projects"))]
-      [:li {:class (when elements? "current")}
+      #_[:li {:class (when elements? "current")}
        (header-link :dashboard/elements (tr "ds.elements"))]
       [:li {:class (when icons? "current")}
        (header-link :dashboard/icons (tr "ds.icons"))]


disable flaky tests (#577)

disable flaky tests (#577)

--- waiter/integration/waiter/request_timeout_test.clj
+++ waiter/integration/waiter/request_timeout_test.clj
@@ -137,7 +137,8 @@
       (make-request-and-assert-timeout waiter-url request-headers start-time-ms timeout-period-sec)
       (delete-service waiter-url request-headers))))

-(deftest ^:parallel ^:integration-slow test-request-queue-timeout-max-instances-limit
+; Marked explicit because it's flaky
+(deftest ^:parallel ^:integration-slow ^:explicit test-request-queue-timeout-max-instances-limit
   ;; Limits the service to a single instance and then makes a long requests to it on each router.
   ;; Then we make a request with a small timeout and make sure it actually times out.
   (testing-using-waiter-url


s/io/I/

s/io/I/

--- babel/english/lexicon.clj
+++ babel/english/lexicon.clj
@@ -512,7 +512,7 @@
                     :person :1st
                     :number :sing}
               :sem {:human true
-                    :pred :io}
+                    :pred :I}
               :subcat '()}}]

    "imagine" {:synsem {:cat :verb


Add :time field to TmpFile record

Add :time field to TmpFile record

--- boot/pod/src/boot/tmpdir.clj
+++ boot/pod/src/boot/tmpdir.clj
@@ -1,4 +1,5 @@
 (ns boot.tmpdir
+  (:refer-clojure :exclude [time])
   (:require
     [clojure.java.io  :as io]
     [clojure.set      :as set]
@@ -11,6 +12,7 @@
   (id   [this])
   (dir  [this])
   (path [this])
+  (time [this])
   (file [this]))

 (defprotocol ITmpFileSet
@@ -22,11 +24,12 @@
   (mv      [this from-path to-path])
   (cp      [this src-file dest-tmpfile]))

-(defrecord TmpFile [dir path id]
+(defrecord TmpFile [dir path id time]
   ITmpFile
   (id   [this] id)
   (dir  [this] dir)
   (path [this] path)
+  (time [this] time)
   (file [this] (io/file dir path)))

 (defrecord TmpDir [dir user input output]
@@ -40,7 +43,7 @@
   [dir]
   (let [file->rel-path #(file/relative-to dir %)
         file->kv       #(let [p (str (file->rel-path %))]
-                          [p (TmpFile. dir p (digest/md5 %))])]
+                          [p (TmpFile. dir p (digest/md5 %) (.lastModified %))])]
     (->> dir file-seq (filter (memfn isFile)) (map file->kv) (into {}))))

 (defn- add-blob!


Use source-paths instead of dependencies for local deps in website

--- website/project.clj
+++ website/project.clj
@@ -7,12 +7,6 @@
   :dependencies [[thheller/shadow-cljs "2.0.20"]
                  [org.clojure/clojure "1.9.0-alpha17"]
                  [org.clojure/clojurescript "1.9.946" :scope "provided"]
-
-                 [re-view "0.4.0-SNAPSHOT"]
-                 [re-db "0.1.13"]
-                 [re-view/prosemirror "0.2.0-SNAPSHOT"]
-                 [re-view/material "0.2.0-SNAPSHOT"]
-
                  [org.clojure/core.match "0.3.0-alpha5"]]

   :plugins [[lein-figwheel "0.5.12"]
@@ -21,7 +15,14 @@
   :clean-targets ^{:protect false} ["resources/public/js/compiled"
                                     "target"]
   :profiles {:dev {:dependencies [[org.clojure/test.check "0.9.0"]]}}
-  :source-paths ["src"]
+  :source-paths ["src"
+                 "../re_db/src"
+                 "../prosemirror/src"
+                 "../re_view/src"
+                 "../material/src"
+                 "../material/example"
+                 "../prosemirror/example"
+                 "../re_view/example"]

   :cljsbuild {:builds [{:id           "dev"
                         :source-paths ["src"]


use 12 t-attr colum families

use 12 t-attr colum families

We used to use a single t-attr table. This table grows very fast under
high loads and make it hard to scale cassandra in a timely manner.

Using 12 tables makes it easy to compaction to catch up, which is
important since we are using leveled compaction strategy.

Archiving is also much easier since for most of the time the column
families will be essentially read-only.

--- src/blackbox/src/leela/blackbox/storage/cassandra.clj
+++ src/blackbox/src/leela/blackbox/storage/cassandra.clj
@@ -30,10 +30,13 @@
   (let [time (from-long (* 1000 time-in-sec))
         bucket (quot (to-long (date-time (year time) (month time) (day time))) 1000)
         slot (- time-in-sec bucket)]
-    [bucket slot]))
+    [(month time) bucket slot]))

 (defn encode-time [bucket slot]
   (+ bucket slot))
+
+(defn t-attr-colfam [month]
+  (keyword (format "t_attr_%02d" month)))

 (defn use-attr-schema [cluster keyspace]
   (when-not (describe-keyspace cluster keyspace)
@@ -45,13 +48,15 @@
      (with {:replication {:class "SimpleStrategy" :replication_factor 1}})))
   (info (format "connecting to keyspace %s" keyspace))
   (use-keyspace cluster keyspace)
-  (when-not (describe-table cluster keyspace :t_attr)
-    (warn "creating table t_attr")
-    (create-table
-     cluster :t_attr
-     (if-not-exists)
-     (column-definitions {:key :uuid :name :varchar :bucket :bigint :slot :int :data :blob :primary-key [[:key :name :bucket] :slot]})
-     (with {:compaction {:class "LeveledCompactionStrategy" :sstable_size_in_mb "256"}})))
+  (dotimes [m 12]
+    (let [colfam (t-attr-colfam (+ 1 m))]
+      (when-not (describe-table cluster keyspace colfam)
+        (warn (format "creating table %s" colfam)
+              (create-table
+               cluster colfam
+               (if-not-exists)
+               (column-definitions {:key :uuid :name :varchar :bucket :bigint :slot :int :data :blob :primary-key [[:key :name :bucket] :slot]})
+               (with {:compaction {:class "LeveledCompactionStrategy" :sstable_size_in_mb "256"}}))))))
   (when-not (describe-table cluster keyspace :k_attr)
     (warn "creating table k_attr")
     (create-table
@@ -134,7 +139,9 @@
      ~@body))

 (defn truncate-all [cluster]
-  (doseq [t [:graph :g_index :k_index :t_index :t_attr :k_attr :n_naming :g_naming]]
+  (dotimes [m 12]
+    (truncate cluster (t-attr-colfam (+ 1 m))))
+  (doseq [t [:graph :g_index :k_index :t_index :k_attr :n_naming :g_naming]]
     (truncate cluster t)))

 (defn fmt-put-index-opts [table data opts]
@@ -171,20 +178,20 @@

 (defn fmt-put-tattr [[data opts0]]
   (let [opts (flatten (seq (dissoc opts0 :index)))
-        [bucket slot] (decode-time (:time data))
+        [month bucket slot] (decode-time (:time data))
         idx (if (:index opts0)
               [(fmt-put-index-opts :t_index
                                    {:key (:key data)
                                     :name (:name data)} opts)]
               [])]
     (if (empty? opts)
-      (cons (insert-query :t_attr
+      (cons (insert-query (t-attr-colfam month)
                           {:data (:value data)
                            :key (:key data)
                            :name (:name data)
                            :bucket bucket
                            :slot slot}) idx)
-      (cons (insert-query :t_attr
+      (cons (insert-query (t-attr-colfam month)
                           {:data (:value data)
                            :key (:key data)
                            :name (:name data)
@@ -199,9 +206,9 @@

 (defn fmt-del-tattr [data]
   (if (contains? data :time)
-    (let [[bucket slot] (decode-time (:time data))]
+    (let [[month bucket slot] (decode-time (:time data))]
       [(delete-query
-        :t_attr
+        (t-attr-colfam month)
         (where [[= :key (:key data)]
                 [= :name (:name data)]
                 [= :bucket bucket]
@@ -297,12 +304,12 @@
     (client/execute cluster (client/render-query query))))

 (defn get-tattr [cluster k name time]
-  (let [[bucket slot] (decode-time time)]
+  (let [[month bucket slot] (decode-time time)]
     (map
      (fn [row]
        [(encode-time bucket (:slot row)) (f/binary-to-bytes (:data row))])
      (select cluster
-             :t_attr
+             (t-attr-colfam month)
              (columns :slot :data)
              (where [[= :key k] [= :name name] [= :bucket bucket] [>= :slot slot]])))))


Add test for mapping nth fn foo.

Add test for mapping nth fn foo.

--- test/dsbdp/test/processing_fn_utils.clj
+++ test/dsbdp/test/processing_fn_utils.clj
@@ -47,7 +47,15 @@
     (is (= 2 ((proc-fns 1) nil 0)))
     (is (= 6 ((proc-fns 5) nil 0)))
     (is (= 6 (mapped-proc-fn 0 nil)))
-    (is (= 10 (mapped-proc-fn 4 nil)))
+    (is (= 10 (mapped-proc-fn 4 nil)))))
+
+(deftest simple-create-mapped-proc-fn-test-nth
+  (let [proc-fns (create-proc-fn-vec-from-template '(fn [i _] (+ i :_idx_ 1)) '(fn [_ o] (+ o :_idx_ 1)) 6)
+        mapped-proc-fn (create-mapped-proc-fn proc-fns 3 5)]
+    (is (= 4 ((proc-fns 3) nil 0)))
+    (is (= 5 ((proc-fns 4) nil 0)))
+    (is (= 9 (mapped-proc-fn nil 0)))
+    (is (= 15 (mapped-proc-fn nil 6)))
     )
   )


Add log when fails

Add log when fails

--- test/obb_rules/ai/firingsquad_test.cljc
+++ test/obb_rules/ai/firingsquad_test.cljc
@@ -4,6 +4,7 @@
             [obb-rules.stash :as stash]
             [obb-rules.unit :as unit]
             [obb-rules.element :as element]
+            [obb-rules.simplifier :as simplifier]
             [obb-rules.board :as board]
             [obb-rules.result :as result]
             [obb-rules.ai.firingsquad :as firingsquad]
@@ -97,4 +98,7 @@
               (recur (dissoc next-game :action-results) (+ 1 counter))
               (if (result/succeeded? result)
                 (println "** Game" x ":" counter "turns")
-                (println result)))))))))
+                (do
+                  (println "--" player)
+                  (println actions)
+                  (println (simplifier/clean-result result)))))))))))