Add undo API

Add undo API

--- src/re_frame/core.cljs
+++ src/re_frame/core.cljs
@@ -4,6 +4,7 @@
     [re-frame.subs       :as subs]
     [re-frame.router     :as router]
     [re-frame.utils      :as utils]
+    [re-frame.undo       :as undo]
     [re-frame.middleware :as middleware]))

@@ -23,12 +24,22 @@

 (def pure        middleware/pure)
 (def debug       middleware/debug)
-(def undoable    middleware/undoable)
 (def path        middleware/path)
 (def enrich      middleware/enrich)
 (def trim-v      middleware/trim-v)
 (def after       middleware/after)
 (def on-changes  middleware/on-changes)
+
+
+;; -- Undo API -----
+;;
+;; https://github.com/Day8/re-frame/wiki/Undo-&-Redo
+
+
+(def undoable    undo/undoable)
+(def set-max-undos!  undo/set-max-undos!)
+(def set-undo-path!  undo/set-undo-path!)
+

 ;; --  Logging -----


Why oh why does Clojure not have triple quoted strings??

--- src/re_frame/subs.cljc
+++ src/re_frame/subs.cljc
@@ -200,7 +200,7 @@
 (defn reg-sub
   "For a given `query-id`, register two functions: a `computation` function and an `input signals` function.

-  During program execution, a call to `subscribe`, such as `(subscribe [:sub-id 3 "blue"])`,
+  During program execution, a call to `subscribe`, such as `(subscribe [:sub-id 3 \"blue\"])`,
   will create a new `:sub-id` node in the Signal Graph. And, at that time, re-frame
   needs to know how to create the node.   By calling `reg-sub`, you are registering
   'the template' or 'the mechanism' by which nodes in the Signal Graph can be created.
@@ -217,8 +217,8 @@
     `(input-values, query-vector) -> a-value`

   When this computation function is called, `query-vector` will be what was passed as the first
-  argument the `subscribe` causing the node to be created. So if the call was `(subscribe [:sub-id 3 "blue"])`
-  then the `query-vector` supplied to the computaton function will be `[:sub-id 3 "blue"]`.
+  argument the `subscribe` causing the node to be created. So if the call was `(subscribe [:sub-id 3 \"blue\"])`
+  then the `query-vector` supplied to the computaton function will be `[:sub-id 3 \"blue\"]`.

   The arguments supplied between the `query-id` and the `computation-function` can vary in 3 ways,
   but whatever is there will define the `input signals` part of the template, and this controls


Change warning

Change warning

--- src/re_frame/subs.cljs
+++ src/re_frame/subs.cljs
@@ -1,6 +1,6 @@
 (ns re-frame.subs
  (:require
-  [re-frame.db :refer [app-db]]
+  [re-frame.db    :refer [app-db]]
   [re-frame.utils :refer [first-in-vector warn]]))

@@ -12,7 +12,7 @@
   "register a hander function for an id"
   [key-v handler-fn]
   (if (contains? @key->fn key-v)
-   (warn "re-frame: overwriting subscription-handler for: " key-v))   ;; allow it, but warn.
+    (warn "re-frame: overwriting subscription-handler for: " key-v))   ;; allow it, but warn.
   (swap! key->fn assoc key-v handler-fn))

@@ -20,7 +20,7 @@
   "returns a reagent/reaction which observes a part of the "
   [v]
   (let [key-v       (first-in-vector v)
-       handler-fn  (get @key->fn key-v)]
+        handler-fn  (get @key->fn key-v)]
     (if (nil? handler-fn)
-      (warn "re-frame: no subscription handler registered for: \"" key-v "\".  Returning nil.")
+      (warn "re-frame: no subscription handler registered for: \"" key-v "\".  Returning a nil subscription.")
       (handler-fn app-db v))))


hold on to listener (so it can be closed on component shutdown)

--- Clojure-Websockets/MainApp/src/clj/birdwatch/interop/component.clj
+++ Clojure-Websockets/MainApp/src/clj/birdwatch/interop/component.clj
@@ -9,15 +9,17 @@

 ;;; The interop component allows sending and receiving messages via Redis Pub/Sub.
 ;;; It has both a :send and a :receive channel and can be used on both sides of the Pub/Sub.
-(defrecord Interop [conf channels conn]
+(defrecord Interop [conf channels listener]
   component/Lifecycle
   (start [component] (log/info "Starting Interop Component")
-         (let [conn {:pool {} :spec {:host (:redis-host conf) :port (:redis-port conf)}}]
-           (red/subscribe-topic (:receive channels) conn "matches")
-           ;(red/run-send-loop (:send channels) conn "matches")
-           (assoc component :conn conn)))
-  (stop  [component] (log/info "Stopping Interop Component") ;; TODO: proper teardown of resources
-         (assoc component :conn nil)))
+         (let [conn {:pool {} :spec {:host (:redis-host conf) :port (:redis-port conf)}}
+               listener (red/subscribe-topic (:receive channels) conn "matches")]
+           (assoc component :conn conn :listener listener)))
+
+  (stop  [component] (log/info "Stopping Interop Component")
+         (red/unsubscribe listener)
+         (red/close listener)
+         (assoc component :conn nil :listener nil)))

 (defn new-interop [conf] (map->Interop {:conf conf}))


Warning language for docstring on config/reinject

--- src/riemann/config.clj
+++ src/riemann/config.clj
@@ -224,6 +224,9 @@

 (defn reinject
   "A stream which applies any events it receives back into the current core.
+  You almost never need this: it makes it easy to create infinite loops, and
+  it's rarely the case that you *need* top-level recursion. Where possible,
+  prefer a stream that passes events to children.

   (with :metric 1 reinject)"
   [event]


Change expected implementation file name for consistency

--- assignments/clojure/word-count/word-count_test.clj
+++ assignments/clojure/word-count/word-count_test.clj
@@ -1,5 +1,5 @@
 (ns word-count.test (:require [clojure.test :refer :all]))
-(load-file "word_count.clj")
+(load-file "word-count.clj")

 (deftest count-one-word
   (is (= {"word" 1}


worker checks and warns for missing outbound connections from assignment, now drops messages for which doesn't have outbound connection

--- src/clj/backtype/storm/daemon/worker.clj
+++ src/clj/backtype/storm/daemon/worker.clj
@@ -223,10 +223,11 @@
                                 (select-keys outbound-tasks)
                                 (#(map-val endpoint->string %)))
               ;; we dont need a connection for the local tasks anymore
-              needed-connections (->> my-assignment
-                                      (filter-key (complement (-> worker :task-ids set)))
-                                      vals
-                                      set)
+              needed-assignment (->> my-assignment
+                                      (filter-key (complement (-> worker :task-ids set))))
+              needed-connections (-> needed-assignment vals set)
+              needed-tasks (-> needed-assignment keys)
+
               current-connections (set (keys @(:cached-node+port->socket worker)))
               new-connections (set/difference needed-connections current-connections)
               remove-connections (set/difference current-connections needed-connections)]
@@ -252,7 +253,12 @@
                      (:cached-node+port->socket worker)
                      #(HashMap. (dissoc (into {} %1) %&))
                      remove-connections)
-          )))))
+
+              (let [missing-tasks (->> needed-tasks
+                                       (filter (complement my-assignment)))]
+                (when-not (empty? missing-tasks)
+                  (log-warn "Missing assignment for following tasks: " (pr-str missing-tasks))
+                  )))))))

 (defn refresh-storm-active
   ([worker]
@@ -286,9 +292,10 @@
               (fast-list-iter [[task ser-tuple] drainer]
                 ;; TODO: consider write a batch of tuples here to every target worker
                 ;; group by node+port, do multipart send
-                (let [socket (get node+port->socket (get task->node+port task))]
-                  (msg/send socket task ser-tuple)
-                  ))))
+                (let [node-port (get task->node+port task)]
+                  (when node-port
+                    (msg/send (get node+port->socket node-port) task ser-tuple))
+                    ))))
           (.clear drainer))))))

 (defn launch-receive-thread [worker]


add some session data schemes, not used yet

--- src/shale/sessions.clj
+++ src/shale/sessions.clj
@@ -32,8 +32,19 @@
 (defn is-ip? [s]
   (re-matches #"(?:\d{1,3}\.){3}\d{1,3}" s))

-(def Session
-  "A schema for a session spec."
+(def Capabilities {s/Any s/Any})
+
+(def SessionInRedis
+  "A session, as represented in redis."
+  {:id                            s/Str
+   (s/optional-key :tags)        [s/Str]
+   (s/optional-key :reserved)     s/Bool
+   (s/optional-key :current-url)  s/Str
+   (s/optional-key :browser-name) s/Str
+   (s/optional-key :node-id)      s/Str})
+
+(def SessionView
+  "A session, as presented to library users."
   {:id                            s/Str
    (s/optional-key :tags)        [s/Str]
    (s/optional-key :reserved)     s/Bool
@@ -41,7 +52,11 @@
    (s/optional-key :browser-name) s/Str
    (s/optional-key :node)         NodeView})

-(def Capabilities {s/Any s/Any})
+(def TagChange
+  "Add/remove a session/node tag"
+  {:resource (s/either :session :node)
+   :action   (s/either :add :remove)
+   :tag      s/Str})

 (def Requirement
   "A schema for a session requirement."
@@ -147,6 +162,13 @@
   "Asynchronously point a session to a url.
   Return nil or :webdriver-is-dead."
   (webdriver-go-to-url (resume-webdriver-from-id session-id) url))
+
+(def ModifyArg
+  "Modification to a session"
+  (s/either
+    (s/pair :change-tag "action" TagChange "tag change")
+    (s/pair :go-to-url  "action" s/Str     "url")
+    (s/pair :reserve    "action" s/Bool    "reserve")))

 (defn modify-session
   [session-id {:keys [browser-name
@@ -181,6 +203,12 @@
             nil)
         (car/return (view-model session-id))))
     nil))
+
+(def CreateArg
+  "Session-creation args"
+  {(s/optional-key :browser-name) s/Str
+   (s/optional-key :capabilities) Capabilities
+   (s/optional-key :node-id) s/Str})

 (defn create-session
   [{:keys [browser-name
@@ -259,6 +287,13 @@
    :reserved false})
 (s/validate OldGetOrCreateArg get-or-create-defaults)

+(def GetOrCreateArg
+  "The arg to get-or-create-session."
+  {(s/optional-key :require) Requirement  ; filter criteria
+   (s/optional-key :score) [Score]        ; sort ranking
+   (s/optional-key :create) CreateArg     ; how to create, if creating
+   (s/optional-key :modify) [ModifyArg]}) ; modifications to perform always
+
 (defn get-or-create-session [arg]
   (let [arg (s/validate OldGetOrCreateArg (merge get-or-create-defaults arg))]
     (with-car*


fix missing slash in absolute doc url

fix missing slash in absolute doc url

--- src-cljs/frontend/urls.cljs
+++ src-cljs/frontend/urls.cljs
@@ -6,4 +6,4 @@
   (str (url/map->URL {:protocol config/scheme
                       :port config/port
                       :host config/hostname
-                      :path (str "/document" doc-id)})))
+                      :path (str "/document/" doc-id)})))


1 should be enough here

1 should be enough here

--- src/sormilla/video.clj
+++ src/sormilla/video.clj
@@ -95,7 +95,7 @@
     (println "video: connecting...")
     (let [socket   (io-utils/open-video-socket #_ comm/drone-ip (InetAddress/getByName nil))
           frame-ch (async/chan (async/sliding-buffer 10))
-          image-ch (async/chan (async/sliding-buffer 10))
+          image-ch (async/chan (async/sliding-buffer 1))
           [v ch]   (alts!! [cancel-ch
                             (thread* (read-frame-task socket frame-ch))
                             (thread* (decode-frame-task frame-ch image-ch))


Switch extension example to use text tags

--- src/transit.clj
+++ src/transit.clj
@@ -40,11 +40,11 @@
   (extend-protocol transit.write/Handler
     Point
     (tag [_] "point")
-    (rep [p] (transit.write/as-tag :array [(.x p) (.y p)] nil))
+    (rep [p] (transit.write/as-tag "array" [(.x p) (.y p)] nil))
     (str-rep [_] nil)
     Circle
     (tag [_] "circle")
-    (rep [c] (transit.write/as-tag :array [(.c c) (.r c)] nil))
+    (rep [c] (transit.write/as-tag "array" [(.c c) (.r c)] nil))
     (str-rep [_] nil))

   (r/register-decode-fn "point" (fn [[x y]] (prn "making a point") (Point. x y)))


Minor fix on clj impl of finally function.

--- src/promesa/core.cljc
+++ src/promesa/core.cljc
@@ -299,8 +299,8 @@
   executed independently if promise is
   resolved or rejected."
   [p callback]
-  #?(:clj (-> (p/then #(callback))
-              (p/catch #(callback)))
+  #?(:clj (-> (then #(callback))
+              (catch #(callback)))
      :cljs (.finally p callback)))

 (defn branch


fix JS deps only being required when used as string

--- src/main/shadow/build/compiler.clj
+++ src/main/shadow/build/compiler.clj
@@ -208,20 +208,25 @@
     ;; this saves downloading a bunch of data prematurely
     (comp/emitln "goog.provide(\"cljs.core$macros\");"))

-  (doseq [dep deps
-          :when (not= 'goog dep)]
-    (comp/emitln "goog.require('" (comp/munge dep) "');"))
-
-  ;; the goog.require for these deps only ensured that the shadow$provide is available
-  ;; the shadow$provide can't be called eagerly because of cyclic (and conditional) requires
-  ;; so we properly require them in the CLJS file.
-  ;; this is not done in release mode since optimized code will treat this differently
-  ;; as shadow.js.require should only be called once (since it exposes a global var)
-  ;; this is fine in :none but :advanced complains (when using :modules)
-  (when (and (= :shadow (get-in state [:js-options :js-provider]))
-             (= :dev (:mode state)))
-    (doseq [[js-require js-alias] (:js-aliases ast)]
-      (comp/emitln "var " js-alias "=shadow.js.require(\"" js-alias "\");"))))
+  (let [shadow-js?
+        (and (= :shadow (get-in state [:js-options :js-provider]))
+             (= :dev (:mode state)))]
+
+    (doseq [dep deps
+            :when (not= 'goog dep)]
+      (comp/emitln "goog.require('" (comp/munge dep) "');")
+
+      ;; the goog.require for these deps only ensured that the shadow$provide is available
+      ;; the shadow$provide can't be called eagerly because of cyclic (and conditional) requires
+      ;; so we properly require them in the CLJS file.
+      ;; this is not done in release mode since optimized code will treat this differently
+      ;; as shadow.js.require should only be called once (since it exposes a global var)
+      ;; this is fine in :none but :advanced complains (when using :modules)
+      (when shadow-js?
+        (let [{:keys [ns type] :as rc} (data/get-source-by-provide state dep)]
+          (when (= :npm type)
+            (comp/emitln "var " ns "=shadow.js.require(\"" ns "\");")
+            ))))))

 (defn default-compile-cljs
   [state compile-state form]


add :warnings-as-errors compiler options

takes either a boolean or a set of warning-type keywords

--- src/main/shadow/build/compiler.clj
+++ src/main/shadow/build/compiler.clj
@@ -340,7 +340,7 @@
               :ns (:name ast)
               :ns-info (dissoc ast :env)))))))

-(defn warning-collector [build-env warnings warning-type env extra]
+(defn warning-collector [state warnings warning-type env extra]
   ;; FIXME: currently there is no way to turn off :infer-externs
   ;; the work is always done and the warning is always generated
   ;; it is just not emitted when *warn-in-infer* is not set
@@ -364,15 +364,21 @@
           extra
           (if (not= warning-type :fn-deprecated)
             extra
-            (dissoc extra :fexpr))]
-
-      (swap! warnings conj
-        {:warning warning-type
-         :line line
-         :column column
-         :msg msg
-         :extra extra}
-        ))))
+            (dissoc extra :fexpr))
+
+          warning-info
+          {:warning warning-type
+           :line line
+           :column column
+           :msg msg
+           :extra extra}]
+
+      (let [wae (get-in state [:compiler-options :warnings-as-errors])]
+        (when (or (true? wae)
+                  (and (set? wae) (contains? wae warning-type)))
+          (throw (ex-info msg warning-info))))
+
+      (swap! warnings conj warning-info))))

 (defmacro with-warnings
   "given a body that produces a compilation result, collect all warnings and assoc into :warnings"


Add log to entry armageddon

Add log to entry armageddon

--- src/oc/storage/resources/entry.clj
+++ src/oc/storage/resources/entry.clj
@@ -612,6 +612,7 @@
   ([conn confirm]
    {:pre [(db-common/conn? conn)]}
    (assert (= confirm "I do know what I am doing!") (ex-info "Do you know what you are doing?" {:confirmation confirm}))
+   (timbre/info "It looks like you really know what you are doing! Removing all entries, interactions and related versions...")
    ;; Delete all interactions and entries
    (db-common/delete-all-resources! conn common/interaction-table-name)
    (db-common/delete-all-resources! conn versions-table-name)


Cleanup slot-ids after job is killed

Cleanup slot-ids after job is killed

--- src/onyx/log/commands/kill_job.clj
+++ src/onyx/log/commands/kill_job.clj
@@ -21,6 +21,7 @@
           (update-in [:allocations] dissoc job-id)
           (update-in [:task-metadata] dissoc job-id)
           (update-in [:ackers] dissoc job-id)
+          (update-in [:task-slot-ids] dissoc job-id)
           (update-in [:peer-state] merge (into {} (map (fn [p] {p :idle}) peers)))
           (reconfigure-cluster-workload)))
     replica))


Reduce memory consumption

Reduce memory consumption

--- src/advent_2017/day_20.cljc
+++ src/advent_2017/day_20.cljc
@@ -25,7 +25,7 @@
                             (iterate #(map step %) indexed)))

 (defn part-1 []
-  (take 500 closest-particle-idx))                          ; eyeball result and guess
+  (into [] (take 500) closest-particle-idx))                ; eyeball result and guess

 (defn remove-colliding [particles]
   (->> particles
@@ -38,4 +38,4 @@
                       (iterate (comp remove-colliding #(map step %)) indexed)))

 (defn part-2 []
-  (take 500 particle-count))                                ; eyeball result and guess
+  (into [] (take 500) particle-count))                      ; eyeball result and guess


libs -> samples

libs -> samples

--- src/overtone/samples/freesound.clj
+++ src/overtone/samples/freesound.clj
@@ -2,8 +2,8 @@
             freesound.org"
       :author "Sam Aaron, Kevin Neaton"}
   overtone.samples.freesound
-  (:use [overtone.libs.freesound.url]
-        [overtone.libs.freesound.search-results]
+  (:use [overtone.samples.freesound.url]
+        [overtone.samples.freesound.search-results]
         [overtone.sc.node]
         [overtone.helpers.lib :only [defrecord-ifn]])
   (:require [clojure.data.json :as json]


Add debug output

Add debug output

--- src/antlion_clojure/bot.clj
+++ src/antlion_clojure/bot.clj
@@ -445,6 +445,7 @@

 (defn message-handler
   [{:keys [slack dynamodb res] :as opt}]
+  (println opt)
   (->> (case (:subtype res)
          "channel_leave" (channel-leave-handler opt)
          "group_leave" (channel-leave-handler opt)


add more validations on bolth options

add more validations on bolth options

--- src/bolth.clj
+++ src/bolth.clj
@@ -370,7 +370,10 @@
   (assert (and (number? (:warn-on-slow-test-limit-ms options 1000)) (pos? (:warn-on-slow-test-limit-ms options 1000))) (str ":warn-on-slow-test-limit-ms should be a positive number, but was: " (pr-str (:warn-on-slow-test-limit-ms options 1000))))
   (assert (and (number? (:clear-screen-lines options 50)) (pos? (:clear-screen-lines options 50))) (str ":clear-screen-lines should be a positive number, but was: " (pr-str (:clear-screen-lines options 50))))
   (assert (and (number? (:flush-interval options 10)) (pos? (:flush-interval options 50))) (str ":flush-interval should be a positive number, but was: " (pr-str (:flush-interval options 50))))
-  (assert (map? (:frame-options options *frame-options*)) (str ":frame-options should be a map, but was: " (pr-str (:frame-options options *frame-options*)))))
+  (assert (map? (:frame-options options *frame-options*)) (str ":frame-options should be a map, but was: " (pr-str (:frame-options options *frame-options*))))
+  (assert (#{true false} (:colored-printing options true)) (str ":colored-printing should be a boolean, but was: " (pr-str (:colored-printing options true))))
+  (assert (#{:random :agony :gathered nil} (:priority options :agony)) (str ":priority should be one of :random, :agony, :gathered, or not set at all, but was: " (pr-str (:priority options :agony))))
+  (assert (fn? (options->prioritizer options)) (str "prioritizer should a function, but was: " (pr-str (options->prioritizer options)))))

 (defn run-all-tests
   "runs tests, just like clojure.test/run-all-tests.


+(def lexicon-indices)

+(def lexicon-indices)

--- src/babel/italiano/lab.cljc
+++ src/babel/italiano/lab.cljc
@@ -248,8 +248,8 @@
                      babel.generate/grammar grammar]
              (time (generate spec model))))))

-(defn verbcoach-lexical-lookup [spec]
-  (let [lexicon
+(def lexicon-indices
+  (let [filtered-lexicon
         (into {}
               (for [[k vals] (:lexicon model)]
                 (let [filtered-vals
@@ -262,9 +262,11 @@
                                  (= true (u/get-in % [:synsem :reflexive]))))
                        vals)]
                   (if (not (empty? filtered-vals))
-                    [k filtered-vals]))))
-        indices (create-indices lexicon grammar/index-paths)]
-    (lookup-spec spec indices grammar/index-paths)))
+                    [k filtered-vals]))))]
+    (create-indices filtered-lexicon grammar/index-paths)))
+
+(defn verbcoach-lexical-lookup [spec]
+  (lookup-spec spec lexicon-indices grammar/index-paths))

 ;; (take 10 (generate-for-verbcoach))
 (defn generate-for-verbcoach


Update cider-nrepl version

Update cider-nrepl version

--- lein/profiles.clj
+++ lein/profiles.clj
@@ -1,2 +1,2 @@
-{:user {:plugins [[cider/cider-nrepl "0.9.0"] [refactor-nrepl "1.1.0"]]
+{:user {:plugins [[cider/cider-nrepl "0.10.0-snapshot"] [refactor-nrepl "1.1.0"]]
         :dependencies [[org.clojure/tools.nrepl "0.2.7"]]}}


removed

removed

--- lein/profiles.clj
+++ lein/profiles.clj
@@ -1,9 +0,0 @@
-{
-    :user {
-        :plugins [
-            [lein-exec "0.2.0"]
-            [lein-swank "1.4.4"]
-            [org.clojure/clojure "1.3.0"]
-        ]
-    }
-}


remove with-conn from migrate

remove with-conn from migrate

--- src/chat/server/migrate.clj
+++ src/chat/server/migrate.clj
@@ -8,343 +8,327 @@
 (defn migrate-2016-05-13
   "Threads have associated groups"
   []
-  (db/with-conn
-    (d/transact db/*conn*
-      [{:db/ident :thread/group
-        :db/valueType :db.type/ref
-        :db/cardinality :db.cardinality/one
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}])
-    (let [threads (->> (d/q '[:find [?t ...]
-                              :where
-                              [?t :thread/id]]
-                            (d/db db/*conn*))
-                       (d/pull-many
-                         (d/db db/*conn*)
-                         [:thread/id
-                          {:thread/mentioned [:user/id]}
-                          {:thread/tag [:tag/group]}
-                          {:message/_thread [:message/created-at
-                                             {:message/user [:user/id]}]}]))
-          tx
-          (vec
-            (for [th threads]
-              (let [author (->> (th :message/_thread)
-                                (sort-by :message/created-at)
-                                first
-                                :message/user)
-                    author-grp (some-> author :user/id
-                                       db/get-groups-for-user
-                                       first :id)
-                    fallback-group (:group/id (d/pull (d/db db/*conn*) [:group/id] [:group/name "Braid"]))]
-                (cond
-                  (seq (th :thread/tag))
-                  (let [grp (get-in th [:thread/tag 0 :tag/group :db/id])]
-                    (when (nil? grp)
-                      (println "Nil by tag " (th :thread/id)))
-                    [:db/add [:thread/id (th :thread/id)]
-                     :thread/group grp])
-
-                  (seq (th :thread/mentioned))
-                  (let [grps (apply
-                               set/intersection
-                               (map (comp :id
-                                          db/get-groups-for-user
-                                          :user/id)
-                                    (cons author (th :thread/mentioned))))
-                        grp (or (first grps) author-grp fallback-group)]
-                    (when (nil? grp)
-                      (println "Nil by mentions " (th :thread/id)))
-                    [:db/add [:thread/id (th :thread/id)]
-                     :thread/group [:group/id grp]])
-
-                  :else
-                  (let [grp (or author-grp fallback-group)]
-                    (when (nil? grp)
-                      (println "nil by author" (th :thread/id)))
-                    [:db/add [:thread/id (th :thread/id)]
-                     :thread/group [:group/id grp]])))))]
-      (d/transact db/*conn* tx))))
+  (d/transact db/*conn*
+    [{:db/ident :thread/group
+      :db/valueType :db.type/ref
+      :db/cardinality :db.cardinality/one
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}])
+  (let [threads (->> (d/q '[:find [?t ...]
+                            :where
+                            [?t :thread/id]]
+                          (d/db db/*conn*))
+                     (d/pull-many
+                       (d/db db/*conn*)
+                       [:thread/id
+                        {:thread/mentioned [:user/id]}
+                        {:thread/tag [:tag/group]}
+                        {:message/_thread [:message/created-at
+                                           {:message/user [:user/id]}]}]))
+        tx
+        (vec
+          (for [th threads]
+            (let [author (->> (th :message/_thread)
+                              (sort-by :message/created-at)
+                              first
+                              :message/user)
+                  author-grp (some-> author :user/id
+                                     db/get-groups-for-user
+                                     first :id)
+                  fallback-group (:group/id (d/pull (d/db db/*conn*) [:group/id] [:group/name "Braid"]))]
+              (cond
+                (seq (th :thread/tag))
+                (let [grp (get-in th [:thread/tag 0 :tag/group :db/id])]
+                  (when (nil? grp)
+                    (println "Nil by tag " (th :thread/id)))
+                  [:db/add [:thread/id (th :thread/id)]
+                   :thread/group grp])
+
+                (seq (th :thread/mentioned))
+                (let [grps (apply
+                             set/intersection
+                             (map (comp :id
+                                        db/get-groups-for-user
+                                        :user/id)
+                                  (cons author (th :thread/mentioned))))
+                      grp (or (first grps) author-grp fallback-group)]
+                  (when (nil? grp)
+                    (println "Nil by mentions " (th :thread/id)))
+                  [:db/add [:thread/id (th :thread/id)]
+                   :thread/group [:group/id grp]])
+
+                :else
+                (let [grp (or author-grp fallback-group)]
+                  (when (nil? grp)
+                    (println "nil by author" (th :thread/id)))
+                  [:db/add [:thread/id (th :thread/id)]
+                   :thread/group [:group/id grp]])))))]
+    (d/transact db/*conn* tx)))

 (defn migrate-2016-05-07
   "Change how user preferences are stored"
   []
-  (db/with-conn
-    ; rename old prefs
-    (d/transact db/*conn* [{:db/id :user/preferences
-                            :db/ident :user/preferences-old}])
-    ; create new entity type
-    (d/transact db/*conn*
-      [{:db/ident :user/preferences
-        :db/valueType :db.type/ref
-        :db/cardinality :db.cardinality/many
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}
-
-       {:db/ident :user.preference/key
-        :db/valueType :db.type/keyword
-        :db/cardinality :db.cardinality/one
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}
-       {:db/ident :user.preference/value
-        :db/valueType :db.type/string
-        :db/cardinality :db.cardinality/one
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}])
-
-    ; migrate to new style
-    (let [prefs (d/q '[:find (pull ?u [:user/id :user/preferences-old])
-                       :where [?u :user/id]]
-                     (d/db db/*conn*))]
-      (doseq [[p] prefs]
-        (let [u-id (:user/id p)
-              u-prefs (edn/read-string (:user/preferences-old p))]
-          (doseq [[k v] u-prefs]
-            (when k (db/user-set-preference! u-id k v))))))))
+  ; rename old prefs
+  (d/transact db/*conn* [{:db/id :user/preferences
+                          :db/ident :user/preferences-old}])
+  ; create new entity type
+  (d/transact db/*conn*
+    [{:db/ident :user/preferences
+      :db/valueType :db.type/ref
+      :db/cardinality :db.cardinality/many
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}
+
+     {:db/ident :user.preference/key
+      :db/valueType :db.type/keyword
+      :db/cardinality :db.cardinality/one
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}
+     {:db/ident :user.preference/value
+      :db/valueType :db.type/string
+      :db/cardinality :db.cardinality/one
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}])
+
+  ; migrate to new style
+  (let [prefs (d/q '[:find (pull ?u [:user/id :user/preferences-old])
+                     :where [?u :user/id]]
+                   (d/db db/*conn*))]
+    (doseq [[p] prefs]
+      (let [u-id (:user/id p)
+            u-prefs (edn/read-string (:user/preferences-old p))]
+        (doseq [[k v] u-prefs]
+          (when k (db/user-set-preference! u-id k v)))))))

 (defn migrate-2016-05-03
   "Add tag descriptions"
   []
-  (db/with-conn
-    (d/transact db/*conn*
-      [{:db/ident :tag/description
-        :db/valueType :db.type/string
-        :db/cardinality :db.cardinality/one
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}])))
+  (d/transact db/*conn*
+    [{:db/ident :tag/description
+      :db/valueType :db.type/string
+      :db/cardinality :db.cardinality/one
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}]))

 (defn migrate-2016-04-29
   "Add group admins"
   []
-  (db/with-conn
-    (d/transact db/*conn*
-      [{:db/ident :group/admins
-        :db/valueType :db.type/ref
-        :db/cardinality :db.cardinality/many
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}])))
+  (d/transact db/*conn*
+    [{:db/ident :group/admins
+      :db/valueType :db.type/ref
+      :db/cardinality :db.cardinality/many
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}]))

 (defn migrate-2016-03-28
   "Add group settings"
   []
-  (db/with-conn
-    (d/transact db/*conn*
-                [{:db/ident :group/settings
-                  :db/valueType :db.type/string
-                  :db/cardinality :db.cardinality/one
-                  :db/id #db/id [:db.part/db]
-                  :db.install/_attribute :db.part/db}])))
+  (d/transact db/*conn*
+    [{:db/ident :group/settings
+      :db/valueType :db.type/string
+      :db/cardinality :db.cardinality/one
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}]))

 (defn migrate-2016-03-21
   "Add user preferences"
   []
-  (db/with-conn
-    (d/transact db/*conn*
-      [{:db/ident :user/preferences
-        :db/valueType :db.type/string
-        :db/cardinality :db.cardinality/one
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}])))
+  (d/transact db/*conn*
+    [{:db/ident :user/preferences
+      :db/valueType :db.type/string
+      :db/cardinality :db.cardinality/one
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}]))

 (defn migrate-2016-03-04
   "Add extension type as attribute"
   []
-  (db/with-conn
-    (d/transact db/*conn*
-                [{:db/ident :extension/type
-                 :db/valueType :db.type/keyword
-                 :db/cardinality :db.cardinality/one
-                 :db/id #db/id [:db.part/db]
-                 :db.install/_attribute :db.part/db}])))
+  (d/transact db/*conn*
+    [{:db/ident :extension/type
+      :db/valueType :db.type/keyword
+      :db/cardinality :db.cardinality/one
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}]))

 (defn migrate-2016-03-02
   "Add extension user"
   []
-  (db/with-conn
-    (d/transact db/*conn*
-                [{:db/ident :extension/user
-                 :db/valueType :db.type/ref
-                 :db/cardinality :db.cardinality/one
-                 :db/id #db/id [:db.part/db]
-                 :db.install/_attribute :db.part/db}])))
+  (d/transact db/*conn*
+    [{:db/ident :extension/user
+      :db/valueType :db.type/ref
+      :db/cardinality :db.cardinality/one
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}]))

 (defn migrate-2016-02-26
   "Add extension schema"
   []
-  (db/with-conn
-    (d/transact db/*conn*
-      [{:db/ident :extension/id
-        :db/valueType :db.type/uuid
-        :db/cardinality :db.cardinality/one
-        :db/unique :db.unique/identity
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}
-       {:db/ident :extension/group
-        :db/valueType :db.type/ref
-        :db/cardinality :db.cardinality/one
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}
-       {:db/ident :extension/token
-        :db/valueType :db.type/string
-        :db/cardinality :db.cardinality/one
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}
-       {:db/ident :extension/refresh-token
-        :db/valueType :db.type/string
-        :db/cardinality :db.cardinality/one
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}
-       {:db/ident :extension/config
-        :db/valueType :db.type/string
-        :db/cardinality :db.cardinality/one
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}
-       {:db/ident :extension/watched-threads
-        :db/valueType :db.type/ref
-        :db/cardinality :db.cardinality/many
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}
-       ])))
+  (d/transact db/*conn*
+    [{:db/ident :extension/id
+      :db/valueType :db.type/uuid
+      :db/cardinality :db.cardinality/one
+      :db/unique :db.unique/identity
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}
+     {:db/ident :extension/group
+      :db/valueType :db.type/ref
+      :db/cardinality :db.cardinality/one
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}
+     {:db/ident :extension/token
+      :db/valueType :db.type/string
+      :db/cardinality :db.cardinality/one
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}
+     {:db/ident :extension/refresh-token
+      :db/valueType :db.type/string
+      :db/cardinality :db.cardinality/one
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}
+     {:db/ident :extension/config
+      :db/valueType :db.type/string
+      :db/cardinality :db.cardinality/one
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}
+     {:db/ident :extension/watched-threads
+      :db/valueType :db.type/ref
+      :db/cardinality :db.cardinality/many
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}
+     ]))

 (defn migrate-2016-01-14
   "All users must have a nickname"
   []
-  (db/with-conn
-    (let [give-nicks (->> (d/q '[:find (pull ?u [:user/id :user/email :user/nickname])
-                                 :where
-                                 [?u :user/id]]
-                               (d/db db/*conn*))
-                          (map first)
-                          (filter (comp nil? :user/nickname))
-                          (mapv (fn [u] [:db/add [:user/id (:user/id u)]
-                                         :user/nickname (-> (:user/email u) (string/split #"@") first)])))]
-      (d/transact db/*conn* give-nicks))))
+  (let [give-nicks (->> (d/q '[:find (pull ?u [:user/id :user/email :user/nickname])
+                               :where
+                               [?u :user/id]]
+                             (d/db db/*conn*))
+                        (map first)
+                        (filter (comp nil? :user/nickname))
+                        (mapv (fn [u] [:db/add [:user/id (:user/id u)]
+                                       :user/nickname (-> (:user/email u) (string/split #"@") first)])))]
+    (d/transact db/*conn* give-nicks)))

 (defn migrate-2016-01-01
   "Change email uniqueness to /value, add thread mentions"
   []
-  (db/with-conn
-    (d/transact db/*conn*
-      [{:db/id :user/email
-        :db/unique :db.unique/value
-        :db.alter/_attribute :db.part/db}
-       {:db/ident :thread/mentioned
-        :db/valueType :db.type/ref
-        :db/cardinality :db.cardinality/many
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}])))
+  (d/transact db/*conn*
+    [{:db/id :user/email
+      :db/unique :db.unique/value
+      :db.alter/_attribute :db.part/db}
+     {:db/ident :thread/mentioned
+      :db/valueType :db.type/ref
+      :db/cardinality :db.cardinality/many
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}]))

 (defn migrate-2015-12-19
   "Add user nicknames"
   []
-  (db/with-conn
-    (d/transact db/*conn*
-      [{:db/ident :user/nickname
-        :db/valueType :db.type/string
-        :db/cardinality :db.cardinality/one
-        :db/unique :db.unique/value
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}])))
+  (d/transact db/*conn*
+    [{:db/ident :user/nickname
+      :db/valueType :db.type/string
+      :db/cardinality :db.cardinality/one
+      :db/unique :db.unique/value
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}]))

 (defn migrate-2015-12-12
   "Make content fulltext"
   []
   ; rename content
-  (db/with-conn (d/transact db/*conn* [{:db/id :message/content :db/ident :message/content-old}]))
-  (db/with-conn (d/transact db/*conn* [{:db/ident :message/content
+  (d/transact db/*conn* [{:db/id :message/content :db/ident :message/content-old}])
+  (d/transact db/*conn* [{:db/ident :message/content
                                         :db/valueType :db.type/string
                                         :db/fulltext true
                                         :db/cardinality :db.cardinality/one
                                         :db/id #db/id [:db.part/db]
-                                        :db.install/_attribute :db.part/db}]))
-  (let [messages (db/with-conn (->> (d/q '[:find (pull ?e [:message/id
-                                                           :message/content-old
-                                                           :message/created-at
-                                                           {:message/user [:user/id]}
-                                                           {:message/thread [:thread/id]}])
-                                           :where [?e :message/id]]
-                                         (d/db db/*conn*))
-                                    (map first)))]
-    (db/with-conn
-      (let [msg-tx (->> messages
-                        (map (fn [msg]
-                               [:db/add [:message/id (msg :message/id)]
-                                :message/content (msg :message/content-old)])))]
-        (d/transact db/*conn* (doall msg-tx))))))
+                                        :db.install/_attribute :db.part/db}])
+  (let [messages (->> (d/q '[:find (pull ?e [:message/id
+                                             :message/content-old
+                                             :message/created-at
+                                             {:message/user [:user/id]}
+                                             {:message/thread [:thread/id]}])
+                             :where [?e :message/id]]
+                           (d/db db/*conn*))
+                      (map first))]
+    (let [msg-tx (->> messages
+                      (map (fn [msg]
+                             [:db/add [:message/id (msg :message/id)]
+                              :message/content (msg :message/content-old)])))]
+      (d/transact db/*conn* (doall msg-tx)))))

 (defn migrate-2015-07-29
   "Schema changes for groups"
   []
-  (db/with-conn
-    (d/transact db/*conn*
-      [{:db/ident :tag/group
-        :db/valueType :db.type/ref
-        :db/cardinality :db.cardinality/one
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}
-
-       ; groups
-       {:db/ident :group/id
-        :db/valueType :db.type/uuid
-        :db/cardinality :db.cardinality/one
-        :db/unique :db.unique/identity
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}
-       {:db/ident :group/name
-        :db/valueType :db.type/string
-        :db/cardinality :db.cardinality/one
-        :db/unique :db.unique/identity
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}
-       {:db/ident :group/user
-        :db/valueType :db.type/ref
-        :db/cardinality :db.cardinality/many
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}]))
+  (d/transact db/*conn*
+    [{:db/ident :tag/group
+      :db/valueType :db.type/ref
+      :db/cardinality :db.cardinality/one
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}
+
+     ; groups
+     {:db/ident :group/id
+      :db/valueType :db.type/uuid
+      :db/cardinality :db.cardinality/one
+      :db/unique :db.unique/identity
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}
+     {:db/ident :group/name
+      :db/valueType :db.type/string
+      :db/cardinality :db.cardinality/one
+      :db/unique :db.unique/identity
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}
+     {:db/ident :group/user
+      :db/valueType :db.type/ref
+      :db/cardinality :db.cardinality/many
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}])
   (println "You'll now need to create a group and add existing users & tags to that group"))

 (defn create-group-for-users-and-tags
   "Helper function for migrate-2015-07-29 - give a group name to create that
   group and add all existing users and tags to that group"
   [group-name]
-  (db/with-conn
-    (let [group (db/create-group! {:id (db/uuid) :name group-name})
-          all-users (->> (d/q '[:find ?u :where [?u :user/id]] (d/db db/*conn*)) (map first))
-          all-tags (->> (d/q '[:find ?t :where [?t :tag/id]] (d/db db/*conn*)) (map first))]
-      (d/transact db/*conn* (mapv (fn [u] [:db/add [:group/id (group :id)] :group/user u]) all-users))
-      (d/transact db/*conn* (mapv (fn [t] [:db/add t :tag/group [:group/id (group :id)]]) all-tags)))))
+  (let [group (db/create-group! {:id (db/uuid) :name group-name})
+        all-users (->> (d/q '[:find ?u :where [?u :user/id]] (d/db db/*conn*)) (map first))
+        all-tags (->> (d/q '[:find ?t :where [?t :tag/id]] (d/db db/*conn*)) (map first))]
+    (d/transact db/*conn* (mapv (fn [u] [:db/add [:group/id (group :id)] :group/user u]) all-users))
+    (d/transact db/*conn* (mapv (fn [t] [:db/add t :tag/group [:group/id (group :id)]]) all-tags))))

 (defn migrate-2015-08-26
   "schema change for invites"
   []
-  (db/with-conn
-    (d/transact db/*conn*
-      [
-       ; invitations
-       {:db/ident :invite/id
-        :db/valueType :db.type/uuid
-        :db/cardinality :db.cardinality/one
-        :db/unique :db.unique/identity
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}
-       {:db/ident :invite/group
-        :db/valueType :db.type/ref
-        :db/cardinality :db.cardinality/one
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}
-       {:db/ident :invite/from
-        :db/valueType :db.type/ref
-        :db/cardinality :db.cardinality/one
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}
-       {:db/ident :invite/to
-        :db/valueType :db.type/string
-        :db/cardinality :db.cardinality/one
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}
-       {:db/ident :invite/created-at
-        :db/valueType :db.type/instant
-        :db/cardinality :db.cardinality/one
-        :db/id #db/id [:db.part/db]
-        :db.install/_attribute :db.part/db}
-       ])))
+  (d/transact db/*conn*
+    [
+     ; invitations
+     {:db/ident :invite/id
+      :db/valueType :db.type/uuid
+      :db/cardinality :db.cardinality/one
+      :db/unique :db.unique/identity
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}
+     {:db/ident :invite/group
+      :db/valueType :db.type/ref
+      :db/cardinality :db.cardinality/one
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}
+     {:db/ident :invite/from
+      :db/valueType :db.type/ref
+      :db/cardinality :db.cardinality/one
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}
+     {:db/ident :invite/to
+      :db/valueType :db.type/string
+      :db/cardinality :db.cardinality/one
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}
+     {:db/ident :invite/created-at
+      :db/valueType :db.type/instant
+      :db/cardinality :db.cardinality/one
+      :db/id #db/id [:db.part/db]
+      :db.install/_attribute :db.part/db}
+     ]))


debugger: cleaner list style

debugger: cleaner list style

--- examples/_common/middleware/devtools.cljs
+++ examples/_common/middleware/devtools.cljs
@@ -317,8 +317,8 @@
    [-menu-button "Hide" #(dispatch ::on-toggle-visibility) (str "Hides debugger view (" toggle-visibility-shortcut ")")]

    [:label {:style {:font-weight "bold"
-                    :padding "4px"
-                    :margin  "5px 3px"}}
+                    :padding     "4px"
+                    :margin      "5px 3px"}}
     "Persist"
     [:input {:title     "Persist debug session into local storage?"
              :type      "checkbox"
@@ -332,27 +332,25 @@
      (for [[signal-id signal] (reverse signal-events)]
        ^{:key signal-id}
        [:div {:title "Signal"}
-        [:div {:style    {:cursor "pointer"}
+        [:div {:style    {:cursor           "pointer"
+                          :background-color "rgb(60, 70, 80)"}
                :on-click #(dispatch [::on-toggle-signal signal-id])
                :title    "Click to enable/disable all actions dispatched from this signal"}
-         "→ "
          (if (coll? signal)
-           [:span [:strong (pr-str (first signal))] " " (clojure.string/join " " (map pr-str (rest signal)))]
-           [:strong (pr-str signal)])]
+           [:span (pr-str (first signal)) " " (clojure.string/join " " (map pr-str (rest signal)))]
+           (pr-str signal))]

         (for [{:keys [id enabled? action]} (filter #(= (:signal-id %) signal-id)
                                                    action-events)]
           ^{:key id}
-          [:div {:style {:display          "flex"
-                         :margin-left      "10px"
-                         :margin-top       "3px"
-                         :padding          "2px"
-                         :background-color "rgb(60, 70, 80)"
-                         :color            (if enabled? "inherit" "grey")}}
-
-           [:div {:style    {:cursor "pointer"}
-                  :on-click #(dispatch [::on-toggle-action id])
-                  :title    "Click to enable/disable this action"}
+          [:div {:style    {:display     "flex"
+                            :margin-left "20px"
+                            :margin-top  "3px"
+                            :padding     "2px"
+                            :color       (if enabled? "inherit" "grey")
+                            :cursor      "pointer"}
+                 :on-click #(dispatch [::on-toggle-action id])}
+           [:div {:title "Click to enable/disable this action"}
             (if (coll? action)
               [:div [:strong (pr-str (first action))] " " (clojure.string/join " " (map pr-str (rest action)))]
               [:div [:strong (pr-str action)]])]
@@ -362,7 +360,7 @@
                                :margin-left      "5px"
                                :border-radius    "3px"
                                :background-color "rgb(79, 90, 101)"}
-                    :on-click #(dispatch [::on-log-action-result id])
+                    :on-click #(do (.stopPropagation %) (dispatch [::on-log-action-result id]))
                     :title    "Print model state after this action"}
               "model"])])]))])


stop collecting raw html

stop collecting raw html

--- src/clj/ceres/collector.clj
+++ src/clj/ceres/collector.clj
@@ -81,8 +81,8 @@
 (defn store-article
   "Fetch html document, extract title and store them"
   [{:keys [url content-type ts] :as expanded-url}]
-  (let [raw-html (if (= url "Not available") nil (slurp url))
-        html-title (if raw-html (-> (java.io.StringReader. raw-html) enlive/html-resource (enlive/select [:head :title]) first :content first)
+  (let [raw-html url #_(if (= url "Not available") nil (slurp url))
+        html-title "" #_(if raw-html (-> (java.io.StringReader. raw-html) enlive/html-resource (enlive/select [:head :title]) first :content first)
                        nil)]
     (mc/insert-and-return
      @db


fixed typo

fixed typo

--- src/clj/datasplash/core.clj
+++ src/clj/datasplash/core.clj
@@ -1795,7 +1795,7 @@
                        (FixedWindows/of)
                        (Window/into))]
      (apply-transform pcoll transform window-schema options)))
-  ([width step ^PCollection pcoll] (fixed-windows width {} pcoll)))
+  ([width ^PCollection pcoll] (fixed-windows width {} pcoll)))

 (defn sliding-windows
   {:doc (with-opts-docstr


add an editor for the answer

add an editor for the answer

--- src/cljs/relembra/core.cljs
+++ src/cljs/relembra/core.cljs
@@ -18,12 +18,12 @@

 (defonce conn (let [conn (d/create-conn)]
                 (d/transact! conn [{:db/id 0
-                                    :editor/text ""}])
+                                    :addq/question-text ""
+                                    :addq/answer-text ""}])
                 (p/posh! conn)
                 conn))

 (defn typeset [c]
-  (.log js/console "Updating!")
   (js/MathJax.Hub.Queue (array "Typeset" js/MathJax.Hub (r/dom-node c))))

 (defn markdown-box [text]
@@ -34,19 +34,24 @@
     {:component-did-mount typeset
      :component-did-update typeset}))

+(defn md-editor [k]
+  (let [text @(p/q conn '[:find ?c .
+                          :in $ ?k
+                          :where [0 ?k ?c]]
+                   k)]
+    [:tr
+     [:td>textarea {:rows 20
+                    :cols 80
+                    :value text
+                    :on-change (fn [e]
+                                 (p/transact! conn
+                                              [{:db/id 0 k (.. e -target -value)}]))} ]
+     [:td {:valign "top"} [mathjax-box text]]]))
+
 (defn app []
-  (let [editor-text @(p/q conn
-                          '[:find ?c .
-                            :where [0 :editor/text ?c]])]
-    [:table>tbody>tr
-      [:td>textarea {:rows 40
-                     :cols 80
-                     :value editor-text
-                     :on-change (fn [e]
-                                  (p/transact! conn
-                                               [{:db/id 0 :editor/text (.. e -target -value)}]))} ]
-      [:td {:valign "top"} [mathjax-box editor-text]]]))
-
+  [:table>tbody
+   [md-editor :addq/question-text]
+   [md-editor :addq/answer-text]])

 (defn ^:export main []
   (r/render [app]


Less indentation on MD export works better

--- src/cljs/repodoc/utils.cljs
+++ src/cljs/repodoc/utils.cljs
@@ -220,8 +220,8 @@
   (clojure.string/join (map
                          (fn [item]
                            (let [path (:path item)
-                                 parts (rest (clojure.string/split path "/"))
-                                 level (count parts)
+                                 parts (clojure.string/split path "/")
+                                 level (- (count parts) 2)
                                  base (last parts)]
                              (str
                                (clojure.string/join (repeat level "  "))


Plug the help button (ugly)

Plug the help button (ugly)

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -153,10 +153,15 @@
     (update-in [:scores looser] - (count taken))
     ))

+(defn- get-move-at
+  "Access the available moves for the provided player at the provided point"
+  [game player point]
+  (get-in game [:moves player point]))
+
 (defn play-move
   "On player playing the move [x y]"
   [{:keys [player board] :as game} point]
-  (if-let [moves (get-in game [:moves player point])]
+  (if-let [moves (get-move-at game player point)]
     (->
       (reduce apply-move game moves)
       (apply-move (take-empty-cell-move player point))
@@ -173,6 +178,8 @@
   (with-available-moves
     {:board (new-board)
      :player (rand-nth players)
+     :moves {}
+     :help false
      :scores
      {:blue 12
       :red 12
@@ -200,8 +207,12 @@
    ])

 (defn empty-cell
-  [x y]
-  (rect-cell x y "lightgray"
+  [x y game]
+  (rect-cell x y
+    (if-not
+      (and (:help game) (get-move-at game (:player game) [x y]))
+      "lightgray"
+      "lightblue")
     {:on-click #(swap! app-state play-move [x y])}
     ))

@@ -217,13 +228,15 @@
 (defn run-game []
   [:div
    [show-scores @scores @current-player]
+   [:button
+    {:on-click #(swap! app-state update :help not)} "Help"]
    (into
      [:svg#board
       {:view-box (str "0 0 " board-width " " board-height)}]
      (for [[x y] all-positions]
        ^{:key [x y]}
        (case (get-in @app-state [:board x y])
-         :empty  [empty-cell x y]
+         :empty [empty-cell x y @app-state]
          :blue [rect-cell x y "blue"]
          :red [rect-cell x y "red"]
          :green [rect-cell x y "green"]


comment

comment

--- src/clojure_fabric/core.clj
+++ src/clojure_fabric/core.clj
@@ -154,9 +154,6 @@
 ;;;;;;;;;;; Ex
 #_
 (comment
-  ;; sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout resource/creds/clojure-fabric.key -out resource/creds/clojure-fabric.crt
-  ;; mv <result-files>
-
   ;; Copy from fabcar example
   (defonce options
     {:channel-id "mychannel" :chaincode-id "fabcar" :network-url "grpc://localhost:7051"


Create new conn-lifetime setting

Create new conn-lifetime setting

This restores the original behavior for conn-max-age (for
backwards-compatibility reasons), and creates a new option called
`conn-lifetime` that governs how long idle/active connections stick
around.

--- src/com/puppetlabs/jdbc.clj
+++ src/com/puppetlabs/jdbc.clj
@@ -145,7 +145,7 @@
   [{:keys [classname subprotocol subname username password
            partition-conn-min partition-conn-max partition-count
            stats log-statements log-slow-statements
-           conn-max-age conn-idle-max-age conn-keep-alive]
+           conn-max-age conn-lifetime conn-keep-alive]
     :or   {partition-conn-min  1
            partition-conn-max  50
            partition-count     1
@@ -154,8 +154,7 @@
            ;;  be in the config file and we're manually converting it to a boolean
            log-statements      "true"
            log-slow-statements 10
-           conn-max-age        0
-           conn-idle-max-age   60
+           conn-max-age        60
            conn-keep-alive     240}
     :as   db}]
   ;; Load the database driver class
@@ -168,8 +167,7 @@
                           (.setMaxConnectionsPerPartition partition-conn-max)
                           (.setPartitionCount partition-count)
                           (.setStatisticsEnabled stats)
-                          (.setMaxConnectionAge conn-max-age, TimeUnit/MINUTES)
-                          (.setIdleMaxAgeInMinutes conn-idle-max-age)
+                          (.setIdleMaxAgeInMinutes conn-max-age)
                           (.setIdleConnectionTestPeriodInMinutes conn-keep-alive)
                           ;; paste the URL back together from parts.
                           (.setJdbcUrl (str "jdbc:" subprotocol ":" subname))
@@ -177,6 +175,7 @@
     ;; configurable without default
     (when username (.setUsername config (str username)))
     (when password (.setPassword config (str password)))
+    (when conn-lifetime (.setMaxConnectionAge config conn-lifetime TimeUnit/MINUTES))
     (when log-statements? (.setLogStatementsEnabled config log-statements?))
     (when log-slow-statements
       (.setQueryExecuteTimeLimit config log-slow-statements (TimeUnit/SECONDS)))


Fix invalid docstring

Fix invalid docstring

--- src/main/hbase_region_inspector/util.clj
+++ src/main/hbase_region_inspector/util.clj
@@ -11,7 +11,7 @@
     (.compareTo left right)))

 (defn local-ip-addresses
-  "Returns the first local IPv4 address"
+  "Returns local IPv4 addresses"
   []
   (let [addrs (->> (java.net.NetworkInterface/getNetworkInterfaces)
                    enumeration-seq


If debug interceptor was "to the left" of path,  debug would not show correct diffs.  Make path reinstate effect to fix this.

--- src/re_frame/std_interceptors.cljc
+++ src/re_frame/std_interceptors.cljc
@@ -167,7 +167,8 @@
                  (let [db-store     (db-store-key context)
                        original-db  (peek db-store)
                        new-db-store (pop db-store)
-                       context'     (assoc context db-store-key new-db-store)
+                       context'     (-> (assoc context db-store-key new-db-store)
+                                        (assoc-coeffect :db original-db))     ;; put the original db back so that things like debug work later on
                        db           (get-effect context :db ::not-found)]
                    (if (= db ::not-found)
                      context'


fix wrong arity of naming-system.vs-defined/costy? fn


Solved 5.2

Solved 5.2


Add stats before sidekiq component mount about current workers

--- src/sidequarter_frontend/core.cljs
+++ src/sidequarter_frontend/core.cljs
@@ -13,12 +13,31 @@

 (defonce app-state (atom {}))

+(defn sidekiq-stats-view [data owner]
+  (om/component
+   (dom/ul #js {:className "sidekiq-stats"}
+           (dom/li nil (str "Busy: " (data :busy)))
+           (dom/li nil (str "Enqueued: " (data :enqueued)))
+           (dom/li nil (str "Scheduled: " (data :scheduled)))
+           (dom/li nil (str "Retries: " (data :retries)))
+           (dom/li nil (str "Failed: " (data :failed)))
+           (dom/li nil (str "Processed: " (data :processed))))))
+
 (defn sidekiq-view [data owner]
-  (om/component
-   (dom/div #js {:className "sidekiq" :id (data :id)}
-            (dom/h3 nil (data :namespace))
-            (dom/p nil (data :application))
-            (dom/p nil (data :redis_url)))))
+  (reify
+    om/IWillMount
+    (will-mount [_]
+      (go
+        (let [response ((<! (api/get-stats (data :id))) :body)
+              stats (:stats response)]
+          (om/update! data [:stats] stats))))
+    om/IRender
+    (render [_]
+      (dom/div #js {:className "sidekiq" :id (data :id)}
+               (dom/h3 nil (data :application))
+               (dom/p nil (data :namespace))
+               (dom/p nil (data :redis_url))
+               (om/build sidekiq-stats-view (get data :stats {}))))))

 (defn sidekiq-list [data owner]
   (om/component


add proper authorization levels to access key routes

--- src/wombats/routes.clj
+++ src/wombats/routes.clj
@@ -105,11 +105,14 @@
            {:put game/start-game}]]]

         ["/access_keys"
-         ^:interceptors [(authorize #{:user.roles/coordinator
-                                      :user.roles/admin})]
-         {:get access-key/get-access-keys
-          :post access-key/add-access-key}
+         {:get [:get-access-keys
+                access-key/get-access-keys
+                ^:interceptors [(authorize #{:user.roles/coordinator})]]
+          :post [:add-access-key
+                 access-key/add-access-key
+                 ^:interceptors [(authorize #{:user.roles/coordinator})]]}
          ["/:access-key-id"
+          ^:interceptors [(authorize #{:user.roles/admin})]
           {:get access-key/get-access-key
            :delete access-key/delete-access-key
            :put access-key/update-access-key}]]


Removed TODO, current-file-name is part of macro.

--- src/midje/parsing/util/file_position.clj
+++ src/midje/parsing/util/file_position.clj
@@ -48,7 +48,6 @@
 (defn- basename [string]
   (last (str/split string #"/")))

-;; TODO: Make private.
 ;; clojure.test sometimes runs with *file* bound to #"NO_SOURCE.*".
 ;; This corrects that by looking up the stack. Note that it
 ;; produces a reasonable result for the repl, because the stack


We have cleaned up rstr-vec calls.

We have cleaned up rstr-vec calls.

--- src/zprint/zprint.cljc
+++ src/zprint/zprint.cljc
@@ -1508,18 +1508,11 @@
           (recur next-remaining new-out))))))

 (defn rstr-vec
-  "Create an r-str-vec with, possibly, a newline at the beginning if
-  the last thing before it is a comment."
-  ([options ind zloc r-str r-type respect-nl?] ; i132
-   (dbg-pr options "rstr-vec: respect-nl?" respect-nl?)
-   (let [nl nil #_(when (and (zcomment? (zlast zloc)) (not respect-nl?))
-              [[(str "\n" (blanks ind)) :none :indent 3]])]
-     (concat nl
-             [[r-str (zcolor-map options (or r-type r-str))
-               (or r-type :right) ind]])))
-  ([options ind zloc r-str] (rstr-vec options ind zloc r-str nil nil))
+  "Create an r-str-vec with the indent appropriate for the r-str if
+  it is preceded by a newline."
   ([options ind zloc r-str r-type]
-   (rstr-vec options ind zloc r-str r-type nil)))
+   [[r-str (zcolor-map options (or r-type r-str)) (or r-type :right) ind]])
+  ([options ind zloc r-str] (rstr-vec options ind zloc r-str nil)))

 (declare interpose-nl-hf)
 (declare fzprint-get-zloc-seq)
@@ -1531,7 +1524,7 @@
         l-str "["
         r-str "]"
         l-str-vec [[l-str (zcolor-map options l-str) :left]]
-        r-str-vec (rstr-vec options ind #_(inc ind) zloc r-str)] ; i143
+        r-str-vec (rstr-vec options ind zloc r-str)]
     (dbg-form options
               "fzprint-binding-vec exit:"
               (if (= (zcount zloc) 0)
@@ -3159,8 +3152,7 @@
         roptions options
         l-str-vec [[l-str (zcolor-map options l-str) :left]]
 	; Fudge the ind a bit for r-str-vec for anon fns: #()
-        r-str-vec (rstr-vec options (+ ind (max 0 (dec l-str-len))) #_(+ indent ind) zloc r-str ; i143
-	             nil (:respect-nl? (caller options))) ; i132
+        r-str-vec (rstr-vec options (+ ind (max 0 (dec l-str-len))) zloc r-str)
         _ (dbg-pr
             options
             "fzprint-list*:" (zstring zloc)
@@ -3786,13 +3778,10 @@
     (fzprint-binding-vec options ind zloc)
     (let [l-str-len (count l-str)
           l-str-vec [[l-str (zcolor-map options l-str) :left]]
-          #_#_r-str-vec (rstr-vec options ind zloc r-str nil respect-nl?)
           r-str-vec (rstr-vec options
-	                      (+ ind (max 0 (dec l-str-len)))  ; i143
+	                      (+ ind (max 0 (dec l-str-len)))
 			      zloc
-			      r-str
-			      nil
-			      respect-nl?) ; i132
+			      r-str)

           len (zcount zloc)
           new-options (when option-fn-first
@@ -4274,7 +4263,7 @@
   (if indent-only?
     (let [options (assoc options :map-depth (inc map-depth))
           l-str-vec [[l-str (zcolor-map options l-str) :left]]
-          r-str-vec (rstr-vec options ind #_(+ indent ind) zloc r-str)] ; i143
+          r-str-vec (rstr-vec options ind zloc r-str)]
       (if (zero? (zcount zloc))
         (concat-no-nil l-str-vec r-str-vec)
         (concat-no-nil l-str-vec
@@ -4320,7 +4309,7 @@
                      pair-seq)
           indent (count l-str)
           l-str-vec [[l-str (zcolor-map options l-str) :left]]
-          r-str-vec (rstr-vec options ind #_(+ indent ind) zloc r-str)] ; i143
+          r-str-vec (rstr-vec options ind zloc r-str)]
       (if (empty? pair-seq)
         (concat-no-nil l-str-vec r-str-vec)
         (let [_ (dbg-pr options
@@ -4441,7 +4430,7 @@
           r-str ">"
           indent (count l-str)
           l-str-vec [[l-str (zcolor-map options l-str) :left]]
-          r-str-vec (rstr-vec options ind #_(+ indent ind) zloc r-str) ; i143
+          r-str-vec (rstr-vec options ind zloc r-str)
           arg-1 (str "Atom@" (hash-identity-str zloc))
           arg-1-indent (+ ind indent 1 (count arg-1))]
       (dbg-pr options
@@ -4478,7 +4467,7 @@
             r-str ">"
             indent (count l-str)
             l-str-vec [[l-str (zcolor-map options l-str) :left]]
-            r-str-vec (rstr-vec options ind #_(+ indent ind) zloc r-str) ; i143
+            r-str-vec (rstr-vec options ind zloc r-str)
             type-str (case zloc-type
                        :future "Future@"
                        :promise "Promise@"
@@ -4523,7 +4512,7 @@
           r-str ">"
           indent (count l-str)
           l-str-vec [[l-str (zcolor-map options :fn) :left]]
-          r-str-vec (rstr-vec options ind #_(+ indent ind) zloc r-str :fn) ; i143
+          r-str-vec (rstr-vec options ind zloc r-str :fn)
           arg-1-left "Fn@"
           arg-1-right (hash-identity-str zloc)
           arg-1-indent (+ ind indent 1 (count arg-1-left) (count arg-1-right))
@@ -4567,7 +4556,7 @@
         r-str ">"
         indent (count l-str)
         l-str-vec [[l-str (zcolor-map options l-str) :left]]
-        r-str-vec (rstr-vec options ind #_(+ indent ind) zloc r-str) ; i143
+        r-str-vec (rstr-vec options ind zloc r-str)
         arg-1 "Namespace"
         arg-1-indent (+ ind indent 1 (count arg-1))]
     (dbg-pr options
@@ -4598,7 +4587,7 @@
             r-str ""
             indent (count l-str)
             l-str-vec [[l-str (zcolor-map options l-str) :left]]
-            r-str-vec (rstr-vec options ind #_(+ indent ind) zloc r-str) ; i143
+            r-str-vec (rstr-vec options ind zloc r-str)
             arg-1 (pr-str #?(:clj (class zloc)
                              :cljs (type zloc)))
             arg-1 (let [tokens (clojure.string/split arg-1 #"\.")]
@@ -4697,7 +4686,7 @@
         ; we may want to color this based on something other than
         ; its actual character string
         l-str-vec [[l-str (zcolor-map options l-str) :left]]
-        r-str-vec (rstr-vec options ind #_(+ indent ind) zloc r-str) ; i143
+        r-str-vec (rstr-vec options ind zloc r-str)
         floc
           (if (and at? (not alt-at?)) (zfirst (zsecond zloc)) (zsecond zloc))]
     (dbg-pr options


Fix tests

Fix tests

--- test/onyx/coordinator/simulation_test.clj
+++ test/onyx/coordinator/simulation_test.clj
@@ -85,6 +85,7 @@

         (testing "Attempts to delete a non-existent peer fails"
           (extensions/delete sync peer)
+          (<!! evict-ch-spy)

           (testing "A failure is raised for the second callback"
             (let [failure (<!! failure-ch-spy)]
@@ -93,7 +94,10 @@
           (testing "A failure is raised for the second delete"
             (>!! (:dead-peer-ch-head coordinator) peer)
             (let [failure (<!! failure-ch-spy)]
-              (is (= (:ch failure) :peer-death)))))
+              (is (= (:ch failure) :peer-death)))
+
+            (let [failure (<!! failure-ch-spy)]
+              (is (= (:ch failure) :evict)))))

         (testing "Acking a non-existent node fails"
           (>!! (:ack-ch-head coordinator) {:path (str (java.util.UUID/randomUUID))})
@@ -128,7 +132,8 @@

             (>!! (:ack-ch-head coordinator) {:path node-path})
             (let [failure (<!! failure-ch-spy)]
-              (is (= (:ch failure) :ack)))))))))
+              (is (= (:ch failure) :ack))))))))
+  {:eviction-delay 500000})

 (deftest plan-one-job-no-peers
   (with-system


Add create follow-up link to each entry if user is authenticated.

--- src/oc/storage/representations/entry.clj
+++ src/oc/storage/representations/entry.clj
@@ -95,6 +95,11 @@
   (hateoas/link-map "revert" hateoas/POST (str (url org-slug board-slug entry-uuid) "/revert")
     {:content-type mt/revert-request-media-type
      :accept mt/entry-media-type}))
+
+(defn- create-follow-up-link [org-slug board-slug entry-uuid follow-up-uuid]
+  (hateoas/link-map "follow-up" hateoas/POST (url org-slug board-slug entry-uuid follow-up-uuid)
+    {:accept mt/entry-media-type
+     :content-type mt/follow-up-media-type})

 (defn- complete-follow-up-link [org-slug board-slug entry-uuid follow-up-uuid]
   (hateoas/link-map "mark-complete" hateoas/POST (str (url org-slug board-slug entry-uuid follow-up-uuid) "/complete")
@@ -180,7 +185,8 @@
               ;; Indirect access via the board, rather than direct access by the secure ID
               ;; needs a share link
               (and (not secure-access?) (or (= access-level :author) (= access-level :viewer)))
-              (conj react-links (share-link org-slug board-slug entry-uuid))
+              (conj react-links (share-link org-slug board-slug entry-uuid)
+               (create-follow-up-link org-slug board-slug entry-uuid))
               ;; Otherwise just the links they already have
               :else react-links)]
     (-> (if secure-access?


Disable collectibles for beta [#4899]

Disable collectibles for beta [#4899]

Signed-off-by: Julien Eluard <c768e13f1ba4c3ebed2909a1fc1e4b50bb021a2f@gmail.com>

--- src/status_im/utils/ethereum/tokens.cljs
+++ src/status_im/utils/ethereum/tokens.cljs
@@ -389,15 +389,18 @@
                    {:symbol   :CK
                     :nft?     true
                     :name     "CryptoKitties"
-                    :address  "0x06012c8cf97bead5deae237070f9587f8e7a266d"}
+                    :address  "0x06012c8cf97bead5deae237070f9587f8e7a266d"
+                    :hidden?  true}
                    {:symbol   :EMONA
                     :nft?     true
                     :name     "Etheremon"
-                    :address  "0xB2c0782ae4A299f7358758B2D15dA9bF29E1DD99"}
+                    :address  "0xB2c0782ae4A299f7358758B2D15dA9bF29E1DD99"
+                    :hidden?  true}
                    {:symbol   :STRK
                     :nft?     true
                     :name     "CryptoStrikers"
-                    :address  "0xdcaad9fd9a74144d226dbf94ce6162ca9f09ed7e"}])
+                    :address  "0xdcaad9fd9a74144d226dbf94ce6162ca9f09ed7e"
+                    :hidden?  true}])
    :testnet
    (resolve-icons :testnet
                   [{:name     "Status Test Token"


density tests

density tests

--- src/clj/ceres_analytics/measures.clj
+++ src/clj/ceres_analytics/measures.clj
@@ -81,4 +81,6 @@

   (aprint (map #(density :full (t/date-time 2015 4 %)) (range 3 20)))

+  (aprint (mc/find-maps @db "users" {:name "SZ"}))
+
   )


Remove unused let bindings

Remove unused let bindings

Signed-off-by: Pang Yan Han <22594c345857f664c61cd411f607c4d40a9d4af9@gmail.com>

--- src/cljs/cljs_nusmods/timetable.cljs
+++ src/cljs/cljs_nusmods/timetable.cljs
@@ -541,9 +541,6 @@
   (let [rowNum    (find-free-row-for-lesson day startTime endTime)
         slotsOcc  (- endTime startTime)

-        [hourClass minuteClass]
-        (get-css-hour-minute-classes-for-time startTime)
-
         $divElem
         (create-lesson-div :moduleCode moduleCode, :moduleName moduleName,
                            :lessonType lessonType, :lessonGroup lessonGroup,


More consistent naming

More consistent naming

--- src/cljs/mdr2/productions/vubis.cljs
+++ src/cljs/mdr2/productions/vubis.cljs
@@ -14,7 +14,7 @@
                       (.append "file" js-file-value "filename.txt"))]
       {:db (-> db
                (assoc-in [:loading :vubis] true)
-               (notifications/set-button-state :vubis :vubis-file))
+               (notifications/set-button-state :vubis :upload-file))
        :http-xhrio (as-transit
                     {:method          :post
                      :headers 	     (auth/auth-header db)
@@ -110,17 +110,17 @@
  (fn [db [_ id]] (get-in db [:productions :vubis id])))

 (rf/reg-sub
- ::vubis-file
+ ::upload-file
  (fn [db _] (get-in db [:upload :vubis])))

 (rf/reg-event-db
-  ::set-vubis-file
+  ::set-upload-file
   (fn [db [_ file]] (assoc-in db [:upload :vubis] file)))

 (defn- file-input []
   (let [get-value (fn [e] (-> e .-target .-files (aget 0)))
-        save!     #(rf/dispatch [::set-vubis-file %])
-        file      @(rf/subscribe [::vubis-file])]
+        save!     #(rf/dispatch [::set-upload-file %])
+        file      @(rf/subscribe [::upload-file])]
     [:p.control
      [:div.file.has-name
       [:label.file-label
@@ -134,9 +134,9 @@
        [:span.file-name (if file (.-name file) (tr [:no-file]))]]]]))

 (defn- file-upload []
-  (let [klass (when @(rf/subscribe [::notifications/button-loading? :vubis :vubis-file]) "is-loading")
+  (let [klass (when @(rf/subscribe [::notifications/button-loading? :vubis :upload-file]) "is-loading")
         admin? @(rf/subscribe [::auth/is-admin?])
-        file @(rf/subscribe [::vubis-file])]
+        file @(rf/subscribe [::upload-file])]
     [:div.field
      [file-input]
      [:p.control


hashtagger hentes fra kommentarfeltet og legges til økta under key :tags

--- src/cljs/movement/pages/session.cljs
+++ src/cljs/movement/pages/session.cljs
@@ -387,14 +387,16 @@

 (defn store-session [event s]
   (.preventDefault event)
-  (pr (session/get :movement-session))
-  #_(let [session (session/get :movement-session)
-          new-parts (mapv (fn [part]
-                            (mapv (fn [m]
-                                    (dissoc m :category :slot-category :measurement :previous :next :image)) part))
-                          (:parts session))
-          date (if-let [date (:date session)] date (date-string))
-          session (assoc session :parts new-parts :date date)]
+  (let [session (session/get :movement-session)
+        session (if-not (:comment session) (assoc session :comment "") session)
+        new-parts (mapv (fn [part]
+                          (mapv (fn [m]
+                                  (dissoc m :category :slot-category :measurement :previous :next :image)) part))
+                        (:parts session))
+        date (if-let [date (:date session)] date (date-string))
+        session (assoc session :parts new-parts :date date)
+        hash-tags (vec (re-seq #"#[\w]+" (:comment session)))
+        session (assoc session :tags hash-tags)]
       (POST "store-session"
             {:params        {:session session
                              :user-id (:user-id (session/get :user))}


Small indentation

Small indentation

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

--- src/conexp/contrib/draw/lattices.clj
+++ src/conexp/contrib/draw/lattices.clj
@@ -109,11 +109,11 @@
                (redraw-scene scn)))

   ;; layouts
-  (let [layouts {"standard" *standard-layout-function*,
-                 "inf-add"  inf-additive-layout,
-                 "freese"   freese-layout,
+  (let [layouts {"standard"     *standard-layout-function*,
+                 "inf-add"      inf-additive-layout,
+                 "freese"       freese-layout,
                  "simple-layer" simple-layered-layout,
-                 "as-chain" as-chain},
+                 "as-chain"     as-chain},
         ^JButton fit (make-button buttons "Fit"),
         ^JComboBox combo-box (make-combo-box buttons (keys layouts))]
     (action-on fit


clean up

clean up

--- test/glasses/tree_test.clj
+++ test/glasses/tree_test.clj
@@ -21,23 +21,25 @@
              </book>
             </books>"))

+(defn shrink-tag [tag-name]
+  (travers/shrink (fn [{t :tag}] (= t tag-name))))
+
+(def xml-nodes (tree/pre-tree [:content travers/mapped]))
+(def books [xml-nodes (shrink-tag :book)])
+(def book-title [:attrs :title])
+(def book-author [:content travers/mapped (shrink-tag :author)])
+
 (deftest pre-tree-test
-  (let [xml-nodes (tree/pre-tree [:content travers/mapped])]
+  (is (= (lens/view data [xml-nodes :tag])
+         [:books :book :author :book :author]))

-    (is (= (lens/view data [xml-nodes :tag])
-           [:books :book :author :book :author]))
+  (is (= (lens/view data [books {:title book-title
+                                 :authors [book-author :attrs :name]}])
+         [{:title "my little pony" :authors ["john"]}
+          {:title "the big star"   :authors ["lars"]}]))

-    (let [books [xml-nodes (travers/shrink (fn [{t :tag}] (= t :book)))]
-          title [:attrs :title]
-          author [:content travers/mapped (travers/shrink (fn [{t :tag}] (= t :author)))]]
+  (is (= (-> data
+             (lens/update [books book-title] string/capitalize)
+             (lens/view   [books book-title]))

-      (is (= (lens/view data [books {:title title
-                                     :authors [author :attrs :name]}])
-             [{:title "my little pony" :authors ["john"]}
-              {:title "the big star"   :authors ["lars"]}]))
-
-      (is (= (-> data
-                 (lens/update [books title] string/capitalize)
-                 (lens/view   [books title]))
-
-             ["My little pony" "The big star"])))))
+         ["My little pony" "The big star"])))


Remove noop test

Remove noop test

--- test/grimoire/lib_test.clj
+++ test/grimoire/lib_test.clj
@@ -1,7 +0,0 @@
-(ns grimoire.lib-test
-  (:require [clojure.test :refer :all]
-            [grimoire.lib :refer :all]))
-
-(deftest a-test
-  (testing "FIXME, I fail."
-    (is (= 0 1))))


Add basic tests for success futures

Add basic tests for success futures

--- test/beehive/future_test.clj
+++ test/beehive/future_test.clj
@@ -1,2 +1,32 @@
-(ns beehive.future-test)
+;; Copyright 2015 Timothy Brooks
+;;
+;; 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 beehive.future-test
+  (:require [clojure.test :refer :all]
+            [beehive.future :as f])
+  (:import (net.uncontended.precipice.concurrent Eventual)))
+
+(defn remove-false [f & ks]
+  (filter (fn [func] (func f)) ks))
+
+(deftest future-status
+  (testing "Test that statuses work correctly."
+    (let [eventual (Eventual.)
+          future (f/->BeehiveFuture eventual)]
+      (is (= :pending (:status future)))
+      (is (:pending? future))
+      (.complete eventual 4)
+      (is (= :success (:status future)))
+      (is (:success? future))
+      (is (= [] (remove-false future :pending?))))))


Fix file path doc.

Fix file path doc.

--- test/cavm/benchmark/core.clj
+++ test/cavm/benchmark/core.clj
@@ -242,7 +242,7 @@
 (def ^:private argspec
   [["-o" "--output FILE" "Output file" :default "bench.edn"]
    ["-h" "--help" "Show help"]
-   ["-l" "--load" "Load benchmark params from cache in ~/.benchmark"]
+   ["-l" "--load" "Load benchmark params from cache in .benchmark"]
    ["-r" "--input FILE" "Read and print results from FILE"]
    ["-i" "--include TAG" "Run benchmarks with TAG (can be used multiple times)" :default [] :assoc-fn (fn [m k v] (update-in m [k] conj v))]])


Split benchmark from main for running in repl.

--- test/cavm/benchmark/core.clj
+++ test/cavm/benchmark/core.clj
@@ -142,38 +142,48 @@
    ["-r" "--input FILE" "Read and print results from FILE"]
    ["-i" "--include TAG" "Run benchmarks with TAG (can be used multiple times)" :default [] :assoc-fn (fn [m k v] (update-in m [k] conj v))]])

+(defn run [& args]
+  (let [{:keys [options arguments summary errors]} (parse-opts args argspec)
+        includes (map keyword (:include options))
+        test-filter (if (empty? includes)
+                      (fn [_] true)
+                      #(some (fn [pat] (or (= (:id %) pat) ((meta %) pat)))
+                             includes))]
+    (cond
+      errors (binding [*out* *err*]
+               (println (s/join "\n" errors)))
+      (:help options) (println summary)
+      (= arguments ["install"]) (install
+                                  (io/file (System/getProperty "user.home")
+                                           "xena-benchmark"))
+      (:input options) (print-results (edn/read-string (slurp (:input options))))
+      :else (let [xena (h2/create-xenadb dbfile)
+                  results (atom [])]
+              (when-let [error (mkdir (io/file "." ".benchmark"))]
+                (binding [*out* *err*]
+                  (println error)
+                  (System/exit 1)))
+              (doseq [{:keys [id desc params body]} (filter test-filter tests)]
+                (let [params (if (:load options)
+                               (edn/read-string
+                                 (slurp (io/file "." ".benchmark" (name id))))
+                               (params))
+                      result (apply body xena params)]
+                  (when (not (:load options))
+                    (spit (io/file "." ".benchmark" (name id)) (pr-str params)))
+                  (swap! results conj {:id id :result result})
+                  (println (report desc result))))
+              (spit (:output options) (pr-str @results))))))
+
+
+(comment
+  (run "benchmark" "-i" "cnv")
+  (run "benchmark")
+  (.printStackTrace *e)
+  )
+
 (defn -main [& args]
   (try
-    (let [{:keys [options arguments summary errors]} (parse-opts args argspec)
-          includes (map keyword (:include options))
-          test-filter (if (empty? includes)
-                        (fn [_] true)
-                        #(some (fn [pat] (or (= (:id %) pat) ((meta %) pat)))
-                               includes))]
-      (cond
-        errors (binding [*out* *err*]
-                 (println (s/join "\n" errors)))
-        (:help options) (println summary)
-        (= arguments ["install"]) (install
-                                    (io/file (System/getProperty "user.home")
-                                             "xena-benchmark"))
-        (:input options) (print-results (edn/read-string (slurp (:input options))))
-        :else (let [xena (h2/create-xenadb dbfile)
-                    results (atom [])]
-                (when-let [error (mkdir (io/file "." ".benchmark"))]
-                  (binding [*out* *err*]
-                    (println error)
-                    (System/exit 1)))
-                (doseq [{:keys [id desc params body]} (filter test-filter tests)]
-                  (let [params (if (:load options)
-                                 (edn/read-string
-                                   (slurp (io/file "." ".benchmark" (name id))))
-                                 (params))
-                        result (apply body xena params)]
-                    (when (not (:load options))
-                      (spit (io/file "." ".benchmark" (name id)) (pr-str params)))
-                    (swap! results conj {:id id :result result})
-                    (println (report desc result))))
-                (spit (:output options) (pr-str @results)))))
+    (apply run args)
     (finally
       (shutdown-agents))))


use core.matrix random sampling function

--- test/cortex/network_test.clj
+++ test/cortex/network_test.clj
@@ -2,6 +2,7 @@
   (:require
     [clojure.test :refer [deftest is are]]
     [clojure.core.matrix :as mat]
+    [clojure.core.matrix.random :as randm]
     [cortex.util :as util]
     [cortex.network :as net]))

@@ -38,18 +39,11 @@
     (println (format "XOR Score: %f [%d of %d]" score-percent score label-count))
     nil))

-
-(defn rand-matrix
-  [rows cols]
-  (mat/array (for [i (range rows)]
-               [(for [i (range cols)]
-                  (rand))])))
-
 (defn linear-model-test
   "Define a random dataset and create the labels from some fixed parameters so we know exactly
   what the linear model should learn."
   []
-  (let [x-data (rand-matrix 100 2)
+  (let [x-data (randm/sample-uniform [100 2])
         y-data (mat/array (mat/transpose (mat/add (mat/mmul [0.1 0.2] (mat/transpose x-data)) 0.3)))
         model (net/linear-layer :n-inputs 2 :n-outputs 1)
         loss (net/mse-loss)


Fixed irc tests

Fixed irc tests

--- test/demogorgon/test/irc.clj
+++ test/demogorgon/test/irc.clj
@@ -3,18 +3,14 @@
   (:use [clojure.test]))

 (deftest can-parse-line
-  (is (= {:prefix nil
-          :command "TEST"
-          :args ["a" "b"]} (parse-line "TEST a b")))
-  (is (= {:prefix "test.example.com"
-          :command "372"
-          :args ["foo bar"]} (parse-line ":test.example.com 372 :foo bar")))
-  (is (= {:prefix "someone!foo@example.com"
-          :command "PRIVMSG"
-          :args ["me" "hey you"]} (parse-line ":someone!foo@example.com PRIVMSG me :hey you")))
-  (is (= {:prefix "someone!foo@example.com"
-          :command "PRIVMSG"
-          :args ["me" "hey you"]} (parse-line ":someone!foo@example.com PRIVMSG me :hey you"))))
+  (is (=
+       {:prefix {:nick nil, :username nil, :host nil}, :command "TEST", :args ["a" "b"]}
+       (parse-line "TEST a b")))
+  (is (=
+       {:prefix {:nick nil, :username nil, :host "test.example.com"}, :command "372", :args ["foo bar"]}
+       (parse-line ":test.example.com 372 :foo bar")))
+  (is (=
+       {:prefix {:nick "someone", :username "foo", :host "example.com"}, :command "PRIVMSG", :args ["me" "hey you"]}
+       (parse-line ":someone!foo@example.com PRIVMSG me :hey you"))))

-


Remove a TODO

Remove a TODO

--- test/app/core_test.clj
+++ test/app/core_test.clj
@@ -61,7 +61,6 @@
               :args ["java.lang.String"]
               :javadoc "Create Magic\n@return a new piece of Magic"
               })))
-    ; TODO method invocation with args
     ; TODO static field
     ; TODO class literal
     ))


Une solution à l'exercice Phone Number de Exercism dans la track Clojure

--- exercism/clojure/phone-number/src/phone_number.clj
+++ exercism/clojure/phone-number/src/phone_number.clj
@@ -1,13 +1,16 @@
-(ns phone-number)
+(ns phone-number
+  (:require [clojure.string :as string]))

-(defn number [num-string] ;; <- arglist goes here
-      ;; your code goes here
-)
+(defn number [num-string]
+  (let [clean-string (string/replace num-string #"\(|\)|\.|\-|\s+" "")]
+    (cond
+      (= 10 (count clean-string)) clean-string
+      (and (= 11 (count clean-string)) (string/starts-with? clean-string "1")) (subs clean-string 1)
+      :else "0000000000")))

-(defn area-code [num-string] ;; <- arglist goes here
-  ;; your code goes here
-)
+(defn area-code [num-string]
+  (string/join (take 3 (seq (phone-number/number num-string)))))

-(defn pretty-print [num-string] ;; <- arglist goes here
-  ;; your code goes here
-)
+(defn pretty-print [num-string]
+  (let [clean-string (seq (phone-number/number num-string))]
+    (str "(" (string/join (take 3 clean-string)) ") " (string/join (take 3 (drop 3 clean-string))) "-" (string/join (drop 6 clean-string)))))


forgotten log suppression

forgotten log suppression

--- test/riemann/test/core.clj
+++ test/riemann/test/core.clj
@@ -176,5 +176,5 @@

              (finally
                (close-client client)
-               (logging/suppress ["riemann.server" "riemann.core"]
+               (logging/suppress ["riemann.transport.tcp" "riemann.core"]
                                  (stop core))))))


whitespace

whitespace

--- test/riemann/client_test.clj
+++ test/riemann/client_test.clj
@@ -23,7 +23,6 @@
                        (stop! core)
                        (is (thrown? java.io.IOException
                                     (send-event client {:service "test"})))
-

                        ; Restart server; should work
                        (start! core)


more integration tests to come

more integration tests to come

--- test/shuppet/integration.clj
+++ test/shuppet/integration.clj
@@ -46,4 +46,6 @@
          (client/get (url+ "/envs/poke/apps/test/clean"))
          (client/get (url+ "/envs/poke/apps/test/apply")) => (contains {:status 200})
          (client/get (url+ "/envs/poke/apps/test/apply")) => (contains {:status 200})
-         (client/get (url+ "/envs/poke/apps/test/clean"))))
+         (client/get (url+ "/envs/poke/apps/test/clean")))
+
+   (future-fact "Correct branch is read from git"))


CMR-2301: Updated echo-orbits-java dependency.

--- search-app/project.clj
+++ search-app/project.clj
@@ -14,7 +14,7 @@
                  [nasa-cmr/cmr-spatial-lib "0.1.0-SNAPSHOT"]
                  [nasa-cmr/cmr-common-app-lib "0.1.0-SNAPSHOT"]
                  [nasa-cmr/cmr-common-lib "0.1.1-SNAPSHOT"]
-                 [nasa-echo/echo-orbits-java "0.1.10"]
+                 [nasa-echo/echo-orbits-java "0.1.11"]
                  [ring/ring-core "1.4.0" :exclusions [clj-time]]
                  [ring/ring-json "0.4.0"]
                  [nasa-cmr/cmr-elastic-utils-lib "0.1.0-SNAPSHOT"]


Properties files are more efficient than parsing EDN

--- boot/pod/src/boot/tmpdir.clj
+++ boot/pod/src/boot/tmpdir.clj
@@ -8,7 +8,9 @@
     [boot.util        :as util]
     [boot.file        :as file]
     [boot.from.digest :as digest])
-  (:import [java.io File]))
+  (:import
+    [java.io File]
+    [java.util Properties]))

 (set! *warn-on-reflection* true)

@@ -102,17 +104,26 @@

 (defn- ^File manifest-file
   [cache-key]
-  (io/file (cache-dir cache-key) "manifest.edn"))
+  (io/file (cache-dir cache-key) "manifest.properties"))

 (defn- read-manifest
-  [manifile bdir]
-  (let [prep #(-> % map->TmpFile (assoc :bdir bdir))]
-    (->> manifile slurp read-string (reduce-kv #(assoc %1 %2 (prep %3)) {}))))
+  [^File manifile ^File bdir]
+  (with-open [r (io/input-stream manifile)]
+    (let [p (doto (Properties.) (.load r))]
+      (-> #(let [id   (.getProperty p %2)
+                 hash (subs id 0 32)
+                 time (Long/parseLong (subs id 33))
+                 m    {:id id :path %2 :hash hash :time time :bdir bdir}]
+             (->> m map->TmpFile (assoc %1 %2)))
+          (reduce {} (enumeration-seq (.propertyNames p)))))))

 (defn- write-manifest!
-  [manifile manifest]
-  (let [prep #(-> (into {} %) (dissoc :dir :bdir))]
-    (spit manifile (pr-str (reduce-kv #(assoc %1 %2 (prep %3)) {} manifest)))))
+  [^File manifile manifest]
+  (let [p (Properties.)]
+    (doseq [[path {:keys [id]}] manifest]
+      (.setProperty p path id))
+    (with-open [w (io/output-stream manifile)]
+      (.store p w nil))))

 (defn- apply-mergers!
   [mergers ^File old-file path ^File new-file ^File merged-file]


#13 autoremove of all info messages

#13 autoremove of all info messages

--- src/consolelifebot/core.clj
+++ src/consolelifebot/core.clj
@@ -21,8 +21,15 @@
                    (telegram/reply-with-message
                     :to (:message_id message)
                     :with-text response
-                    :at chat-id))]
-
+                    :at chat-id))
+            (reply-and-remove [response]
+              (let [reply-message @(reply response)]
+                (timer/schedule-task 60000 (do
+                                             (telegram/delete-message :with-id (:message_id reply-message)
+                                                                      :at chat-id)
+                                             (telegram/delete-message :with-id (:message_id message)
+                                                                      :at chat-id)))))]
+
       (when (:new_chat_members message)
         (reply messages/welcome))

@@ -31,20 +38,14 @@
       (when (matches "tags")
         (let [tags (tags/get-all)]
           (when (seq tags)
-            (let [reply-message @(reply (s/join " " tags))]
-              (timer/schedule-task 60000 (do
-                                          (telegram/delete-message :with-id (:message_id reply-message)
-                                                                   :at chat-id)
-                                          (telegram/delete-message :with-id
-                                                                   (:message_id message)
-                                                                   :at chat-id)))))))
-
+            (reply-and-remove (s/join " " tags)))))
+
       (doseq [[command response]
               [["about" messages/about]
                ["rules" messages/rules]
                ["list" messages/console-list]]]
         (when (matches command)
-          (reply response))))))
+          (reply-and-remove response))))))

 (defn -main
   [& args]


Minor method name fixes on postgresql main ns.

--- src/continuo/postgresql.clj
+++ src/continuo/postgresql.clj
@@ -13,24 +13,21 @@
 ;; limitations under the License.

 (ns continuo.postgresql
+  "A postgresql transactor engine."
   (:require [promissum.core :as p]
             [suricatta.core :as sc]
-            [continuo.executor :as exec]
-            [continuo.database :as db]
-            [continuo.protocols :as p]
+            [continuo.impl :as impl]
             [continuo.util :as util]
-            [continuo.postgresql.bootstrap :as bootstrap])
-  (:import java.net.URI))
+            [continuo.postgresql.bootstrap :as bootstrap]))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Types
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (defrecord Transactor [context]
-  p/ITransactorInternal
+  impl/ITransactorInternal
   (-initialize [it]
-    ;; (exec/submit #(bootstrap/initialize it)))
-    )
+    (bootstrap/initialize it))
   (-create [it]
     (bootstrap/create it)))

@@ -38,7 +35,7 @@
 ;; Connection Management
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(defmethod db/connect :postgresql
-  [^URI uri options]
+(defmethod impl/connect :postgresql
+  [uri options]
   (let [options (merge options (util/parse-params uri))]
     (Transactor. (bootstrap/connect options))))


Use when modifier for exclusions

Use when modifier for exclusions

--- src/docker_clojure/core.clj
+++ src/docker_clojure/core.clj
@@ -99,11 +99,9 @@
     (assoc variant :dockerfile filename)))

 (defn generate-dockerfiles! []
-  (let [variants (image-variants base-images distros (keys build-tools))]
-    (remove nil?
-            (for [variant variants]
-              (when-not (exclude? exclusions variant)
-                (generate-dockerfile variant))))))
+  (for [variant (image-variants base-images distros (keys build-tools))
+        :when (not (exclude? exclusions variant))]
+    (generate-dockerfile! variant)))

 (defn -main [& args]
   (case (first args)


Capture output during r.h.dump test.

Capture output during r.h.dump test.

--- ring-devel/test/ring/handler/dump_test.clj
+++ ring-devel/test/ring/handler/dump_test.clj
@@ -13,7 +13,8 @@
    :request-method :get})

 (deftest test-handle-dump
-  (let [{:keys [status]} (handle-dump post-req)]
-    (is (= 200 status)))
-  (let [{:keys [status]} (handle-dump get-req)]
-    (is (= 200 status))))
+  (binding [*out* (java.io.StringWriter.)]
+    (let [{:keys [status]} (handle-dump post-req)]
+      (is (= 200 status)))
+    (let [{:keys [status]} (handle-dump get-req)]
+      (is (= 200 status)))))


Add extracted native libraries from jars to the list of native libraries to be packaged in the apk

--- src/leiningen/droid/sdk.clj
+++ src/leiningen/droid/sdk.clj
@@ -15,6 +15,12 @@
     (.newInstance constructor (into-array [(io/file apk-name) (io/file res-path)
                                            (io/file dex-path) nil nil]))))

+(defn add-unpackaged-natives [other-native-paths]
+  (let [unpackaged-natives-path "target/native/linux/"]
+    (if (.exists (io/file unpackaged-natives-path))
+      (conj other-native-paths unpackaged-natives-path)
+      other-native-paths)))
+
 (defn create-apk
   "Delegates APK creation to ApkBuilder class in sdklib.jar."
   [{{:keys [sdk-path out-res-pkg-path out-dex-path native-libraries-paths]}
@@ -22,13 +28,14 @@
   ;; Dynamically load sdklib.jar
   (pomegranate/add-classpath (io/file sdk-path "tools" "lib" "sdklib.jar"))
   (let [apkbuilder-class (Class/forName "com.android.sdklib.build.ApkBuilder")
-        apkbuilder (make-apk-builder apk-name out-res-pkg-path out-dex-path)]
+        apkbuilder (make-apk-builder apk-name out-res-pkg-path out-dex-path)
+        all-native-libraries (add-unpackaged-natives native-libraries-paths)]
     (when (seq resource-jars)
       (debug "Adding resource libraries: " resource-jars))
     (doseq [rj resource-jars]
       (.addResourcesFromJar apkbuilder rj))
-    (when (seq native-libraries-paths)
-      (debug "Adding native libraries: " native-libraries-paths))
-    (doseq [lib native-libraries-paths]
+    (when (seq all-native-libraries)
+      (debug "Adding native libraries: " all-native-libraries))
+    (doseq [lib all-native-libraries]
       (.addNativeLibraries apkbuilder ^File (io/file lib)))
     (.sealApk apkbuilder)))


apply debugged funcs

apply debugged funcs

--- logging-macro-demo/src/logging_macro_demo/core.clj
+++ logging-macro-demo/src/logging_macro_demo/core.clj
@@ -73,7 +73,24 @@
                              last-statement)]
     `(do
        (eval '~new-function))))
+
+(my-debug-sm
+ (defn apply-interest
+  "Compound interest formula."
+   [years interest-rate input-balance]
+   (* input-balance (math/expt (+ 1 (float interest-rate)) years))))
+
+(my-debug-sm
+ (defn round-and-format
+  "Set decimal places and currency formatting."
+   [val]
+   (format-currency (round val 2))))
+
+(def apply-interest-curry (partial apply-interest 1 0.4))
+
 (defn -main
-  "I don't do a whole lot ... yet."
+  "Run the macro demo for function logging by a syntax tree walk."
   [& args]
-  (println "Hello, World!"))
+  (println (add-meaning 1))
+  (println (map round-and-format
+                (map apply-interest-curry balances))))