add chaos ugen metadata

add chaos ugen metadata

--- src/overtone/sc/ugen/chaos.clj
+++ src/overtone/sc/ugen/chaos.clj
@@ -33,22 +33,22 @@
        ;; }

        {:name "QuadN",
-        :args [{:name "freq", :default 22050.0}
-               {:name "a", :default 1.0}
-               {:name "b", :default -1.0}
-               {:name "c", :default -0.75}
-               {:name "xi", :default 0.0}]
-        :doc "a non-interpolating sound generator based on the difference equation: xn+1 = axn2 + bxn + c "}
+        :args [{:name "freq", :default 22050.0 :doc "iteration frequency in Hertz"}
+               {:name "a", :default 1.0 :doc "1st coefficient"}
+               {:name "b", :default -1.0 :doc "2nd coefficient"}
+               {:name "c", :default -0.75 :doc "3rd coefficient"}
+               {:name "xi", :default 0.0 :doc "initial value of x"}]
+        :doc "a non-interpolating (general quadratic map chaotic) sound generator based on the difference equation: xn+1 = axn2 + bxn + c "}

        ;; QuadL : QuadN {}

        {:name "QuadL" :extends "QuadN"
-        :doc "a linear-interpolating sound generator based on the difference equation: xn+1 = axn2 + bxn + c"}
+        :doc "a linear-interpolating (general quadratic map chaotic) sound generator based on the difference equation: xn+1 = axn2 + bxn + c"}

        ;; QuadC : QuadN {}

        {:name "QuadC", :extends "QuadN"
-        :doc "a cubic-interpolating sound generator based on the difference equation: xn+1 = axn2 + bxn + c"}
+        :doc "a cubic-interpolating (general quadratic map chaotic) sound generator based on the difference equation: xn+1 = axn2 + bxn + c"}

        ;; // Cusp Map
        ;; CuspN : ChaosGen {
@@ -59,16 +59,16 @@
        ;; }

        {:name "CuspN",
-        :args [{:name "freq", :default 22050.0}
-               {:name "a", :default 1.0}
-               {:name "b", :default 1.9}
-               {:name "xi", :default 0.0}]
-        :doc "a non-interpolating sound generator based on the difference equation: xn+1 = a - b*sqrt(|xn|)"}
+        :args [{:name "freq", :default 22050.0 :doc "iteration frequency in Hertz"}
+               {:name "a", :default 1.0 :doc "first coefficient"}
+               {:name "b", :default 1.9 :doc "2nd coefficient"}
+               {:name "xi", :default 0.0 :doc "initial value of x"}]
+        :doc "a non-interpolating (cusp map chaotic) sound generator based on the difference equation: xn+1 = a - b*sqrt(|xn|)"}

        ;; CuspL : CuspN {}

        {:name "CuspL" :extends "CuspN"
-        :doc "a linear-interpolating sound generator based on the difference equation: xn+1 = a - b*sqrt(|xn|)"}
+        :doc "a linear-interpolating (cusp map chaotic) sound generator based on the difference equation: xn+1 = a - b*sqrt(|xn|)"}

        ;; // Gingerbreadman Map
        ;; GbmanN : ChaosGen {
@@ -79,17 +79,17 @@
        ;; }

        {:name "GbmanN",
-        :args [{:name "freq", :default 22050.0}
-               {:name "xi", :default 1.2}
-               {:name "yi", :default 2.1}]
-        :doc "A non-interpolating sound generator based on the difference equations:
+        :args [{:name "freq", :default 22050.0 :doc "iteration frequency in Hz"}
+               {:name "xi", :default 1.2 :doc "initial value of x"}
+               {:name "yi", :default 2.1 :doc "initial value of y"}]
+        :doc "A non-interpolating (gingerbreadman map chaotic) sound generator based on the difference equations:
 xn+1 = 1 - yn + |xn|
 yn+1 = xn"}

        ;; GbmanL : GbmanN {}

        {:name "GbmanL" :extends "GbmanN"
-        :doc "A linear-interpolating sound generator based on the difference equations:
+        :doc "A linear-interpolating (gingerbreadman map chaotic) sound generator based on the difference equations:
 xn+1 = 1 - yn + |xn|
 yn+1 = xn"}

@@ -102,25 +102,25 @@
        ;; }

        {:name "HenonN",
-        :args [{:name "freq", :default 22050.0}
-               {:name "a", :default 1.4}
-               {:name "b", :default 0.3}
-               {:name "x0", :default 0.0}
-               {:name "x1", :default 0.0}]
-        :doc "a non-interpolating sound generator based on the difference equation:
-x[n+2] = 1 - a*(x[n+1]^)2 + bx[n]"}
+        :args [{:name "freq", :default 22050.0 :doc "iteration frequency in Hertz"}
+               {:name "a", :default 1.4 :doc "1st coefficient"}
+               {:name "b", :default 0.3 :doc "2nd coefficient"}
+               {:name "x0", :default 0.0 :doc "initial value of x"}
+               {:name "x1", :default 0.0 :doc "second value of x"}]
+        :doc "a non-interpolating (henon map chaotic) sound generator based on the difference equation:
+x[n+2] = 1 - a*(x[n+1]^)2 + bx[n]. This equation was discovered by French astronomer Michel Hénon while studying the orbits of stars in globular clusters."}

        ;; HenonL : HenonN {}

        {:name "HenonL" :extends "HenonN"
-        :doc "a linear-interpolating sound generator based on the difference equation:
-x[n+2] = 1 - a*(x[n+1]^)2 + bx[n]"}
+        :doc "a linear-interpolating (henon map chaotic) sound generator based on the difference equation:
+x[n+2] = 1 - a*(x[n+1]^)2 + bx[n]. This equation was discovered by French astronomer Michel Hénon while studying the orbits of stars in globular clusters."}

        ;; HenonC : HenonN {}

        {:name "HenonC" :extends "HenonN"
-        :doc "a cubic-interpolating sound generator based on the difference equation:
-x[n+2] = 1 - a*(x[n+1]^)2 + bx[n]"}
+        :doc "a cubic-interpolating (henon map chaotic) sound generator based on the difference equation:
+x[n+2] = 1 - a*(x[n+1]^)2 + bx[n]. This equation was discovered by French astronomer Michel Hénon while studying the orbits of stars in globular clusters."}

        ;; // Latoocarfian
        ;; LatoocarfianN : ChaosGen {
@@ -131,24 +131,24 @@
        ;; }

        {:name "LatoocarfianN",
-        :args [{:name "freq", :default 22050.0}
-               {:name "a", :default 1.0}
-               {:name "b", :default 3.0}
-               {:name "c", :default 0.5}
-               {:name "d", :default 0.5}
-               {:name "xi", :default 0.5}
-               {:name "yi", :default 0.5}]
-        :doc "a non-interpolating latoocarfian chaotic sound generator"}
+        :args [{:name "freq", :default 22050.0 :doc "iteration frequency in Hertz"}
+               {:name "a", :default 1.0 :doc "1st coefficient"}
+               {:name "b", :default 3.0 :doc "2nd coefficient"}
+               {:name "c", :default 0.5 :doc "3rd coefficient"}
+               {:name "d", :default 0.5 :doc "4th coefficient"}
+               {:name "xi", :default 0.5 :doc "initial value of x"}
+               {:name "yi", :default 0.5 :doc "initial value of y"}]
+        :doc "a non-interpolating (latoocarfian chaotic) sound generator. Parameters a and b should be in the range from -3 to +3, and parameters c and d should be in the range from 0.5 to 1.5. The function can, depending on the parameters given, give continuous chaotic output, converge to a single value (silence)  or oscillate in a cycle (tone)."}

        ;; LatoocarfianL : LatoocarfianN {}

        {:name "LatoocarfianL" :extends "LatoocarfianN"
-        :doc "a linear-interpolating latoocarfian chaotic sound generator"}
+        :doc "a linear-interpolating (latoocarfian chaotic) sound generator. Parameters a and b should be in the range from -3 to +3, and parameters c and d should be in the range from 0.5 to 1.5. The function can, depending on the parameters given, give continuous chaotic output, converge to a single value (silence)  or oscillate in a cycle (tone)."}

        ;; LatoocarfianC : LatoocarfianN {}

        {:name "LatoocarfianC" :extends "LatoocarfianN"
-        :doc "a cubic-interpolating latoocarfian chaotic sound generator"}
+        :doc "a cubic-interpolating (latoocarfian chaotic) sound generator. Parameters a and b should be in the range from -3 to +3, and parameters c and d should be in the range from 0.5 to 1.5. The function can, depending on the parameters given, give continuous chaotic output, converge to a single value (silence)  or oscillate in a cycle (tone)."}

        ;; // Linear Congruential
        ;; LinCongN : ChaosGen {
@@ -159,22 +159,22 @@
        ;; }

        {:name "LinCongN",
-        :args [{:name "freq", :default 22050.0}
-               {:name "a", :default 1.1}
-               {:name "c", :default 0.13}
-               {:name "m", :default 1.0}
-               {:name "xi", :default 0.0}]
-        :doc "a non-interpolating linear congruential chaotic sound generator"}
+        :args [{:name "freq", :default 22050.0 :doc "iteration frequency in Hertz."}
+               {:name "a", :default 1.1 :doc "multiplier amount"}
+               {:name "c", :default 0.13 :doc "increment amount"}
+               {:name "m", :default 1.0 :doc "modulus amount"}
+               {:name "xi", :default 0.0 :doc "initial value of x"}]
+        :doc "a non-interpolating (linear congruential chaotic) sound generator. The output signal is automatically scaled to a range of [-1, 1]."}

        ;; LinCongL : LinCongN {}

        {:name "LinCongL" :extends "LinCongN"
-        :doc "a linear-interpolating linear congruential chaotic sound generator"}
+        :doc "a linear-interpolating (linear congruential chaotic) sound generator. The output signal is automatically scaled to a range of [-1, 1]."}

        ;; LinCongC : LinCongN {}

        {:name "LinCongC" :extends "LinCongN"
-        :doc "a cubic-interpolating linear congruential chaotic sound generator"}
+        :doc "a cubic-interpolating (linear congruential chaotic) sound generator. The output signal is automatically scaled to a range of [-1, 1]."}

        ;; // Standard Map
        ;; StandardN : ChaosGen {
@@ -185,16 +185,16 @@
        ;; }

        {:name "StandardN",
-        :args [{:name "freq", :default 22050.0}
-               {:name "k", :default 1.0}
-               {:name "xi", :default 0.5}
-               {:name "yi", :default 0.0}]
-        :doc "standard map chaotic generator"}
+        :args [{:name "freq", :default 22050.0 :doc "iteration frequency in Hertz"}
+               {:name "k", :default 1.0 :doc "perturbation amount"}
+               {:name "xi", :default 0.5 :doc "initial value of x"}
+               {:name "yi", :default 0.0 :doc "initial value of y"}]
+        :doc "standard map chaotic generator. The standard map is an area preserving map of a cylinder discovered by the plasma physicist Boris Chirikov."}

        ;; StandardL : StandardN {}

        {:name "StandardL" :extends "StandardN"
-        :doc "linear-interpolating standard map chaotic generator"}
+        :doc "linear-interpolating standard map chaotic generator. The standard map is an area preserving map of a cylinder discovered by the plasma physicist Boris Chirikov."}

        ;; // Feedback Sine with Linear Congruential Phase Indexing
        ;; FBSineN : ChaosGen {
@@ -205,23 +205,23 @@
        ;; }

        {:name "FBSineN",
-        :args [{:name "freq", :default 22050.0}
-               {:name "im", :default 1.0}
-               {:name "fb", :default 0.1}
-               {:name "a", :default 1.1}
-               {:name "c", :default 0.5}
-               {:name "xi", :default 0.1}
-               {:name "yi", :default 0.1}]
-        :doc "a non-interpolating feedback sine with chaotic phase indexing sound generator"}
+        :args [{:name "freq", :default 22050.0 :doc "iteration frequency in Hertz"}
+               {:name "im", :default 1.0 :doc "index multiplier amount"}
+               {:name "fb", :default 0.1 :doc "feedback amount"}
+               {:name "a", :default 1.1 :doc "phase multiplier amount"}
+               {:name "c", :default 0.5 :doc "phase increment amount"}
+               {:name "xi", :default 0.1 :doc "initial value of x"}
+               {:name "yi", :default 0.1 :doc "initial value of y"}]
+        :doc "a non-interpolating feedback sine with chaotic phase indexing sound generator. This uses a linear congruential function to drive the phase indexing of a sine wave.  For im = 1, fb = 0, and a = 1 a normal sinewave results."}

        ;; FBSineL : FBSineN {}

        {:name "FBSineL" :extends "FBSineN"
-        :doc "a linear-interpolating feedback sine with chaotic phase indexing sound generator"}
+        :doc "a linear-interpolating feedback sine with chaotic phase indexing sound generator. This uses a linear congruential function to drive the phase indexing of a sine wave.  For im = 1, fb = 0, and a = 1 a normal sinewave results."}

        ;; FBSineC : FBSineN {}
        {:name "FBSineC" :extends "FBSineN"
-        :doc "a cubic-interpolating feedback sine with chaotic phase indexing sound generator"}
+        :doc "a cubic-interpolating feedback sine with chaotic phase indexing sound generator. This uses a linear congruential function to drive the phase indexing of a sine wave.  For im = 1, fb = 0, and a = 1 a normal sinewave results."}

        ;; // ODEs
        ;; // 'h' is integration time-step
@@ -235,12 +235,12 @@
        ;; }

        {:name "LorenzL",
-        :args [{:name "freq", :default 22050.0}
-               {:name "s", :default 10.0}
-               {:name "r", :default 28.0}
-               {:name "b", :default 2.667}
-               {:name "h", :default 0.05}
-               {:name "xi", :default 0.1}
-               {:name "yi", :default 0.0}
-               {:name "zi", :default 0.0}]
-        :doc "lorenz chaotic generator"}]))
+        :args [{:name "freq", :default 22050.0 :doc "iteration frequency in Hertz"}
+               {:name "s", :default 10.0 :doc "1st variable"}
+               {:name "r", :default 28.0 :doc "2nd variable"}
+               {:name "b", :default 2.667 :doc "3rd variable"}
+               {:name "h", :default 0.05 :doc "integration time stamp"}
+               {:name "xi", :default 0.1 :doc "initial value of x"}
+               {:name "yi", :default 0.0 :doc "initial value of y"}
+               {:name "zi", :default 0.0 :doc "initial value of z"}]
+        :doc "lorenz chaotic generator. A strange attractor discovered by Edward N. Lorenz while studying mathematical models of the atmosphere. The time step amount h determines the rate at which the ODE is evaluated.  Higher values will increase the rate, but cause more instability.  A safe choice is the default amount of 0.05."}]))


keeping command as an array

keeping command as an array

fixes #281

--- src/clj/swarmpit/docker/engine/mapper/compose.clj
+++ src/clj/swarmpit/docker/engine/mapper/compose.clj
@@ -62,7 +62,7 @@
   {(keyword (alias :serviceName (or stack-name (:stack service)) service))
    (ordered-map
      :image (-> service :repository :image)
-     :command (some->> service :command (str/join " "))
+     :command (some->> service :command)
      :user (-> service :user)
      :working_dir (-> service :dir)
      :extra_hosts (->> service :hosts


fix result label and query with *

fix result label and query with *

--- src/wb_es/web/integration.clj
+++ src/wb_es/web/integration.clj
@@ -4,7 +4,8 @@
   (let [doc-source (:_source doc)]
     {:id (:wbid doc-source)
      :class (clojure.string/replace (:_type doc) "-" "_")
-     :label (:label doc-source)
+     :label (or (:label doc-source)
+                (:wbid doc-source))
      :taxonomy (:species doc-source)}))

 (defn- get-obj [doc]
@@ -12,7 +13,9 @@
         doc-source (:_source doc)]
     {:name search-obj
      :description (:description doc-source)
-     :taxonomy nil}))
+     :taxonomy nil
+     :gene (:gene doc-source)
+     :phenotype (:phenotype doc-source)}))

 (defn wrap-params [handler]
   (fn [request]
@@ -25,7 +28,8 @@
                                        (Integer.)
                                        (dec)
                                        (* page-size))
-                            :q (get params :q (:query params))
+                            :q (-> (get params :q (:query params))
+                                   (clojure.string/replace #"\*" ""))
                             :type (get params :type (:class params))
                             :species (:species params)
                             :raw params)]


Type hint to avoid reflection.

Type hint to avoid reflection.

--- metrics-clojure-core/src/metrics/utils.clj
+++ metrics-clojure-core/src/metrics/utils.clj
@@ -22,7 +22,7 @@
          ^String (last title))))

 (defn all-metrics []
-  (letfn [(parse-name [metric-name]
+  (letfn [(parse-name [^MetricName metric-name]
             (str (.getGroup metric-name)
                  "." (.getType metric-name)
                  "." (.getName metric-name)))


Splitting up osx plan card into sections.

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -306,14 +306,18 @@
     om/IRender
     (render [_]
       (html
-        [:div.card
-         [:div title]
-         [:div "$" price "/mo"]
-         [:div container-count " OS X containers"]
-         [:div "Recommended for teams that do " daily-build-count " builds/day"]
-         [:div max-minutes " max minutes/month"]
-         [:div support-level]
-         [:div "Recommended for " team-size " team members"]]))))
+        [:div.plan-card {:data-component `osx-plan-ga}
+         [:div.header
+          [:div.title title]
+          [:div.price "$" price "/mo"]]
+         [:div.content
+          [:div.containers container-count " OS X containers"]
+          [:div.daily-builds "Recommended for teams that do " daily-build-count " builds/day"]
+          [:div.max-minutes max-minutes " max minutes/month"]
+          [:div.support support-level]
+          [:div.team-size "Recommended for " team-size " team members"]]
+         [:div.action
+          [:a.btn.btn-primary "Select"]]]))))

 (defn osx-plan [{:keys [plan-type plan price current-plan]} owner]
   (reify


Wrap tag pill in .tag span to fix styles, remove unneeded fn

--- src/braid/core/client/ui/views/pages/tags.cljs
+++ src/braid/core/client/ui/views/pages/tags.cljs
@@ -61,23 +61,22 @@
   [tag]
   (let [group-id (subscribe [:open-group-id])
         admin? (subscribe [:current-user-is-group-admin?] [group-id])]
-    (fn [tag]
-      [:div.tag-info
-       [:span.count.threads-count
-        (tag :threads-count)]
-       [:span.count.subscribers-count
-        (tag :subscribers-count)]
-       [tag-pill-view (tag :id)]
-       [subscribe-button-view (tag :id)]
-       [:div.description
-        [:p
-         (if (string/blank? (tag :description))
-           "One day, a tag description will be here."
-           (tag :description))]
-        (when @admin?
-          [:div
-           [edit-description-view tag]
-           [delete-tag-view tag]])]])))
+    [:div.tag-info
+     [:span.count.threads-count
+      (tag :threads-count)]
+     [:span.count.subscribers-count
+      (tag :subscribers-count)]
+     [:span.tag [tag-pill-view (tag :id)]]
+     [subscribe-button-view (tag :id)]
+     [:div.description
+      [:p
+       (if (string/blank? (tag :description))
+         "One day, a tag description will be here."
+         (tag :description))]
+      (when @admin?
+        [:div
+         [edit-description-view tag]
+         [delete-tag-view tag]])]]))

 (defn tags-page-view
   []


Add missing # character

Add missing # character

--- src/main/clojure/com/stuartsierra/lazytest.clj
+++ src/main/clojure/com/stuartsierra/lazytest.clj
@@ -446,7 +446,7 @@
   namespaces in the named directory."
   [x & options]
   (let [unload? (some #{:replace} options)
-        options (filter (not #{:replace} %) options)]
+        options (filter #(not #{:replace} %) options)]
     (cond (symbol? x)
           (do (when unload? (remove-ns x))
               (apply require x options)


fix: json_reader reflection

fix: json_reader reflection

--- src/main/clojure/pdok/featured/json_reader.clj
+++ src/main/clojure/pdok/featured/json_reader.clj
@@ -46,8 +46,8 @@
 (defn clojurify [s]
   (keyword (cond->
                (clojure.string/replace s #"_" "-")
-               (.startsWith s "_")
-               (.substring 1))))
+               (clojure.string/starts-with? s "_")
+               (subs 1))))

 (defn- parse-object [^JsonParser jp]
   (jparse/parse* jp identity nil nil))
@@ -96,7 +96,7 @@
   (and (vector? element)
        (= 2 (count element))
        (string? (first element))
-       (-> element first (.startsWith "~#"))))
+       (-> element first (clojure.string/starts-with? "~#"))))

 (defn- evaluate-f [element]
   (let [[function params] element]


Filter commands just on first word

Filter commands just on first word

--- src/bolt/core.cljs
+++ src/bolt/core.cljs
@@ -133,10 +133,12 @@
                   [:a {:href (:url %)} (:url %)])
          (sort-by :name
                   (filter
-                   #(or
-                     (> (.indexOf (:url %) (:user-input @app)) -1)
-                     (> (.indexOf (str (:alias %)) (:user-input @app)) -1)
-                     (> (.indexOf (:name %) (:user-input @app)) -1))
+                   #(let [first-word (or (re-find #"\S+" (:user-input @app))
+                                         (:user-input @app))]
+                      (or
+                       (> (.indexOf (:url %) first-word) -1)
+                       (> (.indexOf (str (:alias %)) first-word) -1)
+                       (> (.indexOf (:name %) first-word) -1)))
                    (:all-commands @app))))]])

 (rum/defc bolt-app < event-loop rum/reactive [app]


remove stupid hack, input issue disappears after clearing js/out

--- src/bolt/core.cljs
+++ src/bolt/core.cljs
@@ -43,8 +43,7 @@
              (apply dom/datalist #js {:id "commands"}
                     (map #(dom/option #js {:value (name %)})
                          (sort (keys (commands-index)))))
-             ;; without onChange, om 0.3.1 won't allow input
-             (dom/input #js {:id "search_term" :type "text" :autoFocus "autofocus" :list "commands" :onChange (constantly nil) })
+             (dom/input #js {:id "search_term" :type "text" :autoFocus "autofocus" :list "commands"})
              (dom/a #js {:className "btn btn-default mic" :href "#" :onClick (partial speech/toggle-speech "#search_term" "#search_submit") }
                          (dom/img #js {:id "mic" :src "img/mic.gif"}))
              (dom/input #js {:id "search_submit" :type "submit" :value "Search" :className "btn btn-default btn-lg"}))))


consistency

consistency

- Capitalize "Haskell"
- Use "Haskell-style"

--- src/cats/core.cljc
+++ src/cats/core.cljc
@@ -148,7 +148,7 @@
   a result wrapped in context of same type of av context.

   This function is variadic, so it can be used like
-  a haskell style left-associative fapply."
+  a Haskell-style left-associative fapply."
   [af & avs]
   {:pre [(not (empty? avs))]}
   (let [ctx (ctx/get-current af)]
@@ -425,11 +425,11 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (def <$>
-  "A haskell-style fmap alias."
+  "A Haskell-style fmap alias."
   fmap)

 (def <*>
-  "A haskell-style fapply alias."
+  "A Haskell-style fapply alias."
   fapply)

 (defn >>=


Example multi-response request

Example multi-response request

--- src/cbfg/fence.clj
+++ src/cbfg/fence.clj
@@ -6,6 +6,14 @@
   (go
    (<! (timeout delay))
    (+ x 2)))
+
+(defn range-to [s e delay]
+  (let [c (chan)]
+    (go
+     (doseq [n (range s e)]
+       (<! (timeout delay))
+       (>! c n))
+     (close! c))))

 ;; request format
 ;; {:rq function-to-call :fence true-or-false}
@@ -49,7 +57,9 @@
    {:rq #(add-two 10 6000) :fence true}
    {:rq #(add-two 9 1000)}
    {:rq #(add-two 9 1000)}
-   {:rq #(add-two 9 1000)}
+   {:rq #(range-to 0 5 500)}
+   {:rq #(range-to 6 10 1000) :fence true}
+   {:rq #(add-two 30 1000)}
    ])

 (defn test-rq-processor []


server/tracks-data becomes its own fn

server/tracks-data becomes its own fn

easier to experiment if we can see the data structure before sending it
to the json mincing machine

--- src/sledge/server.clj
+++ src/sledge/server.clj
@@ -62,7 +62,7 @@
    "ogg" {"href" "/bits/L3BhdGgvdG8vYXVkaW8uZmxhYw.ogg"},
    "flac" {"href" "/bits/L3BhdGgvdG8vYXVkaW8uZmxhYw.flac"}}))

-(defn tracks-json [req]
+(defn tracks-data [req]
   (let [p (:params req)
         fields [:artist :album :title :year :album-artist :track :genre
                 :encoding-type
@@ -76,12 +76,14 @@
                       fields)
         project (if-let [f (get p "_fields" ) ]
                   #(select-keys % (map keyword (str/split f #",")))
-                  #(assoc % "_links" (media-links %)))
-        tracks (distinct (map project
-                              (search/search search/index terms num-rows)))]
+                  #(assoc % "_links" (media-links %)))]
+    (distinct (map project
+                   (search/search search/index terms num-rows)))))
+
+(defn tracks-json-handler [req]
     {:status 200
      :headers {"Content-type" "text/json"}
-     :body (json/write-str tracks)}))
+     :body (json/write-str (tracks-data req))})

 (def scripts
@@ -187,7 +189,7 @@
 (defn routes [req]
   (let [u (:uri req)]
     (cond
-     (.startsWith u "/tracks.json") (tracks-json req)
+     (.startsWith u "/tracks.json") (tracks-json-handler req)
      (.startsWith u "/bits/") (bits-handler req)
      :else ((ringo front-page-view) req)
      )))


simplified, now rpy values are drawn inside the main display

--- src/sormilla/core.clj
+++ src/sormilla/core.clj
@@ -58,13 +58,13 @@
   (doseq [n (range 5 50 10)]
     (.drawRect g 5 n 23 5))
   (.setColor g norm)
-  (.setClip g (Rectangle. 0 0 (/ w 2) (- h th)))
+  (.setClip g (Rectangle. 0 0 (/ w 2) h))
   (with-trans g
-    (.translate g (double (/ w 4)) (double (/ (- h th) 2)))
+    (.translate g (double (/ w 4)) (double (/ h 2)))
     (.translate g
       (double (-> yaw math/clip-to-zero (math/lin-scale -0.6 +0.6 (/ w -4) (/ w 4))))
-      (double (-> pitch math/clip-to-zero (math/lin-scale -1.5 +1.5 (/ w 4) (/ w -4)))))
-    (.rotate g (- roll))
+      (double (-> pitch math/clip-to-zero (math/lin-scale -0.3 +0.3 (/ w 4) (/ w -4)))))
+    (.rotate g (- (-> roll math/clip-to-zero)))
     (.setColor g lo)
     (.fillOval g -150 -20 300 40)
     (.setColor g norm)
@@ -85,17 +85,16 @@
     (.setColor g hud-color)
     (.setFont g font)
     (.drawLine g (/ w 2 ) 0 (/ w 2) h)
-    (.drawLine g 0 (- h th) w (- h th))
     (.drawString g message (int (- (/ w 4) (/ tw 2))) (int (- h td)))
     (.drawString g message (int (- (* 3 (/ w 4)) (/ tw 2))) (int (- h td)))
     (.setColor g hud-lo-color)
     (doseq [x (map (fn [v] (int (* v (/ w 20.0)))) (range 20))]
-      (.drawLine g x 0 x (- h th)))
+      (.drawLine g x 0 x h))
     (doseq [x (map (fn [v] (int (* v (/ w 100.0)))) (range 100))]
-      (.drawLine g x (- (/ (- h th) 2) 5) x (+ (/ (- h th) 2) 5)))
-    (doseq [y (map (fn [v] (int (* v (/ (- h th) 10.0)))) (range 10))]
+      (.drawLine g x (- (/ h 2) 5) x (+ (/ h 2) 5)))
+    (doseq [y (map (fn [v] (int (* v (/ h 10.0)))) (range 10))]
       (.drawLine g 0 y w y))
-    (doseq [y (map (fn [v] (int (* v (/ (- h th) 50.0)))) (range 50))]
+    (doseq [y (map (fn [v] (int (* v (/ h 50.0)))) (range 50))]
       (.drawLine g (- (/ w 4) 5) y (+ (/ w 4) 5) y)
       (.drawLine g (- (* 3 (/ w 4)) 5) y (+ (* 3 (/ w 4)) 5) y))
     (when left-hand (draw-hand g w h tw th td left-hand (:left hand-colors)))


Add svg.axis helper.

Add svg.axis helper.

--- src/clj/c2/svg.clj
+++ src/clj/c2/svg.clj
@@ -1,12 +1,52 @@
 (ns c2.svg
   (:use [c2.maths :only [Pi Tau radians-per-degree
-                         sin cos]]))
-;;Lil' SVG helpers
-(defn translate [[x y]] (str "translate(" x "," y ")"))
-(defn scale [[x y]] (str "scale(" x "," y ")"))
+                         sin cos]]
+        [clojure.core.match :only [match]]))

-(def ArcMax (- (* 2 Pi) 0.0000001))
+;;Lil' SVG helpers
+(defn translate [coordinates]
+  (match [coordinates]
+         [[x y]] (str "translate(" x "," y ")")
+         [{:x x :y y}] (recur [x y])))
+
+(defn scale [coordinates]
+  (match [coordinates]
+         [[x y]] (str "scale(" x "," y ")")
+         [{:x x :y y}] (recur [x y])))
+
+
+(defn axis
+  "Returns axis <g> for input scale with ticks.
+Direction away from the data frame is defined to be positive; use negative margins and widths for the axis to render inside of the data frame"
+  [scale ticks & {:keys [orientation
+                         formatter
+                         major-tick-width
+                         text-margin]
+                  :or {orientation :left
+                       formatter str
+                       major-tick-width 6
+                       text-margin 9}}]
+
+  (let [[x y x1 x2 y1 y2] (case orientation
+                            (:left :right) [:x :y :x1 :x2 :y1 :y2]
+                            (:top :bottom) [:y :x :y1 :y2 :x1 :x2])
+
+        parity (case orientation
+                 (:left :top) -1
+                 (:right :bottom) 1)]
+
+    [:g.axis {:class (name orientation)}
+     [:line.rule (apply hash-map (interleave [y1 y2] (:range scale)))]
+
+     (map (fn [d]
+            [:g.major-tick {:transform (translate {x 0 y (scale d)})}
+             [:text {x (* parity text-margin)} (formatter d)]
+             [:line {x1 0 x2 (* parity major-tick-width)}]])
+          ticks)]))
+
+
+(def ArcMax (- Tau 0.0000001))

 (defn circle
   "Returns svg path data for a circle starting at 3 o'clock and sweeping in positive y."


Add tor

Add tor

--- src/cljs/browser_rotation/core.cljs
+++ src/cljs/browser_rotation/core.cljs
@@ -25,6 +25,7 @@
                      {:vivaldi "https://vivaldi.com/images/logo-only@2x.png" :selected? true}
                      {:netscape "http://www.ranklogos.com/wp-content/uploads/2012/04/Netscape-logo1.jpg" :selected? true}
                      {:lynx "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcTy9oS7vRhRVziK-mk-cYK4MU8yhJ4w0tnJ8US471Xb9JNy7V8k_A" :selected? true}
+                     {:tor "https://www.torproject.org/images/tor-logo.jpg" :selected? true}
                      ]))

 (defonce users (atom []))


Convert to CQP format on text change

Convert to CQP format on text change

--- src/cljs/cglossa/search_inputs.cljs
+++ src/cljs/cglossa/search_inputs.cljs
@@ -1,5 +1,22 @@
 (ns cglossa.search-inputs
   (:require [clojure.string :as str]))
+
+(defn- convert-to-cqp [value phonetic?]
+  (let [attr (if phonetic? "phon" "word")
+        chinese-chars-range "[\u4E00-\u9FFF\u3400-\u4DFF\uF900-\uFAFF]"
+        value (str/replace value (re-pattern (str "(" chinese-chars-range ")")) " $1 ")]
+    (->> (str/split value #"\s")
+         (map #(if (= % "")
+                ""
+                (str "[" attr "=\"" % "\" %c]")))
+         (str/join " "))))
+
+(defn- handle-text-changed [event search-query phonetic?]
+  (let [value (aget event "target" "value")
+        query (if (= value "")
+                ""
+                (convert-to-cqp value phonetic?))]
+    (swap! search-query assoc-in [:query] query)))

 (defn cwb-search-inputs [{:keys [search-query]}]
   (let [query (:query @search-query)
@@ -9,7 +26,7 @@
      [:form.form-inline.span12
       [:div.span10
        [:input.span12 {:type "text" :value displayed-query
-                       :on-change #(swap! search-query assoc-in [:query] (aget % "target" "value"))}]
+                       :on-change #(handle-text-changed % search-query phonetic?)}]
        [:label {:style {:marginTop 5}}]
        [:input {:name "phonetic" :type "checkbox"
                 :style {:marginTop -3} :checked phonetic?} " Phonetic form"]]]]))


Fix prince-princess interaction

Fix prince-princess interaction

--- src/cljs/love_letter_cljs/game.cljs
+++ src/cljs/love_letter_cljs/game.cljs
@@ -113,7 +113,7 @@

 (defn prince-ability [game target]
   (let [target-card (find-card game target)]
-    (if (= :princess target-card)
+    (if (= :princess (:face target-card))
       (kill-player game target)
       (-> game
           (discard-card [:players target :hand])


Slight readability improvement

Slight readability improvement

--- src/cljs/onyx_cheat_sheet/core.cljs
+++ src/cljs/onyx_cheat_sheet/core.cljs
@@ -193,7 +193,6 @@
                      (dom/b {} "Version: ")
                      deprecated-version)
               (dom/p {}
-                     (dom/b {} "Documentation: ")
                      (codify (get-in model [section :model k :deprecation-doc])))])))

 (defn keyword-sanitize-? [k]


check for issuer verified evidence

check for issuer verified evidence

--- src/cljs/salava/badge/ui/modal.cljs
+++ src/cljs/salava/badge/ui/modal.cljs
@@ -231,14 +231,17 @@
           [:h2.uppercase-header (if (= (count evidences) 1)  (t :badge/Evidence) (str (t :badge/Evidence) " (" (count evidences) ")") ) ]
           (reduce (fn [r evidence]
                     (let [{:keys [narrative description name evidence_type id url mtime ctime properties]} evidence
+                          added-by-user? (and (not (blank? description)) (starts-with? description "Added by badge recipient"))
                           desc (cond
                                  (not (blank? narrative)) narrative
-                                 (and (not (blank? description)) (not (starts-with? description "Evidence added by badge owner from"))) description
+                                 (not added-by-user?) description ;;todo use regex to match description
                                  :else nil
                                  )]
                       (conj r
                             [:div.modal-evidence
-                             (if (empty? properties) [:span.label.label-success (t :user/verified)])
+                             ;(if (empty? properties) )
+
+                             (when-not added-by-user? [:span.label.label-success (t :badge/Verifiedevidence)])
                              [evidence-icon evidence_type]
                              [:div.content


added import

added import

--- src/clojure/sparkling/sql/types.clj
+++ src/clojure/sparkling/sql/types.clj
@@ -3,7 +3,8 @@
   1. turn rdd into rows using create row
   2. create struct type passing in representation of the schema
   3. pass rdd of rows and struct type to sparkling.sql/data-frame"
-  (:import [org.apache.spark.sql.types DataTypes]))
+  (:import [org.apache.spark.sql.types DataTypes]
+           [org.apache.spark.sql RowFactory]))

 ;The list of types supported by spark


implemented the list-monad in clojure

implemented the list-monad in clojure

--- src/clojure_learning/list_monad.clj
+++ src/clojure_learning/list_monad.clj
@@ -1,10 +1,28 @@
 (ns clojure-learning.list-monad
   (use (clojure repl test)))

-(defn return [v] (list v))
+(defn return [v]
+  (fn [] (flatten (list v))))
+
 (defn bind [mv func]
-
-  )
+  (func (mv)))

-(defn push [xs x] (conj xs x))
-(defn lift-push [mv x])
+(defn lift-push [mv x]
+  (bind mv (fn [xs] (return (cons x xs)))))
+
+(defn lift-pop [mv]
+  (bind mv (fn [xs] (return (butlast xs)))))
+
+(defn lift-search [mv subject]
+  (bind mv (fn [xs] (return (some #{subject} xs)))))
+
+;; in action:
+((-> (return 4)
+     (lift-push 5)
+     (lift-push 6)
+     (lift-push 7)
+     lift-pop
+     (lift-search 6)
+     ))
+
+(mapcat #(conj % 24) [[1] [2]]) ;; ( 1 24 2 24)


Remove unused IOnStep protocol.

Remove unused IOnStep protocol.

--- src/suricatta/dsl.clj
+++ src/suricatta/dsl.clj
@@ -57,9 +57,6 @@

 (defprotocol IFieldCoerce
   (as-field* [_ params] "Field alias constructor"))
-
-(defprotocol IOnStep
-  (on [_ conditions]))

 (defprotocol ICondition
   (condition* [_] "Condition constructor"))


tests: make test run correctly when using maven

--- src/test/clojure/clojure/tools/reader_test.clj
+++ src/test/clojure/clojure/tools/reader_test.clj
@@ -48,7 +48,8 @@
 (deftest read-keyword
   (is (= :foo-bar (read-string ":foo-bar")))
   (is (= :foo/bar (read-string ":foo/bar")))
-  (is (= :user/foo-bar (read-string "::foo-bar")))
+  (is (= :user/foo-bar (binding [*ns* (the-ns 'user)]
+                         (read-string "::foo-bar"))))
   (is (= :clojure.core/foo-bar
          (do (alias 'core 'clojure.core)
              (read-string "::core/foo-bar")))))
@@ -111,7 +112,8 @@
   (is (= ''foo (read-string "'foo"))))

 (deftest read-syntax-quote
-  (is (= '`user/foo (read-string "`foo")))
+  (is (= '`user/foo (binding [*ns* (the-ns 'user)]
+                      (read-string "`foo"))))
   (is (= '`+ (read-string "`+")))
   (is (= '`foo/bar (read-string "`foo/bar")))
   (is (= '`1 (read-string "`1")))


117 (neigbors)

117 (neigbors)

--- stuf/src/sandbox/4clojure.clj
+++ stuf/src/sandbox/4clojure.clj
@@ -814,3 +814,9 @@
 ;;             a (first (filter p (drop (+ n 1) (range))))]
 ;;         (and (p n) (= n (/ (+ a b) 2))))))

+;;117
+(defn neighbors [size yx]
+  (filter (fn [new-yx]
+            (every? #(< -1 % size) new-yx))
+          (map #(vec (map + yx %))
+               [[-1 0] [0 -1] [0 1] [1 0]])))


draw map layers in their correct order when using :with or :without options.

--- src/play_clj/core_graphics.clj
+++ src/play_clj/core_graphics.clj
@@ -526,6 +526,7 @@
                                               (set layer-names))
              (u/throw-key-not-found k))
            (map #(.indexOf ^java.util.List all-layer-names %))
+           (sort)
            int-array
            (.render renderer)))
     (.render renderer))


Fix cat*->from* alias (was cat*->from)

Fix cat*->from* alias (was cat*->from)

--- src/uio/main/main.clj
+++ src/uio/main/main.clj
@@ -82,7 +82,7 @@

 (defn op-or-alias->op [op]
   (or ({"cat"  "from"
-        "cat*" "from"
+        "cat*" "from*"
         "rm"   "delete"
         "cp"   "copy"} op)
       op))


only fdef defresolver in clj

only fdef defresolver in clj

--- src/com/wsscode/pathom/connect.cljc
+++ src/com/wsscode/pathom/connect.cljc
@@ -1699,9 +1699,10 @@
             (fn ~name ~arglist'
               ~@body))))))

-(s/fdef defresolver
-  :args ::defresolver-args
-  :ret any?)
+#?(:clj
+   (s/fdef defresolver
+     :args ::defresolver-args
+     :ret any?))

 ; endregion


Some clean up. Don't need various ways of evaluating. Also minor fix, should be "< num 2" not "< num 1".

--- clojure-functional/src/test/clojure/no/knowit/clojure_functional/euler_two.clj
+++ clojure-functional/src/test/clojure/no/knowit/clojure_functional/euler_two.clj
@@ -15,8 +15,8 @@

 (defn fib-tail [num]
   (loop [num num, b 1N a 0N]
-    (if (< num 1) a
-      (recur (- num 1) (+ a b) b))))
+    (if (< num 2) a
+      (recur (dec num) (+ a b) b))))

 (defn fib-lazy []
   ((fn f [a b]
@@ -34,26 +34,15 @@
 (defn contents-less-than [limit coll]
   (take-while #(> limit %) coll))

-
-(defn in-side-out [limit f]
+(defn euler-two [limit f]
   (apply +
     (contents-less-than limit
       (even-nums (f)))))

-
-(defn composed [limit f]
-  ((comp #(apply + %)
-     #(contents-less-than limit %) even-nums f)))
-
-
-(defn arrowed [limit f]
-  (->> (f) even-nums (contents-less-than limit) (apply +)))
-
-
 (deftest euler-two-fibonacci-sum
-  (is (= (in-side-out 40 #(fib-range fib)) 44))
-  (is (= (in-side-out 4000000 #(fib-range fib-mem)) 4613732))
-  (is (= (in-side-out 4000000 #(fib-range fib-tail)) 4613732))
-  (is (= (in-side-out 4000000 fib-lazy) 4613732)))
+  (is (= (euler-two 40 #(fib-range fib)) 44))
+  (is (= (euler-two 4000000 #(fib-range fib-mem)) 4613732))
+  (is (= (euler-two 4000000 #(fib-range fib-tail)) 4613732))
+  (is (= (euler-two 4000000 fib-lazy) 4613732)))

 (run-tests)


some german fixes

some german fixes

--- src/status_im/translations/de.cljs
+++ src/status_im/translations/de.cljs
@@ -79,19 +79,19 @@
    :image-source-cancel                   "Abbrechen"

    ;sign-up
-   :contacts-syncronized                  "Ihre Kontakte wurden synchronisiert"
-   :confirmation-code                     (str "Danke! Wir haben Ihnen eine Textnachricht mit einer Bestätigungscode"
-                                               "geschickt. Bitte geben Sie den Code ein, damit wir Ihre Telefonnummer verifizieren können")
+   :contacts-syncronized                  "Ihre Kontakte wurden synchronisiert."
+   :confirmation-code                     (str "Danke! Wir haben Ihnen eine Textnachricht mit einem Bestätigungscode "
+                                               "geschickt. Bitte geben Sie den Code ein, damit wir Ihre Telefonnummer verifizieren können.")
    :incorrect-code                        (str "Tut uns leid, der Code war nicht korrekt, bitte erneut eingeben")
    :generate-passphrase                   (str "Ich werde eine Passphrase für Sie generieren, damit Sie Ihren"
                                                "Zugriff wiederherstellen oder sich von einem anderen Gerät aus einloggen können")
-   :phew-here-is-your-passphrase          "*Puh* das war schwer, hier ist Ihr Passphrase, *bitte aufschreiben und sicher aufbewahren!*Sie benötigen dies, um Ihren Account wiederherzustellen."
+   :phew-here-is-your-passphrase          "*Puh* das war schwer, hier ist Ihr Passphrase, *bitte aufschreiben und sicher aufbewahren! *Sie benötigen dies, um Ihren Account wiederherzustellen."
    :here-is-your-passphrase               "Hier ist Ihr Passphrase, *bitte aufschreiben und sicher verwahren!*Sie benötigen dies, um Ihren Account wiederherzustellen."
    :written-down                          "Stellen Sie sicher, dass Sie es sicher aufgeschrieben haben"
    :phone-number-required                 "Tippen Sie hier, um Ihre Telefonnummer einzugeben & ich werde Ihre Freunde finden"
    :intro-status                          "Chatten Sie mit mir, um Ihren Account einzurichten und Ihre Einstellungen zu ändern!"
-   :intro-message1                        "Willkommen beim Status\nTippen Sie auf diese nachricht, um Ihr Passwort einzurichten und loszulegen!"
-   :account-generation-message            "Eine Sekunde, ich muss wahnsinnig schwere Mathematik machen, um Ihr Konto zu generieren!"
+   :intro-message1                        "Willkommen beim Status.\nTippen Sie auf diese Nachricht, um Ihr Passwort einzurichten und loszulegen!"
+   :account-generation-message            "Eine Sekunde, ich muss wahnsinnig schwierige Berechnungen durchführen, um Ihr Konto zu generieren!"

    ;chats
    :chats                                 "Chats"


Using environ to retrieve environment settings for http port

--- src/wareblog/core.clj
+++ src/wareblog/core.clj
@@ -3,7 +3,8 @@
            [liberator.core :refer [resource defresource]]
            [ring.middleware.params :refer [wrap-params]]
            [bidi.ring :refer [make-handler]]
-           [org.httpkit.server :as server])
+           [org.httpkit.server :as server]
+           [environ.core :refer [env]])
   (:gen-class))

 (defn -main
@@ -14,7 +15,14 @@
 ;(defresource article
 ;  :available-media-types ["text/html"]
 ;  :allowed-methods [:get :options]
-;  :handle-ok (fn [ctx] (str "Id of the request: " (get-in ctx [:request :route-params :id]))))
+                                        ;  :handle-ok (fn [ctx] (str "Id of the request: " (get-in ctx [:request :route-params :id]))))
+
+(def default-http-port
+  3000)
+
+(def http-port
+  (let [ext-http-port (env :wareblog-http-port)]
+    (if (nil? ext-http-port) default-http-port (Integer/valueOf ext-http-port))))

 (defresource article
   :available-media-types ["application/edn" "text/html"]
@@ -45,7 +53,7 @@
 (defonce server (atom nil))

 (defn start-server []
-  (reset! server (server/run-server #'wrap-handler {:port 3000 :join? false})))
+  (reset! server (server/run-server #'wrap-handler {:port http-port :join? false})))

 (defn stop-server []
   (when-not (nil? server)


adding state to app-state

adding state to app-state

--- src/saved_for_reddit/core.cljs
+++ src/saved_for_reddit/core.cljs
@@ -29,7 +29,8 @@
 ;; save app data in local-storage so that it doesn't get over-written on page reload
 (def app-state (local-storage (r/atom {:username ""
                                        :token ""
-                                       :after nil})
+                                       :after nil
+                                       :state ""})
                               :saved-for-reddit-app-state))

 (def saved-posts (r/atom []))
@@ -93,7 +94,8 @@
     (if (nil? error)
       ;; reddit auth request didnt give an error back
       (do
-        (if (and (nil? code) (clojure.string/blank? (:token @app-state))) ;; code query param is not present or the token is blank in HTML5 localStorage
+        (if (and (nil? code) (clojure.string/blank? (:token @app-state)))
+          ;; code query param is not present or the token is blank in HTML5 localStorage
           ;; redirect to reddit for requesting authorization
           (set! (.-location js/window) (gen-reddit-auth-url client-id redirect-uri "abcdef"))
           ;; code query param is not nil or token is populated in app state
@@ -118,7 +120,6 @@
               ;; all reddit auth and setup is already in app-state
               ;;  retreive all saved posts
               (get-all-saved-posts (:token @app-state) (:username @app-state) saved-posts))))
-
         ;; render html doms
         (r/render-component [loggedin-html (:username @app-state)] (dommy/sel1 :#loggedin))
         (r/render-component [search-bar-html] (dommy/sel1 :#search-form))


fix `quit` fn for remote driver (#314)

fix `quit` fn for remote driver (#314)

--- src/etaoin/api.clj
+++ src/etaoin/api.clj
@@ -3143,10 +3143,12 @@
 (defn quit
   "Closes the current session and stops the driver."
   [driver]
-  (try
-    (disconnect-driver driver)
-    (finally
-      (stop-driver driver))))
+  (let [process (:process @driver)]
+    (try
+      (disconnect-driver driver)
+      (finally
+        (when process
+          (stop-driver driver))))))

 (def firefox
   "Launches Firefox driver. A shortcut for `boot-driver`."


wicked fast

wicked fast

--- benchmark/cljs/benchmark_runner.cljs
+++ benchmark/cljs/benchmark_runner.cljs
@@ -38,6 +38,13 @@
 (simple-benchmark [coll "foobar"] (first coll) 1000000)
 (simple-benchmark [coll (array 1 2 3)] (nth coll 2) 1000000)
 (simple-benchmark [coll "foobar"] (nth coll 2) 1000000)
+(println)
+
+(defprotocol IFoo (foo [x]))
+
+(println ";;; cloning & specify")
+(simple-benchmark [coll [1 2 3]] (clone coll) 1000000)
+(simple-benchmark [coll [1 2 3]] (specify coll IFoo (foo [_] :bar)) 1000000)
 (println)

 (println ";;; list ops")


optimize resolve-var

optimize resolve-var

--- src/main/clojure/cljs/analyzer.cljc
+++ src/main/clojure/cljs/analyzer.cljc
@@ -612,63 +612,70 @@
    warnings about unresolved vars."
   ([env sym] (resolve-var env sym nil))
   ([env sym confirm]
-     (if (= (namespace sym) "js")
+     (if #?(:clj  (= "js" (namespace sym))
+            :cljs (identical? "js" (namespace sym)))
        {:name sym :ns 'js}
-       (let [s (str sym)
-             lb (-> env :locals sym)]
+       (let [s    (str sym)
+             lcls (:locals env)
+             lb   (get lcls sym)]
          (cond
-           lb lb
-
-           (namespace sym)
-           (let [ns (namespace sym)
-                 ns (if (= "clojure.core" ns) "cljs.core" ns)
+           (not (nil? lb)) lb
+
+           (not (nil? (namespace sym)))
+           (let [ns      (namespace sym)
+                 ns      (if #?(:clj  (= "clojure.core" ns)
+                                :cljs (identical? "clojure.core" ns))
+                           "cljs.core"
+                           ns)
                  full-ns (resolve-ns-alias env ns)]
-             (when confirm
+             (when-not (nil? confirm)
                (when (not= (-> env :ns :name) full-ns)
                  (confirm-ns env full-ns))
                (confirm env full-ns (symbol (name sym))))
              (merge (gets @env/*compiler* ::namespaces full-ns :defs (symbol (name sym)))
-                    {:name (symbol (str full-ns) (str (name sym)))
-                     :ns full-ns}))
+               {:name (symbol (str full-ns) (str (name sym)))
+                :ns full-ns}))

            #?(:clj  (and (.contains s ".")
                          (not (.contains s "..")))
-              :cljs (and (goog.string/contains s ".")
-                         (not (goog.string/contains s ".."))))
-           (let [idx (.indexOf s ".")
+              :cljs (and ^boolean (goog.string/contains s ".")
+                         (not ^boolean (goog.string/contains s ".."))))
+           (let [idx    (.indexOf s ".")
                  prefix (symbol (subs s 0 idx))
                  suffix (subs s (inc idx))
-                 lb (-> env :locals prefix)]
-             (if lb
+                 lb     (get lcls prefix)]
+             (if-not (nil? lb)
                {:name (symbol (str (:name lb)) suffix)}
-               (let [cur-ns (-> env :ns :name)]
-                 (if-let [full-ns (gets @env/*compiler* ::namespaces cur-ns :imports prefix)]
+               (let [cur-ns  (-> env :ns :name)
+                     full-ns (gets @env/*compiler* ::namespaces cur-ns :imports prefix)]
+                 (if-not (nil? full-ns)
                    {:name (symbol (str full-ns) suffix)}
-                   (if-let [info (gets @env/*compiler* ::namespaces cur-ns :defs prefix)]
-                     (merge info
-                       {:name (symbol (str cur-ns) (str sym))
-                        :ns cur-ns})
-                     (merge (gets @env/*compiler* ::namespaces prefix :defs (symbol suffix))
-                       {:name (if (= "" prefix) (symbol suffix) (symbol (str prefix) suffix))
-                        :ns prefix}))))))
-
-           (gets @env/*compiler* ::namespaces (-> env :ns :name) :uses sym)
+                   (let [info (gets @env/*compiler* ::namespaces cur-ns :defs prefix)]
+                     (if-not (nil? info)
+                       (merge info
+                         {:name (symbol (str cur-ns) (str sym))
+                          :ns cur-ns})
+                       (merge (gets @env/*compiler* ::namespaces prefix :defs (symbol suffix))
+                         {:name (if (= "" prefix) (symbol suffix) (symbol (str prefix) suffix))
+                          :ns prefix})))))))
+
+           (not (nil? (gets @env/*compiler* ::namespaces (-> env :ns :name) :uses sym)))
            (let [full-ns (gets @env/*compiler* ::namespaces (-> env :ns :name) :uses sym)]
              (merge
-              (gets @env/*compiler* ::namespaces full-ns :defs sym)
-              {:name (symbol (str full-ns) (str sym))
-               :ns (-> env :ns :name)}))
-
-           (gets @env/*compiler* ::namespaces (-> env :ns :name) :imports sym)
+               (gets @env/*compiler* ::namespaces full-ns :defs sym)
+               {:name (symbol (str full-ns) (str sym))
+                :ns (-> env :ns :name)}))
+
+           (not (nil? (gets @env/*compiler* ::namespaces (-> env :ns :name) :imports sym)))
            (recur env (gets @env/*compiler* ::namespaces (-> env :ns :name) :imports sym) confirm)

            :else
            (let [cur-ns (-> env :ns :name)
                  full-ns (cond
-                           (gets @env/*compiler* ::namespaces cur-ns :defs sym) cur-ns
+                           (not (nil? (gets @env/*compiler* ::namespaces cur-ns :defs sym))) cur-ns
                            (core-name? env sym) 'cljs.core
                            :else cur-ns)]
-             (when confirm
+             (when-not (nil? confirm)
                (confirm env full-ns sym))
              (merge (gets @env/*compiler* ::namespaces full-ns :defs sym)
                {:name (symbol (str full-ns) (str sym))


more tweaks / fixes

more tweaks / fixes

--- src/main/clojure/cljs/compiler.cljc
+++ src/main/clojure/cljs/compiler.cljc
@@ -476,7 +476,7 @@
     (emitln "throw " throw ";")))

 (def base-types
-  #{"null" "*"
+  #{"null" "*" "...*"
     "boolean" "Boolean"
     "string" "String"
     "number" "Number"
@@ -509,26 +509,15 @@
           t         (if optional?
                       (subs t 0 (dec (count t)))
                       t)
-          ret       (str (:name (ana/resolve-var env (symbol t))))]
+          ret       (munge (str (:name (ana/resolve-var env (symbol t)))))]
       (if optional?
         (str ret "=")
         ret))))

-(defn type-munge [s]
-  (cond
-    (= "null" s) s
-    (= "*" s) s
-    :else (munge s)))
-
 (defn resolve-types [env ts]
   (let [ts (-> ts string/trim (subs 1 (dec (count ts))))
         xs (string/split ts #"\|")]
-    (str
-      "{"
-      (->> (map #(resolve-type env %) xs)
-        (map type-munge)
-        (string/join "|"))
-      "}")))
+    (str "{" (string/join "|" (map #(resolve-type env %) xs)) "}")))

 (defn munge-param-return [env line]
   (cond


Задание стиля для иконок от бутстрапа

Задание стиля для иконок от бутстрапа

--- radiolamp-6P3S/src/r6p3s/ui/glyphicon.cljs
+++ radiolamp-6P3S/src/r6p3s/ui/glyphicon.cljs
@@ -1,8 +1,10 @@
 (ns r6p3s.ui.glyphicon
   (:require [om.dom :as dom :include-macros true]))

-(defn render [name & [class+ size]]
+(defn render [name & [class+ size style]]
   (dom/span #js {:className   (str "glyphicon glyphicon-"
                                    name " " (or class+ ""))
-                 :style       #js {:fontSize size}
+                 :style       (if size
+                                #js {:fontSize size}
+                                style)
                  :aria-hidden "true"}))


Big problems with expansion? Tests highlight inconsistent behavior

--- test/forma/trends/stretch_test.clj
+++ test/forma/trends/stretch_test.clj
@@ -21,11 +21,71 @@
     (ts-expander "32" "16" ts) => output))

 (fact
-  "Expanding a year-long monthly timeseries (12 periods) should yield a year's worth of 16-day periods (23)."
-  (let [periods-32 12 ;; number of periods, 32-day res
-        periods-16 23 ;; expected number of periods, 16-day res
+
+  (let [periods-32 12
+        periods-16 23
         ts (schema/timeseries-value 360 (take periods-32 data/ndvi))]
     (count (:series (ts-expander "32" "16" ts))) => periods-16))
+
+
+;; Sam, this is commented out because all the error messages were
+;; getting annoying
+
+(tabular
+ (fact
+   (let [series (concat (repeat 12 1) (repeat ?extra-32 2))
+         ts (schema/timeseries-value 360 series)
+         expanded-ts (:series (ts-expander "32" "8" ts))
+         expected-ts (map float (concat (repeat 45 1) (repeat ?extra-8 2)))]
+     expanded-ts => expected-ts))
+ ?extra-32 ?extra-8
+ 0          0
+ 1          3
+ 2          7
+ 3          11
+ 12         45)
+
+(tabular
+ (fact
+   "Expanding a year-long monthly timeseries (12 periods) should yield a year's worth of 16-day periods (23). Here we simplify by using the same value for all periods, so `?periods-target-res` is just the number of periods we should see, ignoring the value for those periods.
+
+The correct number of periods for 16- and 8-day timeseries is given by the number of directories in ftp://e4ftl01p.cr.usgs.gov/MOLT/MOD13A1.005 for the range of interest.
+
+Period 360 is 2000-01-01 at monthly resolution
+Period 736 is 2000-01-01 at 16-day resolution
+
+The problem at present: The output timeseries seems to be too short by 1-2 periods. So even if we have monthly data for December (starting on 12/1/2011), the output will only run through 11/16/2011 because the 16-day periods are bounded by 12/1/2011 rather than 12/31/2011."
+
+   (let [series (repeat ?periods-base-res 1)
+         ts (schema/timeseries-value ?start-idx series)
+         expected-count (count (:series (ts-expander ?base-res ?target-res ts)))
+         ]
+     expected-count => ?periods-target-res))
+ ?base-res ?target-res ?periods-base-res ?periods-target-res ?start-idx
+ "32"          "16"            1                1               360
+ "32"          "16"            2                3               360
+ "32"          "16"            3                5               360
+ "32"          "16"            9                17              360
+ "32"          "16"            10               19              360
+ "32"          "16"            11               20              360
+ "32"          "16"            12               23              360
+ "32"          "16"            13               24              360
+ "32"          "16"            14               26              360
+ "32"          "16"            24               46              360
+ "32"          "16"            25               47              360
+
+ "32"          "8"             1                3               360
+ "32"          "8"             2                7               360
+ "32"          "8"             3                11              360
+ "32"          "8"             12               45              360
+
+ "16"          "8"             1                2               736
+ "16"          "8"             2                4               736
+ "16"          "8"             3                6               736
+ "16"          "8"             23               45              736)
+
+
+

 (tabular
  (fact
@@ -35,13 +95,16 @@

 We'll add a few additional values to make sure extending beyond January works.

+Expected outcome for adding twos to the end of the timeseries in a new year:
+
 0 0 => all ones through end of December
 1 1 => all ones then twos through first period of January
 2 3 => all ones then twos through mid-February
 3 5 => all ones then twos through mid-Marchoutput through mid-March
 12 23 => all ones then twos through end of second December

-The problem at present: The output timeseries seems to be too short by 1-2 periods. So even if we have monthly data for December (starting on 12/1/2011), the output will only run through 11/16/2011 because the 16-day periods are bounded by 12/1/2011 rather than 12/31/2011.
+This highlights that the expansion works for 32- to 16-day resolution except at the end of the year.
+
 "
    (let [series (concat (repeat 12 1) (repeat ?extra-32 2))
          ts (schema/timeseries-value 360 series)
@@ -55,4 +118,3 @@
  3          5
  12         23)

-


fix(ccw.core-launch): Add check on message log "Started nREPL...." execution.

The form for logging "Started ccw nREPL server..." needed a guard against multiple executions that
now has been added (it was printed multiple times, for example when a project Repl was created).
Now only when the start-server-map-delay is not realized we will print the log.

--- ccw.core/src/clj/ccw/core/launch.clj
+++ ccw.core/src/clj/ccw/core/launch.clj
@@ -20,9 +20,9 @@
   "Atom containing a Map of listener name -> listener fn.
    Listener fns will be called when interesting events occur wrt nrepl servers
    managed by Counterclockwise, like that: (a-listener-fn event-map).
-   Events currently handled: :creation, with keys :event-type :creation,
+   Events currently handled: :creation, with keys :event-type :creation,
                              :port (Number, required) and :project (String, optional)" }
-  nrepl-servers-listeners
+  nrepl-servers-listeners
   (atom {:ccw/default #'default-nrepl-server-listener}))

@@ -76,8 +76,10 @@
     (when (= 0 nrepl-port)
       (CCWPlugin/log (str "nRepl port will be automatically selected")))
     (let [start-server-delay (swap! nrepl-server-map-delay fill-nrepl-start-delay nrepl-port)
+          was-realized (realized? start-server-delay)
           server-map (force start-server-delay)]
-      (CCWPlugin/log (str "Started ccw nREPL server: nrepl://127.0.0.1:" (:port server-map))))))
+      (if-not was-realized
+        (CCWPlugin/log (str "Started ccw nREPL server: nrepl://127.0.0.1:" (:port server-map)))))))

 (defn ccw-nrepl-stop
   "Stops the instance of the running nRepl on the underlying atom. Always returns nil."


Add UserVisibility schema and attach it to the entry schema.

--- src/oc/storage/resources/common.clj
+++ src/oc/storage/resources/common.clj
@@ -96,6 +96,11 @@

 (def Status (schema/pred #(#{:draft :published} (keyword %))))

+(def UserVisibility
+  "A user-visibility item."
+  {(schema/optional-key :dismiss-at) lib-schema/ISO8601
+   (schema/optional-key :follow) schema/Bool})
+
 (def FollowUp
   "A follow-up item."
   {
@@ -146,7 +151,9 @@
   :updated-at lib-schema/ISO8601

   ;; FollowUps
-  (schema/optional-key :follow-ups) [FollowUp]})
+  (schema/optional-key :follow-ups) [FollowUp]
+  (schema/optional-key :user-visibility) (schema/maybe {schema/Keyword UserVisibility})
+})

 (def NewBoard
   "A new board for creation, can have new or existing entries already."


Remove duplicated test

Remove duplicated test

--- test/buddy/hashers_tests.clj
+++ test/buddy/hashers_tests.clj
@@ -19,21 +19,6 @@
             [buddy.core.bytes :as bytes]
             [buddy.core.codecs :as codecs]
             [buddy.hashers :as hashers]))
-
-(deftest buddy-hashers
-  (let [pwd "my-test-password"]
-    (are [alg]
-        (let [result (hashers/encrypt pwd {:alg alg})]
-          (hashers/check pwd result))
-      :pbkdf2+sha1
-      :pbkdf2+sha256
-      :pbkdf2+sha512
-      :pbkdf2+sha3_256
-      :pbkdf2+blake2b-512
-      :bcrypt+sha512
-      :bcrypt+sha384
-      :bcrypt+blake2b-512
-      :scrypt)))

 (deftest buddy-hashers
   (let [pwd "my-test-password"]


assert that boards aren't identical on different initializations

--- test/cartagena/core_test.clj
+++ test/cartagena/core_test.clj
@@ -3,7 +3,10 @@
             [cartagena.core :refer :all]))

 (deftest initialize-board-test
-  (let [board (initialize-board)]
-    (is (= 36 (count board)))
-    (doseq [icon [:bottle :gun :hat :key :knife :skull]]
-      (is (= 6 (count (filter #(= icon %) board)))))))
+  (testing "Returns the right number of spaces as well as icons"
+    (let [board (initialize-board)]
+      (is (= 36 (count board)))
+      (doseq [icon [:bottle :gun :hat :key :knife :skull]]
+        (is (= 6 (count (filter #(= icon %) board)))))))
+  (testing "Boards are not exactly alike"
+    (is (not (= (initialize-board) (initialize-board))))))


bind-inputs! validates lifecycles exist for input

--- resources/leiningen/new/onyx_app/utils.clj
+++ resources/leiningen/new/onyx_app/utils.clj
@@ -83,6 +83,10 @@
         (throw (ex-info "Input channel capacity is smaller than bound inputs. Capacity can be adjusted in utils.clj"
                         {:channel-size input-channel-capacity
                          :n-segments n-segments})))
+      (when-not ((set (map :lifecycle/task lifecycles)) task)
+        (throw (ex-info (str "Cannot bind input for task " task " as lifecycles are missing. Check that inputs are being bound to the correct task name.")
+                        {:input task
+                         :lifecycles lifecycles})))
       (doseq [segment segments]
         (>!! in-ch segment))
       (>!! in-ch :done))))


Add an update-task fn that allows a single catalog entry to be updated

--- resources/leiningen/new/onyx_app/utils.clj
+++ resources/leiningen/new/onyx_app/utils.clj
@@ -18,12 +18,25 @@
     result
     (assert false)))

-(defn find-task [catalog task-name]
+(defn find-task
+  "Finds the catalog entry where the :onyx/name key equals task-name"
+  [catalog task-name]
   (let [matches (filter #(= task-name (:onyx/name %)) catalog)]
     (when-not (seq matches)
       (throw (ex-info (format "Couldn't find task %s in catalog" task-name)
                       {:catalog catalog :task-name task-name})))
     (first matches)))
+
+(defn update-task
+  "Finds the catalog entry with :onyx/name task-name
+  and applies f to it, returning the full catalog with the
+  transformed catalog entry"
+  [catalog task-name f]
+  (mapv (fn [entry]
+          (if (= task-name (:onyx/name entry))
+            (f entry)
+            entry))
+        catalog))

 (defn n-peers
   "Takes a workflow and catalog, returns the minimum number of peers


cyanite: make intent slightly clearer

cyanite: make intent slightly clearer

--- src/io/cyanite.clj
+++ src/io/cyanite.clj
@@ -100,9 +100,8 @@

       (sig/with-handler :hup
         (info "caught SIGHUP, reloading")
-        (swap! system #(-> %
-                           component/stop-system
-                           component/start-system)))
+        (swap! system (comp component/start-system
+                            component/stop-sytsem)))

       (info "ready to start the system")
       (swap! system component/start-system)))


forall/lambda style indent

forall/lambda style indent

--- src/latte/core.clj
+++ src/latte/core.clj
@@ -495,4 +495,11 @@
 ;; ## Basic forms
 ;;}

-
+(defn forall [params body]
+  {:style/indent [1 :form :form]}
+  (list 'forall params body))
+
+(defn lambda [params body]
+  {:style/indent [1 :form :form]}
+  (list 'lambda params body))
+


[#6957] Wallet shouldn't allows redirect to Home after a transaction completion

Signed-off-by: Andrey Shovkoplyas <b713972e59b8e606e23253c4a13e948139fea4d1@gmail.com>

--- src/status_im/ui/screens/views.cljs
+++ src/status_im/ui/screens/views.cljs
@@ -243,16 +243,43 @@
            :unsigned-transactions        wallet-transactions/transactions
            :transactions-history         wallet-transactions/transactions
            :wallet-transaction-details   wallet-transactions/transaction-details
-           :login                        login})
+           :login                        login
+           :wallet-settings-hook         wallet-settings/settings-hook})
          {:headerMode       "none"
           :initialRouteName "wallet"})}
+
+       :wallet-send-modal-stack
+       {:screen
+        (nav-reagent/stack-navigator (stack-screens {:wallet-send-transaction-modal
+                                                     [:modal send-transaction-modal]
+
+                                                     :wallet-transaction-sent
+                                                     [:modal transaction-sent-modal]
+
+                                                     :wallet-transaction-fee
+                                                     [:modal wallet.transaction-fee/transaction-fee]})
+                                     {:headerMode       "none"
+                                      :initialRouteName "wallet-send-transaction-modal"})}
+
+       :wallet-send-modal-stack-with-onboarding
+       {:screen
+        (nav-reagent/stack-navigator (stack-screens {:wallet-onboarding-setup-modal
+                                                     [:modal wallet.onboarding/modal]
+
+                                                     :wallet-send-transaction-modal
+                                                     [:modal send-transaction-modal]
+
+                                                     :wallet-transaction-sent
+                                                     [:modal transaction-sent-modal]
+
+                                                     :wallet-transaction-fee
+                                                     [:modal wallet.transaction-fee/transaction-fee]})
+                                     {:headerMode       "none"
+                                      :initialRouteName "wallet-send-modal-stack-with-onboarding"})}
+
        :wallet-settings-assets
        {:screen (nav-reagent/stack-screen
                  (wrap-modal :wallet-settings-assets wallet-settings/manage-assets))}
-
-       :wallet-settings-hook
-       {:screen (nav-reagent/stack-screen
-                 (wrap-modal :wallet-settings-assets wallet-settings/settings-hook))}

        :wallet-transaction-fee
        {:screen (nav-reagent/stack-screen


make config function configurable

make config function configurable

--- src/tesla/component/configuring.clj
+++ src/tesla/component/configuring.clj
@@ -13,16 +13,16 @@
    (get-in (:config config) key-path default)))

-(defn load-config []
+(defn load-config [self]
   (config/init (str (environ/env :system) "-" (environ/env :env))))

 ;; Load config on startup.
-(defrecord Configuring [runtime-config]
+(defrecord Configuring [runtime-config load-config-fn]
   component/Lifecycle
   (start [self]
     (log/info "-> loading configuration.")
-    (log/info runtime-config)
-    (assoc self :config (merge (load-config) runtime-config)
+    (log/info runtime-config load-config-fn)
+    (assoc self :config (merge (load-config-fn self) runtime-config)
                 :version {:version "test.version"
                           :commit  "test.githash"}))        ;; TODO: Alter versions!

@@ -30,8 +30,7 @@
     (log/info "<- stopping configuration.")
     self))

-(defn new-config [runtime-config] (map->Configuring {:runtime-config runtime-config}))
-
-
-
-
+(defn new-config [runtime-config & {:keys [load-config-fn] :or {load-config-fn load-config}}]
+  (map->Configuring {:runtime-config runtime-config
+                     :load-config-fn load-config-fn
+                     }))


Allow only admins access to list of registered users

Co-authored-by: Samrat Man Singh <de71a275ed207d9c2083ebfa9af5dcdfa3ea2b88@nilenso.com>

--- src/time_tracker/users/handlers.clj
+++ src/time_tracker/users/handlers.clj
@@ -16,5 +16,8 @@
 ;; /users/

 (defn list-all
-  [request connection]
-  (res/response (users-db/retrieve-all connection)))
+  [{:keys [credentials] :as request} connection]
+  (let [google-id (:sub credentials)]
+    (if (users-db/has-user-role? google-id connection ["admin"])
+      (res/response (users-db/retrieve-all connection))
+      web-util/error-forbidden)))


Make Clojure scripting API handle all Screwdriver config options

--- src/main/resources/com/semperos/screwdriver/clojure/screwdriver_api.clj
+++ src/main/resources/com/semperos/screwdriver/clojure/screwdriver_api.clj
@@ -1,23 +1,136 @@
 (ns screwdriver-api
+  (:require [clojure.template :as tpl])
   (:import [com.semperos.screwdriver Config]
            [java.io File]
-           [java.util HashMap]))
+           [java.util ArrayList HashMap]))

-(defn build-java-map
+(defn java-map
   [m]
-  (let [h (HashMap.)]
+  (let [jh (HashMap.)]
     (doseq [[k v] m]
-      (.put h (name k) v))
-    h))
+      (.put jh (name k) v))
+    jh))
+
+(defn java-list
+  [l]
+  (let [jl (ArrayList.)]
+    (doseq [i l]
+      (.add jl i))
+    jl))
+
+(defmacro ^{:private true} nn
+  "Templating macro, if `pred` is not nil, it's used as a value for __ in the body forms."
+  [pred & body]
+  (let [body-with-param (tpl/apply-template '[__] body [pred])]
+    `(when-not (nil? ~pred)
+       ~@body-with-param)))

 (defn build-config
-  "Currently limited to needs of specific project"
-  [{:keys [asset-directory output-directory
-           css-dir-filter optimize-js?
-           server-template-locals]}]
-      (doto (Config.)
-        (.setAssetDirectory        (File. asset-directory))
-        (.setOutputDirectory       (File. output-directory))
-        (.setCssDirFilter          css-dir-filter)
-        (.setOptimizeJs            optimize-js?)
-        (.setServerTemplateLocals  (build-java-map server-template-locals))))+  "Configure Screwdriver with a Clojure map. For advanced functionality like IOFileFilter's, an instance of that class is expected as the value of a map entry. For String values, or list of String values, default Clojure values may be used (e.g., vectors)."
+  [{:keys [debug-mode asset-directory output-directory
+           js-sub-directory-name css-sub-directory-name image-sub-directory-name
+           template-sub-directory-name server-template-sub-directory-name
+           static-asset-sub-directory-name
+           js-extensions css-extensions image-extensions template-extensions
+           server-template-extensions static-asset-extensions
+           js-file-filter css-file-filter image-file-filter template-file-filter
+           server-template-file-filter static-asset-file-filter
+           js-dir-filter css-dir-filter image-dir-filter template-dir-filter
+           server-template-dir-filter static-asset-dir-filter
+           js-includes css-includes image-includes template-includes
+           server-template-includes static-asset-includes
+           js-excludes css-excludes image-excludes template-excludes
+           server-template-excludes static-asset-excludes
+           server-template-locals
+           optimize-js? optimize-css? optimize-image?
+           rjs-modules ]}]
+  (let [c (Config.)]
+    (nn debug-mode
+        (.setDebugMode c __))
+    (nn asset-directory
+        (.setAssetDirectory c (File. __)))
+    (nn output-directory
+        (.setOutputDirectory c (File. __)))
+    (nn js-sub-directory-name
+        (.setJsSubDirectoryName c __))
+    (nn css-sub-directory-name
+        (.setCssSubDirectoryName c __))
+    (nn image-sub-directory-name
+        (.setImageSubDirectoryName c __))
+    (nn template-sub-directory-name
+        (.setTemplateSubDirectoryName c __))
+    (nn server-template-sub-directory-name
+        (.setServerTemplateSubDirectoryName c __))
+    (nn static-asset-sub-directory-name
+        (.setStaticAssetSubDirectoryName c __))
+    (nn js-extensions
+        (.setJsExtensions c (java-list __)))
+    (nn css-extensions
+        (.setCssExtensions c (java-list __)))
+    (nn image-extensions
+        (.setImageExtensions c (java-list __)))
+    (nn template-extensions
+        (.setTemplateExtensions c (java-list __)))
+    (nn server-template-extensions
+        (.setServerTemplateExtensions c (java-list __)))
+    (nn static-asset-extensions
+        (.setStaticAssetExtesions c (java-list __)))
+    (nn js-file-filter
+        (.setJsFileFilter c __))
+    (nn css-file-filter
+        (.setCssFileFilter c __))
+    (nn image-file-filter
+        (.setImageFileFilter c __))
+    (nn template-file-filter
+        (.setTemplateFileFilter c __))
+    (nn server-template-file-filter
+        (.setServerTemplateFileFilter c __))
+    (nn static-asset-file-filter
+        (.setStaticAssetFileFilter c __))
+    (nn js-dir-filter
+        (.setJsDirFilter c __))
+    (nn css-dir-filter
+        (.setCssDirFilter c __))
+    (nn image-dir-filter
+        (.setImageDirFilter c __))
+    (nn template-dir-filter
+        (.setTemplateDirFilter c __))
+    (nn server-template-dir-filter
+        (.setServerTemplateDirFilter c __))
+    (nn static-asset-dir-filter
+        (.setStaticAssetDirFilter c __))
+    (nn js-includes
+        (.setJsIncludes c (java-list __)))
+    (nn css-includes
+        (.setCssIncludes c (java-list __)))
+    (nn image-includes
+        (.setImageIncludes c (java-list __)))
+    (nn template-includes
+        (.setTemplateIncludes c (java-list __)))
+    (nn server-template-includes
+        (.setServerTemplateIncludes c (java-list __)))
+    (nn static-asset-includes
+        (.setStaticAssetIncludes c (java-list __)))
+    (nn js-excludes
+        (.setJsExcludes c (java-list __)))
+    (nn css-excludes
+        (.setCssExcludes c (java-list __)))
+    (nn image-excludes
+        (.setImageExcludes c (java-list __)))
+    (nn template-excludes
+        (.setTemplateExcludes c (java-list __)))
+    (nn server-template-excludes
+        (.setServerTemplateExcludes c (java-list __)))
+    (nn static-asset-excludes
+        (.setStaticAssetExcludes c (java-list __)))
+    (nn server-template-locals
+        (.setServerTemplateLocals c (java-map __)))
+    (nn optimize-js?
+        (.setOptimizeJs c __))
+    (nn optimize-css?
+        (.setOptimizeCss c __))
+    (nn optimize-image?
+        (.setOptimizeImage c __))
+    (nn rjs-modules
+        (.setRjsModules c (java-list __)))
+    c))


Show the drawtools first on right sidebar.

--- src/uxbox/ui/workspace/sidebar.cljs
+++ src/uxbox/ui/workspace/sidebar.cljs
@@ -44,10 +44,10 @@
     (html
      [:aside#settings-bar.settings-bar
       [:div.settings-bar-inside
+       (when (contains? flags :drawtools)
+         (draw-toolbox))
        (when (contains? flags :element-options)
          (options-toolbox))
-       (when (contains? flags :drawtools)
-         (draw-toolbox))
        (when (contains? flags :icons)
          (icons-toolbox))]])))


Fix indentation.

Fix indentation.

--- src/videotest/falling/triangles.clj
+++ src/videotest/falling/triangles.clj
@@ -68,5 +68,5 @@
                                          rot1 x y))
                   (assoc-in [pt2] (glyph display-bin-size-x2
                                          rot2 x y)))))
-          {}
-          (partition 2 triangle-points)))
+            {}
+            (partition 2 triangle-points)))


update cors check

update cors check

--- src/wombats/components/pedestal.clj
+++ src/wombats/components/pedestal.clj
@@ -26,7 +26,7 @@
      ::http/file-path "/public"
      ::http/allowed-origins (if (contains? #{:dev :dev-ddb} env)
                               (fn [origin] true)
-                              #(re-find #"\.wombats\.io|\/\/wombats.io" %))
+                              #(re-find #"\.wombats\.io$|\/\/wombats\.io$" %))
      ::http/routes api-routes
      ::http/port port
      ::http/type type


Basic test for the -main function

Basic test for the -main function

--- test/clouseau/test_db_spec.clj
+++ test/clouseau/test_db_spec.clj
@@ -36,7 +36,7 @@
 ;;; exception statement from your version.
 ;;;

-(ns clouseau.test-core
+(ns clouseau.test-db-spec
   (:require [clojure.test :refer :all]
             [clouseau.db-spec :refer :all]))


revise kaleidoscope

revise kaleidoscope

--- spectacles/src/spectacles/kaleidoscope.clj
+++ spectacles/src/spectacles/kaleidoscope.clj
@@ -9,65 +9,53 @@
 (def min_diameter 15)
 (def max_speed 10)

-(defn random-int [start stop]
-  (let [x (rand-int (- stop start))]
-    (+ x start)))
-
 (defn new_dot []
-  (let [xspeed (* (rand-nth '(1 -1)) (rand-int max_speed))
+  (let [xspeed (* (rand-nth '(1 -1)) (q/random max_speed))
         yspeed (if (= xspeed 0)
-                 (* (rand-nth '(1 -1)) (random-int 1 max_speed))
-                 (* (rand-nth '(1 -1)) (rand-int max_speed)))]
+                 (* (rand-nth '(1 -1)) (q/random 1 max_speed))
+                 (* (rand-nth '(1 -1)) (q/random max_speed)))]
     {:x 0
      :y 0
      :xspeed xspeed
      :yspeed yspeed
-     :diameter (random-int min_diameter max_diameter)
-     :color [(rand-int 255) (rand-int 255) (rand-int 255) (random-int 10 200)]}))
+     :diameter (q/random min_diameter max_diameter)
+     :color [(q/random 256) (q/random 256) (q/random 256) (q/random 10 200)]}))

 (defn setup []
   (q/background 0)
   (q/smooth)
   (q/frame-rate 60)
   {:ldots (list (new_dot))
-   :rdots (list (new_dot))})
+   :rdots (list (new_dot))
+   :logo (q/load-image "resources/images/lifeinlights-logo.png")})
+
+(defn draw-dots [x y direction dots func]
+  (q/push-matrix)
+  (q/translate x y)
+  (q/rotate (* direction (q/radians (mod (* (q/frame-count) 2) 360))))
+
+  (let [items (count dots)]
+    (dotimes [n items]
+      (let [dot (nth dots n)]
+        (apply q/fill (:color dot))
+        (func (:x dot) (:y dot) (:diameter dot) (:diameter dot)))))
+  (q/pop-matrix))

 (defn draw [state]
-  ;; (q/background 0)
   (q/no-stroke)
   (q/fill 0 0 0 25)
   (q/rect 0 0 (q/width) (q/height))
-  (q/push-matrix)
-  (q/translate 300 300)
-  ;; (q/translate (/ (q/width) 2) (/ (q/height) 2))
-  (q/rotate (q/radians (mod (* (q/frame-count) 2) 360)))
-  (let [dots (:ldots state)
-        items (count (:ldots state))]
-    (dotimes [n items]
-      (let [dot (nth dots n)]
-        (apply q/fill (:color dot))
-        ;;(q/ellipse (:x dot) (:y dot) (:diameter dot) (:diameter dot)))))
-        (q/rect (:x dot) (:y dot) (:diameter dot) (:diameter dot)))))
-  (q/pop-matrix)
-  (q/push-matrix)
-  ;; (q/translate 300 300)
-  (q/translate (/ (q/width) 2) (/ (q/height) 2))
-  (q/rotate (- (q/radians (mod (* (q/frame-count) 2) 360))))
-  (let [dots (:rdots state)
-        items (count (:rdots state))]
-    (dotimes [n items]
-      (let [dot (nth dots n)]
-        (apply q/fill (:color dot))
-        (q/ellipse (:x dot) (:y dot) (:diameter dot) (:diameter dot)))))
-  (q/pop-matrix)
-  )
+  (q/image (:logo state) (- (/ (q/width) 2) 100) (- (/ (q/height) 2) 100))
+  (draw-dots 300 300 1 (:ldots state) q/rect)
+  (draw-dots (/ (q/width) 2) (/ (q/height) 2) -1 (:rdots state) q/ellipse))

 (defn update-position [m]
-  (let [x (update-in m [:x] + (:xspeed m))]
-    (update-in x [:y] + (:yspeed m))))
+  (-> m
+      (update-in [:x] + (:xspeed m))
+      (update-in [:y] + (:yspeed m))))

 (defn add-dot [m]
-  (if (< 50 (rand-int 100))
+  (if (< 50 (q/random 100))
     (conj m (new_dot)) ; Add a new dot
     m)) ; Do nothing and return the original list


Removes command from the 'Submitting jobs' log (#876)

--- scheduler/src/cook/mesos/api.clj
+++ scheduler/src/cook/mesos/api.clj
@@ -1389,7 +1389,7 @@
   ::jobs and ::groups, which specify the jobs and job groups."
   [conn {:keys [::groups ::jobs ::pool]}]
   (try
-    (log/info "Submitting jobs through raw api:" jobs)
+    (log/info "Submitting jobs through raw api:" (map #(dissoc % :command) jobs))
     (let [group-uuids (set (map :uuid groups))
           group-asserts (map (fn [guuid] [:entity/ensure-not-exists [:group/uuid guuid]])
                              group-uuids)


Make selecting tag/users with arrow keys nicer

--- src/braid/core/client/ui/views/thread.cljs
+++ src/braid/core/client/ui/views/thread.cljs
@@ -72,12 +72,18 @@
                         vec))
             selected (reaction (get-in [@tags @users] [@selected-column @selected-row]))]
         (run!
-          (->> (get (mapv (comp dec count) [@tags @users]) @selected-column)
-              (min @selected-row)
-              (reset! selected-row)))
+          (let [counts (mapv count [@tags @users])
+                cur-count (get counts @selected-column)
+                other-count (get counts (mod (inc @selected-column) 2))]
+            (if (and (zero? cur-count)
+                     (not (zero? other-count)))
+              (do
+                (swap! selected-column (comp #(mod % 2) inc))
+                (swap! selected-row #(max 0 (min % (dec other-count)))))
+              (swap! selected-row #(max 0 (min % (dec cur-count)))))))
         [:div.add-mention-popup
          [:input.search
-          {:placeholder "Search for tag/user"
+          {:placeholder "Search for tag/user to add to thread"
            :auto-focus true
            :value @search-query
            :on-change (fn [e] (reset! search-query
@@ -90,10 +96,7 @@
                     (.stopPropagation e)
                     (case k
                       ("ArrowRight" "ArrowLeft")
-                      (let [other-col (mod (inc @selected-column) 2)
-                            other-count (count (get [@tags @users] other-col))]
-                        (when-not (zero? other-count)
-                          (swap! selected-column (comp #(mod % 2) inc))))
+                      (swap! selected-column (comp #(mod % 2) inc))

                       "ArrowUp"
                       (swap! selected-row (comp (partial max 0) dec))
@@ -102,7 +105,7 @@
                       (swap! selected-row inc)

                       "Enter"
-                      (do
+                      (when @selected
                         (popovers/close!)
                         (case @selected-column
                           0 (dispatch [:add-tag-to-thread


Cassandra component start function improved

--- src/clj/hellhound/components/cassandra.clj
+++ src/clj/hellhound/components/cassandra.clj
@@ -1,24 +1,28 @@
 (ns hellhound.components.cassandra
   "This namespace provides the necessary means to communicate with
   database."
-  (:require [environ.core                   :as environ]
-            [qbits.alia                     :as alia]
-            [qbits.hayt                     :as hayt]
-            [hellhound.components.protocols :as protocols]
-            [hellhound.logger.core          :as logger]
-            [hellhound.core                 :as hellhound]))
+  (:require
+   [clojure.spec.alpha             :as spec]
+   [environ.core                   :as environ]
+   [qbits.alia                     :as alia]
+   [qbits.hayt                     :as hayt]
+   ;; Internals
+   [hellhound.components.protocols :as protocols]
+   [hellhound.logger.core          :as logger]
+   [hellhound.core                 :as hellhound]))

-(defn- cassandra-config
+(spec/def ::cassanda-configuration
+  (spec/keys :req [::connection ::keyspace]))
+
+(defn cassandra-config
   []
   (:cassandra (:db (hellhound/application-config))))

 (defn- connect
-  ([]
-   (connect {}))
-  ([config]
-   (let [cluster (alia/cluster (:connecttion config))]
-     (alia/connect cluster))))
+  [config]
+  (let [cluster (alia/cluster (:connecttion config))]
+    (alia/connect cluster)))

 (defn- check-session
   [session name]
@@ -29,12 +33,16 @@
   protocols/DatabaseLifecycle

   (start [this]
+    (spec/valid? ::cassanda-configuration options)
     (logger/info "Connecting to Cassandra cluster...")
-    (let [use-query (alia/prepare "USE :keyspace")
-          session   (connect options)
-          keyspace  (:keyspace options)]
-      (alia/execute session use-query {:values {:keyspace keyspace}})
-      (assoc this :session session)))
+    (let [session   (connect options)
+          keyspace  (:name (:keyspace options))]
+
+      (try
+        (alia/execute session (format "USE %s;" keyspace))
+        (catch  com.datastax.driver.core.exceptions.InvalidQueryException e
+          (throw (Exception. "Keyspace is not present. You need to migrate first."))))
+      (assoc this :session session :keyspace keyspace)))

   (stop [this]
     (if (:session this)
@@ -45,8 +53,7 @@
       this))

   (setup [this]
-    (let [session (:session this)
-          use-query (alia/prepare "USE :keyspace")]
+    (let [session (:session this)]
       (check-session session "Cassandra")

       (let [keyspace-config (:keyspace (:options this))]
@@ -56,7 +63,9 @@
                                (:name keyspace-config)
                                (hayt/with (:details keyspace-config))))

-        (assoc this :keyspace (:name keyspace-config))))))
+        (assoc this :keyspace (:name keyspace-config)))))
+
+  (teardown [this]))

 (defn make-cassandra-client


Added messenger-oriented batch-subscribe function.

--- src/cmr/dev/env/manager/messaging/core.clj
+++ src/cmr/dev/env/manager/messaging/core.clj
@@ -18,3 +18,10 @@
   [msgr-type]
   (case msgr-type
     :pubsub (pubsub/new-messenger)))
+
+(defn batch-subscribe
+  "The passed argument `subscribers` is a list of maps with each map having
+  `:topic` and `:content` keys with corresponding values."
+  [messenger subscribers]
+  (for [subscriber subscribers]
+    (subscribe messenger (:topic subscriber) (:content subscriber))))


Make the test a bit more thorough.

Make the test a bit more thorough.

--- test/com/rpl/specter/core_test.cljx
+++ test/com/rpl/specter/core_test.cljx
@@ -245,11 +245,13 @@
 (defspec parser-test
   (for-all+
     [i gen/int
-     j gen/int]
-    (and (= (first (s/select (s/parser #(+ % j) #(- % j)) i))
-            (+ j i))
-         (= (s/transform (s/parser #(+ % j) #(- % j)) identity i)
-            i)
+     afn (gen/elements [inc dec #(* % 2)])
+     bfn (gen/elements [inc dec #(* % 2)])
+     cfn (gen/elements [inc dec #(* % 2)])]
+    (and (= (first (s/select (s/parser afn bfn) i))
+            (afn i))
+         (= (s/transform (s/parser afn bfn) cfn i)
+            (-> i afn cfn bfn))
          )))

 (deftest selected?-test


clone-element can now take normal (non-quiescent) props

--- src/quiescent.cljs
+++ src/quiescent.cljs
@@ -1,5 +1,6 @@
 (ns quiescent
-  (:require cljsjs.react)
+  (:require cljsjs.react
+            [goog.object :as gobj])
   (:require-macros [quiescent :as q :refer [wrapped-lifecycle-method]]))

 (def ^:dynamic *component*
@@ -131,7 +132,13 @@
   (aget (.-props quiescent-react-element) "value"))

 (defn clone-element
-  "Merge quiescent props into a quescient-react-element's props."
-  [quiescent-react-element quiescent-props]
-  (js/React.cloneElement quiescent-react-element
-    #js{:value (into (element-props quiescent-react-element) quiescent-props)}))
+  "Merge quiescent props into a quescient-react-element's props.
+  You may also include a normal react-props js object with top-level props."
+  ([quiescent-react-element quiescent-props]
+    (clone-element quiescent-react-element quiescent-props nil))
+  ([quiescent-react-element quiescent-props react-props]
+   (js/React.cloneElement quiescent-react-element
+     (doto (if (nil? react-props)
+             #js{}
+             (gobj/clone react-props))
+       (aset "value" quiescent-props)))))


Implement normalise-namespace test

Implement normalise-namespace test

--- test/irresponsible/unscrew_test.clj
+++ test/irresponsible/unscrew_test.clj
@@ -36,4 +36,5 @@
     (is (= "irresponsible/unscrew.clj" (first (keys mymap))))))
 (deftest normalise-class
   (is (= "path.to.foo" (u/normalise-class "path/to/foo.class"))))
-(deftest normalise-namespace)
+(deftest normalise-namespace
+  (is (= "path.to.foo" (u/normalise-namespace "path/to/foo.clj"))))


Druid test fix :wrench: [ci drivers]

Druid test fix :wrench: [ci drivers]

--- test/metabase/driver/druid_test.clj
+++ test/metabase/driver/druid_test.clj
@@ -38,7 +38,6 @@
    :data      {:columns     ["timestamp" "id" "user_name" "venue_price" "venue_name" "count"]
                :rows        [["2013-01-03T08:00:00.000Z" "931" "Simcha Yan" "1" "Kinaree Thai Bistro"       1]
                              ["2013-01-10T08:00:00.000Z" "285" "Kfir Caj"   "2" "Ruen Pair Thai Restaurant" 1]]
-               :annotate?   nil
                :cols        [{:name "timestamp",   :base_type :type/Text}
                              {:name "id",          :base_type :type/Text}
                              {:name "user_name",   :base_type :type/Text}