Remove superfluous broadcast function from control

--- src/engulf/control.clj
+++ src/engulf/control.clj
@@ -13,13 +13,9 @@

 (lc/siphon relay/emitter emitter)

-(defn broadcast
-  [name body]
-  (lc/enqueue n-manager/receiver {"name" name "body" body}))
-
 (defn stop-job
   []
-  (broadcast "job-stop" nil)
+  (lc/enqueue n-manager/receiver {"name" "job-stop"})
   (relay/stop-job)
   (jmgr/stop-job))

@@ -35,7 +31,8 @@
   (log/info (str "Starting job with params: " params))
   (let [job (jmgr/register-job formula-name params)
         start-res @(relay/start-job job)]
-    (broadcast "job-start" (dissoc job :results))
+    (lc/enqueue n-manager/receiver {"name" "job-start"
+                                    "body" (jmgr/serializable job)})
     (jmgr/record-results job (:results-ch start-res))
     (lc/on-closed (:results-ch start-res) #(stop-job))
     start-res))


Don't use nprosser-key anymore

Don't use nprosser-key anymore

--- src/exploud/asgard.clj
+++ src/exploud/asgard.clj
@@ -53,7 +53,7 @@
 (def default-key-name
   "The default SSH key we'll use on the instances that are launched. This key
    will be replaced by our usual security measures so isn't really useful."
-  "nprosser-key")
+  "exploud")

 (def all-create-new-asg-keys
   "A set of the all parameters we can provide to Asgard when creating a new


Layout manager #41

Layout manager #41

--- src/flatgui/layout.clj
+++ src/flatgui/layout.clj
@@ -86,7 +86,7 @@
           (= elem-count 0) (throw (IllegalArgumentException. (str "Wrong layout cfg (nothing but flags specified): " v)))))

    :else
-   (throw (IllegalArgumentException. (str "Wrong layout cfg: " v)))))
+   (throw (IllegalArgumentException. (str "Wrong layout cfg: '" (if (nil? v) "<nil>" v) "'")))))

 (defn cfg->flags [cfg]
   (let [_ (println "------" cfg)]
@@ -100,8 +100,10 @@

 (declare flattenmap)

-(defn flatten-mapper [e]
-  (if (coll? e) (flattenmap e) [e]))
+(defn- node? [e] (and (coll? e) (not (map? e))))
+
+(defn- flatten-mapper [e]
+  (if (node? e) (flattenmap e) [e]))

 (defn flattenmap [coll]
   (mapcat flatten-mapper coll))
@@ -138,8 +140,11 @@
       nil)))

 (fg/defevolverfn :coord-map
- (if-let [layout (map cmd->smile (get-property [:this] :layout))]
-   (flagnestedvec->coordmap (map-direction component layout \- \< m/x))))
+ (let [usr-layout (get-property [:this] :layout)
+       ;TODO this does not work layout (if usr-layout (map cmd->smile usr-layout))
+       layout usr-layout]
+   (if layout
+     (flagnestedvec->coordmap (map-direction component layout \- \< m/x)))))

 (fg/defevolverfn :position-matrix
   (if-let [coord-map (get-property [] :coord-map)]


fixed multiple files downloading at once

--- src/frontend/core.cljs
+++ src/frontend/core.cljs
@@ -9,7 +9,8 @@
                           :messages []
                           :upload-progress nil
                           :data-uploaded 0
-                          :current-file-download nil}))
+                          :current-file-download nil
+                          :current-download-stream-id nil}))

 (enable-console-print!)

@@ -86,14 +87,18 @@

 (.on (new js/ss socket) "file-to-client"
   (fn [stream]
-    (swap! app-state assoc :current-file-download (new js/Blob))
+    (if (nil? (:current-download-stream-id @app-state)) (fn []
+      (swap! app-state assoc :current-download-stream-id (.-id stream))
+      (swap! app-state assoc :current-file-download (new js/Blob))))
     (.on stream "data"
       (fn [blob-chunk]
-        (println "H")
-        (swap! app-state assoc :current-file-download
-          (new js/Blob #js [(:current-file-download @app-state) blob-chunk]))))
+        (if (= (.-id stream) (:current-download-stream-id @app-state))
+          (println "H")
+          (swap! app-state assoc :current-file-download
+            (new js/Blob #js [(:current-file-download @app-state) blob-chunk])))))
     (.on stream "end"
       (fn []
+        (if (= (.-id stream) (:current-download-stream-id @app-state))
         (println (.-size (:current-file-download @app-state)))
         (let [reader (new js/FileReader)
               blob   (:current-file-download @app-state)]
@@ -105,7 +110,8 @@
               (.attr (js/$ "#current-track") "src" (.-result reader))
               (println (.attr (js/$ "#current-track") "src"))
               (.load (.getElementById js/document "audio-tag"))
-              (.play (.getElementById js/document "audio-tag")))))))))
+              (.play (.getElementById js/document "audio-tag"))
+              (swap! app-state assoc :current-download-stream-id nil)))))))))

 (.change (js/$ "#file_upload_input")
   (fn [e]


Don't animate when selecting initial node

--- src/graphito/core.cljs
+++ src/graphito/core.cljs
@@ -341,11 +341,12 @@
                         :projection :fisheye
                         :camera-pos (v/copy pos)))

-(defn select-and-zoom-to-node! [current-state node]
-  (swap-state-animated! current-state assoc
-                        :projection :fisheye
-                        :camera-pos (v/copy (:pos node))
-                        :selected-node node))
+(defn select-and-zoom-to-node! [current-state node & {:keys [disable-animation?]}]
+  (let [swap-fn (if disable-animation? swap-state! swap-state-animated!)]
+    (swap-fn current-state assoc
+             :projection :fisheye
+             :camera-pos (v/copy (:pos node))
+             :selected-node node)))

 ;; JSON loading and parsing

@@ -661,7 +662,8 @@
           (set-graph! current-state (parse-js-graph js-graph))
           (when initial-selection
             (select-and-zoom-to-node! current-state
-                                      ((:nodes @current-state) initial-selection))))]
+                                      ((:nodes @current-state) initial-selection)
+                                      :disable-animation? true)))]
     (prevent-focus-on-detail-button! detail-button)
     (sync-on-window-size! current-state)
     (cond


Add init-tasks function

Add init-tasks function

--- src/todo_repl_webapp/handler.clj
+++ src/todo_repl_webapp/handler.clj
@@ -18,14 +18,17 @@
   (dosync (alter *tasks-ref* assoc-in [index :status] :complete)))

 ;; Initialize some tasks
-(add-new-task {:name "Go get some milk"
-               :context "shopping"
-               :due "tomorrow"})
-(add-new-task {:name "Go get new shoes"
-               :context "shopping"
-               :due "friday"})
-(add-new-task {:name "Clean the kitchen sink"
-               :context "cleaning"})
+(defn init-tasks [& _]
+  (do
+    (add-new-task {:name "Go get some milk"
+                   :context "shopping"
+                   :due "tomorrow"})
+    (add-new-task {:name "Go get new shoes"
+                   :context "shopping"
+                   :due "friday"})
+    (add-new-task {:name "Clean the kitchen sink"
+                   :context "cleaning"})))
+(init-tasks)

 (defroutes app-routes
   (GET "/" [] (do (println "get /")


compile-html now almost works a little more

--- src/hiccup.clj
+++ src/hiccup.clj
@@ -81,7 +81,7 @@
   [tag]
   (list "</" (as-str tag) ">"))

-(defn- remove-attrs
+(defn remove-attrs
   "Remove optional attribute map from content."
   [content]
   (if (map? (first content))
@@ -98,8 +98,7 @@
     (pre-compile `(make-start-tag ~tag))
     (pre-compile `(make-tag-attrs ~(first content)))
     (list ">")
-    (for [item (remove-attrs content)]
-      (compile-html item))
+    (mapcat compile-html (remove-attrs content))
     (pre-compile `(make-end-tag ~tag))))

 (defmethod compile-html IPersistentList
@@ -108,9 +107,9 @@

 (defmethod compile-html :default
   [x]
-  (pre-compile `(str ~x)))
+  (list (pre-compile `(str ~x))))

-(defn- collapse-strs
+(defn collapse-strs
   "Concatenate adjacent strings in a sequence."
   [coll]
   (reduce
@@ -121,7 +120,7 @@
     '()
     (reverse coll)))

-(defn- build-str-concat
+(defn build-str-concat
   "Build code to string concatenate a sequence of forms."
   [coll]
   (let [buffer (gensym "buffer")]
@@ -134,5 +133,4 @@
   "Efficiently compile a Clojure data structure to HTML"
   [& content]
   (build-str-concat
-    (for [item content]
-      (compile-html item))))
+    (mapcat compile-html content)))


handling cases when we dont have a match

--- src/kvm/networking.clj
+++ src/kvm/networking.clj
@@ -56,7 +56,7 @@
    (let [uuid (gen-uuid) nat (nat-ip c id node)
          cmd (<< "ssh ~{ignore-authenticity} ~{user}@~{nat} -C 'ifconfig ~{public-nic}'")]
      (execute cmd node :out-fn (collect-log uuid))
-     (if-let [ip (second (re-matches #".*addr\:(\d+\.\d+\.\d+\.\d+).*" (inet-line (get-log uuid))))]
+     (if-let [ip (second (re-matches #".*addr\:(\d+\.\d+\.\d+\.\d+).*" (or (inet-line (get-log uuid)) "")))]
         ip
         (throw+ {:type ::kvm:networking} "Failed to grab domain public IP")
         )))


comments

comments

--- src/launchpad/core.clj
+++ src/launchpad/core.clj
@@ -1,10 +1,13 @@
 (ns launchpad.core)
 (use '[overtone.studio.midi] '[overtone.midi :only [midi-out]])

-(defn find-launchpad []
+(defn find-launchpad
+  "Find the first connected Launchpad"
+  []
   (midi-find-connected-receiver "Launchpad"))

 (defn mk-color
+  "Make a color. red and green range from 0 to 3"
   [r g]
   (bit-or
    r
@@ -12,17 +15,25 @@
    (bit-shift-left g 4)))

 (defn light
+  "light a pad at x,y (0,0 is top-left). Use mk-color for c"
   [m x y c]
   (midi-note-on
    m
    (+ x (* 0x10 y))
    c))

-(defn unlight [m x y]
+(defn unlight
+  "unlight a pad"
+  [m x y]
   (light m x y 0))

-(defn reset [m] (midi-control m 0 0))
+(defn reset
+  "reset the launchpad"
+  [m] (midi-control m 0 0))

-  (defn all-on "brightness is 1, 2 or 3"
-    [m brightness]
-    (midi-control m 0 (+ 124 brightness)))
+(defn all-on
+  "brightness is 1, 2 or 3"
+  [m brightness]
+  (midi-control m 0 (+ 124 brightness)))
+
+


reset beat phase fn

reset beat phase fn

--- src/lights/my_show.clj
+++ src/lights/my_show.clj
@@ -183,9 +183,7 @@
 (defn reset-beat
   "Reset beat of the show"
   []
-  (:rhythm/metro-start (:metronome my-show) 1)
-  (:rhythm/metro-bar-start (:metronome my-show) 1)
-  (:rhythm/metro-phase-start (:metronome my-show) 1)
+  (afterglow.rhythm/metro-start (:metronome *show*) 1)
 )

 (fiat-lux)


Font settings is global, not editor specific - #1460

--- src/lt/objs/style.cljs
+++ src/lt/objs/style.cljs
@@ -54,7 +54,7 @@
                               ))

 (behavior ::font-settings
-                  :desc "Editor: Font settings"
+                  :desc "App: Font settings"
                   :params [{:label "Font family"
                             :type :string}
                            {:label "Size (pt)"


modified exclude param error message inputs

--- test/cmr/system_int_test/search/granule_search_test.clj
+++ test/cmr/system_int_test/search/granule_search_test.clj
@@ -266,6 +266,7 @@
            nil 0.7 [gran4 gran5]
            -70.0 31.0 [gran1 gran2 gran4 gran5]))))

+
 ;; exclude granules by echo_granule_id or concept_id (including parent concept_id) params
 (deftest exclude-granules-by-echo-granule-n-concept-ids
   (let [coll1 (d/ingest "CMR_PROV1" (dc/collection {}))
@@ -307,10 +308,10 @@
       (let [srch1 {:exclude {:dataset-id [gran2-cid]}, :echo_granule_id [gran1-cid gran2-cid gran3-cid]}
             srch2 {:exclude {:dataset-id [gran2-cid] :concept-id [gran1-cid]}, :echo_granule_id [gran1-cid gran2-cid]}]
         (is (= {:status 422
-                :errors [(msg/invalid-exclude-param-msg :entry-title)]}
+                :errors [(msg/invalid-exclude-param-msg #{:entry-title})]}
                (search/find-refs :granule srch1)))
         (is (= {:status 422
-                :errors [(msg/invalid-exclude-param-msg)]}
+                :errors [(msg/invalid-exclude-param-msg #{:entry-title})]}
                (search/find-refs :granule srch2)))))))

 ;; Find granules by echo_granule_id, echo_collection_id and concept_id params


rename deps to libs, other tweaks

rename deps to libs, other tweaks

--- src/migae/boot_gae.clj
+++ src/migae/boot_gae.clj
@@ -212,7 +212,7 @@
   "copy assets to build-dir"
   [v verbose bool "Print trace messages"
    t type TYPE kw "type to move"
-   o odir ODIR str "output dir"]
+   o odir ODIR str "output dir (default: './')"]
 (let [regex (re-pattern (condp = type
                           :clj  #"(.*clj$)"
                           :cljs  #"(.*cljs$)"
@@ -260,7 +260,7 @@
     (comp
      (core/with-pre-wrap fs
        (let [tmp-dir (core/tmp-dir!)
-             _ (println "odir: " odir)
+             ;; _ (println "odir: " odir)
              out-file (doto (io/file tmp-dir (str odir "/" out-path)) io/make-parents)]
          (spit out-file content)
          (-> fs (core/add-resource tmp-dir) core/commit!))))))
@@ -366,6 +366,13 @@
     #_(. method invoke nil invoke-args))
     )

+(core/deftask libs
+  "" []
+  (comp
+   (builtin/uber :as-jars true)
+   (builtin/sift :include #{#"jar$"} :move {#"(.*jar$)" "WEB-INF/lib/$1"})
+   (builtin/target :dir #{"build"} :no-clean true)))
+
 (core/deftask deps
   "Install dependency jars in <build-dir>/WEB-INF/lib"
   [v verbose bool "Print traces"]
@@ -499,7 +506,7 @@

 (core/deftask servlets
   "aot compile master servlet file"
-  [c clj bool "Save intermediate generated .clj file"
+  [a save bool "Save intermediate generated .clj file"
    d odir DIR str "output dir for generated class files"
    n namespace NS str "namespace to aot"
    s servleter SERVELETER str "namespace for master servlet generator"
@@ -515,7 +522,7 @@
                                ]
     ;; (println "aot-ns: " aot-ns)
     ;; (println "STENCIL: " content)
-    (println "mv arg: " mv-arg)
+    ;; (println "mv arg: " mv-arg)
     (comp
      ;; (builtin/sift :move mv-arg)
      ;; (builtin/show :fileset true)
@@ -524,20 +531,19 @@
        (let [tmp-dir (core/tmp-dir!)
              odir (if odir odir classes-dir)
              servlet-master (str (str/replace servlet-ns #"\.|-" {"." "/" "-" "_"}) ".clj")
-             _ (println "servlet-master: " servlet-master)
+             ;; _ (println "servlet-master: " servlet-master)
              out-file (doto (io/file tmp-dir
                                      ;;(str odir "/"
                                      servlet-master ;;)
                         ) io/make-parents)
              ]
-         (println "servlet-ns: " servlet-ns)
+         ;; (println "servlet-ns: " servlet-ns)
          (spit out-file content)
          (-> fileset (core/add-source tmp-dir) core/commit!)))
      ;; Step 2: compile it
-     (builtin/aot :namespace #{servlet-ns}))))
+     (builtin/aot :namespace #{servlet-ns})
 ;;                  :dir (if odir odir "./" )))))
-
-     ;; (builtin/sift :include (if clj #{#".*\.class"  #"\.clj$"} #{#"\.class$"}))
+      (builtin/sift :include (if save #{#".*\.class"  #"\.clj$"} #{#"\.class$"})))))
      ;; (builtin/target :dir #{classes-dir}
      ;;                 :no-clean false)
      ;;   #_(builtin/show :fileset true)


fn to extend trial

fn to extend trial

--- src/pc/models/plan.clj
+++ src/pc/models/plan.clj
@@ -24,6 +24,10 @@

 (defn add-coupon [plan coupon-ident]
   @(d/transact (pcd/conn) [[:db/add (:db/id plan) :discount/coupon coupon-ident]]))
+
+(defn extend-trial [plan days]
+  @(d/transact (pcd/conn) [[:db/add (:db/id plan) :plan/trial-end (clj-time.coerce/to-date
+                                                                   (time/plus (time/now) (time/days days)))]]))

 (def coupons
   #{{:coupon/stripe-id "product-hunt"


playing around with h-box

playing around with h-box

--- src/re_demo/h_box.cljs
+++ src/re_demo/h_box.cljs
@@ -19,24 +19,23 @@
                    {:id :auto   :label "auto"}
                    {:id :none   :label "none"}
                    {:id :px     :label "px"}
-                   {:id :%      :label "%"}])
+                   {:id :%      :label "num"}])

-(def config (reagent/atom
+(def demo-state (reagent/atom
               {:hbox {:width   "500px"
                      :height  "100px"
                      :justify :start
                      :gap     "4px"}
-               :box1 {:size "auto"
-                      :min-width "200px"
-                      ; :height  "20px"
-                      :align-self :end
+               :box1 {:size "none"
+                      ; :min-width "200px"
+                      ; :height  "200px"
+                      :align-self :center
                       :text "Box1"}
-               :box2 {:size "0 1 100px"
-
+               :box2 {:size "0 1 50px"
                       :text "Box2"}
                :box3 {:size "0 1 100px"
                       :text "Box3"}
-               :box4 {:size "0 1 100px"
+               :box4 {:size "1 1 100px"
                      :text "Box4"}}))

 (defn merge-named-params
@@ -45,12 +44,11 @@
       ;; =>  [box :a 1 :b 2  :c 3]
   "
   [v m]
-  (let [not-nil-value #(identity (second %))]
-    (->> m
-         (filter not-nil-value)
-         (reduce concat [])
-         (into v)
-         vec)))
+  (->> m
+       (filter second)        ;; remove nil valued members
+       (reduce concat [])
+       (into v)
+       vec))

 (defn make-box
@@ -68,85 +66,51 @@
       (conj [:div {:style rounded-panel} (:text box-parameters)])))

+
 (defn demo
+  "creates the hiccup for the real demo, with its child boxes and all"
+  []
+  (-> [h-box
+       :padding  "4px"
+       :style {:border "dashed 1px red"}]
+      (merge-named-params (:hbox @demo-state))
+      (conj :children)
+      (conj [(make-box (:box1 @demo-state))
+             (make-box (:box2 @demo-state))
+             (make-box (:box3 @demo-state))
+             (make-box (:box4 @demo-state))])))
+
+(defn code-row
+  [indent text & args]
+  (let  [mouse-over   (reagent/atom false)]
+    (fn [indent text & args]
+    [h-box
+     :attr  {:on-mouse-over  #(do (reset! mouse-over true) (println "over") nil)
+             :on-mouse-out   #(do (reset! mouse-over false) nil)
+             }
+     :style {:background-color (if @mouse-over "#f0f0f0")}
+     :children [[gap :size (str (* indent 10) "px")]   ;; leading indent
+                [:span {:style {:flex "0 0 100px"}} text]
+                args]])))
+
+
+(defn editable-code
+  "Shows the code in a way that values can be edited, allowing for an interactive demo."
   []
   [v-box
-   :gap      "10px"
-   :children [[title2 "Demo"]
-              (-> [h-box
-                    :padding  "4px"
-                    :style {:border "dashed 1px red"}]
-                  (merge-named-params (:hbox @config))
-                  (conj :children)
-                  (conj [(make-box (:box1 @config))
-                         (make-box (:box2 @config))
-                         (make-box (:box3 @config))
-                         (make-box (:box4 @config))]))]])
+   :children [[gap :size "20px"]
+              [p "the demo above is produced by the code below"]
+              [v-box
+               :style {:font-family      "Consolas, \"Courier New\", monospace"
+                       :background-color "#f5f5f5"
+                       :border           "1px solid lightgray"
+                       :border-radius    "4px"
+                       :padding          "8px"}
+               :children [[code-row 0 "[h-box"        ]
+                          [code-row 2 "  :size"      "\"1\"" ]
+                          [code-row 2 "  :gap"     "\"1px\"" ]
+                          [code-row 2 "  :children"  " ["]]]]])

-
-
-#_(defn demo
-  []
-  (let [container-size (reagent/atom 500)
-        gap-size       (reagent/atom 0)
-        box1-db        (reagent/atom {:size :%  :px 100 :% 60 :show? true})
-        box2-db        (reagent/atom {:size :px :px 100 :% 50 :show? true})
-        box3-db        (reagent/atom {:size :%  :px 100 :% 40 :show? true})]
-    [v-box
-     :gap      "10px"
-     :children [[title2 "Demo"]
-                #_[p "Descriptions removed for now."]
-                [p "An h-box is normally invisible, but for this demo we've styled it with a dashed red border."]
-                ;[p "Each child box component (which includes an 4px magin) describes it's own settings and allows you to modify them."]
-                #_[p "Dashed red lines have been added between the boxes."]
-                [title :level :level3 :label "Container (h-box/v-box) - red border"]
-                [h-box
-                 :gap      "10px"
-                 :children [[box :align :start :width "100px" :child [:span "h/v-box " [:code ":w/:h"]]]
-                            [slider
-                             :model     container-size
-                             :min       0
-                             :max       800
-                             :width     "200px"
-                             :on-change #(reset! container-size %)]
-                            [:span @container-size "px"]]]
-                [h-box
-                 :gap      "10px"
-                 :children [[box :align :start :width "100px" :child [:span "gap " [:code ":size"]]]
-                            [slider
-                             :model     gap-size
-                             :min       0
-                             :max       50
-                             :width     "200px"
-                             :on-change #(reset! gap-size %)]
-                            [:span @gap-size "px"]]]
-                [gap :size "10px"]
-                [title :level :level3 :label "Children (box) - blue border at end of box"]
-                [box-controls "Box1" box1-db]
-                [box-controls "Box2" box2-db]
-                [box-controls "Box3" box3-db]
-                [gap :size "10px"]
-                [h-box
-                 :width    (px @container-size)
-                 :height   "100px"
-                 :gap      (px @gap-size)
-                 :style    {:border "dashed 1px red"}
-                 :children [(when (:show? @box1-db)
-                              [box
-                               :size (box-size @box1-db)
-                               :style h-box-style
-                               :child [:div {:style rounded-panel} "Box 1" [:br] ":size " (box-size @box1-db)]])
-                            (when (:show? @box2-db)
-                              [box
-                               :size (box-size @box2-db)
-                               :style h-box-style
-                               :child [:div {:style rounded-panel} "Box 2" [:br] ":size " (box-size @box2-db)]])
-                            (when (:show? @box3-db)
-                              [box
-                               :size (box-size @box3-db)
-                               :style h-box-style
-                               :child [:div {:style rounded-panel} "Box 3" [:br] ":size " (box-size @box3-db)]])]]
-                ]]))

   (defn panel
@@ -169,16 +133,16 @@
                                :children [[title2 "Notes"]
                                           [status-text "Stable"]
                                           [p "h-box is a container which lays out its  " [:code ":children"] " in a single horizontal row."]
-                                          [p
-                                           "To understand it fully and use it powerfully, you must have a good understanding of the "
-                                           [hyperlink-href
-                                            :label "CSS Flexbox"
-                                            :href "https://css-tricks.com/snippets/css/a-guide-to-flexbox"
-                                            :target "_blank"]
-                                           " layout system."]
-                                          [p "The actual layout is a function of the " [:code ":size"] " of the container and the " [:code ":size"] " provided for each of the children."]
+
+                                          [p "The " [:span.bold "Layout"] " page (look LHS) describes the importance of " [:span.bold ":size"] "The actual layout is a function of the " [:code ":size"] " of the container and the " [:code ":size"] " provided for each of the children."]
                                           [p "Todo: Nestability with v-box"]

                                           [args-table h-box-args-desc]]]
-                              [demo]]]
+                              [v-box
+                               :gap      "10px"
+                               :width    "500px"
+                               :children [[title2 "Demo"]
+                                          [demo]
+                                          [editable-code]]]
+                              ]]
                   [gap :size "30px"]]]))


fixes #400

fixes #400

--- src/re_frame/cofx.cljc
+++ src/re_frame/cofx.cljc
@@ -83,13 +83,17 @@
     :id      :coeffects
     :before  (fn coeffects-before
                [context]
-               (update context :coeffects (get-handler kind id)))))
+               (if-let [handler (get-handler kind id)]
+                 (update context handler :coeffects)
+                 (console :error "No cofx handler registered for \"" id "\"")))))
   ([id value]
    (->interceptor
      :id     :coeffects
      :before  (fn coeffects-before
                 [context]
-                (update context :coeffects (get-handler kind id) value)))))
+                (if-let [handler (get-handler kind id)]
+                  (update context :coeffects handler value)
+                  (console :error "No cofx handler registered for \"" id "\""))))))

 ;; -- Builtin CoEffects Handlers  ---------------------------------------------


Ready to deploy bootstrap 0.2.0

Ready to deploy bootstrap 0.2.0

--- modules/bootstrap/project.clj
+++ modules/bootstrap/project.clj
@@ -1,6 +1,6 @@
 ;; Copyright © 2014 JUXT LTD.

-(defproject juxt.modular/bootstrap "0.2.0-SNAPSHOT"
+(defproject juxt.modular/bootstrap "0.2.0"
   :description "A modular extension that HTML rendering of components with the Twitter Bootstrap library."
   :url "https://github.com/juxt/modular/tree/master/modules/bootstrap"
   :license {:name "The MIT License"


Update library dependencies and release clostache

--- modules/clostache/project.clj
+++ modules/clostache/project.clj
@@ -1,11 +1,11 @@
 ;; Copyright © 2014 JUXT LTD.

-(defproject juxt.modular/clostache "0.6.0"
+(defproject juxt.modular/clostache "0.6.1"
   :description "A modular extension that provides a Clostache templater for juxt.modular/template"
   :url "https://github.com/juxt/modular/tree/master/modules/clostache"
   :license {:name "The MIT License"
             :url "http://opensource.org/licenses/MIT"}
-  :dependencies [[com.stuartsierra/component "0.2.1"]
-                 [de.ubercode.clostache/clostache "1.3.1"]
-                 [juxt.modular/template "0.6.0"]
+  :dependencies [[com.stuartsierra/component "0.2.2"]
+                 [de.ubercode.clostache/clostache "1.4.0"]
+                 [juxt.modular/template "0.6.2"]
                  ])


Add mailgun output plugin to riemann.config ns

Add mailgun output plugin to riemann.config ns so it is available within
riemann configuration and explicit `require` statements are not
necessary.

--- src/riemann/config.clj
+++ src/riemann/config.clj
@@ -43,6 +43,7 @@
         [cemerick.pomegranate :only [add-dependencies]]
         [riemann.shinken :only [shinken]]
 	[riemann.xymon :only [xymon]]
+        [riemann.mailgun :only [mailgun]]
         riemann.streams))

 (def core "The currently running core."


+(defn lexicon-for-generation) and use the same for all Italian language models

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -470,6 +470,14 @@
      {})
    (if (get-in tree [:head])
      {:head (morph-walk-tree (get-in tree [:head]))})))
+
+(defn lexicon-for-generation [lexicon]
+  (into {}
+        (for [[k v] lexicon]
+          (let [filtered-v
+                (filter #(not (= false (get-in % [:generate-with] true))) v)]
+            (if (not (empty? filtered-v))
+              [k filtered-v])))))

 (def small
   (let [grammar
@@ -498,7 +506,8 @@
                                     (= (get-in % [:synsem :pronoun]) true)))
                               v)]
                   (if (not (empty? filtered-v))
-                    [k filtered-v]))))]
+                    [k filtered-v]))))
+        lexicon-for-generation (lexicon-for-generation lexicon)]
     {:name "small"
      :morph-walk-tree (fn [tree]
                         (do
@@ -510,6 +519,7 @@
      :lookup (fn [arg]
                (analyze arg lexicon))
      :enrich enrich
+     :generate {:lexicon lexicon-for-generation}
      :grammar grammar
      :lexicon lexicon
      :index (create-index grammar (flatten (vals lexicon)) head-principle)}))
@@ -534,6 +544,7 @@
                               v)]
                   (if (not (empty? filtered-v))
                     [k filtered-v]))))
+        lexicon-for-generation (lexicon-for-generation lexicon)
         rules (map #(keyword (get-in % [:rule])) grammar)]
     {:name "medium"
      :language "it"
@@ -542,6 +553,7 @@
      :lookup (fn [arg]
                (analyze arg parse-lexicon))
      :enrich enrich
+     :generate {:lexicon lexicon-for-generation}
      :grammar grammar
      :rules rules
      :rule-map (zipmap rules
@@ -571,7 +583,8 @@
                                              (not (= (get-in % [:synsem :pronoun] false) true)))))
                               v)
                       ;; TODO: remove this removal:
-                      ;; don't remove this semantic info.
+                      ;; don't remove this semantic info. It's an interesting example of how to
+                      ;; process a lexicon, though, so perhaps find a reason to use it in some way.
                       remove-semantic-features
                       (map (fn [lexeme]
                              (remove-matching-keys lexeme
@@ -585,7 +598,8 @@
                                                      (= % :physical-object) (= % :place)    (= % :speakable))))
                            filtered-v)]
                   (if (not (empty? remove-semantic-features))
-                    [k remove-semantic-features]))))]
+                    [k remove-semantic-features]))))
+        lexicon-for-generation (lexicon-for-generation lexicon)]
     {:name "np-grammar"
      :morph-walk-tree (fn [tree]
                         (do
@@ -597,9 +611,10 @@
      :lookup (fn [arg]
                (analyze arg lexicon))
      :enrich enrich
+     :generate {:lexicon lexicon-for-generation}
      :grammar grammar
      :lexicon lexicon
-     :index (create-index grammar (flatten (vals lexicon)) head-principle)
+     :index (create-index grammar (flatten (vals lexicon-for-generation)) head-principle)
      :rules rules
      :rule-map (zipmap rules grammar)}))


s/target/surface/; s/source/pred/

s/target/surface/; s/source/pred/

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -473,13 +473,13 @@
                           (morph/exception-generator lexicon)))
       lexicon)))

-(defn vocab-entry-to-lexeme [{target :target
-                              vocab-cat :vocab_cat
-                              source :source}]
-  (let [ends-with (str (nth target (- (count target) 1)))]
+(defn vocab-entry-to-lexeme [{surface :surface
+                              pred :pred
+                              vocab-cat :vocab_cat}]
+  (let [ends-with (str (nth surface (- (count surface) 1)))]
     (cond (= vocab-cat "noun1")
-          {target
-           [{:synsem {:sem {:pred (keyword source)}
+          {surface
+           [{:synsem {:sem {:pred (keyword pred)}
                       :cat :noun
                       :agr {:gender (cond (= "o" ends-with)
                                           :masc


add transitive default rule

add transitive default rule

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -121,6 +121,12 @@
                  :subcat {:1 {:top :top}
                           :2 '()}}})

+      (default ;; a verb is transitive if not otherwise set (e.g. by previous rule).
+       {:synsem {:cat :verb
+                 :subcat {:1 {:top :top}
+                          :2 {:top :top}
+                          :3 '()}}})
+
       (default ;; a verb's first argument's case is nominative.
        {:synsem {:cat :verb
                  :subcat {:1 {:cat :noun


handle clicks on groups

handle clicks on groups

--- src/braid/ui/views/sidebar.cljs
+++ src/braid/ui/views/sidebar.cljs
@@ -78,12 +78,12 @@
                           (dispatch! :set-preference [:groups-order new-groups])))
         drag-state (r/atom {:grp nil
                             :elt-height 0
+                            :click nil
                             :listeners nil
                             :start nil
                             :location nil
                             :offset nil})
         drag-move (fn [grp evt]
-                    (.preventDefault evt)
                     (when (= grp (@drag-state :grp))
                       (swap! drag-state assoc
                              :location (v+ (location evt)
@@ -93,12 +93,16 @@
                      (doto js/window
                        (events/unlisten EventType.MOUSEUP up)
                        (events/unlisten EventType.MOUSEMOVE move)))
-                   (let [moved (-> (v- (@drag-state :location)
-                                       (@drag-state :start))
-                                   second
-                                   (/ (@drag-state :elt-height))
-                                   js/Math.round)]
-                     (move-group-by grp moved))
+                   (let [y-delta (-> (v- (@drag-state :location)
+                                         (@drag-state :start))
+                                     second)
+                         idx-delta (-> y-delta
+                                       (/ (@drag-state :elt-height))
+                                       js/Math.round)]
+                     (if (< (js/Math.abs y-delta) (/ (@drag-state :elt-height) 2))
+                       (when-let [click (@drag-state :click)]
+                         (click))
+                       (move-group-by grp idx-delta)))
                    (swap! drag-state assoc
                           :grp nil
                           :listeners nil))
@@ -112,12 +116,14 @@
                            elt-height (+ (.-clientHeight elt)
                                          (-> elt
                                              (get-style "margin-bottom")
-                                             px->n))
+                                             px->n
+                                             (* 2)))
                            up (partial drag-end grp)
                            move (partial drag-move grp)]
                        (swap! drag-state assoc
                               :grp grp
                               :start loc
+                              :click (fn [] (.click elt))
                               :elt-height elt-height
                               :location offset
                               :offset (v- offset loc)


Make state-component utility function private. Users shouldn't access the component directly anyway


tests for Incubator and Origami

tests for Incubator and Origami

--- src/clj/test/cards-programs.clj
+++ src/clj/test/cards-programs.clj
@@ -51,6 +51,29 @@
       (is (= 2 (:credit (get-runner))) "1cr to use Djinn ability")
       (is (= 2 (:click (get-runner))) "1click to use Djinn ability"))))

+(deftest incubator-transfer-virus-counters
+  "Incubator - Gain 1 virus counter per turn; trash to move them to an installed virus program"
+  (do-game
+    (new-game (default-corp)
+              (default-runner [(qty "Incubator" 1) (qty "Datasucker" 1)]))
+    (take-credits state :corp)
+    (play-from-hand state :runner "Datasucker")
+    (play-from-hand state :runner "Incubator")
+    (take-credits state :runner)
+    (take-credits state :corp)
+    (let [ds (get-in @state [:runner :rig :program 0])
+          incub (get-in @state [:runner :rig :program 1])]
+      (is (= 1 (:counter (refresh incub))) "Incubator gained 1 virus counter")
+      (take-credits state :runner)
+      (take-credits state :corp)
+      (is (= 2 (:counter (refresh incub))) "Incubator has 2 virus counters")
+      (card-ability state :runner incub 0)
+      (prompt-select :runner ds)
+      (is (= 2 (:counter (refresh ds))) "Datasucker has 2 virus counters moved from Incubator")
+      (is (= 1 (count (get-in @state [:runner :rig :program]))))
+      (is (= 1 (count (:discard (get-runner)))) "Incubator trashed")
+      (is (= 3 (:click (get-runner)))))))
+
 (deftest leprechaun-mu-savings
   "Leprechaun - Keep MU the same when hosting or trashing hosted programs"
   (do-game
@@ -85,6 +108,17 @@
     (let [mopus (get-in @state [:runner :rig :program 0])]
       (card-ability state :runner mopus 0)
       (is (= 2 (:credit (get-runner))) "Gain 2cr"))))
+
+(deftest origami
+  "Origami - Increases Runner max hand size"
+  (do-game
+    (new-game (default-corp)
+              (default-runner [(qty "Origami" 2)]))
+    (take-credits state :corp)
+    (play-from-hand state :runner "Origami")
+    (is (= 6 (:max-hand-size (get-runner))))
+    (play-from-hand state :runner "Origami")
+    (is (= 9 (:max-hand-size (get-runner))) "Max hand size increased by 2 for each copy installed")))

 (deftest parasite-apex
   "Parasite - Installed facedown w/ Apex"


Template creator complete

Template creator complete

--- src/cljs/movement/template.cljs
+++ src/cljs/movement/template.cljs
@@ -37,18 +37,18 @@
    [:div.pure-u.movement
     (when-not (nil? m)
       [:div.pure-g
-       [:div.pure-u.destroy
-        [:i.fa.fa-remove {:on-click #(let [specific-movements (vec (remove #{m} (get-in @template-state [:parts i :specific-movements])))]
+       [:div.pure-u-1
+        [:i.fa.fa-remove {:style {:margin "10px 0 0 15px" :cursor 'pointer :color "#CC9999" :opacity 0.8 :font-size "2.0em"}
+                          :on-click #(let [specific-movements (vec (remove #{m} (get-in @template-state [:parts i :specific-movements])))]
                                       (swap! template-state assoc-in [:parts i :specific-movements] specific-movements))
                           :title    "Remove movement"}]]])
     [:h3.pure-g
-     [:div.pure-u-1-12]
-     [:div.pure-u.title title]]
+     [:div.pure-u-1.center title]]
     (if-not (nil? m)
       [:img.graphic.pure-img-responsive {:src image}]
-      [:div
+      [:div.pure-g
        (for [c categories]
-         [:div {:style {:margin-right 5}} c])
+         [:div.pure-u-1.center {:style {:margin-right 5}} c])
        [:img.graphic.pure-img-responsive {:src image}]])
     [:div
      [:div.pure-g
@@ -170,6 +170,22 @@

 (defn category-input [categories i showing-categories-list]
   [:div
+   [:div.pure-g {:style {:margin-top 10 :margin-bottom 10}}
+    [:a.pure-u {:style {:text-decoration 'underline}
+                :on-click #(handler-fn (reset! showing-categories-list (not @showing-categories-list)))}
+     (if @showing-categories-list "Hide categories list" "Show categories list")]]
+   (when @showing-categories-list
+     [:div.pure-g
+      (for [c (sort (session/get :all-categories))]
+        ^{:key c}
+        [:div.pure-u
+         {:style    {:cursor     'pointer :margin-right 10 :margin-bottom 5
+                     :color      (when (some #{c} (get-in @template-state [:parts i :categories])) "#fffff8")
+                     :background (when (some #{c} (get-in @template-state [:parts i :categories])) "gray")}
+          :on-click #(if (some #{c} (get-in @template-state [:parts i :categories]))
+                      (let [new-categories (remove #{c} (get-in @template-state [:parts i :categories]))]
+                        (swap! template-state assoc-in [:parts i :categories] new-categories))
+                      (swap! template-state update-in [:parts i :categories] conj c))} c])])
    [:div.pure-g
     (let [id (str "ctags" i)
           categories-ac-comp (with-meta text-input-component
@@ -190,24 +206,7 @@
        [:span c]
        [:i.fa.fa-times {:style    {:color 'red :cursor 'pointer}
               :on-click #(let [categories (vec (remove #{c} (get-in @template-state [:parts i :categories])))]
-                          (swap! template-state assoc-in [:parts i :categories] categories))}]])]
-
-   [:div.pure-g {:style {:margin-top 10}}
-    [:a.pure-u {:style {:text-decoration 'underline}
-                :on-click #(handler-fn (reset! showing-categories-list (not @showing-categories-list)))}
-     (if @showing-categories-list "Hide categories list" "Show categories list")]]
-   (when @showing-categories-list
-     [:div.pure-g
-      (for [c (sort (session/get :all-categories))]
-        ^{:key c}
-        [:div.pure-u
-         {:style    {:cursor     'pointer :margin-right 8 :margin-bottom 5
-                     :color      (when (some #{c} (get-in @template-state [:parts i :categories])) "#fffff8")
-                     :background (when (some #{c} (get-in @template-state [:parts i :categories])) "gray")}
-          :on-click #(if (some #{c} (get-in @template-state [:parts i :categories]))
-                      (let [new-categories (remove #{c} (get-in @template-state [:parts i :categories]))]
-                        (swap! template-state assoc-in [:parts i :categories] new-categories))
-                      (swap! template-state update-in [:parts i :categories] conj c))} c])])])
+                          (swap! template-state assoc-in [:parts i :categories] categories))}]])]])

 (defn part-creator-component []
   (let [showing-categories-list (atom false)]


Basic stuff working

Basic stuff working

--- src/cljs/reagent_test/core.cljs
+++ src/cljs/reagent_test/core.cljs
@@ -70,18 +70,18 @@
     [navbar-dropdowns-data]
     [:nav
      [:div.nav-wrapper
-       [:a {:href "#!" :class "brand-logo"} "Bababet"]
+       [:a {:href "" :class "brand-logo"} "Bababet"]
        [:ul {:class "right hide-on-med-and-down"}
         [:li
          [:a {:href "#/"} "Home"]]
         [:li
-         [:a {:href "#/bet"} "Bet"]]
-        [:li
-         [:a {:href "#!" :class "profile-dropdown-navbar-item" :data-activates "profile-dropdown" }
+         [:a {:href "#/propose"} "Propose"]]
+        [:li
+         [:a {:href "#" :onclick "return false;" :class "profile-dropdown-navbar-item" :data-activates "profile-dropdown" }
           "Profile"
           [:i {:class "mdi-navigation-arrow-drop-down right"}]]]
         [:li
-         [:a {:href "#!" :class "signin-dropdown-navbar-item" :data-activates "signin-dropdown" }
+         [:a {:href "#" :class "signin-dropdown-navbar-item" :data-activates "signin-dropdown" }
           "Sign in"
           [:i {:class "mdi-navigation-arrow-drop-down right"}]]]
       ]
@@ -164,9 +164,9 @@
 (secretary/defroute "/propose" []
   (session/put! :current-page #'propose-page))

-(secretary/defroute "/bet/:id" {:as params}
+(secretary/defroute "/bet/:id" {id :id}
   (session/put! :current-page #'bet-page)
-  (js/console.log (str "Bet: " (:id params)))
+  (js/console.log (str "Bet: " id))
   )

 (secretary/defroute "/profile" []
@@ -181,26 +181,28 @@
 (defn activate-dropdowns []
   (.dropdown ($ ".profile-dropdown-navbar-item"))
   (.dropdown ($ ".signin-dropdown-navbar-item"))
-             )
+  (js/console.log "Activated dropdowns")
+)
+
 (defn hook-browser-navigation! []
   (doto (History.)
     (events/listen
      EventType/NAVIGATE
      (fn [event]
-       (secretary/dispatch! (.-token event))))
+       (secretary/dispatch! (.-token event))
+       (activate-dropdowns)
+      ))
     (.setEnabled true)))

 ;; -------------------------
 ;; Initialize app

 (defn mount-root []
-  (reagent/render [current-page] (.getElementById js/document "app")))
-
-
-;;$(".profile-dropdown-navbar-item").dropdown()
+  (reagent/render [current-page] (.getElementById js/document "app"))
+  (activate-dropdowns)
+)

 (defn init! []
   (hook-browser-navigation!)
   (mount-root)
-  (activate-dropdowns)
-)
+)


Serialize functions with kryo

Serialize functions with kryo

--- src/clojure/flambo/function.clj
+++ src/clojure/flambo/function.clj
@@ -11,7 +11,11 @@
   (= (type f) :serializable.fn/serializable-fn))

 (def serialize-fn sfn/serialize)
-(def deserialize-fn (memoize sfn/deserialize))
+(def deserialize-serfn (memoize sfn/deserialize))
+(def deserialize-fn (memoize #(let [f (kryo/deserialize (first %))]
+                                (->> f class .getName (re-matches #"(.*?)\$.*")
+                                     second symbol require)
+                                f)))
 (def array-of-bytes-type (Class/forName "[B"))

 ;; ## Generic
@@ -24,8 +28,8 @@
   (let [fn-or-serfn (.state this)
         f (if (instance? array-of-bytes-type fn-or-serfn)
             (binding [sfn/*deserialize* kryo/deserialize]
-              (deserialize-fn fn-or-serfn))
-            fn-or-serfn)]
+              (deserialize-serfn fn-or-serfn))
+            (deserialize-fn fn-or-serfn))]
     (log/trace "CLASS" (type this))
     (log/trace "META" (meta f))
     (log/trace "XS" xs)
@@ -52,8 +56,10 @@
         :constructors {[Object] []})
        (defn ~wrapper-name [f#]
          (new ~new-class-sym
-              (if (serfn? f#) (binding [sfn/*serialize* kryo/serialize]
-                                (serialize-fn f#)) f#))))))
+              (if (serfn? f#)
+                (binding [sfn/*serialize* kryo/serialize]
+                  (serialize-fn f#))
+                [(kryo/serialize f#)]))))))

 (gen-function Function function)
 (gen-function Function2 function2)


SMTP server connections now run in threads, we can handle more than on connection at once.

--- src/clojure/neveragain/core.clj
+++ src/clojure/neveragain/core.clj
@@ -6,6 +6,7 @@
 			[settings :as settings]
 			rfc auth tls))
 	(:import
+		(java.util.concurrent Executors)
 		(javax.net.ssl SSLSocket)
 		(java.net ServerSocket InetAddress)
  		(java.util.concurrent Executors)
@@ -74,13 +75,14 @@
 						:else (recur response inner-conn)))))))

 (defn serve-forever [port-number thread-count]
-	(let [serv-socket (ServerSocket. port-number)]
+	(let [serv-socket (ServerSocket. port-number)
+			thread-pool (Executors/newFixedThreadPool thread-count)]
 		(println (str "Serving on port " port-number))
 		(println settings/banner)
 		(while (= 1 1)
 			(let [client-socket (.accept serv-socket)
 					conn (make-conn client-socket)]
-				(handle-conn conn)))))
+				(.execute thread-pool (fn [] (handle-conn conn)))))))

 (defn -main [& args]
 	(serve-forever settings/smtp-port settings/thread-count))


add all new entity fns

add all new entity fns

--- src/navigator.clj
+++ src/navigator.clj
@@ -73,6 +73,21 @@
   (tx-entity! db-conn :task (merge {:task/id-sk (str (get-in message [:header :entity-id :task-id]))}
                                    (hatch/slam-all (get-in message [:payload :entity]) :task))))

+(defn comp-in [db-conn message]
+  (tx-entity! db-conn :comp (merge {:comp/id-sk (str (get-in message [:header :entity-id :comp-id]))
+                                    (hatch/slam-all (get-in message [:payload :entity]) :comp)})))
+
+(defn comp-tag-in [db-conn message]
+  (tx-entity! db-conn :comp-tag (hatch/slam-all (get-in message [:payload :entity]) :comp-tag)))
+
+(defn perf-asmt-in [db-conn message]
+  (tx-entity! db-conn :perf-asmt (merge {:perf-asmt/id-sk (str (get-in message [:header :entity-id :perf-asmt-id]))
+                                         (hatch/slam-all (get-in message [:paylod :entity]) :perf-asmt)})))
+(defn user2comp-in [db-conn message]
+  (tx-entity! db-conn :user2comp (hatch/slam-all (get-in message [:payload :entity]) :user2comp)))
+
+(defn user2perf-asmt-in [db-conn message]
+  (tx-entity! db-conn :user2perf-asmt (hatch/slam-all (get-in message [:payload :entity]) :user2perf-asmt)))

 (comment


Updated docstring.

Updated docstring.

--- dev-resources/src/dragon/dev.clj
+++ dev-resources/src/dragon/dev.clj
@@ -1,8 +1,8 @@
 (ns dragon.dev
-  "Clojang blog development namespace
+  "Dragon development namespace

-  This namespace is particularly useful when doing active development on the
-  Clojang blog application."
+  This namespace is particularly useful when doing active development on depedent
+  blog applications."
   (:require [clojure.edn :as edn]
             [clojure.java.io :as io]
             [clojure.pprint :refer [pprint print-table]]


cleaner campaign

cleaner campaign

--- src/ctia/stores/es/campaign.clj
+++ src/ctia/stores/es/campaign.clj
@@ -13,14 +13,11 @@

 (def ^{:private true} mapping "campaign")

-(defn- make-id [schema j]
-  (str "campagin" "-" (UUID/randomUUID)))
-
-(defn handle-create-campaign [state login realized]
+(defn handle-create-campaign [state login realized-new-campaign]
   (create-doc (:conn state)
               (:index state)
               mapping
-              realized))
+              realized-new-campaign))

 (defn handle-update-campaign [state login id new-campaign]
   (update-doc (:conn state)


:bug: Properly redirect to login when no route.

--- frontend/src/uxbox/main.cljs
+++ frontend/src/uxbox/main.cljs
@@ -42,7 +42,7 @@
       (st/emit! (rt/nav :dashboard-projects))

       (and (= path "") (not (:auth storage)))
-      (st/emit! (rt/nav :auth/login))
+      (st/emit! (rt/nav :login))

       (nil? match)
       (prn "TODO 404 main")


clean up some debug printing

clean up some debug printing

--- src/block_chain/miner.clj
+++ src/block_chain/miner.clj
@@ -90,7 +90,7 @@
   ([block] (mine block (atom true)))
   ([block switch]
    (let [attempt (blocks/hashed block)]
-     (when (= 0 (mod (get-in attempt [:header :nonce]) 1000000)) (println "got to nonce: " (get-in attempt [:header :nonce])))
+     #_(when (= 0 (mod (get-in attempt [:header :nonce]) 1000000)) (println "got to nonce: " (get-in attempt [:header :nonce])))
      (if (blocks/meets-target? attempt)
        attempt
        (if (not @switch)
@@ -104,7 +104,7 @@
 (defn mine-and-commit
   ([] (mine-and-commit db/block-chain))
   ([chain]
-   (println "Preparing New block; found " (count @db/transaction-pool) " transactions in the pool.")
+   #_(println "Preparing New block; found " (count @db/transaction-pool) " transactions in the pool.")
    (let [txns (into [(coinbase)] @db/transaction-pool)]
      (reset! db/transaction-pool #{})
      (mine-and-commit chain
@@ -112,14 +112,13 @@
                      txns
                      {:blocks @chain}))))
   ([chain pending]
-   (println "will mine this block: ")
-   (println pending)
    (if-let [b (mine pending mine?)]
-     (do
+     (swap! chain conj b)
+     #_(do
        (println "*******************")
-     (println "found new block:")
-     (println "NEXT TARGET: " (bc/next-target @db/block-chain))
-     (swap! chain conj b))
+       (println "found new block:")
+       (println "NEXT TARGET: " (bc/next-target @db/block-chain))
+       (swap! chain conj b))
      (println "didn't find coin, exiting"))))

 (defn run-miner! []


Lock file store in put!, delete!, and erase!.

--- src/blocks/store/file.clj
+++ src/blocks/store/file.clj
@@ -174,11 +174,12 @@
     [this block]
     (let [id (:id block)
           file (id->file root id)]
-      (when-not (.exists file)
-        (io/make-parents file)
-        (with-open [content (block/open block)]
-          (io/copy content file))
-        (.setWritable file false false))
+      (locking this
+        (when-not (.exists file)
+          (io/make-parents file)
+          (with-open [content (block/open block)]
+            (io/copy content file))
+          (.setWritable file false false)))
       (data/merge-blocks
         block
         (file->block id file))))
@@ -187,14 +188,16 @@
   (delete!
     [this id]
     (when-block id
-      (.delete file))))
+      (locking this
+        (.delete file)))))

 (defn erase!
   "Clears all contents of the file store by recursively deleting the root
   directory."
   [store]
-  (rm-r (:root store)))
+  (locking store
+    (rm-r (:root store))))

 (defn file-store


Fix typo

Fix typo

--- src/braid/server/sync.clj
+++ src/braid/server/sync.clj
@@ -339,7 +339,7 @@
     (let [user-tags (tag/tag-ids-for-user db/conn user-id)
           filter-tags (fn [t] (update-in t [:tag-ids] (partial into #{} (filter user-tags))))
           thread-ids (search/search-threads-as user-id ?data)
-          threads (map (comp filter-tags thread/thread-by-idb/conn d)
+          threads (map (comp filter-tags (partial thread/thread-by-id db/conn))
                        (take 25 thread-ids))]
       (when ?reply-fn
         (?reply-fn {:threads threads :thread-ids thread-ids})))))


Make site traversal test toggle-able

Make site traversal test toggle-able

--- test/comic_reader/sites_test.clj
+++ test/comic_reader/sites_test.clj
@@ -160,6 +160,7 @@
 (defn test-full-site-traversal [site]
   (and
    (call-with-options site #(ensure-all-dependencies))
+   run-network-tests?

    (is (not
         (nil?


Improved code style on cats.monad.maybe namespace source.

- Rename proto/ with p/
- Fix indentation issues.

--- src/cats/monad/maybe.cljc
+++ src/cats/monad/maybe.cljc
@@ -32,7 +32,7 @@
       (maybe/just 1)
       ;; => #<Just [1]>
   "
-  (:require [cats.protocols :as proto]
+  (:require [cats.protocols :as p]
             [cats.core :as m]))

 (declare maybe-monad)
@@ -42,10 +42,10 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (deftype Just [v]
-  proto/Context
+  p/Context
   (get-context [_] maybe-monad)

-  proto/Extract
+  p/Extract
   (extract [_] v)

   #?(:clj clojure.lang.IDeref
@@ -63,17 +63,17 @@
          (with-out-str (print [v])))])

   #?@(:cljs
-       [cljs.core/IEquiv
-        (-equiv [_ other]
-                (if (instance? Just other)
-                  (= v (.-v other))
-                  false))]))
+      [cljs.core/IEquiv
+       (-equiv [_ other]
+         (if (instance? Just other)
+           (= v (.-v other))
+           false))]))

 (deftype Nothing []
-  proto/Context
+  p/Context
   (get-context [_] maybe-monad)

-  proto/Extract
+  p/Extract
   (extract [_] nil)

   #?(:clj clojure.lang.IDeref
@@ -89,9 +89,9 @@
          (with-out-str (print "")))])

   #?@(:cljs
-       [cljs.core/IEquiv
-        (-equiv [_ other]
-                (instance? Nothing other))]))
+      [cljs.core/IEquiv
+       (-equiv [_ other]
+         (instance? Nothing other))]))

 (alter-meta! #'->Nothing assoc :private true)
 (alter-meta! #'->Just assoc :private true)
@@ -100,8 +100,8 @@
   "Return true in case of `v` is instance
   of Maybe monad."
   [v]
-  (if (satisfies? proto/Context v)
-    (identical? (proto/get-context v) maybe-monad)
+  (if (satisfies? p/Context v)
+    (identical? (p/get-context v) maybe-monad)
     false))

 (defn just
@@ -152,11 +152,11 @@
   ([mv]
    {:pre [(maybe? mv)]}
    (when (just? mv)
-     (proto/extract mv)))
+     (p/extract mv)))
   ([mv default]
    {:pre [(maybe? mv)]}
    (if (just? mv)
-     (proto/extract mv)
+     (p/extract mv)
      default)))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -166,33 +166,33 @@
 (def ^{:no-doc true}
   maybe-monad
   (reify
-    proto/Semigroup
+    p/Semigroup
     (mappend [_ mv mv']
       (cond
         (nothing? mv) mv'
         (nothing? mv') mv
-        :else (just (m/mappend (proto/extract mv)
-                               (proto/extract mv')))))
-
-    proto/Monoid
+        :else (just (m/mappend (p/extract mv)
+                               (p/extract mv')))))
+
+    p/Monoid
     (mempty [_]
       (nothing))

-    proto/Functor
+    p/Functor
     (fmap [_ f mv]
       (if (nothing? mv)
         mv
         (just (f (from-maybe mv)))))

-    proto/Applicative
+    p/Applicative
     (pure [_ v]
       (just v))
     (fapply [m af av]
       (if (nothing? af)
         af
-        (proto/fmap m (from-maybe af) av)))
-
-    proto/Monad
+        (p/fmap m (from-maybe af) av)))
+
+    p/Monad
     (mreturn [_ v]
       (just v))
     (mbind [_ mv f]
@@ -200,27 +200,27 @@
         mv
         (f (from-maybe mv))))

-    proto/MonadZero
+    p/MonadZero
     (mzero [_]
       (nothing))

-    proto/MonadPlus
+    p/MonadPlus
     (mplus [_ mv mv']
       (if (just? mv)
         mv
         mv'))

-    proto/Foldable
+    p/Foldable
     (foldl [_ f z mv]
       (if (just? mv)
-        (m/with-monad (proto/get-context mv)
-          (f z (proto/extract mv)))
+        (m/with-monad (p/get-context mv)
+          (f z (p/extract mv)))
         z))

     (foldr [_ f z mv]
       (if (just? mv)
-        (m/with-monad (proto/get-context mv)
-          (f (proto/extract mv) z))
+        (m/with-monad (p/get-context mv)
+          (f (p/extract mv) z))
         z))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -231,38 +231,38 @@
   "The maybe transformer constructor."
   [inner-monad]
   (reify
-    proto/Functor
+    p/Functor
     (fmap [_ f fv]
-      (proto/fmap inner-monad
-                  #(proto/fmap maybe-monad f %)
-                  fv))
-
-    proto/Monad
+      (p/fmap inner-monad
+              #(p/fmap maybe-monad f %)
+              fv))
+
+    p/Monad
     (mreturn [m v]
-      (proto/mreturn inner-monad (just v)))
+      (p/mreturn inner-monad (just v)))

     (mbind [_ mv f]
-      (proto/mbind inner-monad
-                   mv
-                   (fn [maybe-v]
-                     (if (just? maybe-v)
-                       (f (from-maybe maybe-v))
-                       (proto/mreturn inner-monad (nothing))))))
-
-    proto/MonadZero
+      (p/mbind inner-monad
+               mv
+               (fn [maybe-v]
+                 (if (just? maybe-v)
+                   (f (from-maybe maybe-v))
+                   (p/mreturn inner-monad (nothing))))))
+
+    p/MonadZero
     (mzero [_]
-      (proto/mreturn inner-monad (nothing)))
-
-    proto/MonadPlus
+      (p/mreturn inner-monad (nothing)))
+
+    p/MonadPlus
     (mplus [_ mv mv']
-      (proto/mbind inner-monad
-                   mv
-                   (fn [maybe-v]
-                     (if (just? maybe-v)
-                       (proto/mreturn inner-monad maybe-v)
-                       mv'))))
-
-    proto/MonadTrans
+      (p/mbind inner-monad
+               mv
+               (fn [maybe-v]
+                 (if (just? maybe-v)
+                   (p/mreturn inner-monad maybe-v)
+                   mv'))))
+
+    p/MonadTrans
     (base [_]
       maybe-monad)

@@ -270,10 +270,10 @@
       inner-monad)

     (lift [_ mv]
-      (proto/mbind inner-monad
-                   mv
-                   (fn [v]
-                     (proto/mreturn inner-monad (just v)))))))
+      (p/mbind inner-monad
+               mv
+               (fn [v]
+                 (p/mreturn inner-monad (just v)))))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Utility functions


tweak drag behavior

tweak drag behavior

--- src/chessground/drag.cljs
+++ src/chessground/drag.cljs
@@ -9,11 +9,12 @@
 (def dragging-div-pos
   (atom {}))

-(.addEventListener js/document "DOMContentLoaded"
-                   (fn []
-                     (let [div (.createElement js/document "div")]
-                       (set! (.-id div) "chessground-moving-square")
-                       (.appendChild (.-body js/document) div))))
+(when common/touch-device?
+  (.addEventListener js/document "DOMContentLoaded"
+                     (fn []
+                       (let [div (.createElement js/document "div")]
+                         (set! (.-id div) "chessground-moving-square")
+                         (.appendChild (.-body js/document) div)))))

 ; from interact.js
 (def get-scroll-xy
@@ -68,12 +69,13 @@
 (defn on-end [event chan]
   (let [piece (.-target event)
         orig (.-parentNode piece)
-        dest (.-dropzone event)
-        dragging-div (.getElementById js/document "chessground-moving-square")]
-    (.setTimeout js/window #(unfuck piece) 10)
-    (set! (-> dragging-div .-style .-display) "none")
-    (when dest (-> dest .-classList (.remove klass/drag-over)))
+        dest (.-dropzone event)]
+    (when-let [dragging-div (.getElementById js/document "chessground-moving-square")]
+      (set! (-> dragging-div .-style .-display) "none"))
+    (when dest
+      (-> dest .-classList (.remove klass/drag-over)))
     (-> piece .-classList (.remove klass/dragging))
+    (.setTimeout js/window #(unfuck piece) 20)
     (when-let [orig-key (common/square-key orig)]
       (if (and dest (= (common/square-board orig) (common/square-board dest)))
         (a/put! chan [:move-piece (map common/square-key [orig dest])])


* src/clj/cljs/compiler.clj: added type inference for if test expressions

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -311,18 +311,29 @@
   (when-not (= :statement (:context env))
     (emit-wrap env (emit-constant form))))

-(defn bool-expr? [e]
-  (or (= (-> e :tag) clojure.core$boolean)
-      (= (-> e :info :tag) clojure.core$boolean)))
+(defn get-tag [e]
+  (or (-> e :tag)
+      (-> e :info :tag)))
+
+(defn infer-tag [e]
+  (if-let [tag (get-tag e)]
+    tag
+    (case (:op e)
+      :let (infer-tag (:ret e))
+      :if (let [then-tag (infer-tag (:then e))
+                else-tag (infer-tag (:else e))]
+            (when (= then-tag else-tag)
+              then-tag))
+      nil)))

 (defmethod emit :if
   [{:keys [test then else env]}]
   (let [context (:context env)]
     (if (= :expr context)
-      (print (str "(" (when-not (bool-expr? test) "cljs.core.truth_")
+      (print (str "(" (when-not (= (infer-tag test) clojure.core$boolean) "cljs.core.truth_")
                   "(" (emits test) ")?" (emits then) ":" (emits else) ")"))
       (let [testsym (gensym "test")]
-        (print (str "if(" (when-not (bool-expr? test) "cljs.core.truth_")
+        (print (str "if(" (when-not (= (infer-tag test) clojure.core$boolean) "cljs.core.truth_")
                     "(" (emits test) "))\n{" (emits then) "} else\n{" (emits else) "}\n"))))))

 (defmethod emit :throw


Removed unused imports

Removed unused imports

--- src/stub_http/core.clj
+++ src/stub_http/core.clj
@@ -3,12 +3,10 @@
            (java.net ServerSocket)
            (java.io Closeable)
            (fi.iki.elonen NanoHTTPD))
-  (:require [clojure.string :refer [split blank? lower-case]]
-            [clojure.test :refer [function?]]
+  (:require [clojure.test :refer [function?]]
             [stub-http.internal.port :refer [get-free-port!]]
             [stub-http.internal.nano :as nano]
-            [stub-http.internal.spec :refer [normalize-request-spec normalize-response-spec]]
-            [stub-http.internal.support :refer [substring-before]]))
+            [stub-http.internal.spec :refer [normalize-request-spec normalize-response-spec]]))

 (defn- record-route! [route-state route-matcher response-spec]
   (swap! route-state conj {:request-spec-fn  (normalize-request-spec route-matcher) :request-spec route-matcher


Refactoring.

Refactoring.

--- src/clj/org_ui/server.clj
+++ src/clj/org_ui/server.clj
@@ -4,7 +4,6 @@
             [org-ui.dev :refer [is-dev? inject-devmode-html start-figwheel]]
             [compojure.core :refer [GET defroutes]]
             [compojure.route :refer [resources]]
-            [compojure.handler :refer [api]]
             [net.cgrand.enlive-html :refer [deftemplate]]
             [ring.middleware.reload :as reload]
             [environ.core :refer [env]]
@@ -20,18 +19,17 @@

 (def http-handler
   (if is-dev?
-    (reload/wrap-reload (api #'routes))
-    (api routes)))
+    (reload/wrap-reload routes)
+    routes))

 (defn run [& [port]]
-  (defonce ^:private server
-    (do
-      (if is-dev? (start-figwheel))
-      (let [port (Integer. (or port (env :port) 10555))]
-        (print "Starting web server on port" port ".\n")
-        (run-jetty http-handler {:port port
-                          :join? false}))))
-  server)
+  (let [server (do
+                 (when is-dev? (start-figwheel))
+                 (let [port (Integer. (or port (env :port) 10555))]
+                   (print "Starting web server on port" port ".\n")
+                   (run-jetty http-handler {:port port
+                                            :join? false})))]
+    server))

 (defn -main [& [port]]
   (run port))


slack.hook is optional

slack.hook is optional

--- src/clj/runbld/schema.clj
+++ src/clj/runbld/schema.clj
@@ -27,7 +27,7 @@
    :user               s/Str})

 (def OptsSlack
-  {:hook               s/Str
+  {(s/optional-key :hook) s/Str
    :success            s/Bool
    :failure            s/Bool
    :template           (s/cond-pre s/Str java.io.File)})


restore unsell lot handling

restore unsell lot handling

--- src/clj_money/trading.clj
+++ src/clj_money/trading.clj
@@ -367,9 +367,8 @@
 (defn unsell
   [storage-spec transaction-id]
   (with-transacted-storage [s storage-spec]
-  (let [transactions (transactions/find-by-id s transaction-id)]
-    #_(doseq [lot-transaction lot-transactions]
-      (let [lot (lots/find-by-id s (:lot-id lot-transaction))]
-        (lots/update s (update-in lot [:shares-owned] #(+ % (:shares lot-transaction))))
-        (lot-transactions/delete s (:id lot-transaction))))
-    (transactions/delete s transaction-id))))
+    (let [transaction (transactions/find-by-id s transaction-id)]
+      (doseq [lot-item (:lot-items transaction)]
+        (let [lot (lots/find-by-id s (:lot-id lot-item))]
+          (lots/update s (update-in lot [:shares-owned] #(+ % (:shares lot-item))))))
+      (transactions/delete s transaction-id))))


initially display loading message for history instead of just an empty history

--- src/cljs/lambdacd/db.cljs
+++ src/cljs/lambdacd/db.cljs
@@ -6,7 +6,7 @@

 (def default-db
-  {:history []
+  {:history nil
    :pipeline-state nil
    :connection-state :lost
    :displayed-build-number nil


Add a basic delay.

Add a basic delay.

--- src/klangmeister/synthesis.cljs
+++ src/klangmeister/synthesis.cljs
@@ -96,6 +96,14 @@
     (doto (.createStereoPanner context)
       (-> .-pan (plug pan context at duration)))))

+(defn echo
+  "A delay."
+  [time]
+  (fn [context at duration]
+    (let [maximum 5]
+      (doto (.createDelay context maximum)
+        (-> .-delayTime (plug time context at duration))))))
+
 (defn destination [context at duration]
   (.-destination context))


Rename time -> t, call week-dated function.

--- src/cljs/tunnit/core.cljs
+++ src/cljs/tunnit/core.cljs
@@ -1,7 +1,7 @@
 (ns tunnit.core
   (:require [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]
-            [cljs-time.core :as time]
+            [cljs-time.core :as t]
             [cljs-time.format :as format]
             [om-tools.dom :as ot :include-macros true]
             [om-tools.core :refer-macros [defcomponent]]
@@ -24,13 +24,13 @@
   (format/formatter "dd.MM.yyyy"))

 (defn today []
-  (format/unparse date-format (time/now)))
+  (format/unparse date-format (t/now)))

 (defn week-day [date]
-  (time/day-of-week date))
+  (t/day-of-week date))

-(def week-dates ;[]
-  (assoc-in week-map [(week-day (time/now))
+(defn week-dates []
+  (assoc-in week-map [(week-day (t/now))
                       :date] (today)))

 (defcomponent week-view [app owner]
@@ -39,9 +39,8 @@
                         (map (fn [day]
                                (ot/output {:class "day-label"}
                                           (str (:name day) " " (:date day))))
-                              (vals week-dates))
-                        ))
-              )
+                              (vals (week-dates)))
+                        )))

 (defcomponent app-view [app owner]
               (render [this]


Rename delay to delay-line to avoid clashing with Clojure core.

--- src/klangmeister/synthesis.cljs
+++ src/klangmeister/synthesis.cljs
@@ -96,8 +96,7 @@
     (doto (.createStereoPanner context)
       (-> .-pan (plug pan context at duration)))))

-(defn echo
-  "A delay."
+(defn delay-line
   [time]
   (fn [context at duration]
     (let [maximum 5]


Pretty print functions names across several lines in show-fns.

--- src/quil/core.clj
+++ src/quil/core.clj
@@ -4247,6 +4247,36 @@
                         (:subcategories cat))))
           cats))))

+(defn- wrap-lines
+  "Split a list of words in lists (lines) not longer than width chars each,
+   space between words included."
+  [width words]
+  (letfn [(wrap-lines-rec
+            [ws accum-lns]
+            (if (empty? ws)
+              accum-lns
+              (let [lens (map count ws)
+                    cumlens (reduce
+                             (fn [sums len]
+                               (conj sums
+                                     (if (empty? sums)
+                                       len
+                                       (+ (last sums) len 1))))
+                             [] lens)
+                    [line other] (split-with #(> width %) cumlens)
+                    [line other] (split-at (count line) ws)]
+                (recur other (conj accum-lns line)))))]
+    (wrap-lines-rec words [])))
+
+(defn- pprint-wrapped-lines
+  "Pretty print words across several lines by wrapping lines at word boundary."
+  [words & {:keys [fromcolumn width] :or {fromcolumn 0 width 80}}]
+  (let [w (- width fromcolumn)
+        wordss (wrap-lines w words)
+        indent (apply str (repeat fromcolumn \space))
+        lines (map #(apply str indent (interpose " " %)) wordss)]
+    (doseq [l lines] (println l))))
+
 (defn show-fns
   "If given a number, print all the functions within category or
   subcategory specified by the category index (use show-cats to see a
@@ -4268,7 +4298,7 @@
               (if (not (empty? names))
                 (do
                   (println cid (:name c))
-                  (println "   " (apply str (interpose " " names)))))))
+                  (pprint-wrapped-lines names :fromcolumn 4)))))
           (show-fns-by-cat-idx [cat-idx]
             (let [c (get (all-category-map) (str cat-idx))]
               (list-category cat-idx c)))


should be function for flexibility

should be function for flexibility

--- src/corpus_utils/text.clj
+++ src/corpus_utils/text.clj
@@ -74,7 +74,7 @@

 (sm/defn parse-document :- [UnidicMorphemeSchema]
   [doc :- DocumentSchema
-   field :- s/Keyword]
+   field :- clojure.lang.IFn]
   (->> doc
        :paragraphs
        (r/mapcat :sentences)


sort search results of same score by label

--- src/wb_es/web/core.clj
+++ src/wb_es/web/core.clj
@@ -29,6 +29,8 @@
 (defn search [es-base-url index q options]
   (let [query (if (and q (not= (clojure.string/trim q) ""))
                 {;:explain true
+                 :sort [:_score
+                        {:label {:order :asc}}]
                  :query
                  {:bool
                   {:must [{:bool {:filter (get-filter options)}}


Removed unused file.

Removed unused file.

--- src/wishlistd/json.clj
+++ src/wishlistd/json.clj
@@ -1,2 +0,0 @@
-(ns wishlistd.json
-  (:require clojure.contrib.json))


Write out student school association records

--- POC/aggregation/tools/genAssessments/src/genAssessments/core.clj
+++ POC/aggregation/tools/genAssessments/src/genAssessments/core.clj
@@ -7,7 +7,7 @@

 (defn gen-edfi
   [interchange output-file contents]
-  (prn output-file)
+  ; (prn output-file)
   (with-open [out (java.io.OutputStreamWriter. (java.io.FileOutputStream. output-file) "UTF-8")]
     (emit (element interchange {:xmlns "http://ed-fi.org/0100"} contents) out)
   )
@@ -291,8 +291,10 @@
 )

 (defn enroll [schoolName studentId]
-  (gen-enroll schoolName studentId)
-  (gen-section-assoc schoolName studentId)
+  (into () [
+    (gen-enroll schoolName studentId)
+    (gen-section-assoc schoolName studentId) ]
+  )
 )

 (defn gen-enrollments [schools rng output-file]
@@ -521,14 +523,33 @@
   )
 )

+(defn no-op [v]
+  v
+)
+
+(defn make-counter [init-val]
+  (let [c (atom init-val)]
+    {:next #(swap! c inc)
+     :reset #(reset! c init-val)
+     :curr #(swap! c no-op)}
+  )
+)
+
 (defn gen-big-data
   [districtCount schoolCount studentCount]
   (def sectionName "7th Grade Math - Sec 2")
   (def assessmentName "Grade 7 State Math")
-
+  (def i (make-counter 0))
+  ;(def i (atom 0))
+  (println
+    (format "Starting assessment data generation: [%d districts %d schools %d students/school]"
+    districtCount schoolCount studentCount)
+  )
+  (println (format "[0/%d districts]" districtCount))
   (gen-assessment assessmentName "/tmp/test/F-assessment.xml")
   (def rng (range 1 (+ 1 studentCount)))
   (doseq [ [district] (map list (gen-district-schools districtCount schoolCount studentCount))]
+    (def startTime (System/currentTimeMillis))
     (doseq [ [districtName schools] district]
       (gen-schools districtName schools (format "/tmp/test/A-%s-schools.xml" districtName))
       (gen-sessions districtName schools (format "/tmp/test/B-%s-calendar.xml" districtName))
@@ -537,8 +558,13 @@
       (gen-enrollments schools rng (format "/tmp/test/E-%s-enrollment.xml" districtName))
       (gen-saas districtName schools rng assessmentName 10 (format "/tmp/test/G-%s-assessment-results.xml" districtName))
     )
+    (def endTime (System/currentTimeMillis))
+    (def elapsed (/ (-  endTime startTime) 1000.0))
+    (def remain (* elapsed (- (- districtCount 1) ((i :next)))))
+    (println (format "[%d/%d districts] (%f seconds : %f remaining)"  ((i :curr)) districtCount elapsed (max 0.0 remain)))
   )
   (create-control-file)
+  (println "Assessment data generation complete")
 )

 ; 100 students


-> to core/->

-> to core/->

--- src/main/clojure/cljs/core.cljc
+++ src/main/clojure/cljs/core.cljc
@@ -254,7 +254,7 @@
              (recur (next params) (conj new-params (first params)) lets)
              (core/let [gparam (gensym "p__")]
                (recur (next params) (conj new-params gparam)
-                 (-> lets (conj (first params)) (conj gparam)))))
+                 (core/-> lets (conj (first params)) (conj gparam)))))
            `(~new-params
               (let ~lets
                 ~@body)))))))


BUGFIX: Wasn't handling tab re-activation after suspend correctly

--- src/app/booklet/background.cljs
+++ src/app/booklet/background.cljs
@@ -117,8 +117,8 @@
                             (= (:windowId old-tab) (:windowId current-tab)))]
       (console/trace "From suspend:" is-same? suspend-info)
       (if is-same?
-        (dispatch [:handle-deactivation old-tab (:time suspend-info)])
-        (dispatch [:handle-activation old-tab (:start-time old-tab)]))
+        (dispatch [:handle-activation old-tab (:start-time old-tab)])
+        (dispatch [:handle-deactivation old-tab (:time suspend-info)]))
       (dispatch [:data-set :suspend-info] nil)
       app-state
       )


expose ReactDOM.hydrate

expose ReactDOM.hydrate

--- src/rum/core.cljs
+++ src/rum/core.cljs
@@ -221,6 +221,11 @@
   "Removes component from the DOM tree"
   [node]
   (js/ReactDOM.unmountComponentAtNode node))
+
+(defn hydrate
+  "Hydrates server rendered DOM tree with provided component."
+  [component node]
+  (js/ReactDOM.hydrate component node))

 (defn create-portal
   "Add component to the DOM tree."


update

update

--- src/site/core.clj
+++ src/site/core.clj
@@ -90,7 +90,7 @@
   [:div
    (navigation :inverse)
    [:div {:style (style [container [pull-down 50] [push-down 100] [bg :inverted-main]] )}
-    [:h1 {:style (style [txt-center])} "Projects"]]
+    [:h1 {:style (style [txt-center])} (:project strings)]]
    [:div.projects {:style (style [container [pull-down 50]])}
     [:h4 "Projects"]]])


example project changes

example project changes

--- example/project.clj
+++ example/project.clj
@@ -3,9 +3,9 @@
   :url "http://example.com/FIXME"
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
-  :dependencies [#_[org.clojure/clojure "1.6.0"]
+  :dependencies [
                  [org.clojure/clojure "1.7.0-beta1"]
-                 [org.clojure/clojurescript "0.0-3196"]
+                 [org.clojure/clojurescript "0.0-3211"]
                  [org.clojure/core.async "0.1.346.0-17112a-alpha"]
                  [sablono "0.3.4"]
                  [org.omcljs/om "0.8.8"]
@@ -15,7 +15,7 @@

   :plugins [[lein-ring "0.8.13"]
             [lein-cljsbuild "1.0.5"]
-            [lein-figwheel "0.3.1"]
+            [lein-figwheel "0.3.2-SNAPSHOT"]
             [lein-npm "0.4.0"]]

   :node-dependencies [[source-map-support "0.2.8"]
@@ -41,7 +41,7 @@

   :cljsbuild {
               :builds [{ :id "example"
-                         :source-paths ["src" #_"dev" #_"tests" #_"../support/src"]
+                         :source-paths ["src" #_"dev" #_"tests" "../support/src"]

                          :figwheel { :websocket-host "localhost"
                                      :on-jsload      "example.core/fig-reload"}


CLJS-1345 Analyzer tests are broken due to new error messages

--- src/test/clojure/cljs/analyzer_tests.clj
+++ src/test/clojure/cljs/analyzer_tests.clj
@@ -95,7 +95,7 @@
           (a/analyze ns-env '(ns foo.bar (:unless [])))
           (catch Exception e
             (.getMessage e)))
-        "Only :refer-clojure, :require, :require-macros, :use and :use-macros libspecs supported"))
+        "Only :refer-clojure, :require, :require-macros, :use, :use-macros, and :import libspecs supported"))
   (is (.startsWith
         (try
           (a/analyze ns-env '(ns foo.bar (:require baz.woz) (:require noz.goz)))
@@ -260,7 +260,7 @@
           (a/analyze test-env '(defn foo 123))
           (catch Exception e
             (.getMessage e)))
-        "Parameter declaration \"123\" should be a vector at line")))
+        "Parameter declaration \"123\" should be a vector")))

 ;; =============================================================================
 ;; ns desugaring


Fix :seq collection

Fix :seq collection

--- src/foreclojure/mongo.clj
+++ src/foreclojure/mongo.clj
@@ -21,10 +21,10 @@
 (defn prepare-seqs []
   (update! :seqs
            {:_id "problems"}
-           {:$set {:seq (apply max
-                               (map :_id
-                                    (fetch :problems
-                                           :only [:_id])))}}))
+           {:$set {:seq (inc (apply max
+                                    (map :_id
+                                         (fetch :problems
+                                                :only [:_id]))))}}))

 ;; make it easier to get off the ground by marking contributors automatically
 ;; useful since some "in-development" features aren't enabled for all users


pass gl context

pass gl context

--- src/gamma_driver/api.cljs
+++ src/gamma_driver/api.cljs
@@ -113,7 +113,7 @@
        :bind-attribute       bind-attribute
        :bind-texture-uniform bind-texture-uniform
        :bind-uniform         bind-uniform}
-      this program spec)))
+      (gdp/gl this) program spec)))

 ;; IDraw


Print timestamp when saving.

Print timestamp when saving.

--- src/gorilla_repl/core.clj
+++ src/gorilla_repl/core.clj
@@ -66,7 +66,7 @@
       (do
         (print (str "Saving: " ws " ... "))
         (spit (str (:worksheet-dir @config-info) ws) ws-data)
-        (println "done.")
+        (println (str "done. [" (java.util.Date.) "]"))
         (res/response {:status "ok"}))
       ;; else, create a new file and save in to that
       (do


Move docstring to proper place

Move docstring to proper place

--- src/hangul_utils/core.clj
+++ src/hangul_utils/core.clj
@@ -28,9 +28,9 @@
 (def ^:private final? (set final-jaeums))

 (defn deconstruct
-  [c]
   "Takes a single Korean syllable char and deconstructs it into its constituent
   jamo char: 강 => [ㄱ ㅏ ㅇ]"
+  [c]
   (let [codepoint (int c)
         diff (- codepoint 0xAC00)
         i (Math/floorDiv diff 588)


Refactor github/gen-pages

Refactor github/gen-pages

--- src/github_changelog/github.clj
+++ src/github_changelog/github.clj
@@ -30,9 +30,8 @@
           Long/parseLong))

 (defn- gen-pages [links]
-  (if-let [last-page (last-page-number links)]
-    (range 2 (inc last-page))
-    []))
+  (when-let [last-page (last-page-number links)]
+    (range 2 (inc last-page))))

 (defn- make-requests [config links]
   (map #(make-request config {:page %}) (gen-pages links)))


fix debug macros

fix debug macros

--- src/main/shadow/debug.clj
+++ src/main/shadow/debug.clj
@@ -28,7 +28,7 @@

 (defmacro ?>
   ([obj]
-   `(?> ~obj {}))
+   `(tap> [:shadow.remote/wrap ~obj ~(dbg-info &env &form {})]))
   ([obj opts]
    `(tap> [:shadow.remote/wrap ~obj ~(dbg-info &env &form opts)])))

@@ -38,13 +38,13 @@

 (defmacro ?->
   ([obj]
-   `(?-> ~obj {}))
+   `(tap-> ~obj ~(dbg-info &env &form {})))
   ([obj opts]
    `(tap-> ~obj ~(dbg-info &env &form opts))))

 (defmacro ?->>
   ([obj]
-   `(?->> {} ~obj))
+   `(tap-> ~obj ~(dbg-info &env &form {})))
   ([opts obj]
    `(tap-> ~obj ~(dbg-info &env &form opts))))

@@ -80,6 +80,8 @@
         y 2]
     (locals))

+  (?> :yo)
+
   (-> :thing
       (?-> :view-opts))


Expire cookies in 2021

Expire cookies in 2021

--- src/mars_ogler/routes.clj
+++ src/mars_ogler/routes.clj
@@ -51,6 +51,11 @@
       [visit-recent now now]
       [visit-last visit-start now])))

+(defn set-expires
+  [cookies]
+  (into {} (for [[c v] cookies]
+             [c {:value v, :expires "Wed, 13-Jan-2021 22:23:01 GMT"}])))
+
 (defroutes ogler-routes
   (GET "/" [& params :as {:keys [query-string cookies]}]
     (let [[visit-last
@@ -74,7 +79,8 @@
                          :visit-recent visit-recent
                          :cams (->> (:cams parsed-params)
                                  (map name)
-                                 (str/join " "))))}))
+                                 (str/join " ")))
+                  set-expires)}))
   (route/resources "/")
   (route/not-found "You have wandered into a maze of twisty passages, all alike"))


Remove unnecessary doall

Remove unnecessary doall

--- src/onyx/plugin/kafka.clj
+++ src/onyx/plugin/kafka.clj
@@ -344,12 +344,11 @@
   (write-batch
     [this {:keys [onyx.core/results]}]
     (let [messages (mapcat :leaves (:tree results))]
-      (doall
-       (->> messages
-            (map (fn [msg]
-                   (send-async! producer (message->producer-record serializer-fn topic (:message msg)))))
-            (doall)
-            (run! deref)))
+      (->> messages
+           (map (fn [msg]
+                  (send-async! producer (message->producer-record serializer-fn topic (:message msg)))))
+           (doall)
+           (run! deref))
       {}))

   (seal-resource


preserve callable-map metadata on assoc and cons

--- src/overtone/util/lib.clj
+++ src/overtone/util/lib.clj
@@ -112,12 +112,12 @@
          []
        (count       [] (count m))
        (seq         [] (seq m))
-       (cons        [[k v]] (callable-map (assoc m k v) fun))
+       (cons        [[k v]] (callable-map (assoc m k v) fun metadata))
        (empty       [] {})
        (equiv       [o] (= o m))
        (containsKey [k] (contains? m k))
        (entryAt     [k] (map-entry k (get m k)))
-       (assoc       [k v] (callable-map (assoc m k v) fun))
+       (assoc       [k v] (callable-map (assoc m k v) fun metadata))
        (valAt
          ([k] (get m k))
          ([k d] (get m k d)))


Revert to js behavior

Revert to js behavior

--- src/parse_names/core.cljs
+++ src/parse_names/core.cljs
@@ -5,8 +5,8 @@
   (let [name-obj (v/parse name)]
     (->> {:first-name (.-firstName name-obj)
           :last-name (.-lastName name-obj)
-          :leading-initial (.-salutation name-obj)
+          :salutation (.-salutation name-obj)
           :suffix (.-suffix name-obj)
-          :middle-name (.-initials name-obj)}
+          :initials (.-initials name-obj)}
          (filter (fn [[k v]] (not (empty? v))))
          (into {}))))


fn documentation

fn documentation

--- src/pretty/cli/colors.clj
+++ src/pretty/cli/colors.clj
@@ -1,6 +1,6 @@
 (ns pretty.cli.colors
   (:require [pretty.cli.ansi-escapes :as esc]))
-;TODO fn docs
+
 (def ^:private fg-const 30)
 (def ^:private bg-const 40)

@@ -11,25 +11,25 @@
      (str esc/esc-code (+ c color-val) "m" txt esc/reset-code)))
   ([color-val txt] (build-color-code color-val txt false)))

-(defn txt-bold "Return txt with bold display attribute" [txt] (str esc/esc-code "1m" txt esc/reset-code))
-(defn txt-dim "Return txt with dim display attribute" [txt] (str esc/esc-code "2m" txt esc/reset-code))
-(defn txt-underscore "Return txt with underscore display attribute" [txt] (str esc/esc-code "4m" txt esc/reset-code))
-(defn txt-blink "Return txt with blink display attribute" [txt] (str esc/esc-code "5m" txt esc/reset-code))
+(defn txt-bold "Return txt string with bold display attribute" [txt] (str esc/esc-code "1m" txt esc/reset-code))
+(defn txt-dim "Return txt string with dim display attribute" [txt] (str esc/esc-code "2m" txt esc/reset-code))
+(defn txt-underscore "Return txt string with underscore display attribute" [txt] (str esc/esc-code "4m" txt esc/reset-code))
+(defn txt-blink "Return txt string  with blink display attribute" [txt] (str esc/esc-code "5m" txt esc/reset-code))

-(defn black "Text color black" [txt] (build-color-code 0 txt))
-(defn red "Text color red" [txt] (build-color-code 1 txt))
-(defn green "Text color green" [txt] (build-color-code 2 txt))
-(defn yellow "Text color yellow" [txt] (build-color-code 3 txt))
-(defn blue "Text color blue" [txt] (build-color-code 4 txt))
-(defn magenta "Text color magenta" [txt] (build-color-code 5 txt))
-(defn cyan "Text color cyan" [txt] (build-color-code 6 txt))
-(defn white "Text color white" [txt] (build-color-code 7 txt))
+(defn black "Return txt string with black color" [txt] (build-color-code 0 txt))
+(defn red "Return txt string with red color" [txt] (build-color-code 1 txt))
+(defn green "Return txt string with green color" [txt] (build-color-code 2 txt))
+(defn yellow "Return txt string with yellow color" [txt] (build-color-code 3 txt))
+(defn blue "Return txt string with blue color" [txt] (build-color-code 4 txt))
+(defn magenta "Return txt string with magenta color" [txt] (build-color-code 5 txt))
+(defn cyan "Return txt string with cyan color" [txt] (build-color-code 6 txt))
+(defn white "Return txt string with white color" [txt] (build-color-code 7 txt))

-(defn black-bg "Text background color black" [txt] (build-color-code 0 txt true))
-(defn red-bg "Text background color red" [txt] (build-color-code 1 txt true))
-(defn green-bg "Text background color green" [txt] (build-color-code 2 txt true))
-(defn yellow-bg "Text background color yellow" [txt] (build-color-code 3 txt true))
-(defn blue-bg "Text background color blue" [txt] (build-color-code 4 txt true))
-(defn magenta-bg "Text background color magenta" [txt] (build-color-code 5 txt true))
-(defn cyan-bg "Text background color cyan" [txt] (build-color-code 6 txt true))
-(defn white-bg "Text background color white" [txt] (build-color-code 7 txt true))
+(defn black-bg "Return txt string with black background color" [txt] (build-color-code 0 txt true))
+(defn red-bg "Return txt string with red background color" [txt] (build-color-code 1 txt true))
+(defn green-bg "Return txt string with green background color" [txt] (build-color-code 2 txt true))
+(defn yellow-bg "Return txt string with yellow background color" [txt] (build-color-code 3 txt true))
+(defn blue-bg "Return txt string with blue background color" [txt] (build-color-code 4 txt true))
+(defn magenta-bg "Return txt string with magenta background color" [txt] (build-color-code 5 txt true))
+(defn cyan-bg "Return txt string with cyan background color" [txt] (build-color-code 6 txt true))
+(defn white-bg "Return txt string with white background color" [txt] (build-color-code 7 txt true))


fixing dest path

fixing dest path

--- src/remote/capistrano.clj
+++ src/remote/capistrano.clj
@@ -24,20 +24,19 @@

 (import-logging)

-(defconstrainedrecord Capistrano [src args dst timeout]
-  "A capistrano remote agent"
-  []
+;; A capistrano remote agent
+(defrecord Capistrano [src args dst timeout]
   Remoter
   (setup [this]
          (when (exists? (dest-path src dst))
            (throw+ {:type ::old-code :message "Old code found in place, cleanup first"}))
          (mkdirs dst)
+         (copy src dst)
          (try
-           (sh- "cap" "-T" {:dir dst})
+           (sh- "cap" "-T" {:dir (dest-path src dst)})
            (catch Throwable e
              (error e)
-             (throw+ {:type ::cap-sanity-failed :message "Failed to run Capistrano sanity"})))
-         (copy src dst))
+             (throw+ {:type ::cap-sanity-failed :message "Failed to run Capistrano sanity"}))))
   (run [this]
        (info (dest-path src dst))
        (apply sh- "cap" (conj args {:dir (dest-path src dst) :timeout timeout})))


Fix -ptions typo

Fix -ptions typo

--- src/uruk/core.clj
+++ src/uruk/core.clj
@@ -256,10 +256,10 @@
   "Given a SecurityOptions object, returns a map describing its
   configuration."
   [security-options]
-  {:hashcode (.hashCode security-ptions)
-   :cipher-suites (.getEnabledCipherSuites security-ptions)
-   :protocols (.getEnabledProtocols security-ptions)
-   :ssl-context (.getSslContext security-ptions)})
+  {:hashcode (.hashCode security-options)
+   :cipher-suites (.getEnabledCipherSuites security-options)
+   :protocols (.getEnabledProtocols security-options)
+   :ssl-context (.getSslContext security-options)})

 (defn configure-content-source
   "Given a ContentSource object, modifies that object according to the


Type checking in functions parseInt, parseFloat, and loadConfiguration

--- src/zg/config.clj
+++ src/zg/config.clj
@@ -7,7 +7,7 @@
 ;  http://www.eclipse.org/legal/epl-v10.html
 ;
 ;  Contributors:
-;      Pavel Tisnovsky
+;      Pavel Tisnovsky
 ;

 (ns zg.config
@@ -19,17 +19,17 @@

 (defn parse-int
     "Parse the given string as an integer number."
-    [string]
+    [^String string]
     (java.lang.Integer/parseInt string))

 (defn parse-float
     "Parse the given string as a float number."
-    [string]
+    [^String string]
     (java.lang.Float/parseFloat string))

 (defn load-configuration
     "Load configuration from the provided INI file."
-    [ini-file-name]
+    [^String ini-file-name]
     (clojure-ini/read-ini ini-file-name :keywordize? true))

 (defn print-configuration


Add missing fields on loaded image collections.

--- src/uxbox/main/data/images.cljs
+++ src/uxbox/main/data/images.cljs
@@ -45,16 +45,33 @@
       (rx/empty))))

 (defn initialize
-  []
-  (Initialize.))
+  [type id]
+  (Initialize. type id))
+
+;; --- Select a Collection
+
+(defrecord SelectCollection [type id]
+  rs/WatchEvent
+  (-apply-watch [_ state stream]
+    (rx/of (r/navigate :dashboard/images
+                       {:type type :id id}))))
+
+(defn select-collection
+  ([type]
+   (select-collection type nil))
+  ([type id]
+   {:pre [(keyword? type)]}
+   (SelectCollection. type id)))

 ;; --- Color Collections Fetched

 (defrecord CollectionsFetched [items]
   rs/UpdateEvent
   (-apply-update [_ state]
-    (reduce (fn [acc {:keys [id] :as item}]
-               (assoc-in acc [:images-by-id id] item))
+    (reduce (fn [state item]
+              (let [id (:id item)
+                    item (assoc item :type :own)]
+                (assoc-in state [:images-by-id id] item)))
             state
             items)))

@@ -80,10 +97,11 @@
 (defrecord CollectionCreated [item]
   rs/UpdateEvent
   (-apply-update [_ state]
-    (-> state
-        (assoc-in [:images-by-id (:id item)] item)
-        (assoc-in [:dashboard :collection-id] (:id item))
-        (assoc-in [:dashboard :collection-type] :own))))
+    (let [item (assoc item :type :own)]
+      (-> state
+          (assoc-in [:images-by-id (:id item)] item)
+          (assoc-in [:dashboard :collection-id] (:id item))
+          (assoc-in [:dashboard :collection-type] :own)))))

 (defn collection-created
   [item]


Search for hashtag

Search for hashtag

--- src/layzee/adapters/twitter.clj
+++ src/layzee/adapters/twitter.clj
@@ -48,4 +48,4 @@

 (defn lazy-web [consumer-token & opts]
   (let [token (bearer-token-for consumer-token)]
-    (search token "lazyweb" log (if (nil? opts) {} (first opts)))))
+    (search token "#lazyweb" log (if (nil? opts) {} (first opts)))))


remove stale emacs autosave file

remove stale emacs autosave file


Error message consistency

Error message consistency

--- test/caesium/crypto/box_test.clj
+++ test/caesium/crypto/box_test.clj
@@ -51,5 +51,5 @@
       (is (thrown? ClassCastException (b/encrypt pk sk nonce ptext))))
     (let [forgery (r/randombytes (alength ctext))]
       (is (thrown-with-msg?
-           RuntimeException #"Ciphertext validation failed"
+           RuntimeException #"Ciphertext verification failed"
            (b/decrypt bob-pk alice-sk nonce forgery))))))


Test for function message-to-channel?

Test for function message-to-channel?

--- test/clj_mrazik/irc_bot_test.clj
+++ test/clj_mrazik/irc_bot_test.clj
@@ -166,3 +166,13 @@
     (testing "if the clj-mrazik.irc-bot/start-irc-bot definition exists."
         (is (callable? 'clj-mrazik.irc-bot/start-irc-bot))))

+(deftest test-message-to-channel?
+    "Check the behaviour of function clj-mrazik.irc-bot/message-to-channel?"
+    (testing "the function message-to-channel?"
+        (is (message-to-channel? {:target "#"}))
+        (is (message-to-channel? {:target "#channel"}))
+        (is (message-to-channel? {:target "#channel message"}))
+        (is (not (message-to-channel? {:target ""})))
+        (is (not (message-to-channel? {:target "channel"})))
+        (is (not (message-to-channel? {:target "channel message"})))))
+


Improve FMI weather data fetching unit tests

Remove unnecessary imports and add one test case for a edge case.

--- test/env_logger/grabber_test.clj
+++ test/env_logger/grabber_test.clj
@@ -5,11 +5,9 @@
             [clj-time.core :as t]
             [clj-time.format :as f]
             [cheshire.core :refer [generate-string]]
-            [env-logger.db-test :refer [test-postgres]]
             [env-logger.grabber :refer :all])
   (:import org.joda.time.DateTime
-           org.joda.time.DateTimeZone
-           java.util.concurrent.TimeUnit))
+           org.joda.time.DateTimeZone))

 (deftest test-parse-xml
   (testing "XML parser tests"
@@ -344,12 +342,16 @@
 (deftest weather-query-ok
   (testing "Test when it is OK to query for FMI weather data"
     (with-redefs [j/query (fn [db query] '())]
-      (is (true? (weather-query-ok? test-postgres 5))))
+      (is (true? (weather-query-ok? {} 5))))
     (with-redefs [j/query (fn [db query]
                             (list {:recorded (t/minus (t/now)
                                                       (t/minutes 3))}))]
-      (is (false? (weather-query-ok? test-postgres 5))))
+      (is (false? (weather-query-ok? {} 5))))
+    (with-redefs [j/query (fn [db query]
+                            (list {:recorded (t/minus (t/now)
+                                                      (t/minutes 3))}))]
+      (is (false? (weather-query-ok? {} 3))))
     (with-redefs [j/query (fn [db query]
                             (list {:recorded (t/minus (t/now)
                                                       (t/minutes 6))}))]
-      (is (true? (weather-query-ok? test-postgres 5))))))
+      (is (true? (weather-query-ok? {} 5))))))


Return inserted id for SQLite3

Return inserted id for SQLite3

--- src/toucan/db.clj
+++ src/toucan/db.clj
@@ -513,12 +513,14 @@
   "Get the ID of a row inserted by `jdbc/db-do-prepared-return-keys`."
   [insert-result]
   (or
-   ;; Postgres, newer H2, and most others return :id
-   (:id insert-result)
-   ;; :generated_key is returned by MySQL
-   (:generated_key insert-result)
-   ;; scope_identity() returned by older versions of H2
-   ((keyword "scope_identity()") insert-result)))
+    ;; Postgres, newer H2, and most others return :id
+    (:id insert-result)
+    ;; :generated_key is returned by MySQL
+    (:generated_key insert-result)
+    ;; scope_identity() returned by older versions of H2
+    ((keyword "scope_identity()") insert-result)
+    ;; last_insert_rowid() returned by SQLite3
+    ((keyword "last_insert_rowid()") insert-result)))

 (defn simple-insert-many!
   "Do a simple JDBC `insert!` of multiple objects into the database.


Update metadata for with-x macroses.

Update metadata for with-x macroses.

--- src/quil/core.clj
+++ src/quil/core.clj
@@ -4296,7 +4296,8 @@
   ^{:requires-bindings true
     :processing-name nil
     :category "Color"
-    :subcategory "Utility Macros"}
+    :subcategory "Utility Macros"
+    :added "1.7"}
   with-fill
   "Temporarily set the fill color for the body of this macro.
    The code outside of with-fill form will have the previous fill color set.
@@ -4314,7 +4315,8 @@
   ^{:requires-bindings true
     :processing-name nil
     :category "Color"
-    :subcategory "Utility Macros"}
+    :subcategory "Utility Macros"
+    :added "1.7"}
   with-stroke
   "Temporarily set the stroke color for the body of this macro.
    The code outside of with-stroke form will have the previous stroke color set.
@@ -4332,7 +4334,8 @@
   ^{:requires-bindings true
     :processing-name nil
     :category "Transform"
-    :subcategory "Utility Macros"}
+    :subcategory "Utility Macros"
+    :added "1.0"}
   with-translation
   "Performs body with translation, restores current transformation on
   exit."
@@ -4347,7 +4350,8 @@
   ^{:requires-bindings true
     :processing-name nil
     :category "Transform"
-    :subcategory "Utility Macros"}
+    :subcategory "Utility Macros"
+    :added "1.0"}
   with-rotation
   "Performs body with rotation, restores current transformation on exit.
   Accepts a vector [angle] or [angle x-axis y-axis z-axis].
@@ -4362,7 +4366,12 @@
      ~@body
      (pop-matrix)))

-(defmacro with-graphics
+(defmacro
+  ^{:requires-bindings true
+    :processing-name nil
+    :category "Rendering"
+    :added "1.7"}
+  with-graphics
   "All subsequent calls of any drawing function will draw on given graphics.
   'with-graphics' cannot be nested (you can draw simultaneously only on 1 graphics)"
   [graphics & body]