Visualize grouping by coloring and connecting data points.

--- src/ai_playground/client/core.cljs
+++ src/ai_playground/client/core.cljs
@@ -31,16 +31,27 @@

 (def colors ["#b58900" "#cb4b16" "#dc322f" "#d33682" "#6c71c4" "#268bd2" "#2aa198" "#859900"])

-(pm/defpartial data-point [[x y]]
-  [:svg:circle {:r 4 :cx x :cy y :stroke "#333" :fill "#fff"}])
+(defn visualize-group [data function]
+  (-> (vis/visual data)
+      (vis/elem function)
+      (vis/enter (partial dom/append (dom/query "svg")))))

-(pm/defpartial mean [[x y]]
-  [:svg:circle {:r 6 :cx x :cy y :stroke "#333" :fill (colors 1)}])
+(pm/defpartial data-point [color [x y]]
+  [:svg:circle {:r 4 :cx x :cy y :stroke "#333" :fill color}])
+
+(pm/defpartial line [[x1 y1] [x2 y2]]
+  [:svg:line {:x1 x1 :y1 y1 :x2 x2 :y2 y2 :stroke "#ccc"}])
+
+(pm/defpartial mean [[[x y] {:keys [index points]}]]
+  (let [color (nth (cycle colors) index)]
+    (visualize-group points (partial data-point color))
+    (visualize-group points (partial line [x y]))
+    [:svg:circle {:r 6 :cx x :cy y :stroke "#333" :fill color}]))

 (def points (atom []))

 (def initial-state {:next-step :init
-                    :k 3
+                    :k 10
                     :points []})
 (def state (atom initial-state))

@@ -56,7 +67,7 @@
         data (mapcat random-cluster (repeat k N))
         means (clustering/k-means k data)]
     (-> (vis/visual @points)
-        (vis/elem data-point)
+        (vis/elem (partial data-point "#fff"))
         (vis/enter (partial dom/append (dom/query "svg"))))
     (-> (vis/visual means)
         (vis/elem mean)
@@ -67,12 +78,8 @@

 (defn visualize []
   (clear-svg)
-  (-> (vis/visual (@state :points))
-      (vis/elem data-point)
-      (vis/enter (partial dom/append (dom/query "svg"))))
-  (-> (vis/visual (keys (@state :means)))
-      (vis/elem mean)
-      (vis/enter (partial dom/append (dom/query "svg")))))
+  (visualize-group (@state :points) (partial data-point "#fff"))
+  (visualize-group (@state :means) mean))

 (defn add-random-cluster []
   (swap! state (fn [{points :points :as state}]


Rename proto to protocol

Rename proto to protocol

--- src/adzerk/boot_reload/server.clj
+++ src/adzerk/boot_reload/server.clj
@@ -9,8 +9,8 @@

 (def state (atom {}))

-(defn web-path [proto rel-path tgt-path asset-path]
-  (if-not (= "file:" proto)
+(defn web-path [protocol rel-path tgt-path asset-path]
+  (if-not (= "file:" protocol)
     (if asset-path
       (string/replace rel-path (re-pattern (str "^" (string/replace asset-path #"^/" "") "/")) "")
       (str "/" rel-path))
@@ -22,19 +22,19 @@
     (http/send! channel (pr-str [:visual messages]))))

 (defn send-changed! [tgt-path asset-path changed]
-  (doseq [[id {:keys [proto channel]}] @state]
+  (doseq [[id {:keys [protocol channel]}] @state]
     (http/send! channel
-      (pr-str (into [:reload] (map #(web-path proto % tgt-path asset-path) changed))))))
+      (pr-str (into [:reload] (map #(web-path protocol % tgt-path asset-path) changed))))))

-(defn set-proto! [channel proto]
+(defn set-protocol [channel protocol]
   (doseq [[id {c :channel}] @state]
-    (when (= c channel) (swap! state assoc-in [id :proto] proto))))
+    (when (= c channel) (swap! state assoc-in [id :protocol] protocol))))

 (defn connect! [channel]
   (let [id (gensym)]
     (swap! state assoc id {:channel channel})
     (http/on-close channel (fn [_] (swap! state dissoc id)))
-    (http/on-receive channel #(set-proto! channel (read-string %)))))
+    (http/on-receive channel #(set-protocol channel (read-string %)))))

 (defn handler [request]
   (if-not (:websocket? request)


handle Marzhauser-LStep missing hyphen

handle Marzhauser-LStep missing hyphen

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

--- buildscripts/buildcheck/src/buildcheck/core.clj
+++ buildscripts/buildcheck/src/buildcheck/core.clj
@@ -290,7 +290,8 @@
                (filter #(.startsWith % "libmmgr")
                        (map #(.getName %)
                             (file-seq (File. "/Users/arthur/Programs/ImageJ"))))))
-    (disj "Stradus") (conj "Vortran")))
+    (disj "Stradus") (conj "Vortran")
+    (disj "MarzhauserLStep") (conj "Marzhauser-LStep")))

 (defn missing-unix-adapters []


working on reflexive morphology

working on reflexive morphology

--- src/babel/francais/morphology.cljc
+++ src/babel/francais/morphology.cljc
@@ -607,7 +607,7 @@
                 ]

    ;; -er and -ir type verbs
-   #"^(aeéiou\S+)es$" [;; reflexive verbs beginning with a vowel: (e.g. "s'amuser") : 2nd singular
+   #"^([aeéiou]\S+)es$" [;; reflexive verbs beginning with a vowel: (e.g. "s'amuser") : 2nd singular
                        {:replace-with "er"
                         :replace-pattern "s'$1"
                         :structure {:synsem {:subcat {:1 {:agr {:number :sing


good so far

good so far

--- src/bluebell/utils/setdispatch.clj
+++ src/bluebell/utils/setdispatch.clj
@@ -93,8 +93,12 @@
       :default nil)))

 (defn set-vectors-dominate?
-  "va and vb are collections of sets. va is said to dominate vb if all of its sets
-  are subsets of the corresponding sets of vb and at least one of these relations is strict subset"
+
+  "va and vb are collections of sets. va is said
+  to dominate vb if all of its sets
+  are subsets of the corresponding sets of vb and
+  at least one of these relations is strict subset"
+
   [va vb]
   (let [comparisons (map compare-sets va vb)]
     (and (not (some nil? comparisons))


fixed reagent implementation of user page

--- src/braid/ui/views/pages/user.cljs
+++ src/braid/ui/views/pages/user.cljs
@@ -1,58 +1,62 @@
 (ns braid.ui.views.pages.user
   (:require [om.core :as om]
             [om.dom :as dom]
+            [reagent.ratom :include-macros true :refer-macros [reaction]]
+            [braid.ui.views.pills :refer [user-pill-view]]
+            [chat.client.reagent-adapter :refer [subscribe]]
             [chat.client.store :as store]
             [chat.client.views.threads :refer [thread-view new-thread-view]]
-            [chat.client.views.helpers :refer [user-cursor]]
-            [chat.client.views.pills :refer [user-view]]))
+            [chat.client.views.helpers :refer [user-cursor]]))

 (defn user-page-view
-  [{:keys [subscribe]}]
-    (fn []
-      (let [user-id (subscribe [:page-id])
-            current-user-id (subscribe [:user-id])
-            user-avatar-url (subscribe [:user-avatar-url])
-            threads (subscribe [:threads])
-            open-threads-ids (subscribe [:open-thread-ids])
-            open-threads (select-keys @threads @open-threads-ids)
-            user (subscribe [:user @user-id])]
-        [:div.page.channel
-          [:div.title
-            [user-view @user subscribe]]
-          [:div.content
-            [:div.description
-              [:img.avatar {:src @user-avatar-url}]
-              [:p "One day, a profile will be here."]
-              [:p "Currently only showing your open threads that mention this user."]
-              [:p "Soon, you will see all recent threads this user has participated in."]]]
-          [:div.threads {:ref "threads-div"
-                         :on-wheel
-                         (fn [e]
-                           (let [target-classes (.. e -target -classList)
-                                 this-elt (.. e -target)]
-                             ; TODO: check if threads-div needs to scroll?
-                             (when (and (or (.contains target-classes "thread")
-                                            (.contains target-classes "threads"))
-                                     (= 0 (.-deltaX e) (.-deltaZ e)))
-                               (set! (.-scrollLeft this-elt)
-                                     (- (.-scrollLeft this-elt) (.-deltaY e))))))}
-             (let [sorted-threads (->> @open-threads-ids
-                                  ; sort by last message sent by logged-in user, most recent first
-                                        vals
-                                        (filter
-                                          (fn [thread]
-                                            (contains?
-                                              (set (thread :mentioned-ids)) @user-id)))
-                                        (sort-by
-                                          (comp (partial apply max)
-                                                (partial map :created-at)
-                                                (partial filter
-                                                  (fn [m] (= (m :user-id) @current-user-id)))
-                                                :messages))
-                                          reverse)]
-                [new-thread-view]
+  []
+  (fn []
+    (let [user-id (subscribe [:page-id])
+          user (subscribe [:user @user-id])
+          current-user-id (subscribe [:user-id])
+          user-avatar-url (subscribe [:user-avatar-url])
+          threads (subscribe [:threads])
+          open-threads-ids (subscribe [:open-thread-ids])
+          open-threads (reaction (select-keys @threads @open-threads-ids))
+          sorted-threads (reaction (->> @open-threads
+                                   ; sort by last message sent by logged-in user, most recent first
+                                    vals
+                                    (filter
+                                      (fn [thread]
+                                        (contains?
+                                          (set (thread :mentioned-ids)) @user-id)))
+                                    (sort-by
+                                      (comp (partial apply max)
+                                            (partial map :created-at)
+                                            (partial filter
+                                              (fn [m] (= (m :user-id) @current-user-id)))
+                                            :messages))
+                                      reverse))]
+      [:div.page.channel
+        [:div.title
+          [user-pill-view @user]]
+        [:div.content
+          [:div.description
+            [:img.avatar {:src @user-avatar-url}]
+            [:p "One day, a profile will be here."]
+            [:p "Currently only showing your open threads that mention this user."]
+            [:p "Soon, you will see all recent threads this user has participated in."]]]
+        [:div.threads {:ref "threads-div"
+                       :on-wheel
+                       (fn [e]
+                         (let [target-classes (.. e -target -classList)
+                               this-elt (.. e -target)]
+                           ; TODO: check if threads-div needs to scroll?
+                           (when (and (or (.contains target-classes "thread")
+                                          (.contains target-classes "threads"))
+                                   (= 0 (.-deltaX e) (.-deltaZ e)))
+                             (set! (.-scrollLeft this-elt)
+                                   (- (.-scrollLeft this-elt) (.-deltaY e))))))}
+              [new-thread-view]
+              (doall
                 (for [thread @sorted-threads]
-                  [thread-view thread]))]])))
+                 ^{:key [thread :id]}
+                 [thread-view thread]))]])))

 ;(om/get-node owner "threads-div")
 ; [new-thread-view {:mentioned-ids [user-id]}]


Capture call result in let block, and test on that.

--- src/caesium/crypto/generichash.clj
+++ src/caesium/crypto/generichash.clj
@@ -60,16 +60,16 @@
   ([buf msg]
    (blake2b-to-buf! buf msg {}))
   ([buf msg {:keys [key salt personal] :or {key (bb/alloc 0)}}]
-   (if-not (zero?
-            (if (or salt personal)
-              ;; You can't set the defaults in the argspec's destructuring form,
-              ;; because you want to be able to differentiate between a salt that
-              ;; wasn't passed and an empty salt, to call a different fn.
-              (let [salt (or salt (bb/alloc blake2b-saltbytes))
-                    personal (or personal (bb/alloc blake2b-personalbytes))]
-                (b/call! blake2b-salt-personal buf msg key salt personal))
-              (b/call! blake2b buf msg key)))
-     (throw (RuntimeException. "Error in BLAKE2b hashing"))
+   (let [blake2b-result (if (or salt personal)
+                          ;; You can't set the defaults in the argspec's destructuring form,
+                          ;; because you want to be able to differentiate between a salt that
+                          ;; wasn't passed and an empty salt, to call a different fn.
+                          (let [salt (or salt (bb/alloc blake2b-saltbytes))
+                                personal (or personal (bb/alloc blake2b-personalbytes))]
+                            (b/call! blake2b-salt-personal buf msg key salt personal))
+                          (b/call! blake2b buf msg key))]
+     (if-not (zero? blake2b-result)
+       (throw (RuntimeException. "Error in BLAKE2b hashing")))
      buf)))

 (defn blake2b


CMR-3687: Reformated requires

CMR-3687: Reformated requires

--- search-app/src/cmr/search/api/tags_api.clj
+++ search-app/src/cmr/search/api/tags_api.clj
@@ -1,15 +1,16 @@
 (ns cmr.search.api.tags-api
   "Defines the API for tagging collections in the CMR."
-  (:require [compojure.route :as route]
-            [compojure.core :refer :all]
-            [cheshire.core :as json]
-            [clojure.string :as str]
-            [cmr.common.util :as util]
-            [cmr.common.mime-types :as mt]
-            [cmr.common.services.errors :as errors]
-            [cmr.common-app.api.enabled :as common-enabled]
-            [cmr.search.services.tagging-service :as tagging-service]
-            [cmr.acl.core :as acl]))
+  (:require
+   [cheshire.core :as json]
+   [clojure.string :as str]
+   [cmr.acl.core :as acl]
+   [cmr.common.mime-types :as mt]
+   [cmr.common.services.errors :as errors]
+   [cmr.common.util :as util]
+   [cmr.common-app.api.enabled :as common-enabled]
+   [cmr.search.services.tagging-service :as tagging-service]
+   [compojure.core :refer :all]
+   [compojure.route :as route]))

 (defn- validate-tag-content-type
   "Validates that content type sent with a tag is JSON"


Don't need ^:dynamic with with-redefs.

Don't need ^:dynamic with with-redefs.

--- test/monocle/test/core.clj
+++ test/monocle/test/core.clj
@@ -4,7 +4,7 @@
   (:require [clojure.java.io :as io])
   (:import (java.io File)))

-(def ^:dynamic tmp nil)
+(def tmp nil)

 (use-fixtures :each
   (fn [t]


refactor code block to general transducer-maker

--- src/chat/client/views/helpers.cljs
+++ src/chat/client/views/helpers.cljs
@@ -66,59 +66,50 @@
         text))
     text-or-node))

-(defn extract-code-blocks
-  "Return a transducer to processs the sequence of words into multiline code blocks"
-  []
+(defn make-delimited-processor
+  "Make a new transducer to process the stream of words"
+  [{:keys [delimiter result-fn]}]
   (fn [xf]
     (let [state (volatile! ::start)
-          block-type (volatile! nil)
           in-code (volatile! [])]
       (fn
         ([] (xf))
         ([result] (if (= @state ::in-code)
-                    (let [prefix (if (= @block-type :block) "```" "`")]
-                      (reduce xf result (update-in @in-code [0] (partial str prefix))))
+                    (reduce xf result (update-in @in-code [0] (partial str delimiter)))
                     (xf result)))
         ([result input]
          (if (string? input)
            (cond
-             ; TODO: handle starting code block with backtick not at beginning of word
-             ; start multiline
-             (and (= @state ::start) (.startsWith input "```"))
-             (if (and (not= "```" input) (.endsWith input "```"))
-               (xf result (dom/code #js {:className "multiline-code"} (.slice input 3 (- (.-length input) 3))))
+             ; TODO: handle starting code block with delimiter not at beginning of word
+             ; start
+             (and (= @state ::start) (.startsWith input delimiter))
+             (if (and (not= input "`") (.endsWith input delimiter))
+               (xf result (result-fn (.slice input (count delimiter) (- (.-length input) (count delimiter)))))
                (do (vreset! state ::in-code)
-                   (vreset! block-type :block)
-                   (vswap! in-code conj (.slice input 3))
+                   (vswap! in-code conj (.slice input (count delimiter)))
                    result))

-             ; start inline
-             (and (= @state ::start) (.startsWith input "`"))
-             (if (and (not= input "`") (.endsWith input "`"))
-               (xf result (dom/code #js {:className "inline-code"} (.slice input 1 (dec (.-length input)))))
-               (do (vreset! state ::in-code)
-                   (vswap! in-code conj (.slice input 1))
-                   result))
-
-             ; end multiline
-             (and (= @state ::in-code) (= @block-type :block) (.endsWith input "```"))
-             (let [code (conj @in-code (.slice input 0 (- (.-length input) 3)))]
+             ; end
+             (and (= @state ::in-code) (.endsWith input delimiter))
+             (let [code (conj @in-code (.slice input 0 (- (.-length input) (count delimiter))))]
                (vreset! state ::start)
                (vreset! in-code [])
-               (xf result (dom/code #js {:className "multiline-code"} (string/join " " code))))
+               (xf result (result-fn (string/join " " code))))

-             ; end inline
-             (and (= @state ::in-code) (.endsWith input "`"))
-             (let [code (conj @in-code (.slice input 0 (dec (.-length input))))]
-               (vreset! state ::start)
-               (vreset! in-code [])
-               (xf result (dom/code #js {:className "inline-code"} (string/join " " code))))
-
-             ; both
              (= @state ::in-code) (do (vswap! in-code conj input) result)

              :else (xf result input))
            (xf result input)))))))
+
+(def extract-code-blocks
+  (make-delimited-processor {:delimiter "```"
+                             :result-fn (fn [input]
+                                       (dom/code #js {:className "multiline-code"} input))}))
+(def extract-code-inline
+  (make-delimited-processor {:delimiter "`"
+                             :result-fn (fn [input]
+                                       (dom/code #js {:className "inline-code"}
+                                                 input))}))

 (defn format-message
   "Given the text of a message body, turn it into dom nodes, making urls into
@@ -130,7 +121,7 @@
                                    tag-replace
                                    emoji-shortcodes-replace
                                    emoji-ascii-replace))
-        statefull-transform (extract-code-blocks)]
+        statefull-transform (comp extract-code-blocks extract-code-inline)]
     (->> (into [] (comp statefull-transform stateless-transform) (string/split text #" "))
          (interleave (repeat " "))
          rest)))


Fail if service takes too long to load.

Fail if service takes too long to load.

--- src/clj/elephantdb/test/keyval.clj
+++ src/clj/elephantdb/test/keyval.clj
@@ -169,10 +169,14 @@
   (let [handler  (doto (kv/kv-service database)
                    (db/prepare)
                    (.updateAll))]
-    (while (not (.isFullyLoaded handler))
-      (info "waiting...")
-      (Thread/sleep 50))
-    handler))
+    (loop [times 20]
+      (if (pos? times)
+        (if (.isFullyLoaded handler)
+          handler
+          (do (info "waiting...")
+              (Thread/sleep 50)
+              (recur (dec times))))
+        (throw (RuntimeException. "Couldn't load handler!"))))))

 ;; TODO: Fake out host->shard function, start an updater, and cancel
 ;; with future-cancel.


Different colour scheme. Refactor out one initialisation function

--- src/cljs/mandelbrot_cljs/core.cljs
+++ src/cljs/mandelbrot_cljs/core.cljs
@@ -105,7 +105,7 @@
    overlay-canvas
    0 0
    (aget overlay-canvas "width") (aget overlay-canvas "height")
-   :opacity 0.2 :color "green" :clear? true :type :fill)
+   :opacity 0.1 :color "blue" :clear? false :type :fill)

   (.setTimeout js/window #(render-mandelbrot! new-state) 50))

@@ -182,23 +182,30 @@
                                             (aget e "pageX")
                                             (aget e "pageY")
                                             :clear? true
-                                            :color "green"))))
+                                            :type :stroke
+                                            :opacity 0.9
+                                            :color "red"))))

   (set! (.-onmouseup overlay-canvas) handle-mouseup))

-
-(set! (.-onresize js/window) (fn [] (re-render! @app-state)))
-
-(add-watch app-state :state-changed
-           (fn [_ _ old-state new-state]
-             (when-not (= (:rendering-data old-state)
-                          (:rendering-data new-state))
-               (re-render! new-state))))
-
-(add-overlay-handlers! (get @app-state :overlay-canvas))
-
-(render-mandelbrot! @app-state)
+(defn init!
+  "Initialise event handlers, add atom watches, do the first rendering"
+  []
+  (set! (.-onresize js/window) (fn [] (re-render! @app-state)))
+
+  (add-watch app-state :state-changed
+             (fn [_ _ old-state new-state]
+               (when-not (= (:rendering-data old-state)
+                            (:rendering-data new-state))
+                 (re-render! new-state))))
+
+  (add-overlay-handlers! (get @app-state :overlay-canvas))
+
+  (render-mandelbrot! @app-state))
+

 (defn on-js-reload
   "A figwheel thing"
   [])
+
+(init!)


Link to contact if it's mentioned

Link to contact if it's mentioned

--- src/cljs/openslack/views/text.cljs
+++ src/cljs/openslack/views/text.cljs
@@ -1,7 +1,7 @@
 (ns openslack.views.text
   (:require [cuerdas.core :as str]
             [openslack.state :as st]
-            [openslack.routing :refer [emoji-route room-route]])
+            [openslack.routing :refer [emoji-route room-route contact-route]])
   (:import [goog Uri]))

 (def enrichers (atom []))
@@ -88,6 +88,20 @@

 (register-enricher! room-regex room-converter)

+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Contacts
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(def contact-regex #"@\w+")
+(defn contact-converter
+  [contact-name]
+  (let [contact-local (str/ltrim contact-name "@")]
+    ;; TODO: if it's the logged-in users name we may want to do something special
+    (if-let [maybe-contact (st/get-contact @st/state contact-local)]
+      [:a {:href (contact-route {:name contact-local})} contact-name]
+      [:span contact-name])))
+
+(register-enricher! contact-regex contact-converter)

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Emoji


[Issue-#82] riffing on the idea of making t-formulas more of an as-documentation style... but kept in the usual location.

--- test/midje/ideas/t_formulas.clj
+++ test/midje/ideas/t_formulas.clj
@@ -6,7 +6,106 @@
         midje.util.ecosystem
         [midje.ideas.formulas :only [*num-trials*]] ))

+
+;;;; Formulas
+
+;; First we create our own generator functions since Midje doesn't include any.
+(defn make-string []
+  (rand-nth ["a" "b" "c" "d" "e" "f" "g" "i"]))
+(defn- gen-int [pred]
+  (rand-nth (filter pred [-999 -100 -20 -5 -4 -3 -2 -1 0 1 2 3 4 5 20 100 999])))
+
+;; Formulas are a generative style test macro. Each binding has a generator on
+;; the right and a symbol on the left that will hold the generated value
+
+(formula "can now use simple generative-style formulas - with multiple bindings"
+  [a (make-string) b (make-string) c (make-string)]
+  (str a b c) => (has-prefix (str a b)))
+
+;; You can use provided to make fakes inside of a formula
+(unfinished f)
+(defn g [x] (str (f x) x))
+
+(formula "'provided' works"
+  [a (make-string)]
+  (g a) => (str "foo" a)
+  (provided
+    (f anything) => "foo"))
+
+
+;; Failed formulas report once per formula regardless how many trials were run
+(after-silently
+  (formula "some description" [a "y"] a => :foo))
+(fact @reported => (one-of (contains {:type :mock-expected-result-failure
+                                      :description "some description"})))
+
+
+;; Passing formulas run the generator many times, and evaluate
+;; their body many times - number of trials is rebindable
+(defn-call-countable y-maker [] "y")
+(defn-call-countable my-str [s] (str s))
+
+(binding [*num-trials* 77]
+  (formula [y (y-maker)]
+    (my-str y) => "y"))
+(fact @y-maker-count => 77)
+(fact @my-str-count => 77)
+
+
+;; Can specify number of trials to run in options map - overrides *num-trials* var value
+(defn-call-countable foo-maker [] "foo")
+(defn-call-countable my-double-str [s] (str "double" s))
+
+(binding [*num-trials* 111]  ;; this will be overridden by opt map
+  (formula "asdf" {:num-trials 88} [foo (foo-maker)]
+    (my-double-str foo) => "doublefoo"))
+(fact @foo-maker-count => 88)
+(fact @my-double-str-count => 88)
+
+
+;; Runs only as few times as needed to see a failure
+(defn-call-countable z-maker [] "z")
+(defn-call-countable my-identity [x] (identity x))
+
+(after-silently
+  (formula [z (z-maker)]
+    (my-identity z) => "clearly not 'z'"))
+(fact "calls generator once" @z-maker-count => 1)
+(fact "evalautes body once" @my-identity-count => 1)
+
+;; Shrinks failure case to smallest possible failure -- shrinks each binding result
+(when-1-3+
+  (with-redefs [midje.ideas.formulas/shrink (fn [x]
+                                               (if (integer? x)
+                                                 [0 1 2 3 4 5]
+                                                 ["a" "b" "c" "d" "e"]))]
+    (after-silently
+      (formula [x 100 a "abc"]
+        [x a] => #(neg? (first %))))
+    (fact @reported => (one-of (contains {:type :mock-expected-result-functional-failure
+                                          :actual [0 "a"]} ))))) ;; note that it shrank both 100 and "abc"
+
+;; Shrunken failure case is in the same domain as the generator
+;; used to create the input case in the first place.
+(after-silently
+  (formula [x (gen-int odd?)]  ;;(guard (gs/int) odd?)]
+    x => neg?))
+(future-fact "shrunken failure case is in the same domain as the generator"
+  @reported => (one-of (contains {:type :mock-expected-result-failure
+                                  :actual 1})))
+
+
+;;;; Other
+
+(future-formula "demonstrating the ability to create future formulas"
+  [a 1]
+  a => 1)
+
+
 ;;;; Validation
+
+;; The following facts express an assortment of ways that formulas
+;; could be expressed with invalid syntax

 (unfinished h)

@@ -70,7 +169,7 @@
   (k a) => 10)

 ;; :num-trials can be any number 1+
-(formula {:num-trials 1 } [a 1] a => 1)
+(formula {:num-trials 1} [a 1] a => 1)
 (formula {:num-trials 2} [a 1] a => 1)
 (formula {:num-trials 3} [a 1] a => 1)
 (formula {:num-trials 4} [a 1] a => 1)
@@ -78,9 +177,6 @@

 ;; *num-trials* binding validation
-
-(defn- gen-int [pred]
-  (rand-nth (filter pred [-999 -100 -20 -5 -4 -3 -2 -1 0 1 2 3 4 5 20 100 999])))

 (formula
   "binding too small a value - gives nice error msg"
@@ -92,92 +188,4 @@
   "allows users to dynamically rebind to 1+"
   [n (gen-int #(>= % 1))]
   (binding [*num-trials* n] nil)
-     =not=> (throws Exception))
-
-
-;;;; Formulas
-
-;; the first formula use ever!
-(defn make-string []
-  (rand-nth ["a" "b" "c" "d" "e" "f" "g" "i"]))
-(formula "can now use simple generative-style formulas - with multiple bindings"
-  [a (make-string) b (make-string) c (make-string)]
-  (str a b c) => (has-prefix (str a b)))
-
-(unfinished f)
-(defn g [x] (str (f x) x))
-
-(formula "'provided' works"
-  [a (make-string)]
-  (g a) => (str "foo" a)
-  (provided
-    (f anything) => "foo"))
-
-
-;; failed formulas report once per formula regardless how many generations were run
-(after-silently
-  (formula "some description" [a "y"] a => :foo))
-(fact @reported => (one-of (contains {:type :mock-expected-result-failure
-                                      :description "some description"})))
-
-
-;; passing formulas run the generator many times, and evaluate
-;; their body many times - number of generations is rebindable
-(defn-call-countable y-maker [] "y")
-(defn-call-countable my-str [s] (str s))
-
-(binding [*num-trials* 77]
-  (formula [y (y-maker)]
-    (my-str y) => "y"))
-(fact @y-maker-count => 77)
-(fact @my-str-count => 77)
-
-
-;; can specify number of trials to run in options map - overrides *num-trials* var value
-(defn-call-countable foo-maker [] "foo")
-(defn-call-countable my-double-str [s] (str "double" s))
-
-(binding [*num-trials* 111]  ;; this will be overridden by opt map
-  (formula "asdf" {:num-trials 88} [foo (foo-maker)]
-    (my-double-str foo) => "doublefoo"))
-(fact @foo-maker-count => 88)
-(fact @my-double-str-count => 88)
-
-
-;; runs only as few times as needed to see a failure
-(defn-call-countable z-maker [] "z")
-(defn-call-countable my-identity [x] (identity x))
-
-(after-silently
-  (formula [z (z-maker)]
-    (my-identity z) => "clearly not 'z'"))
-(fact "calls generator once" @z-maker-count => 1)
-(fact "evalautes body once" @my-identity-count => 1)
-
-;; shrinks failure case to smallest possible failure -- shrinks each binding result
-(when-1-3+
-  (with-redefs [midje.ideas.formulas/shrink (fn [x]
-                                               (if (integer? x)
-                                                 [0 1 2 3 4 5]
-                                                 ["a" "b" "c" "d" "e"]))]
-    (after-silently
-      (formula [x 100 a "abc"]
-        [x a] => #(neg? (first %))))
-    (fact @reported => (one-of (contains {:type :mock-expected-result-functional-failure
-                                          :actual [0 "a"]} ))))) ;; note that it shrank both 100 and "abc"
-
-;; shrunken failure case is in the same domain as the generator
-;; used to create the input case in the first place.
-(after-silently
-  (formula [x (gen-int odd?)]  ;;(guard (gs/int) odd?)]
-    x => neg?))
-(future-fact "shrunken failure case is in the same domain as the generator"
-  @reported => (one-of (contains {:type :mock-expected-result-failure
-                                  :actual 1})))
-
-
-;;;; Other
-
-(future-formula "demonstrating the ability to create future formulas"
-  [a 1]
-  a => 1)+     =not=> (throws Exception))


Some minor code clean. Thanks kibit!

Some minor code clean. Thanks kibit!

--- src/coming_soon/models/contact.clj
+++ src/coming_soon/models/contact.clj
@@ -18,31 +18,25 @@
 (defn exists-by-email?
   "Determine if a contact with the specified email address has been collected."
   [email]
-  (if (= 1 (with-car (car/hexists coming-soon-emails email)))
-    true
-    false))
+  (= 1 (with-car (car/hexists coming-soon-emails email))))

 (defn exists-by-id?
   "Determine if a contact with the specified id has been collected."
   [id]
-  (if (= 1 (with-car (car/hexists coming-soon-contacts id)))
-    true
-    false))
+  (= 1 (with-car (car/hexists coming-soon-contacts id))))

 (defn contact-by-id
   "Return the contact for an id, nil if no contact exists by that id."
   [id]
-  (if (exists-by-id? id)
-    (read-string (with-car (car/hget coming-soon-contacts id)))
-    nil))
+  (when (exists-by-id? id)
+    (read-string (with-car (car/hget coming-soon-contacts id)))))

 (defn contact-by-email
   "Return the contact for an email, nil if the email has not been collected."
   [email]
-  (if (exists-by-email? email)
+  (when (exists-by-email? email)
     (let [id (with-car (car/hget coming-soon-emails email))]
-      (contact-by-id id))
-    nil))
+      (contact-by-id id))))

 (defn contact-count
   "Return the number of contacts collected."
@@ -62,7 +56,7 @@
 (defn all-referrers
   "Return all the referrer URLs and the # of referrals by that URL, in order of most referrals."
   []
-  (sort-by last > (map identity (frequencies (filter #(not (nil? %)) (map :referrer (all-contacts)))))))
+  (sort-by last > (map identity (frequencies (remove nil? (map :referrer (all-contacts)))))))

 ;; ISO 8601 timestamp
 (defn- current-timestamp []


Mostly rearrangement, with some clear names (#856)

* Mostly rearrangement, with some clear names

* Making sturdier

* Cleanup

--- src/cljs/main/broadfcui/page/groups/groups_management.cljs
+++ src/cljs/main/broadfcui/page/groups/groups_management.cljs
@@ -23,23 +23,9 @@
      [:div {}
       (cond
         (:delete-modal? @state)
-        (modals/render-message
-         {:text (str "Are you sure you want to delete the group " (:group-name @state) "?")
-          :on-confirm #(this :-delete-group)
-          :on-dismiss #(swap! state dissoc :delete-modal?)})
+        (this :-render-confirmation)
         (:deleting? @state)
-        (net/render-with-ajax
-         (:delete-response @state)
-         #(this :-load-data)
-         {:blocking? true
-          :loading-text "Deleting group..."
-          :handle-error
-          (fn [parsed-response]
-            (modals/render-error
-             {:text (if (= 409 (:statusCode parsed-response))
-                      "This group cannot be deleted because it is in use."
-                      (:message parsed-response))
-              :on-dismiss #(swap! state dissoc :deleting? :delete-response)}))}))
+        (this :-render-deletion-actions))
       (net/render-with-ajax
        (:groups-response @state)
        #(this :-render-groups-table)
@@ -51,10 +37,7 @@
    (fn [{:keys [state]}]
      (utils/ajax-orch
       "/groups"
-      {:on-done (net/handle-ajax-response #(swap! state assoc
-                                                  :groups-response %
-                                                  :deleting? nil
-                                                  :delete-response nil))}))
+      {:on-done (net/handle-ajax-response #(swap! state assoc :groups-response %))}))
    :-render-groups-table
    (fn [{:keys [this state]}]
      [Table
@@ -109,7 +92,29 @@
      (endpoints/call-ajax-orch
       {:endpoint (endpoints/delete-group (:group-name @state))
        :on-done (net/handle-ajax-response
-                 #(swap! state assoc :delete-response %))}))})
+                 (fn [response]
+                    (swap! state assoc :delete-response response)
+                    (this :-load-data)))}))
+   :-render-confirmation
+   (fn [{:keys [state this]}]
+     (modals/render-message
+      {:text (str "Are you sure you want to delete the group " (:group-name @state) "?")
+       :on-confirm #(this :-delete-group)
+       :on-dismiss #(swap! state dissoc :delete-modal?)}))
+   :-render-deletion-actions
+   (fn [{:keys [state this]}]
+     (net/render-with-ajax
+      (:delete-response @state)
+      (constantly nil)
+      {:blocking? true
+       :loading-text "Deleting group..."
+       :handle-error
+       (fn [parsed-response]
+         (modals/render-error
+          {:text (if (= 409 (:statusCode parsed-response))
+                   "This group cannot be deleted because it is in use."
+                   (:message parsed-response))
+           :on-dismiss #(swap! state dissoc :deleting? :delete-response)}))}))})

 (react/defc- Page
   {:render


Added matrix dimension checks for matrix-fmap! matrix-fold and matrix-foldmap.

--- src/clojure/uncomplicate/neanderthal/impl/buffer_block.clj
+++ src/clojure/uncomplicate/neanderthal/impl/buffer_block.clj
@@ -8,7 +8,7 @@
              :refer [PseudoFunctor Foldable fmap! fold foldmap]]
             [uncomplicate.neanderthal
              [protocols :refer :all]
-             [core :refer [transfer! copy!]]]
+             [core :refer [transfer! copy! mrows ncols]]]
             [uncomplicate.clojurecl.core :refer [Releaseable]])
   (:import [java.nio ByteBuffer DirectByteBuffer]
            [clojure.lang IFn IFn$D IFn$DD IFn$LD IFn$DDD IFn$LDD IFn$DDDD
@@ -19,6 +19,9 @@
             BLAS RealBufferAccessor BufferAccessor DataAccessor
             RealVector RealMatrix Vector Matrix RealChangeable Block]))

+(def ^{:no-doc true :const true} FITTING_DIMENSIONS_MATRIX_MSG
+  "Matrices should have fitting dimensions.")
+
 (defn ^:private hash* ^double [^double h ^double x]
   (double (clojure.lang.Util/hashCombine h (Double/hashCode x))))

@@ -333,7 +336,6 @@
                                                  (.entry ^RealVector z i)
                                                  (.entry ^RealVector v i))))
            acc))))))
-

 ;; ================== map/reduce functions =====================================

@@ -430,6 +432,17 @@
   ([x g f init y z v ws]
    (throw (UnsupportedOperationException. "Vector foldmap support up to 4 vectors."))))

+(defn check-matrix-dimensions
+  ([^Matrix x ^Matrix y]
+   (and (<= (.ncols x) (.ncols y))
+        (<= (.mrows x) (.mrows y))))
+  ([^Matrix x ^Matrix y ^Matrix z]
+   (and (<= (.ncols x) (min (.ncols y) (.ncols z)))
+        (<= (.mrows x) (min (.mrows y) (.ncols z)))))
+  ([^Matrix x ^Matrix y ^Matrix z ^Matrix v]
+   (and (<= (.ncols x) (min (.ncols y) (.ncols z) (.ncols v)))
+        (<= (.mrows x) (min (.mrows y) (.ncols z) (.ncols v))))))
+
 (defn ^:private matrix-fmap!
   ([^Matrix x f]
    (do (if (column-major? x)
@@ -439,26 +452,32 @@
            (vector-fmap* f (.row x i))))
        x))
   ([^Matrix x f ^Matrix y]
-   (do (if (column-major? x)
-         (dotimes [i (.ncols x)]
-           (vector-fmap* f (.col x i) (.col y i)))
-         (dotimes [i (.mrows x)]
-           (vector-fmap* f (.row x i) (.row y i))))
-       x))
+   (if (check-matrix-dimensions x y)
+     (do (if (column-major? x)
+           (dotimes [i (.ncols x)]
+             (vector-fmap* f (.col x i) (.col y i)))
+           (dotimes [i (.mrows x)]
+             (vector-fmap* f (.row x i) (.row y i))))
+         x)
+     (throw (IllegalArgumentException. FITTING_DIMENSIONS_MATRIX_MSG))))
   ([^Matrix x f ^Matrix y ^Matrix z]
-   (do (if (column-major? x)
-         (dotimes [i (.ncols x)]
-           (vector-fmap* f (.col x i) (.col y i) (.col z i)))
-         (dotimes [i (.mrows x)]
-           (vector-fmap* f (.row x i) (.row y i) (.row z i))))
-       x))
-  ([^Matrix x f ^Matrix y ^Matrix z ^Matrix w]
-   (do (if (column-major? x)
-         (dotimes [i (.ncols x)]
-           (vector-fmap* f (.col x i) (.col y i) (.col z i) (.col w i)))
-         (dotimes [i (.mrows x)]
-           (vector-fmap* f (.row x i) (.row y i) (.row z i) (.col w i))))
-       x))
+   (if (check-matrix-dimensions x y z)
+     (do (if (column-major? x)
+           (dotimes [i (.ncols x)]
+             (vector-fmap* f (.col x i) (.col y i) (.col z i)))
+           (dotimes [i (.mrows x)]
+             (vector-fmap* f (.row x i) (.row y i) (.row z i))))
+         x)
+     (throw (IllegalArgumentException. FITTING_DIMENSIONS_MATRIX_MSG))))
+  ([^Matrix x f ^Matrix y ^Matrix z ^Matrix v]
+   (if (check-matrix-dimensions x y z v)
+     (do (if (column-major? x)
+           (dotimes [i (.ncols x)]
+             (vector-fmap* f (.col x i) (.col y i) (.col z i) (.col v i)))
+           (dotimes [i (.mrows x)]
+             (vector-fmap* f (.row x i) (.row y i) (.row z i) (.col v i))))
+         x)
+     (throw (IllegalArgumentException. FITTING_DIMENSIONS_MATRIX_MSG))))
   ([x f y z w ws]
    (throw (UnsupportedOperationException. "Matrix fmap support up to 4 matrices."))))

@@ -480,20 +499,26 @@
        (recur (inc i) (vector-reduce f acc (.col x i)))
        acc)))
   ([^Matrix x f init ^Matrix y]
-   (loop [i 0 acc init]
-     (if (< i (.ncols x))
-       (recur (inc i) (vector-reduce f acc (.col x i) (.col y i)))
-       acc)))
+   (if (check-matrix-dimensions x y)
+     (loop [i 0 acc init]
+       (if (< i (.ncols x))
+         (recur (inc i) (vector-reduce f acc (.col x i) (.col y i)))
+         acc))
+     (throw (IllegalArgumentException. FITTING_DIMENSIONS_MATRIX_MSG))))
   ([^Matrix x f init ^Matrix y ^Matrix z]
-   (loop [i 0 acc init]
-     (if (< i (.ncols x))
-       (recur (inc i) (vector-reduce f acc (.col x i) (.col y i) (.col z i)))
-       acc)))
+   (if (check-matrix-dimensions x y z)
+     (loop [i 0 acc init]
+       (if (< i (.ncols x))
+         (recur (inc i) (vector-reduce f acc (.col x i) (.col y i) (.col z i)))
+         acc))
+     (throw (IllegalArgumentException. FITTING_DIMENSIONS_MATRIX_MSG))))
   ([^Matrix x f init ^Matrix y ^Matrix z ^Matrix v]
-   (loop [i 0 acc init]
-     (if (< i (.ncols x))
-       (recur (inc i) (vector-reduce f acc (.col x i) (.col y i) (.col z i) (.col v i)))
-       acc)))
+   (if (check-matrix-dimensions x y z v)
+     (loop [i 0 acc init]
+       (if (< i (.ncols x))
+         (recur (inc i) (vector-reduce f acc (.col x i) (.col y i) (.col z i) (.col v i)))
+         acc))
+     (throw (IllegalArgumentException. FITTING_DIMENSIONS_MATRIX_MSG))))
   ([x f init y z v ws]
    (throw (UnsupportedOperationException. "Matrix fold support up to 4 matrices."))))

@@ -515,20 +540,26 @@
        (recur (inc i) (vector-reduce-map f acc g (.col x i)))
        acc)))
   ([^Matrix x g f init ^Matrix y]
-   (loop [i 0 acc init]
-     (if (< i (.ncols x))
-       (recur (inc i) (vector-reduce-map f acc g (.col x i) (.col y i)))
-       acc)))
+   (if (check-matrix-dimensions x y)
+     (loop [i 0 acc init]
+       (if (< i (.ncols x))
+         (recur (inc i) (vector-reduce-map f acc g (.col x i) (.col y i)))
+         acc))
+     (throw (IllegalArgumentException. FITTING_DIMENSIONS_MATRIX_MSG))     ))
   ([^Matrix x g f init ^Matrix y ^Matrix z]
-   (loop [i 0 acc init]
-     (if (< i (.ncols x))
-       (recur (inc i) (vector-reduce-map f acc g (.col x i) (.col y i) (.col z i)))
-       acc)))
+   (if (check-matrix-dimensions x y z)
+     (loop [i 0 acc init]
+       (if (< i (.ncols x))
+         (recur (inc i) (vector-reduce-map f acc g (.col x i) (.col y i) (.col z i)))
+         acc))
+     (throw (IllegalArgumentException. FITTING_DIMENSIONS_MATRIX_MSG))))
   ([^Matrix x g f init ^Matrix y ^Matrix z ^Matrix v]
-   (loop [i 0 acc init]
-     (if (< i (.ncols x))
-       (recur (inc i) (vector-reduce-map f acc g (.col x i) (.col y i) (.col z i) (.col v i)))
-       acc)))
+   (if (check-matrix-dimensions x y z v)
+     (loop [i 0 acc init]
+       (if (< i (.ncols x))
+         (recur (inc i) (vector-reduce-map f acc g (.col x i) (.col y i) (.col z i) (.col v i)))
+         acc))
+     (throw (IllegalArgumentException. FITTING_DIMENSIONS_MATRIX_MSG))))
   ([x g f init y z v ws]
    (throw (UnsupportedOperationException. "Matrix fold support up to 4 matrices."))))


have Kit update modified ice and be able to match strength

--- src/clj/game/cards-identities.clj
+++ src/clj/game/cards-identities.clj
@@ -297,7 +297,10 @@
                                                                     (join " - "))))
                                 (register-events state side {:run-ends
                                                              {:effect (effect (update! (assoc ice :subtype stypes))
-                                                                              (unregister-events card))}} card)))}]
+                                                                              (unregister-events card))}} card)
+                                (update-ice-strength state side ice)
+                                (update-run-ice state side)
+                                (trigger-event state side :ice-subtype-changed)))}]
     :events {:run-ends nil}}

    "Silhouette: Stealth Operative"


Adapted snippet `resize-image` for use with p5js. Issue #255.

--- src/cljc/quil/snippets/image.cljc
+++ src/cljc/quil/snippets/image.cljc
@@ -30,7 +30,9 @@
     (dotimes [x 100]
       (dotimes [y 100]
         (q/set-pixel im x y (q/color (* 2 x) (* 2 y) (+ x y)))))
+    #?(:cljs (q/update-pixels im))
     (q/image im 0 0)
+
     (comment "resize image from 100x100 to 50x50 and draw again")
     (q/resize im 50 50)
     (q/image im 100 100)))


Fix footer when :medium

Fix footer when :medium

--- src/cljs/cljs_repl_web/views.cljs
+++ src/cljs/cljs_repl_web/views.cljs
@@ -535,16 +535,16 @@
                 :target "_blank"
                 :class "btn app-footer-btn"
                 :label "BLOG"]]]
-    (if (= :wide @media-query-atom)
+    (if (= :narrow @media-query-atom)
+      [v-box
+       :size "1 1 auto"
+       :justify :center
+       :align :center
+       :gap "4px"
+       :children links]
       [h-box
        :size "1 1 auto"
        :justify :end
-       :align :center
-       :gap "4px"
-       :children links]
-      [v-box
-       :size "1 1 auto"
-       :justify :center
        :align :center
        :gap "4px"
        :children links])))


Only show decks from the player side in the deck selection modal

--- src/cljs/netrunner/gamelobby.cljs
+++ src/cljs/netrunner/gamelobby.cljs
@@ -71,20 +71,22 @@
       (aset input "value" "")
       (.focus input))))

-(defn deckselect-modal [cursor owner opts]
+(defn deckselect-modal [{:keys [gameid games]} owner opts]
   (om/component
    (sab/html
     [:div.modal.fade#deck-select
      [:div.modal-dialog
       [:h3 "Select your deck"]
       [:div.deck-collection
-       (for [deck (:decks cursor)]
-         [:div.deckline {:on-click #(send {:action "deck" :gameid (:gameid @app-state) :deck deck})
-                         :data-dismiss "modal"}
-          [:img {:src (image-url (:identity deck))}]
-          [:h4 (:name deck)]
-          [:div.float-right (-> (:date deck) js/Date. js/moment (.format "MMM Do YYYY - HH:mm"))]
-          [:p (get-in deck [:identity :title])]])]]])))
+       (let [players (:players (some #(when (= (:id %) gameid) %) games))
+             side (:side (some #(when (= (:user %) (:user @auth/app-state)) %) players))]
+         (for [deck (:decks @deckbuilder/app-state) :when (= (get-in deck [:identity :side]) side)]
+           [:div.deckline {:on-click #(send {:action "deck" :gameid gameid :deck deck})
+                           :data-dismiss "modal"}
+            [:img {:src (image-url (:identity deck))}]
+            [:h4 (:name deck)]
+            [:div.float-right (-> (:date deck) js/Date. js/moment (.format "MMM Do YYYY - HH:mm"))]
+            [:p (get-in deck [:identity :title])]]))]]])))

 (defn player-view [cursor]
   (om/component
@@ -182,7 +184,6 @@
                        [:span.fake-link.deck-load
                         {:data-target "#deck-select" :data-toggle "modal"} "Select deck"])])]]
                 (om/build chat-view (:messages cursor) {:state state})])))]
-        [:div#deck-modal]]))))
+        (om/build deckselect-modal (merge cursor @deckbuilder/app-state))]))))

 (om/root game-lobby app-state {:target (. js/document (getElementById "gamelobby"))})
-(om/root deckselect-modal deckbuilder/app-state {:target (. js/document (getElementById "deck-modal"))})


removed game lobby msg from previously joined games

--- src/cljs/netrunner/gamelobby.cljs
+++ src/cljs/netrunner/gamelobby.cljs
@@ -53,12 +53,14 @@
        (om/set-state! owner :flash-message "Please fill a game title.")
        (do
          (om/set-state! owner :editing false)
+         (swap! app-state assoc :messages [])
          (send {:action "create" :title (om/get-state owner :title)}))))))

 (defn join-game [gameid owner]
   (authenticated
    (fn [user]
      (om/set-state! owner :editing false)
+     (swap! app-state assoc :messages [])
      (send {:action "join" :gameid gameid}))))

 (defn leave-game [cursor owner]
@@ -128,7 +130,7 @@
           [:input {:ref "msg-input" :placeholder "Say something"}]
           [:button "Send"]]]]))))

-(defn game-lobby [{:keys [games gameid user] :as cursor} owner]
+(defn game-lobby [{:keys [games gameid messages user] :as cursor} owner]
   (reify
     om/IRenderState
     (render-state [this state]
@@ -189,7 +191,7 @@
                      (when (= (:user player) user)
                        [:span.fake-link.deck-load
                         {:data-target "#deck-select" :data-toggle "modal"} "Select deck"])])]]
-                (om/build chat-view (:messages cursor) {:state state})])))]
+                (om/build chat-view messages {:state state})])))]
         (om/build deckselect-modal cursor)]))))

 (om/root game-lobby app-state {:target (. js/document (getElementById "gamelobby"))})


Cleanup partition layout docs.

Cleanup partition layout docs.

--- src/cljx/c2/layout/partition.cljx
+++ src/cljx/c2/layout/partition.cljx
@@ -1,13 +1,41 @@
+;; The partition layout transforms root node of hierarchy into a flat collection of nodes positioned and sized according to provided value fn.
+;; E.g., a doughnut plot can be created by partitioning the angular width and radius of a circle:
+;;
+;;     (partition {:name "Pie"
+;;                 :slices [{:name "Big slice" :val 5}
+;;                          {:name "Lil' slice" :val 3}]}
+;;                 :size [Tau 1]
+;;                 :value :val
+;;                 :children :slices) ;;=>
+;;
+;;     (;;Centre piece; circle with radius 1/2.
+;;      {:partition {:dy 1/2, :dx 6.283185307179586, :y 0N, :x 0, :value 8, :depth 0}, :name "Pie", :slices [{:name "Big slice", :val 5} {:name "Lil' slice", :val 3}]}
+;;
+;;      ;;Outer pieces; radii from 1/2 to 1 and angular displacement given according to val
+;;      {:partition {:dy 1/2, :dx 3.9269908169872414, :y 1/2, :x 0, :value 5, :depth 1}, :name "Big slice", :val 5}
+;;      {:partition {:dy 1/2, :dx 2.356194490192345, :y 1/2, :x 3.9269908169872414, :value 3, :depth 1}, :name "Lil' slice", :val 3})
+
 (ns c2.layout.partition
   (:refer-clojure :exclude [partition]))

-(defn partition [root & {:keys [sort children value size output-key]
-                         :or {sort nil
-                              children :children
-                              value :value
-                              size [1 1]
-                              output-key :partition}}]
+(defn partition
+  "Transforms `root` node of hierarchy into a flat collection of nodes positioned and sized according to provided value fn.
+
+   Kwargs:
+
+   > *:children* fn that calculates children of node, defaults to `:children`
+
+   > *:value* fn that calculates value of node, defaults to `:value`
+
+   > *:size* 2D space to be partitioned, defaults to `[1, 1]`
+
+   > *:output-key* keyword added to node map in output collection that holds calculated positions, defaults to `:partition`"
+  [root & {:keys [children value size output-key]
+           :or {children :children
+                value :value
+                size [1 1]
+                output-key :partition}}]

   (defn depth [node]
     (inc (if-let [cs (children node)]
@@ -42,13 +70,8 @@

 (comment
-
-  (use 'cheshire.core)
-  (def flare (parse-string
-              (slurp "../../../software/d3/examples/data/flare.json")
-              true))
-
-
+  (use '[vomnibus.d3 :only [flare]])
+  (use '[c2.maths :only [Tau]])
   (partition flare :value #(do % 1))

   (partition {:name "rrr"
@@ -60,6 +83,3 @@
                            :children [{:name "ba" :value 2}
                                       {:name "bb" :value 2}
                                       {:name "bc" :value 2}]}]}))
-
-
-


Fix coloring and unmarking when finding text

--- src/clojure/nightcode/editors.clj
+++ src/clojure/nightcode/editors.clj
@@ -224,10 +224,11 @@
         (when (.isShiftDown e)
           (.setSearchForward context false)))
       (if (and valid-search?
-               (not (try (SearchEngine/find text-area context)
-                      (catch Exception e false))))
+               (-> (SearchEngine/find text-area context) .getCount (= 0)))
         (s/config! e :background (color/color :red))
-        (s/config! e :background nil)))))
+        (s/config! e :background nil))
+      (when (= (count find-text) 0)
+        (SearchEngine/find text-area context)))))

 (defn replace-text!
   [e]


Clients should be functions that establish a new connection

--- src/clojure/picard/net/client.clj
+++ src/clojure/picard/net/client.clj
@@ -68,11 +68,8 @@
   (do-connect  [_ app opts])
   (do-release  [_]))

-(defrecord BasicClient  [channel-group bootstrap])
-(defrecord PooledClient [basic-client pool])
-
-(extend-protocol Client
-  BasicClient
+(defrecord BasicClient  [channel-group bootstrap]
+  Client
   (do-connect [client app {host :host port :port :as opts}]
     (let [addr     (mk-socket-addr [host port])
           ch-group (.channel-group client)
@@ -85,14 +82,25 @@
      (fn [_]
        (.releaseExternalResources (.bootstrap client)))))

-  PooledClient
+  clojure.lang.IFn
+  (invoke [this app opts]
+    (do-connect this app opts)
+    true))
+
+(defrecord PooledClient [basic-client pool]
+  Client
   (do-connect [client app opts]
     (pool/connect
      (.pool client) app opts
      #(do-connect (.basic-client client) % opts)))

   (do-release [client]
-    (do-release (.basic-client client))))
+    (do-release (.basic-client client)))
+
+  clojure.lang.IFn
+  (invoke [this app opts]
+    (do-connect this app opts)
+    true))

 (defn- basic-client
   [opts]
@@ -127,7 +135,7 @@
   (do-release client))

 (defn connect
-  ([app opts] (connect default-client app opts))
+  ([app opts]
+     (default-client app opts))
   ([client app opts]
-     (do-connect client app opts)
-     true))
+     (client app opts)))


Lock on session access to prevent race-condition

--- src/clojure/staircase/handler.clj
+++ src/clojure/staircase/handler.clj
@@ -235,24 +235,27 @@
         real-id #(if (= "default" %) (:default-service config) %)]
     (routes ;; Routes for getting service information.
             (GET "/" []
-                (let [user-services (get-all services)
-                      configured-services (->> config :services (map (fn [[k v]] {:root v :ident k})))]
-                  (info "USER SERVICES" (count user-services) "CONF SERVICES" (count configured-services))
-                  (response (vec (map ensure-token (left-outer-join configured-services user-services :root :root))))))
+                 (locking services ;; Not very happy about this - is there some better way to avoid this bottle-neck?
+                  (let [user-services (get-all services)
+                        configured-services (->> config :services (map (fn [[k v]] {:root v :ident k})))]
+                    (info "USER SERVICES" (count user-services) "CONF SERVICES" (count configured-services))
+                    (response (vec (map ensure-token (left-outer-join configured-services user-services :root :root)))))))
             (context "/:ident" [ident]
                      (GET "/" []
-                          (let [ident (real-id ident)
-                                uri (get-in config [:services ident])
-                                user-services (get-where services [:= :root uri])
-                                service (-> (left-outer-join [{:root uri :ident ident}]
-                                                             user-services
-                                                             :root
-                                                             :root)
-                                            first)]
-                            (response (ensure-token service))))
+                          (locking services
+                            (let [ident (real-id ident)
+                                  uri (get-in config [:services ident])
+                                  user-services (get-where services [:= :root uri])
+                                  service (-> (left-outer-join [{:root uri :ident ident}]
+                                                              user-services
+                                                              :root
+                                                              :root)
+                                              first)]
+                              (response (ensure-token service)))))
                     (PUT "/" {doc :body}
-                          (let [uri (get-in config [:services (real-id ident)])]
-                            (create-new services (assoc doc :root uri))))))))
+                         (locking services
+                            (let [uri (get-in config [:services (real-id ident)])]
+                              (create-new services (assoc doc :root uri)))))))))

 (defn- build-api-session-routes [router]
   (-> (routes


[#947] Fix tests

[#947] Fix tests

--- backend/test/akvo/lumen/endpoint/share_test.clj
+++ backend/test/akvo/lumen/endpoint/share_test.clj
@@ -86,14 +86,16 @@
                                 :table-name (:table-name spec)
                                 :imported-table-name (:imported-table-name spec)
                                 :version 1
-                                :columns {}})
+                                :columns {}
+                                :transformations []})
   (insert-dataset-version conn {:id (squuid)
                                 :dataset-id (:dataset-id-2 spec)
                                 :job-execution-id (:job-execution-id-2 spec)
                                 :table-name (:table-name-2 spec)
                                 :imported-table-name (:imported-table-name-2 spec)
                                 :version 1
-                                :columns {}})
+                                :columns {}
+                                :transformations []})
   (upsert-visualisation conn {:id         (:visualisation-id spec)
                               :dataset-id (:dataset-id spec)
                               :name       "Visualisation"


first pass at a better apropos

first pass at a better apropos

--- user.clj
+++ user.clj
@@ -72,6 +72,19 @@
      (remove #(not (var? %)))
      (map meta) display)))

+(defn var-search "Same as apropos but returns definitions by namespace"
+   [str-or-pattern]
+   (let [matches? (if (instance? java.util.regex.Pattern str-or-pattern)
+                    #(re-find str-or-pattern  (str %))
+                    #(.contains  (str %)  (str str-or-pattern)))]
+     (->>
+       (reduce
+         #(assoc %1 %2 (vec (filter matches? (keys (ns-publics %2)))))
+         {}
+         (all-ns))
+       (remove #(zero? (count (second %1))))
+       display)))
+
 (defn vars-values
   "Prints dynamic vars for a namespace mapped to their values"
    [& options]


Story ID: GEM-226 Summary: - spec setup for fixing :without

--- spec/untangled/client/data_fetch_spec.cljs
+++ spec/untangled/client/data_fetch_spec.cljs
@@ -12,8 +12,12 @@
 ;;; SETUP
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

+(defui Person
+  static om/IQuery (query [_] [:db/id :username :name])
+  static om/Ident (ident [_ props] [:person/id (:db/id props)]))
+
 (defui Comment
-  static om/IQuery (query [this] [:db/id :title])
+  static om/IQuery (query [this] [:db/id :title {:author (om/get-query Person)}])
   static om/Ident (ident [this props] [:comments/id (:db/id props)]))

 (defui Item
@@ -34,8 +38,8 @@
 (specification "Data states"
   (let [ready-marker (dfi/ready-state
                        :ident [:item/by-id 1]
-                       :field
-                       :comments
+                       :field :comments
+                       :without #{:author}
                        :query (om/focus-query (om/get-query Item) [:comments]))]

     (behavior "are properly initialized."
@@ -64,7 +68,8 @@
                                     (behavior "includes the component's ident."
                                       (is (= [:item/by-id 10] (:ident params))))
                                     (behavior "focuses the query to the specified field."
-                                      (is (= [{:comments [:db/id :title]}] (:query params))))
+                                      (is (= [{:comments [:db/id :title {:author [:db/id :username :name]}]}]
+                                            (:query params))))
                                     (behavior "includes the parameters."
                                       (is (= {:sort :by-name} (:params params))))
                                     (behavior "includes the subquery exclusions."


Added numergent logo, acts as a separator.

--- src/content/booklet/startpage.cljs
+++ src/content/booklet/startpage.cljs
@@ -29,7 +29,11 @@
         node
         (doto (dommy/create-element :span)
           (dommy/set-style! :font-size "90%")
-          (dommy/append! (create-node :span " [time viewed: " "rgb(80, 99, 152)"))
+          (dommy/append! (create-node :span " " "rgb(80, 99, 152)"))
+          (dommy/append! (doto
+                           (dommy/create-element :img)
+                           (dommy/set-attr! :src  "http://numergent.com/images/relevance/icon38.png")))
+          (dommy/append! (create-node :span "[time viewed: " "rgb(80, 99, 152)"))
           (dommy/append! (create-node :span (time-display time) "rgb(140, 101, 153)"))
           (dommy/append! (create-node :span "]" "rgb(80, 99, 152)"))
           ))


insights: change filter label to "Successful"

--- src-cljs/frontend/components/insights.cljs
+++ src-cljs/frontend/components/insights.cljs
@@ -376,7 +376,7 @@
                  :checked (= selected-filter :success)
                  :on-change #(raise! owner [:insights-filter-changed {:new-filter :success}])}]
         [:label {:for "insights-filter-success"}
-         (gstring/format"Success (%s)" (count (:success categories)))]
+         (gstring/format"Successful (%s)" (count (:success categories)))]
         [:input {:id "insights-filter-failed"
                  :type "radio"
                  :name "selected-filter"


fixed indicators by observable atom store query

--- src/ctia/stores/atom/indicator.clj
+++ src/ctia/stores/atom/indicator.clj
@@ -22,14 +22,9 @@
 (s/defn handle-list-indicators-by-judgements :- (s/maybe [StoredIndicator])
   [indicator-state :- (s/atom {s/Str StoredIndicator})
    judgements :- [StoredJudgement]]
-  (let [judgement-ids (set (map :id judgements))]
-    ;; Note (polygloton, 2016-03-10):
-    ;; Find indicators using the :judgements relationship on the indicators.
-    ;; It could be done the other way around, since judgements have :indicators
-    ;; relationships.  Not sure which is more correct.
+  (let [indicator-ids (some->> (map :indicators judgements)
+                               (mapcat #(map :indicator_id %))
+                               set)]
     (filter (fn [indicator]
-              (some (fn [judgement-relationship]
-                      (let [judgement-id (:judgement_id judgement-relationship)]
-                        (contains? judgement-ids judgement-id)))
-                    (:judgements indicator)))
+              (clojure.set/subset? #{(:id indicator)} indicator-ids))
             (vals @indicator-state))))


populate meta at any position

populate meta at any position

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

--- sandbox/bioformats/src/org/micromanager/bioformats.clj
+++ sandbox/bioformats/src/org/micromanager/bioformats.clj
@@ -85,22 +85,24 @@
 ;; generate ome metadata using bioformats

 (defn +int [n] (PositiveInteger. n))
-
-(defn populate-meta [m w h nslices nchannels nframes ncomponents]
+
+(defn populate-meta [pos m w h nslices nchannels nframes ncomponents]
   (doto m
     .createRoot
-    (.setImageID "Image:0" 0)
-    (.setPixelsID "Pixels:0" 0)
-    (.setPixelsBinDataBigEndian true 0 0)
-    (.setPixelsDimensionOrder DimensionOrder/XYZCT 0)
-    (.setPixelsSizeX (+int w) 0)
-    (.setPixelsSizeY (+int h) 0)
-    (.setPixelsSizeZ (+int nslices) 0)
-    (.setPixelsSizeC (+int nchannels) 0)
-    (.setPixelsSizeT (+int nframes) 0)
-    (.setPixelsType PixelType/UINT8 0)
-    (.setChannelID "Channel:0:0" 0 0)
-    (.setChannelSamplesPerPixel (+int ncomponents) 0 0)))
+    (.setImageID "Image:0" pos)
+    (.setPixelsID "Pixels:0" pos)
+    (.setPixelsBinDataBigEndian true pos 0)
+    (.setPixelsDimensionOrder DimensionOrder/XYZCT pos)
+    (.setPixelsSizeX (+int w) pos)
+    (.setPixelsSizeY (+int h) pos)
+    (.setPixelsSizeZ (+int nslices) pos)
+    (.setPixelsSizeC (+int nchannels) pos)
+    (.setPixelsSizeT (+int nframes) pos)
+    (.setPixelsType PixelType/UINT8 pos))
+  (doseq [chan (range nchannels)]
+    (doto m (.setChannelID (str "Channel:" pos ":" chan) pos chan)
+            (.setChannelSamplesPerPixel (+int ncomponents) pos chan)))
+  m)

 ;; testing

@@ -117,7 +119,7 @@

 ;;;; metadata tests

-(def test-meta (populate-meta (new-ome-meta) 512 512 2 2 2 2))
+(def test-meta (populate-meta 0 (new-ome-meta) 512 512 2 2 2 2))

 (defn test-write-image []
   (write-ome-tiff


Tests for confirming behavior on invalid password

buddy-hasher only had tests for confirming that "check" returned true,
but there were no tests to ensure that the function hadn't broken and
was always returning true (even for invalid passwords).

--- test/buddy/hashers_tests.clj
+++ test/buddy/hashers_tests.clj
@@ -36,6 +36,28 @@
     (is (hashers/check plain-password
                        (hashers/encrypt plain-password {:algorithm :md5})))))

+
+(deftest confirm-check-failure
+  (let [plain-password "my-test-password"
+        bad-password   "my-text-password"]
+    (is (not (hashers/check bad-password
+                            (hashers/encrypt plain-password))))
+    (is (not (hashers/check bad-password
+                            (hashers/encrypt plain-password {:algorithm :pbkdf2+sha1}))))
+    (is (not (hashers/check bad-password
+                            (hashers/encrypt plain-password {:algorithm :pbkdf2+sha256}))))
+    (is (not (hashers/check bad-password
+                            (hashers/encrypt plain-password {:algorithm :pbkdf2+sha3_256}))))
+    (is (not (hashers/check bad-password
+                            (hashers/encrypt plain-password {:algorithm :bcrypt+sha512}))))
+    (is (not (hashers/check bad-password
+                            (hashers/encrypt plain-password {:algorithm :scrypt}))))
+    (is (not (hashers/check bad-password
+                            (hashers/encrypt plain-password {:algorithm :sha256}))))
+    (is (not (hashers/check bad-password
+                            (hashers/encrypt plain-password {:algorithm :md5}))))))
+
+
 (deftest buddy-hashers-nil
   (let [plain-password "my-test-password"
         encrypted-password (hashers/encrypt plain-password {:algorithm :pbkdf2+sha256})]


Four new tests for parse-int: min value, max value, overflow, and bad input

--- test/clouseau/test_utils.clj
+++ test/clouseau/test_utils.clj
@@ -422,4 +422,26 @@
         -65536      (parse-int "-65536")
         -2147483647 (parse-int "-2147483647")))

-
+(deftest test-parse-int-min-int
+    "Check the behaviour of function emender-jenkins.config/parse-int."
+    (is (== Integer/MIN_VALUE (parse-int "-2147483648"))))
+
+(deftest test-parse-int-max-int
+    "Check the behaviour of function emender-jenkins.config/parse-int."
+    (is (== Integer/MAX_VALUE (parse-int "2147483647"))))
+
+(deftest test-parse-int-overflow
+    "Check the behaviour of function emender-jenkins.config/parse-int."
+    (are [x] (thrown? NumberFormatException x)
+        (parse-int "2147483648")
+        (parse-int "-2147483649")))
+
+(deftest test-parse-int-bad-input
+    "Check the behaviour of function emender-jenkins.config/parse-int."
+    (are [x] (thrown? NumberFormatException x)
+        (parse-int "")
+        (parse-int " ")
+        (parse-int "xyzzy")))
+       ; (parse-int "+1"))) ; removed, not compatible with all supported JDKs
+
+


Change default replication factor.

Change default replication factor.

It doesn't make sense to have the replication factor the same as the
number of brokers.

--- src/kixi/eventlog/application.clj
+++ src/kixi/eventlog/application.clj
@@ -25,7 +25,7 @@
                                            "3"))
                   :replication-factor (Integer/valueOf
                                        (or (System/getenv (str (.toUpperCase topic-name) "_TOPIC_REPLICATION_FACTOR"))
-                                           "3") )
+                                           "2") )
                   :max-message-size   max-message-size}) topic-names)))

 (defn parse-topics [topics]


加入if和loop相关的内容

加入if和loop相关的内容

--- src/learnclojure/chapt1/core6.clj
+++ src/learnclojure/chapt1/core6.clj
@@ -25,4 +25,39 @@

 ;;жϣif
 ;;ifclojureΨһĻж
+;; ifһʽ߼TrueκηnilfalseֵĻôʽֵǵڶʽֵǵʽֵ
+(if "hi" \t)
+(if 43 \t)
+(if nil "adad" \f)
+(if false "adad" \f)
+;;ʽfalseelseʽûṩifֵnilʹwhen
+(if (not true) \t)
+;;true?falseνʺifж޹,ǼǲǷǲֵtruefalse߼ϵtruefalse
+(true? "ad")
+(if "ad" \t \f)
+;;߼ϵtrueʽӵȼ
+#(or (not  (nil? %)) (true? %))

+;;ѭlooprecur
+;;clojureкüõѭṹdoseqdotimesǹrecur֮ϵ
+;;recurڲĶջռ°ɳִתloopͷ
+;;loopʽһʽһֵֵΪloopʽֵ
+(loop [x 5]
+  (println x)
+  (if (neg? x)
+    x
+    (recur (- x 4))))
+;;ҲԽloopͷ
+(defn countdown
+  "hehe"
+  [x]
+  (if (zero? x)
+    :blastoff!
+    (do (println x)
+        (recur (dec x)))))
+(countdown 5)
+;;recur Ƿǳײѭ͵ݹƲͨãĶջռ䣬ʵĳЩݹ㷨ܹؼ
+;;װ䣬ԶʵһЩѧйصĲ
+;;һЩҪۼƻһϣҲõrecur
+
+


get rid of pipeline-state-integration-test, adds little value now that pipeline-updater is generalized and tested on its own

--- test/clj/lambdacd/internal/default_pipeline_state_test.clj
+++ test/clj/lambdacd/internal/default_pipeline_state_test.clj
@@ -2,16 +2,12 @@
   (:use [lambdacd.testsupport.test-util])
   (:require [clojure.test :refer :all]
             [lambdacd.internal.default-pipeline-state :refer :all]
-            [lambdacd.internal.pipeline-state :as pipeline-state]
             [lambdacd.util :as utils]
             [clojure.data.json :as json]
             [clj-time.core :as t]
             [lambdacd.testsupport.test-util :as tu]
             [lambdacd.testsupport.data :refer [some-ctx-with some-ctx]]
-            [clojure.java.io :as io]
-            [clojure.core.async :as async]
-            [lambdacd.util :as util]
-            [lambdacd.event-bus :as event-bus]))
+            [clojure.java.io :as io]))

 (defn- after-update [build id newstate]
   (let [state (atom clean-pipeline-state)]
@@ -41,23 +37,10 @@
     (let [home-dir (utils/create-temp-dir)
           step-result { :foo :bar }]
       (t/do-at (t/epoch) (update-legacy 10 [0] step-result home-dir (atom {})))
-      (is (= [{ "step-id" "0"
+      (is (= [{"step-id" "0"
                "step-result" {"foo" "bar"
                               "most-recent-update-at" "1970-01-01T00:00:00.000Z"
                               "first-updated-at" "1970-01-01T00:00:00.000Z"}}] (json/read-str (slurp (str home-dir "/build-10/pipeline-state.json"))))))))
-
-(deftest pipeline-state-integration-test
-  (testing "that we tap into the event bus update the pipeline state with its information"
-    (let [ctx (some-ctx)
-          pipeline-state (new-default-pipeline-state (atom {}) {:home-dir (util/create-temp-dir)} ctx)]
-
-      (event-bus/publish ctx :step-result-updated {:build-number 1 :step-id [1 2] :step-result {:status :running}})
-      (event-bus/publish ctx :step-result-updated {:build-number 2 :step-id [1 2] :step-result {:status :success}})
-      (event-bus/publish ctx :step-result-updated {:build-number 1 :step-id [1 2] :step-result {:status :running :foo :bar}})
-
-      (Thread/sleep 200) ;; make sure all events received TODO: improve
-      (is (= {1 { [1 2] {:status :running :foo :bar}}
-              2 { [1 2] {:status :success}}} (tu/without-ts (pipeline-state/get-all pipeline-state)))))))

 (defn- write-pipeline-state [home-dir build-number state]
   (let [dir (str home-dir "/" "build-" build-number)


clean-up home page

clean-up home page

--- webapp/src/webapp/core.clj
+++ webapp/src/webapp/core.clj
@@ -17,8 +17,11 @@

 (def site-map
 	(html
-		[:ul "blog"]
-		[:ul (linkfy "dougpuett.com/ff" "fantasy football")]
+		[:h3 "Doug's Website"]
+		[:ul (linkfy "dougpuett.com/microblog" "Micro-Blog")]
+		[:ul (linkfy "dougpuett.com/ff" "Fantasy Football")]
+		[:ul "Full Blog"]
+		[:ul "Poetry Reader"]
 		))

 (def ff (html [:h2 "Championship Odds:"][:h3 "Before Week 1:"][:p "What's Fappening 42.2%, Team Freedman 29.3%, Bill and Ted's ExcellentAdv 15.5%, Champ's Smelly Meat 13.0%"][:h3 "After Week 1:"][:p "Team Freedman 49.4%, Champ's Smelly Meat 39.8%, Bill and Ted's ExcellentAdv 5.7%, What's Fappening 5.2%"][:h2 "Individual Matches:"][:h3 "Before Week 1:"][:p "Team Freedman 60.1%, Bill and Ted's ExcellentAdv 39.9%"][:p "What's Fappening 68.6%, Champ's Smelly Meat 31.4%"][:p "Samuel Beckittns 69.6%, Pat Sajak Off 30.4%"][:p "Team buckley 52.5%, I Didn't Know You Were A Cop 47.5%"][:p "Nebraska Cornholers 53.3%, RGIII's iCloud Pics 46.7%"][:p "The Manifest Destinies 82.0%, Team Stanley 18.0%"][:h3 "After Week 1:"][:p "Team Freedman 87.0%, Bill and Ted's ExcellentAdv 13.0%"][:p "Champ's Smelly Meat 90.2%, What's Fappening 9.8%"][:p "Samuel Beckittns 60.2%, Pat Sajak Off 39.8%"][:p "Team buckley 90.2%, I Didn't Know You Were A Cop 9.8%"][:p "Nebraska Cornholers 100.0%"][:p "The Manifest Destinies 95.3%, Team Stanley 4.7%"]))
@@ -31,7 +34,7 @@
 (def microblog (html (map #(vector :p %) posts)))

 (defroutes router*
-	(GET "/" request (str "Doug's Website" site-map))
+	(GET "/" request site-map)
 	(GET "/ff" request ff)
 	(GET "/microblog" request microblog)
 	(compojure.route/not-found "Link not found."))


Added dummy parameter to do-nothing to prevent exceptions caused by passing the values parameter to it

--- src/main/clojure/naojure/core.clj
+++ src/main/clojure/naojure/core.clj
@@ -134,7 +134,7 @@

 ;; function to use as placeholder in callback wrapper when no
 ;; action is required
-(defn- do-nothing [])
+(defn- do-nothing [values])

 (defn future-callback-on-complete
   [future complete-fn]


Speed up the input controller logic

Speed up the input controller logic

Avoid taking a seq of the whole input just to check if there is
something there. Instead use the fact that first returns nil when called
with an empty collection.

--- src/cljs/chocolatier/engine/components/controllable.cljs
+++ src/cljs/chocolatier/engine/components/controllable.cljs
@@ -64,13 +64,13 @@
    - action: the action based on the input"
   [input-state]
   (loop [out {}, input-seq (seq input-state)]
-    (if (seq input-seq)
-      (let [[k v] (first input-seq)
-            next-out (if-let [interaction (k keycode->movement)]
-                       (merge-with comp-movement out interaction)
-                       out)]
-        (recur next-out (rest input-seq)))
-      out)))
+    (let [[k v] (first input-seq)]
+      (if k
+        (let [interaction (k keycode->movement)]
+          (if interaction
+            (recur (merge-with comp-movement out interaction) (rest input-seq))
+            (recur out (rest input-seq))))
+        out))))

 (defn input->attack
   "Returns the first attack from the input state."


Fixes for orbits not returning shapes

Fixes for orbits not returning shapes

--- src/cmr/search/results_handlers/atom_results_handler.clj
+++ src/cmr/search/results_handlers/atom_results_handler.clj
@@ -211,7 +211,7 @@
      :day-night day-night
      :cloud-cover (str cloud-cover)
      :coordinate-system coordinate-system
-     :shapes (srl/ords-info->shapes ords-info ords)
+     :shapes shapes

      ;; Fields required for ACL enforcment
      :concept-type :granule


Changed cbay max time from 4 hours to 2 hours, and lowered possible items to 3.

--- src/hphelper/scengen/generator.clj
+++ src/hphelper/scengen/generator.clj
@@ -249,11 +249,11 @@
   [scenRec]
   (assoc-in scenRec [:cbay]
             (into []
-                  (let [items (sql/get-random-cbay-items (scenRec :zone) 5)]
+                  (let [items (sql/get-random-cbay-items (scenRec :zone) 3)]
                     (map str
                          items
                          (repeat " ")
-                         (generate-times 30 240 (count items)))))))
+                         (generate-times 30 120 (count items)))))))

 (defn add-character
   "Adds a high programmer character to the record under :hps"


trim search key strings

trim search key strings

--- src/er_cassandra/model/callbacks/search_key_callback.clj
+++ src/er_cassandra/model/callbacks/search_key_callback.clj
@@ -7,6 +7,7 @@
 (defn normalize-string
   [s]
   (-> s
+      str/trim
       (Normalizer/normalize Normalizer$Form/NFD)
       (str/replace #"\p{InCombiningDiacriticalMarks}+", "")
       .toLowerCase))


read task input

read task input

--- src/hackerrank/security/Security_Bijective_Functions.clj
+++ src/hackerrank/security/Security_Bijective_Functions.clj
@@ -1,3 +1,6 @@
+;; Security Bijective Functions
+;; https://www.hackerrank.com/challenges/security-bijective-functions/forum
+
 (ns hackerrank.security.security-bijective-functions
   (:import java.util.Scanner)
   (:require [clojure.java.io :as io])
@@ -15,5 +18,7 @@
   (Integer/parseInt string))

 (with-in-str input
-  (let [n (parseInt (read-line))]
-    (println n)))
+  (let [n (parseInt (read-line))
+        numbers (map parseInt (split (read-line) #" "))]
+    (println n)
+    (println numbers)))


Delete track button.

Delete track button.

--- sonic-jam/src/sonic_jam/core.cljs
+++ sonic-jam/src/sonic_jam/core.cljs
@@ -287,67 +287,72 @@
                        (dom/table nil
                                   (apply dom/tbody nil
                                          (concat
-                                             [(dom/tr nil
-                                                     (dom/td closer "{")
+                                          [(dom/tr nil
+                                                   (dom/td nil nil)
+                                                   (dom/td nil nil)
+                                                   (dom/td nil (dom/span #js {:onClick #(go (>! delete-ch cursor))
+                                                                              :style #js {:float "right"}} "X")))
+                                           (dom/tr nil
+                                                   (dom/td closer "{")
+                                                   (dom/td nil nil)
+                                                   (dom/td nil nil))
+                                           (dom/tr nil
+                                                   (dom/td nil nil)
+                                                   (dom/td nil "type:")
+                                                   (dom/td nil (om/build type-editor input)))]
+                                          (condp = (get cursor "type")
+                                            "synth" [(dom/tr nil
+                                                             (dom/td nil nil)
+                                                             (dom/td nil "synth:")
+                                                             (dom/td nil (om/build synth-editor input)))]
+                                            "sample" [(dom/tr nil
+                                                              (dom/td nil nil)
+                                                              (dom/td nil "sample:")
+                                                              (dom/td nil (om/build sample-editor input)))]
+                                            "play" [(dom/tr nil
+                                                            (dom/td nil nil)
+                                                            (dom/td nil "note:")
+                                                            (dom/td nil (get cursor "note")))]
+                                            [])
+                                          (condp = (get cursor "type")
+                                            "none" []
+                                            "grid" (condp = (get cursor "grid-type")
+                                                     "synth" [(dom/tr nil
+                                                                      (dom/td nil nil)
+                                                                      (dom/td nil "grid-type:")
+                                                                      (dom/td nil (om/build grid-type-editor input)))
+                                                              (dom/tr nil
+                                                                      (dom/td nil nil)
+                                                                      (dom/td nil "synth:")
+                                                                      (dom/td nil (om/build grid-synth-editor input)))
+                                                              (dom/tr nil
+                                                                      (dom/td nil nil)
+                                                                      (dom/td nil "params:")
+                                                                      (dom/td nil (om/build synth-param-editor input)))]
+                                                     "sample" [(dom/tr nil
+                                                                       (dom/td nil nil)
+                                                                       (dom/td nil "grid-type:")
+                                                                       (dom/td nil (om/build grid-type-editor input)))
+                                                               (dom/tr nil
+                                                                       (dom/td nil nil)
+                                                                       (dom/td nil "sample:")
+                                                                       (dom/td nil (om/build grid-sample-editor input)))
+                                                               (dom/tr nil
+                                                                       (dom/td nil nil)
+                                                                       (dom/td nil "params:")
+                                                                       (dom/td nil (om/build sample-param-editor input)))]
+                                                     [(dom/tr nil
+                                                              (dom/td nil nil)
+                                                              (dom/td nil "grid-type:")
+                                                              (dom/td nil (om/build grid-type-editor input)))])
+                                            [(dom/tr nil
                                                      (dom/td nil nil)
-                                                     (dom/td nil nil))
-                                              (dom/tr nil
-                                                      (dom/td nil nil)
-                                                      (dom/td nil "type:")
-                                                      (dom/td nil (om/build type-editor input)))]
-                                             (condp = (get cursor "type")
-                                               "synth" [(dom/tr nil
-                                                                (dom/td nil nil)
-                                                                (dom/td nil "synth:")
-                                                                (dom/td nil (om/build synth-editor input)))]
-                                               "sample" [(dom/tr nil
-                                                                 (dom/td nil nil)
-                                                                 (dom/td nil "sample:")
-                                                                 (dom/td nil (om/build sample-editor input)))]
-                                               "play" [(dom/tr nil
-                                                               (dom/td nil nil)
-                                                               (dom/td nil "note:")
-                                                               (dom/td nil (get cursor "note")))]
-                                               [])
-                                             (condp = (get cursor "type")
-                                               "none" []
-                                               "grid" (condp = (get cursor "grid-type")
-                                                        "synth" [(dom/tr nil
-                                                                         (dom/td nil nil)
-                                                                         (dom/td nil "grid-type:")
-                                                                         (dom/td nil (om/build grid-type-editor input)))
-                                                                 (dom/tr nil
-                                                                         (dom/td nil nil)
-                                                                         (dom/td nil "synth:")
-                                                                         (dom/td nil (om/build grid-synth-editor input)))
-                                                                 (dom/tr nil
-                                                                         (dom/td nil nil)
-                                                                         (dom/td nil "params:")
-                                                                         (dom/td nil (om/build synth-param-editor input)))]
-                                                        "sample" [(dom/tr nil
-                                                                         (dom/td nil nil)
-                                                                         (dom/td nil "grid-type:")
-                                                                         (dom/td nil (om/build grid-type-editor input)))
-                                                                  (dom/tr nil
-                                                                          (dom/td nil nil)
-                                                                          (dom/td nil "sample:")
-                                                                          (dom/td nil (om/build grid-sample-editor input)))
-                                                                  (dom/tr nil
-                                                                          (dom/td nil nil)
-                                                                          (dom/td nil "params:")
-                                                                          (dom/td nil (om/build sample-param-editor input)))]
-                                                        [(dom/tr nil
-                                                                 (dom/td nil nil)
-                                                                 (dom/td nil "grid-type:")
-                                                                 (dom/td nil (om/build grid-type-editor input)))])
-                                               [(dom/tr nil
-                                                        (dom/td nil nil)
-                                                        (dom/td nil "params:")
-                                                        (dom/td nil (om/build param-editor input)))])
-                                             [(dom/tr nil
-                                                      (dom/td closer "}")
-                                                      (dom/td nil nil)
-                                                      (dom/td nil))])))))))))
+                                                     (dom/td nil "params:")
+                                                     (dom/td nil (om/build param-editor input)))])
+                                          [(dom/tr nil
+                                                   (dom/td closer "}")
+                                                   (dom/td nil nil)
+                                                   (dom/td nil))])))))))))

 (defn track-builder [{:keys [cursor id set-state-ch]} owner]
   (reify


Simplify 'standard-metadata' to not quote anything

* Quoting is the responsibility of the calling macro

--- src/main/clojure/com/stuartsierra/lazytest/arguments.clj
+++ src/main/clojure/com/stuartsierra/lazytest/arguments.clj
@@ -21,18 +21,18 @@
   "Returns a metadata map with keys :ns, :file,
   :line, :form, :doc, and :name."
   ([form docstring]
-     `{:ns ~*ns*
-       :file ~*file*
-       :line ~(:line (meta form))
-       :form '~form
-       :doc ~docstring})
+     {:ns *ns*
+      :file *file*
+      :line (:line (meta form))
+      :form form
+      :doc docstring})
   ([form docstring name]
-     `{:ns ~*ns*
-       :file ~*file*
-       :line ~(:line (meta form))
-       :form '~form
-       :doc ~docstring
-       :name '~name}))
+     {:ns *ns*
+      :file *file*
+      :line (:line (meta form))
+      :form form
+      :doc docstring
+      :name name}))

 (defn firsts
   "Returns a vector of the first element of each pair."
@@ -61,18 +61,19 @@
 (assert (= [nil '(a b :c)] (get-options '(a b :c))))

 ;; standard-metadata
-(defmacro test-macro [name docstring & body]
-  `(defn ~name ~(standard-metadata &form docstring name) [] ~@body))
+(comment
+  (defmacro test-macro [name docstring & body]
+    `(defn ~name ~(standard-metadata &form docstring name) [] ~@body))

-(test-macro test-var "hello" (+ 1 2))
+  (test-macro test-var "hello" (+ 1 2))

-(let [m (meta (var test-var))]
-  (assert (= *ns* (:ns m)))
-  (assert (= 'test-var (:name m)))
-  (assert (= "hello" (:doc m)))
-  (assert (= '(test-macro test-var "hello" (+ 1 2)) (:form m)))
-  (assert (string? (:file m)))
-  (assert (integer? (:line m))))
+  (let [m (meta (var test-var))]
+    (assert (= *ns* (:ns m)))
+    (assert (= 'test-var (:name m)))
+    (assert (= "hello" (:doc m)))
+    (assert (= '(test-macro test-var "hello" (+ 1 2)) (:form m)))
+    (assert (string? (:file m)))
+    (assert (integer? (:line m)))))

 ;; firsts
 (assert (= '[a b c] (firsts '[a 1 b 2 c 3])))


Don't include this namespace in the documentation yet.

--- src/pipeline/grafter/pipeline.clj
+++ src/pipeline/grafter/pipeline.clj
@@ -1,4 +1,5 @@
 (ns grafter.pipeline
+  {:no-doc true}
   (:refer-clojure :exclude [ns-name])
   (:require [clojure.java.io :as io]
             [clojure.edn :as edn]


Removed superfluous `do`

Removed superfluous `do`

See https://github.com/marick/Midje/pull/228#discussion-diff-5308658 and
the following thread for reference.

* src/midje/emission/plugins/tap.clj:

Signed-off-by: giorgio-v <3a4d67eb2c7c1aeb8cfd15182af01f6f7ec0be3d@refactor.it>

--- src/midje/emission/plugins/tap.clj
+++ src/midje/emission/plugins/tap.clj
@@ -15,24 +15,21 @@
     (map #(str "# " %) (conj more (apply str (:position failure-map))))))

 (defn future-fact [description-list position]
-  (do
-    (swap! fact-counter inc)
-    (util/emit-one-line (str "not ok " @fact-counter
-                             " # TODO "
-                             (when-let [doc (util/format-nested-descriptions description-list)]
-                               (str (pr-str doc) " "))
-                             "at " (util/filename-lineno position)))))
+  (swap! fact-counter inc)
+  (util/emit-one-line (str "not ok " @fact-counter
+                           " # TODO "
+                           (when-let [doc (util/format-nested-descriptions description-list)]
+                             (str (pr-str doc) " "))
+                           "at " (util/filename-lineno position))))
 (defn fail [failure-map]
-  (do
-    (swap! fact-counter inc)
-    (util/emit-lines (format-failure-summary failure-map))
-    (util/emit-one-line
-     (str "not ok " @fact-counter))))
+  (swap! fact-counter inc)
+  (util/emit-lines (format-failure-summary failure-map))
+  (util/emit-one-line
+   (str "not ok " @fact-counter)))

 (defn pass []
-  (do
-    (swap! fact-counter inc)
-    (util/emit-one-line (str "ok " @fact-counter))))
+  (swap! fact-counter inc)
+  (util/emit-one-line (str "ok " @fact-counter)))

 (def last-namespace-shown (atom nil))


fixing icon path

fixing icon path

--- src/scullery_plateau/routings.clj
+++ src/scullery_plateau/routings.clj
@@ -39,7 +39,7 @@
 (defn build-app []
   (r/build-api
     {:page404 page404
-     :static {"/favicon.ico" ["resources/icon/favicon.ico"]
+     :static {"/favicon.ico" ["/resources/icon/favicon.ico"]
               "/script" ["/resources/js"]
               "/pages" ["/resources/pages"]
               "/css" ["/resources/css"]


Mention unquote in sample.project.clj

Mention unquote in sample.project.clj

--- sample.project.clj
+++ sample.project.clj
@@ -5,6 +5,8 @@

 ;; The project is named "sample", and its group-id is "org.example".
 (defproject org.example/sample "1.0.0-SNAPSHOT" ; version "1.0.0-SNAPSHOT"
+  ;; Beyond this point you may prepend a form with unquote, or ~, to eval it.
+
   ;; The descrption is used to allow searchability when uploaded to Clojars.
   :description "A sample project"
   ;; The URL is also metadata that Clojars uses.


Specify namespaces for sample project to compile.

--- sample/project.clj
+++ sample/project.clj
@@ -1,4 +1,5 @@
 (defproject nomnomnom "0.5.0-SNAPSHOT"
   :dependencies [[org.clojure/clojure "1.0.0"]
                  [rome/rome "0.9"]
-                 [org.ccil.cowan.tagsoup/tagsoup "1.2"]])
+                 [org.ccil.cowan.tagsoup/tagsoup "1.2"]]
+  :namespaces [nom.nom.nom])


Added AQL support to search granules on equator crossing longitude.

--- src/cmr/search/services/aql/conversion.clj
+++ src/cmr/search/services/aql/conversion.clj
@@ -54,7 +54,7 @@
              :temporal {:name :temporal :type :temporal}
              :additionalAttributes {:name :attribute :type :attribute}
              :orbitNumber {:name :orbit-number :type :orbit-number}
-             :equatorCrossingLongitude {:name :equator-crossing-longitude :type :num-range}
+             :equatorCrossingLongitude {:name :equator-crossing-longitude :type :equator-crossing-longitude}
              :equatorCrossingDate {:name :equator-crossing-date :type :equator-crossing-date}
              :TwoDCoordinateSystemName {:name :two-d-coordinate-system-name :type :string}}})

@@ -78,7 +78,7 @@

 (defn- update-values [m f & args]
   "update values in a map by applying the given function and args"
- (reduce (fn [r [k v]] (assoc r k (apply f v args))) {} m))
+  (reduce (fn [r [k v]] (assoc r k (apply f v args))) {} m))

 (defn- inheritance-condition
   "Returns the inheritance condition for the given key value and options"
@@ -131,6 +131,15 @@
         stop-date (date-time-from-strings year month day hour minute sec)]
     [start-date stop-date]))

+(defn- element->num-range
+  [concept-type element]
+  (let [string-double-fn (fn [n] (when n (Double. n)))
+        range-val (-> (cx/attrs-at-path element [:range])
+                      (set/rename-keys {:lower :min-value :upper :max-value})
+                      (update-in [:min-value] string-double-fn)
+                      (update-in [:max-value] string-double-fn))]
+    range-val))
+
 (defmulti element->condition
   "Converts a aql element into a condition"
   (fn [concept-type elem]
@@ -189,12 +198,11 @@
   [concept-type element]
   (if-let [value (cx/double-at-path element [:value])]
     (qm/map->OrbitNumberValueCondition {:value value})
-    (let [string-double-fn (fn [n] (when n (Double. n)))
-          range-val (-> (cx/attrs-at-path element [:range])
-                        (set/rename-keys {:lower :min-value :upper :max-value})
-                        (update-in [:min-value] string-double-fn)
-                        (update-in [:max-value] string-double-fn))]
-      (qm/map->OrbitNumberRangeCondition range-val))))
+    (qm/map->OrbitNumberRangeCondition (element->num-range concept-type element))))
+
+(defmethod element->condition :equator-crossing-longitude
+  [concept-type element]
+  (qm/map->EquatorCrossingLongitudeCondition (element->num-range concept-type element)))

 (def aql-query-type->concept-type
   "Mapping of AQL query type to search concept type"