Teach resolve-degree about sharps and flats, also move the octave modifiers into it.

--- src/overtone/music/pitch.clj
+++ src/overtone/music/pitch.clj
@@ -233,33 +233,55 @@
              :vii   7
              :_     nil})

-(defn resolve-degree
+(defn degree->int
   [degree]
   (if (some #{degree} (keys DEGREE))
     (degree DEGREE)
     (throw (IllegalArgumentException. (str "Unable to resolve degree: " degree ". Was expecting a roman numeral in the range :i -> :vii or the nil-note symbol :_")))))

+(defn resolve-degree
+  "returns a map representing the degree, and the octave semitone
+  shift (i.e. sharp flat)"
+  ([degree] (resolve-degree degree 0 0))
+  ([degree octave-shift semitone-shift]
+     (cond
+      (.endsWith (name degree) "-")
+      (resolve-degree (keyword (chop (name degree))) (dec octave-shift) semitone-shift)
+
+      (.endsWith (name degree) "+")
+      (resolve-degree (keyword (chop (name degree))) (inc octave-shift) semitone-shift)
+
+      (.endsWith (name degree) "b")
+      (resolve-degree (keyword (chop (name degree))) octave-shift (dec semitone-shift))
+
+      (.endsWith (name degree) "#")
+      (resolve-degree (keyword (chop (name degree))) octave-shift (inc semitone-shift))
+
+      :default
+      (let [degree (degree->int degree)]
+        {:degree degree
+         :octave-shift octave-shift
+         :semitone-shift semitone-shift}))))
+
 (defn degree->interval
   "Converts the degree of a scale given as a roman numeral keyword and converts
   it to the number of intervals (semitones) from the tonic of the specified
-  scale."
-  ([degree scale] (degree->interval degree scale 0))
-  ([degree scale shift]
+  scale.
+
+  Trailing #, b, + - represent sharps, flats, octaves up and down respectively.
+  An arbitrary number may be added in any order."
+  ([degree scale]
      (cond
       (nil? degree) nil
       (= :_ degree) nil

-      (number? degree) (+ shift (nth-interval scale (dec degree)))
-
-      (keyword? degree) (cond
-                         (.endsWith (name degree) "-")
-                         (degree->interval (keyword (chop (name degree))) scale (- shift 12))
-
-                         (.endsWith (name degree) "+")
-                         (degree->interval (keyword (chop (name degree))) scale (+ shift 12))
-
-                         :default
-                         (+ shift (nth-interval scale (dec (resolve-degree degree))))))))
+      (number? degree) (nth-interval scale (dec degree))
+
+      (keyword? degree) (let [degree     (resolve-degree degree)
+                              interval   (nth-interval scale (dec (:degree degree)))
+                              oct-shift  (* 12 (:octave-shift degree))
+                              semi-shift (:semitone-shift degree)]
+                          (+ interval oct-shift semi-shift)))))

 (defn degrees->pitches
   "Convert intervals to pitches in MIDI number format.  Supports nested collections."


making instrument group at the head of the root so it can route through the mixer.

--- src/overtone/studio/core.clj
+++ src/overtone/studio/core.clj
@@ -39,7 +39,7 @@
 (on-event :studio-setup-completed :start-mixer start-mixer)

 (defn setup-studio []
-  (let [g (group :tail ROOT-GROUP)
+  (let [g (group :head ROOT-GROUP)
         m (group :tail ROOT-GROUP)
         r (group :tail ROOT-GROUP)]
     (dosync


s/trace/warn/ when unable to find a lexical complement

--- src/babel/forest.cljc
+++ src/babel/forest.cljc
@@ -235,9 +235,12 @@

               ;; else, no complements could be added to this bolt.
               (do
-                (log/trace (str " add-complement took " run-time " msec, but found no lexical complements for "
-                               (morph from-bolt)
-                               ". Complements tried were: " (morph complement-candidate-lexemes)))))
+                (log/warn (str " add-complement took " run-time " msec, but found no lexical complements for "
+                               "'" (morph from-bolt) "'"
+                               ". Complements tried were:" (str " " (string/join "," (map morph (take 5 complement-candidate-lexemes))) ".. and "
+                                                                 (- (count complement-candidate-lexemes) 5) " more.")))))
+
+
             (do (log/trace (str "add-complement after adding complement: "
                                 (string/join ","
                                              (map (fn [each]


(PDB-3529) Check latest_report_timestamp in one query

Prior to this commit, we found the latest_report_timestamp in a
select query and then compared it to the producer timestamp being
processed in clojure.

After this commit, we just submit an UPDATE query with a
WHERE clause that will only update if the producer timestamp being
processed is newer than the one already stored in the certnames
table.

--- src/puppetlabs/puppetdb/scf/storage.clj
+++ src/puppetlabs/puppetdb/scf/storage.clj
@@ -1284,21 +1284,16 @@
 (defn update-latest-report!
   "Given a node name, updates the `certnames` table to ensure that it indicates the
    most recent report for the node."
-  [node report-id report-timestamp]
+  [node report-id producer-timestamp]
   {:pre [(string? node) (integer? report-id)]}

-  (let [latest-report-timestamp (:latest_report_timestamp (first (query-to-vec
-                                    ["SELECT latest_report_timestamp
-                                      FROM certnames
-                                      WHERE certname = ?
-                                      " node])))]
-    (if (sql-ts-after? (to-timestamp report-timestamp)
-                     (to-timestamp latest-report-timestamp))
-
-      (jdbc/update! :certnames
-                    {:latest_report_id report-id
-                     :latest_report_timestamp report-timestamp}
-                    ["certname = ?" node]))))
+  (jdbc/update! :certnames
+                {:latest_report_id report-id
+                 :latest_report_timestamp producer-timestamp}
+                [(str "certname = ?"
+                      "AND ( latest_report_timestamp < ?"
+                      "      OR latest_report_timestamp is NULL )")
+                 node producer-timestamp]))

 (defn find-containing-class
   "Given a containment path from Puppet, find the outermost 'class'."


[#Fix 167] Only build AST for files on classpath

--- src/refactor_nrepl/find/find_symbol.clj
+++ src/refactor_nrepl/find/find_symbol.clj
@@ -129,14 +129,13 @@
                                        (:line-end  info))}))]
     (map gather locs)))

-(defn- find-global-symbol [file ns var-name clj-dir ignore-errors]
-  (let [dir (or clj-dir ".")
-        namespace (or ns (core/ns-from-string (slurp file)))
+(defn- find-global-symbol [file ns var-name ignore-errors]
+  (let [namespace (or ns (core/ns-from-string (slurp file)))
         fully-qualified-name (if (= namespace "clojure.core")
                                var-name
                                (str/join "/" [namespace var-name]))]
-    (->> dir
-         (core/find-in-dir (some-fn core/clj-file? core/cljc-file?))
+    (->> (core/dirs-on-classpath)
+         (mapcat (partial core/find-in-dir (some-fn core/clj-file? core/cljc-file?)))
          (mapcat (partial find-symbol-in-file fully-qualified-name ignore-errors)))))

 (defn- get&read-enclosing-sexps
@@ -232,10 +231,10 @@
   [{:keys [line-beg line-end col-beg col-end name file match]}]
   [line-beg line-end col-beg col-end name file match])

-(defn find-symbol [{:keys [file ns name dir line column ignore-errors]}]
+(defn find-symbol [{:keys [file ns name line column ignore-errors]}]
   (core/throw-unless-clj-file file)
   (let [macros (future (find-macro (core/fully-qualify ns name)))
-        globals (->> (find-global-symbol file ns name dir (= ignore-errors "true"))
+        globals (->> (find-global-symbol file ns name (= ignore-errors "true"))
                      distinct
                      (remove find-util/spurious?)
                      future)]


Strangely this corrects a spurious failure

--- spec/rook/jetty_async_spec.clj
+++ spec/rook/jetty_async_spec.clj
@@ -40,7 +40,8 @@

   (it "can process requests and return responses"

-      (let [response (client/get "http://localhost:9988/fred" {:accept :json})]
+      (let [response (client/get "http://localhost:9988/fred" {:accept           :json
+                                                               :throw-exceptions false})]
         (should= HttpServletResponse/SC_OK (:status response))
         (should= "application/json; charset=utf-8" (-> response :headers (get "Content-Type")))
         (should= "{\"message\":\":barney says `ribs!'\"}" (:body response))))


Add ClojureScript special form doc map

Add ClojureScript special form doc map

--- src/clj/cljs/repl.clj
+++ src/clj/cljs/repl.clj
@@ -784,6 +784,49 @@
 ;; =============================================================================
 ;; ClojureScript REPL interaction support

+(def special-doc-map
+  '{. {:forms [(.instanceMethod instance args*)
+               (.-instanceField instance)]
+       :doc "The instance member form works for methods and fields.
+  They all expand into calls to the dot operator at macroexpansion time."}
+    def {:forms [(def symbol doc-string? init?)]
+         :doc "Creates and interns a global var with the name
+  of symbol in the current namespace (*ns*) or locates such a var if
+  it already exists.  If init is supplied, it is evaluated, and the
+  root binding of the var is set to the resulting value.  If init is
+  not supplied, the root binding of the var is unaffected."}
+    do {:forms [(do exprs*)]
+        :doc "Evaluates the expressions in order and returns the value of
+  the last. If no expressions are supplied, returns nil."}
+    if {:forms [(if test then else?)]
+        :doc "Evaluates test. If not the singular values nil or false,
+  evaluates and yields then, otherwise, evaluates and yields else. If
+  else is not supplied it defaults to nil."}
+    new {:forms [(Classname. args*) (new Classname args*)]
+         :url "java_interop#new"
+         :doc "The args, if any, are evaluated from left to right, and
+  passed to the JavaScript constructor. The constructed object is
+  returned."}
+    quote {:forms [(quote form)]
+           :doc "Yields the unevaluated form."}
+    recur {:forms [(recur exprs*)]
+           :doc "Evaluates the exprs in order, then, in parallel, rebinds
+  the bindings of the recursion point to the values of the exprs.
+  Execution then jumps back to the recursion point, a loop or fn method."}
+    set! {:forms[(set! var-symbol expr)
+                 (set! (. instance-expr instanceFieldName-symbol) expr)]
+          :url "vars#set"
+          :doc "Used to set vars and JavaScript object fields"}
+    throw {:forms [(throw expr)]
+           :doc "The expr is evaluated and thrown."}
+    try {:forms [(try expr* catch-clause* finally-clause?)]
+         :doc "catch-clause => (catch classname name expr*)
+  finally-clause => (finally expr*)
+  Catches and handles JavaScript exceptions."}
+    var {:forms [(var symbol)]
+         :doc "The symbol must resolve to a var, and the Var object
+itself (not its value) is returned. The reader macro #'x expands to (var x)."}})
+
 (defmacro doc
   "Prints documentation for a var or special form given its name"
   [sym]


support for Starlight Crusade Funding

support for Starlight Crusade Funding

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -1313,7 +1313,8 @@
   ([state side {:keys [title] :as card} {:keys [targets extra-cost no-additional-cost]}]
     (when (not (seq (get-in @state [side :locked (-> card :zone first)])))
      (let [cdef (card-def card)
-           additional-cost (if (has? card :subtype "Double")
+           additional-cost (if (and (has? card :subtype "Double")
+                                    (not (get-in @state [side :register :double-ignore-additional])))
                              (concat (:additional-cost cdef) [:click 1])
                              (:additional-cost cdef))]
        (when (and (if-let [req (:req cdef)]


split out registration of successful run to new function

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -1198,13 +1198,16 @@
   (resolve-ability state side ability card nil)
   (handle-end-run state side))

+(defn register-successful-run [state side server]
+  (swap! state update-in [:runner :register :successful-run] #(conj % (first server)))
+  (swap! state assoc-in [:run :successful] true)
+  (trigger-event state side :successful-run (first server)))
+
 (defn successful-run [state side args]
   (when-let [successful-run-effect (get-in @state [:run :run-effect :successful-run])]
     (resolve-ability state side successful-run-effect (:card successful-run-effect) nil))
   (let [server (get-in @state [:run :server])]
-    (swap! state update-in [:runner :register :successful-run] #(conj % (first server)))
-    (swap! state assoc-in [:run :successful] true)
-    (trigger-event state side :successful-run (first server))
+    (register-successful-run state side server)
     (let [run-effect (get-in @state [:run :run-effect])
           r (:req run-effect)
           card (:card run-effect)


Change CLJS unify! into a multimethod; datasets can be any ISeqable or IWatchables that point to an ISeqable.

--- src/cljs/c2/core.cljs
+++ src/cljs/c2/core.cljs
@@ -1,5 +1,5 @@
 (ns c2.core
-  (:use-macros [c2.util :only [p timeout]])
+  (:use-macros [c2.util :only [p pp timeout]])
   (:use [cljs.reader :only [read-string]]
         [c2.dom :only [select select-all node-type append! remove! children build-dom-elem merge-dom! attr cannonicalize]])
   (:require [goog.dom :as gdom]
@@ -37,26 +37,34 @@
     (if (undefined? d) nil d)))

-;; (defmulti unify!
-;;   (fn [_ data & args]
-;;     (cond (instance? cljs.core.Atom data) :atom
-;;           (seq? data)                        :seq
-;;           :else                              (throw (js/Error. "Unify! requires data to be seqable or an atom containing seqable")))))
-;; (defmethod unify! :atom
-;;   [_ atom-data & args]
-;;   (apply unify! _ @atom-data args))
-
-;;(defmethod unify! :seq)
-
-
 ;;Used to generate unique IDs for auto-unify atom watchers
 (def ^:private auto-unify-id (atom 0))

-(defn unify!
-  "Calls (mapping datum idx) for each datum and appends resulting elements to container.
+
+(defmulti unify!
+  "Given container, data, and mapping-fn, calls (mapping datum idx) for each datum and appends resulting elements to container.
 Automatically updates elements mapped to data according to key-fn (defaults to index) and removes elements that don't match.
-Scoped to selector, if given, otherwise applies to all container's children.
-Optional enter, update, and exit functions called before DOM is changed; return false to prevent default behavior."
+Scoped to selector kwarg, if given, otherwise applies to all container's children.
+Optional enter, update, and exit functions called before DOM is changed; return false to prevent default behavior.
+If data implements IWatchable, DOM will update when data changes."
+  (fn [container data mapping & kwargs]
+    (cond (satisfies? cljs.core.IWatchable data) :atom
+          (satisfies? cljs.core.ISeqable data)   :seq
+          :else (do (pp data)
+                    (throw (js/Error. "Unify! requires data to be seqable or an atom containing seqable"))))))
+
+(defmethod unify! :atom
+  [container !data & args]
+  (let [redraw! #(apply unify! container % args)]
+    ;;add watcher to redraw whenever atom is update
+    (add-watch !data (keyword (str "auto-unify" (swap! auto-unify-id inc)))
+               (fn [_ _ old new] (when (not= old new)
+                                  (redraw! new))))
+    ;;initial draw
+    (redraw! @!data)))
+
+
+(defmethod unify! :seq
   [container data mapping & {:keys [selector key-fn pre-fn post-fn update exit enter
                                     defer-attr force-update]
                              :or {key-fn (fn [d idx] idx)
@@ -72,25 +80,6 @@
                                   defer-attr false}}]

   (let [container (select container)
-        ;;This logic should be abstracted out via a (unify!) multimethod, once (apply multimethod) is fixed in ClojureScript
-        data (if (instance? cljs.core.Atom data)
-               ;;Then add a watcher to auto-unify when the atom changes, and deference data for this run
-               (do (add-watch data (keyword (str "auto-unify" (swap! auto-unify-id inc)))
-                              (fn [key data-atom old new]
-                                (p "atom updated; automatically calling unify!")
-                                (unify! container @data-atom mapping
-                                        :selector selector
-                                        :key-fn key-fn
-                                        :enter  enter
-                                        :update update
-                                        :exit exit
-                                        :pre-fn pre-fn
-                                        :post-fn post-fn
-                                        :defer-attr defer-attr
-                                        :force-update force-update)))
-                   @data)
-               data)
-
         data (if pre-fn
                (pre-fn data)
                data)


New test: test-get-last-day-of-week

New test: test-get-last-day-of-week

--- test/clj_calendar/calendar_test.clj
+++ test/clj_calendar/calendar_test.clj
@@ -330,3 +330,20 @@
                 "2000-01-09" (get-first-day-of-week calendar2)
                 "2000-01-16" (get-first-day-of-week calendar3)))))

+(deftest test-get-last-day-of-week
+    "Check the function clj-calendar.calendar/calculate-last-day-of-week"
+    (testing "the function clj-calendar.calendar/calculate-last-day-of-week"
+        (let [calendar1 (get-calendar)
+              calendar2 (get-calendar)
+              calendar3 (get-calendar)]
+            (.set calendar1 java.util.Calendar/YEAR 2000)
+            (.set calendar1 java.util.Calendar/WEEK_OF_YEAR 2)
+            (.set calendar2 java.util.Calendar/YEAR 2000)
+            (.set calendar2 java.util.Calendar/WEEK_OF_YEAR 3)
+            (.set calendar3 java.util.Calendar/YEAR 2000)
+            (.set calendar3 java.util.Calendar/WEEK_OF_YEAR 4)
+            (are [x y] (= x (format-date y))
+                "2000-01-08" (get-last-day-of-week calendar1)
+                "2000-01-15" (get-last-day-of-week calendar2)
+                "2000-01-22" (get-last-day-of-week calendar3)))))
+


fix tests for cljs

fix tests for cljs

--- test/com/rpl/specter/core_test.cljx
+++ test/com/rpl/specter/core_test.cljx
@@ -1320,7 +1320,7 @@
          ))))

 (deftest multi-transform-overrun-error
-  (is (thrown? Exception (multi-transform s/STAY 3)))
+  (is (thrown? #+clj Exception #+cljs js/Error (multi-transform s/STAY 3)))
   )

 (deftest terminal-val-test


GAWB-1288: Changing log limit

GAWB-1288: Changing log limit

--- src/cljs/org/broadinstitute/firecloud_ui/common/gcs_file_preview.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/common/gcs_file_preview.cljs
@@ -9,7 +9,7 @@
     [org.broadinstitute.firecloud-ui.utils :as utils]
     ))

-(def ^:private preview-byte-count 1800)
+(def ^:private preview-byte-count 20000)

 (react/defc PreviewDialog
   {:render


Scale wave form height to match visual

Scale wave form height to match visual

--- src/web_audio_cljs/core.cljs
+++ src/web_audio_cljs/core.cljs
@@ -1,8 +1,10 @@
 (ns ^:figwheel-always web-audio-cljs.core
-    (:require[om.core :as om :include-macros true]
-              [om.dom :as dom :include-macros true]
-              [web-audio-cljs.audio :as audio]
-              [web-audio-cljs.utils :refer [l]]))
+  (:require [om.core :as om :include-macros true]
+            [om.dom :as dom :include-macros true]
+            [web-audio-cljs.audio :as audio]
+            [web-audio-cljs.utils :refer [l]]
+            [cljs.core.async :refer [put! chan timeout <! >!] :as async])
+  (:require-macros [cljs.core.async.macros :refer [go go-loop alt!]]))

 (enable-console-print!)

@@ -14,19 +16,46 @@
                           :recorded-buffers []
                           :audio-context audio-context}))

+(defn lin-interp [x0 x1 y0 y1]
+  (fn [x]
+    (+ y0
+       (* (/ (- x x0)
+             (- x1 x0))
+          (- y1 y0)))))
+
+(defn min-arr-val [arr]
+  (loop [i 0 min-val (aget arr 0)]
+    (if (= i (.-length arr))
+      min-val
+      (let [cur-val (aget arr i)]
+        (if (< cur-val min-val)
+          (recur (inc i) cur-val)
+          (recur (inc i) min-val))))))
+
+(defn max-arr-val [arr]
+  (loop [i 0 max-val (aget arr 0)]
+    (if (= i (.-length arr))
+      max-val
+      (let [cur-val (aget arr i)]
+        (if (> cur-val max-val)
+          (recur (inc i) cur-val)
+          (recur (inc i) max-val))))))
+
 (defn draw-buffer! [width height canvas-context data]
   (let [step (.ceil js/Math (/ (.-length data) width))
-        amp (/ height 2)]
+        amp (/ height 2)
+        min-val (min-arr-val data)
+        max-val (max-arr-val data)
+        scale (lin-interp min-val max-val (- amp) amp)]
+    (.log js/console "min of data: " min-val)
+    (.log js/console "max of data: " max-val)
     (aset canvas-context "fillStyle" "silver")
     (.clearRect canvas-context 0 0 width height)
-    (.log js/console "amplitude" amp)
-    (.log js/console "data length " (.-length data))
-    (.log js/console "step " step)
-    (.log js/console "width " width)
     (doseq [i (range width)]
       (doseq [j (range step)]
-        (let [datum (aget data (+ (* i step) j))]
-          (.fillRect canvas-context i amp 1 (- (.max js/Math 1 (* datum amp)))))))))
+        (let [datum (.min js/Math (aget data (+ (* i step) j)) 1)
+              height (scale datum)]
+          (.fillRect canvas-context i amp 1 height))))))

 (defn play-sound [context sound-data]
   (let [audio-tag (.getElementById js/document "play-sound")]
@@ -35,14 +64,17 @@
     ;(.connect source (.-destination context))
     ))

-(defn save-recording! [app-state audio-recorder audio-context]
-  (.stop audio-recorder)
-  (.getBuffers audio-recorder
-               (fn [buffers]
-                 (om/transact! app-state :recorded-buffers #(conj % (aget buffers 0)))
-                 (.clear audio-recorder))))
+(defn save-recording! [app-state audio-recorder audio-context analyser-node]
+  (let [buffer-length (.-frequencyBinCount analyser-node)
+        data-array (js/window.Uint8Array. buffer-length)]
+    (.getByteTimeDomainData analyser-node data-array)
+    (.stop audio-recorder)
+    (.getBuffers audio-recorder
+                 (fn [buffers]
+                   (om/transact! app-state :recorded-buffers #(conj % (aget buffers 0)))
+                   (.clear audio-recorder)))))

-(defn recorder-view [{:keys [audio-recorder is-recording audio-context] :as data} owner]
+(defn recorder-view [{:keys [audio-recorder is-recording audio-context analyser-node] :as data} owner]
   (reify
     om/IDisplayName (display-name [_] "recorder-view")
     om/IRender
@@ -52,14 +84,14 @@
                                 :onClick (fn [e]
                                            (if is-recording
                                              (do
-                                               (save-recording! data audio-recorder audio-context)
+                                               (save-recording! data audio-recorder audio-context analyser-node)
                                                (om/transact! data :is-recording not))
                                              (do
                                                (.record audio-recorder)
                                                (om/transact! data :is-recording not))))}
                            (if is-recording "Stop" "Record"))))))

-(defn buffer-view [recorded-buffer owner]
+(defn buffer-view [time-domain-data owner]
   (reify
     om/IDisplayName (display-name [_] "buffer-view")

@@ -67,27 +99,39 @@
     (init-state [_] {:canvas nil
                      :canvas-context nil
                      :canvas-width 400
-                     :canvas-height 100})
+                     :canvas-height 100
+                     :mouse-chan (chan)})

     om/IDidMount
     (did-mount [_]
-      (let [{:keys [canvas-width canvas-height]} (om/get-state owner)
+      (let [{:keys [canvas-width canvas-height mouse-chan]} (om/get-state owner)
             canvas (om/get-node owner "the-canvas")
             canvas-context (.getContext canvas "2d")]
-        (draw-buffer! canvas-width canvas-height canvas-context recorded-buffer)))
+        (draw-buffer! canvas-width canvas-height canvas-context time-domain-data)
+        (go
+          (while true
+            (let [target (<! mouse-chan)]
+              (.log js/console "!!!target: " target))))))

     om/IRenderState
-    (render-state [_ {:keys [canvas-width canvas-height]}]
+    (render-state [_ {:keys [canvas-width canvas-height mouse-chan]}]
       (dom/div nil
-        (dom/canvas #js {:width canvas-width :height canvas-height :ref "the-canvas"} "no canvas")))))
+        (dom/canvas #js {:width canvas-width
+                         :height canvas-height
+                         :ref "the-canvas"
+                         :onMouseMove (fn [e]
+                                        (.stopPropagation e)
+                                        (.preventDefault e)
+                (.log js/console "Got mouse pageX, pageY: " (.-pageX e) (.-pageY e))
+                                        (put! mouse-chan (.-target e)))} "no canvas")))))

-(defn buffers-list-view [{:keys [recorded-buffers] :as data} owner]
+(defn buffers-list-view [{:keys [recorded-buffers]} owner]
   (reify
     om/IDisplayName (display-name [_] "buffers-list-view")
     om/IRender
     (render [_]
       (apply dom/div {:className "buffers-list"}
-             (om/build-all buffer-view (:recorded-buffers data))))))
+             (om/build-all buffer-view recorded-buffers)))))

 (defn mount-om-root []
   (om/root


Make table prefix db config optional

Make table prefix db config optional

Fix yetibot/yetibot#698

--- src/yetibot/core/db/util.clj
+++ src/yetibot/core/db/util.clj
@@ -1,12 +1,14 @@
 (ns yetibot.core.db.util
   (:require
+    [schema.core :as sch]
     [clojure.string :refer [join]]
     [cuerdas.core :refer [kebab snake]]
     [clojure.java.jdbc :as sql]
     [taoensso.timbre :refer [debug info color-str]]
     [yetibot.core.config :refer [get-config]]))

-(def config-shape {:url String :table {:prefix String}})
+(def config-shape {:url String
+                   (sch/optional-key :table) {:prefix String}})

 (def default-db-url "postgresql://localhost:5432/yetibot")

@@ -19,9 +21,11 @@
    [:created-at :timestamp "NOT NULL" "DEFAULT CURRENT_TIMESTAMP"]])

 (defn config []
-  (or (:value (get-config config-shape [:db]))
-      {:url default-db-url
-       :table {:prefix default-table-prefix}}))
+  (merge
+    ;; default
+    {:url default-db-url
+     :table {:prefix default-table-prefix}}
+    (:value (get-config config-shape [:db]))))

 (defn qualified-table-name
   [table-name]


Refine APIs

Refine APIs

--- src/zipping_checkin/core.clj
+++ src/zipping_checkin/core.clj
@@ -4,7 +4,8 @@
             [ring.adapter.jetty :refer [run-jetty]]
             [ring.middleware.defaults :refer [wrap-defaults api-defaults]]
             [zipping-checkin [users :as users]
-                             [checkin :as checkin]]))
+                             [checkin :as checkin]]
+            [clojure.string :as str]))

 (defroutes routes
   (GET "/users/register" {{:keys [name phone email]} :params}
@@ -15,13 +16,15 @@
     (let [user (users/query-user user-id)]
       (users/unregister-user user-id)
       (str "unregistered: " (:name user))))
-  (GET "/checkin/users" req
-    (pr-str (checkin/query-checkin-users)))
-  (GET "/api/checkin/checkin" {{:keys [user-id]} :params}
+  (GET "/users/all" req
+    (str/join \newline (users/query-users)))
+  (GET "/users/checkin" req
+    (str/join \newline (checkin/query-checkin-users)))
+  (GET "/api/checkin" {{:keys [user-id]} :params}
     (let [user (users/query-user user-id)]
       (checkin/checkin user-id)
       (str "{\"type\":\"checkin\", \"status\":\"success\", \"user\":\"" (:name user) "\"}")))
-  (GET "/api/checkin/checkout" {{:keys [user-id]} :params}
+  (GET "/api/checkout" {{:keys [user-id]} :params}
     (let [user (users/query-user user-id)]
       (checkin/checkout user-id)
       (str "{\"type\":\"checkout\", \"status\":\"success\", \"user\":\"" (:name user) "\"}")))


New functions: read-commit-id, insert-changed-file, insert-commit

--- src/arachnida/db_interface.clj
+++ src/arachnida/db_interface.clj
@@ -15,3 +15,26 @@
                                   from   repos
                                   where  product=? order by id;" product-id]))

+(defn read-commit-id
+    [db product repo branch sha]
+    (:id
+    (first
+        (jdbc/query db ["select id from commits where product=? and repo=? and branch=? and sha=?"
+                             product repo branch sha]))))
+
+(defn insert-changed-file
+    [db commit-id changed-file]
+    (jdbc/insert! db "changed_files" {:commit_id commit-id
+                                           :file_name (first changed-file)
+                                           :operation (second changed-file)}))
+
+(defn insert-commit
+    "Zapis dat do tabulky."
+    [db product repo branch sha message author date files-changed insertions deletions]
+    (jdbc/insert! db "commits" {:product product :repo repo :branch branch
+                                             :sha     sha     :message message
+                                             :author author   :date date
+                                             :files_changed files-changed
+                                             :insertions insertions
+                                             :deletions deletions}))
+


test logic-as-control-flow instead of conditional

--- src/atom_finder/atom_patch.clj
+++ src/atom_finder/atom_patch.clj
@@ -122,7 +122,7 @@

 (defn log-atom-removed-all-commits
   []
-  (binding [*out* (clojure.java.io/writer "gcc-conditional-commits.txt")]
+  (binding [*out* (clojure.java.io/writer "gcc-logic-as-control-flow-commits.txt")]
     (->> ;conditional-atom?
          logic-as-control-flow-atom?
          (atom-removed-all-commits gcc-repo)


constraints on arguments of "turn [on|off]"

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -2146,7 +2146,10 @@
                 :subcat {:1 {:sem subj}
                          :2 {:cat :prep
                              :sem {:pred :on}}
-                         :3 {:sem obj}}}}
+                         :3 {:cat :noun
+                             :subcat '()
+                             :pronoun false
+                             :sem obj}}}}
       {:synsem {:cat :verb
                 :sem {:pred :turn-off
                       :subj subj
@@ -2154,7 +2157,10 @@
                 :subcat {:1 {:sem subj}
                          :2 {:cat :prep
                              :sem {:pred :off}}
-                         :3 {:sem obj}}}}])
+                         :3 {:cat :noun
+                             :subcat '()
+                             :pronoun false
+                             :sem obj}}}}])

    "turn off"
    {:synsem {:cat :verb


refine post-processing rule

refine post-processing rule

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1832,7 +1832,8 @@
                           {:synsem {:subcat {:2 {:reflexive false}}}})

                  ;; if not(reflexive), then reflexive = false.
-                 (if-then {:synsem {:sem {:reflexive false}}}
+                 (if-then {:synsem {:cat :verb
+                                    :sem {:reflexive false}}}
                           {:synsem {:sem {:reflexive false}}})

                  ;; subject-and-reflexive-pronoun agreement


make get-angry conform to Italian: anything {:animate true} can get angry

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -554,7 +554,7 @@
                           :animate false
                           :games true}}}
    "get angry"
-   (let [subject-semantics (atom {:human true})]
+   (let [subject-semantics (atom {:animate true})]
      {:synsem {:cat :verb
                :sem {:pred :get-angry
                      :subj subject-semantics


added salire get on

added salire get on

--- src/babel/italiano/lexicon.clj
+++ src/babel/italiano/lexicon.clj
@@ -1627,6 +1627,16 @@
                           :physical-object true
                           :human false}}})

+   "salire"
+    {:italiano {:italiano "salire"
+                :essere true
+                :present {:1sing "salgo"
+                          :3plur "salgono"}}
+     :synsem {:cat :verb
+              :essere true
+              :sem {:subj {:animate true}
+                    :pred :get-on}}}
+
    "scappare"  {:synsem {:cat :verb
                          :sem {:pred :escape}}}


STORM-2535: Replace test-reset-timeout with a more reliable test

--- storm-core/test/clj/integration/org/apache/storm/integration_test.clj
+++ storm-core/test/clj/integration/org/apache/storm/integration_test.clj
@@ -149,19 +149,25 @@
       (.advanceClusterTime cluster 12)
       (assert-failed tracker 2)
       )))
-
-(defbolt extend-timeout-twice {} {:prepare true}
-  [conf context collector]
-  (let [state (atom -1)]
+
+(defbolt reset-timeout-bolt {} {:prepare true}
+  [conf context collector]
+  (let [tuple-counter (atom 1)
+        first-tuple (atom nil)]
     (bolt
       (execute [tuple]
-        (do
-          (Time/sleep (* 8 1000))
-          (reset-timeout! collector tuple)
-          (Time/sleep (* 8 1000))
-          (reset-timeout! collector tuple)
-          (Time/sleep (* 8 1000))
-          (ack! collector tuple)
+        (do
+          (condp = @tuple-counter
+            1 (reset! first-tuple tuple)
+            2 (reset-timeout! collector @first-tuple)
+            5 (do
+                (ack! collector @first-tuple)
+                (ack! collector tuple)
+              )
+            (do
+              (reset-timeout! collector @first-tuple)
+              (ack! collector tuple)))
+          (swap! tuple-counter inc)
         )))))

 (deftest test-reset-timeout
@@ -175,18 +181,33 @@
                      {"1" (Thrift/prepareSpoutDetails feeder)}
                      {"2" (Thrift/prepareBoltDetails
                             {(Utils/getGlobalStreamId "1" nil)
-                             (Thrift/prepareGlobalGrouping)} extend-timeout-twice)})]
+                             (Thrift/prepareGlobalGrouping)} reset-timeout-bolt)})]
     (.submitTopology cluster
                            "timeout-tester"
                            {TOPOLOGY-MESSAGE-TIMEOUT-SECS 10}
                            topology)
-    (.advanceClusterTime cluster 11)
+    ;The first tuple will be used to check timeout reset
     (.feed feeder ["a"] 1)
-    (.advanceClusterTime cluster 21)
+    ;The second tuple is used to wait for the spout to rotate the spout's pending map
+    (.feed feeder ["b"] 2)
+    (.advanceClusterTime cluster 9)
+    ;The other tuples are used to reset the first tuple's timeout,
+    ;and to wait for the message to get through to the spout (acks use the same path as timeout resets)
+    (.feed feeder ["c"] 3)
+    (assert-acked tracker 3)
+    (.advanceClusterTime cluster 9)
+    (.feed feeder ["d"], 4)
+    (assert-acked tracker 4)
+    (.advanceClusterTime cluster 2)
+    ;The time is now twice the message timeout, the second tuple should expire since it was not acked
+    ;Waiting for this also ensures that the first tuple gets failed if reset-timeout doesn't work
+    (assert-failed tracker 2)
+    ;Put in a tuple to cause the first tuple to be acked
+    (.feed feeder ["e"], 5)
+    (assert-acked tracker 5)
+    ;The first tuple should be acked and should not have failed
     (is (not (.isFailed tracker 1)))
-    (is (not (.isAcked tracker 1)))
-    (.advanceClusterTime cluster 5)
-    (assert-acked tracker 1)
+    (is (.isAcked tracker 1))
     )))

 (defn mk-validate-topology-1 []


Remove CountedAndMarkedGraph

Remove CountedAndMarkedGraph

Having a separate type for an OrderedGraph that has its crossings
marked and counted always felt like a gigantic hack. I replaced
this with a memoized function of OrderedGraphs.

--- src/fatlip/order.cljs
+++ src/fatlip/order.cljs
@@ -32,10 +32,6 @@
            :layers (vec (rseq layers)))))

 (defrecord OrderedLayer [id duration items])
-
-;; still has OrderedLayers
-(defrecord CountedAndMarkedGraph [layers succs preds
-                                  crossings marked characters])

 (defrecord FlatGraph [layers succs preds aboves belows top-idxs bot-idxs
                       crossings marked characters]
@@ -340,7 +336,7 @@
                0)))

-(defn count-and-mark-crossings
+(defn count-and-mark-crossings-layer
   "Step 5 of ESK, counts the number of crossings that result from a bi-layer
   ordering. Implements the algorithm found in Bilayer Cross Counting, by
   Wilhelm Barth, Petra Mutzel and Michael Jünger
@@ -528,27 +524,27 @@
                           order-subnodes)))))))

-(defn OrderedGraph->CountedAndMarkedGraph
-  "Takes an OrderedGraph, counts edge crossings and marks edges that should not
-  be drawn straight, and returns a new graph with this information"
-  [ordered-graph]
-  (let [{:keys [minus-ps minus-qs preds succs characters]} ordered-graph
-        [crossings marked] (->> (map #(count-and-mark-crossings
-                                       %1 %2 preds succs characters)
-                                     minus-ps minus-qs)
-                                (apply map vector))]
-    (map->CountedAndMarkedGraph (assoc ordered-graph
-                                       :crossings (reduce + crossings)
-                                       :marked (reduce set/union marked)))))
+(def count-and-mark-crossings
+  ^{:doc "Takes an OrderedGraph, counts edge crossings and marks edges that should not
+         be drawn straight, and returns a new graph with this information. Memoized."}
+  (memoize
+   (fn [ordered-graph]
+     (let [{:keys [minus-ps minus-qs preds succs characters]} ordered-graph
+           [crossings marked] (->> (map #(count-and-mark-crossings-layer
+                                          %1 %2 preds succs characters)
+                                        minus-ps minus-qs)
+                                   (apply map vector))]
+       {:crossings (reduce + crossings)
+        :marked (reduce set/union marked)}))))

 (defn best-ordering
   "Chooses the graph with the fewest crossings from a collection of OrderedGraphs"
   [ordered-graphs]
-  (->> (map OrderedGraph->CountedAndMarkedGraph ordered-graphs)
-       (sort-by (fn [g]
-                  [(:crossings g)
-                   (reduce #(+ %1 (:weight %2)) 0 (:marked g))]))
+  (->> ordered-graphs
+       (sort-by (fn [og]
+                  (let [{:keys [crossings marked]} (count-and-mark-crossings og)]
+                    [crossings (reduce #(+ %1 (:weight %2)) 0 marked)])))
        first))

@@ -586,16 +582,17 @@
                                      (-> ordered-layer :items flatten)))))

-(defn CountedAndMarkedGraph->FlatGraph
+(defn OrderedGraph->FlatGraph
   "Transforms each OrderedLayer into a FlatLayer, and calculates attributes
   that are useful for organizing Nodes and Segments into horizontally-aligned
   blocks"
-  [cm-graph]
-  (let [{:keys [layers succs preds marked crossings characters]} cm-graph
-        cm-layers (mapv OrderedLayer->FlatLayer layers)
-        [aboves belows] (apply map merge (map neighborify cm-layers))
-        [top-idxs bot-idxs] (apply map merge (map indexify cm-layers))]
-    (map->FlatGraph {:layers cm-layers
+  [ordered-graph]
+  (let [{:keys [layers succs preds characters]} ordered-graph
+        {:keys [crossings marked]} (count-and-mark-crossings ordered-graph)
+        flat-layers (mapv OrderedLayer->FlatLayer layers)
+        [aboves belows] (apply map merge (map neighborify flat-layers))
+        [top-idxs bot-idxs] (apply map merge (map indexify flat-layers))]
+    (map->FlatGraph {:layers flat-layers
                      :succs succs
                      :preds preds
                      :aboves aboves
@@ -607,6 +604,6 @@
                      :characters characters})))

-(def SparseGraph->FlatGraph (comp CountedAndMarkedGraph->FlatGraph
+(def SparseGraph->FlatGraph (comp OrderedGraph->FlatGraph
                                   best-ordering
                                   SparseGraph->ordered-graphs))


Add LED Techno Strobe, fix RGB strobe channel.

--- src/afterglow/fixtures/chauvet.clj
+++ src/afterglow/fixtures/chauvet.clj
@@ -3,6 +3,23 @@
   {:doc/format :markdown}
   (:require [afterglow.channels :as chan]
             [afterglow.effects.channel :refer [function-value-scaler]]))
+
+(defn led-techno-strobe
+  "[LED Techno Strobe](http://www.chauvetlighting.com/led-techno-strobe.html)
+  strobe light."
+  {:doc/format :markdown
+   :author "James Elliott"}
+  []
+  {:channels [(chan/functions :control 1
+                              0 {:type :intensity-control
+                                 :label "Intensity control"
+                                 :range :fixed}
+                              (range 30 209 30) "program"
+                              210 :sound-active)
+              (chan/functions :strobe 2 0 nil
+                              1 :strobe)  ; TODO: Measure speed, add scale-fn
+              (chan/dimmer 3)]  ; TODO: Manual implies this might be reversed? If so, what a pain.
+   :name "LED Techno Strobe"})

 (defn led-techno-strobe-rgb
   "[LED Techno Strobe RGB](http://www.chauvetlighting.com/led-techno-strobe-rgb.html)
@@ -25,9 +42,8 @@
               (chan/color 2 :red)
               (chan/color 3 :green)
               (chan/color 4 :blue)
-              (chan/fine-channel :speed 5
-                                 :function-name "Speed"
-                                 :var-label "fast to slow")
+              (chan/functions :strobe 5 0 nil
+                              1 :strobe)  ; TODO: Measure speed, add scale-fn
               (chan/dimmer 6)]
    :name "LED Techno Strobe RGB"})


remove debug logging

remove debug logging

--- src/clj/elephantdb/service.clj
+++ src/clj/elephantdb/service.clj
@@ -201,7 +201,7 @@
                        (let [info                   (get-readable-domain-info domains-info domain)
                              shard                  (domain/key-shard domain info key)
                              #^LocalPersistence lp  (domain/domain-data info shard)]
-                         (log-message "Direct get key " (seq key) "at shard " shard)
+                         (log-debug "Direct get key " (seq key) "at shard " shard)
                          (when-not lp
                            (throw (thrift/wrong-host-ex)))
                          (thrift/mk-value (.get lp key))


add advance message to underway renovation

--- src/clj/game/cards-agendas.clj
+++ src/clj/game/cards-agendas.clj
@@ -467,6 +467,8 @@
    "Underway Renovation"
    {:install-state :face-up
     :events {:advance {:req (req (= (:cid card) (:cid target)))
+                       :msg (msg "trash the top " (if (>= (:advance-counter (get-card state card)) 4) "2 cards" "card")
+                                 " of the Runner's Stack")
                        :effect (effect (mill :runner
                                              (if (>= (:advance-counter (get-card state card)) 4) 2 1)))}}}


add code comments

add code comments

--- src/clj_money/partitioning.clj
+++ src/clj_money/partitioning.clj
@@ -57,6 +57,11 @@
        (map #(create-table-cmd date %))))

 (defn create-partition-tables
+  "Creates the specified partition tables.
+
+  Options:
+    :silent - do not output the commands that are generated
+    :dry-run - do not execute the commands that are generated"
   [date options]
   (jdbc/with-db-connection [c (env :db)]
     (doseq [cmd (create-table-cmds date)]


add accounts-layout

add accounts-layout

--- src/clj_money/web/accounts.clj
+++ src/clj_money/web/accounts.clj
@@ -72,24 +72,29 @@
      [:td " "]]
     (map account-and-children-rows accounts)))

+(defmacro accounts-layout
+  [page-title entity-id options & content]
+  `(layout
+     ~page-title (assoc ~options :side-bar (budget-monitors ~entity-id))
+     ~@content))
+
 (defn index
   "Renders the list of accounts"
   ([entity-id] (index entity-id {}))
   ([entity-id options]
-   (layout
-     "Accounts" (assoc options :side-bar (budget-monitors entity-id))
-     (html
-       [:table.table.table-striped
-        [:tr
-         [:th.col-sm-6 "Name"]
-         [:th.col-sm-4.text-right "Balance"]
-         [:th.col-sm-2 " "]]
-        (let [groups (accounts/select-nested-by-entity-id (env :db) (Integer. entity-id))]
-          (map account-rows groups))]
-       [:a.btn.btn-primary
-        {:href (format "/entities/%s/accounts/new" entity-id)
-         :title "Click here to add a new account."}
-        "Add"]))))
+   (accounts-layout
+     "Accounts" entity-id options
+     [:table.table.table-striped
+      [:tr
+       [:th.col-sm-6 "Name"]
+       [:th.col-sm-4.text-right "Balance"]
+       [:th.col-sm-2 " "]]
+      (let [groups (accounts/select-nested-by-entity-id (env :db) (Integer. entity-id))]
+        (map account-rows groups))]
+     [:a.btn.btn-primary
+      {:href (format "/entities/%s/accounts/new" entity-id)
+       :title "Click here to add a new account."}
+      "Add"])))

 (defn- transaction-item-row
   [{:keys [transaction-id
@@ -128,29 +133,27 @@
   ([id] (show id {}))
   ([id options]
    (let [account (accounts/find-by-id (env :db) id)]
-     (layout
-       (format "Account - %s" (:name account))
-       (assoc options :side-bar (budget-monitors (:entity-id account)))
-       (html
-         [:table.table.table-striped.table-hover
-          [:tr
-           [:th.text-right "Date"]
-           [:th "Description"]
-           [:th.text-right "Amount"]
-           [:th.text-right "Balance"]
-           [:th " "]]
-          (map transaction-item-row
-               (transactions/items-by-account (env :db) id))]
-         [:a.btn.btn-primary {:href (-> (path "/entities"
-                                              (:entity-id account)
-                                              "transactions"
-                                              "new")
-                                        (query {:redirect (url-encode (format "/accounts/%s" id))})
-                                        format-url)}
-          "Add"]
-         " "
-         [:a.btn.btn-default {:href (format "/entities/%s/accounts" (:entity-id account))}
-          "Back"])))))
+     (accounts-layout
+       (format "Account - %s" (:name account)) (:entity-id account) options
+       [:table.table.table-striped.table-hover
+        [:tr
+         [:th.text-right "Date"]
+         [:th "Description"]
+         [:th.text-right "Amount"]
+         [:th.text-right "Balance"]
+         [:th " "]]
+        (map transaction-item-row
+             (transactions/items-by-account (env :db) id))]
+       [:a.btn.btn-primary {:href (-> (path "/entities"
+                                            (:entity-id account)
+                                            "transactions"
+                                            "new")
+                                      (query {:redirect (url-encode (format "/accounts/%s" id))})
+                                      format-url)}
+        "Add"]
+       " "
+       [:a.btn.btn-default {:href (format "/entities/%s/accounts" (:entity-id account))}
+        "Back"]))))

 (defn- form-fields
   "Renders the form fields for an account"
@@ -176,8 +179,8 @@
   "Renders the new account form"
   ([entity-id] (new-account entity-id {:entity-id entity-id}))
   ([entity-id account]
-   (layout
-     "New account" {}
+   (accounts-layout
+     "New account" entity-id {}
      [:div.row
       [:div.col-md-6
        [:form {:action (str "/entities/" entity-id "/accounts")
@@ -197,11 +200,11 @@
 (defn edit
   "Renders the edit form for an account"
   [id-or-account]
-  (layout
-    "Edit account" {}
-    (let [account (if (map? id-or-account)
-                    id-or-account
-                    (accounts/find-by-id (env :db) (Integer. id-or-account)))]
+  (let [account (if (map? id-or-account)
+                  id-or-account
+                  (accounts/find-by-id (env :db) (Integer. id-or-account)))]
+    (accounts-layout
+      "Edit account" (:entity-id account) {}
       [:div.row
        [:div.col-md-6
         [:form {:action (format "/accounts/%s" (:id account))


Scroll ac results into view when moving up

--- src/cljs/clojuredocs/anim.cljs
+++ src/cljs/clojuredocs/anim.cljs
@@ -37,8 +37,7 @@

 (defn scroll-into-view
   [elem & [opts]]
-  (dom/scroll-into-view elem false)
-  #_(let [elem (node elem)
+  (let [elem (node elem)
         {:keys [top bottom]} (dom/bounding-client-rect elem)]
     (when (or (< js/window.innerHeight
                 (+ top (.-offsetHeight elem)))


Add preliminary support for body requests, adds parameters as body or url-query

--- src/googlica/core.clj
+++ src/googlica/core.clj
@@ -27,16 +27,34 @@
   "Generates the ns declaration for an API.
   Takes name, version, description and docs link, all strings."
   [name version desc docs-link]
-  `(ns
+  `(~'ns
     ~(symbol (str "googlica." name "." version)) ;; HACK: instead of having the ns as string, we should probably read it from the current one
     ~(str desc "\n\nDocumentation link: " docs-link)
     (:gen-class)
-    (:require [clj-http.client :as http])))
+    (:require [clj-http.client :as http]
+              [clojure.string :as str])))

+;; TODO move util generation to another function or a dedicated namespace
 (defn generate-global-vars
   "Generates global variables that are used throughout the generated namespace"
   [root-url service-path]
-  `[(def base-url ~(str root-url service-path))])
+  `[(def ~'base-url ~(str root-url service-path))
+    (def ~'*api-key* nil)
+    ~'(defn ?assoc
+        "Same as assoc, but skip the assoc if v is nil"
+        [m & kvs]
+        (->> kvs
+             (partition 2)
+             (filter second)
+             (map vec)
+             (into m)))
+    ~'(defn body->get-params
+        [b]
+        (str "?" (str/join "&"
+                           (mapv (fn [[k v]]
+                                   (str k "=" v)) ;;TODO urlencode
+                                 b))))])
+

 (defn split-required-params
   "Returns a vector of two maps: first with the required params, second with the optional"
@@ -101,12 +119,29 @@
   "Generates the request map to be passed to the http library.
   NB: uses the `base-url` symbol, it should be generated in the ns including the method."
   [http-method path parameters]
-  {:method (-> http-method str/lower-case keyword)
-   :url `(str base-url ~@(generate-path path parameters))})
+  (let [query-params (->> parameters
+                          (filter (fn [[_ v]] (= (:location v) "query")))
+                          (mapv   (fn [[k _]] (name k))))
+        body `(~'?assoc ~'{"key" *api-key*}
+               ~@(mapcat (fn [p] [p (->kebab-case-symbol p)]) query-params))
+        method (-> http-method str/lower-case keyword)
+        query-params-str (if (= method :post)
+                           ""
+                           `(~'body->get-params ~body))
+        base-request {:method method
+                      :url `(~'str ~'base-url
+                             ~@(generate-path path parameters)
+                             ~query-params-str)}]
+    (if (= method :post)
+      (assoc base-request
+             :content-type "application/json"
+             :body body)
+      base-request)))
+

 (defn generate-function-from-method
   [{:keys [id httpMethod parameters path parameterOrder] :as method}]
-  `(defn ~(generate-function-name id)
+  `(~'defn ~(generate-function-name id)
      ~(generate-docs method)
      ~(generate-args parameters parameterOrder)
      (http/request ~(generate-request httpMethod path parameters))))


Update basement agent config.

Update basement agent config.

--- metlog-agent/basement-config.clj
+++ metlog-agent/basement-config.clj
@@ -1,4 +1,8 @@
-(def vault-url "http://dunitall.com:8080/data")
+;; config.clj
+;;
+;; Custom configuration goes here
+
+(def vault-url "http://metrics.mschaef.com/data")

 (defn constrain-sensor-range [ sensor-val low high ]
   (and sensor-val
@@ -12,41 +16,41 @@
     (and (= 200 (:status response))
          body)))

-(defn read-wunderground-temp [ key location ]
-  (let [body (request-json (str "http://api.wunderground.com/api/" key "/conditions/q/" location ".json"))]
-    (and body
-         (let [obv (get body "current_observation")]
-           {:temp-c (ensure-number (get obv "temp_c" false))
-            :pressure-in (ensure-number (get obv "pressure_in" false))
-            :wind-degrees (ensure-number (get obv "wind_degrees" false))
-            :wind-mph  (ensure-number (get obv "wind_mph" false))
-            :wind-gust-mph (ensure-number (get obv "wind_gust_mph" false))
-            :relative-humidity (try-parse-percentage (get obv "relative_humidity" false))
-            :precip-1hr-in (ensure-number (get obv "precip_1hr_in" false))
-            :precip-today-in (ensure-number (get obv "precip_today_in" false))}))))
-
 (defn read-w1-sensor-at-path [ sensor-path ]
   (with-open [rdr (jio/reader sensor-path)]
     (let [ line (second (line-seq rdr)) ]
       (and (not (nil? line))
            (/ (Double/valueOf (.substring line 29)) 1000.0)))))

-(defsensor "upstairs-temp-f" {:poll-interval (minutes 1)}
-   (let [body (request-json "http://192.168.1.150/tstat")]
-     (and body
-        (constrain-sensor-range (ensure-number (get body "temp" false)) 20 120))))
+(defsensor "phl-basement-temp" {:poll-interval (seconds 15)}
+  (read-w1-sensor-at-path "/sys/bus/w1/devices/28-0000068f7d15/w1_slave"))

-(defsensor "upstairs-humidity" {:poll-interval (minutes 1)}
-   (let [body (request-json "http://192.168.1.150/tstat/humidity")]
+(defsensor "phl-basement-window-frame" {:poll-interval (seconds 15)}
+  (read-w1-sensor-at-path "/sys/bus/w1/devices/28-0000068f415f/w1_slave"))
+
+(defsensor "phl-downstairs-humidity" {:poll-interval (minutes 1)}
+   (let [body (request-json "http://10.0.0.150/tstat/humidity")]
      (and body
         (ensure-number (get body "humidity" false)))))

-(defsensor "basement-temp"
-  (read-w1-sensor-at-path "/sys/bus/w1/devices/28-00000690f5b9/w1_slave"))
-
-(defsensor "weather-19096" {:poll-interval (minutes 15)}
-   (read-wunderground-temp "965408b79c41f708" "19096"))
+(defsensor "phl-upstairs-humidity" {:poll-interval (minutes 1)}
+   (let [body (request-json "http://10.0.0.151/tstat/humidity")]
+     (and body
+        (ensure-number (get body "humidity" false)))))

-(defsensor "weather-08226" {:poll-interval (minutes 15)}
-   (read-wunderground-temp "965408b79c41f708" "08226"))
+(defn poll-ct-80 [ url ]
+  (let [body (request-json url)]
+    (and body
+         (->
+          {:temp-f (constrain-sensor-range (ensure-number (get body "temp" false)) 20 120)
+           :tmode (ensure-number (get body "tmode" false))
+           :fmode (ensure-number (get body "fmode" false))
+           :cool-setpoint-f (or (ensure-number (get body "t_cool" false)) -1)
+           :heat-setpoint-f (or (ensure-number (get body "t_heat" false)) -1)}))))

+(defsensor "phl-downstairs" {:poll-interval (minutes 1)}
+  (poll-ct-80 "http://10.0.0.150/tstat"))
+
+(defsensor "phl-upstairs" {:poll-interval (minutes 1)}
+  (poll-ct-80 "http://10.0.0.151/tstat"))
+


CAS with DDL stored procedure

CAS with DDL stored procedure

--- src/jepsen/voltdb.clj
+++ src/jepsen/voltdb.clj
@@ -218,6 +218,11 @@
                              PRIMARY KEY (id)
                              );
                              PARTITION TABLE registers ON COLUMN id;")
+                   (sql-cmd! "CREATE PROCEDURE registers_cas
+                               PARTITION ON TABLE registers COLUMN id
+                             AS
+                               UPDATE registers SET value = ?
+                               WHERE id = ? AND value = ?;")
                    (info node "table created")))
            (client conn)))

@@ -238,9 +243,10 @@
                         (assoc op :type :ok))
              :cas   (let [[v v'] value
                           res (-> conn
-                                  (ad-hoc! "UPDATE registers SET value = ?
-                                           WHERE id = ? AND value = ?"
-                                           v' id v)
+                                  (call! "registers_cas" v' id v)
+;                                  (ad-hoc! "UPDATE registers SET value = ?
+;                                           WHERE id = ? AND value = ?"
+;                                           v' id v)
                                   first
                                   :rows
                                   first


+TODO

+TODO

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -413,7 +413,8 @@

         ]
     (cond
-
+      ;; TODO: replace with articles.edn or similar rather than
+      ;; a big clojure (cond).
       (and (= a "gli")
            (string? (get-in b '(:italiano)))
            (not (or (re-find #"^[aeiou]" (get-in b '(:italiano)))


[scamp] comment core 'ns

[scamp] comment core 'ns

--- modules/scamp/src/scamp/core.clj
+++ modules/scamp/src/scamp/core.clj
@@ -1,4 +1,17 @@
 (ns scamp.core
+  "Implement Gossip cluster membership protocol defined in \"Peer-to-Peer Membership Management
+  for Gossip-Based Protocols\".
+  SCAMP = SCAlable Membership Protocol
+  https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/ieee_tocs.pdf
+
+  TODO:
+    * DONE: subscription (§2.2.1, Algorithm 1)
+    * DONE: subscription (§2.2.1, Algorithm 2)
+    * DONE: unsubscription (§2.2.2)
+    * heartbeats (§2.2.3) (partially done, first async feature because depends on concept of \"a long time\")
+    * subscription indirection (§3.1)
+    * lease mechanism (§3.2)
+  "
   (:require [clojure.string :as str]
             [taoensso.timbre :as timbre]
             [schema.core :as s]))


Added defnail macro

Added defnail macro

--- src/de/kotka/gorilla/nails.clj
+++ src/de/kotka/gorilla/nails.clj
@@ -27,33 +27,38 @@
   (:import
      com.martiansoftware.nailgun.NGContext))

-(gen-class
-  :name    de.kotka.gorilla.nails.DocLookup
-  :prefix  DocLookup-
-  :methods [#^{:static true}
-            [nailMain [com.martiansoftware.nailgun.NGContext] void]]
-  :main    false)
+(defmacro defnail
+  "Define a new Nail of the given name. A suitable class with the
+  .nailMain method is generated. The arguments is a command line
+  arguments specification vector suitable for with-command-line.
+  The body will be installed as the body .nailMain method with the
+  command-line arguments available according to the specification
+  and the nailgun context as 'nailContext'."
+  [nail usage arguments & body]
+  `(do
+     (gen-class
+       :name    ~(symbol (str "de.kotka.gorilla.nails." (name nail)))
+       :prefix  ~(symbol (str (name nail) "-"))
+       :methods [#^{:static true}
+                 [~'nailMain [com.martiansoftware.nailgun.NGContext] ~'void]]
+       :main    false)

-(defn DocLookup-nailMain
-  [#^NGContext context]
-  (with-command-line (.getArgs context)
-    "Usage: ng de.kotka.gorilla.nails.DocString [options] [--] symbol ..."
-    [[namespace n "Lookup the symbols in the given namespace." "user"]
-     symbols]
-    (binding [*out* (-> context .out java.io.OutputStreamWriter.)]
-      (print (doc-lookup namespace symbols))
-      (flush))))
+     (defn ~(symbol (str (name nail) "-nailMain"))
+       ~usage
+       [~(with-meta 'nailContext {:tag 'NGContext})]
+       (with-command-line (.getArgs ~'nailContext)
+         ~usage
+         ~arguments
+         ~@body))))

-(gen-class
-  :name    de.kotka.gorilla.nails.NamespaceInfo
-  :prefix  NamespaceInfo-
-  :methods [#^{:static true}
-            [nailMain [com.martiansoftware.nailgun.NGContext] void]]
-  :main    false)
+(defnail DocLookup
+  "Usage: ng de.kotka.gorilla.nails.DocString [options] [--] symbol ..."
+  [[namespace n "Lookup the symbols in the given namespace." "user"]
+   symbols]
+  (print (doc-lookup namespace symbols))
+  (flush))

-(defn NamespaceInfo-nailMain
-  [#^NGContext context]
-  (with-command-line (.getArgs context)
-    "Usage: ng de.kotka.gorilla.nails.NamespaceInfo namespace ..."
-    [namespaces]
-    (println (clj->vim (map #(-> % symbol find-ns ns-info) namespaces)))))
+(defnail NamespaceInfo
+  "Usage: ng de.kotka.gorilla.nails.NamespaceInfo [--] namespace ..."
+  [namespaces]
+  (println (clj->vim (map #(-> % symbol find-ns ns-info) namespaces))))


one more

one more

--- test/clj/just_married/api/rvsp_test.clj
+++ test/clj/just_married/api/rvsp_test.clj
@@ -23,9 +23,7 @@
                           :comment  "My comment"
                           :coming   true}
           ;; bit of a hack to get transform the data
-          params-from-db (dissoc (assoc params
-                                        :how_many 3
-                                        :coming true)
+          params-from-db (dissoc (assoc params :how_many 3)
                                  :how-many)

           response (sut/rvsp! {:json-params params})]


Please cljfmt

Please cljfmt

--- test/desdemona/jobs/sample_job_test.clj
+++ test/desdemona/jobs/sample_job_test.clj
@@ -31,7 +31,7 @@
     (is (= expected-catalog-names
            (map :onyx/name catalog)))
     (is (= "test1"
-           ((find-task catalog :read-lines) :kafka/topic) ))
+           ((find-task catalog :read-lines) :kafka/topic)))
     (is (thrown? Exception ((find-task catalog :doesnt-exist) :kafka/topic)))
     (is (= :logLines
            ((find-task catalog :write-lines) :sql/table)))


implement date time handling

implement date time handling

--- src/metabase/driver/crate.clj
+++ src/metabase/driver/crate.clj
@@ -4,8 +4,33 @@
             [metabase.driver.generic-sql.query-processor :as qp]
             (korma [core :as k])
             [korma.sql.engine :as kengine]
-            [korma.sql.fns :as kfns])
-  (:import (clojure.lang Named)))
+            [korma.sql.fns :as kfns]
+            [metabase.util.korma-extensions :as kx]
+            [korma.sql.utils :as kutils]
+            [clj-time.format :as f]
+            [clj-time.coerce :as c]
+            [clj-time.core :as t])
+  (:import (clojure.lang Named)
+           (java.sql Timestamp)))
+
+
+(defn- column->base-type
+  "Map of Postgres column types -> Field base types.
+   Add more mappings here as you come across them."
+  [_ column-type]
+  ({:integer   :IntegerField
+    :string    :TextField
+    :boolean   :BooleanField
+    :byte      :IntegerField
+    :short     :IntegerField
+    :long      :BigIntegerField
+    :float     :FloatField
+    :double    :FloatField
+    :ip        :UnknownField
+    :timestamp :DateTimeField
+    :geo_point :UnknownField
+    :geo_shape :UnknownField
+    } column-type))

 ;; # Adapt generic SQL to Crate SQL

@@ -15,6 +40,7 @@
   {:pre [(map? filter) field]}
   (let [field (qp/formatted field)]
     {field (case          filter-type
+             ;; TODO: implement Crate equivalent for "BETWEEN"
              :between     ['between [(qp/formatted (:min-val filter)) (qp/formatted (:max-val filter))]]
              :starts-with ['like (qp/formatted (update value :value (fn [s] (str    s \%)))) ]
              :contains    ['like (qp/formatted (update value :value (fn [s] (str \% s \%))))]
@@ -38,24 +64,68 @@
   [_ korma-form {clause :filter}]
   (k/where korma-form (filter-clause->predicate clause)))

+(defn- convert-to-isotime
+  "Prints datetime as ISO time"
+  [sql-time format]
+  (if (= (instance? Timestamp sql-time) true)
+    (f/unparse (f/formatters format)
+               (t/from-time-zone (c/from-sql-time sql-time)
+                                 (t/time-zone-for-offset -2)))
+    sql-time))

-(defn- column->base-type
-  "Map of Postgres column types -> Field base types.
-   Add more mappings here as you come across them."
-  [_ column-type]
-  ({:integer   :IntegerField
-    :string    :TextField
-    :boolean   :BooleanField
-    :byte      :UnknownField
-    :short     :UnknownField
-    :long      :BigIntegerField
-    :float     :FloatField
-    :double    :FloatField
-    :ip        :UnknownField
-    :timestamp :DateTimeField
-    :geo_point :UnknownField
-    :geo_shape :UnknownField
-    } column-type))
+(defn- unix-timestamp->timestamp [_ expr seconds-or-milliseconds]
+  "Converts datetime string to a valid timestamp"
+  (kutils/func (format "TRY_CAST('%s' as TIMESTAMP)" seconds-or-milliseconds) [expr]))
+
+(defn- date-trunc [unit expr]
+  "date_trunc('interval', timestamp): truncates a timestamp to a given interval"
+  (k/sqlfn :DATE_TRUNC (kx/literal unit) expr))
+
+(defn- extract    [unit expr]
+  "extract(field from expr): extracts subfields of a timestamp"
+  (kutils/func (format "EXTRACT(%s FROM %%s)" (name unit)) [expr]))
+
+(def ^:private extract-integer
+  (comp kx/->integer extract))
+
+(defn- date [_ unit expr]
+  (case unit
+    :default         (kx/->timestamp expr)
+    :minute          (date-trunc :minute expr)
+    :minute-of-hour  (extract-integer :minute expr)
+    :hour            (date-trunc :hour expr)
+    :hour-of-day     (extract-integer :hour expr)
+    :day             (date-trunc :day (convert-to-isotime expr :date-hour-minute-second))
+    :day-of-week     (extract-integer :day_of_week expr)
+    :day-of-month    (extract-integer :day_of_month expr)
+    :day-of-year     (extract-integer :day_of_year expr)
+    :week            (date-trunc :week expr)
+    :week-of-year    (extract-integer :week expr)
+    :month           (date-trunc :month expr)
+    :month-of-year   (extract-integer :month expr)
+    :quarter         (date-trunc :quarter expr)
+    :quarter-of-year (extract-integer :quarter expr)
+    :year            (extract-integer :year expr)))
+
+
+(def ^:private now (k/sqlfn :CURRENT_TIMESTAMP (k/raw 3)))
+
+(def ^:private YEAR (constantly 31536000000))
+(def ^:private MONTH (constantly 2628000000))
+(def ^:private WEEK (constantly 604800000))
+(def ^:private DAY (constantly 86400000))
+
+(defn- sql-interval [unit amount]
+  (format "CURRENT_TIMESTAMP + %d" (* (unit) amount)))
+
+(defn- date-interval [_ unit amount]
+  "defines the sql command required for date-interval calculation"
+  (case unit
+    :quarter (recur nil :month (kx/* amount 3))
+    :year (k/raw (sql-interval YEAR amount))
+    :month (k/raw (sql-interval MONTH amount))
+    :week (k/raw (sql-interval WEEK amount))
+    :day (k/raw (sql-interval DAY amount))))

 (defrecord CrateDriver []
   Named
@@ -86,7 +156,10 @@
          {:connection-details->spec  connection-details->spec
           :column->base-type         column->base-type
           :string-length-fn          (constantly :CHAR_LENGTH)
-          :apply-filter              apply-filter}))
+          :apply-filter              apply-filter
+          :date                      date
+          :unix-timestamp->timestamp unix-timestamp->timestamp
+          :current-datetime-fn       (constantly now)}))

 (extend CrateDriver
   driver/IDriver
@@ -98,7 +171,8 @@
                                         :display-name "Port"
                                         :type         :integer
                                         :default      4300}])
-          :can-connect?  can-connect})
+          :can-connect?  can-connect
+          :date-interval date-interval})
   sql/ISQLDriver CrateISQLDriverMixin)

 (driver/register-driver! :crate (CrateDriver.))


remove satisfied TODO

remove satisfied TODO

--- src/clj/backtype/storm/testing.clj
+++ src/clj/backtype/storm/testing.clj
@@ -208,7 +208,6 @@
   `(with-simulated-time
     (with-local-cluster ~@args)))

-;; TODO: should take in a port symbol and find available port automatically
 (defmacro with-inprocess-zookeeper [port-sym & body]
   `(with-local-tmp [tmp#]
      (let [[~port-sym zks#] (zk/mk-inprocess-zookeeper tmp#)]


pushed documentation for pixel generator.

--- src/clj/forma/hadoop/predicate.clj
+++ src/clj/forma/hadoop/predicate.clj
@@ -23,6 +23,11 @@
 ;; ### Generators

 (defn pixel-generator
+  "Returns a cascalog generator that produces every pixel combination
+  for the supplied sequence of tiles, given the supplied
+  resolution. `pixel-generator` works by first writing every tuple to
+  a sequencefile in a temp directory on the distributed filesystem,
+  then returning a tap into its guts."
   [res tileseq]
   (let [tmpdir (.getAbsolutePath (io/temp-dir "tuples"))
         tap (hfs-seqfile tmpdir)]


Evaluate custom prompt when it's a form

Evaluate custom prompt when it's a form

(as it is when entered via CLI arguments)

--- src/clj/reply/eval_modes/nrepl.clj
+++ src/clj/reply/eval_modes/nrepl.clj
@@ -155,8 +155,11 @@
     (swap! response-queues assoc
            session (LinkedBlockingQueue.)
            completion-session (LinkedBlockingQueue.))
-    (let [options (assoc options :prompt
-                    (fn [ns] (str ns "=> ")))
+    (let [custom-prompt (:custom-prompt options)
+          options (assoc options :prompt
+                         (cond (fn? custom-prompt) custom-prompt
+                               (seq? custom-prompt) (eval custom-prompt)
+                               :else (fn [ns] (str ns "=> "))))
           options (if (:color options)
                     (merge options nrepl.cmdline/colored-output)
                     options)


implement put-string in terms of put-chars

--- src/clj/robinson/swingterminal.clj
+++ src/clj/robinson/swingterminal.clj
@@ -293,10 +293,9 @@
                                                (assoc! line x character))
                                              line)))
                                        line
-                                       (map-indexed vector s)))]
-              (swap! character-map
-                (fn [cm]
-                  (assoc cm row new-line))))))
+                                       (map-indexed vector s)))
+                  characters (map-indexed  (fn [i c] {:c (str c) :fg fg :bg bg :x (+ col i) :y row}) string)]
+              (put-chars this characters))))
         (put-chars [this characters]
           (swap! character-map
             (fn [cm]


Now prints character sheet on demand.

Now prints character sheet on demand.

--- src/hphelper/scengen/print.clj
+++ src/hphelper/scengen/print.clj
@@ -62,26 +62,36 @@

 (defn- html-print-player-sheet
   "Prints a single player sheet in a html format"
-  [player]
+  [scenRec player]
+  (log/trace "Printing player sheet for: " player)
   (html [:div
+         (if (player :printSheet)
+           [:div (cgen/html-print-sheet player)]
+           "")
          [:div [:h3 "Welcome " (player :name)]]
          ;; TODO Indicies
          ;; TODO News
          [:div [:b "Message summary follows:"]]
+         [:div (map html-print-single-society-mission
+                    (filter (fn [mission]
+                              (some #{(mission :ss_id)}
+                                    (map :ss_id
+                                         (get player "Program Group"))))
+                            (scenRec :societies)))]
          ]
         ))

 (defn- html-print-player-sheets
   "Prints all the player's sheets, and possibly their character sheets, in a html format"
   [scenRec]
-  ;(map html-print-player-sheet (scenRec :hps))
+  (map (comp (partial html-print-player-sheet scenRec) second) (scenRec :hps))
   )

 (defn html-print-scenario
   "Prints a scenario in html format"
   [scenRec]
   (html [:div
-         [:div "DEBUG: " (str scenRec)]
+         ;[:div "DEBUG: " (str scenRec)] ;; Prints out the entire map for debugging
          (html-print-crisises scenRec)
          (html-print-directive-summary scenRec)
          (html-print-ssm-summary scenRec)


Extended example msc definition

Extended example msc definition

to return an EL expression when possible.

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

--- src/conexp/contrib/dl/examples.clj
+++ src/conexp/contrib/dl/examples.clj
@@ -50,6 +50,13 @@
 (def ext-dl-exp (dl-expression SimpleDL [some-tbox, Grandfather]))
 (def ext-dl-exp-2 (dl-expression SimpleDL (and [some-tbox, Grandfather])))

+(define-msc SimpleDL
+  [model objects]
+  (let [[tbox target] (reduce-tbox (apply EL-gfp-msc model objects))]
+    (if (= 1 (count (tbox-definitions tbox)))
+      (definition-expression (first (tbox-definitions tbox)))
+      [tbox target])))
+
 ;;;

 ;;;


Improve checks on board patch: can't change board access to private or public if not on premium. Keep into consideration the disallow-public-board setting too.

--- src/oc/storage/api/boards.clj
+++ src/oc/storage/api/boards.clj
@@ -98,20 +98,36 @@
         [false, {:reason (.getMessage e)}])) ; Not a valid new board
     [false, {:reason :invalid-org}])) ; couldn't find the specified org

-(defn- valid-board-update? [conn org-slug slug board-props]
-  (if-let* [org (org-res/get-org conn org-slug)
-            board (board-res/get-board conn (:uuid org) slug)
-            board-data (dissoc board-props :private-notifications :note)]
-    (if (and (:disallow-public-board (or (:content-visibility org) {}))
-             (not= (:access board-data) "public")
-             (= (:access board-data) "public"))
-      [false, {:reason :disallowed-public-board}]
-      (let [updated-board (merge board (board-res/clean board-data))]
+(defn- valid-board-access-update?
+  "If changing access of a board, make sure the change is allowed:
+   - no public boards if disallowed by org settings
+   - no private or public boards if not on premium."
+  [premium? disallow-public-board original-access updating-access]
+  (if (= original-access updating-access)
+    true
+    (let [public-access-check (or (not disallow-public-board)
+                                  (not= updating-access "public"))
+          premium-access-check (or premium?
+                                   (= updating-access "team"))]
+      (and public-access-check
+           premium-access-check))))
+
+(defn- valid-board-update? [conn org-slug slug ctx]
+  (if-let* [updating-board (-> ctx
+                               :data
+                               (dissoc :private-notifications :note))
+            org (org-res/get-org conn org-slug)
+            original-board (board-res/get-board conn (:uuid org) slug)]
+    ;; Check public board change
+    (if (valid-board-access-update? (:premium? ctx) (:disallow-public-board (:content-visibility org))
+                                    (:access original-board) (:access updating-board))
+      [false, {:reason :board-access-not-allowed}]
+      (let [updated-board (merge original-board (board-res/clean updating-board))]
         (if (lib-schema/valid? common-res/Board updated-board)
           {:existing-org (api-common/rep org)
-           :existing-board (api-common/rep board)
+           :existing-board (api-common/rep original-board)
            :board-update (api-common/rep updated-board)
-           :notifications (api-common/rep (:private-notifications board-props))}
+           :notifications (api-common/rep (:private-notifications updating-board))}
           [false, {:board-update (api-common/rep updated-board)}]))) ; invalid update
     true)) ; No org or board, so this will fail existence check later

@@ -314,7 +330,7 @@
     :get true
     :patch (fn [ctx] (and (slugify/valid-slug? org-slug)
                           (slugify/valid-slug? slug)
-                          (valid-board-update? conn org-slug slug (:data ctx))))
+                          (valid-board-update? conn org-slug slug ctx)))
     :delete true})

   ;; Existentialism


Remove WIP commit from other branch

Remove WIP commit from other branch

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


Removing the special case polygons from the general spatial search test.


CMR-822: Cleanup in response to code review

--- test/cmr/system_int_test/search/parameter_type_validation_test.clj
+++ test/cmr/system_int_test/search/parameter_type_validation_test.clj
@@ -3,34 +3,28 @@
    level due to the tendency for pre-validation code to make assumptions about the
    shape of parameters."
   (:require [clojure.test :refer :all]
-            [cmr.system-int-test.utils.ingest-util :as ingest]
-            [cmr.system-int-test.utils.search-util :as search]
-            [cmr.system-int-test.utils.index-util :as index]
-            [cmr.system-int-test.data2.collection :as dc]
-            [cmr.system-int-test.data2.core :as d]
-            [cmr.search.data.keywords-to-elastic :as k2e]))
+            [cmr.system-int-test.utils.search-util :as search]))

 (defn- is-bad-request?
   "Returns true if the given response returns a 400 error with the given error strings"
   [response expected-errors]
   (is (= 400 (:status response)))
-  (is (= expected-errors (:errors response))))
+  (is (= (sort expected-errors) (sort (:errors response)))))

-(defmacro test-map-type
+(defn- test-map-type
   "Runs tests that the given parameter works for searches on the given concept id using
     the valid example map and produces errors non-map values.  other-params is an optional
     map (or maps) of other parameters to send with the query."
   [concept-type name valid-example-map & other-params]
-  `(do
-     (testing (str "querying with " ~name " as a single value returns an error")
-       (let [response# (search/find-refs ~concept-type (into {~name "a"} (list ~@other-params)))]
-         (is-bad-request? response# [(str "Parameter [" ~name "] must contain a map.")])))
-     (testing (str "querying with " ~name " as a list returns an error")
-       (let [response# (search/find-refs ~concept-type (into {~name ["a" "b"]} (list ~@other-params)))]
-         (is-bad-request? response# [(str "Parameter [" ~name "] must contain a map.")])))
-     (testing (str "querying with " ~name " as a map succeeds")
-       (let [response# (search/find-refs ~concept-type (into {~name ~valid-example-map} (list ~@other-params)))]
-         (is (nil? (:errors response#)))))))
+  (testing (str "querying with " name " as a single value returns an error")
+    (let [response (search/find-refs concept-type (into {name "a"} other-params))]
+      (is-bad-request? response [(str "Parameter [" name "] must contain a map.")])))
+  (testing (str "querying with " name " as a list returns an error")
+    (let [response (search/find-refs concept-type (into {name ["a" "b"]} other-params))]
+      (is-bad-request? response [(str "Parameter [" name "] must contain a map.")])))
+  (testing (str "querying with " name " as a map succeeds")
+    (let [response (search/find-refs concept-type (into {name valid-example-map} other-params))]
+      (is (nil? (:errors response))))))

 (deftest parameter-type-validations
   (test-map-type :collection "options" {:entry-title {:pattern "true"}})


stop removing text when you hit enter

stop removing text when you hit enter

--- src/pathfinder/ui/render.cljs
+++ src/pathfinder/ui/render.cljs
@@ -23,12 +23,11 @@
                       (fn [evt]
                         (when (enter-key? evt)
                           (let [v (.-value (.-target evt))]
-                            (am/go (a/>! submit-ch v))
-                            (set! (.-value (.-target evt)) ""))))
+                            (am/go (a/>! submit-ch v)))))
                       :autoFocus true})))

 (q/defcomponent Code-block
-  :on-mount #(.highlightBlock js/hljs %)
+  :on-render #(.highlightBlock js/hljs %)
   [source]
   (d/pre nil (d/code nil source)))


remove whitespace

remove whitespace

--- src/meta/promise.cljs
+++ src/meta/promise.cljs
@@ -62,10 +62,10 @@

 (extend-protocol IPromise
   js/Promise
-  (then    [promise callback]   (.then    promise callback))
-  (catch   [promise callback]   (.catch   promise callback))
-  (log     [promise]            (.then    promise #(.log js/console %)))
-  (err     [promise]            (.catch   promise #(.error js/console %)))
-  (map     [promise func]       (.then    promise #(cljs.core/map func %)))
-  (conj    [promise data]       (.then    promise #(cljs.core/conj % data))))
+  (then    [promise callback]   (.then  promise callback))
+  (catch   [promise callback]   (.catch promise callback))
+  (log     [promise]            (.then  promise #(.log js/console %)))
+  (err     [promise]            (.catch promise #(.error js/console %)))
+  (map     [promise func]       (.then  promise #(cljs.core/map func %)))
+  (conj    [promise data]       (.then  promise #(cljs.core/conj % data))))
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Removed obsolete code.

Removed obsolete code.

--- src/fm/simrunner/gui/rendering.clj
+++ src/fm/simrunner/gui/rendering.clj
@@ -26,15 +26,8 @@
 (defn- render [{render-tasks :render-tasks :as ui}]
   ((apply comp (reverse (tbf/staged render-tasks))) ui))

-(defn- drop-messages [messages rendered-messages]
-  (into [] (drop (count rendered-messages) messages)))
-
 (defn- stop-rendering [app-ui rendered-ui]
-  (let [rendered-messages (get-in rendered-ui [:model :messages])]
-    (-> app-ui
-        (assoc :rendering? false)
-        (update-in [:render-tasks] tbf/drain)
-        (update-in [:model :messages] drop-messages rendered-messages))))
+  (update-in app-ui [:render-tasks] tbf/drain))

 (defn- end [app-state ui]
   (update-in app-state [:ui] stop-rendering ui))


Add tests for IDeref to exception.

Add tests for IDeref to exception.

--- spec/cats/monad/exception_spec.cljx
+++ spec/cats/monad/exception_spec.cljx
@@ -21,6 +21,10 @@
       (s/should= 1 (exc/from-success (exc/try-on 1)))
       (s/should= e (exc/from-failure (exc/try-on (throw e))))
       (s/should= e (exc/from-failure (exc/try-on e)))))
+
+  (s/it "Test IDeref"
+    (s/should= 1 @(exc/success 1))
+    (s/should= 1 @(exc/failure 1)))

   #+cljs
   (s/it "Basic operations with cljs."


Remove dangling reference to satellite-slave.recipes.mesos

--- satellite-slave/src/satellite_slave/config.clj
+++ satellite-slave/src/satellite_slave/config.clj
@@ -16,7 +16,6 @@
   (:require [clj-time.periodic :refer [periodic-seq]]
             [clj-time.core :as t]
             [satellite-slave.recipes]
-            [satellite-slave.recipes.mesos]
             [satellite-slave.util :refer [every]]))

 (def settings


style(paredit): correct indentation

style(paredit): correct indentation

--- paredit.clj/src/paredit/core.clj
+++ paredit.clj/src/paredit/core.clj
@@ -273,7 +273,7 @@
       (.startsWith name "def")
       (.startsWith name "with")
       (.startsWith name "let")
-    (lisp-forms s))))
+      (lisp-forms s))))

 (defn inline-implementation?


Add support to pass predicate to `catch` and `error` chain functions.

--- src/promesa/core.cljc
+++ src/promesa/core.cljc
@@ -148,11 +148,14 @@
   "Catch all promise chain helper."
   ([p f]
    (pt/-catch p f))
-  ([p type f]
-   (pt/-catch p (fn [e]
-                 (if (instance? type e)
-                   (f e)
-                   (pm/rejected e))))))
+  ([p pred-or-type f]
+   (let [accept? (if (ifn? pred-or-type)
+                   pred-or-type
+                   #(instance? pred-or-type %))]
+     (pt/-catch p (fn [e]
+                    (if (accept? e)
+                      (f e)
+                      (pm/rejected e)))))))

 (defn error
   "Same as `catch` but with parameters inverted."


Make `alet` macro handle properly (asynchronously) all exceptions.

Previously, if the first expresion raises synchronous exception it will
be propagated synchronously without returning a rejected promise.

--- src/promesa/core.cljc
+++ src/promesa/core.cljc
@@ -384,8 +384,9 @@
      The `promise.core/await` is no longer necesary (it is maintained
      only for backward compatibility."
      [bindings & body]
-     (->> (reverse (partition 2 bindings))
-          (reduce (fn [acc [l r]]
-                    `(bind ~r (fn [~l] ~acc)))
-                  `(pt/-promise (do ~@body))))))
-
+     `(p/bind nil (fn [_#]
+                    ~(->> (reverse (partition 2 bindings))
+                          (reduce (fn [acc [l r]]
+                                    `(bind ~r (fn [~l] ~acc)))
+                                  `(pt/-promise (do ~@body))))))))
+


formatted

formatted

--- src/taggie_server/handler.clj
+++ src/taggie_server/handler.clj
@@ -1,20 +1,20 @@
 (ns taggie-server.handler
-	(:use
-		taggie-server.routes.subject-routes
-		taggie-server.routes.user-routes)
-	(:require
-		[compojure.core :refer :all]
-		[compojure.handler :as handler]
-		[compojure.route :as route]
-		[ring.middleware.format-params :refer [wrap-restful-params]]
-		[ring.middleware.format-response :refer [wrap-restful-response]]))
+    (:use
+        taggie-server.routes.subject-routes
+        taggie-server.routes.user-routes)
+    (:require
+        [compojure.core :refer :all]
+        [compojure.handler :as handler]
+        [compojure.route :as route]
+        [ring.middleware.format-params :refer [wrap-restful-params]]
+        [ring.middleware.format-response :refer [wrap-restful-response]]))

 (defroutes app-routes
-	(context "/api" [] subject-routes user-routes)
-	(route/not-found "Requested URL not found"))
+    (context "/api" [] subject-routes user-routes)
+    (route/not-found "Requested URL not found"))

 (def app
-	(->
-		(handler/site app-routes)
-		(wrap-restful-params)
-		(wrap-restful-response)))
+    (->
+        (handler/site app-routes)
+        (wrap-restful-params)
+        (wrap-restful-response)))


In left navbar, made any line without a panel a little greyer to emphasise Introduction and Layout panels (and turned cursor to a hand for those with panels

--- src/re_demo/core.cljs
+++ src/re_demo/core.cljs
@@ -109,26 +109,25 @@
       (let [selected?   (= @selected-tab-id (:id tab))
             is-major?  (= (:level tab) :major)
             has-panel? (some? (:panel tab))]
-      [:div
-       {:style {;:width            "150px"
-                :white-space "nowrap"
-                :line-height      "1.3em"
-                :padding-left     (if is-major? "24px" "32px")
-                :padding-top      (when is-major? "6px")
-                :font-size        (when is-major? "15px")
-                :font-weight      (when is-major? "bold")
-                :color            (when selected? "#111")
-                :border-right     (when selected? "4px #d0d0d0 solid")
-                :background-color (if (or
-                                        (= @selected-tab-id (:id tab))
-                                        @mouse-over?) "#eaeaea")}
-
-        :on-mouse-over (handler-fn (when has-panel? (reset! mouse-over? true)))
-        :on-mouse-out  (handler-fn (reset! mouse-over? false))
-        :on-click      (handler-fn (when has-panel? (on-select-tab (:id tab))))}
-       [:span
-        {:style {:cursor "default"}}    ;; removes the I-beam over the label
-        (:label tab)]]))))
+        [:div
+         {:style         {;:width            "150px"
+                          :white-space      "nowrap"
+                          :line-height      "1.3em"
+                          :padding-left     (if is-major? "24px" "32px")
+                          :padding-top      (when is-major? "6px")
+                          :font-size        (when is-major? "15px")
+                          :font-weight      (when is-major? "bold")
+                          :border-right     (when selected? "4px #d0d0d0 solid")
+                          :cursor           (if has-panel? "pointer" "default")
+                          :color            (if has-panel? (when selected? "#111") "#888")
+                          :background-color (if (or
+                                                  (= @selected-tab-id (:id tab))
+                                                  @mouse-over?) "#eaeaea")}
+
+          :on-mouse-over (handler-fn (when has-panel? (reset! mouse-over? true)))
+          :on-mouse-out  (handler-fn (reset! mouse-over? false))
+          :on-click      (handler-fn (when has-panel? (on-select-tab (:id tab))))}
+         [:span (:label tab)]]))))

 (defn left-side-nav-bar


:should-update looks at children in addition to props

--- src/re_view/core.cljs
+++ src/re_view/core.cljs
@@ -133,8 +133,8 @@
                            (aset this "$reView" "children" (aget props "cljs$children"))
                            (aset this "$reView" "prev-children" prev-children)))})
 (def base-mixin-after
-  {
-   :should-update (fn [this] (not= (:props this) (:prev-props this)))
+  {:should-update (fn [this] (or (not= (:props this) (:prev-props this))
+                                 (not= (:children this) (:prev-children this))))
    :will-unmount  #(set! (.-unmounted %) true)})

 (def reactive-mixin


use filter map instead of rethinkdb functions

--- src/oc/storage/resources/entry.clj
+++ src/oc/storage/resources/entry.clj
@@ -239,24 +239,19 @@
   {:pre [(db-common/conn? conn)
           (#{:desc :asc} order)
           (#{:before :after} direction)]}
-  (let [must-read-filter (if (nil? must-read)
-                           (r/fn [row]
-                             (r/contains allowed-boards (r/get-field row :board-uuid)))
-                           (r/fn [row]
-                             (r/and
-                              (r/contains allowed-boards
-                                          (r/get-field row :board-uuid))
-                              (r/eq
-                               (r/default (r/get-field row :must-read) false)
-                               (= must-read "true"))))
-                           )]
-  (db-common/read-resources-and-relations conn table-name
-    :status-org-uuid [[:published org-uuid]]
-    "published-at" order start direction config/default-activity-limit
-    must-read-filter
-    :interactions common/interaction-table-name :uuid :resource-uuid
-    ["uuid" "headline" "body" "reaction" "author"
-     "published-at" "created-at" "updated-at"])))
+  (let [filter-map (if (nil? must-read)
+                     [{:fn :contains :value allowed-boards :field :board-uuid}]
+                     [{:fn :contains :value allowed-boards :field :board-uuid}
+                      {:fn :eq :field :must-read :value (= must-read "true")}]
+                     )]
+    (timbre/debug filter-map)
+    (db-common/read-resources-and-relations conn table-name
+      :status-org-uuid [[:published org-uuid]]
+      "published-at" order start direction config/default-activity-limit
+      filter-map
+      :interactions common/interaction-table-name :uuid :resource-uuid
+      ["uuid" "headline" "body" "reaction" "author"
+       "published-at" "created-at" "updated-at"])))

 (schema/defn ^:always-validate list-entries-by-org-author
   "


Supply context rather than full opts to sync-fn

--- src/onyx/triggers/triggers_api.clj
+++ src/onyx/triggers/triggers_api.clj
@@ -94,7 +94,7 @@
          (let [window-metadata {:window-id window-id
                                 :lower-bound lower
                                 :upper-bound upper
-                                :opts opts}]
+                                :context (:context opts)}]
            (refine-state event trigger)
            ((:trigger/sync-fn trigger) event window trigger window-metadata state)
            (if (refinement-destructive? event trigger)


Change components in async.

Change components in async.

--- src/onyx/coordinator/async.clj
+++ src/onyx/coordinator/async.clj
@@ -22,8 +22,8 @@
     (extensions/on-delete sync pulse death-cb)
     (extensions/mark-peer-born sync peer)))

-(defn mark-peer-death [log peer]
-  (extensions/mark-peer-dead log peer))
+(defn mark-peer-death [sync pulse]
+  (extensions/mark-peer-dead sync pulse))

 (defn plan-job [log sync queue {:keys [catalog workflow]}]
   (let [tasks (planning/discover-tasks catalog workflow)
@@ -114,19 +114,19 @@
   (let [shutdown (:shutdown (extensions/read-place sync peer))]
     (extensions/delete sync shutdown)))

-(defn born-peer-ch-loop [log sync born-tail offer-head dead-head]
+(defn born-peer-ch-loop [sync born-tail offer-head dead-head]
   (loop []
     (when-let [peer (<!! born-tail)]
-      (when (mark-peer-birth log sync peer (fn [_] (>!! dead-head peer)))
+      (when (mark-peer-birth sync peer (fn [_] (>!! dead-head peer)))
         (>!! offer-head peer))
       (recur))))

-(defn dead-peer-ch-loop [log dead-tail evict-head offer-head]
-  (loop []
-    (when-let [peer (<!! dead-tail)]
-      (when (mark-peer-death log peer)
-        (>!! evict-head peer)
-        (>!! offer-head peer))
+(defn dead-peer-ch-loop [sync dead-tail evict-head offer-head]
+  (loop []
+    (when-let [pulse (<!! dead-tail)]
+      (when (mark-peer-death sync pulse)
+        (>!! evict-head pulse)
+        (>!! offer-head pulse))
       (recur))))

 (defn planning-ch-loop [log sync queue planning-tail offer-head]
@@ -381,8 +381,8 @@
         :failure-mult failure-mult
         :shutdown-mult shutdown-mult

-        :born-peer-thread (thread (born-peer-ch-loop log sync born-peer-ch-tail offer-ch-head dead-peer-ch-head))
-        :dead-peer-thread (thread (dead-peer-ch-loop log dead-peer-ch-tail evict-ch-head offer-ch-head))
+        :born-peer-thread (thread (born-peer-ch-loop sync born-peer-ch-tail offer-ch-head dead-peer-ch-head))
+        :dead-peer-thread (thread (dead-peer-ch-loop sync dead-peer-ch-tail evict-ch-head offer-ch-head))
         :planning-thread (thread (planning-ch-loop log sync queue planning-ch-tail offer-ch-head))
         :ack-thread (thread (ack-ch-loop log sync ack-ch-tail))
         :evict-thread (thread (evict-ch-loop log sync evict-ch-tail offer-ch-head shutdown-ch-head))