Add line-simplification, curve-interpolation fns

--- src/clj/genartlib/curves.clj
+++ src/clj/genartlib/curves.clj
@@ -1,8 +1,10 @@
 (ns genartlib.curves
   (:require
-    [genartlib.algebra :refer [interpolate point-dist]]))
+    [genartlib.algebra :refer [interpolate point-dist]]
+    [genartlib.util :refer [enumerate]]))

-(defn- single-chaikin-step [points tightness]
+(defn ^:private single-chaikin-step
+  [points tightness]
   (mapcat (fn [[[start-x start-y] [end-x end-y]]]
             (let [q-x (interpolate start-x end-x (+ 0.0 tightness))
                   q-y (interpolate start-y end-y (+ 0.0 tightness))
@@ -59,7 +61,7 @@
 (defn split-curve-with-step
   [curve-to-split step-size]
   (if (<= (count curve-to-split) 1)
-    curve-to-split
+    []
     (loop [curve (rest curve-to-split)
            segments (transient [])
            current-segment (transient [(first curve-to-split)])
@@ -96,3 +98,81 @@
     (let [total-length (curve-length curve)
           segment-length (/ total-length num-parts)]
       (split-curve-with-step curve segment-length))))
+
+(defn interpolate-curve
+  "Find a point along a curve, where t is between 0.0 and 1.0. For optimization
+   purposes, the curve-len can be passed in as the third param."
+  [curve t & [curve-len]]
+  (let [first-point (first curve)
+        last-point (last curve)]
+
+    (cond
+      (<= t 0)
+      first-point
+
+      (>= t 1)
+      last-point
+
+      (= 2 (count curve))
+      (let [mid-x (interpolate (first first-point) (first last-point) t)
+            mid-y (interpolate (second first-point) (second last-point) t)
+            mid-point [mid-x mid-y]]
+        [[first-point mid-point]
+         [mid-point last-point]])
+
+      :else
+      (let [total-len (or curve-len (curve-length curve))
+            target-len (* total-len t)]
+
+        (loop [curve (rest curve)
+               current-length 0
+               prev-point first-point]
+
+          (if (empty? curve)
+            last-point ; probably shouldn't happen?
+
+            (let [new-point (first curve)
+                  new-dist (point-dist prev-point new-point)
+                  new-length (+ current-length new-dist)]
+
+              (if (< new-length target-len)
+                (recur (rest curve) new-length new-point)
+
+                ; we need to split
+                (let [dist-needed (- target-len current-length)
+                      inner-t (/ dist-needed new-dist)
+                      x (interpolate (first prev-point) (first new-point) inner-t)
+                      y (interpolate (second prev-point) (second new-point) inner-t)]
+                  [x y])))))))))
+
+(defn ^:private point-to-line-dist
+  "[x1 y1] and [x2 y2] define the line, [x0 y0] defines the point."
+  [[x1 y1] [x2 y2] [x0 y0]]
+  (let [denom (Math/sqrt (+ (Math/pow (- y2 y1) 2)
+                            (Math/pow (- x2 x1) 2)))]
+    (if (zero? denom)
+      0
+      (/ (Math/abs (+ (*  1 (* (- y2 y1) x0))
+                      (* -1 (* (- x2 x1) y0))
+                      (*  1 (* x2 y1))
+                      (* -1 (* y2 x1))))
+         denom))))
+
+(defn line-simplification
+  "An implementation of the Ramer-Douglas-Peucker line simplification algorithm.
+   A good value for `min-tolerated-dist` is probably between 0.0001 and 0.01 times
+   the image width, depending on your use case."
+  [points min-tolerated-dist]
+  (if (<= (count points) 2)
+    points
+    (let [start-point (first points)
+          last-point (last points)
+          point-dists (map #(point-to-line-dist start-point last-point %) points)
+          [max-index max-dist] (apply max-key second (enumerate point-dists))]
+      (if (< max-dist min-tolerated-dist)
+        [start-point last-point]
+        (concat
+          (line-simplification (take (inc max-index) points)
+                               min-tolerated-dist)
+          (drop 1 (line-simplification (drop max-index points)
+                                       min-tolerated-dist)))))))


colors

colors

--- src/clj/just_married/css.clj
+++ src/clj/just_married/css.clj
@@ -105,7 +105,7 @@
                  :font-size "x-large"}]

    [:.button__add-to-calendar {:background-color (:dark-red COLOR-PALLETTE)
-                                      :color (:white COLOR-PALLETTE)}]
+                               :color (:white COLOR-PALLETTE)}]
    [:.find-us {:grid-column 1
                :grid-row 2}]


fix page dispatch

fix page dispatch

--- src/clj/lesezeichen/core.clj
+++ src/clj/lesezeichen/core.clj
@@ -71,7 +71,7 @@
         (case topic
           :get-user-bookmarks {:topic topic :data (get-user-bookmarks conn data)}
           :get-all-bookmarks {:topic topic :data (get-all-bookmarks conn)}
-          :sign-up {:topic topic :data (add-user conn (assoc data :host (:mail-host state)))}
+          :sign-up {:topic topic :data (add-user conn (assoc data :host (:mail-host @state)))}
           :register-device {:topic topic :data (register-device conn data)}
           :add-bookmark {:topic topic :data (add-bookmark conn (assoc data :title (fetch-url-title (:url data))))}
           :verify-token (handle-token state channel msg)
@@ -106,10 +106,12 @@
   (resources "/")
   (GET "/bookmark/ws" [] bookmark-handler)
   (GET "/*" {{auth-code :auth email :email} :params}
-       (if (or auth-code email)
-         (dev-page :auth)
-         (if (= (:build @server-state) :prod)
-           (static-page)
+       (if (= (:build @server-state) :prod)
+         (if (or auth-code email)
+           (static-page :auth)
+           (static-page :client))
+         (if (or auth-code email)
+           (dev-page :auth)
            (dev-page :client)))))


Added a few functions

Added a few functions

fract, sin, sin-01


Added additional info on importing decks

--- src/cljs/netrunner/help.cljs
+++ src/cljs/netrunner/help.cljs
@@ -88,9 +88,11 @@
                        "happy to play with a beginner should join after a while."]}
             {:id "finddecks"
              :title "Where can I find some good starting decks?"
-             :content [:p [:a {:href "https://netrunnerdb.com/"} "NetrunnerDB"] " is a good resource for finding decks of all kinds. "
+             :content (list [:p [:a {:href "https://netrunnerdb.com/"} "NetrunnerDB"] " is a good resource for finding decks of all kinds. "
                        "For finding decks consisting of core set only try setting some filters in "
-                       [:a {:href "http://netrunnerdb.com/en/decklists/search#allowed_packs"} "the decklist search"] "."]}
+                       [:a {:href "http://netrunnerdb.com/en/decklists/search#allowed_packs"} "the decklist search"] "."]
+                            [:p "Once you find a deck you like, export it in Jinteki.net's format (or plain text format if the "
+                             "site doesn't offer the former), copy and paste it into the deckbuilder."])}
             {:id "communities"
              :title "Where can I find other Netrunner players to talk to?"
              :content [:p "Apart from the chatrooms here on Jinteki.net, here are a few links to online Netrunner communities:"


Make sure the buttons refresh when the project tree is blank

--- src/clojure/nightcode/ui.clj
+++ src/clojure/nightcode/ui.clj
@@ -110,6 +110,8 @@
 (defmethod adjust-nodes nil [_ _ children] children)

 (defn reduce-nodes
+  "Runs the nodes through whatever `adjust-nodes` multi-methods are indicated in
+*node-adjustment-types*"
   [parent children]
   (reduce #(adjust-nodes %2 parent %1) children *node-adjustment-types*))

@@ -201,6 +203,6 @@
     ; select the first project if there is nothing selected
     (when (nil? (.getSelectionPath tree))
       (.setSelectionRow tree 0))
-    ; if there is still nothing selected, reset atom so the buttons refresh
-    (when (nil? @tree-selection)
+    ; if the project tree is blank, reset atom so the buttons refresh
+    (when (= 0 (count @tree-projects))
       (reset! tree-selection nil))))


Remove debug statements when the picard internal log is not enabled.

--- src/clojure/picard/utils.clj
+++ src/clojure/picard/utils.clj
@@ -24,20 +24,17 @@
     InetAddress
     InetSocketAddress
     URI]
-   [java.util
-    UUID]))
+   java.util.UUID
+   org.apache.log4j.Logger))

 (def VERSION "0.0.1")
 (def SERVER-NAME (str "Picard " VERSION " - *FACEPALM*"))

 (defmacro debug
   [cmpnt msg]
-  `(log/log :debug ~msg nil ~(str "picard.internal." (name cmpnt))))
-
-(defmacro when-debug
-  [cmpnt & stmts]
-  (when (log/enabled? :debug (str "picard.internal." (name cmpnt)))
-    `(do ~@stmts)))
+  (let [logger-name (str "picard.internal." (name cmpnt))]
+    (when (.isDebugEnabled (Logger/getLogger logger-name))
+      `(log/log :debug ~msg nil ~logger-name))))

 (defmacro returning
   [val & stmts]


Add labels

Add labels

The labels look good but we currently have performance issues.

--- src/graphito/core.cljs
+++ src/graphito/core.cljs
@@ -34,6 +34,11 @@
 (def displacement-factor 1)

 (def max-radius 32)
+(def label-font "Verdana")
+(def label-font-size 24)
+
+(def label-y 42)
+(def label-y-transform (str "translate(0," label-y ")"))

 (def zoom-out-scale 0.25)

@@ -110,8 +115,8 @@
       (v/add view-center
              (v/multiply displacement (/ projected-r r))))))

-(defn project-radius [t]
-  (* max-radius (min 1 (/ 1 (.pow js/Math 2 (* 2 (- t 0.25)))))))
+(defn project-scale [t]
+  (min 1 (/ 1 (.pow js/Math 2 (* 2 (- t 0.25))))))

 (defn project-opacity [t]
   (cond
@@ -120,13 +125,17 @@
     (<= 2 t 3) (- 0.75 (* 0.75 (- t 2)))
     :else 0))

+(defn project-label-opacity [t] 1)
+
 (def fisheye-projectors {:project-displacement project-displacement
-                         :project-radius project-radius
-                         :project-opacity project-opacity})
+                         :project-scale project-scale
+                         :project-opacity project-opacity
+                         :project-label-opacity project-label-opacity})

 (def zoom-out-projectors {:project-displacement (partial * zoom-out-scale)
-                          :project-radius (constantly (* zoom-out-scale max-radius))
-                          :project-opacity (constantly 1)})
+                          :project-scale (constantly zoom-out-scale)
+                          :project-opacity (constantly 1)
+                          :project-label-opacity (constantly 0)})

 (defn projectors-for-state [state]
   (if (= (:projection state) :fisheye) fisheye-projectors zoom-out-projectors))
@@ -148,8 +157,9 @@
                 node-tap-signaller
                 link-tap-signaller]} state
         {:keys [project-displacement
-                project-radius
-                project-opacity]} (projectors-for-state state)
+                project-scale
+                project-opacity
+                project-label-opacity]} (projectors-for-state state)
         transition (fn [selection]
                      (animation-signaller true)
                      (-> selection
@@ -179,20 +189,38 @@
           (.attr "y1" #(-> % :source positions v/y))
           (.attr "x2" #(-> % :target positions v/x))
           (.attr "y2" #(-> % :target positions v/y))))
-    (let [node-selection (-> svg (.selectAll ".node") (.data (apply array nodes)))]
-      (-> node-selection .enter
-          (.append "circle")
-          (.attr "class" "node")
+    (let [node-selection (-> svg (.selectAll ".node")
+                             (.data (apply array nodes)))
+          new-node-selection (-> node-selection .enter
+                                 (.append "g")
+                                 (.attr "class" "node"))]
+      (-> new-node-selection (.append "circle")
+          (.attr "class" "node-dot")
           (.style "fill" "#777A7A")
+          (.attr "r" max-radius)
           (.each
             (fn [node]
               (this-as elem (add-tap-listener elem #(node-tap-signaller node))))))
+      (-> new-node-selection (.append "text")
+          (.attr "class" "node-label")
+          (.attr "y" ".6em")
+          (.attr "font-family" label-font)
+          (.attr "font-size" (str label-font-size))
+          (.style "text-anchor" "middle")
+          (.attr "transform" label-y-transform))
       (-> node-selection
           maybe-transition
-          (.attr "cx" (fn [d i] (v/x (positions i))))
-          (.attr "cy" (fn [d i] (v/y (positions i))))
-          (.attr "r" (fn [d i] (project-radius (distances-from-camera i))))
-          (.style "opacity" (fn [d i] (project-opacity (distances-from-camera i))))))))
+          (.attr "transform"
+                 (fn [d i]
+                   (let [scale (project-scale (distances-from-camera i))
+                         x (v/x (positions i))
+                         y (v/y (positions i))]
+                     (str "translate(" x "," y ") scale(" scale ")")))))
+      (-> node-selection (.selectAll ".node-label")
+          maybe-transition
+          (.attr "opacity" (fn [d i]
+                             (project-label-opacity (distances-from-camera i))))
+          (.text #(:title %))))))

 ;; State management


Refactor d3 code

Refactor d3 code

No longer repeat the attribute functions in the enter and update
sections.

--- src/graphito/core.cljs
+++ src/graphito/core.cljs
@@ -162,35 +162,27 @@
         distances-from-camera
         (mapv (fn [node]
                 (scaled-distance-from-camera state (:pos node))) nodes)]
-    (-> svg (.selectAll ".link")
-        (.data (apply array links))
-        (.attr "x1" #(-> % :source positions :x))
-        (.attr "y1" #(-> % :source positions :y))
-        (.attr "x2" #(-> % :target positions :x))
-        (.attr "y2" #(-> % :target positions :y))
-        .enter
-        (.append "line")
-        (.attr "class" "link")
-        (.style "stroke" "#C9CBCB")
-        (.style "stroke-width" 3)
-        (.attr "x1" #(-> % :source positions :x))
-        (.attr "y1" #(-> % :source positions :y))
-        (.attr "x2" #(-> % :target positions :x))
-        (.attr "y2" #(-> % :target positions :y)))
-    (-> svg (.selectAll ".node")
-        (.data (apply array nodes))
+    (let [link-selection (-> svg (.selectAll ".link") (.data (apply array links)))]
+      (-> link-selection .enter
+          (.append "line")
+          (.attr "class" "link")
+          (.style "stroke" "#C9CBCB")
+          (.style "stroke-width" 3))
+      (-> link-selection
+          (.attr "x1" #(-> % :source positions :x))
+          (.attr "y1" #(-> % :source positions :y))
+          (.attr "x2" #(-> % :target positions :x))
+          (.attr "y2" #(-> % :target positions :y))))
+    (let [node-selection #(-> svg (.selectAll ".node") (.data (apply array nodes)))]
+      (-> (node-selection) .enter
+        (.append "circle")
+        (.attr "class" "node")
+        (.style "fill" "#777A7A"))
+      (-> (node-selection)
         (.attr "cx" (fn [d i] (:x (positions i))))
         (.attr "cy" (fn [d i] (:y (positions i))))
         (.attr "r" (fn [d i] (project-radius (distances-from-camera i))))
-        (.style "opacity" (fn [d i] (project-opacity (distances-from-camera i))))
-        .enter
-        (.append "circle")
-        (.attr "class" "node")
-        (.style "fill" "#777A7A")
-        (.attr "cx" (fn [d i] (:x (positions i))))
-        (.attr "cy" (fn [d i] (:y (positions i))))
-        (.attr "r" (fn [d i] (project-radius (distances-from-camera i))))
-        (.style "opacity" (fn [d i] (project-opacity (distances-from-camera i)))))))
+        (.style "opacity" (fn [d i] (project-opacity (distances-from-camera i))))))))

 ;; State management


create moves table

create moves table

--- src/greybear/model.clj
+++ src/greybear/model.clj
@@ -21,11 +21,17 @@
                      [:id :serial "primary key"]
                      [:white_id :serial "references players (id)"]
                      [:black_id :serial "references players (id)"]
-                     [:stones "varchar"]))
+                     [:stones "varchar"])
+
+  (jdbc/create-table :moves
+                     [:move "varchar"]
+                     [:ordinal "smallint"]
+                     [:game_id :serial "references games (id)"]))

 (defn teardown
   "use with a jdbc connection"
   []
+  (jdbc/drop-table :moves)
   (jdbc/drop-table :games)
   (jdbc/drop-table :players))

@@ -51,12 +57,17 @@
   (entity-fields :name)
   (has-many games {:fk :white_id}))

+(defentity moves
+  (table :moves)
+  (entity-fields :move :order)
+  (belongs-to games {:fk :game_id}))
+
 (defentity games
   (table :games)
-  (entity-fields :board :white :black)
+  (entity-fields :board :white :black :moves)
+  (has-many moves {:fk :game_id})
   (belongs-to player-w {:fk :white_id})
   (belongs-to player-b {:fk :black_id}))
-

 (defn read-game [game-id]
   (first
@@ -88,7 +99,6 @@
     (catch org.postgresql.util.PSQLException e
       nil)))

-
 (def ^:const starting-stones
   (apply str (repeat (* 19 19) "0")))


Relative path to words dict

Relative path to words dict

--- src/major_system/browser.cljs
+++ src/major_system/browser.cljs
@@ -20,7 +20,7 @@
 (def worker-count 1)

 (if (servant/webworker?)
-  (take! (http/get "/words-by-number.edn")
+  (take! (http/get "../words-by-number.edn")
          (fn [res] (let [res (reader/read-string (:body res))]
                     (def words-by-number res)))))


Make sure that the question changes on every step

--- src/sinusoides/views/main.cljs
+++ src/sinusoides/views/main.cljs
@@ -34,11 +34,21 @@
                      #(rand-nth [[" I " "am"]
                                  [" you " "are"]
                                  [" they " "are"]])]
+
                parts (r/atom ;; (vec (map apply gens))
-                       ["What " " you" [" I " "am"]])
-               randomize (fn []
-                           (let [[idx gen] (rand-nth (map-indexed vector gens))]
-                             (swap! parts #(assoc % idx (gen)))))
+                      ["What " " you" [" I " "am"]])
+
+               gen-new
+               (fn [gen elem]
+                 (first (first
+                   (drop-while (fn [[a b]] (= a b))
+                               (map vector (repeatedly gen) (repeat elem))))))
+
+               randomize
+               (fn []
+                 (let [[idx gen] (rand-nth (map-indexed vector gens))]
+                   (swap! parts #(assoc % idx (gen-new gen (% idx))))))
+
                interval (.setInterval js/window randomize 6000)

                transition {:transition-name "part"


Ping via ASK query instead of HTTP HEAD request. Some endpoints don't support the HEAD method.

--- src/sparql_to_csv/endpoint.clj
+++ src/sparql_to_csv/endpoint.clj
@@ -8,10 +8,12 @@
   (:import (java.net UnknownHostException)))

 (defn init-endpoint
-  "Ping endpoint to test if it is up."
+  "Ping endpoint to test if it is up."
   [{::spec/keys [auth endpoint max-retries sleep]}]
-  (try+ (let [virtuoso? (-> endpoint
-                            (client/head (cond-> {:throw-entire-message? true}
+  (try+ (let [test-query "ASK { [] ?p [] . }"
+              virtuoso? (-> endpoint
+                            (client/get (cond-> {:query-params {"query" test-query}
+                                                 :throw-entire-message? true}
                                            auth (assoc :digest-auth auth)))
                             (get-in [:headers "Server"] "")
                             (string/includes? "Virtuoso"))]


arc radius; alpha

arc radius; alpha

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

--- plugins/SlideExplorer2/src/slide_explorer/canvas.clj
+++ plugins/SlideExplorer2/src/slide_explorer/canvas.clj
@@ -1,5 +1,5 @@
 (ns slide-explorer.core
-  (:import (java.awt Color Font Graphics Graphics2D Polygon RenderingHints)
+  (:import (java.awt AlphaComposite Color Font Graphics Graphics2D Polygon RenderingHints)
            (java.awt.font TextAttribute)
            (javax.swing JFrame JPanel)))

@@ -29,9 +29,13 @@
 (def default-primitive-params
   {:filled false :color Color/BLACK})

-(defn set-style [g2d params]
+(defn set-style [g2d {:keys [alpha color]}]
   (doto g2d
-    (.setColor (:color params))))
+    (.setComposite (if (or (not alpha)
+                           (= alpha 1))
+                     AlphaComposite/Src
+                     (AlphaComposite/getInstance AlphaComposite/SRC_ATOP alpha)))
+    (.setColor (if color color Color/BLACK))))

 (defn- -? [a b]
   (when (and a b)
@@ -108,10 +112,14 @@
     (.drawRect g2d l t w h)))

 (defmethod draw-primitive :primitive-round-rect
-  [g2d shape {:keys [l t w h filled arc-width arc-height]}]
-  (if filled
-    (.fillRoundRect g2d l t w h arc-width arc-height)
-    (.drawRoundRect g2d l t w h arc-width arc-height)))
+  [g2d shape {:keys [l t w h filled arc-radius arc-width arc-height]}]
+  (if filled
+    (.fillRoundRect g2d l t w h
+                    (or arc-radius arc-width)
+                    (or arc-radius arc-height))
+    (.drawRoundRect g2d l t w h
+                    (or arc-radius arc-width)
+                    (or arc-radius arc-height))))

 (defn draw-string-center
   "Draw a string centered at position x,y."
@@ -171,11 +179,10 @@
   [
    {:type :primitive-round-rect
     :params {:l 20 :t 10 :w 140 :h 140
-             :arc-width 20 :arc-height 20
+             :arc-radius 20 :arc-height 20
              :filled true :color Color/RED}}
    {:type :primitive-ellipse
     :params {:l 25 :t 15 :w 110 :h 90
-             :arc-width 20 :arc-height 20
              :filled true :color Color/YELLOW}}
    {:type :primitive-round-rect
     :params {:x 90 :y 80 :r 160 :b 150
@@ -188,8 +195,9 @@
              :filled false
              :closed true}}
    {:type :primitive-text
-    :params {:x 180 :y 280 :text "TEST"
+    :params {:x 180 :y 120 :text "TEST"
              :color Color/BLUE
+             :alpha 0.5
              :font {:name "Courier New"
                     :bold true
                     :italic false
@@ -197,9 +205,9 @@
                     :strikethrough false
                     :size 100}}}
    {:type :primitive-line
-    :params {:x 180 :y 280 :w 0 :h 300 :color Color/RED}}
+    :params {:x 180 :y 120 :w 0 :h 300 :color Color/RED}}
    {:type :primitive-line
-    :params {:x 180 :y 280 :w 10 :h 0 :color Color/RED}}
+    :params {:x 180 :y 120 :w 10 :h 0 :color Color/RED}}
    {:type :primitive-arc
     :params {:l 40 :t 30 :w 100 :h 100
              :start-angle 10 :arc-angle 100 :color Color/GREEN


Fix message-for-me?

Fix message-for-me?

--- src/antlion_clojure/slack.clj
+++ src/antlion_clojure/slack.clj
@@ -34,8 +34,9 @@

 (defn message-for-me?
   [res self]
-  (re-matches (re-pattern (str "\\<\\@" self "\\> .*"))
-              (:text res)))
+  (when (:text res)
+    (re-matches (re-pattern (str "\\<\\@" self "\\> .*"))
+                (:text res))))

 (defn post
   [{:keys [connection]} {:keys [channel text]}]


Remove unused fn.

Remove unused fn.

--- src/oc/storage/api/boards.clj
+++ src/oc/storage/api/boards.clj
@@ -24,9 +24,6 @@
             [oc.storage.resources.reaction :as reaction-res]))

 ;; ----- Utility functions -----
-
-(defn- topic-for-name [topic-name]
-  {:name topic-name :slug (slugify/slugify topic-name)})

 (defn- comments
   "Return a sequence of just the comments for an entry."


Disable auto-recovery for now

Disable auto-recovery for now

--- src/onyx/state/bookkeeper.clj
+++ src/onyx/state/bookkeeper.clj
@@ -43,6 +43,7 @@
                                                 (.setZkServers (:zookeeper/address env-config))
                                                 (.setZkLedgersRootPath ledgers-root-path)
                                                 (.setBookiePort port)
+                                                ;(.setAutoRecoveryDaemonEnabled true)
                                                 (.setJournalDirName journal-dir)
                                                 (.setLedgerDirNames (into-array String [ledger-dir]))
                                                 (.setAllowLoopback true))


db/content.clj: use local content file storage if possible

--- src/org/altlaw/db/content.clj
+++ src/org/altlaw/db/content.clj
@@ -1,6 +1,9 @@
 (ns org.altlaw.db.content
-  (:require [org.altlaw.util.s3 :as s3])
-  (:import (org.apache.commons.codec.digest DigestUtils)))
+  (:require [org.altlaw.util.s3 :as s3]
+            [org.altlaw.util.context :as context])
+  (:import (org.apache.commons.codec.digest DigestUtils)
+           (org.apache.commons.io FileUtils)
+           (java.io File)))

 (def #^{:private true} *bucket* "content.altlaw.org")

@@ -34,9 +37,15 @@
        *bucket* key content metadata))
     hash))

+(defn- get-content-string-from-file [key]
+  (let [path (File. (context/content-storage-dir) key)]
+    (when (.exists path)
+      (FileUtils/readFileToString path "UTF-8"))))
+
 (defn get-content-string [hash]
   (let [key (str "sha1/" hash)]
-    (s3/get-object-string *bucket* key)))
+    (or (get-content-string-from-file key)
+        (s3/get-object-string *bucket* key))))

 (defn get-content-bytes [hash]
   (let [key (str "sha1/" hash)]


hide increase gas/cancel temporary for 1.10

--- src/status_im/ui/screens/wallet/transactions/views.cljs
+++ src/status_im/ui/screens/wallet/transactions/views.cljs
@@ -76,7 +76,8 @@
                        :style     {:margin-top 10}
                        :icon-opts (merge styles/forward
                                          {:accessibility-label :show-transaction-button})}]]]]
-   (when (and (not keycard-account?)
+   (when (and false ;;TODO temporary disable for 1.10
+              (not keycard-account?)
               (= type :pending))
      [react/view {:flex-direction :row :padding 16 :justify-content :space-between}
       [quo/button


replace java bitset allocator with a clojure ref-based one which can handle the allocation of sequential ids

--- src/overtone/sc/allocator.clj
+++ src/overtone/sc/allocator.clj
@@ -1,6 +1,4 @@
-(ns overtone.sc.allocator
-  (:import
-    [java.util BitSet]))
+(ns overtone.sc.allocator)

 ;; ## SCSynth limits
 (def MAX-NODES 1024)
@@ -16,11 +14,15 @@
 ;; and then freed either by client request or automatically by receiving
 ;; notifications from the server.  (e.g. When an envelope trigger fires to
 ;; free a synth.)
-(defonce allocator-bits
-  {:node         (BitSet. MAX-NODES)
-   :audio-buffer (BitSet. MAX-BUFFERS)
-   :audio-bus    (BitSet. MAX-NODES)
-   :control-bus  (BitSet. MAX-NODES)})
+
+(defn mk-bitset [size]
+  (ref (vec (repeat size false))))
+
+(defonce allocator-bits
+  {:node         (mk-bitset MAX-NODES)
+   :audio-buffer (mk-bitset MAX-BUFFERS)
+   :audio-bus    (mk-bitset MAX-NODES)
+   :control-bus  (mk-bitset MAX-NODES)})

 (defonce allocator-limits
   {:node    MAX-NODES
@@ -28,47 +30,53 @@
    :audio-bus   MAX-AUDIO-BUS
    :control-bus MAX-CONTROL-BUS})

+(defn- fill-gaps
+  "Fill a given vector bs with size consecutive vals from idx"
+  [bs idx size val]
+  (loop [bs bs
+         idx idx
+         size size]
+    (if (> size 0)
+      (recur (assoc bs idx val) (inc idx) (dec size))
+      bs)))
+
+(defn- find-gap
+  [bs size idx gap-found limit]
+  (if (> idx limit)
+    (throw (Exception. (str "No more ids! Unable to allocate a sequence of ids of length" limit))))
+  (if (= gap-found size)
+    (- idx gap-found)
+    (let [gap-found (if (not (get bs idx)) (inc gap-found) 0)]
+      (find-gap bs size (inc idx) gap-found limit))))
+
 (defn alloc-id
   "Allocate a new ID for the type corresponding to key."
-  [k]
-  (let [bits  (get allocator-bits k)
-        limit (get allocator-limits k)]
-    (locking bits
-      (let [id (.nextClearBit bits 0)]
-        (if (= limit id)
-          (throw (Exception. (str "No more " (name k) " ids available!")))
-          (do
-            (.set bits id)
-            id))))))
+  ([k] (alloc-id k 1))
+  ([k size]
+     (let [bits  (get allocator-bits k)
+           limit (get allocator-limits k)]
+       (dosync
+        (let [id (find-gap @bits size 0 0 limit)]
+          (alter bits fill-gaps id size true)
+          id)))))

 ; The root group is implicitly allocated
 (defonce _root-group_ (alloc-id :node))

 (defn free-id
   "Free the id of type key."
-  [k id]
+  ([k id] (free-id k id 1))
+  ([k id size]
   (let [bits (get allocator-bits k)
         limit (get allocator-limits k)]
-    (locking bits
-      (.clear bits id))))
+    (dosync
+     (alter bits fill-gaps id size false)))))

-(defn all-ids
-  "Get all of the currently allocated ids for key."
-  [k]
-  (let [bits (get allocator-bits k)
-        limit (get allocator-limits k)]
-    (locking bits
-      (loop [ids []
-             idx 0]
-        (let [id (.nextSetBit bits idx)]
-          (if (and (> id -1) (< idx limit))
-            (recur (conj ids id) (inc id))
-            ids))))))

 (defn clear-ids
   "Clear all ids allocated for key."
   [k]
-  (locking (get allocator-bits k)
-    (doseq [id (all-ids k)]
-      (free-id k id))))
-
+  (let [bits (get allocator-bits k)
+        limit (get allocator-limits k)]
+    (dosync
+     (ref-set bits (mk-bitset limit)))))


Track org clicks again

Track org clicks again

--- src-cljs/frontend/components/pages/projects.cljs
+++ src-cljs/frontend/components/pages/projects.cljs
@@ -180,12 +180,10 @@
                                                      (select-keys % [:organization/vcs-type :organization/name]))
                                                  orgs))
                     :on-org-click (fn [{:keys [organization/vcs-type organization/name]}]
-                                    (navigate! this (routes/v1-organization-projects-path {:org name :vcs_type vcs-type}))
-                                    ;; NOMERGE: Analytics
-                                    #_((om/get-shared owner :track-event) {:event-type :org-clicked
-                                                                           :properties {:view :projects
-                                                                                :login name
-                                                                                :vcs_type vcs-type}}))})
+                                    (analytics/track! this {:event-type :org-clicked
+                                                            :properties {:login name
+                                                                         :vcs_type vcs-type}})
+                                    (navigate! this (routes/v1-organization-projects-path {:org name :vcs_type vcs-type})))})
                   (html [:div.loading-spinner common/spinner])))]
               [:.main
                (if selected-org


fix cancel in line with pagination changes

--- src-cljs/frontend/components/pages/workflow.cljs
+++ src-cljs/frontend/components/pages/workflow.cljs
@@ -68,8 +68,7 @@
                                                                       repo)})}
          pretty-sha]]))))

-(defn- transact-run-retry
-  [component run-id jobs]
+(defn- transact-run-mutate [component mutation]
   (om-next/transact!

    ;; We transact on the reconciler, not the component; otherwise the
@@ -94,27 +93,22 @@
    ;; so we do it. This is another bug we're punting on.
    (om-next/transform-reads
     (om-next/get-reconciler component)
-    `[(run/retry {:run/id ~run-id :run/jobs ~jobs})
-      ;; We queue the entire page to re-read using :compassus.core/route-data.
-      ;; Ideally we'd know what specifically to re-run, but there are now
-      ;; several keys the new run could show up under. (Aliases also complicate
-      ;; this, and solving that problem is not something we want to spend time
-      ;; on yet.) Re-reading the entire query here seems like a good idea
-      ;; anyhow.
-      :compassus.core/route-data])))
+    [mutation
+     ;; We queue the entire page to re-read using :compassus.core/route-data.
+     ;; Ideally we'd know what specifically to re-run, but there are now
+     ;; several keys the new run could show up under. (Aliases also complicate
+     ;; this, and solving that problem is not something we want to spend time
+     ;; on yet.) Re-reading the entire query here seems like a good idea
+     ;; anyhow.
+     :compassus.core/route-data])))
+
+(defn- transact-run-retry
+  [component run-id jobs]
+  (transact-run-mutate component `(run/retry {:run/id ~run-id :run/jobs ~jobs})))

 (defn- transact-run-cancel
   [component run-id vcs-type org-name project-name]
-  (om-next/transact!
-   ;; TODO: when bodhi props metadata bug is fixed, pass the component
-   ;; instead of the reconciler
-   (om-next/get-reconciler component)
-   ;; TODO: when bodhi props metadata bug is fixed, pass the query
-   ;; without transforming reads
-   (om-next/transform-reads
-    (om-next/get-reconciler component)
-    `[(run/cancel {:run/id ~run-id})
-      :project/workflow-runs])))
+  (transact-run-mutate component `(run/cancel {:run/id ~run-id})))

 ;; TODO: Move this to pieces.*, as it's used on the run page as well.
 (defui ^:once RunRow


fix typo in s-imperfect-nonphrasal-head

fix typo in s-imperfect-nonphrasal-head

--- src/babel/english/grammar.clj
+++ src/babel/english/grammar.clj
@@ -253,7 +253,7 @@
                                      :sem {:aspect :progressive
                                            :tense :past}}})
                    (unifyc c10
-                           root-is-head-root
+                           root-is-head
                            {:rule "s-imperfect-nonphrasal-head"
                             :head {:phrasal false}
                             :synsem {:aux false


cleanup

cleanup

--- src/babel/italiano/writer.clj
+++ src/babel/italiano/writer.clj
@@ -101,5 +101,3 @@
                                                        :tense :past}}}
                                        )))))
                  tutti))))
-
-


STORM-977 Send -15 (SIGTERM) signal to worker

--- storm-core/src/clj/backtype/storm/daemon/supervisor.clj
+++ storm-core/src/clj/backtype/storm/daemon/supervisor.clj
@@ -262,7 +262,7 @@
       (psim/kill-process thread-pid))
     (doseq [pid pids]
       (if as-user
-        (worker-launcher-and-wait conf user ["signal" pid "9"] :log-prefix (str "kill -15 " pid))
+        (worker-launcher-and-wait conf user ["signal" pid "15"] :log-prefix (str "kill -15 " pid))
         (kill-process-with-sig-term pid)))
     (when-not (empty? pids)
       (log-message "Sleep " shutdown-sleep-secs " seconds for execution of cleanup threads on worker.")


Fix typo

Fix typo

--- src-cljs/frontend/components/pieces/button.cljs
+++ src-cljs/frontend/components/pieces/button.cljs
@@ -125,7 +125,7 @@
              "Secondary Link")]]))

   (defcard medium-link-buttons
-    "These are `:medium` size link buttons.''"
+    "These are `:medium` size link buttons."
     (html
      [:div
       [:div


Add :test-resources-path to sample.project.clj

--- sample.project.clj
+++ sample.project.clj
@@ -77,7 +77,8 @@
   :source-path "src/main/clojure"
   :library-path "target/dependency"
   :test-path "src/test/clojure"
-  :resources-path "src/main/resources"
+  :resources-path "src/main/resource" ; non-code files included in classpath/jar
+  :test-resources-path "src/test/resource" ; added to classpath but not in jar
   :native-path "src/native"   ; where to look for native dependencies
   :jar-dir "target/"          ; where to place the project's jar file
   :jar-name "sample.jar"      ; name of the jar produced by 'lein jar'


Using wrapped decode

Using wrapped decode

--- src/wishlistd/models/redis.clj
+++ src/wishlistd/models/redis.clj
@@ -1,7 +1,7 @@
 (ns wishlistd.models.redis
   (:require [redis.core :as r])
   (:use [wishlistd.code]
-        [cheshire.core]))
+        [wishlistd.json]))

 (def db {:host "127.0.0.1" :port 6379 :db 0})

@@ -26,8 +26,7 @@
   "Get a single wishlist from datastore."
   (r/with-server db
     (decode
-      (r/get code)
-      true))) ; so it decodes into keywords
+      (r/get code)))) ; so it decodes into keywords

 (defn update-wishlist [{:keys [code] :as wishlist}]
   "Update a single wishlist in the datastore."


Comment not relevant

Comment not relevant

--- src/wishlistd/models/redis.clj
+++ src/wishlistd/models/redis.clj
@@ -26,7 +26,7 @@
   "Get a single wishlist from datastore."
   (r/with-server db
     (decode
-      (r/get code)))) ; so it decodes into keywords
+      (r/get code))))

 (defn update-wishlist [{:keys [code] :as wishlist}]
   "Update a single wishlist in the datastore."


Adds localStorage helpers to window

Adds localStorage helpers to window

--- src/wordsmith/persistence.cljs
+++ src/wordsmith/persistence.cljs
@@ -29,3 +29,5 @@
     (remove-document t)))

 (aset js/window "clearLocalStorage" wordsmith.persistence/clear-local-storage)
+(aset js/window "getDocument" wordsmith.persistence/get-document)
+(aset js/window "setDocument" wordsmith.persistence/set-document)


Rename Success/Failure value names to better match Left/Right and Just

--- src/cats/monad/exception.cljc
+++ src/cats/monad/exception.cljc
@@ -79,37 +79,37 @@

 (declare context)

-(defrecord Success [v]
+(defrecord Success [success]
   p/Contextual
   (-get-context [_] context)

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

   p/Printable
   (-repr [_]
-    (str "#<Success " (pr-str v) ">"))
+    (str "#<Success " (pr-str success) ">"))

   #?@(:cljs [cljs.core/IDeref
-             (-deref [_] v)]
+             (-deref [_] success)]
       :clj  [clojure.lang.IDeref
-             (deref [_] v)]))
-
-(defrecord Failure [e]
+             (deref [_] success)]))
+
+(defrecord Failure [failure]
   p/Contextual
   (-get-context [_] context)

   p/Extract
-  (-extract [_] e)
+  (-extract [_] failure)

   p/Printable
   (-repr [_]
-    (str "#<Failure " (pr-str e) ">"))
+    (str "#<Failure " (pr-str failure) ">"))

   #?@(:cljs [cljs.core/IDeref
-             (-deref [_] (throw e))]
+             (-deref [_] (throw failure))]
       :clj  [clojure.lang.IDeref
-             (deref [_] (throw e))]))
+             (deref [_] (throw failure))]))

 (alter-meta! #'->Success assoc :private true)
 (alter-meta! #'->Failure assoc :private true)
@@ -216,7 +216,7 @@
   (let [result (exec-try-on func)]
     (ctx/with-context context
       (if (failure? result)
-        (recoverfn (.-e ^Failure result))
+        (recoverfn (.failure ^Failure result))
         result))))

 #?(:clj


Remove usage of /.git directory for specifying git locations.

Since we don't allow separate GIT_DIR and GIT_WORK_TREE and we may
want to specify a relative path in the repo, we now rely on the new
:dir change directory functionallity of the 'git function.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -29,7 +29,7 @@
   ;; We won't handle bare repos or displaced worktrees
   (let [cmd-args (if (nil? gitdir)
                    []
-                   [:dir (.getParent gitdir)])
+                   [:dir gitdir])
         all-args (concat subcmd cmd-args)
         ;; _ (prn :calling (doall (cons 'git all-args)))
         {:keys [exit] :as rtn} (apply sh "git" all-args)
@@ -143,7 +143,7 @@
          d)))

 (defn all-repos-dirs []
-  (glob (str (s/replace repos-home #"/$" "") "/*/.git")))
+  (glob (str (s/replace repos-home #"/$" "") "/*")))

 (defn fetch-all
   [dirs]
@@ -586,7 +586,7 @@
                     (s/replace #"/" "--"))
           pdir (adj-path bdir pname)
           checkout (adj-path bdir (str ".voom-box/" pname))
-          g {:gitdir (adj-path checkout "/.git")}
+          g {:gitdir checkout}
           remote (-> (remotes gitdir) :origin :fetch)]
       (if (.exists ^File checkout)
         (git g "fetch")


Add tabling logic to obj-patho.

Add tabling logic to obj-patho.

This speeds up my test cases by ~1/3rd.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -1042,14 +1042,14 @@
     ;; TODO: if dirty, write out db
     db))

-(defn obj-patho
-  [tree-sha so-far fname ftype fsha tree-path]
-  (l/conde
-   [(r-tree tree-sha fname ftype fsha) (l/== so-far tree-path)]
-   [(l/fresh [next-path next-sha new-path]
-             (r-tree tree-sha next-path :tree next-sha)
-             (l/conso next-path so-far new-path)
-             (obj-patho next-sha new-path fname ftype fsha tree-path))]))
+(def obj-patho
+  (l/tabled [tree-sha so-far fname ftype fsha tree-path]
+   (l/conde
+    [(r-tree tree-sha fname ftype fsha) (l/== so-far tree-path)]
+    [(l/fresh [next-path next-sha new-path]
+              (r-tree tree-sha next-path :tree next-sha)
+              (l/conso next-path so-far new-path)
+              (obj-patho next-sha new-path fname ftype fsha tree-path))])))

 (def ancestoro
   (l/tabled [childer parenter]


More aggressive tagging

More aggressive tagging

This is necessary to properly handle merge commits.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -321,7 +321,7 @@
 (defn project-change-shas
   [gitdir]
   (->> (git {:gitdir gitdir} "log" "--all" "--pretty=format:%H,%cd,%d"
-            "--name-status" "--" "project.clj" "**/project.clj")
+            "--name-status" "-m" "--" "project.clj" "**/project.clj")
        :lines
        (keep #(if-let [[_ op path] (re-matches #"(.)\t(.*)" %)]
                 {:op op :path path}
@@ -339,7 +339,7 @@
   [gitdir]
   (let [proj-shas (project-change-shas gitdir)]
     (doseq [{:keys [sha refs ops]} (report-progress gitdir proj-shas)
-            :while (not-any? #(.startsWith ^String % "tag: voom-") refs)
+            :when (not-any? #(.startsWith ^String % "tag: voom-") refs)
             {:keys [op path]} ops]
       (when-let [p (and (not= "D" op)
                         (robust-read-project gitdir sha path))]


Use new *url* dynamic var

Use new *url* dynamic var

--- src/foreclojure/problems.clj
+++ src/foreclojure/problems.clj
@@ -123,11 +123,10 @@
 (defn run-code [id raw-code]
   (let [code (.trim raw-code)
         {:keys [tests restricted]} (get-problem id)
-        sb-tester (get-tester restricted)
-        this-url (str "/problem/" id)]
+        sb-tester (get-tester restricted)]
     (session/flash-put! :code code)
     (if (empty? code)
-      (flash-msg "Empty input is not allowed" this-url)
+      (flash-msg "Empty input is not allowed" *url*)
       (try
         (loop [[test & more] tests
                i 0]
@@ -137,9 +136,9 @@
             (let [testcase (s/replace test "__" (str code))]
               (if (sb sb-tester (safe-read testcase))
                 (recur more (inc i))
-                (flash-msg "You failed the unit tests." this-url)))))
+                (flash-msg "You failed the unit tests." *url*)))))
         (catch Exception e
-          (flash-msg (.getMessage e) this-url))))))
+          (flash-msg (.getMessage e) *url*))))))

 (defn render-test-cases [tests]
   [:table {:class "testcases"}


Simplify read-config impl

Simplify read-config impl

--- dev/cake.clj
+++ dev/cake.clj
@@ -21,10 +21,9 @@
 (def ^{:dynamic true} *errs* nil)

 (defn read-config [file]
-  (if (.exists file)
-    (with-open [f (FileInputStream. file)]
-      (into {} (doto (Properties.) (.load f))))
-    {}))
+  (into {} (when (.exists file)
+             (with-open [f (FileInputStream. file)]
+               (doto (Properties.) (.load f))))))

 (def ^{:dynamic true} *config*
   (apply merge (map read-config [(File. (System/getProperty "user.home") ".cake/config")


Add call of `tnr/set-refresh-dirs`

Add call of `tnr/set-refresh-dirs`

--- dev/user.clj
+++ dev/user.clj
@@ -3,7 +3,8 @@
   (:require [clojure.main]
             [clojure.string :as str]
             [clojure.tools.namespace.move :refer :all]
-            [clojure.tools.namespace.repl :refer :all]
+            [clojure.tools.namespace.repl :as tnr
+             :refer [refresh refresh-all]]
             [midje.repl :refer :all]))

 ;;;; ___________________________________________________________________________
@@ -15,6 +16,23 @@
 (apply require clojure.main/repl-requires)

 ;;;; ___________________________________________________________________________
+
+;;;; `clojure.tools.namespace.repl/refresh` sometimes doesn't work, because it
+;;;; doesn't know what directories to read from when refreshing. This is a
+;;;; problem caused by different behaviour around classpaths on different
+;;;; versions of the JVM.
+;;;;
+;;;; See:
+;;;; - https://ask.clojure.org/index.php/8288/java-11-and-tools-namespace
+;;;; - https://github.com/clojure-emacs/cider/issues/2686
+;;;; - https://github.com/clojure-emacs/cider/issues/2686#issuecomment-532389499
+;;;;
+;;;; Conclusion:
+;;;; - Do the following:
+
+(tnr/set-refresh-dirs "dev" "src" "test")
+
+;;;; ___________________________________________________________________________
 ;;;; App-specific additional utilities for the REPL or command line

 (comment


cr-map de-idiomization and hide a little of the sausage making

--- 2014-09-30-langmartin-crdt/cr_map.clj
+++ 2014-09-30-langmartin-crdt/cr_map.clj
@@ -2,6 +2,22 @@
   (:use
    clojure.test))

+;;; Not a slide, just some odds and ends
+
+(def number-desc
+  (comparator (fn [n m] (> n m))))
+
+(defn first-key [map] (first (first map)))
+(defn first-val [map] (second (first map)))
+
+(def ^:dynamic creator-key "a")
+(defmacro as-creator
+  [c & body]
+  `(binding [creator-key ~c]
+     ~@body))
+
+(declare cr-map-id cr-major)
+

 ;;; The over the wire update format
@@ -12,10 +28,6 @@
 ;;;
 ;;; - Is tagged with the minor version number, an orderable bit of
 ;;;   stuff that identifies the writer
-
-(declare cr-map-id cr-major)
-(def ^:dynamic creator-key "a")
-(defmacro with-c [c & body] `(binding [creator-key ~c] ~@body))

 (defn cr-update
   [map & kvs]
@@ -35,17 +47,15 @@
 ;;; - cr-map is an ordered (descending) map of major versions
 ;;; - revision is an ordered map of creator tag to update value

-(def number-desc (comparator (fn [n m] (> n m))))
-
 (defn cr-map
   [id]
-  (-> (sorted-map-by number-desc)
-      (with-meta {:id id})))
-
-(defn cr-map-id [map] (:id (meta map)))
-
-(def first-key ffirst)
-(def first-val (comp second first))
+  (with-meta
+    (sorted-map-by number-desc)
+    {:id id}))
+
+(defn cr-map-id
+  [map]
+  (get (meta map) :id))

 (defn cr-major
   [map]
@@ -62,11 +72,12 @@
 ;;; - A functional update, this returns a new cr-map

 (defn cr-apply
-  [map {:keys [val maj min] :as update}]
-  (assoc map
-    maj
-    (assoc (cr-get-rev map maj)
-      min val)))
+  [map update]
+  (let [{val :val maj :maj min :min} update]
+    (assoc map
+      maj
+      (assoc (cr-get-rev map maj)
+        min val))))

@@ -128,29 +139,32 @@

 ;;; It's a map!

+(def foo (cr-assoc (cr-map "foo") :a 1 :b 2))
+(def p1  (cr-update foo :b 1))
+(def p2  (as-creator "b" (cr-update foo :b 2)))
+(def bar (cr-apply foo p1))
+(def p3  (cr-update bar :b 3))
+(def p4  (as-creator "b" (cr-update bar :b 4)))
+(def p5  (as-creator "c" (cr-update bar :b 5)))
+
 (deftest test-mappiness
-  (def foo
-    (-> (cr-map "foo")
-        (cr-assoc :a 1 :b 2)))
-
   (is (= (cr-get foo :a) 1))
   (is (= (cr-get foo :b) 2))
-  (is (= 2  (-> (cr-assoc foo :a 2) (cr-get :a))))
-  (is (nil? (-> (cr-dissoc foo :a)  (cr-get :a)))))
+  (is (= 2  (cr-get (cr-assoc foo :a 2) :a)))
+  (is (nil? (cr-get (cr-dissoc foo :a)  :a))))

 ;;; Idempotent

 (deftest test-idempotency
-  (def p3 (cr-update foo :b 3))
-  (def bar (cr-apply foo p3))
-
   (is (identical?
        bar
-       (-> bar
-           (cr-apply p3)
-           (cr-apply p3)))))
+       (cr-apply bar p1)))
+
+  (is (identical?
+       bar
+       (cr-apply (cr-apply bar p1) p1))))

@@ -159,31 +173,25 @@
 (defn ap [m & ps] (reduce cr-apply m ps))

 (deftest test-associtivity
-  (def p4 (cr-update bar :b 4))
-  (def p5 (with-c "b" (cr-update bar :b 5)))
-  (def p6 (with-c "c" (cr-update bar :c 6)))
-
-  (is (= (ap (ap bar p4 p5) p6)
-         (ap (ap bar p4) p5 p6))))
+  (is (= (ap (ap bar p3 p4) p5)
+         (ap (ap bar p3) p4 p5))))

 ;;; Commutative

 (deftest test-commutivity
-  (def baz (ap bar p4 p5 p6))
-
-  (def p7 (cr-update baz :b 7))
-  (def p8 (with-c "b" (cr-delete baz :b)))
-
-  (is (= (ap baz p7 p8)
-         (ap baz p8 p7)))
-
-  (is (= (ap foo p8 p7 p6 p5 p4 p3)
-         (ap foo p3 p4 p5 p6 p7 p8)
-         (ap foo p3 p5 p4 p6 p8 p7)
-         (ap (ap foo p5 p3 p4) p8 p6 p7)
-         (ap (ap foo p6 p3 p7) p8 p5 p4 p3 p3 p3))))
+  (is (= (ap foo p1 p2)
+         (ap foo p2 p1)))
+
+  (is (= (ap foo p1 p5)
+         (ap foo p5 p1)))
+
+  (is (= (ap foo p1 p2 p3 p4 p5)
+         (ap foo p5 p4 p3 p2 p1)
+         (ap foo p3 p5 p4 p1 p2)
+         (ap (ap foo p5 p3 p4) p1 p2)
+         (ap foo p3 p2 p1 p5 p4 p3 p3 p3))))


Add selected property channel back.

Add selected property channel back.

--- src-cljs/kixi/hecuba/tabs/hierarchy/properties.cljs
+++ src-cljs/kixi/hecuba/tabs/hierarchy/properties.cljs
@@ -110,6 +110,7 @@
      (html  [:tr
              {:onClick   (fn [_ _]
                            (history/update-token-ids! history :properties entity_id)
+                           (put! selected-row-chan @property)
                            (common/fixed-scroll-to-element "property-details-div"))
               :className (if (:selected property) "success")
               :id        (str table-id "-selected")}
@@ -160,9 +161,16 @@
   (reify
     om/IInitState
     (init-state [_]
-      {:th-chan (chan)})
+      {:th-chan (chan)
+       :selected-row-chan (chan)})
     om/IWillMount
     (will-mount [_]
+      ;; Put selected property into :selected-property cursor
+      (go-loop []
+        (let [selected-row-chan (om/get-state owner :selected-row-chan)
+              row               (<! selected-row-chan)]
+          (om/update! properties [:selected-property :property] row))
+        (recur))
       (go-loop []
         (let [{:keys [th-chan]}                   (om/get-state owner)
               {:keys [sort-key sort-fn sort-asc]} (:sort-spec @properties)
@@ -199,7 +207,8 @@
             (om/build-all property-row (if sort-asc
                                          (sort-by sort-fn (:data properties))
                                          (reverse (sort-by sort-fn (:data properties))))
-                          {:opts {:table-id table-id}})]]])))))
+                          {:opts {:table-id table-id
+                                  :selected-row-chan (om/get-state owner :selected-row-chan)}})]]])))))

 (defmethod properties-table :default [properties owner]
   (om/component


adding Account Siphon and Blackmail to run-arrow

--- src/clj/game/cards-events.clj
+++ src/clj/game/cards-events.clj
@@ -30,7 +30,7 @@

    "Blackmail"
    {:req (req (> (:bad-publicity corp) 0)) :prompt "Choose a server" :choices (req servers)
-    :effect (effect (run target))}
+    :effect (effect (run target nil card))}

    "Bribery"
    {:prompt "How many [Credits]?" :choices :credit


Minor WIP

Minor WIP

--- src/clj/my_project/server.clj
+++ src/clj/my_project/server.clj
@@ -35,24 +35,17 @@

   (defn get-png-enc [name]
     (->>
-      (str "resources/public/data/" name ".png" )
-      (get-enc-64-as-str )
-      )
+      (io/resource (str  "public/data/" name ".png"))
+      (get-enc-64-as-str ))
     )

-  (println (get-png-enc "tiles"))
-  )
-
-(format
-  "%02x"
-  (+ 256 -119)
-  )
+  (println (get-png-enc "tiles")))

 (defroutes routes
   (resources "/")
   (resources "/react" {:root "react"})
-  (GET ["/rez/:name.img" :name #".*"] [name]
+  (GET ["/rez/:name.txt" :name #".*"] [name]
        (str "File:" name ))
   (GET "/*" req (page)))


[patch] image->patch next

[patch] image->patch next

 - Sanitized interface.
 - Added `:colorspace` parameter (either `:rgb` or `:grayscale`) that can be used to produce single channel output.

--- src/clj/think/image/patch.clj
+++ src/clj/think/image/patch.clj
@@ -103,29 +103,29 @@

 (defn image->patch
-  ([^BufferedImage img ^Rectangle rect datatype ^ints data-array]
-   (image/->array img rect data-array)
-   (let [retval-num-pixels (*(.width rect) (.height rect))]
-    (condp = datatype
-      :double
-      (let [retval-r (double-array retval-num-pixels)
-            retval-g (double-array retval-num-pixels)
-            retval-b (double-array retval-num-pixels)]
-        (image->patch-impl retval-r retval-g retval-b data-array retval-num-pixels double)
+  "Turns BufferedImage img into an array suitable for cortex input."
+  [^BufferedImage img & {:keys [rect datatype colorspace data-array]}]
+  (let [rect (or rect (image-util/image->rect img))
+        datatype (or datatype :double)
+        colorspace (or colorspace :rgb)
+        retval-num-pixels (* (.width rect) (.height rect))
+        data-array (or data-array (int-array retval-num-pixels))
+        array-constructor (condp = datatype :double double-array :float float-array)
+        cast-fn (condp = datatype :double double :float float)]
+    (image/->array img rect data-array)
+    (condp = colorspace
+      :rgb
+      (let [retval-r (array-constructor retval-num-pixels)
+            retval-g (array-constructor retval-num-pixels)
+            retval-b (array-constructor retval-num-pixels)]
+        (image->patch-impl retval-r retval-g retval-b data-array retval-num-pixels cast-fn)
         [retval-r retval-g retval-b])
-      :float
-      (let [retval-r (float-array retval-num-pixels)
-            retval-g (float-array retval-num-pixels)
-            retval-b (float-array retval-num-pixels)]
-        (image->patch-impl retval-r retval-g retval-b data-array retval-num-pixels float)
-        [retval-r retval-g retval-b]))))
-  ([img ^Rectangle rect datatype]
-   (image->patch img rect datatype(int-array (* (.width rect)
-                                                (.height rect)))))
-  ([img ^Rectangle rect]
-   (image->patch img rect :double))
-  ([^BufferedImage img]
-   (image->patch img (image-util/image->rect img))))
+      :grayscale
+      (let [retval-r (array-constructor retval-num-pixels)
+            retval-g (array-constructor retval-num-pixels)
+            retval-b (array-constructor retval-num-pixels)]
+        (image->patch-impl retval-r retval-g retval-b data-array retval-num-pixels cast-fn)
+        [retval-r]))))

 (defn patch->image
@@ -135,8 +135,10 @@
         retval (image/new-image image/*default-image-impl* img-width img-height :rgb)
         byte-data (byte-array (mat/ecount data))
         n-pixels (long n-cols)
-        [r-data g-data b-data] data]
-    (assert (= 3 n-rows))
+        r-data (if (= 1 n-rows) (first data) (nth data 0))
+        g-data (if (= 1 n-rows) (first data) (nth data 1))
+        b-data (if (= 1 n-rows) (first data) (nth data 2))]
+    (assert (#{1 3} n-rows))
     (c-for [idx 0 (< idx n-pixels) (inc idx)]
            (aset byte-data (+ (* idx 3) 0)
                  (unchecked-byte (* 255.0 (+ (double (dtype/get-value r-data idx)) 0.5))))
@@ -150,21 +152,20 @@

 (defn masked-image->patches
-  ([img mask-img patch-count patch-dim content-rect datatype
-    & {:keys [image-augmentation-fn]}]
-   (let [patch-rects (vec
-                      (generate-n-filtered-rects
-                       (partial is-rect-completely-within-mask? mask-img)
-                       content-rect
-                       patch-count patch-dim))
-         patch-data-array (int-array (* (long patch-dim) (long patch-dim)))
-         image-augmentation-fn (or image-augmentation-fn identity)]
-     (mapv (fn [rect]
-             (let [aug-image (-> (image/sub-image img rect)
-                                 image-augmentation-fn)]
-               (image->patch aug-image (image-util/image->rect aug-image) datatype patch-data-array)))
-           patch-rects))))
-
+  [img mask-img patch-count patch-dim content-rect datatype
+   & {:keys [image-augmentation-fn]}]
+  (let [patch-rects (vec
+                     (generate-n-filtered-rects
+                      (partial is-rect-completely-within-mask? mask-img)
+                      content-rect
+                      patch-count patch-dim))
+        patch-data-array (int-array (* (long patch-dim) (long patch-dim)))
+        image-augmentation-fn (or image-augmentation-fn identity)]
+    (mapv (fn [rect]
+            (let [aug-image (-> (image/sub-image img rect)
+                                image-augmentation-fn)]
+              (image->patch aug-image :data-array patch-data-array)))
+          patch-rects)))

 (defn buffered-image-has-alpha-channel?


Remove some extra printlns

Remove some extra printlns

--- src/cljc/robinson/render.cljc
+++ src/cljc/robinson/render.cljc
@@ -92,7 +92,6 @@
        (is (every? character? xs))))

 (defn renderstate? [x]
-  (println x)
   (is (every? characters? (vals (get x :layers {})))))

 ;;; {
@@ -393,7 +392,6 @@
         fg (rcolor/color->rgb fg)
         bg (rcolor/color->rgb bg)]
     ;; render top and bottom
-    ; FIXME
     (put-chars rstate :ui
       (mapcat identity
           (concat
@@ -1190,7 +1188,6 @@
          v-height] (rv/viewport-wh state)
         popover-x  (int (- (/ v-width 2) (/ width 2)))
         popover-y  (int (- (/ v-height 2) (/ height 2)))]
-    (println "rendering popover at" popover-x "," popover-y)
     (render-list rstate :ui popover-x popover-y width (inc height)
       (concat
         [{:s "" :fg :black :bg :white :style #{}}]
@@ -1208,7 +1205,6 @@
          v-height] (rv/viewport-wh state)
         popover-x  (int (- (/ v-width 2) (/ width 2)))
         popover-y  (int (- (/ v-height 2) (/ height 2)))]
-    (println "rendering popover at" popover-x "," popover-y)
     (-> rstate
       (render-list :ui popover-x popover-y width (+ 4 height)
         (concat


Fix fire/lava lighting

Fix fire/lava lighting

--- src/cljc/robinson/render.cljc
+++ src/cljc/robinson/render.cljc
@@ -1348,9 +1348,10 @@
   (let [bg                  (rcolor/lighting sight-distance)
         light-producing-xys (set (map (juxt :x :y) (get rstate :light-producing-cells)))
         characters          (for [x (range 80)
-                                  y (range 24)
-                                  :when (not (contains? light-producing-xys [x y]))]
-                              {:x x :y y :c \space :fg [0 0 0] :bg bg})]
+                                  y (range 24)]
+                              (if (contains? light-producing-xys [x y])
+                                {:x x :y y :c \space :fg [0 0 0] :bg [255 255 255]}
+                                {:x x :y y :c \space :fg [0 0 0] :bg bg}))]
     (put-chars rstate :lighting characters)))

 (defn draw-log [rstate state]


Fixed error in server path

Fixed error in server path

--- src/cljs/bookmarx/common.cljs
+++ src/cljs/bookmarx/common.cljs
@@ -12,7 +12,7 @@

 (defn server-path "Create a url to the service with the path from the environment."
   [& args]
-  (str apply (concat [(:host-url bookmarx.common/env) (:prefix bookmarx.common/env)] args)))
+  (apply str (concat [(:host-url bookmarx.common/env) (:prefix bookmarx.common/env)] args)))

 (defn get-active "Get the active folder from the session or else a cookie."
   []


Move test function into utility section.

--- src/multihash/core.clj
+++ src/multihash/core.clj
@@ -195,20 +195,6 @@
    :sha2-512 sha2-512})

-(defn test
-  "Determines whether a multihash is a correct identifier for some content by
-  recomputing the digest for the algorithm specified in the multihash. Returns
-  nil if either argument is nil, true if the digest matches, or false if not.
-  Throws an exception if the multihash specifies an unsupported algorithm."
-  [mhash content]
-  (when (and mhash content)
-    (if-let [hash-fn (get functions (:algorithm mhash))]
-      (= mhash (hash-fn content))
-      (throw (RuntimeException.
-               (str "No supported hashing function for algorithm "
-                    (:algorithm mhash) " to validate " mhash))))))
-
-

 ;; ## Encoding and Decoding

@@ -323,6 +309,20 @@

 ;; ## Utility Functions

+(defn test
+  "Determines whether a multihash is a correct identifier for some content by
+  recomputing the digest for the algorithm specified in the multihash. Returns
+  nil if either argument is nil, true if the digest matches, or false if not.
+  Throws an exception if the multihash specifies an unsupported algorithm."
+  [mhash content]
+  (when (and mhash content)
+    (if-let [hash-fn (get functions (:algorithm mhash))]
+      (= mhash (hash-fn content))
+      (throw (RuntimeException.
+               (str "No supported hashing function for algorithm "
+                    (:algorithm mhash) " to validate " mhash))))))
+
+
 (defn select
   "Selects multihash identifiers from a sequence based on some criteria.


파라미터 맵의 키를 키워드로 변경해 사용하도록 수정.

파라미터 맵의 키를 키워드로 변경해 사용하도록 수정.

--- src/tweetbook/routes/home.clj
+++ src/tweetbook/routes/home.clj
@@ -3,8 +3,13 @@
             [liberator.core :refer [defresource resource request-method-in]]
             [cheshire.core :refer [generate-string]]
             [noir.io :as io]
+            [noir.session :as sesson]
             [clojure.java.io :refer [file]]
+            [tweetbook.models.tweet :refer [tweet]]
             [tweetbook.models.db :as db]))
+
+(defn keywordify [m]
+  (into {} (for [[k v] m] [(keyword k) v])))

 (defresource home
   :allowed-methods [:get]
@@ -26,9 +31,10 @@
   :available-media-types ["application/json"]
   :post!
   (fn [context]
-    (let [params (get-in context [:request :form-params])]
-      (db/insert-msg {:msg (params "msg"), :src (params "src")})
-      (if (= (params "tweet-immediately") "on") (println "tweet-immediately on"))))
+    (let [{:keys [msg src tweet-immediately]} (keywordify (get-in context [:request :form-params]))]
+      (db/insert-msg {:msg msg, :src src})
+      (if (= "on" tweet-immediately)
+        (tweet (str msg "\n" src)))))
   :handle-created
   (fn [_] (generate-string {:result "OK"})))


put non code user behind an empty ld flag (#1968)

--- src-cljs/frontend/models/user.cljs
+++ src-cljs/frontend/models/user.cljs
@@ -1,5 +1,6 @@
 (ns frontend.models.user
   (:require [clojure.set :as set]
+            [frontend.utils.launchdarkly :as ld]
             goog.string.format))

 (defn current-scopes [user]
@@ -70,7 +71,8 @@
     (-> user check-fn boolean)))

 (defn non-code-identity? [user]
-  (and (not (github-authorized? user))
+  (and (ld/feature-on? "google-login-empty-state")
+       (not (github-authorized? user))
        (not (bitbucket-authorized? user))))

 (defn deauthorize-github [user]


Vip 556 clean feed url (#374)

Vip 556 clean feed url (#374)

* regex replace non-url components

* removed extra space

* added warning when unsupported character found

* forgot to save

--- src/vip/data_processor/s3.clj
+++ src/vip/data_processor/s3.clj
@@ -3,6 +3,7 @@
             [clojure.java.io :as io]
             [turbovote.resource-config :refer [config]]
             [clojure.string :as str]
+            [clojure.tools.logging :as log]
             [vip.data-processor.util :as util])
   (:import [java.io File ByteArrayOutputStream]
            [java.nio.file Files StandardCopyOption]
@@ -43,7 +44,11 @@

 (defn zip-filename
   [{:keys [output-file-basename]}]
-  (str output-file-basename ".zip"))
+  (let [sub-pattern #"[^A-Za-z0-9\-_.]"
+        zip-name (str (str/replace output-file-basename sub-pattern "") ".zip")]
+    (when (re-find sub-pattern output-file-basename)
+      (log/info "Usupported character found! New filename: " zip-name))
+    zip-name))

 (defn prepare-zip-file
   "Creates a temp directory, a new zip file in that directory, and adds


lol remove a pointless (let) that i added last week when i was trying to figure out why my atoms weren't working (it was because they weren't r/atoms)

--- src/voke/world/visualize.cljs
+++ src/voke/world/visualize.cljs
@@ -84,13 +84,13 @@

 ;; Reagent components

-(defn slider [an-atom min max step]
-  (let [_ @an-atom]
-    [:input {:type      "range" :value @an-atom :min min :max max :step step
-             :style     {:width "100%"}
-             :on-change (fn [e]
-                          (reset! an-atom (js/parseFloat (.-target.value e)))
-                          (generate-grid-and-draw))}]))
+(defn slider
+  [an-atom min max step]
+  [:input {:type      "range" :value @an-atom :min min :max max :step step
+           :style     {:width "100%"}
+           :on-change (fn [e]
+                        (reset! an-atom (js/parseFloat (.-target.value e)))
+                        (generate-grid-and-draw))}])

 (defn tab
   [tab-kw text]


fix empty query

fix empty query

--- src/wb_es/web/integration.clj
+++ src/wb_es/web/integration.clj
@@ -40,8 +40,8 @@
                                        (Integer.)
                                        (dec)
                                        (* page-size))
-                            :q (-> (get params :q (:query params))
-                                   (clojure.string/replace #"\*" ""))
+                            :q (some-> (get params :q (:query params))
+                                       (clojure.string/replace #"\*" ""))
                             :type (get params :type (:class params))
                             :species (:species params)
                             :raw params)]


Adding namespaces used by pr.owl as workaround for the http:/ bug

--- src/kabob/core/namespace.clj
+++ src/kabob/core/namespace.clj
@@ -30,9 +30,23 @@
        ;;("iao" "http://purl.obolibrary.org/obo/")
        ("ccp" "http://ccp.ucdenver.edu/obo/ext/")

-       ;; workaround for http:/ bug as documented here: https://trello.com/c/6adKzKOB
+        ;; ---------------------------------------------------------------------------
+        ;; the following namespaces are each a workaround for the 'http:/' bug as
+        ;; documented here: https://trello.com/c/6adKzKOB. These namespaces can/should
+        ;; be removed once the 'http:/' bug is resolved.
+        ;; ---------------------------------------------------------------------------
         ("bnode" "http://ccp.ucdenver.edu/bnode/")
-
+        ("bird_pr","http:/birdgenenames.org/cgnc/GeneReport?id=")
+        ("rgd_pr","http:/rgd.mcw.edu/rgdweb/report/gene/main.html?id=")
+        ("tair_pr","http:/www.arabidopsis.org/servlets/TairObject?type=")
+        ("hgnc_pr","http:/www.genenames.org/cgi-bin/gene_symbol_report?hgnc_id=")
+        ("yeast_pr","http:/www.yeastgenome.org/cgi-bin/locus.fpl?dbid=")
+        ("flybase_pr","http:/flybase.org/reports/")
+        ("eco_pr","http:/www.ecogene.org/gene/")
+        ("pombase_pr","http:/www.pombase.org/spombe/result/")
+        ("wormbase_pr","http:/www.wormbase.org/species/c_elegans/gene/")
+        ("zfin_pr","http:/zfin.org/action/marker/view/")
+        ;; ---------------------------------------------------------------------------

        ("kiao" "http://kabob.ucdenver.edu/iao/")
        ("kabob" "http://kabob.ucdenver.edu/")


Removed bad cases from read-int!

Removed bad cases from read-int!

--- src/longshi/fressian/js.cljs
+++ src/longshi/fressian/js.cljs
@@ -227,9 +227,6 @@
   (read-int! [bis]
     (let [code (bsp/read! bis)]
       (case code
-        ((.-NULL codes)) nil
-        ((.-TRUE codes)) true
-        ((.-FALSE codes)) false
         0xFF -1
         (0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07
          0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F


CMR-5094: Changed get service concepts by associations to use batch search.

--- indexer-app/src/cmr/indexer/data/concepts/service.clj
+++ indexer-app/src/cmr/indexer/data/concepts/service.clj
@@ -59,16 +59,12 @@
        :revision-date revision-date
        :metadata-format (name (mt/format-key format))})))

-(defn- service-association->service-concept
-  "Returns the service concept and service association for the given service association."
-  [context service-association]
-  (let [{:keys [service-concept-id]} service-association
-        service-concept (mdb/find-latest-concept
-                         context
-                         {:concept-id service-concept-id}
-                         :service)]
-    (when-not (:deleted service-concept)
-      service-concept)))
+(defn- service-associations->service-concepts
+  "Returns the service concepts for the given service associations."
+  [context service-associations]
+  (let [service-concept-ids (map :service-concept-id service-associations)
+        service-concepts (mdb/get-latest-concepts context service-concept-ids true)]
+    (filter #(not (:deleted %)) service-concepts)))

 (defn- has-formats?
   "Returns true if the given service has more than one supported formats value."
@@ -108,9 +104,7 @@
 (defn service-associations->elastic-doc
   "Converts the service association into the portion going in the collection elastic document."
   [context service-associations]
-  (let [service-concepts (remove nil?
-                                 (map #(service-association->service-concept context %)
-                                      service-associations))
+  (let [service-concepts (service-associations->service-concepts context service-associations)
         service-names (map #(get-in % [:extra-fields :service-name]) service-concepts)
         service-concept-ids (map :concept-id service-concepts)]
     {:service-names service-names


add `unwrap-route` private helper

add `unwrap-route` private helper

--- src/main/compassus/core.cljs
+++ src/main/compassus/core.cljs
@@ -15,6 +15,10 @@
   "Returns the application's root class."
   [app]
   (-> app :config :root-class))
+
+(defn- unwrap-route [route]
+  (cond-> route
+    (util/unique-ident? route) first))

 (defn- make-root-class
   [{:keys [routes wrapper]}]
@@ -29,9 +33,7 @@
       Object
       (render [this]
         (let [props (om/props this)
-              route (::route props)
-              route (cond-> route
-                      (util/unique-ident? route) first)
+              route (unwrap-route (::route props))
               route-data (::route-data props)
               factory (get route->factory route)]
           (if wrapper
@@ -130,9 +132,7 @@
 (defmethod read [nil ::route-data]
   [{:keys [state user-parser] :as env} key params]
   (let [st @state
-        route (get st ::route)
-        route (cond-> route
-                (util/unique-ident? route) first)
+        route (unwrap-route (get st ::route))
         query (infer-query env route)
         ret (user-parser env query)]
     {:value (get ret route)}))
@@ -144,9 +144,7 @@
 (defmethod read [:default ::route-data]
   [{:keys [state target ast user-parser] :as env} key params]
   (let [st @state
-        route (get st ::route)
-        route (cond-> route
-                (util/unique-ident? route) first)
+        route (unwrap-route (get st ::route))
         query (infer-query env route)
         ret (user-parser env query target)]
     (when-not (empty? ret)
@@ -211,9 +209,7 @@

 (defn compassus-merge
   [reconciler state res query]
-  (let [route (get state ::route)
-        route (cond-> route
-                (util/unique-ident? route) first)]
+  (let [route (unwrap-route (get state ::route))]
     (om/default-merge reconciler state (get res route) query)))

 (defn- process-reconciler-opts


bug/49: fixed incorrect namespace

bug/49: fixed incorrect namespace

--- src/integration/clojure/com/xebia/visualreview/itest/database_migration_test.clj
+++ src/integration/clojure/com/xebia/visualreview/itest/database_migration_test.clj
@@ -1,4 +1,4 @@
-(ns com.xebia.visualreview.service.persistence.database-migration-test
+(ns com.xebia.visualreview.itest.database-migration-test
   (:require [clojure.test :refer :all]
             [clojure.java.jdbc :as j]
             [clojure.java.io :as io]


add render-to-str test (#22)

add render-to-str test (#22)

* add render-to-str test

* fix: require om.dom only for clojure

* Indentation fixes

--- src/test/compassus/tests.cljc
+++ src/test/compassus/tests.cljc
@@ -1,7 +1,8 @@
 (ns compassus.tests
   #?(:cljs (:require-macros [cljs.core.async.macros :refer [go]]))
   (:require #?@(:cljs [[cljsjs.react]
-                       [goog.object :as gobj]])
+                       [goog.object :as gobj]]
+                :clj [[om.dom :as dom]])
             [clojure.core.async :refer [<! close! chan take! #?@(:clj [go <!!])]]
             [clojure.test :refer [deftest testing is are use-fixtures #?(:cljs async)]]
             [om.next :as om :refer [defui ui]]
@@ -26,7 +27,10 @@
 (defui Home
   static om/IQuery
   (query [this]
-    [:home/title :home/content]))
+    [:home/title :home/content])
+  #?@(:clj [Object
+            (render [this]
+              (dom/div nil "Hello, home!"))]))

 (defui About
   static om/IQuery
@@ -70,6 +74,11 @@
    :cljs (use-fixtures :each
            {:before set-app!
             :after unset-app!}))
+#?(:clj
+   (deftest render-to-str-test
+     (let [a (compassus.core/mount! *app* nil)]
+       (is (= (dom/render-to-str a)
+              "
Hello, home!
")))))

 (deftest test-create-app
   (is (instance? compassus.core.CompassusApplication *app*))


init vexflow element with size specification

--- src/cljs/daveconservatoire/site/ui/vexflow.cljs
+++ src/cljs/daveconservatoire/site/ui/vexflow.cljs
@@ -91,7 +91,8 @@
       (render-score (om/props this) node)))

   (render [this]
-    (let [el (-> (om/props this) ::backend backend-element)]
-      (el nil))))
+    (let [{::keys [width height backend]} (om/props this)
+          el (backend-element backend)]
+      (el #js {:style #js {:width width :height height}}))))

 (def score (om/factory Score))


fixed filtering, name not always exist a.k.a lumir case

--- src/cljs/swarmpit/component/dockerhub/list.cljs
+++ src/cljs/swarmpit/component/dockerhub/list.cljs
@@ -8,10 +8,10 @@

 (def cursor [:page :dockerhub :list :filter])

-(def headers ["Name" "Username" "Company"])
+(def headers ["Username" "Name" "Company"])

 (def render-item-keys
-  [[:name] [:username] [:company]])
+  [[:username] [:name] [:company]])

 (defn- render-item
   [item]
@@ -24,18 +24,18 @@
 (defn- filter-items
   "Filter list items based on given predicate"
   [items predicate]
-  (filter #(string/includes? (:name %) predicate) items))
+  (filter #(string/includes? (:username %) predicate) items))

 (rum/defc dockeruser-list < rum/reactive [items]
-  (let [{:keys [name]} (state/react cursor)
-        filtered-items (filter-items items name)]
+  (let [{:keys [username]} (state/react cursor)
+        filtered-items (filter-items items username)]
     [:div
      [:div.form-panel
       [:div.form-panel-left
        (comp/panel-text-field
-         {:hintText "Filter by name"
+         {:hintText "Filter by username"
           :onChange (fn [_ v]
-                      (state/update-value [:name] v cursor))})]
+                      (state/update-value [:username] v cursor))})]
       [:div.form-panel-right
        (comp/mui
          (comp/raised-button
@@ -50,7 +50,7 @@

 (defn- init-state
   []
-  (state/set-value {:name ""} cursor))
+  (state/set-value {:username ""} cursor))

 (defn mount!
   [items]


rename Signal to SignalDefinition

rename Signal to SignalDefinition

--- src/cljx/jamesmacaulay/zelkova/impl/signal.cljx
+++ src/cljx/jamesmacaulay/zelkova/impl/signal.cljx
@@ -90,7 +90,7 @@
   [x]
   (satisfies? SignalProtocol x))

-(defrecord Signal
+(defrecord SignalDefinition
   [init-fn sources relayed-event-topic msg-fn deps event-sources]
   SignalProtocol
   (signal-deps [_]
@@ -114,7 +114,7 @@
   [opts]
   (-> opts
       (setup-event-relay)
-      (map->Signal)))
+      (map->SignalDefinition)))

 (def ^{:doc "A transducer which takes in batches of signal graph messages and pipes out fresh values."}
   fresh-values
@@ -347,7 +347,7 @@
           (connect-to-world))))
   (pipe-to-atom* [g atm ks]
     (pipe-to-atom* (spawn* g nil) atm ks))
-  Signal
+  SignalDefinition
   (spawn* [s opts] (spawn* (compile-graph s) opts))
   (pipe-to-atom* [s atm ks]
     (pipe-to-atom* (spawn* s nil) atm ks)))


Oops.. I've forgot to add some changes to the last commit

--- src/blocks_editor/view/styles.cljs
+++ src/blocks_editor/view/styles.cljs
@@ -14,7 +14,7 @@
      :margin-top "3px"
      :padding "0px"}]

-   [:.be-menu
+   [:.be-menux
     {:right "0px"
      :left "auto"
      :max-width "50vw"}


(#17524) Better logging / error handling for version check

Prior to this commit, if a call to the `version` REST endpoint
failed, we were not handling the error gracefully.  This commit
does the following:

* Catches exceptions and returns a reasonable http error to
  the caller
* Logs a message at DEBUG level with some details about the failure

--- src/com/puppetlabs/puppetdb/http/v1/version.clj
+++ src/com/puppetlabs/puppetdb/http/v1/version.clj
@@ -1,6 +1,7 @@
 (ns com.puppetlabs.puppetdb.http.v1.version
   (:require [com.puppetlabs.http :as pl-http]
-            [ring.util.response :as rr])
+            [ring.util.response :as rr]
+            [clojure.tools.logging :as log])
   (:use [com.puppetlabs.utils :only [version update-info]]
         com.puppetlabs.middleware
         [net.cgrand.moustache :only [app]]))
@@ -20,9 +21,18 @@
   [{:keys [globals]}]
   {:pre [(:update-server globals)]}
   (let [update-server (:update-server globals)]
-    (if-let [update (update-info update-server)]
-      (pl-http/json-response update)
-      (pl-http/error-response "Could not find version" 404))))
+    (try
+      (if-let [update (update-info update-server)]
+        (pl-http/json-response update)
+        (do
+          (log/debug (format
+                       "Unable to determine latest version via update-server: '%s'"
+                       update-server))
+          (pl-http/error-response "Could not find version" 404)))
+      (catch java.io.IOException e
+        (log/debug (format "Error when checking for latest version: %s" e))
+        (pl-http/error-response
+          (format "Error when checking for latest version: %s" e))))))

 (def routes
   (app


there can be no :angles nor :houses without :geo coordinates

--- src/ephemeris_api/handler.clj
+++ src/ephemeris_api/handler.clj
@@ -17,4 +17,4 @@

       (GET "/utc" []
         :summary "points at the universal moment"
-        (ok (calc))))))
+        (ok (calc {:angles [] :houses false}))))))


add link to filter docs

add link to filter docs

--- src/flambo/parquet/thrift.clj
+++ src/flambo/parquet/thrift.clj
@@ -26,7 +26,10 @@

 (defn parquet-thrift-file
   "Create an RDD from a directory of parquet-thrift files
-  where `klass` is the thrift class used to create the parquet files."
+  where `klass` is the thrift class used to create the parquet files.
+
+  See https://github.com/Parquet/parquet-mr/blob/master/parquet_cascading.md
+  for the filter syntax."
   [spark-context path klass & {:keys [job unbound-record-filter filter]
                                :or {job (Job.)}}]
   (let [job (if unbound-record-filter


Mixed up wording here

Mixed up wording here

--- src/foreclojure/solutions.clj
+++ src/foreclojure/solutions.clj
@@ -20,9 +20,9 @@
                           :only [(keyword (str "scores." problem-id))
                                  :solved])]
            (cond (seq scores) (str "Scored " (first (vals scores))
-                                   ", before 4clojure started storing solutions."),
+                                   ", before 4clojure started saving solutions."),

-                 (some #{problem-id} solved) "Solved before 4clojure started saving solutions")))))
+                 (some #{problem-id} solved) "Solved before 4clojure started scoring solutions")))))

 (defn save-solution [user-id problem-id code]
   (update! :solutions


Handle playlists path change

Handle playlists path change

--- src/trak/action_handlers.cljs
+++ src/trak/action_handlers.cljs
@@ -3,7 +3,8 @@
             [trak.utils :as utils]
             [trak.api :as api]
             [trak.globals :as globals]
-            [trak.db :as db]))
+            [trak.db :as db])
+  (:import goog.string))

 (def api-result-handler)
@@ -15,17 +16,25 @@
 (defmethod handler :find-albums [_ _ _]
   (api/find-albums "blues"))

-(defmethod handler :api-call-result [_ params db]
-  (api-result-handler (:call params) (:response params) db))
+(defmethod handler :api-call-result [_ params *db]
+  (api-result-handler (:call params) (:response params) *db))

-(defmethod handler :login-on-arrival [_ params db]
+(defmethod handler :login-on-arrival [_ params *db]
   (when-let [auth (globals/get-spotify-auth-token)]
-    (d/transact! db [(merge {:me/identifier :me
-                             :me/status     :loading}
-                            (db/convert-atrrs-to-datascript auth :me))])
-    (api/me (:access_token auth))
-    ))
+    (d/transact! *db [(merge {:me/identifier :me
+                              :me/status     :loading}
+                             (db/convert-atrrs-to-datascript auth :me))])
+    (api/me (:access_token auth))))

+(defmethod handler :load-playlist [_ params *db]
+  (d/transact! *db (map (fn [track] [:db.fn/retractEntity (:db/id track)]) (db/tracks @*db)))
+  (d/transact! *db [{:application/state-type :page
+                     :application/state      {:title (:playlist/name (db/playlist @*db (:id params)))}
+                     :application/status     :loading}])
+  (let [id (:id params)]
+    (when-let
+      [tracks (:playlist/tracks (db/playlist @*db id))]
+      (api/playlist (:href tracks) (:me/access_token (db/me @*db))))))

 (defmulti api-result-handler (fn [api result *db]
                                (utils/debug "API result handler " api " with result " result)


selection list - improve demo list labels to Fight Club Rules

--- src/re_demo/lists.cljs
+++ src/re_demo/lists.cljs
@@ -49,14 +49,15 @@
         multi-select? (r/atom true)
         required?     (r/atom true)
         as-exlcusion? (r/atom false)
-        items         (r/atom [{:id "1" :label "1 Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit" :short "Short label 1"}
-                               {:id "2" :label "2 Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit" :short "Short label 2"}
-                               {:id "3" :label "3 Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit" :short "Short label 3"}
-                               {:id "4" :label "4 Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit" :short "Short label 4"}
-                               {:id "5" :label "5 Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit" :short "Short label 5"}
-                               {:id "6" :label "6 Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit" :short "Short label 6"}
-                               {:id "7" :label "7 Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit" :short "Short label 7"}])
-        selections    (r/atom (set [(second @items)]))]
+        items         (r/atom [{:id "1" :label "1st RULE: You do not talk about FIGHT CLUB." :short "1st RULE"}
+                               {:id "2" :label "2nd RULE: You DO NOT talk about FIGHT CLUB." :short "2nd RULE"}
+                               {:id "3" :label "3rd RULE: If someone says \"stop\" or goes limp, taps out the fight is over." :short "3rd RULE"}
+                               {:id "4" :label "4th RULE: Only two guys to a fight." :short "4th RULE"}
+                               {:id "5" :label "5th RULE: One fight at a time." :short "5th RULE"}
+                               {:id "6" :label "6th RULE: No shirts, no shoes." :short "6th RULE"}
+                               {:id "7" :label "7th RULE: Fights will go on as long as they have to." :short "7th RULE"}
+                               {:id "8" :label "8th RULE: If this is your first night at FIGHT CLUB, you HAVE to fight." :short "8th RULE"}])
+        selections (r/atom (set [(second @items)]))]
     [options-with
      width
      [v-box ;; TODO: v-box required to constrain height of internal border.


Reworked the setup of the project. The downloading of the dependencies is now shown in the wizard when "lein deps" is executed.

--- ccw.support.examples/src/ccw/support/labrepl/wizards/LabreplCreationOperation.clj
+++ ccw.support.examples/src/ccw/support/labrepl/wizards/LabreplCreationOperation.clj
@@ -112,7 +112,7 @@
   "Calls resource-fn until it returns a non-nil value and returns it. If resource-fn
 returns nil, waits for step milliseconds, and repeats. Returns nil if resource-fn
 never returned a non-nil value before the timeout occurred."
-  [resource-fn timeout step monitor]
+  [resource-fn desc timeout step monitor]
   (let [sub-monitor (SubMonitor/convert monitor 10)]
     (println "wait for resource")
     (loop
@@ -125,8 +125,8 @@
 	        (if resource
 	          resource
 	          (try
-              (println (str "Remaing wait time " self-timeout))
-              (.subTask sub-monitor (str "Remaing wait time " self-timeout))
+              (println (str "Remaining wait time " desc " " self-timeout))
+              (.subTask sub-monitor (str "Remaining wait time " desc " " self-timeout))
 	            (Thread/sleep step)
 	            (.worked sub-monitor 1)
 	            (recur (- self-timeout step))
@@ -145,7 +145,7 @@
 (defn- open-browser
   "Open a browser for the running labrepl web page"
   [monitor]
-	(if (wait-for-resource check-server *timeout* *step* monitor)
+	(if (wait-for-resource check-server "REPL" *timeout* *step* monitor)
 	   (let
 		  [browser-support (.getBrowserSupport (PlatformUI/getWorkbench))
 		   browser
@@ -196,70 +196,44 @@
       project (config-new-project root project-name (.newChild progress 10))
       page-state @(.state page)
       run-lein-deps (.getSelection (:run-lein-deps-button page-state))
-      run-repl (.getSelection (:run-repl-button page-state))
-      test-job
-        (proxy [WorkbenchJob] ["Setup of Labrepl Project"]
-          (runInUIThread [monitor]
-             (let
-               [sleep 100
-                duration 5000
-                ticks (int (/ duration sleep))]
-               (.beginTask monitor "TEST JOB" IProgressMonitor/UNKNOWN)
-               (try
-                 (loop [i 0]
-                    (if (< i ticks)
-                       (do
-                         (.subTask monitor (str "Processing tick #" i))
-                         (println (str "Processing tick #" i))
-                         (Thread/sleep sleep)
-                         (.worked monitor 1)
-                         (recur (inc i)))))
-                 (finally (.done monitor))))
-               Status/OK_STATUS))
-      setup-job
-        (proxy [WorkbenchJob] ["Setup of Labrepl Project"]
-          (runInUIThread [monitor]
-            (let [job-progress (SubMonitor/convert monitor 100)]
-              (.subTask job-progress "Doing imports")
-					    (do-imports project (.newChild job-progress 30) overwrite-query)
-					    (.worked job-progress 1)
-					    (if run-lein-deps
-					      (let
-					        [leiningen-pfile (.toOSString (.getLocation (.getFile project "project.clj")))
-					          labrepl-leiningen-project (read-project (str leiningen-pfile))]
-                  (binding [lancet/ant-project (make-ant-project-with-progress job-progress)]
-                    (.subTask job-progress "Running  \"lein deps\"")
-						        (deps labrepl-leiningen-project)
-	                  (.worked job-progress 1)
-
-	                  (.subTask job-progress "Fixing classpath")
-						        (fix-libraries project)
-	                  (.worked job-progress 1)
-
-						        (if run-repl
-						          (let
-						            [startup-file-selection (StructuredSelection. (.getFile (.getFolder project "src") "labrepl.clj"))]
+      run-repl (.getSelection (:run-repl-button page-state))]
+        (.subTask progress "Doing imports")
+		    (do-imports project (.newChild progress 30) overwrite-query)
+		    (.worked progress 1)
+		    (if run-lein-deps
+		      (let
+		        [leiningen-pfile (.toOSString (.getLocation (.getFile project "project.clj")))
+		          labrepl-leiningen-project (read-project (str leiningen-pfile))]
+            (println "run-lein-deps is true")
+            (binding [lancet/ant-project (make-ant-project-with-progress progress)]
+              (.subTask progress "Running  \"lein deps\"")
+			        (deps labrepl-leiningen-project)
+              (.worked progress 1)
+
+              (.subTask progress "Fixing classpath")
+			        (fix-libraries project)
+              (.worked progress 1)
+
+			        (if run-repl
+			         (let
+                [startup-file-selection (StructuredSelection. (.getFile (.getFolder project "src") "labrepl.clj"))
+                  repl-browser-job
+                    (proxy [WorkbenchJob] ["Setup of Labrepl Project"]
+		                  (runInUIThread [monitor]
+		                    (let
+                          [job-progress (SubMonitor/convert monitor 100)]
 	                        (.subTask job-progress "Launching REPL")
 						              (.launch (ClojureLaunchShortcut.) startup-file-selection ILaunchManager/RUN_MODE)
-	                        (.worked job-progress 1)
-
-													(let [console (wait-for-resource #(ClojureClient/findActiveReplConsole) *timeout* *step* (.newChild job-progress 30))]
+			                    (.worked job-progress 1)
+
+													(let [console (wait-for-resource #(ClojureClient/findActiveReplConsole) "Console" *timeout* *step* (.newChild job-progress 30))]
 			                      (if console
 			                        (do
 				                        (EvaluateTextAction/evaluateText console "(labrepl/-main)")
 													      (open-browser (.newChild job-progress 30)))
-			                        Status/CANCEL_STATUS)))
-	                      Status/OK_STATUS)))
-                  Status/OK_STATUS))))]
-      ; TODO If you are running a long running operation in a wizard/wizardPage you should consider running it thru getContainer().run(). This will show the progressBar right there in the wizard dialog itself:
-      ; http://blog.eclipse-tips.com/2009/02/using-progress-bars.html
-      (.setUser setup-job true)
-      (.schedule setup-job)
-      (.showInDialog (.getProgressService (PlatformUI/getWorkbench)) (.getShell page) setup-job)
-      ; (.setUser test-job true)
-      ; (.schedule test-job)
-      ; (.showInDialog (.getProgressService (PlatformUI/getWorkbench)) (.getShell page) test-job)
-      ))
+			                        Status/CANCEL_STATUS)))))]
+                  (println "run-repl is true")
+                  (.schedule repl-browser-job))))))))

 (defn -run
   [this monitor]


Update home routes.

Update home routes.

--- src/tweetbook/routes/home.clj
+++ src/tweetbook/routes/home.clj
@@ -1,16 +1,24 @@
 (ns tweetbook.routes.home
   (:require [compojure.core :refer :all]
-            [hiccup.form :refer :all]
-            [tweetbook.views.layout :as layout]))
+            [liberator.core :refer [defresource resource request-method-in]]
+            [noir.io :as io]
+            [clojure.java.io :refer [file]]))

-(defn show-form []
-  (form-to [:post "/"]
-           (text-area {:rows 5 :cols 50} "msg") [:br]
-           (text-field "src") [:br]
-           [:p#count "0"]))
+(defresource home
+  :available-media-types ["text/html"]

-(defn home []
-  (layout/common (show-form)))
+  :exists?
+  (fn [_]
+    [(io/get-resource "/index.html")
+     {::file (file (str (io/resource-path) "/index.html"))}])
+
+  :handle-ok
+  (fn [{{{resource :resource} :route-params} :request}]
+    (clojure.java.io/input-stream (io/get-resource "/index.html")))
+
+  :last-modified
+  (fn [{{{resource :resource} :route-params} :request}]
+    (.lastModified (file (str (io/resource-path) "/index.html")))))

 (defroutes home-routes
-  (GET "/" [] (home)))
+  (ANY "/" [] home))


formatting

formatting

--- src/overtone/helpers/zip.clj
+++ src/overtone/helpers/zip.clj
@@ -69,16 +69,16 @@
     (let [zip     (zip-file zip-path)
           entries (.entries zip)
           entries (doall (enumeration-seq entries))]
-          (dorun
-     (map
-      (fn [entry]
-        (let [name           (.getName entry)
-              full-dest-path (mk-path dest-path name)]
-          (when (contains-parent-shortcut? full-dest-path)
-            (throw (Exception. "Security warning - attempted to specify a path which contains the .. previous dir shortcut. Aborting operation.")))
-          (if (.isDirectory entry)
-            (mkdir-p! full-dest-path)
-            (let [is (.getInputStream zip entry)
-                  fs (FileOutputStream. full-dest-path)]
-              (io/copy is fs)))))
-      entries)))))
+      (dorun
+       (map
+        (fn [entry]
+          (let [name           (.getName entry)
+                full-dest-path (mk-path dest-path name)]
+            (when (contains-parent-shortcut? full-dest-path)
+              (throw (Exception. "Security warning - attempted to specify a path which contains the .. previous dir shortcut. Aborting operation.")))
+            (if (.isDirectory entry)
+              (mkdir-p! full-dest-path)
+              (let [is (.getInputStream zip entry)
+                    fs (FileOutputStream. full-dest-path)]
+                (io/copy is fs)))))
+        entries)))))


beef up adsr docstring

beef up adsr docstring

--- src/overtone/sc/envelope.clj
+++ src/overtone/sc/envelope.clj
@@ -160,8 +160,43 @@
       [delay-t attack decay release] curve)))

 (defunk adsr
-  "Create an attack decay sustain release envelope suitable for use with the
-  env-gen ugen"
+  "Create an attack decay sustain release envelope
+  suitable for use as the envelope parameter of the
+  env-gen ugen.
+
+  attack  - the time it takes to go from 0 to the
+            specified amplitude level (this defaults to
+            1)
+
+  decay   - the time it takes to go from the specified
+            amplitude level to sustain * level (also
+            defaulting to 1)
+
+  sustain - the fraction of the level to use as the
+            sustain amplitude
+
+  release - the time it takes to go from the sustain
+            amplitude to 0
+
+  level   - the level of the amplitude after the attack,
+            and the value to multiply the sustain
+            fraction with to determine the sustain
+            amplitude
+
+  curve   - the envelope curve
+
+  bias    - a value to add with every value of the envelope
+
+  This envelope has multiple phases: attack, decay,
+  sustain and release. Once the attack phase has started,
+  after the specified attack time, the envelope value is
+  the specified level + bias. Next the decay phase kicks
+  in. After the decay time, the amplitude is at the
+  sustain level + bias. The amplitude then stays at this
+  level indefinitely. This is, until the gate of the
+  outer env-gen is released. Once this gate is released,
+  the envelope enters the release phase, and after
+  release time, the amplitude is 0 + bias."
   [attack 0.01 decay 0.3 sustain 1 release 1
               level 1 curve -4 bias 0]
   (with-overloaded-ugens


Referring to the wrong fns, should end with !

--- src/overtone/studio/inst.clj
+++ src/overtone/studio/inst.clj
@@ -245,14 +245,14 @@
     you to control the volume or pan of the instrument group with one
     command:

-    (inst-pan bar -1)     ;pan hard left.
-    (inst-volume bar 0.5) ;half the volume.
+    (inst-pan! bar -1)     ;pan hard left.
+    (inst-volume! bar 0.5) ;half the volume.

     For a stereo inst, you can control left and right pan or volume
     separately by passing an additional arg:

-    (inst-pan bar 1 -1)   ;ch1 right, ch2 left.
-    (inst-volume bar 0 1) ;mute ch1.
+    (inst-pan! bar 1 -1)   ;ch1 right, ch2 left.
+    (inst-volume! bar 0 1) ;mute ch1.

   * Each instrument has an fx-chain to which you can add any number of
     'fx synths' using the inst-fx function.


Add midi-capture-next-controller-key

Add midi-capture-next-controller-key

--- src/overtone/studio/midi.clj
+++ src/overtone/studio/midi.clj
@@ -154,3 +154,9 @@
                           (deliver p res)))
                       ::print-next-control-input)
        @p)))
+
+(defn midi-capture-next-controller-key
+  "Returns a vector representing the unique key for the next modified
+  controller."
+  []
+  (:key (midi-capture-next-control-input true)))


Update docstring to warn users that the current thread will be blocked.

--- src/overtone/studio/midi.clj
+++ src/overtone/studio/midi.clj
@@ -142,10 +142,13 @@

 (defn midi-capture-next-control-input
-  "Returns a simple map representing next modified controller. Useful
-  for detecting controller information. If the argument with-key? is set
-  to true, the full event key will be associated with the resulting
-  map."
+  "Returns a simple map representing next modified controller. Will
+  block the current thread until a new MIDI control-change event is
+  received.
+
+  Useful for detecting controller information. If the argument with-key?
+  is set to true, the full event key will be associated with the
+  resulting map."
   ([] (midi-capture-next-control-input false))
   ([with-key?]
      (let [p (promise)]


Add bang

Add bang

--- src/play_clj/g2d_physics.clj
+++ src/play_clj/g2d_physics.clj
@@ -125,7 +125,7 @@
   `(u/call! ^Joint ~object ~k ~@options))

 (defn create-joint!*
-  "The function version of `create-joint`"
+  "The function version of `create-joint!`"
   [screen j-def]
   (box-2d! screen :create-joint j-def))


:sparkles: Minor cosmetic changes in ref definition.

--- frontend/src/app/main/ui/workspace/colorpicker.cljs
+++ frontend/src/app/main/ui/workspace/colorpicker.cljs
@@ -39,7 +39,7 @@
   (l/derived :picked-shift? refs/workspace-local))

 (def viewport
-  (l/derived (comp :vport :workspace-local) st/state))
+  (l/derived (l/in [:workspace-local :vport]) st/state))

 ;; --- Color Picker Modal
@@ -104,7 +104,7 @@
   (let [value (if (uc/hex? value) value "#000000")
         [r g b] (uc/hex->rgb value)
         [h s v] (uc/hex->hsv value)]
-
+
     {:hex (or value "000000")
      :alpha (or opacity 1)
      :r r :g g :b b


Update project.clj

Update project.clj

Cleaned up project.clj template

--- src/leiningen/new/jruby_sinatra_template/project.clj
+++ src/leiningen/new/jruby_sinatra_template/project.clj
@@ -3,9 +3,6 @@
   :description "{{sanitized}} - A Jruby based sinatra web application"

   :url ""
-
-  :license {:name "Eclipse Public License"
-            :url  "http://www.eclipse.org/legal/epl-v10.html"}

   :min-lein-version "2.0.0"

@@ -18,8 +15,12 @@
             "clean" ["do" "clean," "remove-jars"]
             "deps"  ["do" "deps," "libdir"]}

+  ; Global exclusions
   ;:exclusions []

-  ;:dependencies [[]]
+  ; Java dependencies. For example :
+  ;:dependencies [[org.slf4j/slf4j-api "1.6.2"]
+  ;               [org.slf4j/slf4j-log4j12 "1.6.2"]
+  ;               [org.apache.thrift/libthrift "0.9.0"]]

-  :profiles {:dev {:dependencies [[org.clojure/clojure "{{clojure-version}}"]]}})+  :profiles {:dev {:dependencies [[org.clojure/clojure "{{clojure-version}}"]]}})