Added beginnings of globbing function.

Added beginnings of globbing function.

--- vendor/compojure.clj
+++ vendor/compojure.clj
@@ -4,6 +4,9 @@
 (import '(javax.servlet.http HttpServlet
                              HttpServletRequest
                              HttpServletResponse))
+
+;;;; General-purpose functions ;;;;
+
 (defn includes?
   "Returns true if x is contained in coll, else false."
   [x coll]
@@ -20,12 +23,23 @@
   [re coll]
   (filter #(re-matches re %) coll))

-(def sep (. File separator))
-
-(defn file
+(defn re-escape
+  "Escape all special regex chars in a string s."
+  [s]
+  (escape "\\.*+|?()[]{}$^" s))
+
+(defn re-find-all
+  "Repeat re-find for matcher m until nil, and return the seq of results."
+  [m]
+  (doall (take-while identity
+    (map re-find (repeat m)))))
+
+;;;; File handling ;;;;
+
+(defmacro file
   "Returns an instance of java.io.File."
-  [path]
-  (new File path))
+  [& args]
+  `(new File ~@args))

 (defn pipe-stream
   "Pipe the contents of an InputStream into an OutputStream."
@@ -37,6 +51,32 @@
           (. out (write buffer 0 len))
           (recur (. in (read buffer))))))))

+(defn glob->regex
+  "Turns a shallow file glob into a regular expression."
+  [s]
+  (re-pattern
+    (.. (escape "\\.+|()[]{}$^" s)
+        (replaceAll "\\*" ".*")
+        (replaceAll "\\?" "."))))
+
+(defn split-path
+  "Splits a path up into its parts."
+  [path]
+  (loop [parts (list) path (file path)]
+    (let [parts (cons (. path (getName)) parts)]
+      (if-let parent (. path (getParent))
+        (recur parts (file parent))
+        parts))))
+
+(defn load-file-pattern
+  "Load all files matching a regular expression."
+  [re]
+  (doseq
+    file (grep re (map str (file-seq (file "."))))
+    (load-file file)))
+
+;;;; Mimetypes ;;;;
+
 (def *default-mimetype* "application/octet-stream")

 (defn context-mimetype
@@ -45,18 +85,9 @@
   (or (. context (getMimeType filename))
       *default-mimetype*))

-(defn re-escape
-  "Escape all special regex chars in a string s."
-  [s]
-  (escape "\\.*+|?()[]{}$^" s))
+;;;; Routes ;;;;

 (def symbol-regex (re-pattern ":([a-z_]+)"))
-
-(defn re-find-all
-  "Repeat re-find for matcher m until nil, and return the seq of results."
-  [m]
-  (doall (take-while identity
-    (map re-find (repeat m)))))

 (defn parse-route
   "Turn a route string into a regex and seq of symbols."
@@ -75,6 +106,25 @@
     (if (. matcher (matches))
       (apply hash-map
         (interleave symbols (rest (re-groups matcher)))))))
+
+(def #^{:doc
+  "A global list of all registered resources. A resource is a vector
+  consisting of a HTTP method, a parsed route, function that takes in
+  a context, request and response object.
+  e.g.
+  [\"GET\"
+   (parse-route \"/welcome/:name\")
+   (fn [context request response] ...)]"}
+  *resources* '())
+
+(defn assoc-route
+  "Associate a HTTP method and route with a resource."
+  [method route resource]
+  (def *resources*
+    (cons [method (parse-route route) resource]
+          *resources*)))
+
+;;;; Response ;;;;

 (defn update-response
   "Destructively update a HttpServletResponse via a Clojure datatype.
@@ -108,15 +158,7 @@
           "Content-Type" (context-mimetype context (str update))))
         (pipe-stream in out))))

-(def #^{:doc
-  "A global list of all registered resources. A resource is a vector
-  consisting of a HTTP method, a parsed route, function that takes in
-  a context, request and response object.
-  e.g.
-  [\"GET\"
-   (parse-route \"/welcome/:name\")
-   (fn [context request response] ...)]"}
-  *resources* '())
+;;;; Resource ;;;;

 (def #^{:doc
   "A set of bindings available to each resource. This can be extended
@@ -128,24 +170,17 @@
     header   #(. request (getHeader %))
     mime     #(context-mimetype (str %))))

-(defmacro pseudo-servlet
+(defmacro resource
   "Create a pseudo-servlet from a resource. It's not quite a real
   servlet because it's a function, rather than an HttpServlet object."
-  [& resource]
+  [& body]
   `(fn ~'[route context request response]
      (let ~(apply vector *resource-bindings*)
-       (update-response ~'response ~'context (do ~@resource)))))
-
-(defn add-resource
-  "Add a resource to the global *resources*."
-  [method route resource]
-  (def *resources*
-    (cons [method (parse-route route) resource]
-          *resources*)))
+       (update-response ~'response ~'context (do ~@body)))))

 (def *default-resource*
-  (pseudo-servlet
-    (let [static-file (file (str "public" sep full-path))]
+  (resource
+    (let [static-file (file "public" full-path)]
       (if (. static-file (isFile))
         static-file
         [404 "Cannot find file"]))))
@@ -165,19 +200,21 @@

 (defmacro GET "Creates a GET resource."
   [route & body]
-  `(add-resource "GET" ~route (pseudo-servlet ~@body)))
+  `(assoc-route "GET" ~route (resource ~@body)))

 (defmacro PUT "Creates a PUT resource."
   [route & body]
-  `(add-resource "POST" ~route (pseudo-servlet ~@body)))
+  `(assoc-route "POST" ~route (resource ~@body)))

 (defmacro POST "Creates a POST resource."
   [route & body]
-  `(add-resource "PUT" ~route (pseudo-servlet ~@body)))
+  `(assoc-route "PUT" ~route (resource ~@body)))

 (defmacro DELETE "Creates a DELETE resource."
   [route & body]
-  `(add-resource "DELETE" ~route (pseudo-servlet ~@body)))
+  `(assoc-route "DELETE" ~route (resource ~@body)))
+
+;;;; Servlet

 (def #^{:doc
   "A servlet that handles all requests into Compojure. Suitable for
@@ -188,10 +225,3 @@
         (let [context  (. this (getServletContext))
               resource (find-resource request response)]
           (resource context request response)))))
-
-(defn load-file-pattern
-  "Load all files matching a regular expression."
-  [re]
-  (doseq
-    file (grep re (map str (file-seq (file "."))))
-    (load-file file)))


Lose head in tests.

Lose head in tests.

--- test/com/hypirion/primes_test.clj
+++ test/com/hypirion/primes_test.clj
@@ -14,12 +14,12 @@

 (deftest serial-take
   (Primes/clear)
-  (doall
+  (dorun
    (map #(is (= %1 %2))
         (p/take 100008) hundred-thousand)))

 (deftest serial-primes
   (Primes/clear)
-  (doall
+  (dorun
    (map #(is (= %1 %2))
         (p/primes) hundred-thousand)))


Fix double roundtrip test.

Fix double roundtrip test.

--- test/incognito/fressian_test.cljs
+++ test/incognito/fressian_test.cljs
@@ -25,7 +25,7 @@
   (testing "Test two roundtrips, one incognito and deserialize at end."
     (let [bar            (map->Bar {:a [1 2 3] :b {:c "Fooos"}})
           write-handlers (atom {})
-          read-handlers  (atom {'incognito.fressian-test/Bar map->Bar})]
+          read-handlers  (atom {'incognito.fressian-test.Bar map->Bar})]
       (is (= bar
              (let [buffer (fress.api/byte-stream)
                    w      (fress.api/create-writer buffer


Fix reset order of chan atoms in min-peers-test

--- test/onyx/peer/min_peers_test.clj
+++ test/onyx/peer/min_peers_test.clj
@@ -63,6 +63,7 @@
                         {:lifecycle/task :out
                          :lifecycle/calls :onyx.plugin.core-async/writer-calls}]
             _ (reset! in-chan (chan (inc n-messages)))
+            _ (reset! out-chan (chan (sliding-buffer (inc n-messages))))
             _ (doseq [n (range n-messages)]
                 (>!! @in-chan {:n n}))
             _ (>!! @in-chan :done)
@@ -72,7 +73,6 @@
                                     :workflow workflow
                                     :lifecycles lifecycles
                                     :task-scheduler :onyx.task-scheduler/balanced})
-            _ (reset! out-chan (chan (sliding-buffer (inc n-messages))))
             results (take-segments! @out-chan)]

         (let [expected (set (map (fn [x] {:n (inc x)}) (range n-messages)))]


Add tests for extended hiccup syntax

Add tests for extended hiccup syntax

--- test/reagenttest/testreagent.cljs
+++ test/reagenttest/testreagent.cljs
@@ -504,3 +504,15 @@
       (fn [c div]
         ;; Just make sure this doesn't print a debug message
         ))))
+
+(deftest test-extended-syntax
+  (is (= (rstr [:p>b "foo"])
+         "
foo
"))
+  (is (= (rstr [:p.foo>b "x"])
+         (rstr [:p.foo [:b "x"]])))
+  (is (= (rstr [:div.foo>p.bar.foo>b.foobar "xy"])
+         (rstr [:div.foo [:p.bar.foo [:b.foobar "xy"]]])))
+  (is (= (rstr [:div.foo>p.bar.foo>b.foobar {} "xy"])
+         (rstr [:div.foo [:p.bar.foo [:b.foobar "xy"]]])))
+  (is (= (rstr [:div>p.bar.foo>a.foobar {:href "href"} "xy"])
+         (rstr [:div [:p.bar.foo [:a.foobar {:href "href"} "xy"]]]))))


Better log msg in client for testevent

Better log msg in client for testevent

--- src/rente/client/ws.cljs
+++ src/rente/client/ws.cljs
@@ -11,7 +11,7 @@

 (defmethod event-msg-handler :rente/testevent
   [{:as ev-msg :keys [?data]}]
-    (js/console.log "Channel socket successfully established!"))
+    (js/console.log "Testevent received from server"))

 (defmethod event-msg-handler :chsk/state
   [{:as ev-msg :keys [?data]}]


Minor fixes (whitespaces)

Minor fixes (whitespaces)

--- src/riemann/logstash.clj
+++ src/riemann/logstash.clj
@@ -38,7 +38,7 @@
 (defrecord LogStashUDPClient [^String host ^int port]
   LogStashClient
   (open [this]
-    (assoc this
+    (assoc this
            :socket (DatagramSocket.)
            :host host
            :port port))
@@ -50,8 +50,6 @@
       (.send ^DatagramSocket (:socket this) datagram)))
   (close [this]
     (.close ^DatagramSocket (:socket this))))
-
-

 (defn logstash
   "Returns a function which accepts an event and sends it to logstash.


Specify minimum requirements for events

Specify minimum requirements for events

--- src/rill/event_store.clj
+++ src/rill/event_store.clj
@@ -43,6 +43,8 @@
    "Appends `events' to stream `stream-id' at position `from-version'. Returns
     `true' if successful or `false' for failure.

+    Events must be maps of printable/readable clojure data.
+
     EventStore implementations must make it impossible to append events in
     positions that are already taken, and should make it impossible to append
     events in any position except the one immediately following the last taken


CMR-2920 fix http status for create user with json

--- mock-echo-app/src/cmr/mock_echo/api/urs.clj
+++ mock-echo-app/src/cmr/mock_echo/api/urs.clj
@@ -48,7 +48,8 @@
   [context body]
   (println "JSON BODY = " body)
   (let [users (json/decode body true)]
-    (urs-db/create-users context users)))
+    (urs-db/create-users context users)
+    {:status 201}))

 (defn parse-user-request-xml
   "Parses a login request into a map of username and password"


Change default opened options on project open (#28)

--- src/uxbox/data/workspace.cljs
+++ src/uxbox/data/workspace.cljs
@@ -52,7 +52,7 @@
              {:project project
               :zoom 1
               :page page
-              :flags #{:layers :element-options}
+              :flags #{:sitemap :drawtools :layers}
               :selected #{}
               :drawing nil})))


Update docstrings: "attr" -> :attr

Update docstrings: "attr" -> :attr

--- src/taoensso/faraday.clj
+++ src/taoensso/faraday.clj
@@ -65,7 +65,6 @@
             java.nio.ByteBuffer))

 ;;;; TODO
-;; * Docstrings: "key|table-name" -> :key|table-name.
 ;; * hash-key -> prim-key?
 ;; * Finish up code walk-through.
 ;; * Go through Rotary PRs, non-PR forks.
@@ -210,7 +209,7 @@
           pr))))
    indexes))

-(defn- expected-values "{attr cond} -> {attr ExpectedAttributeValue}"
+(defn- expected-values "{:attr cond} -> {\"attr\" ExpectedAttributeValue}"
   [expected]
   (when (seq expected)
     (utils/name-map
@@ -315,7 +314,7 @@
     :hash-key   - (required) {:name _ :type #{:s :n :ss :ns :b :bs}}.
     :range-key  - (optional) {:name _ :type #{:s :n :ss :ns :b :bs}}.
     :indexes    - (optional) [{:name _ :range-key _
-                               :projection #{:all :keys-only [attr1 ...]}}]"
+                               :projection #{:all :keys-only [:attr1 ...]}}]"
   [creds {table-name :name
           :keys [throughput hash-key range-key indexes]
           :or   {throughput {:read 1 :write 1}}}]
@@ -353,7 +352,7 @@
 ;;;; API - items

 (defn get-item
-  "Retrieves an item from a table by its hash key, {attr match-value}."
+  "Retrieves an item from a table by its hash key, {:attr match-value}."
   [creds table hash-key & [{:keys [consistent? attrs-to-get]}]]
   (as-map
    (.getItem (db-client creds)
@@ -368,9 +367,9 @@
     :return   - e/o #{:none :all-old :updated-old :all-new :updated-new}
     :expected - a map of attribute/condition pairs, all of which must be met for
                 the operation to succeed. e.g.:
-                  {\"my-attr\" \"expected-value\"}
-                  {\"my-attr\" true\"}  ; Attr must exist
-                  {\"my-attr\" false\"} ; Attr must not exist"
+                  {:attr \"expected-value\"}
+                  {:attr true}  ; Attribute must exist
+                  {:attr false} ; Attribute must not exist"
   [creds table item & [{:keys [return expected]
                         :or   {return :none}}]]
   (as-map
@@ -382,7 +381,7 @@
        (.setReturnValues (utils/enum return))))))

 (defn update-item
-  "Updates an item in a table by its hash key, {attr match-value}.
+  "Updates an item in a table by its hash key, {:attr match-value}.
   See `put-item` for option docs."
   [creds table hash-key update-map & [{:keys [return expected]
                                        :or   {return :none}}]]
@@ -396,7 +395,7 @@
        (.setReturnValues     (utils/enum return))))))

 (defn delete-item
-  "Deletes an item from a table by its hash key, {attr match-value}.
+  "Deletes an item from a table by its hash key, {:attr match-value}.
   See `put-item` for option docs."
   [creds table hash-key & [{:keys [return expected]
                             :or   {return :none}}]]
@@ -434,11 +433,11 @@

   Example:
   (batch-get-item cred
-    {:users {:key-name \"names\"
+    {:users {:key-name :names
              :keys [\"alice\" \"bob\"]}
-     :posts {:key-name \"id\"
+     :posts {:key-name :id
              :keys [1 2 3]
-             :attrs [\"timestamp\" \"subject\"]
+             :attrs [:timestamp :subject]
              :consistent true}})"
   [creds requests]
   (as-map
@@ -561,8 +560,8 @@

 (defn query
   "Return the items in a table matching the supplied hash key,
-  defined in the form {\"hash-attr\" hash-value}.
-  Can specify a range clause if the table has a range-key ie. `(\"range-attr\" >= 234)
+  defined in the form {:hash-attr hash-value}.
+  Can specify a range clause if the table has a range-key ie. `(:range-attr >= 234)
   Takes the following options:
     :order - may be :asc or :desc (defaults to :asc)
     :attrs - limit the values returned to the following attribute names


Add `setup-proportions` function to geom helpers.

--- src/uxbox/main/geom.cljs
+++ src/uxbox/main/geom.cljs
@@ -251,6 +251,23 @@
   [shape index point]
   (assoc-in shape [:points index] point))

+;; --- Setup Proportions
+
+(declare setup-proportions-rect)
+
+(defn setup-proportions
+  [shape]
+  (case (:type shape)
+    :rect (setup-proportions-rect shape)
+    :icon (setup-proportions-rect shape)
+    :circle (setup-proportions-rect shape)
+    shape))
+
+(defn setup-proportions-rect
+  [shape]
+  (let [{:keys [width height]} (size shape)]
+    (assoc shape :proportion (/ width height))))
+
 ;; --- Resize (Absolute)

 (declare resize-rect)


Protocol ack reads do not need reference counts

--- src/onyx/messaging/protocol_aeron.clj
+++ src/onyx/messaging/protocol_aeron.clj
@@ -83,7 +83,7 @@
         (let [id (get-uuid buf offset)
               completion-id (get-uuid buf (unchecked-add offset 16))
               ack-val (.getLong buf (unchecked-add offset 32))]
-          (recur (conj messages (->Ack id completion-id ack-val (atom 1) nil))
+          (recur (conj messages (->Ack id completion-id ack-val nil nil))
                  (inc cnt)
                  (unchecked-add offset 40)))))))

@@ -100,7 +100,7 @@
   (let [id (get-uuid buf offset)
         completion-id (get-uuid buf (unchecked-add offset 16))
         ack-val (.getLong buf (unchecked-add offset 32))]
-    (->Ack id completion-id ack-val (atom 1) nil)))
+    (->Ack id completion-id ack-val nil nil)))

 (defn read-completion [^UnsafeBuffer buf ^long offset]
   (get-uuid buf offset))


Leaf constructor was called with wrong arity.

--- src/onyx/messaging/protocol_netty.clj
+++ src/onyx/messaging/protocol_netty.clj
@@ -103,7 +103,7 @@
         acker-id (take-uuid buf)
         completion-id (take-uuid buf)
         ack-val (.readLong buf)]
-    (->Leaf message id acker-id completion-id ack-val)))
+    (->Leaf message id acker-id completion-id ack-val nil nil)))

 (defn build-messages-msg-buf [compress-f messages]
   (let [message-bytes ^bytes (compress-f (map :message messages))


fix the wrong typo: js->clj

fix the wrong typo: js->clj


Don't try to set __cached fields in assoc-record

--- src/useful/datatypes.clj
+++ src/useful/datatypes.clj
@@ -22,6 +22,9 @@
   [type]
   (->> (.getDeclaredFields (coerce-class type))
        (remove #(java.lang.reflect.Modifier/isStatic (.getModifiers ^Field %)))
+       (remove #(let [name (.getName ^Field %)]
+                  (and (not (#{"__extmap" "__meta"} name))
+                       (.startsWith name "__"))))
        (map #(symbol (normalize-field-name (.getName ^Field %))))))

 (defmacro make-record


match by id

match by id

--- clojure/src/dnd/character.cljs
+++ clojure/src/dnd/character.cljs
@@ -13,7 +13,7 @@
                          :direction "n"
                          :can-move true })

-(defn is-character [inhabitant] (:isPlayer inhabitant))
+(defn match-id [id] #(= (% :id) id))

 (defn character-direction [dx dy]
   (if (= dx 0)
@@ -67,17 +67,16 @@
 (defn rocks []
   (item-maker rocks-han [130 130 130] "rubble"))

-
 (defn redirect-character [character dx dy]
   (assoc character :direction (character-direction dx dy)))

 (defn move-character [level character dx dy]
   (if-let [target-block (get-in level [dx dy])]
     (if-let [not-solid (not (:solid target-block))]
-      (let [{ox :x oy :y} character
+      (let [{ox :x oy :y id :id} character
             {old-inhabitants :inhabitants} (get-in level [ox oy])
             level-without-character (update-in level [ox oy]
-                                               #(assoc % :inhabitants (remove is-character old-inhabitants)))
+                                               #(assoc % :inhabitants (remove (match-id id) old-inhabitants)))
             target-inhabitants (:inhabitants target-block)
             updated-character (assoc character :x dx :y dy)
             update-habs #(assoc % :inhabitants (conj target-inhabitants updated-character))
@@ -99,9 +98,9 @@
     (update-in level [x y] update-habs)))

 (defn get-item [level character]
-  (let [{:keys [x y inventory]} character
+  (let [{:keys [id x y inventory]} character
         {old-inhabitants :inhabitants} (get-in level [x y])
-        gotten-inhabitant (first (remove is-character old-inhabitants))
+        gotten-inhabitant (first (remove (match-id id) old-inhabitants))
         updated-character (if (nil? gotten-inhabitant)
                             character
                             (assoc character :inventory


Make generate-input support empty collections (#67)

* make generate-input support empty collections by using Generate/empty method
* reuse input coder


Add forgotten github url

Add forgotten github url

:-!

--- test/testsuite/github_login_no_username.clj
+++ test/testsuite/github_login_no_username.clj
@@ -5,6 +5,7 @@

 (deftest login-to-github-no-username
   (browser-up)
+  (to "http://www.github.com")
   (click "a[href*='login']")
   (input-text "#password" "your-password")
   (submit "#password")


Rename variables

Rename variables

--- frontend/src/cruncher/rename.cljs
+++ frontend/src/cruncher/rename.cljs
@@ -3,7 +3,8 @@
             [om.dom :as dom :include-macros true]
             [goog.dom :as gdom]
             [cruncher.utils.views :as vlib]
-            [cruncher.utils.lib :as lib]))
+            [cruncher.utils.lib :as lib]
+            [cruncher.config :as config]))

 (defn- dispatch-scheme
   "Gets a string containing the user's selection. Construct the new nickname from it."
@@ -15,10 +16,8 @@
       (= "rename-scheme-2" scheme) (str at "/" df "/" st)
       (= "rename-scheme-3" scheme) (str iv-int "%"))))

-(defn- do-the-rename-dance!
-  "Rename all selected pokemon according to the selected scheme. Not reversible!
-
-   Returns list of maps like this one: {:id 42, :name 33% 15/0/0}, while :name is also
+(defn- create-list-of-new-names
+  "Returns list of maps like this one: {:id 42, :name 33% 15/0/0}, while :name is also
    a string."
   [scheme]
   (let [rows (gdom/getElementsByClass "poketable-row")]
@@ -30,23 +29,31 @@
                               st (.getAttribute row "data-st")
                               checkbox (gdom/getElement (str "poketable-checkbox-" id))]
                           (when (.-checked checkbox)
-                            {:id id :name (dispatch-scheme scheme iv at df st)})))
+                            {:id id
+                             :name (dispatch-scheme scheme iv at df st)})))
                       rows))))
+
+(defn- do-the-rename-dance!
+  "Rename all selected pokemon according to the selected scheme. Not reversible!"
+  [this scheme]
+  (let [url (:rename-selected-pokemon config/api)
+        new-nicknames (create-list-of-new-names scheme)]
+    (lib/log new-nicknames)))

 (defui SelectSchemes
   Object
   (render [this]
-    (let [selected (or (om/get-state this :selected) "rename-scheme-1")]
+    (let [scheme (or (om/get-state this :scheme) "rename-scheme-1")]
       (dom/div nil
                (dom/div #js {:className "input-group"}
                         (dom/select #js {:className "form-control"
-                                         :onChange  #(vlib/commit-component-state this :selected %)
-                                         :value     selected}
+                                         :onChange  #(vlib/commit-component-state this :scheme %)
+                                         :value     scheme}
                                     (dom/option #js {:value "rename-scheme-1"} "IV% AT/DF/ST")
                                     (dom/option #js {:value "rename-scheme-2"} "AT/DF/ST")
                                     (dom/option #js {:value "rename-scheme-3"} "IV%"))
                         (dom/div #js {:className "input-group-btn"}
-                                 (vlib/button-default #(do-the-rename-dance! selected) "Rename")))))))
+                                 (vlib/button-default #(do-the-rename-dance! this scheme) "Rename")))))))
 (def select-schemes (om/factory SelectSchemes {}))

 (defui RenamingControls


increase namespace ID

increase namespace ID

increase namespace ID

--- idesandboxcode/myappshare/mainapp.cljs
+++ idesandboxcode/myappshare/mainapp.cljs
@@ -54,7 +54,7 @@

 (defn load-fn [lib cb]
   (do
-    ;(swap! autoin inc)
+    (swap! autoin inc)
     (let [filename (str "/appshare/outide/" (:path lib) ".cljs?autoin=" @autoin )]
       ;(log (str "load-fn:" filename))
       (get-file   filename


Hotfix. twitter-uri is now a function

Hotfix. twitter-uri is now a function

--- src/word_keeper/auth.clj
+++ src/word_keeper/auth.clj
@@ -14,7 +14,7 @@

 (def request-token (oauth/request-token consumer "http://word-keeper.clojurecup.com/signin"))

-(def twitter-auth-uri (oauth/user-approval-uri consumer (:oauth_token request-token)))
+(defn twitter-auth-uri [] (oauth/user-approval-uri consumer (:oauth_token request-token)))

 (defn authorize [verifier]
   (oauth/access-token consumer request-token verifier))


Use letfn where appropriate.

Use letfn where appropriate.

--- src/afterglow/fixtures/chauvet.clj
+++ src/afterglow/fixtures/chauvet.clj
@@ -102,119 +102,119 @@
   ([]
    (intimidator-scan-led-300 :11-channel))
   ([mode]
-   (let [build-color-wheel (fn [channel]
-                             (chan/functions :color channel
-                                             0 "Color Wheel Open"
-                                             7 (chan/color-wheel-hue "yellow")
-                                             14 "Color Wheel Pink"
-                                             21 (chan/color-wheel-hue "green")
-                                             28 "Color Wheel Peachblow"
-                                             35 "Color Wheel Light Blue"
-                                             42 "Color Wheel Kelly"
-                                             49 (chan/color-wheel-hue "red")
-                                             56 (chan/color-wheel-hue "blue")
-                                             64 "Color Wheel White + Yellow"
-                                             71 "Color Wheel Yellow + Pink"
-                                             78 "Color Wheel Pink + Green"
-                                             85 "Color Wheel Green + Peachblow"
-                                             92 "Color Wheel Peachblow + Blue"
-                                             99 "Color Wheel Blue + Kelly"
-                                             106 "Color Wheel Kelly + Red"
-                                             113 "Color Wheel Red + Blue"
-                                             120 "Color Wheel Blue + White"
-                                             128 {:type :color-clockwise
-                                                  :label "Color Wheel Clockwise (slow->fast)"
-                                                  :var-label "CW (slow->fast)"
-                                                  :range :variable}
-                                             192 {:type :color-counterclockwise
-                                                  :label "Color Wheel Counterclockwise (slow->fast)"
-                                                  :var-label "CCW (slow->fast)"
-                                                  :range :variable}))
-         build-shutter (fn [channel]
-                         (chan/functions :shutter channel
-                                         0 "Shutter Closed"
-                                         4 "Shutter Open"
-                                         8 {:type :strobe
-                                            :label "Strobe"
-                                            :range :variable}
-                                         216 "Shutter Open 2"))
-                  gobo-names ["Pink Dots" "Purple Bubbles" "45 Adapter" "Nested Rings" "Rose" "Triangles" "Galaxy"]
-         build-gobo-wheel (fn [channel]
-                            (chan/functions :gobo channel
-                                            (range 0 63 8) (build-gobo-entries false (concat ["Open"] gobo-names))
-                                            (range 64 119 8) (build-gobo-entries true (reverse gobo-names))
-                                            120 "Gobo Open 2"
-                                            128 {:type :gobo-clockwise
-                                                 :label "Gobo Clockwise Speed"
-                                                 :var-label "CW Speed"
-                                                 :range :variable}
-                                            192 {:type :gobo-counterclockwise
-                                                 :label "Gobo Counterclockwise Speed"
-                                                 :var-label "CCW Speed"
-                                                 :range :variable}))
-         build-gobo-rotation (fn [channel]
-                               (chan/functions :gobo-rotation channel
-                                               0 nil
-                                               16 {:type :gobo-rotation-counterclockwise
-                                                   :label "Gobo Rotation Counterlockwise (slow->fast)"
-                                                   :var-label "CCW (slow->fast)"
-                                                   :range :variable}
-                                               128 {:type :gobo-rotation-clockwise
-                                                    :label "Gobo Rotation Clockwise (slow->fast)"
-                                                    :var-label "CW (slow->fast)"
-                                                    :range :variable}
-                                               240 :gobo-bounce))]
-     (merge {:name "Chauvet Intimidator Scan LED 300"
-             :pan-center 128 :pan-half-circle 128 ; TODO: Fix these values
-             :tilt-center 128 :tilt-half-circle 128 ; TODO: Fix these values
-             :mode mode}
-            (case mode
-              :11-channel
-              {:channels [(chan/pan 1)
-                          (chan/tilt 2)
-                          (build-color-wheel 3)
-                          (build-shutter 4)
-                          (chan/dimmer 5)
-                          (build-gobo-wheel 6)
-                          (build-gobo-rotation 7)
-                          (chan/functions :prism 8
-                                          0 "Prism Out"
-                                          4 "Prism In")
-                          (chan/focus 9)
-                          (chan/functions :control 10
-                                          8 "Blackout while moving Pan/Tilt"
-                                          16 "Disable Blackout while moving Pan/Tilt"
-                                          24 "Blackout while moving Color Wheel"
-                                          32 "Disable Blackout while moving Color Wheel"
-                                          40 "Blackout while moving Gobo Wheel"
-                                          48 "Disable Blackout while moving Gobo Wheel"
-                                          56 "Fast Movement"
-                                          64 "Disable Fast Movement"
-                                          88 "Disable all Blackout while moving"
-                                          96 "Reset Pan/Tilt"
-                                          104 nil
-                                          112 "Reset Color Wheel"
-                                          120 "Reset Gobo Wheel"
-                                          128 nil
-                                          136 "Reset Prism"
-                                          144 "Reset Focus"
-                                          152 "Reset All"
-                                          160 nil)
-                          (chan/functions :control 11
-                                          0 nil
-                                          (range 8 135 16) "Program"
-                                          (range 136 255 16) :sound-active)]}
-              :8-channel
-              {:channels [(chan/pan 1)
-                          (chan/tilt 2)
-                          (build-color-wheel 3)
-                          (build-shutter 4)
-                          (build-gobo-wheel 5)
-                          (build-gobo-rotation 6)
-                          (chan/functions :prism 7
-                                          0 "Prism Out"
-                                          4 "Prism In")
-                          (chan/focus 8)]})))))
+   (let [gobo-names ["Pink Dots" "Purple Bubbles" "45 Adapter" "Nested Rings" "Rose" "Triangles" "Galaxy"]]
+     (letfn [(build-color-wheel [channel]
+               (chan/functions :color channel
+                               0 "Color Wheel Open"
+                               7 (chan/color-wheel-hue "yellow")
+                               14 "Color Wheel Pink"
+                               21 (chan/color-wheel-hue "green")
+                               28 "Color Wheel Peachblow"
+                               35 "Color Wheel Light Blue"
+                               42 "Color Wheel Kelly"
+                               49 (chan/color-wheel-hue "red")
+                               56 (chan/color-wheel-hue "blue")
+                               64 "Color Wheel White + Yellow"
+                               71 "Color Wheel Yellow + Pink"
+                               78 "Color Wheel Pink + Green"
+                               85 "Color Wheel Green + Peachblow"
+                               92 "Color Wheel Peachblow + Blue"
+                               99 "Color Wheel Blue + Kelly"
+                               106 "Color Wheel Kelly + Red"
+                               113 "Color Wheel Red + Blue"
+                               120 "Color Wheel Blue + White"
+                               128 {:type :color-clockwise
+                                    :label "Color Wheel Clockwise (slow->fast)"
+                                    :var-label "CW (slow->fast)"
+                                    :range :variable}
+                               192 {:type :color-counterclockwise
+                                    :label "Color Wheel Counterclockwise (slow->fast)"
+                                    :var-label "CCW (slow->fast)"
+                                    :range :variable}))
+             (build-shutter [channel]
+               (chan/functions :shutter channel
+                               0 "Shutter Closed"
+                               4 "Shutter Open"
+                               8 {:type :strobe
+                                  :label "Strobe"
+                                  :range :variable}
+                               216 "Shutter Open 2"))
+             (build-gobo-wheel [channel]
+               (chan/functions :gobo channel
+                               (range 0 63 8) (build-gobo-entries false (concat ["Open"] gobo-names))
+                               (range 64 119 8) (build-gobo-entries true (reverse gobo-names))
+                               120 "Gobo Open 2"
+                               128 {:type :gobo-clockwise
+                                    :label "Gobo Clockwise Speed"
+                                    :var-label "CW Speed"
+                                    :range :variable}
+                               192 {:type :gobo-counterclockwise
+                                    :label "Gobo Counterclockwise Speed"
+                                    :var-label "CCW Speed"
+                                    :range :variable}))
+             (build-gobo-rotation [channel]
+               (chan/functions :gobo-rotation channel
+                               0 nil
+                               16 {:type :gobo-rotation-counterclockwise
+                                   :label "Gobo Rotation Counterlockwise (slow->fast)"
+                                   :var-label "CCW (slow->fast)"
+                                   :range :variable}
+                               128 {:type :gobo-rotation-clockwise
+                                    :label "Gobo Rotation Clockwise (slow->fast)"
+                                    :var-label "CW (slow->fast)"
+                                    :range :variable}
+                               240 :gobo-bounce))]
+       (merge {:name "Chauvet Intimidator Scan LED 300"
+               :pan-center 128 :pan-half-circle 128 ; TODO: Fix these values
+               :tilt-center 128 :tilt-half-circle 128 ; TODO: Fix these values
+               :mode mode}
+              (case mode
+                :11-channel
+                {:channels [(chan/pan 1)
+                            (chan/tilt 2)
+                            (build-color-wheel 3)
+                            (build-shutter 4)
+                            (chan/dimmer 5)
+                            (build-gobo-wheel 6)
+                            (build-gobo-rotation 7)
+                            (chan/functions :prism 8
+                                            0 "Prism Out"
+                                            4 "Prism In")
+                            (chan/focus 9)
+                            (chan/functions :control 10
+                                            8 "Blackout while moving Pan/Tilt"
+                                            16 "Disable Blackout while moving Pan/Tilt"
+                                            24 "Blackout while moving Color Wheel"
+                                            32 "Disable Blackout while moving Color Wheel"
+                                            40 "Blackout while moving Gobo Wheel"
+                                            48 "Disable Blackout while moving Gobo Wheel"
+                                            56 "Fast Movement"
+                                            64 "Disable Fast Movement"
+                                            88 "Disable all Blackout while moving"
+                                            96 "Reset Pan/Tilt"
+                                            104 nil
+                                            112 "Reset Color Wheel"
+                                            120 "Reset Gobo Wheel"
+                                            128 nil
+                                            136 "Reset Prism"
+                                            144 "Reset Focus"
+                                            152 "Reset All"
+                                            160 nil)
+                            (chan/functions :control 11
+                                            0 nil
+                                            (range 8 135 16) "Program"
+                                            (range 136 255 16) :sound-active)]}
+                :8-channel
+                {:channels [(chan/pan 1)
+                            (chan/tilt 2)
+                            (build-color-wheel 3)
+                            (build-shutter 4)
+                            (build-gobo-wheel 5)
+                            (build-gobo-rotation 6)
+                            (chan/functions :prism 7
+                                            0 "Prism Out"
+                                            4 "Prism In")
+                            (chan/focus 8)]}))))))

 (defn intimidator-spot-led-150
   "[Intimidator Spot LED 150](http://www.chauvetlighting.com/intimidator-spot-led-150.html) moving yoke.
@@ -235,98 +235,98 @@
   ([]
    (intimidator-spot-led-150 :11-channel))
   ([mode]
-   (let [build-color-wheel (fn [channel]
-                             (chan/functions :color channel
-                                             0 "Color Wheel Open"
-                                             (range 6 47 6) (chan/color-wheel-hue ["yellow" "magenta" "green" "red"
-                                                                                "cyan" "orange" "blue"])
-                                             48 "Color Wheel Light Green"
-                                             54 (chan/color-wheel-hue 45 :label "Color Wheel Amber")
-                                             64 "Color Wheel White + Yellow"
-                                             70 "Color Wheel Yellow + Magenta"
-                                             76 "Color Wheel Magenta + Green"
-                                             82 "Color Wheel Green + Red"
-                                             88 "Color Wheel Red + Cyan"
-                                             94 "Color Wheel Cyan + Orange"
-                                             100 "Color Wheel Orange + Blue"
-                                             106 "Color Wheel Blue + Light Green"
-                                             112 "Color Wheel Light Green + Amber"
-                                             118 "Color Wheel Amber + White"
-                                             128 {:type :color-clockwise
-                                                  :label "Color Wheel Clockwise (fast->slow)"
-                                                  :var-label "CW (fast->slow)"
-                                                  :range :variable}
-                                             192 {:type :color-counterclockwise
-                                                  :label "Color Wheel Counterclockwise (slow->fast)"
-                                                  :var-label "CCW (fast->slow)"
-                                                  :range :variable}))
-         build-shutter (fn [channel]
-                         (chan/functions :shutter channel
-                                         0 "Shutter Closed"
-                                         4 "Shutter Open"
-                                         8 {:type :strobe
-                                            :label "Strobe (0-20Hz)"
-                                            :scale-fn (partial chan-fx/function-value-scaler 0 200)
-                                            :range :variable}
-                                         216 "Shutter Open 2"))
-         gobo-names ["Quotes" "Warp Spots" "4 Dots" "Sail Swirl" "Starburst" "Star Field" "Optical Tube"
-                     "Sun Swirl" "Star Echo"]
-         build-gobo-wheel (fn [channel]
-                            (chan/functions :gobo channel
-                                            (range 0 63 6) (build-gobo-entries false (concat ["Open"] gobo-names))
-                                            (range 64 121 6) (build-gobo-entries true (reverse gobo-names))
-                                            122 "Gobo Open 2"
-                                            128 {:type :gobo-clockwise
-                                                 :label "Gobo Clockwise Speed"
-                                                 :var-label "CW Speed"
-                                                 :range :variable}
-                                            192 {:type :gobo-counterclockwise
-                                                 :label "Gobo Counterclockwise Speed"
-                                                 :var-label "CCW Speed"
-                                                 :range :variable}))]
-        (merge {:name "Chauvet Intimidator Spot LED 150"
-                :mode mode}
-               (case mode
-                 :11-channel
-                 {:pan-center 128 :pan-half-circle 128 ; TODO: Fix these values
-                  :tilt-center 128 :tilt-half-circle 128 ; TODO: Fix these values
-                  :channels [(chan/pan 1 3)
-                             (chan/tilt 2 4)
-                             (chan/fine-channel :pan-tilt-speed 5
-                                                :function-name "Pan / Tilt Speed"
-                                                :var-label "P/T fast->slow")
-                             (build-color-wheel 6)
-                             (build-shutter 7)
-                             (chan/dimmer 8)
-                             (build-gobo-wheel 9)
-                             (chan/functions :control-functions 10
-                                             0 nil
-                                             8 "Blackout while moving Pan/Tilt"
-                                             28 "Blackout while moving Gobo Wheel"
-                                             48 "Disable blackout while Pan/Tilt / moving Gobo Wheel"
-                                             68 "Blackout while moving Color Wheel"
-                                             88 "Disable blackout while Pan/Tilt / moving Color Wheel"
-                                             108 "Disable blackout while moving Gobo/Color Wheel"
-                                             128 "Diable blackout while moving all options"
-                                             148 "Reset Pan"
-                                             168 "Reset Tilt"
-                                             188 "Reset Color Wheel"
-                                             208 "Reset Gobo Wheel"
-                                             228 "Reset All Channels"
-                                             248 nil)
-                             (chan/functions :movement-macros 11
-                                             0 nil
-                                             (range 8 135 16) "Program"
-                                             (range 136 255 16) "Sound Active")]}
-                 :6-channel
-                 {:pan-center 128 :pan-half-circle 128 ; TODO: Fix these values
-                  :tilt-center 128 :tilt-half-circle 128 ; TODO: Fix these values
-                  :channels [(chan/pan 1)
-                             (chan/tilt 2)
-                             (build-color-wheel 3)
-                             (build-shutter 4)
-                             (chan/dimmer 5)
-                             (build-gobo-wheel 6)]})))))
+   (let [gobo-names ["Quotes" "Warp Spots" "4 Dots" "Sail Swirl" "Starburst" "Star Field" "Optical Tube"
+                     "Sun Swirl" "Star Echo"]]
+     (letfn [(build-color-wheel [channel]
+               (chan/functions :color channel
+                               0 "Color Wheel Open"
+                               (range 6 47 6) (chan/color-wheel-hue ["yellow" "magenta" "green" "red"
+                                                                     "cyan" "orange" "blue"])
+                               48 "Color Wheel Light Green"
+                               54 (chan/color-wheel-hue 45 :label "Color Wheel Amber")
+                               64 "Color Wheel White + Yellow"
+                               70 "Color Wheel Yellow + Magenta"
+                               76 "Color Wheel Magenta + Green"
+                               82 "Color Wheel Green + Red"
+                               88 "Color Wheel Red + Cyan"
+                               94 "Color Wheel Cyan + Orange"
+                               100 "Color Wheel Orange + Blue"
+                               106 "Color Wheel Blue + Light Green"
+                               112 "Color Wheel Light Green + Amber"
+                               118 "Color Wheel Amber + White"
+                               128 {:type :color-clockwise
+                                    :label "Color Wheel Clockwise (fast->slow)"
+                                    :var-label "CW (fast->slow)"
+                                    :range :variable}
+                               192 {:type :color-counterclockwise
+                                    :label "Color Wheel Counterclockwise (slow->fast)"
+                                    :var-label "CCW (fast->slow)"
+                                    :range :variable}))
+             (build-shutter [channel]
+               (chan/functions :shutter channel
+                               0 "Shutter Closed"
+                               4 "Shutter Open"
+                               8 {:type :strobe
+                                  :label "Strobe (0-20Hz)"
+                                  :scale-fn (partial chan-fx/function-value-scaler 0 200)
+                                  :range :variable}
+                               216 "Shutter Open 2"))
+             (build-gobo-wheel [channel]
+               (chan/functions :gobo channel
+                               (range 0 63 6) (build-gobo-entries false (concat ["Open"] gobo-names))
+                               (range 64 121 6) (build-gobo-entries true (reverse gobo-names))
+                               122 "Gobo Open 2"
+                               128 {:type :gobo-clockwise
+                                    :label "Gobo Clockwise Speed"
+                                    :var-label "CW Speed"
+                                    :range :variable}
+                               192 {:type :gobo-counterclockwise
+                                    :label "Gobo Counterclockwise Speed"
+                                    :var-label "CCW Speed"
+                                    :range :variable}))]
+       (merge {:name "Chauvet Intimidator Spot LED 150"
+               :mode mode}
+              (case mode
+                :11-channel
+                {:pan-center 128 :pan-half-circle 128 ; TODO: Fix these values
+                 :tilt-center 128 :tilt-half-circle 128 ; TODO: Fix these values
+                 :channels [(chan/pan 1 3)
+                            (chan/tilt 2 4)
+                            (chan/fine-channel :pan-tilt-speed 5
+                                               :function-name "Pan / Tilt Speed"
+                                               :var-label "P/T fast->slow")
+                            (build-color-wheel 6)
+                            (build-shutter 7)
+                            (chan/dimmer 8)
+                            (build-gobo-wheel 9)
+                            (chan/functions :control-functions 10
+                                            0 nil
+                                            8 "Blackout while moving Pan/Tilt"
+                                            28 "Blackout while moving Gobo Wheel"
+                                            48 "Disable blackout while Pan/Tilt / moving Gobo Wheel"
+                                            68 "Blackout while moving Color Wheel"
+                                            88 "Disable blackout while Pan/Tilt / moving Color Wheel"
+                                            108 "Disable blackout while moving Gobo/Color Wheel"
+                                            128 "Diable blackout while moving all options"
+                                            148 "Reset Pan"
+                                            168 "Reset Tilt"
+                                            188 "Reset Color Wheel"
+                                            208 "Reset Gobo Wheel"
+                                            228 "Reset All Channels"
+                                            248 nil)
+                            (chan/functions :movement-macros 11
+                                            0 nil
+                                            (range 8 135 16) "Program"
+                                            (range 136 255 16) "Sound Active")]}
+                :6-channel
+                {:pan-center 128 :pan-half-circle 128 ; TODO: Fix these values
+                 :tilt-center 128 :tilt-half-circle 128 ; TODO: Fix these values
+                 :channels [(chan/pan 1)
+                            (chan/tilt 2)
+                            (build-color-wheel 3)
+                            (build-shutter 4)
+                            (chan/dimmer 5)
+                            (build-gobo-wheel 6)]}))))))

 (defn kinta-x
   "[Kinta X](http://www.chauvetlighting.com/kinta-x.html) derby effect."
@@ -533,91 +533,91 @@
   ([]
    (q-spot-160 :12-channel))
   ([mode]
-   (let [build-color-wheel (fn [channel]
-                             (chan/functions :color channel
-                                             0 "Color Wheel Open"
-                                             (range 15 59 15) (chan/color-wheel-hue ["red" "yellow" "green"])
-                                             60 "Color Wheel pink"
-                                             (range 75 119 15) (chan/color-wheel-hue ["blue" "orange" "magenta"])
-                                             120 "Color Wheel Light Blue"
-                                             135 "Color Wheel Light Green"
-                                             150 {:type :color-clockwise
-                                                  :label "Color Wheel Clockwise (slow->fast)"
-                                                  :var-label "CW (slow->fast)"
-                                                  :range :variable}))
-         build-shutter (fn [channel]
-                         (chan/functions :shutter channel
-                                         0 "Shutter Closed"
-                                         32 "Shutter Open"
-                                         64 :strobe
-                                         96 "Shutter Open 2"
-                                         128 :pulse-strobe
-                                         160 "Shutter Open 3"
-                                         192 :random-strobe
-                                         224 "Shutter Open 4"))
-         gobo-names ["Splat" "Spot Sphere" "Fanned Squares" "Box" "Bar" "Blue Starburst" "Perforated Pink"]
-         build-gobo-wheel (fn [channel]
-                            (chan/functions :gobo channel
-                                            (range 0 79 10) (build-gobo-entries false (concat ["Open"] gobo-names))
-                                            (range 80 219 20) (build-gobo-entries true (reverse gobo-names))
-                                            220 {:type :gobo-scroll
-                                                 :label "Gobo Scroll"
-                                                 :var-label "Scroll Speed"
-                                                 :range :variable}))
-         build-gobo-rotation (fn [channel]
-                               (chan/functions :gobo-rotation channel
-                                               0 nil
-                                               3 {:type :gobo-rotation-clockwise
-                                                  :label "Gobo Rotation Clockwise (slow->fast)"
-                                                  :var-label "CW (slow->fast)"
-                                                  :range :variable}
-                              129 "Gobo Rotation Stop"
-                              133 {:type :gobo-rotation-counterclockwise
-                                   :label "Gobo Rotation Counterlockwise (slow->fast)"
-                                   :var-label "CCW (slow->fast)"
-                                   :range :variable}))
-         build-control-channel (fn [channel]
-                                 (chan/functions :control channel
-                                             0 nil
-                                             20 "Blackout while moving Pan/Tilt"
-                                             40 "Disable Blackout while moving Pan/Tilt"
-                                             60 "Auto 1"
-                                             80 "Auto 2"
-                                             100 "Sound Active 1"
-                                             120 "Sound Active 2"
-                                             140 "Custom"
-                                             160 "Test"
-                                             180 nil
-                                             200 "Reset"
-                                             220 nil))]
-        (merge {:name "Chauvet Q Spot 160"
-                :pan-center 128 :pan-half-circle 128 ; TODO: Fix these values
-                :tilt-center 128 :tilt-half-circle 128 ; TODO: Fix these values
-                :mode mode}
-               (case mode
-                 :12-channel
-                 {:channels [(chan/pan 1 2)
-                             (chan/tilt 3 4)
-                             (chan/fine-channel :pan-tilt-speed 5
-                                                :function-name "Pan / Tilt Speed"
-                                                :var-label "P/T fast->slow")
-                             (build-color-wheel 6)
-                             (build-gobo-wheel 7)
-                             (build-gobo-rotation 8)
-                             (chan/functions :prism 9 0 "Prism Out" 128 "Prism In")
-                             (chan/dimmer 10)
-                             (build-shutter 11)
-                             (build-control-channel 12)]}
-                 :9-channel
-                 {:channels [(chan/pan 1)
-                             (chan/tilt 2)
-                             (build-color-wheel 3)
-                             (build-gobo-wheel 4)
-                             (build-gobo-rotation 5)
-                             (chan/functions :prism 6 0 "Prism Out" 128 "Prism In")
-                             (chan/dimmer 7)
-                             (build-shutter 8)
-                             (build-control-channel 9)]})))))
+   (let [gobo-names ["Splat" "Spot Sphere" "Fanned Squares" "Box" "Bar" "Blue Starburst" "Perforated Pink"]]
+     (letfn [(build-color-wheel [channel]
+               (chan/functions :color channel
+                               0 "Color Wheel Open"
+                               (range 15 59 15) (chan/color-wheel-hue ["red" "yellow" "green"])
+                               60 "Color Wheel pink"
+                               (range 75 119 15) (chan/color-wheel-hue ["blue" "orange" "magenta"])
+                               120 "Color Wheel Light Blue"
+                               135 "Color Wheel Light Green"
+                               150 {:type :color-clockwise
+                                    :label "Color Wheel Clockwise (slow->fast)"
+                                    :var-label "CW (slow->fast)"
+                                    :range :variable}))
+             (build-shutter [channel]
+               (chan/functions :shutter channel
+                               0 "Shutter Closed"
+                               32 "Shutter Open"
+                               64 :strobe
+                               96 "Shutter Open 2"
+                               128 :pulse-strobe
+                               160 "Shutter Open 3"
+                               192 :random-strobe
+                               224 "Shutter Open 4"))
+             (build-gobo-wheel [channel]
+               (chan/functions :gobo channel
+                               (range 0 79 10) (build-gobo-entries false (concat ["Open"] gobo-names))
+                               (range 80 219 20) (build-gobo-entries true (reverse gobo-names))
+                               220 {:type :gobo-scroll
+                                    :label "Gobo Scroll"
+                                    :var-label "Scroll Speed"
+                                    :range :variable}))
+             (build-gobo-rotation [channel]
+               (chan/functions :gobo-rotation channel
+                               0 nil
+                               3 {:type :gobo-rotation-clockwise
+                                  :label "Gobo Rotation Clockwise (slow->fast)"
+                                  :var-label "CW (slow->fast)"
+                                  :range :variable}
+                               129 "Gobo Rotation Stop"
+                               133 {:type :gobo-rotation-counterclockwise
+                                    :label "Gobo Rotation Counterlockwise (slow->fast)"
+                                    :var-label "CCW (slow->fast)"
+                                    :range :variable}))
+             (build-control-channel [channel]
+               (chan/functions :control channel
+                               0 nil
+                               20 "Blackout while moving Pan/Tilt"
+                               40 "Disable Blackout while moving Pan/Tilt"
+                               60 "Auto 1"
+                               80 "Auto 2"
+                               100 "Sound Active 1"
+                               120 "Sound Active 2"
+                               140 "Custom"
+                               160 "Test"
+                               180 nil
+                               200 "Reset"
+                               220 nil))]
+       (merge {:name "Chauvet Q Spot 160"
+               :pan-center 128 :pan-half-circle 128 ; TODO: Fix these values
+               :tilt-center 128 :tilt-half-circle 128 ; TODO: Fix these values
+               :mode mode}
+              (case mode
+                :12-channel
+                {:channels [(chan/pan 1 2)
+                            (chan/tilt 3 4)
+                            (chan/fine-channel :pan-tilt-speed 5
+                                               :function-name "Pan / Tilt Speed"
+                                               :var-label "P/T fast->slow")
+                            (build-color-wheel 6)
+                            (build-gobo-wheel 7)
+                            (build-gobo-rotation 8)
+                            (chan/functions :prism 9 0 "Prism Out" 128 "Prism In")
+                            (chan/dimmer 10)
+                            (build-shutter 11)
+                            (build-control-channel 12)]}
+                :9-channel
+                {:channels [(chan/pan 1)
+                            (chan/tilt 2)
+                            (build-color-wheel 3)
+                            (build-gobo-wheel 4)
+                            (build-gobo-rotation 5)
+                            (chan/functions :prism 6 0 "Prism Out" 128 "Prism In")
+                            (chan/dimmer 7)
+                            (build-shutter 8)
+                            (build-control-channel 9)]}))))))

 (defn slimpar-hex3-irc
   "[SlimPAR HEX 3 IRC](http://www.chauvetlighting.com/slimpar-hex3irc.html)


Section 'Tile synthesis'

Section 'Tile synthesis'


latest ClojureScript version

latest ClojureScript version

--- Clojure-Websockets/MainApp/project.clj
+++ Clojure-Websockets/MainApp/project.clj
@@ -18,7 +18,7 @@
                  [ring/ring-defaults "0.1.4"]
                  [clj-time "0.9.0"]
                  [pandect "0.5.1"]
-                 [org.clojure/clojurescript "0.0-2913"]
+                 [org.clojure/clojurescript "0.0-3058"]
                  [tailrecursion/cljs-priority-map "1.1.0"]
                  [org.clojure/data.priority-map "0.0.5"]
                  [reagent "0.5.0-alpha3"]
@@ -56,7 +56,6 @@
                         :compiler {:output-to "resources/public/js/build/birdwatch-opt.js"
                                    :output-dir "resources/public/js/build/out"
                                    :optimizations :advanced
-                                   :cache-analysis true
                                    :externs ["externs/misc.js"]
                                    :source-map "resources/public/js/build/birdwatch-opt.js.map"}}
                        {:id "test"


[network-test] Use thing-ndarray implementation.

--- test/cortex/network_test.cljc
+++ test/cortex/network_test.cljc
@@ -14,7 +14,7 @@
     [cortex.core :as core]
     [cortex.layers :as layers]))

-(mat/set-current-implementation #?(:clj :vectorz :cljs :ndarray))
+(mat/set-current-implementation #?(:clj :vectorz :cljs :thing-ndarray))

 ; a	b	| a XOR b
 ; 1	1	     0


Method: also a required key

Method: also a required key

--- test/icecap/e2e/http_test.clj
+++ test/icecap/e2e/http_test.clj
@@ -49,7 +49,6 @@
     (is (= cap-url nil))))

 (deftest invalid-http-step-tests
-  (are [step expected] (let [create-result @(create-cap step)
-                             message (get-body create-result)]
-                         (= message {:error expected}))
-       {:type :http} '{:url missing-required-key}))
+  (are [step expected] (= (get-body @(create-cap step)) {:error expected})
+       {:type :http} '{:url missing-required-key
+                       :method missing-required-key}))


Capture REPL-entered source for defmulti

--- planck-cljs/src/planck/repl.cljs
+++ planck-cljs/src/planck/repl.cljs
@@ -1485,9 +1485,9 @@
   (call-form? expression-form '#{require require-macros}))

 (defn- def-form?
-  "Determines if the expression is a def expression."
+  "Determines if the expression is a def expression which returns a Var."
   [expression-form]
-  (call-form? expression-form '#{def defn defn- defonce}))
+  (call-form? expression-form '#{def defn defn- defonce defmulti}))

 (defn- process-execute-source
   [source-text expression-form


Fix regression in enabling verbose mode

Fix regression in enabling verbose mode

Former-commit-id: 3b96a6b5e1770e5ab86859d6310144540577d0d7

--- planck-cljs/src/planck/repl.cljs
+++ planck-cljs/src/planck/repl.cljs
@@ -40,7 +40,7 @@
 (defonce app-env (atom nil))

 (defn ^:export init-app-env [verbose]
-  (reset! planck.repl/app-env (:verbose verbose)))
+  (reset! planck.repl/app-env {:verbose verbose}))

 (defn repl-read-string [line]
   (r/read-string {:read-cond :allow :features #{:cljs}} line))


slow tests

slow tests

--- test/euler/euler021_test.clj
+++ test/euler/euler021_test.clj
@@ -27,10 +27,10 @@
         (rec-cycle 1 7) => '(1 4 2 8 5 7)
         (p026) => 983)

-  (fact "Problem 27" ;; too slow - makes cloverage abort
+  (fact "Problem 27"
         (consec-primes 1 41) => 40                       ; n² + n + 41
         (consec-primes -79 1601) => 80                    ; n² − 79n + 1601
-        (p027) => -59231
+        ;(p027) => -59231 ;; too slow - makes cloverage abort
   )

   (fact "Problem 28"


Fix tests

Fix tests

--- test/expound/alpha_test.cljc
+++ test/expound/alpha_test.cljc
@@ -2471,7 +2471,7 @@
 -------------------------
 Detected 1 error
 ")
-         (binding [s/*explain-out* (expound/custom-printer {:color-theme :none})]
+         (binding [s/*explain-out* (expound/custom-printer {:theme :none})]
            (s/explain-str :colorized-output/strings ["" :a ""]))))
   (is (= (pf "<NONE><NONE><CYAN>-- Spec failed --------------------<NONE>

@@ -2490,5 +2490,5 @@
 <CYAN>-------------------------<NONE>
 <CYAN>Detected<NONE> <CYAN>1<NONE> <CYAN>error<NONE>
 ")
-         (binding [s/*explain-out* (expound/custom-printer {:color-theme :figwheel-theme})]
+         (binding [s/*explain-out* (expound/custom-printer {:theme :figwheel-theme})]
            (readable-ansi (s/explain-str :colorized-output/strings ["" :a ""]))))))


Fixes.

Fixes.

--- test/onyx/peer/flow_test.clj
+++ test/onyx/peer/flow_test.clj
@@ -97,9 +97,6 @@
   {:color "yellow"}]
  echo)

-(defn my-inc [{:keys [n] :as segment}]
-  (assoc segment :n (inc n) :extra-key :blah))
-
 (def catalog
   [{:onyx/name :people-in
     :onyx/ident :hornetq/read-segments
@@ -157,7 +154,7 @@
     :onyx/consumption :concurrent
     :onyx/batch-size batch-size}

-   {:onyx/name :process-blue
+   {:onyx/name :process-green
     :onyx/fn :onyx.peer.flow-test/process-green
     :onyx/type :function
     :onyx/consumption :concurrent
@@ -221,17 +218,17 @@
     :hornetq/queue-name blue-out-queue
     :hornetq/host (:host (:non-clustered (:hornetq config)))
     :hornetq/port (:port (:non-clustered (:hornetq config)))
-    :onyx/batch-size batch-size}]
-
-  {:onyx/name :green-out
-   :onyx/ident :hornetq/write-segments
-   :onyx/type :output
-   :onyx/medium :hornetq
-   :onyx/consumption :concurrent
-   :hornetq/queue-name green-out-queue
-   :hornetq/host (:host (:non-clustered (:hornetq config)))
-   :hornetq/port (:port (:non-clustered (:hornetq config)))
-   :onyx/batch-size batch-size})
+    :onyx/batch-size batch-size}
+
+   {:onyx/name :green-out
+    :onyx/ident :hornetq/write-segments
+    :onyx/type :output
+    :onyx/medium :hornetq
+    :onyx/consumption :concurrent
+    :hornetq/queue-name green-out-queue
+    :hornetq/host (:host (:non-clustered (:hornetq config)))
+    :hornetq/port (:port (:non-clustered (:hornetq config)))
+    :onyx/batch-size batch-size}])

 (def workflow
   [[:people-in :process-children]
@@ -253,20 +250,20 @@
    [:process-green :green-out]])

 (def flow-conditions
-  [{:flow/from :in
+  [{:flow/from :people-in
     :flow/to [:process-children]
     :child/age 17
     :flow/predicate [:onyx.peer.flow-test/child? :child/age]}

-   {:flow/from :in
+   {:flow/from :people-in
     :flow/to [:process-adults]
     :flow/predicate :onyx.peer.flow-test/adult?}

-   {:flow/from :in
+   {:flow/from :people-in
     :flow/to [:process-athletes-in-washington]
     :flow/predicate [:and :onyx.peer.flow-test/athlete? :onyx.peer.flow-test/washington-resident?]}

-   {:flow/from :in
+   {:flow/from :people-in
     :flow/to [:process-everyone]
     :flow/predicate :onyx.peer.flow-test/constantly-true}

@@ -327,6 +324,12 @@
 (defn washington-resident? [event {:keys [location]}]
   (= location "Washington"))

+(defn black? [{:keys [color]}]
+  (= color "black"))
+
+(defn white? [{:keys [color]}]
+  (= color "white"))
+
 (defn red? [event {:keys [color]}]
   (= color "red"))

@@ -355,7 +358,7 @@
 (defn process-blue [segment]
   (assoc segment :extra-key "Some extra context for the predicates"))

-(def process-green [segment]
+(defn process-green [segment]
   (assoc segment :extra-key "Some extra context for the predicates"))

 (def v-peers (onyx.api/start-peers! 1 peer-config))


Update tests.

Update tests.


write more tests

write more tests

--- test/s7p/slave/core_test.clj
+++ test/s7p/slave/core_test.clj
@@ -2,41 +2,71 @@
   (:require [clojure.test :refer :all]
             [s7p.slave.core :refer :all]))

-(def dsp {:id        "1"
+(def dsp1 {:id        "1"
+          :url       "http://example.com/api"
+          :winnotice "http://example.com/winnotice"})
+
+(def dsp2 {:id        "2"
+          :url       "http://example.com/api"
+           :winnotice "http://example.com/winnotice"})
+
+(def dsp3 {:id        "3"
           :url       "http://example.com/api"
           :winnotice "http://example.com/winnotice"})

 (deftest validate-test
   (testing "`validate`"
-    (let [ret (validate {:dsp dsp :status 204 :body ""})]
-      (is (= :no-bid (:status ret))
-          "204 no bid"))
+    (testing "204 no bid"
+      (let [ret (validate {:dsp dsp1 :status 204 :body ""})]
+       (is (= :no-bid (:status ret)))))

-    (let [ret (validate {:dsp dsp :status 201 :body ""})]
-      (is (= :invalid (:status ret))
-          "invalid response status"))
+    (testing "invalid response status"
+      (let [ret (validate {:dsp dsp1 :status 201 :body ""})]
+       (is (= :invalid (:status ret)))))

-    (let [ret (validate {:dsp dsp :status 200 :body ""})]
-      (is (= :invalid (:status ret))
-          "empty response"))
+    (testing "empty response"
+     (let [ret (validate {:dsp dsp1 :status 200 :body ""})]
+       (is (= :invalid (:status ret)))))

-    (let [ret (validate {:dsp dsp :status 200 :body "{"})]
-      (is (= :invalid (:status ret))
-          "invalid json string"))
+    (testing "invalid json string"
+      (let [ret (validate {:dsp dsp1 :status 200 :body "{"})]
+       (is (= :invalid (:status ret)))))

-    (let [ret (validate {:dsp dsp :status 200 :body "{\"id\": \"1\", \"bidPrice\": 0.1, \"advertiserId\": \"1\"}"})]
-      (is (= :valid (:status ret))
-          "valid request"))
+    (testing "valid request"
+      (let [ret (validate {:dsp dsp1 :status 200 :body "{\"id\": \"1\", \"bidPrice\": 0.1, \"advertiserId\": \"1\"}"})]
+       (is (= :valid (:status ret)))))

-    (let [ret (validate {:dsp dsp :status 200 :body "{\"bidPrice\": 0.1, \"advertiserId\": \"1\"}"})]
-      (is (= :invalid (:status ret))
-          "no id"))
+    (testing "no id"
+      (let [ret (validate {:dsp dsp1 :status 200 :body "{\"bidPrice\": 0.1, \"advertiserId\": \"1\"}"})]
+       (is (= :invalid (:status ret)))))

-    (let [ret (validate {:dsp dsp :status 200 :body "{\"id\": \"1\", \"advertiserId\": \"1\"}"})]
-      (is (= :invalid (:status ret))
-          "no bidPrice"))
+    (testing "no bidPrice"
+     (let [ret (validate {:dsp dsp1 :status 200 :body "{\"id\": \"1\", \"advertiserId\": \"1\"}"})]
+       (is (= :invalid (:status ret)))))

-    (let [ret (validate {:dsp dsp :status 200 :body "{\"id\": \"1\", \"advertiserId\": \"1\"}"})]
-      (is (= :invalid (:status ret))
-          "no advertiserId"))
-))
+    (testing "no advertiserId"
+      (let [ret (validate {:dsp dsp1 :status 200 :body "{\"id\": \"1\", \"advertiserId\": \"1\"}"})]
+       (is (= :invalid (:status ret)))))))
+
+(deftest auction-test
+  (testing "`auction`"
+    (testing "no valid response"
+      (let [fp 4.0
+            ret (auction fp [])]
+       (is (nil? ret))))
+
+    (testing "one valid response with fp, and bidPrice is over the fp"
+      (let [fp 4.0
+            bid-price 4.1
+            ret (auction fp [{:dsp dsp1 :response {:id "1", :bidPrice bid-price :advertiserId "2"}}])]
+       (is ret)
+       (is (= dsp1 (:dsp ret)))
+       (is (= fp   (:second-price ret)))))
+
+    (testing "one valid response without fp"
+      (let [fp nil
+            bid-price 4.1
+            ret (auction fp [{:dsp dsp1 :response {:id "1", :bidPrice bid-price :advertiserId "2"}}])]
+       (is ret)
+       (is (= dsp1 (:dsp ret)))
+       (is (= bid-price   (:second-price ret)))))))


fix lowercasing damage: e.g. "luisa e marco" =>"Luisa e Marco"

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -702,7 +702,11 @@
             (string/capitalize surface-form)
             (string/capitalize (string/lower-case surface-form))
             (string/upper-case surface-form)
-            (string/lower-case surface-form)))))
+            (string/lower-case surface-form)
+            (string/join " " (map #(if (not (= "e" %))
+                                     (string/capitalize %)
+                                     %)
+                                  (string/split surface-form #"[ ]")))))))

 (defn analyze-capitalization-variant [surface-form lexicon]
   "return an array of the maps, each of which represents the lexical information about a surface form."


Bind generichash

Bind generichash

--- src/caesium/crypto/generichash.clj
+++ src/caesium/crypto/generichash.clj
@@ -1,5 +1,6 @@
 (ns caesium.crypto.generichash
   (:refer-clojure :exclude [bytes])
-  (:require [caesium.binding :refer [sodium defconsts]]))
+  (:require [caesium.binding :refer [sodium defconsts defbindings]]))

 (defconsts [bytes bytes-min bytes-max keybytes keybytes-min keybytes-max])
+(defbindings [generichash])


Added part file logging.

Added part file logging.

--- src/chronograph/import/laskuri.clj
+++ src/chronograph/import/laskuri.clj
@@ -86,8 +86,14 @@
         ; filter out self, directory, crc files etc
         part-files (filter #(re-matches #"^part-\d*$" (.getName %)) files)

+        cnt (atom 0)
+        total (count part-files)
+
         ; Lazy seq of the files.
-        seqs (map #(line-seq (clojure.java.io/reader %)) part-files)
+        seqs (map (fn [f]
+                    (swap! cnt inc)
+                    (prn (str "Part file " @cnt " / " total))
+                    (line-seq (clojure.java.io/reader f))) part-files)

         ; Lazy seq of all lines.
         whole (apply concat seqs)