making repl output behave better

making repl output behave better

--- sidecar/src/figwheel_sidecar/system.clj
+++ sidecar/src/figwheel_sidecar/system.clj
@@ -8,7 +8,7 @@
    [figwheel-sidecar.notifications]
    [figwheel-sidecar.clj-reloading]
    [figwheel-sidecar.javascript-reloading]
-
+
    [com.stuartsierra.component :as component]

    [cljs.build.api :as bapi]
@@ -107,7 +107,6 @@
   (start [this]
     (if-not (:http-server this)
       (do
-        (println "Figwheel: Starting Server")
         (map->FigwheelServer (fig/start-server this)))
       this))
   (stop [this]
@@ -169,11 +168,14 @@
         (println "Figwheel: Watching build -" (:id build-config))
         (flush)
         ;; setup
-        (fig-inject/delete-connect-scripts! [build-config])
+        (figwheel-sidecar.injection/delete-connect-scripts! [build-config])
         ;; TODO this should be conditional based on a flag
         #_(clean-cljs-build* (:build-options build-config))
-        ;; initial build only needs the injection
-        ((figwheel-sidecar.injection/build-hook cljs-build) this)
+        ;; initial build only needs the injection and the
+        ;; start and end messages
+        ((-> cljs-build
+             figwheel-sidecar.injection/build-hook
+             figwheel-start-and-end-messages) this)
         (let [log-writer (or log-writer (io/writer "figwheel_server.log" :append true))]
           (assoc this
                  :file-watcher
@@ -209,7 +211,7 @@
            (do
              (if (:css-dirs this)
                (let [log-writer (or log-writer (io/writer "figwheel_server.log" :append true))]
-                 (println "Figwheel: starting CSS watcher for dirs " (prn-str (:css-dirs this)))
+                 (println "Figwheel: Starting CSS watcher for dirs " (pr-str (:css-dirs this)))
                  (assoc this :css-watcher-quit
                         (watcher (:css-dirs this)
                                  (fn [files]
@@ -235,13 +237,39 @@
 ;; nrepl component only really useful in a development env
 ;; considering making it idempotent so that it's only launched once

+(defn require? [symbol]
+  (try (require symbol) true (catch Exception e false)))
+
+(defn start-nrepl-server [figwheel-options autobuild-options]
+  (when (:nrepl-port figwheel-options)
+    (let [middleware (or
+                      (:nrepl-middleware figwheel-options)
+                      ["cemerick.piggieback/wrap-cljs-repl"])
+          resolve-mw (fn [name]
+                       (let [s (symbol name)
+                             ns (symbol (namespace s))]
+                         (if (and
+                              (require? ns)
+                              (resolve s))
+                           (let [var (resolve s)
+                                 val (deref var)]
+                             (if (vector? val)
+                               (map resolve val)
+                               (list var)))
+                           (println (format "WARNING: unable to load \"%s\" middleware" name)))))
+          middleware (mapcat resolve-mw middleware)]
+      (nrepl-serv/start-server
+       :port (:nrepl-port figwheel-options)
+       :bind (:nrepl-host figwheel-options)
+       :handler (apply nrepl-serv/default-handler middleware)))))
+
 (defrecord NreplComponent []
   component/Lifecycle
   (start [this]
     (if (not (:running-nrepl-server this))
       (do
         (println "Figwheel: Starting nREPL server on port:" (:nrepl-port this))
-        (assoc this :running-nrepl-server (frepl/start-nrepl-server this nil)))
+        (assoc this :running-nrepl-server (start-nrepl-server this nil)))
       (do
         (println "Figwheel: nREPL server already running")
         this)))
@@ -300,7 +328,7 @@
      (concat
       [:builds all-builds ;; this needs to be an array map
        :cljs-build-fn cljs-build-fn
-       :log-writer
+       :log-writer log-writer
        :sync-executor (SyncExecutor.)
        :figwheel-server (map->FigwheelServer figwheel-options)]
       (mapcat (fn [build-config]
@@ -347,22 +375,22 @@
    :all-builds (get-project-builds)})

 ;; TODO just for dev
-(defonce system
+#_(defonce system
   (atom
    (create-figwheel-system* temp-config)))

 ;; TODO just for dev
-(count (:builds @system))
-(keys @system)
+#_(count (:builds @system))
+#_(keys @system)

 ;; TODO just for dev
-(defn start []
+#_(defn start []
   (swap! system component/start))
 ;; TODO just for dev
-(defn stop []
+#_(defn stop []
   (swap! system component/stop))
 ;; TODO just for dev
-(defn reload []
+#_(defn reload []
   (swap! system component/stop)
   (require 'figwheel-sidecar.system :reload)
   (swap! system component/start))
@@ -432,28 +460,33 @@

 (defn stop-autobuild [system ids]
   (repl-println "Figwheel: Stoping autobuild")
-  (swap! system component/stop-system (ids-or-all-build-keys system ids)))
+  (swap! system component/stop-system (ids-or-all-build-keys system ids))
+  nil)

 (defn start-autobuild [system ids]
   (repl-println "Figwheel: Starting autobuild")
   (when (not-empty ids)
     (patch-system-builds system ids))
-  (swap! system component/start-system (ids-or-all-build-keys system ids)))
+  (swap! system component/start-system (ids-or-all-build-keys system ids))
+  nil)

 (defn switch-to-build [system ids]
   (when (not-empty ids)
-    (start-autobuild system ids)))
+    (start-autobuild system ids))
+  nil)

 (defn clean-build [system id]
   (let [{:keys [builds]} @system]
     (when-let [{:keys [build-options]} (get builds (name id))]
       (repl-println "Figwheel: Cleaning build -" id)
-      (clean-cljs-build* build-options))))
+      (clean-cljs-build* build-options)))
+  nil)

 (defn clean-builds [system ids]
   (let [ids (map key->id (ids-or-all-build-keys system ids))]
     (doseq [id ids]
-      (clean-build system id))))
+      (clean-build system id)))
+  nil)

 (defn build-once* [system id]
   (when-let [build-config (get (:builds @system) (name id))]
@@ -463,19 +496,22 @@

 (defn build-once [system ids]
   (doseq [ky (ids-or-all-build-keys system ids)]
-    (build-once* system (key->id ky))))
+    (build-once* system (key->id ky)))
+  nil)

 (defn reset-autobuild [system]
   (swap! system component/stop-system (all-build-keys system))
   (clean-builds system nil)
-  (swap! system component/start-system (all-build-keys system)))
+  (swap! system component/start-system (all-build-keys system))
+  nil)

 (defn reload-config [system]
   (swap! system component/stop-system (all-build-keys system))
   (clean-builds system nil)
   (repl-println "Figwheel: Reloading build config information")
   (swap! system assoc :builds (get-project-builds))
-  (swap! system component/start-system (all-build-keys system)))
+  (swap! system component/start-system (all-build-keys system))
+  nil)

 (defn watchers-running [system]
   (filter (fn [key] (get-in @system [key :file-watcher]))
@@ -493,7 +529,8 @@
        (doseq [[id v] @connection-count]
          (repl-println "\t" (str (if (nil? id) "any-build" id) ":")
                   v (str "connection" (if (= 1 v) "" "s")))))
-     (repl-println "----------------------------------------------------")))
+     (repl-println "----------------------------------------------------"))
+    nil)

 ;; repl-launching

@@ -579,8 +616,9 @@
     (component/start system)))

 (defn start-figwheel-and-cljs-repl! [autobuild-options]
-  (let [system (start-figwheel! autobuild-options)]
-    (build-switching-cljs-repl system)))
+  (let [system-atom (atom (start-figwheel! autobuild-options))]
+    (build-switching-cljs-repl system-atom)
+    system-atom))

 (defn stop-figwheel! [system]
   (component/stop system))


Add missing file

Add missing file

error: pathspec 'src/circle/model/spec.clj' did not match any file(s) known to git

--- src/circle/model/spec.clj
+++ src/circle/model/spec.clj
@@ -0,0 +1,8 @@
+(ns circle.model.spec
+  (:require [somnium.congomongo :as mongo]))
+
+(def spec-coll :specs)
+
+(defn get-spec-for-project [project]
+  (-> (mongo/fetch-one spec-coll :where {:project_id (:_id project)})
+      (dissoc :version :versions)))


Add more examples from chapter 5

Add more examples from chapter 5

error: pathspec 'src/clojure/cfbt/ch05.clj' did not match any file(s) known to git

--- src/clojure/cfbt/ch05.clj
+++ src/clojure/cfbt/ch05.clj
@@ -0,0 +1,80 @@
+(ns clojure.cfbt.ch05)
+
+(defn wisdom
+  [words]
+  (str words ", Daniel-san"))
+
+(wisdom "Always bathe on Friday") ;; "Always bathe on Friday, Daniel-san"
+
+;; non-pure functional
+(defn year-end-evaluation
+  []
+  (if (> (rand) 0.5)
+    ("You get a raise!"
+     "Better luck next year!")))
+
+(defn analysis [text]
+  (str "Character count: " (count text)))
+
+(defn analyze-file
+  [filename]
+  (analysis (slurp filename)))
+
+(analyze-file "project.clj") ;; "Character count: 659"
+
+;; side-effect-free example
+
+(def great-baby-name "Rosanthony")
+
+(let [great-baby-name "Bloodthunder"]
+  great-baby-name) ;; "Bloodthunder"
+
+great-baby-name ;;  "Rosanthony"
+
+(defn sum
+  ([vals] (sum vals 0))
+  ([vals accumulating-total]
+   (if (empty? vals)
+     accumulating-total
+     (sum (rest vals) (+ (first vals) accumulating-total)))))
+
+(sum [39 5 1]) ;; 45
+(sum [39 5 1] 0) ;; 45
+(sum [5 1] 39) ;; 45
+(sum [] 45) ;; 45
+
+;; Using recur
+(defn sum
+  ([vals]
+   (sum vals 0))
+  ([vals accumulating-total]
+   (if (empty? vals)
+     accumulating-total
+     (recur (rest vals) (+ (first vals) accumulating-total)))))
+
+(sum [39 5 1]) ;; 45
+(sum [5 1] 39) ;; 45
+
+(require '[clojure.string :as s])
+(defn clean
+  [text]
+  (s/replace (s/trim text) #"lol" "LOL"))
+
+(clean "My boa constrictor is so sassy lol!  ") ;; "My boa constrictor is so sassy LOL!"
+
+;; Use comp
+((comp inc *) 2 3) ;; 7
+
+(def character
+  {:name "Smooches McCutes"
+   :attributes {:intelligence 10
+                :strength 4
+                :dexterity 5}})
+
+(def c-int (comp :intelligence :attributes))
+(def c-str (comp :strength     :attributes))
+(def c-dex (comp :dexterity    :attributes))
+
+(c-int character) ;; 10
+(c-str character) ;; 4
+(c-dex character) ;; 5


Added configuration namespace.

Added configuration namespace.

error: pathspec 'src/cmr/common/config.clj' did not match any file(s) known to git

--- src/cmr/common/config.clj
+++ src/cmr/common/config.clj
@@ -0,0 +1,35 @@
+(ns cmr.common.config
+  "A namespace that allows for global configuration. Configuration can be provided at runtime or
+  through an environment variable"
+  (:require [clojure.string :as str]))
+
+(def runtime-config-values
+  "An atom containing a map of explicitly set config values."
+  (atom {}))
+
+(defn set-config-value!
+  "Sets a config value at runtime. This allows something like dev-system
+  to change a port at runtime without having to specify it as a env variable"
+  [name value]
+  (swap! runtime-config-values #(assoc % name value)))
+
+(defn reset-config-values
+  "Resets any explicitly set runtime configuration values."
+  []
+  (reset! runtime-config-values {}))
+
+(defn config-value-fn
+  "Returns a function that can retrieve a configuration value which can be set as an environment
+  variable on the command line or default to a value."
+  [config-name default-value]
+
+  ;; Environment variables can't change at runtime so we look them up initially.
+  (let [env-name (str "CMR_" (-> config-name
+                                 name
+                                 (str/replace "-" "_")
+                                 str/upper-case))
+        env-value (System/getenv env-name)]
+    (fn []
+      (or (get @runtime-config-values config-name)
+          env-value
+          default-value))))


kata4: add nrepl dependency for test

kata4: add nrepl dependency for test

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/schaueho/clojure-codekata.git/'


Add a shitty logging engine

Add a shitty logging engine

error: pathspec 'src/detritus/logging.clj' did not match any file(s) known to git

--- src/detritus/logging.clj
+++ src/detritus/logging.clj
@@ -0,0 +1,43 @@
+(ns detritus.logging
+  "This namespace provides a trivial ")
+
+;; FATAL    : 5
+;; ERROR    : 4
+;; WARN     : 3
+;; MESSAGE  : 2
+;; INFO     : 1
+;; DEBUG    : 0
+
+(def ^:dynamic *log-level*  -1)
+(def ^:dynamic *log-width*  80)
+(def ^:dynamic *log-stream* *err*)
+
+(defn debug [& args]
+  (when (>= 0 *log-level*)
+    (with-bindings {#'clojure.core/*out* *log-stream*}
+      (println "[DEBUG   ]" (apply str args)))))
+
+(defn info [& args]
+  (when (>= 1 *log-level*)
+    (with-bindings {#'clojure.core/*out* *log-stream*}
+      (println "[INFO    ]" (apply str args)))))
+
+(defn message [args]
+  (when (>= 2 *log-level*)
+    (with-bindings {#'clojure.core/*out* *log-stream*}
+      (println "[MESSAGE ]" (apply str args)))))
+
+(defn warn [args]
+  (when (>= 3 *log-level*)
+    (with-bindings {#'clojure.core/*out* *log-stream*}
+      (println "[WARN    ]" (apply str args)))))
+
+(defn error [args]
+  (when (>= 4 *log-level*)
+    (with-bindings {#'clojure.core/*out* *log-stream*}
+      (println "[ERROR   ]" (apply str args)))))
+
+(defn fatal [args]
+  (when (>= 5 *log-level*)
+    (with-bindings {#'clojure.core/*out* *log-stream*}
+      (println "[FATAL   ]" (apply str args)))))


btset disj basic impl

btset disj basic impl

--- src/datascript/btset.cljs
+++ src/datascript/btset.cljs
@@ -3,7 +3,7 @@

 (declare BTSet Node LeafNode)

-(def ^:const min-len nil) ;; FIXME
+(def ^:const ^number min-len 64)
 (def ^:const ^number max-len 128)
 (def ^:const ^number level-shift (->> (range 31 -1 -1)
                               (filter #(bit-test max-len %))
@@ -70,7 +70,7 @@
                            ^number cut-to
                            ^number splice-from
                            ^number splice-to
-                           ^array  xs]
+                           ^array  xs] ;; TODO slice + concat?
   (let [arr-l   (alength arr)
         xs-l    (alength xs)
         l1      (- splice-from cut-from)
@@ -85,7 +85,7 @@
       (aset new-arr (+ i l1xs) (aget arr (+ splice-to i))))
     new-arr))

-(defn cut
+(defn cut ;; TODO use Array.prototype.slice etc
   (^array [^array arr ^number cut-from]
     (.slice arr cut-from))
   (^array [^array arr ^number cut-from ^number cut-to]
@@ -102,30 +102,118 @@
                      ^array xs]
   (cut-n-splice arr 0 (alength arr) idx idx xs))

+(defn ^array merge-n-split [^array a1
+                            ^array a2]
+  (let [a1-l    (alength a1)
+        a2-l    (alength a2)
+        total-l (+ a1-l a2-l)
+        r1-l    (half total-l)
+        r2-l    (- total-l r1-l)
+        r1      (make-array r1-l)
+        r2      (make-array r2-l)]
+    (dotimes [i total-l]
+      (aset (if (< i r1-l) r1 r2)
+            (if (< i r1-l) i (- i r1-l))
+            (aget (if (< i a1-l) a1 a2)
+                  (if (< i a1-l) i (- i a1-l)))))
+    #js [r1 r2]))
+
+(defn ^boolean eq-arr [^array  a1
+                       ^number a1-from
+                       ^number a1-to
+                       ^array  a2
+                       ^number a2-from
+                       ^number a2-to
+                       cmp]
+  (let [len (- a1-to a1-from)]
+    (and
+      (== len (- a2-to a2-from))
+      (loop [i 0]
+        (cond
+          (== i len)
+            true
+          (not (cmp (aget a1 (+ i a1-from))
+                    (aget a2 (+ i a2-from))))
+            false
+          :else
+            (recur (inc i)))))))
+
+(defn ^array check-n-splice [^array  arr
+                             ^number from
+                             ^number to
+                             ^array  new-arr]
+  (if (eq-arr arr from to new-arr 0 (alength new-arr) eq)
+    arr
+    (splice arr from to new-arr)))
+
 ;;
-
-(defn ^array replace-keys [^array old-keys ^number idx ^array new-keys]
-  (let [new-keys-l (alength new-keys)]
-    (if (and (== 1 new-keys-l)
-             (eq (aget new-keys 0) (nth old-keys idx)))
-      ;; new key matches old one, can reuse old keys array
-      old-keys
-      ;; else regular replace
-      (splice old-keys idx (inc idx) new-keys))))

 (defn lim-key [node]
   (aget (.-keys node) (dec (alength (.-keys node)))))

+(defn return-array
+  "Drop non-nil references and return array of arguments"
+  ([a1] #js [a1])
+  ([a1 a2] (if a1 (if a2 #js [a1 a2] #js [a1]) #js [a2]))
+  ([a1 a2 a3] (if a1 (if a2 (if a3 #js [a1 a2 a3] #js [a1 a2]) (if a3 #js [a1 a3] #js [a1])) (if a2 (if a3 #js [a2 a3] #js [a2]) #js [a3]))))
+
+(defn rotate [node root? left right]
+  (cond
+    ;; root never merges
+    root?
+      (return-array node)
+
+    ;; enough keys, nothing to merge
+    (> (.len node) min-len)
+      (return-array left node right)
+
+    ;; left and this can be merged to one
+    (and left (<= (.len left) min-len))
+      (return-array (.merge left node) right)
+
+    ;; right and this can be merged to one
+    (and right (<= (.len right) min-len))
+      (return-array left (.merge node right))
+
+    ;; left has fewer nodes, redestribute with it
+    (and left (or (nil? right)
+                  (< (.len left) (.len right))))
+      (let [nodes (.merge-n-split left node)]
+        (return-array (aget nodes 0) (aget nodes 1) right))
+
+    ;; right has fewer nodes, redestribute with it
+    :else
+      (let [nodes (.merge-n-split node right)]
+        (return-array left (aget nodes 0) (aget nodes 1)))))
+
 (deftype Node [keys pointers]
   Object
-
-  (append [this path level key]
+  (len [_]
+    (alength keys))
+
+  (merge [_ next]
+    (Node. (.concat keys (.-keys next))
+           (.concat pointers (.-pointers next))))
+
+  (merge-n-split [_ next]
+    (let [ks (merge-n-split keys (.-keys next))
+          ps (merge-n-split pointers (.-pointers next))]
+      (return-array (Node. (aget ks 0) (aget ps 0))
+                    (Node. (aget ks 1) (aget ps 1)))))
+
+  (lookup [_ key]
+    (let [idx (binary-search keys 0 (dec (alength keys)) key)]
+      (if (== idx (alength keys))
+        -1
+        idx)))
+
+  (append [this path level key] ;; TODO figure out idx here
     (let [idx   (path-get path level)
           nodes (.append (aget pointers idx) path (- level level-shift) key)]
       (if (identical? (aget nodes 0) (aget pointers idx))
         #js [this]
-        (let [new-keys     (replace-keys keys     idx           (.map nodes lim-key))
-              new-pointers (splice       pointers idx (inc idx) nodes)]
+        (let [new-keys     (check-n-splice keys     idx (inc idx) (.map nodes lim-key))
+              new-pointers (splice         pointers idx (inc idx) nodes)]
           (if (<= (alength new-pointers) max-len)
           ;; ok as is
           #js [(Node. new-keys new-pointers)]
@@ -134,12 +222,45 @@
             #js [(Node. (cut new-keys     0 middle)
                         (cut new-pointers 0 middle))
                  (Node. (cut new-keys     middle)
-                        (cut new-pointers middle))])))))))
+                        (cut new-pointers middle))]))))))
+
+  (disj [this ^number key root? left right]
+    (let [idx (.lookup this key)]
+      (when-not (== -1 idx) ;; short-circuit, key not here
+        (let [child       (aget pointers idx)
+              left-child  (when (>= (dec idx) 0)                 (aget pointers (dec idx)))
+              right-child (when (< (inc idx) (alength pointers)) (aget pointers (inc idx)))
+              disjned     (.disj child key false left-child right-child)]
+          (when disjned     ;; short-circuit, key not here
+            (let [left-idx     (if left-child  (dec idx) idx)
+                  right-idx    (if right-child (+ 2 idx) (+ 1 idx))
+                  new-keys     (check-n-splice keys left-idx right-idx (.map disjned lim-key))
+                  new-pointers (splice pointers left-idx right-idx disjned)]
+              (rotate (Node. new-keys new-pointers) root? left right))))))))

 (deftype LeafNode [keys]
   Object
-
-  (append [this ^number path _ key]
+  (toString [_] (pr-str* (vec keys)))
+
+  (len [_]
+    (alength keys))
+
+  (merge [_ next]
+    (LeafNode. (.concat keys (.-keys next))))
+
+  (merge-n-split [_ next]
+    (let [ks (merge-n-split keys (.-keys next))]
+      (return-array (LeafNode. (aget ks 0))
+                    (LeafNode. (aget ks 1)))))
+
+  (lookup [_ key]
+    (let [idx (binary-search keys 0 (dec (alength keys)) key)]
+      (if (and (< idx (alength keys))
+                 (eq (aget keys idx) key))
+        idx
+        -1)))
+
+  (append [this ^number path _ key] ;; TODO figure out idx here
     (let [idx    (path-get path 0)
           keys-l (alength keys)]
       (cond
@@ -155,7 +276,13 @@
               #js [(LeafNode. (cut-n-splice keys 0 middle idx idx #js [key]))
                    (LeafNode. (cut keys middle keys-l))]))
         :else ;; ok as is
-          #js [(LeafNode. (splice keys idx idx #js [key]))]))))
+          #js [(LeafNode. (splice keys idx idx #js [key]))])))
+
+  (disj [this ^number key root? left right]
+    (let [idx (.lookup this key)]
+      (when-not (== -1 idx) ;; key not there
+        (let [new-keys (splice keys idx (inc idx) #js [])]
+          (rotate (LeafNode. new-keys) root? left right))))))

 (defn ^array keys-for [set ^number path]
   (loop [level (.-shift set)
@@ -178,6 +305,19 @@
         (BTSet. (aget roots 0) (.-shift set) *cmp*)
         ;; introducing new root
         (BTSet. (Node. (.map roots lim-key) roots) (+ (.-shift set) level-shift) *cmp*)))))
+
+(defn btset-disj [set key]
+  (binding [*cmp* (.-comparator set)]
+    (let [new-roots (.disj (.-root set) key true nil nil)]
+      (if (nil? new-roots) ;; nothing changed, key wasn't in the set
+        set
+        (let [new-root (aget new-roots 0)]
+          (if (and (instance? Node new-root)
+                   (== (alength (.-pointers new-root)) 1))
+            ;; root has one child, make him new root
+            (BTSet. (aget (.-pointers new-root) 0) (- (.-shift set) level-shift) *cmp*)
+            ;; keeping root level
+            (BTSet. new-root (.-shift set) *cmp*)))))))

 ;; iteration

@@ -246,11 +386,15 @@

 (deftype BTSet [root shift comparator]
   Object
-  (toString [this]
-    (pr-str* this))
+;;   (toString [this]
+;;     (pr-str* this))

   ICollection
   (-conj [set key] (btset-conj set key))
+
+  ISet
+  (-disjoin [set key]
+    (btset-disj set key))

   ILookup
   (-lookup [set k]
@@ -279,6 +423,7 @@

 ;; helpers

+
 (defn parse-path [path shift]
   (loop [level shift
          res   []]
@@ -292,7 +437,6 @@
 ;; (def s0 (apply btset (range 20000)))
 ;; (def s1 (into (btset) (range 3)))
 ;; (apply btset (range 150))
-

 (defn dump [node writer offset]
   (if (instance? LeafNode node)
@@ -306,18 +450,26 @@
       (-write writer "\n")
       (dump (aget (.-pointers node) i) writer (str "  " offset)))))

-;; (extend-type BTSet
-;;   IPrintWithWriter
-;;   (-pr-writer [o writer _]
-;;     (dump (.-root o) writer "")))
+(extend-type BTSet
+  IPrintWithWriter
+  (-pr-writer [o writer _]
+    (dump (.-root o) writer "")))
+
+;; (def s0 (into (btset) (shuffle (range 10000))))
+;; (reduce disj s0 (shuffle (range 9995)))

 (defn test-rand []
-  (dotimes [i 100]
-    (let [xss (repeatedly (rand-int 10000) #(rand-int 10000))
-          xs  (distinct (sort xss))
-          s   (into (btset) xss)]
-      (when-not (= (vec s) xs)
-        (throw (js/Error. xss)))))
+  (dotimes [i 20]
+    (let [xs        (vec (repeatedly (rand-int 10000) #(rand-int 10000)))
+          xs-sorted (distinct (sort xs))
+          set0      (into (btset) xs)
+          rm        (repeatedly (rand-int 10000) #(rand-nth xs))
+          set1      (reduce disj set0 rm)]
+      (when-not (= (vec set0) xs-sorted)
+        (throw (js/Error. (str "conj failed on: " xs))))
+      (when-not (= (vec set1) (->> (reduce disj (into #{} xs) rm) sort))
+        (throw (js/Error. (str "disj failed on: " xs " and " rm))))
+      (println "Checking...")))
   (println "Checked")
   :ok)

@@ -327,7 +479,7 @@

 (def test-matrix [:target    { ;; "sorted-set" (sorted-set)
                                "btset"      (btset)}
-                  :distinct? [true false]
+                  ;; :distinct? [true false]
 ;;                   :size    [100 500 1000 2000 5000 10000 20000 50000]
                   :size      [100 500 20000]
                   :method    { "conj"    (fn [opts] (into (:target opts) (:range opts)))
@@ -336,7 +488,7 @@
                              }])

 (defn test-setup [opts]
-  (let [xs (if (:disticnt? opts)
+  (let [xs (if (:disticnt? opts true)
              (shuffle (range (:size opts)))
              (repeatedly (:size opts) #(rand-int (:size opts))))]
     (-> opts


adds 'true' setting for no-reply to support fire-and-forget in notification-works

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/email-works.git/'


chi square performance

chi square performance

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/clojure-ml/cml.git/'


don't keywordize nil language

don't keywordize nil language

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/voter-registration-http-api.git/'


Skip publish revision in update metdata

Skip publish revision in update metdata

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/physion/ovation-webapi.git/'


json-to-object reads into a Clojure assoc


Set max width to container and auto left/right margins

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/CommonCreative/vbn-website.git/'


Cache part of event search.

Cache part of event search.

Event locations, extension values and types are cached when searching
events. Related to #34. Tracker list can still be cached.

--- src/ruuvi_server/database/event_dao.clj
+++ src/ruuvi_server/database/event_dao.clj
@@ -1,7 +1,8 @@
 (ns ruuvi-server.database.event-dao
   (:require [ruuvi-server.configuration :as conf]
             [ruuvi-server.util :as util]
-            [clojure.string :as string])
+            [clojure.string :as string]
+            [ruuvi-server.cache :as cache])
   (:use [korma.db :only (transaction)]
         [korma.core :only (select where insert update values
                                   set-fields with limit order fields)]
@@ -44,6 +45,7 @@
                       (insert tracker (values {:tracker_code tracker-code
                                                :name (or tracker-name tracker-code)}))))))

+;; TODO needed
 (defn get-all-trackers []
   (select tracker)
   )
@@ -120,6 +122,18 @@
                  (with event-location)
                  (with event-extension-value)
                  (where {:id event_id})))
+  )
+
+(def ^{:private true} cache-event-extra-data (cache/create-cache-region :event-extra-data 10000 (* 60 60 1000)))
+
+(defn- get-event-extra-data [event-id]
+    {:event_locations (select event-location
+                              (where {:event_id event-id}))
+     :event_extension_values (select event-extension-value
+                                     (fields :value)
+                                     (with event-extension-type (fields :name))
+                                     (where {:event_id event-id}))
+     }
   )

 (defn search-events
@@ -164,13 +178,16 @@

     (if (not (empty? conditions))
       (let [results (select event
-                            (with event-location)
-                            (with event-extension-value (fields :value)
-                                  (with event-extension-type (fields :name)))
                             (where (apply and conditions))
                             (order (order-by 0) (order-by 1))
                             (limit result-limit)) ]
-        results
+
+        (map (fn [event]
+               (let [event-id (:id event)
+                     extra-data (cache/lookup cache-event-extra-data event-id
+                                              get-event-extra-data)]
+                 (merge event extra-data)
+                 )) results)
         )
       '() )))


Fix camera bug

Fix camera bug

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/chilliams/voxelminer.git/'


added exit status

added exit status

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/ananthmv/stream.git/'


[DG] Respect the 80

[DG] Respect the 80

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-notification-http-api.git/'


Add stub for pascals triangle

Add stub for pascals triangle

error: pathspec 'exercises/pascals-triangle/src/pascals_triangle.clj' did not match any file(s) known to git

--- exercises/pascals-triangle/src/pascals_triangle.clj
+++ exercises/pascals-triangle/src/pascals_triangle.clj
@@ -0,0 +1,7 @@
+(ns pascals-triangle)
+
+(def triangle)
+
+(defn row [] ;; <- Arglist goes here
+  ;; your code goes here
+  )


generate static and instance method/field access forms

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/aamedina/clojure.llvm.git/'


Making secure RNG tighter

Making secure RNG tighter

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/xcthulhu/clj-bitauth.git/'


cmd for captcha wikipedia

cmd for captcha wikipedia

error: pathspec 'examples/src/queries/captcha_wikipedia.clj' did not match any file(s) known to git

--- examples/src/queries/captcha_wikipedia.clj
+++ examples/src/queries/captcha_wikipedia.clj
@@ -0,0 +1,42 @@
+(ns queries.captcha-wikipedia
+  (:require [anglican.runtime :refer :all]
+            [anglican.emit :refer [defquery with-primitive-procedures]]
+            anglican.csis.csis
+            [helpers.captcha :refer [levenshtein-normalized]]
+            [helpers.captcha-wikipedia :refer [render render-to-file abc-dist abc-sigma letter-dict oxCaptcha]]
+            [clojure.core.matrix :as m]))
+
+;; QUERY
+(with-primitive-procedures [render abc-dist repeatedly]
+  (defquery captcha-wikipedia [baseline-image]
+    (let [;; Number of letters in CAPTCHA
+          num-letters (sample "numletters" (uniform-discrete 8 11))
+          font-size (sample "fontsize" (uniform-discrete 26 32))
+          kerning (sample "kerning" (uniform-discrete 1 3))
+          letter-ids (repeatedly num-letters #(sample "letterid" (uniform-discrete 0 (count letter-dict))))
+          letters (apply str (map (partial nth letter-dict) letter-ids))
+
+          ;; Render image using renderer from ...
+          rendered-image (render letters font-size kerning)]
+
+      ;; ABC observe
+      (observe (abc-dist rendered-image abc-sigma) baseline-image)
+
+      ;; Returns
+      {:letters letters
+       :font-size font-size
+       :kerning kerning})))
+
+;; COMPILE stuff
+(defn COMPILE-combine-observes-fn [observes]
+  (:value (first observes)))
+
+(def COMPILE-query-args [nil])
+
+;; INFER stuff
+(def directory (clojure.java.io/file "resources/wikipedia-dataset"))
+(def files (take 100 (rest (file-seq directory))))
+(def num-observes (count files))
+(def observes (doall (map vec (map (fn [f] (map vec (.load oxCaptcha (.getPath f)))) files))))
+
+(def INFER-query-args [(first observes)])


Adding documentation about hook

Adding documentation about hook

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/B2W-Digital/pdg-core.git/'


Added useful events functions

Added useful events functions

error: pathspec 'src/cljs/junto_labs/learn_specter/events.cljs' did not match any file(s) known to git

--- src/cljs/junto_labs/learn_specter/events.cljs
+++ src/cljs/junto_labs/learn_specter/events.cljs
@@ -0,0 +1,20 @@
+(ns junto-labs.learn-specter.events)
+
+(def ev #(-> % .-target .-value))
+
+(def num->key
+  {8  :backspace
+   32 :space
+   13 :enter
+   38 :up
+   40 :down
+   37 :left
+   39 :right})
+
+(defn e->key
+  "Gets the key from a key event."
+  {:possible-output `{:key :enter, :modifiers #{:alt}}}
+  [e]
+  (let [n (or (.-keyCode e) (.-which e))]
+    {:key (get num->key n n)
+     :modifiers (disj (hash-set (when (.-altKey e) :alt)) nil)}))


Removed annoying strs

Removed annoying strs

--- src/clj/freefrog/lang.clj
+++ src/clj/freefrog/lang.clj
@@ -61,7 +61,8 @@

 (defn apply-collection-update [circle name update-type op]
   (let [component (first op)
-        function-name (str update-type "-role-" (update-conversions component))
+        function-name (format "%s-role-%s"
+                              update-type (update-conversions component))
         fn (resolve (symbol "freefrog.governance" function-name))]
     (reduce #(fn %1 name %2) circle (rest op))))

@@ -95,13 +96,14 @@
 (defn execute-governance-function [record fn circle params]
   (try (fn circle params)
        (catch Exception e
-         (throw (RuntimeException.
-                  (str "Unable to execute governance record " record) e)))))
+         (throw
+           (RuntimeException.
+             (format "Unable to execute governance record: %s " record) e)))))

 (defn modify-entity [circle record function-primary]
   (let [function-secondary (first (second record))
-        function-name (str (name function-primary) "-"
-                           (name function-secondary))
+        function-name (format "%s-%s"
+                              (name function-primary) (name function-secondary))
         fn (resolve (symbol "freefrog.lang" function-name))
         entity-name (nth record 2)
         params (->> record


Extending

Extending

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/yokalona/threen.git/'


Fix #82 Use localhost address if possible

--- Clojure/src/ambly/repl/jsc.clj
+++ Clojure/src/ambly/repl/jsc.clj
@@ -11,7 +11,7 @@
            java.lang.StringBuilder
            [java.io File BufferedReader BufferedWriter IOException]
            (javax.jmdns JmDNS ServiceListener)
-           (java.net URI)))
+           (java.net URI InetAddress NetworkInterface Inet4Address)))

 (defn sh
   "Executes a shell process. Allows up to timeout to complete, returning process
@@ -292,6 +292,22 @@
   {:pre [(or (string? path) (instance? File path))]}
   (form-ambly-import-script-expr-js (str "'" path "'")))

+(defn- local-address-if
+  "Takes an IP address and returns the localhost address if the
+  address happens to be local to this machine."
+  [ip-address]
+  {:pre [(string? ip-address)]
+   :post [(string? %)]}
+  (try
+    (let [inet-address (InetAddress/getByName ip-address)]
+      (if (NetworkInterface/getByInetAddress inet-address)
+        (if (instance? Inet4Address inet-address)
+          "127.0.0.1"
+          "::1")
+        ip-address))
+    (catch Throwable _
+      ip-address)))
+
 (defn- umount-webdav
   "Unmounts WebDAV, returning true upon success."
   [webdav-mount-point]
@@ -347,7 +363,7 @@
   (try
     (let [_ (set-logging-level "javax.jmdns" java.util.logging.Level/OFF)
           [bonjour-name endpoint] (discover-and-choose-device (:choose-first-discovered (:options repl-env)) opts)
-          endpoint-address (.getHostAddress (:address endpoint))
+          endpoint-address (local-address-if (.getHostAddress (:address endpoint)))
           endpoint-port (:port endpoint)
           _ (reset! (:bonjour-name repl-env) bonjour-name)
           webdav-mount-point (mount-webdav repl-env bonjour-name endpoint-address endpoint-port)


no db in import-fhir ns

no db in import-fhir ns

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/fhirbase/fhirterm.git/'


Initial commit of test for word count example topology

error: pathspec 'test/marceline/storm/testing/trident_wordcount_test.clj' did not match any file(s) known to git

--- test/marceline/storm/testing/trident_wordcount_test.clj
+++ test/marceline/storm/testing/trident_wordcount_test.clj
@@ -0,0 +1,34 @@
+(ns marceline.storm.testing.trident-wordcount-test
+  (:import [storm.trident.testing
+            MemoryMapState$Factory
+            FixedBatchSpout])
+  (:require [backtype.storm.testing :as t]
+            [marceline.storm.trident :as marceline])
+  (:use clojure.test
+        clojure.pprint
+        [backtype.storm clojure config]
+        storm.trident.testing
+        marceline.storm.testing.trident-wordcount))
+
+(defn- mk-spout []
+  (FixedBatchSpout.
+    (marceline/fields "sentence")
+    4
+    (into-array (map marceline/values '("the cow jumped over the moon"
+                                        "four score and seven years ago"
+                                        "how many can you eat"
+                                        "to be or not to be the person")))))
+
+(deftest wordcount-drpc
+  (t/with-local-cluster [cluster]
+    (with-drpc [drpc]
+      (let [spout (doto (mk-spout)
+                    (.setCycle false))
+            topology (build-topology spout drpc)]
+        (with-topology [cluster topology]
+          (Thread/sleep 3000)
+          (is (= 4
+                 (ffirst
+                   (exec-drpc drpc "words"
+                              "cat dog the man jumped"))))
+          )))))


Provide spout api

Provide spout api

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/Zintinio/Breeze.git/'


Compact booleans into a single byte

Compact booleans into a single byte

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/leif47/immutabledb-experimental.git/'


Use dev config

Use dev config

--- dev/src/dev.clj
+++ dev/src/dev.clj
@@ -21,7 +21,7 @@
   "Create a development system"
   []
   (s/with-fn-validation
-    (-> (config :local)
+    (-> (config :dev)
         (new-system-map)
         (component/system-using (new-dependency-map))
         (co-dependency/system-co-using (new-co-dependency-map)))))


added api/version to the links

added api/version to the links


Reformat everything

Reformat everything

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/kkroening/jackal.git/'


added dev middleware

added dev middleware

error: pathspec 'src/selmer/middleware.clj' did not match any file(s) known to git

--- src/selmer/middleware.clj
+++ src/selmer/middleware.clj
@@ -0,0 +1,17 @@
+(ns selmer.middleware
+  (:require [selmer.parser :as parser]))
+
+(defn template-error-page
+  "development middleware for rendering a friendly error page when a parsing error occurs"
+  [handler dev?]
+  (if dev?
+    (fn [request]
+      (try
+        (handler request)
+        (catch clojure.lang.ExceptionInfo ex
+          (let [{:keys [type error-template] :as data} (ex-data ex)]
+            (if (= :selmer-validation-error type)
+              {:status 500
+               :body (parser/render error-template data)}
+              (throw ex))))))
+    handler))


Add missing util ns.

Add missing util ns.

error: pathspec 'src/uxbox/msgbus/util.clj' did not match any file(s) known to git

--- src/uxbox/msgbus/util.clj
+++ src/uxbox/msgbus/util.clj
@@ -0,0 +1,11 @@
+(ns uxbox.msgbus.util
+  (:import java.util.UUID))
+
+(defn interrumpted?
+  []
+  (.isInterrupted (Thread/currentThread)))
+
+(defn message-id
+  [msg]
+  (str (UUID/randomUUID)))
+


Day 11

Day 11

error: pathspec 'src/advent_2018/day_11.cljc' did not match any file(s) known to git

--- src/advent_2018/day_11.cljc
+++ src/advent_2018/day_11.cljc
@@ -0,0 +1,53 @@
+(ns advent-2018.day-11
+  (:require
+   [clojure.string :as string]))
+
+(def input 8868)
+
+(defn max-by [f xs]
+  (let [[ndx max] (reduce-kv (fn [[ndx max] k v]
+                               (if (> (f v) (f max))
+                                 [k v]
+                                 [ndx max]))
+                    [-1 (nth xs 0)]
+                    (vec (rest xs)))]
+    [(+ ndx 2) max]))
+
+(defn hundreds-digit [x]
+  (mod (quot x 100) 10))
+
+(defn power-level [serial-number x y]
+  (let [rack-id (+ x 10)]
+    (-> rack-id
+      (* y)
+      (+ serial-number)
+      (* rack-id)
+      hundreds-digit
+      (- 5))))
+
+(defn power-levels [serial-number]
+  (for [y (range 1 301)]
+    (for [x (range 1 301)]
+      (power-level serial-number x y))))
+
+(defn solve [power-levels square-size]
+  (let [[y [x m]] (->> power-levels
+                    (partition square-size 1)
+                    (map #(->> %
+                            (apply map +)
+                            (partition square-size 1)
+                            (map (partial apply +))
+                            (max-by identity)))
+                    (max-by second))]
+    [m x y]))
+
+(defn part-1 []
+  (string/join "," (rest (solve (power-levels input) 3))))
+
+(def pmap' #?(:clj pmap :cljs map))
+
+(defn part-2 []
+  (let [[ndx [_ x y]] (->> (range 1 301)
+                        (pmap' (partial solve (power-levels input)))
+                        (max-by first))]
+    (string/join "," [x y ndx])))


implement payments and delete! resolvers

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/starcity-properties/odin.git/'


update team signers

update team signers

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-notification-works.git/'


adding config... doh

adding config... doh

error: pathspec 'config.clj' did not match any file(s) known to git


at list we get the correct list

at list we get the correct list

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/carolove/clojure-ring-app.git/'


data viz integration snippets

data viz integration snippets

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/encho/vvento4.git/'


Add tests over oxcart.util/*

Add tests over oxcart.util/*

error: pathspec 'test/oxcart/util_test.clj' did not match any file(s) known to git

--- test/oxcart/util_test.clj
+++ test/oxcart/util_test.clj
@@ -0,0 +1,30 @@
+(ns oxcart.util-test
+  (:require [oxcart.util :refer :all]
+            [clojure.test :refer :all]))
+
+
+(deftest take-when-test
+  (is (= [1 [2 3]]
+         (take-when (constantly true)
+                    [1 2 3])))
+
+  (is (= [nil [1 2 3]]
+         (take-when (constantly false)
+                    [1 2 3]))))
+
+
+(deftest map-vals-test
+  (is (= {:a 2}
+         (map-vals {:a 1} inc))))
+
+
+(deftest fix-test
+  (is (= 2
+         (fix #(mod %1 3) 5)))
+
+  (is (= 1
+         (fix (fn [x]
+                (if (>= x 2)
+                  (/ x 2)
+                  x))
+              1024))))


Forgot to add counters namespace

Forgot to add counters namespace

error: pathspec 'src/cljs/chocolatier/engine/utils/counters.cljs' did not match any file(s) known to git

--- src/cljs/chocolatier/engine/utils/counters.cljs
+++ src/cljs/chocolatier/engine/utils/counters.cljs
@@ -0,0 +1,22 @@
+(ns chocolatier.engine.utils.counters)
+
+
+(defn mk-cooldown [limit]
+  {:counter 0 :limit limit})
+
+(defn cooldown?
+  "Takes a cooldown hashmap and returns a boolean if it is in cooldown"
+  [{:keys [counter limit]}]
+  (when (and counter limit)
+    (zero? counter)))
+
+(defn tick-cooldown
+  "Increments counter of the cooldown and returns a pair of updated
+   cooldown and boolean of whether it's still in cooldown. Resets
+   counter to 0 if cooldown counter exceeds the limit. Cooldown is not
+   in progress only if the counter is 0."
+  [{:keys [counter limit] :as cooldown}]
+  (cond
+    (zero? counter) [(update cooldown :counter inc) false]
+    (> (inc counter) limit) [(assoc cooldown :counter 0) true]
+    :else [(update cooldown :counter inc) true]))


Put back the printing so we can eyeball the test results.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/couragelabs/freefrog.git/'


new tile-cache ns handles all reading and writing in memory and on disk

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@9735 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

error: pathspec 'plugins/SlideExplorer2/src/slide_explorer/tile_cache.clj' did not match any file(s) known to git

--- plugins/SlideExplorer2/src/slide_explorer/tile_cache.clj
+++ plugins/SlideExplorer2/src/slide_explorer/tile_cache.clj
@@ -0,0 +1,41 @@
+(ns slide-explorer.tile-cache
+  (:use [slide-explorer.cache :as cache]
+        [slide-explorer.disk :as disk]
+        [slide-explorer.reactive :as reactive]))
+
+(def file-executor (reactive/single-threaded-executor))
+
+(defn tile-dir [memory-tile-atom]
+  (:slide-explorer.main/directory (meta memory-tile-atom)))
+
+(defn add-tile
+  "Adds a tile to the atom in memory and saves a .tif image to the associated directory."
+  [memory-tile-atom key image-processor]
+  (swap! memory-tile-atom cache/add-item key image-processor)
+  (when-let [dir (tile-dir memory-tile-atom)]
+    (.submit file-executor #(disk/write-tile dir key image-processor))))
+
+(defn load-tile
+  [memory-tile-atom key]
+  "Loads the tile into memory-tile-atom, if tile is not already present."
+  (reactive/submit file-executor
+                   (fn []
+                     (or ;(println "loading tile")
+                         (get @memory-tile-atom key)
+                         ;(println "key not found")
+                         (when-let [tile (disk/read-tile (tile-dir memory-tile-atom) key)]
+                           (swap! memory-tile-atom
+                                  #(if-not (get % key)
+                                     (cache/add-item % key tile)
+                                     %))
+                           tile)))))
+
+(defn get-tile
+  [memory-tile-atom key]
+  (swap! memory-tile-atom cache/hit-item key)
+  (get @memory-tile-atom key))
+
+(defn unload-tile
+  [memory-tile-atom key]
+  ;(println "unloading")
+  (swap! memory-tile-atom dissoc key))


Start aligning the response formats from the movements resource.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/cstorey/nrod.git/'


Trivial: fix Hawking's first name

Trivial: fix Hawking's first name

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/croeder/clojure-koans-work.git/'


Move common middleware to a separate namespace.

error: pathspec 'src/lib/clj/one/middleware.clj' did not match any file(s) known to git

--- src/lib/clj/one/middleware.clj
+++ src/lib/clj/one/middleware.clj
@@ -0,0 +1,56 @@
+(ns one.middleware
+  (:use [one.templates :only (render)]
+        [one.core :only (*configuration*)])
+  (:require [net.cgrand.enlive-html :as html])
+  (:import java.io.File))
+
+(defn js-encoding [handler]
+  (fn [request]
+    (let [{:keys [headers body] :as response} (handler request)]
+      (if (and (= (get headers "Content-Type") "text/javascript")
+               (= (type body) File))
+        (assoc-in response [:headers "Content-Type"]
+                  "text/javascript; charset=utf-8")
+        response))))
+
+(defn rewrite-design-uris [handler]
+  (fn [{:keys [uri] :as request}]
+    (if (some true? (map #(.startsWith uri (str "/design/" %))
+                         ["css" "javascripts" "images" "js" "favicon.ico"]))
+      (handler (assoc request :uri (.substring uri 7)))
+      (handler request))))
+
+;; We need to use this instead of Enlive's html-snippet, because
+;; html-snippet throws away the doctype
+(defn- html-parse
+  "Parse a string into a seq of Enlive nodes."
+  [s]
+  (html/html-resource (java.io.StringReader. s)))
+
+(defn active-menu-transform
+  "Accepts the selected menu (a keyword) and the response and returns
+  an updated response body with the correct menu activated."
+  [menu response]
+  (assoc response
+    :body (render (html/transform (html-parse (:body response))
+                                  [:ul#navigation (keyword (str "li." (name menu)))]
+                                  (html/add-class "active")))))
+
+(defn set-active-menu
+  "Middleware which will highlight the current active menu item."
+  [handler]
+  (fn [request]
+    (let [response (handler request)
+          uri (:uri request)]
+      (cond (= uri "/") (active-menu-transform :home response)
+            (and (.startsWith uri "/design") (.endsWith uri ".html")) (active-menu-transform :design response)
+            (= uri "/development") (active-menu-transform :development response)
+            (= uri "/production") (active-menu-transform :production response)
+            :else response))))
+
+(defn wrap-config
+  "Wrap a request in a binding."
+  [handler c]
+  (fn [request]
+    (binding [*configuration* c]
+      (handler request))))


Version 0.6.4-SNAPSHOT

Version 0.6.4-SNAPSHOT

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject sablono "0.6.3"
+(defproject sablono "0.6.4-SNAPSHOT"
   :description "Lisp style templating for Facebook's React."
   :url "http://github.com/r0man/sablono"
   :author "r0man"


Version 1.8.0-SNAPSHOT

Version 1.8.0-SNAPSHOT


Bumped lein-figwheel and luminus-migrations

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/robottokauf3/cia.git/'


Proiektua deskribatu

Proiektua deskribatu

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/lnmnd/magnet.bez.git/'


project.clj is ready for figwheel. Figwheel now takes a ring handler from the core server and starts that server on port 3449. So no dummy server, yey. Bhauman <3 you. Lein ring server also works. All that remaining is develop our product.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/tahmidsadik112/immutant-reagent-template.git/'


fixes CVE-2017-17485, CVE-2018-7489, CVE-2018-5968 found by nvd

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/Yleisradio/rabid.git/'


Update deps

Update deps

...including datomic to 0.9.5394

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-mail-works.git/'


disable pomegranate, not needed currently

--- project.clj
+++ project.clj
@@ -42,7 +42,7 @@

                  ;; remote repl
                  [org.clojure/tools.nrepl "0.2.0-RC1"]
-                 [com.cemerick/pomegranate "0.0.13"]
+                 ;;[com.cemerick/pomegranate "0.0.13"]

                  ;; misc
                  [clj-time "0.4.4"]


removed unnecessary deps

removed unnecessary deps

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/Zallin/fhirvc.git/'


Version 0.3.6

Version 0.3.6

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject sablono "0.3.6-SNAPSHOT"
+(defproject sablono "0.3.6"
   :description "Lisp style templating for Facebook's React."
   :url "http://github.com/r0man/sablono"
   :author "r0man"


Created another tmp rule for testing

Created another tmp rule for testing

error: pathspec 'resources/rules/pre_identifier_merge/post_ice_rdf_load/tmp/refseq_mrna_identifier_typing.clj' did not match any file(s) known to git

--- resources/rules/pre_identifier_merge/post_ice_rdf_load/tmp/refseq_mrna_identifier_typing.clj
+++ resources/rules/pre_identifier_merge/post_ice_rdf_load/tmp/refseq_mrna_identifier_typing.clj
@@ -0,0 +1,21 @@
+;; -------------------------------------------------------
+;; --------- refseq mRNA identifier typing ---------------
+;; -------------------------------------------------------
+`{:name          "refseq-genomic-identifier-typing"
+  :description   "This rule specifically the basic formal ontology identifier"
+  :head          ((?/refseq_identifier rdf/type ccp/IAO_EXT_0001642)) ; CCP:refseq_mrna_identifier
+  :reify ()
+  :sparql-string "prefix obo: <http://purl.obolibrary.org/obo/>
+                  prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+                  prefix ccp: <http://ccp.ucdenver.edu/obo/ext/>
+                  select ?refseq_identifier {
+                     ?record rdf:type ccp:IAO_EXT_0000792 . # CCP:refseq_catalog_record
+                     ?record obo:BFO_0000051 ?molecule_type_field_value .
+                     ?molecule_type_field_value rdf:type ccp:IAO_EXT_0000805 . # CCP:refseq_catalog_record_molecule_type_field_value
+                     ?molecule_type_field_value rdfs:label 'mRNA'@en .
+                     ?record obo:BFO_0000051 ?refseq_identifier_field_value .
+                     ?refseq_identifier_field_value rdf:type ccp:IAO_EXT_0000800 . # CCP:refseq_catalog_record_refseq_identifier_field_value
+                     ?refseq_identifier_field_value rdf:type ?refseq_identifier .
+                     ?refseq_identifier rdfs:subClassOf ccp:IAO_EXT_0000263 . # CCP:refseq_identifier
+                   }"
+  }


Changed url and description.

Changed url and description.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/inchingforward/clojurians.git/'


Small updates in project.clj.

Small updates in project.clj.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/screen6/cascading.redis.git/'


Version 0.3.6-SNAPSHOT

Version 0.3.6-SNAPSHOT

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject sablono "0.3.5"
+(defproject sablono "0.3.6-SNAPSHOT"
   :description "Lisp style templating for Facebook's React."
   :url "http://github.com/r0man/sablono"
   :author "r0man"


bump version to 3.5.7

bump version to 3.5.7

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/B2W-Digital/pdg-core.git/'


adding project.clj to get dependencies

adding project.clj to get dependencies

error: pathspec 'project.clj' did not match any file(s) known to git

--- project.clj
+++ project.clj
@@ -0,0 +1,15 @@
+(defproject backtype/dfs-datastores-cascading "1.0.4"
+  :java-source-path "src/jvm"
+  :javac-options {:debug "true" :fork "true"}
+  :repositories {
+                 "conjars" "http://conjars.org/repo"
+                 }
+
+  :dependencies [
+                 [backtype/dfs-datastores "1.0.3"]
+                 [cascading/cascading-core "1.2-wip-63" :exclusions [org.codehaus.janino/janino]]
+                 ]
+  :dev-dependencies [
+                     [org.apache.hadoop/hadoop-core "0.20.2-dev"]
+                     [junit/junit "3.8.2"]
+                    ])


oops.  wrong column name.

oops.  wrong column name.

--- src/metabase/api/card.clj
+++ src/metabase/api/card.clj
@@ -40,7 +40,7 @@
     (checkp (integer? id) "id" (format "id is required parameter when filter mode is '%s'" (name f)))
     (case f
       :database (read-check Database id)
-      :table    (read-check Database (:db_id (sel :one :fields [Table :database_id])))))
+      :table    (read-check Database (:db_id (sel :one :fields [Table :db_id])))))
   (-> (case (or f :all) ; default value for `f` is `:all`
         :all      (sel :many Card (k/order :name :ASC) (k/where (or {:creator_id *current-user-id*}
                                                                     {:public_perms [> common/perms-none]})))


websocket async channel

websocket async channel

error: pathspec 'src/ontrail/websocket.clj' did not match any file(s) known to git

--- src/ontrail/websocket.clj
+++ src/ontrail/websocket.clj
@@ -0,0 +1,24 @@
+(ns ontrail.websocket
+  (:use lamina.core
+        aleph.http
+        compojure.core)
+  (:import [java.lang IllegalStateException]))
+
+
+(defn chat-init [ch]
+  (receive-all ch #(println "message: " %)))
+
+(def message-channel (named-channel "messages" chat-init))
+
+(defn chat-handler [ch]
+  (siphon ch message-channel)
+  (siphon message-channel ch))
+
+(defn chat [ch request]
+  (if (:websocket request)
+    (chat-handler ch)
+    (throw (IllegalStateException. "not reached"))))
+
+(defroutes async
+  (GET "/rest/v1/async" {}
+       (wrap-aleph-handler chat)))


condense ring middleware

condense ring middleware

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/vincentstorme/clojureme.git/'


[EN] Update testing strings.

[EN] Update testing strings.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-authority-works.git/'


[TH] pulling close! out of bindings

[TH] pulling close! out of bindings

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/voter-registration-works.git/'


Gather the symbols

Gather the symbols

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/kkroening/jackal.git/'


Diningfuture

Diningfuture

error: pathspec 'Code/DiningPhilosophers/src/main/clojure/diningfuture.clj' did not match any file(s) known to git

--- Code/DiningPhilosophers/src/main/clojure/diningfuture.clj
+++ Code/DiningPhilosophers/src/main/clojure/diningfuture.clj
@@ -0,0 +1,74 @@
+(ns dining
+  (:import (java.util.concurrent TimeUnit)
+           (com.google.common.base Stopwatch))
+  (:gen-class))
+
+(def rounds (ref 200)) ;ref due to being a shared resource
+(def philosophers (doall (map #(agent %) (repeat 5 0)))) ;agents due to being uncoordinated async
+(def forks (doall (map #(ref [% true]) (range (count philosophers))))) ;ref due to being a shared resource
+(def logger (agent 0))
+(def stopwatch (. Stopwatch (createStarted)))
+
+(def fork1 (ref true))
+(def fork2 (ref true))
+(def fork3 (ref true))
+(def fork4 (ref true))
+(def fork5 (ref true))
+
+(defn debug [_ id msg r]
+  (println id \space msg "(" r ")")
+  (flush))
+
+(defn print-stopwatch [_ time]
+  (println time)
+  (shutdown-agents))
+
+
+(defn my-forks [id]
+  (map #(nth (cycle forks) (+ (count forks) %)) [id (dec id)]))
+
+(defn got-forks? [id]
+  (every? #(= true (second (deref %))) (my-forks id)))
+
+(defn handle-forks [id action]
+  (doseq [fork (my-forks id)]
+    (ref-set fork [(first @fork) (condp = action :take false :release true)])))
+
+(defn more-food? []
+  (if (pos? (ensure rounds))
+    true
+    (do
+      (. stopwatch (stop))
+      (send logger print-stopwatch (. stopwatch (elapsed (. TimeUnit MILLISECONDS))))
+      false)))
+
+(defn behave [id left right]
+  (loop []
+    (dosync (more-food?))
+    (dosync ; Initiate transaction
+        (when (and @left @right) ; Are both of my forks available?
+          (do
+            (ref-set left false)
+            (ref-set right false)
+            (Thread/sleep 100)
+            ;(handle-forks id :take)
+            (commute rounds dec)
+            (send-off logger debug id "ate      " @rounds)
+            ;(handle-forks id :release)
+            (ref-set left true)
+            (ref-set right true))
+          ))
+    (Thread/sleep 100)
+    (recur))) ; Repeat above
+
+(defn start []
+  (do
+    (future (behave 0 fork1 fork2))
+    (future (behave 1 fork2 fork3))
+    (future (behave 2 fork3 fork4))
+    (future (behave 3 fork4 fork5))
+    (future (behave 4 fork5 fork1))))
+
+
+(defn -main [& args]
+  (start))


test fix

test fix

--- test/metabase/api/common/internal_test.clj
+++ test/metabase/api/common/internal_test.clj
@@ -1,5 +1,6 @@
 (ns metabase.api.common.internal-test
   (:require [expectations :refer :all]
+            [medley.core :as medley]
             (metabase.api.common [internal :refer :all])))

 ;;; TESTS FOR ROUTE-FN-NAME
@@ -32,18 +33,19 @@
 ;;; TESTS FOR ROUTE-PARAM-REGEX

 ;; expectations (internally, `clojure.data/diff`) doesn't think two regexes with the same exact pattern are equal.
-;; so in order to make sure we're getting back the right output we'll just change them to strings, e.g. `#"[0-9]+ -> "#[0-9]+"`
+;; so in order to make sure we're getting back the right output we'll just change them to strings, e.g. `#"^[0-9]+$" -> "#^[0-9]+$"`
 (defmacro no-regex [& body]
-  `(binding [*auto-parse-types* (update-in *auto-parse-types* [:int :route-param-regex] (partial str "#"))]
+  `(binding [*auto-parse-types* (medley/map-vals #(medley/update % :route-param-regex (partial str "#"))
+                                                 *auto-parse-types*) ]
      ~@body))

 (expect nil
   (no-regex (route-param-regex :fish)))

-(expect [:id "#[0-9]+"]
+(expect [:id "#^[0-9]+$"]
   (no-regex (route-param-regex :id)))

-(expect [:card-id "#[0-9]+"]
+(expect [:card-id "#^[0-9]+$"]
   (no-regex (route-param-regex :card-id)))

@@ -76,13 +78,13 @@
 (expect []
   (no-regex (typify-args [:fish :fry])))

-(expect [:id "#[0-9]+"]
+(expect [:id "#^[0-9]+$"]
   (no-regex (typify-args [:id])))

-(expect [:id "#[0-9]+"]
+(expect [:id "#^[0-9]+$"]
   (no-regex (typify-args [:id :fish])))

-(expect [:id "#[0-9]+" :card-id "#[0-9]+"]
+(expect [:id "#^[0-9]+$" :card-id "#^[0-9]+$"]
   (no-regex (typify-args [:id :card-id])))

@@ -91,24 +93,28 @@
 (expect "/"
   (no-regex (typify-route "/")))

-(expect ["/:id" :id "#[0-9]+"]
+(expect ["/:id" :id "#^[0-9]+$"]
   (no-regex (typify-route "/:id")))

-(expect ["/:id/card" :id "#[0-9]+"]
+(expect ["/:id/card" :id "#^[0-9]+$"]
   (no-regex (typify-route "/:id/card")))

-(expect ["/:card-id" :card-id "#[0-9]+"]
+(expect ["/:card-id" :card-id "#^[0-9]+$"]
   (no-regex (typify-route "/:card-id")))

 (expect "/:fish"
   (no-regex (typify-route "/:fish")))

-(expect ["/:id/tables/:card-id" :id "#[0-9]+" :card-id "#[0-9]+"]
+(expect ["/:id/tables/:card-id" :id "#^[0-9]+$" :card-id "#^[0-9]+$"]
   (no-regex (typify-route "/:id/tables/:card-id")))

 ;; don't try to typify route that's already typified
-(expect ["/:id/:crazy-id" :crazy-id "#[0-9]+"]
-  (no-regex (typify-route ["/:id/:crazy-id" :crazy-id "#[0-9]+"])))
+(expect ["/:id/:crazy-id" :crazy-id "#^[0-9]+$"]
+  (no-regex (typify-route ["/:id/:crazy-id" :crazy-id "#^[0-9]+$"])))
+
+;; Check :uuid args
+(expect ["/:uuid/toucans" :uuid "#^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"]
+  (no-regex (typify-route "/:uuid/toucans")))

 ;; TESTS FOR LET-FORM-FOR-ARG


I forgot to add test code..

I forgot to add test code..

error: pathspec 'test/misaki/test/post.clj' did not match any file(s) known to git

--- test/misaki/test/post.clj
+++ test/misaki/test/post.clj
@@ -0,0 +1,16 @@
+(ns misaki.test.post
+  (:use [misaki core config]
+        [hiccup.core :only [html]]
+        misaki.test.common
+        clojure.test))
+
+(deftest* get-posts-test
+  (let [posts (get-posts)]
+    (are [x y] (= x y)
+      1 (count posts)
+      "foo" (-> posts first :title)
+      "/2011/01/foo.html" (-> posts first :url)
+      false (nil? (-> posts first :file))
+      false (nil? (-> posts first :date))
+      false (nil? (-> posts first :lazy-content))
+      "world" (-> posts first :hello))))


Note.

Note.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/mtravers/incidents.git/'


Distill word count kata

Distill word count kata

error: pathspec 'src/shokunin/word.clj' did not match any file(s) known to git

--- src/shokunin/word.clj
+++ src/shokunin/word.clj
@@ -0,0 +1,22 @@
+(ns shokunin.words
+  (:require [clojure.string :refer [lower-case split-lines]]))
+
+
+(defn term-frequency
+  "Count occurrences of terms in a file."
+  [file stop-set]
+  (with-open [rdr (clojure.java.io/reader file)]
+    (let [tokenize (partial re-seq #"(?:\w[\w\-\']+)")
+          non-stop (partial remove stop-set)
+          parse    (comp frequencies non-stop tokenize lower-case)
+          tally    (map parse (line-seq rdr))
+          adder    (partial merge-with +)]
+      (reduce adder tally))))
+
+
+(def stop-set (-> "resources/01/stop.txt" slurp split-lines set))
+(def freq-map (term-frequency "resources/01/declaration.txt" stop-set))
+
+
+(take 10 (sort-by last > freq-map))
+(take 10 (sort-by first compare freq-map))


Add in utility functions.

Add in utility functions.

error: pathspec 'src/smallex/utils.clj' did not match any file(s) known to git

--- src/smallex/utils.clj
+++ src/smallex/utils.clj
@@ -0,0 +1,54 @@
+(ns smallex.utils
+  (:require [clojure.io :as io]
+            [clojure.java.io :as io])
+  (:import (java.io IOException)))
+
+(def root-dir (System/getProperty "user.dir"))
+(def ^:dynamic *cwd* root-dir)
+
+(defn file
+  "Returns a file, relative to the current working directory (*cwd*)."
+  [fname]
+  (io/file *cwd* fname))
+
+(defn smallex-version []
+  (with-open [reader (-> "META-INF/maven/smallex/smallex/pom.properties"
+                         io/resource
+                         io/reader)]
+    (-> (doto (java.util.Properties.)
+          (.load reader))
+        (.getProperty "version"))))
+
+(defn user-agent []
+  (format "Smallex %s (Java %s; %s %s; %s)"
+          (smallex-version) (System/getProperty "java.vm.name")
+          (System/getProperty "os.name") (System/getProperty "os.version")
+          (System/getProperty "os.arch")))
+
+(defn- some-io*
+  "Returns a partially applied function, which returns nil if the single-arity
+  function f throws an IOException."
+  [f]
+  (fn [fname]
+    (try
+      (f fname)
+      (catch (IOException ioe) nil))))
+
+(def
+  ^{:arglists '([fname])
+    :doc "Return the writer returned by calling
+  (clojure.io/writer (utils/file fname)), or nil if the call throws an
+  IOException"}
+  some-writer
+  (some-io* (comp io/writer file)))
+
+(def
+  ^{:arglists '([fname])
+    :doc "Return the writer returned by calling
+  (clojure.io/reader (utils/file fname)), or nil if the call throws an
+  IOException"}
+  some-reader
+  (some-io* (comp io/reader file)))
+
+(defn supported-lang? [lang]
+  false)


lein-elastic-beanstalk plugin

lein-elastic-beanstalk plugin

It allows us to specify the stack-name

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/physion/ovation-webapi.git/'


[WM] bump pedestal-toolbox dep to 0.6.1-SNAPSHOT

We need Transit response support in here.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/user-http-api.git/'


bump cljs dep

bump cljs dep

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/michaelsbradleyjr/ply.git/'


chore(core): update to version 2.6.1-SNAPSHOT

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/B2W-BIT/restQL-server.git/'


bump version and core version to 3.5.2

bump version and core version to 3.5.2


Use the AffineTransform for Y-coordinates too.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/cstorey/nrod.git/'


[DG] Fix tests

[DG] Fix tests

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-notification-http-api.git/'


update ->election to use just the language rather than the language-map

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-notification-works.git/'


Clojure 1.5.0

Clojure 1.5.0

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/michaelsbradleyjr/shen.clj.git/'


bump blueprints

bump blueprints

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/starcity-properties/odin.git/'


Version 0.7.1

Version 0.7.1

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject sablono "0.7.1-SNAPSHOT"
+(defproject sablono "0.7.1"
   :description "Lisp style templating for Facebook's React."
   :url "http://github.com/r0man/sablono"
   :author "r0man"


fix version to pom 2.0.4

fix version to pom 2.0.4

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/mprokopov/privat24-manager.git/'


Begin work on next patch iteration.

Begin work on next patch iteration.

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject com.damballa/abracad "0.4.0"
+(defproject com.damballa/abracad "0.4.1-SNAPSHOT"
   :description "De/serialize Clojure data structures with Avro."
   :url "http://github.com/damballa/abracad"
   :licenses [{:name "Eclipse Public License"


Rejig project.clj for Heroku

Rejig project.clj for Heroku

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/pletcher/mission-hacks.git/'


Resolving deps conflicts.

Resolving deps conflicts.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/B2W-Digital/pdg-core.git/'


Bump nsfw

Bump nsfw

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/zk/rx.git/'


Version 91

Version 91

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/tobias/clojars-web.git/'


Update deps & clojure to latest versions

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/voter-registration-works.git/'


Update deps

Update deps

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-mail-works.git/'


Version 0.3.0-beta4

Version 0.3.0-beta4

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject lein-droid/lein-droid "0.3.0-beta3"
+(defproject lein-droid/lein-droid "0.3.0-beta4"
   :description "Plugin for easy Clojure/Android development and deployment"
   :url "https://github.com/clojure-android/lein-droid"
   :license {:name "Eclipse Public License"


Prepare release

Prepare release

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/tobiasbayer/eureka-client.git/'


rm comment

rm comment


latest clojure

latest clojure


lein-release plugin: preparing 0.2.3 release

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject sablono "0.2.3-SNAPSHOT"
+(defproject sablono "0.2.3"
   :description "Lisp style templating for Facebook's React."
   :url "http://github.com/r0man/sablono"
   :author "Roman Scherer"


Update deps

Update deps

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/scheduled-message-works.git/'


bump version to 3.7.2 and core version to 3.7.0


Remove hac client

Remove hac client

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/terrancesnyder/engulf.git/'


Change CI profile "jenkins" => "ci"

Change CI profile "jenkins" => "ci"

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/physion/ovation-webapi.git/'


draw the patch objects

draw the patch objects

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/jeelabs/jet.git/'


satellite-master: Introduce unit tests for satellite.recipes.

error: pathspec 'satellite-master/test/satellite/recipes_test.clj' did not match any file(s) known to git

--- satellite-master/test/satellite/recipes_test.clj
+++ satellite-master/test/satellite/recipes_test.clj
@@ -0,0 +1,59 @@
+;; Copyright 2015 TWO SIGMA OPEN SOURCE, LLC
+;;
+;; Licensed under the Apache License, Version 2.0 (the "License");
+;; you may not use this file except in compliance with the License.
+;; You may obtain a copy of the License at
+;;
+;;     http://www.apache.org/licenses/LICENSE-2.0
+;;
+;; Unless required by applicable law or agreed to in writing, software
+;; distributed under the License is distributed on an "AS IS" BASIS,
+;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+;; See the License for the specific language governing permissions and
+;; limitations under the License.
+
+(ns satellite.recipes-test
+  (use satellite.recipes
+       clojure.test))
+
+(deftest test-exceeds-threshold?
+
+  (testing "Excessive value returns true"
+    (is (exceeds-threshold? {:metric 5} {:metric 2} 2)))
+
+  (testing "Sufficiently low ratio returns false"
+    (is (not (exceeds-threshold? {:metric 3} {:metric 2} 2))))
+
+  (testing "Positive divisor and zero dividend returns true"
+    (is (exceeds-threshold? {:metric 3} {:metric 0} 2)))
+
+  (testing "Zero divisor and zero dividend returns false"
+    (is (not (exceeds-threshold? {:metric 0} {:metric 0} 2)))))
+
+
+(deftest test-fold-blackhole-thresholds
+
+  (def settings {:blackhole-fails-to-starts-threshold 0.75
+                 :blackhole-fails-to-finishes-threshold 3})
+
+  (testing "critical state when too many failures "
+    (is (= "critical"
+           (:state (fold-blackhole-thresholds settings
+                                              [{:metric 8} {:metric 10} {:metric 2}])))))
+
+  (testing "ok state when few failures"
+    (is (= "ok"
+           (:state (fold-blackhole-thresholds settings
+                                              [{:metric 1} {:metric 10} {:metric 2}])))))
+
+  (testing "ok state when only fails per start exceeeded"
+    (is (= "ok"
+           (:state (fold-blackhole-thresholds settings
+                                              [{:metric 8} {:metric 10} {:metric 9}])))))
+
+  (testing "ok state when only fails per finish exceeeded"
+    (is (= "ok"
+           (:state (fold-blackhole-thresholds settings
+                                              [{:metric 8} {:metric 20} {:metric 2}])))))
+
+  )


Simple scene display (skybox + meshes)

Simple scene display (skybox + meshes)

error: pathspec 'src/clojure/yaw/scene.clj' did not match any file(s) known to git

--- src/clojure/yaw/scene.clj
+++ src/clojure/yaw/scene.clj
@@ -0,0 +1,71 @@
+(ns clojure.yaw.scene
+  (:require [yaw.world :as w]
+            [yaw.mesh :as mesh]
+            [yaw.spec]
+            [clojure.spec.alpha :as s]))
+
+(defn explode
+  "Explodes a vector [x y z] tuple into (:x x :y y :z z)"
+  [[x y z]]
+  (list :x x :y y :z z))
+
+(defn kw-rgb
+  "Returns a rgb tuple from a keyword color"
+  [color]
+  (case color
+      :black [0 0 0]
+      :red [1 0 0]
+      :blue [0 0 1]
+      :green [0 1 0]
+      :yellow [1 1 0]
+      :cyan [0 1 1]
+      :magenta [1 0 1]
+      :white [1 1 1]))
+
+(defn color
+  "Returns a rgb tuple from any sort of color"
+  [[kw v]]
+  (case kw
+    :kw (kw-rgb v)
+    :rgb v))
+
+(def empty-item-map
+  {:cameras []
+   :lights {:ambient nil :sun nil :points [] :spots []}
+   :groups {}
+   :items {}})
+(defn item-map
+  "Reducing function that adds a conformed item to a pre-existing map"
+  ([] empty-item-map)
+  ([m [kw v]]
+   (case kw
+     :item (assoc-in m [:items (:id-kw v)] (:params v)))))
+
+(defn display
+  "Opens a window and displays a 3D scene in it"
+  [scene]
+  (let [scene (s/conform :scene/scene scene)
+        params (get scene :params {})
+        skybox (get params :skybox nil)
+        camera (get params :camera nil)
+        items (get scene :items [])
+        univ (w/start-universe!)
+        world (:world @univ)]
+    (if (some? skybox)
+      (w/set-skybox! world
+                     :scale (:scale skybox)
+                     :color (color (:color skybox))))
+    (let [items (reduce item-map empty-item-map items)]
+      (println items)
+      (run! (fn [[k v]]
+              (let [m (apply w/create-simple-mesh! world (mesh/mesh (:mesh v)) )
+                    i (w/create-item! world :id (str k)
+                                      :position (get v :pos [0 0 0])
+                                      :scale (get v :scale 1))]
+                (apply w/rotate! i (explode (get v :rot [0 0 0])))))
+            (:items items)))))
+
+
+(display [:scene {:skybox {:color :red :scale [30 30 30]}}
+          [:item :test/box {:mesh :mesh/box :color :white :pos [0 0 -5] :rot [0 45 0]}]])
+


update dependencies

update dependencies

--- sidecar/project.clj
+++ sidecar/project.clj
@@ -12,26 +12,27 @@
     :exclusions [org.apache.ant/ant]]
    [org.clojure/core.async "0.2.374"
     :exclusions [org.clojure/tools.reader]]
-   [com.stuartsierra/component "0.3.0"]
+   [com.stuartsierra/component "0.3.1"]
    [http-kit "2.1.19"]
-   [ring-cors "0.1.7"
+   [ring-cors "0.1.8"
     :exclusions [ring/ring-core org.clojure/clojure]]
-   [compojure "1.4.0" :exclusions [org.clojure/clojure]]
+   [compojure "1.5.0" :exclusions [org.clojure/clojure]]
    [clj-stacktrace "0.2.8"]
    [figwheel "0.5.4-SNAPSHOT"
       :exclusions [org.clojure/tools.reader]]
-   [hawk "0.2.9" :exclusions [org.clojure/clojure]]
+   [hawk "0.2.10" :exclusions [org.clojure/clojure]]

    [org.clojure/tools.nrepl "0.2.12"]
    ;; for config validation
    [clj-fuzzy "0.3.1"]
-   [fipp "0.6.4"]]
+   [fipp "0.6.5"]]

   :clean-targets ^{:protect false} ["dev-resources/public/js" "target"]

   :profiles {:dev {:dependencies [[com.cemerick/piggieback "0.2.1"]]
                    :source-paths ["cljs_src" "src"]
-                   :plugins [[lein-cljsbuild "1.1.3" :exclusions [[org.clojure/clojure]]]]}
+                   :plugins [[lein-cljsbuild "1.1.3" :exclusions [[org.clojure/clojure]]]
+                             [lein-ancient "0.6.10"]]}
              :repl {:plugins [[cider/cider-nrepl "0.11.0"]]
                     :source-paths ["cljs_src" "src"]
                     :resource-paths ["resources" "dev-resources"]


Not really necessary, but DRY a bit.

Not really necessary, but DRY a bit.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/psy-q/vinylla.git/'


Remove problematic line-break inside fixed-width text

Signed-off-by: Deepak Giridharagopal <d11186354d1ef01ca06ae37d7e23e827da13e85f@puppetlabs.com>

--- src/com/puppetlabs/cmdb/catalog.clj
+++ src/com/puppetlabs/cmdb/catalog.clj
@@ -285,8 +285,8 @@
     (assoc catalog :resources new-resources)))

 (defn mapify-resources
-  "Turns the list of resources into a mapping of `{resource-spec
-  resource, resource-spec resource, ...}`"
+  "Turns the list of resources into a mapping of
+  `{resource-spec resource, resource-spec resource, ...}`"
   [{:keys [resources] :as catalog}]
   {:pre  [(coll? resources)
           (not (map? resources))]


Don't wrap sched. noty search in a map

Don't wrap sched. noty search in a map

It's already wrapped (or it gets wrapped later, I can't remember).

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-notification-works.git/'


added insult module

added insult module

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/m1dnight/a-slack-and-irc-bot.git/'


Initial implementation of FileBlobStore.

error: pathspec 'src/mvxcvi/vault/blob/store/file.clj' did not match any file(s) known to git

--- src/mvxcvi/vault/blob/store/file.clj
+++ src/mvxcvi/vault/blob/store/file.clj
@@ -0,0 +1,77 @@
+(ns mvxcvi.vault.blob.store.file
+  (:require
+    [clojure.string :as string]
+    [clojure.java.io :as io]
+    [mvxcvi.vault.blob :as blob]
+    [mvxcvi.vault.blob.store :refer :all]))
+
+
+;; HELPER FUNCTIONS
+
+(defn- blobref->file
+  [root blobref]
+  (let [blobref (blob/blob-ref blobref)
+        {:keys [algorithm digest]} blobref]
+    (io/file root
+             (name algorithm)
+             (subs digest 0 3)
+             (subs digest 3 6)
+             (subs digest 6))))
+
+
+(defn- file->blobref
+  [root file]
+  (let [root (str root)
+        file (str file)]
+    (when-not (.startsWith file root)
+      (throw (IllegalArgumentException.
+               (str "File " file " is not a child of root directory " root))))
+    (let [[algorithm & digest] (-> file
+                                   (subs (inc (count root)))
+                                   (string/split #"/"))]
+      (blob/blob-ref algorithm (string/join digest)))))
+
+
+
+;; FILE STORE
+
+(defrecord FileBlobStore
+  [root algorithm]
+
+  BlobStore
+
+  (enumerate [this]
+    (->>
+      (for [algorithm-dir (.listFiles root)]
+        (for [prefix-dir (.listFiles algorithm-dir)]
+          (for [midfix-dir (.listFiles prefix-dir)]
+            (seq (.listFiles midfix-dir)))))
+      flatten
+      (map (partial file->blobref root))))
+
+
+  (content-stream [this blobref]
+    (let [file (blobref->file root blobref)]
+      (if (.exists file)
+        (io/input-stream file)
+        nil)))
+
+
+  (store-content! [this content]
+    (let [blobref (blob/hash-content algorithm content)
+          file (blobref->file root blobref)]
+      (io/make-parents file)
+      (io/copy content file)
+      blobref))
+
+
+  (blob-info [this blobref]
+    (let [file (blobref->file root blobref)]
+      {:location (.toURI file)
+       :size (.length file)})))
+
+
+(defn file-store
+  "Creates a new local file-based blobstore."
+  ([root] (file-store root :sha256))
+  ([root algorithm] (FileBlobStore. (io/file root) algorithm)))


start adding tests

start adding tests

error: pathspec 'test/so/grep/cyanite/carbon_test.clj' did not match any file(s) known to git

--- test/so/grep/cyanite/carbon_test.clj
+++ test/so/grep/cyanite/carbon_test.clj
@@ -0,0 +1,7 @@
+(ns so.grep.cyanite.carbon-test
+  (:require [so.grep.cyanite.carbon :refer :all]
+            [clojure.test           :refer :all]))
+
+(deftest formatter-test
+  (testing "nil-transform"
+    (is (= nil (formatter [] "foo nan 1234")))))