handle escaped symbol/keyword beginning with $$

--- src/keypin/util.clj
+++ src/keypin/util.clj
@@ -153,7 +153,8 @@
                               (cond
                                 ;; '$' as first character of name implies a variable, '$$' is escaped '$'
                                 (= "$" kname)     (i/expected "valid variable name starting with '$'" named)
-                                (= "$$" kname)    '$  ; escape request for '$'
+                                (= '$$ named)     '$  ; escape request for '$
+                                (= :$$ named)     :$  ; escape request for :$
                                 (= [\$ \$]            ; escape request for entire named entity
                                   (take 2 kname)) (condp apply [named]
                                                     symbol?  (symbol (subs kname 1))


Add command to open user.cljs

Add command to open user.cljs

--- src/lt/objs/settings.cljs
+++ src/lt/objs/settings.cljs
@@ -183,6 +183,7 @@

 (def user-behaviors-path (files/lt-user-dir "settings/user.behaviors"))
 (def user-keymap-path (files/lt-user-dir "settings/user.keymap"))
+(def user-cljs-path (files/lt-user-dir "settings/src/lt/plugins/user.cljs"))
 (def user-plugin-paths ["user.behaviors" "user.keymap" "src" "project.clj" "plugin.edn" "user_compiled.js"])
 (def user-plugin-dir (files/lt-user-dir "settings"))

@@ -242,6 +243,11 @@
               :desc "Settings: Default keymap"
               :exec (fn []
                       (cmd/exec! :open-path (files/lt-home "/settings/default/default.keymap")))})
+
+(cmd/command {:command :user.modify-user
+              :desc "Settings: User clojurescript"
+              :exec (fn []
+                      (cmd/exec! :open-path user-cljs-path))})

 (behavior ::on-close-remove
           :triggers #{:close}


Added name for max-distance constant

Added name for max-distance constant

--- src/scramblyzer/analyzer.clj
+++ src/scramblyzer/analyzer.clj
@@ -3,6 +3,8 @@
   (:use [scramblyzer.reid-parser])
   (:use [scramblyzer.piece-filter])
   )
+
+(def max-distance 20)

 (defn num-oriented-corners
   [scramble]
@@ -48,7 +50,7 @@
     (.solveOptimal cube-state
                    acube.Metric/FACE
                    acube.Turn/valueSet
-                   20
+                   max-distance
                    false
                    reporter )
     @distance-result))


Corrected message -> event in dispatcher.cljc; Also fixed missing put

--- libs/datreactor/src/dat/reactor/dispatcher.cljc
+++ libs/datreactor/src/dat/reactor/dispatcher.cljc
@@ -14,14 +14,14 @@
 ;; He'll knock ya lights out and leave ya swimmin with the fishes.
 ;; So don't mess around with him, ya hear?

-;; The dispatcher is what gives us control over how messages are processed.
+;; The dispatcher is what gives us control over how events are processed.
 ;; For most applications, a pretty straightforward mechanism should work.
 ;; Events should get handled in the order they are fired in.
 ;; Simple.

 ;; But suppose you wanted more control over the situation?
-;; Perhaps you want for error and/or warning messages to be handled with higher priority than other queues of
-;; messages?
+;; Perhaps you want for error and/or warning events to be handled with higher priority than other queues of
+;; events?
 ;; Perhaps you are sampling from an input device, and don't want for it's signal to swamp out other important
 ;; functionality?
 ;; Perhaps you want to be able to plug in your own crazy rube goldberg core.async pipeline for some malicious
@@ -45,15 +45,15 @@
   (stop [component]
     component)
   protocols/PDispatcher
-  (dispatch! [component message level]
-    (go (async/>! dispatch-chan)))
-  ;; Here, the message chan is just the dispatch chan...
+  (dispatch! [component event level]
+    (go (async/>! dispatch-chan event)))
+  ;; Here, the event chan is just the dispatch chan...
   (dispatcher-event-chan [component]
     ;; Don't know if this will compile properly
     dispatch-chan))

 (defn new-strictly-ordered-dispatcher
-  "Creates a new strictly ordered dispatcher. This is fine for most cases, and ensures that all messages are
+  "Creates a new strictly ordered dispatcher. This is fine for most cases, and ensures that all events are
   handled in the order they were dispatched (or should...). Can specify `{:dispatch-chan your-chan}` to customize
   the flow."
   ([options]
@@ -62,7 +62,7 @@
    (new-strictly-ordered-dispatcher {})))

-;; Any messages with level :error will get processed by the reactor before _any_ other dispatched messages.
+;; Any events with level :error will get processed by the reactor before _any_ other dispatched events.
 (defrecord ErrorPriorityDispatcher [default-chan error-chan event-chan]
   ;; Should make pluggable config options for the chan creation
   component/Lifecycle
@@ -70,32 +70,32 @@
     (let [component (assoc component
                            :default-chan (or default-chan (async/chan 100))
                            :error-chan (or error-chan (async/chan 100))
-                           ;; This should have no buffer so that it doesn't grab a dispatch message and put it in
-                           ;; the buffer just before an error message comes in
+                           ;; This should have no buffer so that it doesn't grab a dispatch event and put it in
+                           ;; the buffer just before an error event comes in
                            :event-chan (async/chan))])
     (go-loop []
-      ;; Hmm... this actually doesn't have the semantics we want, since 1 default chan message could get
-      ;; through before the message chan is ready to take yet
+      ;; Hmm... this actually doesn't have the semantics we want, since 1 default chan event could get
+      ;; through before the event chan is ready to take yet
       (let [[event chan] (async/alts! [error-chan default-chan])]
         (async/>! event-chan event)))
     component)
   (stop [component]
     component)
   protocols/PDispatcher
-  (dispatch! [component message level]
+  (dispatch! [component event level]
     (go
       (async/>!
         (if (= level :error) error-chan default-chan)
-        message)))
-  ;; Here, the message chan is just the dispatch chan...
+        event)))
+  ;; Here, the event chan is just the dispatch chan...
   (dispatcher-event-chan [component]
     ;; Don't know if this will compile properly TODO
     event-chan))

 (defn new-error-priority-dispatcher
   "Creates a new ErroPriorityDispatcher. Can customize :default-chan and :error-chan through options.
-  Idea is that Reactor will get error messages before other queued messages, but the mechanism is a little flawed.
-  Currently, it's still possible for a non error message to get through before the reactor is ready to consume from the event-chan.
+  Idea is that Reactor will get error events before other queued events, but the mechanism is a little flawed.
+  Currently, it's still possible for a non error event to get through before the reactor is ready to consume from the event-chan.
   May need to adjust the protocols."
   ([options]
    (map->ErrorPriorityDispatcher options))
@@ -104,25 +104,25 @@

 ;; A signal sampler might have functions that let you plug in your own signal channels that you mix/merge/alt
-;; whatever, to gate vs critical system control messages.
+;; whatever, to gate vs critical system control events.

 ;; ## Public API around dispatchers

 (defn dispatch!
-  "Dispatches message on the dispatcher component at the given level (:default if unspecified)."
-  ([dispatcher message level]
-   (protocols/dispatch! dispatcher message level))
-  ([dispatcher message]
-   (protocols/dispatch! dispatcher message :default)))
+  "Dispatches event on the dispatcher component at the given level (:default if unspecified)."
+  ([dispatcher event level]
+   (protocols/dispatch! dispatcher event level))
+  ([dispatcher event]
+   (protocols/dispatch! dispatcher event :default)))

 (defn dispatch-error!
-  [datview message]
-  (dispatch! datview message :error))
+  [datview event]
+  (dispatch! datview event :error))

 (defn event-chan [dispatcher]
-  "Get the message channel for a dispatcher"
+  "Get the event channel for a dispatcher"
   (protocols/dispatcher-event-chan dispatcher))


ellipse-mode takes a keyword argument

ellipse-mode takes a keyword argument

--- src/rosado/processing.clj
+++ src/rosado/processing.clj
@@ -329,7 +329,10 @@
   [a b c d]
   (.ellipse *applet* (float a) (float b) (float c) (float d)))

-(defn ellipse-mode [mode] (.ellipseMode *applet* (int mode)))
+(defmacro ellipse-mode [mode]
+  "Takes a keyword argument; :center, :radius, :corner or :corners."
+  (let [mode (tosymb mode)]
+    `(.ellipseMode *applet* (int ~mode))))

 (defn emissive-float
   ([gray] (.emissive *applet* (float gray)))
@@ -345,6 +348,7 @@
 (defn end-raw [] (.endRaw *applet*))

 (defmacro end-shape
+  "Takes an optinal :close keyword as argument."
   ([] `(.endShape *applet*))
   ([kind]
      (let [kind (tosymb kind)]


add support for passing arguments to scsynth based on OS. OS X support now functioning.... :-)

--- src/overtone/sc.clj
+++ src/overtone/sc.clj
@@ -1,5 +1,5 @@
 (ns overtone.sc
- (:import
+ (:import
      (java.net InetSocketAddress)
      (java.util.regex Pattern)
      (java.util.concurrent TimeUnit TimeoutException)
@@ -7,7 +7,7 @@
   (:require [overtone.log :as log]
      [clojure.zip :as zip]
      [overtone.insertion-point :as ip])
-  (:use
+  (:use
      clojure.contrib.shell-out
      clojure.contrib.seq-utils
      clj-backtrace.repl
@@ -18,7 +18,7 @@
 ; TODO: Make this work correctly
 ; NOTE: "localhost" doesn't work, at least on my laptopt
 (def SERVER-HOST "127.0.0.1")
-(def SERVER-PORT nil) ; nil means a random port
+(def SERVER-PORT nil) ; nil means a random port

 ; Max number of milliseconds to wait for a reply from the server
 (def REPLY-TIMEOUT 300)
@@ -38,16 +38,16 @@
 (defmacro defcounter [counter-name start-id]
   (let [next-fn (symbol (str "next-" (name counter-name) "-id"))]
     `(do
-       (dosync
+       (dosync
          (alter *counters assoc ~counter-name (ref ~start-id))
          (alter *counter-defaults assoc ~counter-name ~start-id))
-       (defn ~next-fn []
-         (dec
+       (defn ~next-fn []
+         (dec
            (dosync (alter (~counter-name @*counters) inc)))))))

 (defn reset-id-counters []
   (doseq [[cname counter] @*counters]
-    (dosync
+    (dosync
     (ref-set counter (cname @*counter-defaults)))))

 (defcounter :group START-GROUP-ID)
@@ -59,13 +59,13 @@

 (declare boot)

-(defn snd
-  "Creates an OSC message and either sends it to the server immediately
+(defn snd
+  "Creates an OSC message and either sends it to the server immediately
   or if a bundle is currently being formed it adds it to the list of messages."
   [path & args]
   (if (nil? @server*)
     (throw (Exception. "Not connected to a SuperCollider server.")))
-      (osc-snd-msg @server*
+      (osc-snd-msg @server*
                    (apply osc-msg path (osc-type-tag args) args)))

 (defmacro at
@@ -77,7 +77,7 @@
   [path & [timeout]]
   (osc-recv @server* path timeout))

-(defn connect
+(defn connect
   ([] (connect SERVER-HOST SERVER-PORT))
   ([host port]
    (log/info "(connect " host ":" port)
@@ -121,7 +121,7 @@
 ; Wait until SuperCollider has completed all asynchronous commands currently in execution.
 (defn wait-sync [& [timeout]]
   (let [sync-id (rand-int 999999)
-        _ (snd "/sync" sync-id)
+        _ (snd "/sync" sync-id)
         reply (osc-recv @server* "/synced" (if timeout timeout REPLY-TIMEOUT))
         reply-id (first (:args reply))]
     (= sync-id reply-id)))
@@ -137,7 +137,7 @@

 (defn- boot-thread [cmd]
   (reset! running?* true)
-  (let [proc (.exec (Runtime/getRuntime) cmd)
+  (let [proc (.exec (Runtime/getRuntime) cmd)
         in-stream (BufferedInputStream. (.getInputStream proc))
         err-stream (BufferedInputStream. (.getErrorStream proc))
         read-buf (make-array Byte/TYPE 256)]
@@ -147,28 +147,33 @@
       (Thread/sleep 250))
     (.destroy proc)))

-(defn connect-jack-ports
+(defn connect-jack-ports
   "Maybe this isn't necessary, since we can use the SC_JACK_DEFAULT_OUTPUTS
   environment variable..."
   [n-channels]
   (let [port-list (sh "jack_lsp")
         sc-outputs (re-find #"SuperCollider.*:out_" port-list)]
   (doseq [i (range n-channels)]
-    (sh "jack_connect"
+    (sh "jack_connect"
         (str sc-outputs (+ i 1))
         (str "system:playback_" (+ i 1))))))

 (def SC-PATHS {:linux "scsynth"
                :windows "C:/Program Files/SuperCollider/scsynth.exe"
-               :mac "scsynth"})
+               :mac  "/Applications/SuperCollider/scsynth" })
+
+(def SC-ARGS  {:linux []
+               :windows []
+               :mac   ["-U" "/Applications/SuperCollider/plugins"] })

 (def SC-PATH (SC-PATHS (config :os)))
+(def SC-ARG (SC-ARGS (config :os)))

 (defn boot
   ([] (boot SERVER-HOST SERVER-PORT))
   ([host port]
    (let [port (if (nil? port) (+ (rand-int 50000) 2000) port)
-         cmd (into-array String [SC-PATH "-u" (str port)])
+         cmd (into-array String (concat [SC-PATH "-u" (str port)] SC-ARG))
          sc-thread (Thread. #(boot-thread cmd))]
      (.setDaemon sc-thread true)
      (log/info "Booting SuperCollider server (scsynth)...")
@@ -179,7 +184,7 @@
      (connect host port)
      (log/info "status check: " (status)))))

-(defn quit
+(defn quit
   "Quit the SuperCollider synth process."
   []
   (log/info "quiting supercollider")
@@ -191,7 +196,7 @@
 (defn notify [& [notify?]]
   (snd "/notify" (if (false? notify?) 0 1)))

-; Synths, Busses, Controls and Groups are all Nodes.  Groups are linked lists,
+; Synths, Busses, Controls and Groups are all Nodes.  Groups are linked lists
 ; and group zero is the root of the graph.  Nodes can be added to a group in
 ; one of these 5 positions relative to either the full list, or a specified node.
 (def POSITION
@@ -211,7 +216,7 @@
     (apply snd "/s_new" synth-name id position target args)
     id))

-(defn node-free
+(defn node-free
   "Instantly remove a node from the graph."
   [node-id & node-ids]
   (apply snd "/n_free" node-id node-ids))
@@ -240,7 +245,7 @@

 ; This can be extended to support setting multiple ranges at once if necessary...
 (defn node-control-range
-  "Set a range of controls all at once, or if node-id is a group control
+  "Set a range of controls all at once, or if node-id is a group control
   all nodes in the group."
   [node-id ctl-start & ctl-vals]
   (apply snd "/n_setn" node-id ctl-start (count ctl-vals) ctl-vals))
@@ -250,7 +255,7 @@
   [node-id & names-busses]
   (apply snd "/n_map" node-id names-busses))

-(defn group
+(defn group
   "Create a new group as a child of the target group."
   [position target-id]
   (let [id (next-group-id)]
@@ -262,24 +267,24 @@
   [group-id & group-ids]
   (apply node-free group-id group-ids))

-(defn node-free
+(defn node-free
   "Instantly remove a node from the graph."
   [node-id & node-ids]
   (apply snd "/n_free" node-id node-ids))

-(defn post-tree
+(defn post-tree
   "Posts a representation of this group's node subtree, i.e. all the groups and
   synths contained within it, optionally including the current control values
   for synths."
   [id & [with-args?]]
   (snd "/g_dumpTree" id with-args?))
-
+
 ;/g_queryTree				get a representation of this group's node subtree.
 ;	[
 ;		int - group ID
 ;		int - flag: if not 0 the current control (arg) values for synths will be included
 ;	] * N
-;
+;
 ; Request a representation of this group's node subtree, i.e. all the groups and
 ; synths contained within it. Replies to the sender with a /g_queryTree.reply
 ; message listing all of the nodes contained within the group in the following
@@ -313,17 +318,17 @@
         (set! *data* new-data)
         {:synth sname
          :controls ctls})
-      (do
+      (do
         (set! *data* (next *data*))
         {:synth sname}))))

 (defn- parse-node-tree-helper [ctls?]
   (let [[id n-children & new-data] *data*]
     (set! *data* new-data)
-    (cond
+    (cond
       (neg? n-children) (parse-synth-tree ctls?) ; synth
       (= 0 n-children) {:group id :children nil}
-      (pos? n-children)
+      (pos? n-children)
       {:group id
        :children (doall (map (fn [i] (parse-node-tree-helper ctls?)) (range n-children)))})))

@@ -336,7 +341,7 @@
 ; Thus child nodes (those contained within a group) are listed immediately
 ; following their parent. See the method Server:queryAllNodes for an example of
 ; how to process this reply.
-(defn node-tree
+(defn node-tree
   "Returns a data structure representing the current arrangement of groups and synthesizer
   instances residing on the audio server."
   [id & [ctls?]]
@@ -345,22 +350,22 @@
     (let [tree (:args (osc-recv @server* "/g_queryTree.reply" REPLY-TIMEOUT))]
       (parse-node-tree tree))))

-(defn prepend-node
+(defn prepend-node
   "Add a node to the end of a group list."
   [g n]
   (snd "/g_head" g n))

-(defn append-node
+(defn append-node
   "Add a node to the end of a group list."
   [g n]
-  (snd "/g_tail" g n))
+  (snd "/g_tail" g n))

 (defn group-clear
   "Free all child synth nodes in a group."
   [group-id]
   (snd "/g_freeAll" group-id))

-(defn clear-msg-queue
+(defn clear-msg-queue
   "Remove any scheduled OSC messages from the run queue."
   []
   (snd "/clearSched"))
@@ -371,7 +376,7 @@
   (recv "/synced"))

 ; size is in samples
-(defn buffer
+(defn buffer
   "Allocate a new buffer for storing audio data."
   [size]
   (let [id (next-buffer-id)]
@@ -390,13 +395,13 @@
 (defn buffer-write [buf start len data]
   (snd "/b_setn" (:id buf) start len data))

-(defn save-buffer
+(defn save-buffer
   "Save the float audio data in an audio buffer to a wav file."
   [buf path]
   (assert (buffer? buf))
   (snd "/b_write" (:id buf) path "wav" "float"))
-
-(defn load-sample
+
+(defn load-sample
   "Load a wav file into memory so it can be played as a sample."
   [path]
   (let [id (next-buffer-id)]
@@ -409,7 +414,7 @@
 (defn sample? [s]
   (and (map? s) (= :sample (:type s))))

-(defn load-synth
+(defn load-synth
   "Load a Clojure synth definition onto the audio server."
   [sdef]
   (assert (synthdef? sdef))
@@ -420,7 +425,7 @@
   [path]
   (snd "/d_recv" (synthdef-bytes (synthdef-read path))))

-(defn reset
+(defn reset
   "Clear all synthesizers, groups and pending messages from the audio server."
   []
   (try
@@ -437,11 +442,11 @@
     (do
       (log/level :debug)
       (snd "/dumpOSC" 1))
-    (do
+    (do
       (log/level :error)
       (snd "/dumpOSC" 0))))

-(defn restart
+(defn restart
   "Reset everything and restart the SuperCollider process."
   []
   (reset)
@@ -450,7 +455,7 @@

 ; Turn hit into a multimethod
 ; Convert samples to be a map object instead of an ID
-(defn hit
+(defn hit
   "Fire off a synth or sample at a specified time.
   These are the same:
       (hit :kick)
@@ -465,7 +470,7 @@
   ([] (hit (now) "sin" :pitch (+ 30 (rand-int 40))))
   ([& args]
    (let [[time-ms synth args] (if (= Long (type (first args)))
-                                [(first args) (second args) (nnext args)]
+                                [(first args) (second args) (nnext args)]
                                 [(now) (first args) (next args)])
          id (next-node-id)
          synth (cond
@@ -473,7 +478,7 @@
                  (sample? synth) synth
                  (keyword? synth) (name synth)
                  (string? synth) synth
-                 :default (throw
+                 :default (throw
                             (Exception. "Hit doesn't know how to play the given synth: " synth)))
          args (-> args (stringify) (floatify))]
      (if (sample? synth)
@@ -492,18 +497,18 @@

 (defn ctl
   "Modify synth parameters, optionally at a specified time.
-
-  (hit :sin :pitch 50) => 1000
+
+  (hit :sin :pitch 50) => 1000
   (ctl 1000 :pitch 40)
   (ctl (+ (now) 2000) 1000 :pitch 60)
-
+
   "
   [& args]
   (let [[time-ms synth-id ctls] (if (odd? (count args))
                                     [(now) (first args) (next args)]
                                     [(first args) (second args) (drop 2 args)])]
     (println time-ms synth-id ": " ctls)
-    (at time-ms
+    (at time-ms
         (apply node-control synth-id (stringify ctls)))))

 (defn kill
@@ -512,9 +517,9 @@
   a handle for the synth node that was created.
       (let [handle (hit :sin)] ; returns => synth-handle
         (kill (+ 1000 (now)) handle))
-
+
       ; a single handle without a time kills immediately
-      (kill handle)
+      (kill handle)

       ; or a seq of synth handles can be removed at once
       (kill (+ (now) 1000) [(hit) (hit) (hit)])
@@ -523,12 +528,12 @@
   (let [[time-ms ids] (if (= 1 (count args))
                         [(now) (flatten args)]
                         [(first args) (flatten (next args))])]
-        (at time-ms
+        (at time-ms
             (apply node-free ids))))

 (defn load-instruments []
-  (doseq [synth (filter #(synthdef? %1)
-                        (map #(var-get %1)
+  (doseq [synth (filter #(synthdef? %1)
+                        (map #(var-get %1)
                              (vals (ns-publics 'overtone.instruments))))]
     (println "loading synth: " (:name synth))
     (load-synth synth)))
@@ -540,7 +545,7 @@
 ;;    (dosync (alter *fx conj new-effect))
 ;;    new-effect))
 ;
-;(defn update
+;(defn update
 ;  "Update a voice or standalone synth with new settings."
 ;  [voice & args]
 ;  (let [[names vals] (synth-args (apply hash-map args))


remove old timestamp code and wrap chime-at scheduler

--- src/wombats/sockets/game.clj
+++ src/wombats/sockets/game.clj
@@ -22,23 +22,6 @@
       (when-not channel-open?
         (swap! connections dissoc chan-id)))))

-
-(defn dev-socket-helpers
-  "Dev functions for easy access to atom state
-
-  If running cider, use C-x C-e to eval the helper functions"
-  []
-
-  ;; Print number of connections
-  (prn (count (keys @connections)))
-
-  ;; Print connections
-  (clojure.pprint/pprint @connections)
-
-  ;; Remove all closed connections
-  (clean-connections 0)
-  )
-
 (defn connection-clean-err
   "If the scheduler fails this will be called

@@ -47,10 +30,32 @@
   [error]
   (prn error))

-(chime-at
- (rest (p/periodic-seq (t/now) (-> 10 t/seconds)))
- clean-connections
- {:error-handler connection-clean-err})
+(defn start-connection-cleanup
+  "Kicks off the cleanup job responsible for removing closed channels
+  from state."
+  []
+  (chime-at
+   (rest (p/periodic-seq (t/now) (-> 10 t/seconds)))
+   clean-connections
+   {:error-handler connection-clean-err}))
+
+(start-connection-cleanup)
+
+(defn dev-socket-helpers
+  "Dev functions for easy access to atom state
+
+  If running cider, use C-x C-e to eval the helper functions"
+  []
+
+  ;; Print number of connections
+  (prn (count (keys @connections)))
+
+  ;; Print connections
+  (clojure.pprint/pprint @connections)
+
+  ;; Remove all closed connections
+  (clean-connections 0)
+  )

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Helpers
@@ -112,7 +117,6 @@
   [datomic]
   (fn [{:keys [chan-id] :as socket-user}
       {:keys [game-id]}]
-    ;; TODO Check for ghost connections
     (swap! game-rooms assoc-in [game-id :players chan-id] socket-user)))

 (defn- broadcast-game-message
@@ -129,14 +133,10 @@
   (fn [{:keys [chan-id user/github-username] :as socket-user}
       {:keys [game-id message]}]

-    ;; TODO Each msg needs a unique way to id itself
     (when (and github-username (not= (count message) 0))
       (let [formatted-message {:username github-username
                                :message message
-                               :timestamp (str (l/local-now))
-                               ;; (f/unparse (f/formatter-local "HH:mm:ss")
-                               ;;                       (l/local-now))
-                               }]
+                               :timestamp (str (l/local-now))}]
         (broadcast-game-message game-id formatted-message)))))

 ;; Broadcast functions


Revert "Make cell! private"

Revert "Make cell! private"

This reverts commit b58b2155bbf435285bf5997392931cd918a5fb64.

--- src/play_clj/ui.clj
+++ src/play_clj/ui.clj
@@ -58,7 +58,7 @@
   [k]
   (u/gdx-field :scenes :scene2d :utils :Align (u/key->camel k)))

-(defn ^:private cell!
+(defn cell!
   "Calls methods on a [Cell](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Cell.html)."
   [^Cell cell & args]
   (let [method (first args)


Added support for HAVING clause to y.c.db.util/query (#54)

--- src/yetibot/core/db/util.clj
+++ src/yetibot/core/db/util.clj
@@ -97,6 +97,7 @@
           where-args :where/args
           ;; optional
           group-clause :group/clause
+          having-clause :having/clause
           order-clause :order/clause
           offset-clause :offset/clause
           limit-clause :limit/clause
@@ -113,6 +114,7 @@
                           " FROM " (qualified-table-name table)
                           (when-not (blank? where-clause) (str " WHERE " where-clause))
                           (when group-clause (str " GROUP BY " group-clause))
+                          (when having-clause (str " HAVING " having-clause))
                           (when order-clause (str " ORDER BY " order-clause))
                           (when offset-clause (str " OFFSET " offset-clause))
                           (when limit-clause (str " LIMIT " limit-clause)))]


whitespace comments

whitespace comments

--- src/specly/core.clj
+++ src/specly/core.clj
@@ -222,7 +222,6 @@
 (defn fuzzy-conform-score-helper [{:keys [known-keys  k->s] :as spec-key-data} map-x]
   (when (map? map-x)
     (let [key-to-score
-
           (fn [[k v]]
             (cond
               (map? v)
@@ -317,23 +316,18 @@
                           (if-let [suggest (spelling-suggestion spec-key-data x unknown-key)]
                             [(conj pred-path :misspelled-key unknown-key)
                              (-> exp-data
-                                 #_(update-in [:in] conj unknown-key)
                                  (assoc
                                   ::misspelled-key unknown-key
                                   ::correct-key suggest))]
                             (if-let [replace-suggest (replacement-suggestion spec-key-data x unknown-key)]
                               [(conj pred-path :misspelled-key unknown-key)
                                (-> exp-data
-                                   #_(update-in [:in] conj unknown-key)
                                    (assoc
                                     ::misspelled-key unknown-key
                                     ::correct-key suggest))]
                               [(conj pred-path :unknown-key unknown-key)
                                (-> exp-data
-                                   #_(update-in [:in] conj unknown-key)
-                                   (assoc ::unknown-key unknown-key))])
-
-                            )))))))))
+                                   (assoc ::unknown-key unknown-key))]))))))))))
       ;; These can be improved
       (gen* [_ a b c]
         (s/gen* keys-spec a b c))
@@ -398,14 +392,15 @@

 (comment

-  (s/explain-str :project-top/figwheel {:hey 1
-                                      :there 2
-                                      :serve-port 1 #_"heyy"
+  (s/explain-str :project-top/figwheel {; :hey 1
+                                        ;:there 2
+                                      :server-por "heyy"
                                       ;:server-port "heyy"
-                                      :builds
+                                      :asdff
                                       [{:id :asdf
                                         :source-paths ["src"]}]})

+
   )


Improve commenting, add some TODOs

Improve commenting, add some TODOs

--- src/od117_walker/core.clj
+++ src/od117_walker/core.clj
@@ -3,6 +3,8 @@
   (:require [clojure.java.io :as io]
             [clj-http.client :as client]
             [pl.danieljanus.tagsoup :as ts]))
+
+;; TODO: Parameterise all data in defs, add code to read it from a config file. This will allow this program to be reused for future wikis.

 ;; Base address of wiki to walk.
 (def wiki-address "http://od117.wikidot.com/")
@@ -53,6 +55,7 @@
           #{}
           (ts/children html)))

+;; TODO: Refactor these 2 functions as they are copy/pasted.
 (defn extract-author
   "Extract the author of the entry from the html. Assumes there is only one author linked."
   [html]
@@ -110,6 +113,7 @@
   (apply str (map #(str \" key \" " -> " \" % \" ";\n") links)))

 (defn node-def
+  "Build a node definition for a given graph node. Form: <quoted-name> [color=<colour>,style=filled];\n. Omits colour/filled if no author given."
   [[key {:keys [author]}]]
   (str \" key \"
        (if-let [colour (get author-colours author)]
@@ -117,6 +121,7 @@
          "")
        ";\n"))

+;; Turn order. Manually transcribed from wiki.
 (def turns [#{\a \b \c}
             #{\d \e \f}
             #{\g \h \i}
@@ -128,6 +133,7 @@
             #{\w \x \y \z}])

 (defn make-turn
+  "Given a paticular turn (as a set) and a list of declarations, extract the declarations for that turn and build a ranked subgraph for them."
   [turn decls]
   (let [turn-decls (filter #(turn (nth % 2)) decls)]
     (str "{ rank=same;\n"
@@ -136,11 +142,12 @@
          "}\n")))

 (defn make-order
+  "Make a subgraph for the turn ordering."
   []
   (str (apply str (interpose "->" (map #(apply str (sort %)) turns))) ";\n"))

 (defn graphify-ranked
-  "Convert a map representation of the graph into a string of graphviz dot language."
+  "Convert a map representation of the graph into a string of graphviz dot language. Use a turn order to create a tiered graph."
   [g]
   (let [decls (map #(make-turn % (map node-def (seq g))) turns)
         vals (map graphify-one (seq g))]
@@ -151,6 +158,7 @@
          "}\n")))

 (defn graphify-unordered
+  "Convert a map representation of the graph into a string of graphviz dot language. Just let dot do whatever its heart tells it."
   [g]
   (let [decls (map node-def (seq g))
         vals (map graphify-one (seq g))]
@@ -169,7 +177,7 @@
                    "/mendacious-islands"])

 (defn -main
-  "Calculate and print the graph of OD-117 to foo.dot."
+  "Calculate and print graphs of OD-117 to ranked.dot and general.dot."
   [& args]
   (let [g (walk start-points authors)]
     (with-open [wrtr (io/writer "ranked.dot")]


Batch deref sends for performance

Batch deref sends for performance

--- src/onyx/plugin/kafka.clj
+++ src/onyx/plugin/kafka.clj
@@ -267,14 +267,17 @@

   (write-batch
     [_ {:keys [onyx.core/results]}]
-    (let [messages (mapcat :leaves (:tree results))]
-      (doseq [m (map :message messages)]
-        (let [k-message (:message m)
-              k-key (some-> m :key serializer-fn)
-              p (some-> m :partition int)]
-          (assert k-message
-                  "Messages must be supplied in a map in form {:message :somevalue}, with optional :key and :partition keys.")
-          @(kp/send producer (kp/record topic p k-key (serializer-fn k-message))))))
+    (let [messages (mapcat :leaves (:tree results))
+          send-futs (doall
+                      (map (fn [m]
+                             (let [k-message (:message m)
+                                   k-key (some-> m :key serializer-fn)
+                                   p (some-> m :partition int)]
+                               (assert k-message
+                                       "Messages must be supplied in a map in form {:message :somevalue}, with optional :key and :partition keys.")
+                               (kp/send producer (kp/record topic p k-key (serializer-fn k-message)))))
+                           (map :message messages)))]
+      (doall (map deref send-futs)))
     {})

   (seal-resource


Remove unnecessary vector conversion, simplify loop

--- src/onyx/plugin/kafka.clj
+++ src/onyx/plugin/kafka.clj
@@ -146,18 +146,16 @@
                            (fn [_ value _] value))]
           _ (log/info (str "Kafka task: " task-id " allocated to partition: " kpartition ", starting at offset: " offset))
           (try
-            (loop [ms (into [] (poll! consumer))]
-              (if-not (seq ms)
-                (do (Thread/sleep empty-read-back-off)
-                    (recur (into [] (poll! consumer))))
-                (do
-                  (doseq [message ms]
-                    (let [next-offset (:offset message)
-                          dm (deserializer-fn (:value message))
-                          wrapped (wrapper-fn message dm next-offset)]
-                      (>!! ch (assoc (t/input (random-uuid) wrapped)
-                                     :offset next-offset))))
-                  (recur (into [] (poll! consumer))))))
+            (loop [ms (seq (poll! consumer))]
+              (if ms
+                (Thread/sleep empty-read-back-off)
+                (doseq [message ms]
+                  (let [next-offset (:offset message)
+                        dm (deserializer-fn (:value message))
+                        wrapped (wrapper-fn message dm next-offset)]
+                    (>!! ch (assoc (t/input (random-uuid) wrapped)
+                                   :offset next-offset)))))
+                (recur (seq (poll! consumer))))
             (finally
               (future-cancel commit-fut))))
         (catch InterruptedException e


Starting to add code for interactively editing notes

--- src/pianola/notation.cljs
+++ src/pianola/notation.cljs
@@ -11,8 +11,7 @@
                                :duration (str (/ 1 duration))}))

 (defn phrase->notes [phrase]
-  (-> (map build-note phrase)
-      (clj->js)))
+  (map build-note phrase))

 (defn num-beats [phrase]
   (* 4 (reduce + (map :duration phrase))))
@@ -22,13 +21,15 @@
                   (.addClef "treble")
                   (.addTimeSignature "4/4")
                   (.setContext context))
+        notes (phrase->notes phrase)
         voice (js/Vex.Flow.Voice. #js {:num_beats (num-beats phrase) :beat_value 4})]
-    (.addTickables voice (phrase->notes phrase))
+    (.addTickables voice (clj->js notes))
     (-> (js/Vex.Flow.Formatter.)
         (.joinVoices #js [voice])
         (.format #js [voice] 400))
     (.draw stave)
-    (.draw voice context stave)))
+    (.draw voice context stave)
+    notes))

 (defn build-context [el]
   (let [vf (js/Vex.Flow.Renderer. el js/Vex.Flow.Renderer.Backends.SVG)
@@ -36,20 +37,34 @@
     (.resize vf 500 150)
     context))

+(defn within-note? [x y note]
+  (let [box (.getBoundingBox note)]
+    (and (> x (.-x box))
+         (< x (+ (.-x box) (.-w box)))
+         (> y (.-y box))
+         (< y (+ (.-y box) (.-h box))))))
+
+(defn handle-click [notes e]
+  (let [target (.-currentTarget e)
+        x (- (.-pageX e) (.-offsetLeft target))
+        y (- (.-pageY e) (.-offsetTop target))]
+    (println (first (drop-while #(not (within-note? x y %)) notes)))))
+
 (defn notation [phrase]
-  (let [context (r/atom nil)]
+  (let [locals (r/atom {:context nil
+                        :notes []})]
     (r/create-class
      {:display-name "notation"
       :component-did-mount
       (fn [this]
-        (let [c (build-context (r/dom-node this))]
-          (reset! context c)
-          (render-phrase c (:music (r/props this)))))
+        (let [context (build-context (r/dom-node this))
+              notes (render-phrase context (:music (r/props this)))]
+          (swap! locals assoc :context context :notes notes)))
       :component-will-update
       (fn [this]
-        (let [c @context]
-          (.clear c)
-          (render-phrase c (:music (r/props this)))))
+        (let [{:keys [context]} @locals]
+          (.clear context)
+          (swap! locals assoc :notes (render-phrase context (:music (r/props this))))))
       :reagent-render
       (fn [phrase]
-        [:div])})))
+        [:div {:onClick #(handle-click (:notes @locals) %)}])})))


Remove unnecessary dep

Remove unnecessary dep

--- build.boot
+++ build.boot
@@ -4,8 +4,7 @@
   :dependencies '[[org.clojure/test.check "0.9.0" :scope "test"]
                   [adzerk/boot-cljs "2.1.4" :scope "test"]
                   ; cljs deps
-                  [org.clojure/clojurescript "1.9.946" :scope "test" :exclusions [org.clojure/tools.reader]]
-                  [org.clojure/tools.reader "1.1.0" :scope "test"]
+                  [org.clojure/clojurescript "1.9.946" :scope "test"]
                   [paren-soup "2.9.0" :scope "test"]
                   [mistakes-were-made "1.7.3" :scope "test"]
                   [cljsjs/codemirror "5.24.0-1" :scope "test"]


Change from the manual loop in the PeristentVector implementation of ASTNode to dotimes, which I later realized macro-compiles to almost the exact code I replaced to the doseq with.

--- src/stencil/ast.clj
+++ src/stencil/ast.clj
@@ -108,12 +108,8 @@
   (render [this ^StringBuilder sb context-stack] (.append sb this))
   clojure.lang.PersistentVector
   (render [this sb context-stack]
-    ;; This is about 10% faster than the (much nicer) doseq equivalent.
-    (let [vec-length (long (count this))]
-      (loop [i (int 0)]
-        (when (< i vec-length)
-          (render (nth this i) sb context-stack)
-          (recur (unchecked-inc i)))))))
+    (dotimes [i (count this)]
+      (render (nth this i) sb context-stack))))

 ;; Implement a Zipper over ASTZippers.


Create an internal ALB only if there is demand

--- src/terraboot/cluster.clj
+++ src/terraboot/cluster.clj
@@ -480,16 +480,21 @@
                     :subnets private-subnets
                     :lifecycle {:create_before_destroy true}
                     :elb []
-                    :alb [{:name "internal-tasks"
-                           :internal true
-                           :listeners (map #(assoc % :account-number account-number) slave-alb-listeners)
-                           :subnets elb-private-subnets
-                           :security-groups (concat [(cluster-id-of "aws_security_group" "slave-alb-sg")]
-                                                    remote-default-sgs)}] })
-              (vpc/private-route53-record "slaves"
-                                          environment-dns
-                                          environment-dns-identifier
-                                          {:zone_id (remote-output-of "vpc" "private-dns-zone")
-                                           :alias {:name (cluster-output-of "aws_alb" "internal-tasks" "dns_name")
-                                                   :zone_id (cluster-output-of "aws_alb" "internal-tasks" "zone_id")
-                                                   :evaluate_target_health true}}))))))
+                    :alb (let [listeners (map #(assoc % :account-number account-number) slave-alb-listeners)]
+                           (if (seq listeners)
+                             [{:name "internal-tasks"
+                               :internal true
+                               :listeners listeners
+                               :subnets elb-private-subnets
+                               :security-groups (concat [(cluster-id-of "aws_security_group" "slave-alb-sg")]
+                                                        remote-default-sgs)}]
+                             []))})
+              (let [listeners (map #(assoc % :account-number account-number) slave-alb-listeners)]
+                (if (seq listeners)
+                  (vpc/private-route53-record "slaves"
+                                              environment-dns
+                                              environment-dns-identifier
+                                              {:zone_id (remote-output-of "vpc" "private-dns-zone")
+                                               :alias {:name (cluster-output-of "aws_alb" "internal-tasks" "dns_name")
+                                                       :zone_id (cluster-output-of "aws_alb" "internal-tasks" "zone_id")
+                                                       :evaluate_target_health true}}))))))))


Fix string formatting for clojurescript

Fix string formatting for clojurescript

--- src/trek/interpreter.cljc
+++ src/trek/interpreter.cljc
@@ -9,7 +9,9 @@
             #?(:clj [clj-time.local :as time.local]
                :cljs [cljs-time.local :as time.local])
             [clojure.string :as str]
-            [trek.machine :as machine])
+            [trek.machine :as machine]
+            #?(:clj [clj.pprint :refer [cl-format]]
+               :cljs [cljs.pprint :refer [cl-format]]))
   #?(:clj (:import java.lang.Math)))

 (defn parse-int
@@ -541,11 +543,6 @@
   [machine formatter]
   (last-value machine (first (machine/emitted machine formatter))))

-(defn fmt
-  [& args]
-  #?(:clj (apply format args)
-     :cljs ":unformatted:"))
-
 (defmethod machine/formatter [:interpreter :format-type]
   [machine formatter]
   (let [[format-type] (machine/emitted machine formatter)
@@ -561,10 +558,10 @@
                         \x (last-value machine (apply str (repeat format-count (str " "))))

                         \a (last-value (update machine :unformatted pop)
-                                       (fmt (str "%" format-count "s") value))
+                                       (cl-format true (str "~" format-count "S") value))

                         \d (last-value (update machine :unformatted pop)
-                                       (fmt (str "%" format-count "d") (int value))))]
+                                       (cl-format true (str "~" format-count "D") (int value))))]
     machine))

 (defn format-list [machine formatter]


Remove redundant key fetch.

Remove redundant key fetch.

--- src/uuuurrrrllll/core.clj
+++ src/uuuurrrrllll/core.clj
@@ -46,10 +46,9 @@

 (defn get-all-entries []
   (wc/connect!)
-  (let [keys (wb/keys-in bucket)]
-    (->> "all"
-         (kv/index-query bucket :all)
-         (pmap get-entry))))
+  (->> "all"
+       (kv/index-query bucket :all)
+       (pmap get-entry)))

 (defn coalesce-entries []
   (->> (get-all-entries)


suppress complaints about a couple of secret device adapters

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

--- buildscripts/buildcheck/src/buildcheck/core.clj
+++ buildscripts/buildcheck/src/buildcheck/core.clj
@@ -180,7 +180,7 @@
   (let [index-txt (slurp device-list-page)]
     (remove empty? (map #(.trim %) (map second (re-seq #"\>(.*?)\<" index-txt))))))

-(def dont-link #{"NI100X" "NNLC" "Neos" "PriorLegacy" "SimpleCam"})
+(def dont-link #{"HamamatsuMac NI100X" "NNLC" "Neos" "PriorLegacy" "SimpleCam"})

 (defn missing-device-links []
   (sort (clojure.set/difference


use root_block_device for asgs

use root_block_device for asgs

--- src/terraboot/cluster.clj
+++ src/terraboot/cluster.clj
@@ -267,7 +267,7 @@
                    :min_size 3
                    :health_check_type "ELB"
                    :health_check_grace_period 20
-                   :ebs_block_device {:device_name "/dev/xvda" :volume_size 20}
+                   :root_block_device {:volume_size 20}
                    :subnets public-subnets
                    :elb {:health_check {:healthy_threshold 2
                                         :unhealthy_threshold 3
@@ -316,7 +316,7 @@
                                                              :exhibitor-s3-bucket (exhibitor-bucket-name cluster-name)
                                                              :internal-lb-dns (output-of "aws_elb" "InternalMasterLoadBalancer" "dns_name")
                                                              :fallback-dns (vpc/fallback-dns vpc/vpc-cidr-block)})
-                   :ebs_block_device {:device_name "/dev/xvda" :volume_size 20}
+                   :root_block_device {:volume_size 20}
                    :max_size 3
                    :min_size 1
                    :health_check_type "ELB"
@@ -350,7 +350,7 @@
                                                       :internal-lb-dns (output-of "aws_elb" "InternalMasterLoadBalancer" "dns_name")
                                                       :fallback-dns (vpc/fallback-dns vpc/vpc-cidr-block)})

-                   :ebs_block_device {:device_name "/dev/xvda" :volume_size 20}
+                   ;; :root_block_device {:volume_size 20}
                    :max_size 3
                    :min_size 3
                    :health_check_type "EC2" ;; or "ELB"?


Increase screen size

Increase screen size

--- src/try_lwjgl/display.clj
+++ src/try_lwjgl/display.clj
@@ -7,8 +7,8 @@
             [try-lwjgl.display.util :as util]
             [clojure.java.io :as io]))

-(def WIDTH 800)
-(def HEIGHT 600)
+(def WIDTH 1024)
+(def HEIGHT 768)

 (defn setup-opengl [width height title]
   (Display/setDisplayMode (DisplayMode. width height))


Mongo driver should ignore naughty blank strings :smiling_imp:

--- src/metabase/driver/mongo/util.clj
+++ src/metabase/driver/mongo/util.clj
@@ -1,6 +1,7 @@
 (ns metabase.driver.mongo.util
   "`*mongo-connection*`, `with-mongo-connection`, and other functions shared between several Mongo driver namespaces."
-  (:require [clojure.tools.logging :as log]
+  (:require [clojure.string :as s]
+            [clojure.tools.logging :as log]
             [colorize.core :as color]
             [monger.core :as mg]
             [metabase.driver :as driver]))
@@ -11,12 +12,12 @@
          dbname]}
   (str "mongodb://"
        user
-       (when pass
-         (assert user "Can't have a password without a user!")
+       (when-not (s/blank? pass)
+         (assert (not (s/blank? user)) "Can't have a password without a user!")
          (str ":" pass))
-       (when user "@")
+       (when-not (s/blank? user) "@")
        host
-       (when port
+       (when-not (s/blank? (str port))
          (str ":" port))
        "/"
        dbname))


web/scrape.clj: log ignored MIME types

web/scrape.clj: log ignored MIME types

--- src/org/altlaw/jobs/web/scrape.clj
+++ src/org/altlaw/jobs/web/scrape.clj
@@ -36,9 +36,11 @@
   (let [download (decode-response-body download)
         type (mime-type download)]
     (h/counter "MIME Types" type)
-    (when (= type "text/html")
+    (if (= type "text/html")
       (map handle-scraper-result
-           (handler/run-scrapers download)))))
+           (handler/run-scrapers download))
+      (do (log/debug "Ignoring MIME type " type)
+          nil))))

 (def mapper-map (partial h/standard-map my-map))


Fix aggregation errors in the fetcher.

Fix aggregation errors in the fetcher.

--- src/org/spootnik/cyanite/store.clj
+++ src/org/spootnik/cyanite/store.clj
@@ -73,10 +73,10 @@
 ;; if no method given parse metric name and select aggregation function
 ;;
 (defn detect-aggregate
-  [{:keys [path] :as metric}]
+  [{:keys [path data] :as metric}]
   (-> metric
       (dissoc :data)
-      (assoc :metric (apply (agg-fn-by-path path) metric))))
+      (assoc :metric ((agg-fn-by-path path) data))))

 (defn max-points
   "Returns the maximum number of points to expect for


(PDB-4872) Log deprecation warning for facts-blacklist

--- src/puppetlabs/puppetdb/schema.clj
+++ src/puppetlabs/puppetdb/schema.clj
@@ -6,9 +6,10 @@
             [schema.coerce :as sc]
             [clojure.string :as str]
             [schema.utils :as su]
-            [cheshire.custom :as json])
+            [cheshire.custom :as json]
+            [clojure.tools.logging :as log])
   (:import
-  (java.util.regex Pattern)))
+   (java.util.regex Pattern)))

 (defrecord DefaultedMaybe [schema default]
   s/Schema
@@ -165,6 +166,8 @@
     (when (and facts-blacklist facts-blocklist)
       (let [msg (trs "Confusing configuration settings found! Both the deprecated facts-blacklist and replacement facts-blocklist are set. These settings are mutually exclusive, please prefer facts-blocklist.")]
         (throw (ex-info msg {:type ::cli-error :message msg}))))
+    (when facts-blacklist
+      (log/warn (trs "The facts-blacklist and facts-blacklist-type settings have been deprecated and will be removed in a future release. Please use facts-blocklist and facts-blocklist-type instead.")))
     (cond-> config
       true (dissoc :facts-blacklist :facts-blacklist-type)
       blocklist-value (assoc :facts-blocklist blocklist-value)


+{:pred :word}

+{:pred :word}

--- src/babel/encyclopedia.cljc
+++ src/babel/encyclopedia.cljc
@@ -208,6 +208,10 @@

    {:pred :vino}     {:artifact true
                       :drinkable true}
+
+   {:pred :word}     {:legible true
+                      :speakable true}
+
    ;; </preds>

    {:stupid true}    {:animate true}


cleanup old comment

cleanup old comment

--- src/babel/italiano/lab.cljc
+++ src/babel/italiano/lab.cljc
@@ -238,7 +238,6 @@
   (let [generated (generate spec model)]
     (u/get-in generated path ::none)))

-;; to be used within babel.reader/generate-question-and-correct-set:
 (defn target-generation [spec index-fn model]
   (let [grammar
         (let [generate-with-grammar-set (grammar/rule-matcher-reducer spec)]


Bumping iteration count to make the tests pass.

--- compute/src/think/compute/verify/nn/train.clj
+++ compute/src/think/compute/verify/nn/train.clj
@@ -160,7 +160,7 @@
                  {:data {:data data :shape 1}
                   :labels {:data labels :shape 1}}
                  (ds/create-index-sets n :training-split 1.0))]
-    (train/train net (opt/adam) dataset [:data] [[:labels (opt/mse-loss)]] 100
+    (train/train net (opt/adam) dataset [:data] [[:labels (opt/mse-loss)]] 200
                  :epoch-train-filter nil)
     net))


Wrap a `get-libspec-from-file-with-caching` with `with-suppressed-errors`

Now that it performs extra computations, it is plausible that it could fail a little more easily.

--- src/refactor_nrepl/ns/libspecs.clj
+++ src/refactor_nrepl/ns/libspecs.clj
@@ -116,7 +116,13 @@
          [clj-aliases cljs-aliases] (pmap (fn [[dialect pred] corpus]
                                             (->> corpus
                                                  (filter pred)
-                                                 (map (partial get-libspec-from-file-with-caching dialect))
+                                                 (keep (comp (fn [v]
+                                                               (or v
+                                                                   ;; nullify `false` values for `keep`:
+                                                                   nil))
+                                                             (util/with-suppressed-errors
+                                                               (partial get-libspec-from-file-with-caching dialect)
+                                                               ignore-errors?)))
                                                  aliases-by-frequencies))
                                           [[:clj (util/with-suppressed-errors
                                                    (some-fn core/clj-file? core/cljc-file?)


Code to create (empty) directory for git mirrors

--- src/branch_handler/core.clj
+++ src/branch_handler/core.clj
@@ -10,10 +10,11 @@
 (require '[clojure.tools.logging   :as log])

 (require '[clj-fileutils.fileutils :as file-utils])
+(require '[clj-jenkins-api.jenkins-api :as jenkins-api])

 (def verbose false)
-(def port 3000)
-(def workdir "work")
+(def port    3000)
+(def workdir "/tmp/bare-repositories")

 (def jenkins-url (System/getenv "JENKINS_URL"))

@@ -189,11 +190,19 @@
     (log/info "Starting the server at the port: " port)
     (jetty/run-jetty ring-app {:port port}))

+(defn create-workdir
+    [workdir]
+    (let [directory (new java.io.File workdir)]
+        (when (not (.isDirectory directory))
+              (log/info "Creating work directory" (.getAbsolutePath directory))
+              (.mkdir directory))))
+
 (defn -main
     "Entry point to the branch handler service server."
     [& args]
     (log/info "Started app on port" port)
     (log/info "JENKINS_URL is set to" jenkins-url)
+    (create-workdir workdir)
     (start-action-consumer actions-queue)
     (start-server ring-app port))


modify memory size for proving ground

modify memory size for proving ground

--- src/clj/morpheus/integration/sources/wikidata.clj
+++ src/clj/morpheus/integration/sources/wikidata.clj
@@ -230,7 +230,7 @@
                   :port 5124
                   :zk  "10.0.1.104:2181"
                   :trunks-size "5gb"
-                  :memory-size "15gb"
+                  :memory-size "50gb"
                   ;:schema-file "configures/neb-schemas.edn"
                   :data-path   "wikidata"
                   :durability true


Make strobe framerate mutable

Make strobe framerate mutable

--- src/clojure/playasophy/wonderdome/mode/strobe.clj
+++ src/clojure/playasophy/wonderdome/mode/strobe.clj
@@ -1,18 +1,31 @@
 (ns playasophy.wonderdome.mode.strobe
   (:require
-    [playasophy.wonderdome.mode.core :as mode]))
+    [playasophy.wonderdome.mode.core :as mode]
+    [playasophy.wonderdome.util.control :as control]))

 (defrecord StrobeMode
-  [colors index]
+  [colors index frames-per-color frame-index]

   mode/Mode

   (update
     [this event]
-    (if (= :time/tick (:type event))
-      (assoc this :index
-        (mod (inc index) (count colors)))
+    (condp = [(:type event) (:input event)]
+      [:time/tick nil]
+      (if (>= frame-index frames-per-color)
+        (assoc this
+               :index (mod (inc index) (count colors))
+               :frame-index 1)
+        (assoc this
+               :frame-index (inc frame-index)))
+
+      [:button/press :up]
+      (assoc this :frames-per-color (min (inc frames-per-color) 100))
+
+      [:button/press :down]
+      (assoc this :frames-per-color (max (dec frames-per-color) 1))
+
       this))

@@ -24,4 +37,4 @@
 (defn init
   "Creates a new strobe mode with the given color sequence."
   [colors]
-  (StrobeMode. (vec colors) 0))
+  (StrobeMode. (vec colors) 0 1 0))


update docker api to 1.30

update docker api to 1.30

--- src/clj/swarmpit/config.clj
+++ src/clj/swarmpit/config.clj
@@ -3,7 +3,7 @@
     [environ.core :refer [env]]))

 (def default {:docker-sock      "/var/run/docker.sock"
-              :docker-api       "1.28"
+              :docker-api       "1.30"
               :db-url           "http://localhost:5984"
               :password-hashing {:alg        :pbkdf2+sha512
                                  :iterations 200000}})


Sunrise/sunset - refactoring to use specified calendar, if provided

--- src/clj_mrazik/schedule.clj
+++ src/clj_mrazik/schedule.clj
@@ -45,28 +45,30 @@
                   (recur (conj schedule (schedule-entry time duration)) (+ time frequency))))))

 (defn get-sunset
-    [geolocation]
-    (let [cal   (calendar/get-calendar)
-          day   (calendar/get-day cal)
-          month (calendar/get-month cal)
-          year  (calendar/get-year cal)]
-        (sunrise/setting-time {:day   day
+    ([geolocation]
+     (get-sunset geolocation (calendar/get-calendar)))
+    ([geolocation cal]
+     (let [day   (calendar/get-day cal)
+           month (calendar/get-month cal)
+           year  (calendar/get-year cal)]
+         (sunrise/setting-time {:day   day
+                                :month month
+                                :year  year
+                                :latitude  (:latitude  geolocation)
+                                :longitude (:longitude geolocation)
+                                :local-offset 1}))))
+
+(defn get-sunrise
+    ([geolocation]
+     (get-sunrise geolocation (calendar/get-calendar)))
+    ([geolocation cal]
+     (let [day   (calendar/get-day cal)
+           month (calendar/get-month cal)
+           year  (calendar/get-year cal)]
+         (sunrise/rising-time {:day   day
                                :month month
                                :year  year
                                :latitude  (:latitude  geolocation)
                                :longitude (:longitude geolocation)
-                               :local-offset 1})))
+                               :local-offset 1}))))

-(defn get-sunrise
-    [geolocation]
-    (let [cal   (calendar/get-calendar)
-          day   (calendar/get-day cal)
-          month (calendar/get-month cal)
-          year  (calendar/get-year cal)]
-        (sunrise/rising-time {:day   day
-                               :month month
-                               :year  year
-                               :latitude  (:latitude  geolocation)
-                               :longitude (:longitude geolocation)
-                               :local-offset 1})))
-


refactor: try to extract the ai from the game

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -33,7 +33,7 @@
   (assoc game :moves (move/all-available-moves board)))

 (defn- next-player
-  [player]
+  [player]
   (case player
     :blue :red
     :red :green
@@ -135,6 +135,15 @@
         moves))
     ))

+(defn with-ai-data
+  "Add the AI data needed to play the game"
+  [init-game]
+  (merge init-game
+    {:ai-players
+     {:red (partial best-move (compute-cells-strength board))
+      :green (partial best-move (compute-cells-strength board))}}
+    ))
+

 ;; -----------------------------------------
 ;; GAME STATE
@@ -142,24 +151,22 @@

 (defn new-game []
   (let [board (board/new-board)]
-    (with-available-moves
-      {:board board
-       :player (rand-nth cst/players)
-       :moves {}
-       :help false
-       :ai-players
-       {:red (partial best-move (compute-cells-strength board))
-        :green (partial best-move (compute-cells-strength board))}
-       :scores
-       {:blue cst/init-block-count
-        :red cst/init-block-count
-        :green cst/init-block-count}})))
+    (-> {:board board
+         :player (rand-nth cst/players)
+         :moves {}
+         :help false
+         :scores
+         {:blue cst/init-block-count
+          :red cst/init-block-count
+          :green cst/init-block-count}}
+      with-available-moves
+      with-ai-data)))

 (defonce app-state
   (atom {:games (list (new-game))
          :help false}))

-(def game (reaction (first (get-in @app-state [:games]))))
+(def game (reaction (first (get-in @app-state [:games]))))
 (def board (reaction (get-in @game [:board])))
 (def scores (reaction (get-in @game [:scores])))
 (def current-player (reaction (get-in @game [:player])))
@@ -208,7 +215,7 @@
         ai-events (chan 1 (comp (filter game-on-xf) (filter is-ai-xf)))
         player-events (chan 1 (comp (filter game-on-xf) (filter is-human-xf)))
         game-events (chan 1)]
-
+
     (go
       (while true
         (alt!
@@ -217,7 +224,7 @@
           ai-events ([msg] (when (= msg :ai-play) (handle-ai!)))
           (async/timeout ai-move-delay) ([_] (put! ai-events :ai-play))
           )))
-
+
     {:player-events player-events
      :game-events game-events}))


More pre-conditions

More pre-conditions

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -4,10 +4,10 @@
     [clojure.string :as str]))

 (enable-console-print!)
-(set! *assert* true)
+(set! *assert* false) ;; Set to true for the debug mode

 ;; TODO - Try to plug the history of brower for "back"
-;; TODO - Try to bring some domain vocabular here: it gets too complicated to trace
+;; TODO - Try to bring some domain vocabulary here: it gets too complicated to trace

 ;; -----------------------------------------
 ;; GAME PARAMETERS
@@ -25,7 +25,20 @@
 ;; -----------------------------------------

 (def player? (set players))
-(def cell-types? (conj player? :wall :empty))
+(def cell? (conj player? :wall :empty))
+
+(defn coord? [p]
+  (and
+    (integer? (first p))
+    (integer? (second p))
+    (= 2 (count p))))
+
+(defn move? [m]
+  (and
+    (:move m)
+    (every? coord? (:taken m))
+    (:winner m)
+    (:looser m)))

 ;; -----------------------------------------
@@ -86,7 +99,7 @@

 (defn ^boolean is-cell-empty?
   "Indicates whether a cell is owned by any player"
-  {:pre (or (nil? cell) (cell-types? cell))}
+  {:pre [(or (nil? cell) (cell? cell))]}
   [cell]
   (or (nil? cell) (= cell :empty) (= cell :wall)))

@@ -200,6 +213,7 @@

 (defn- compute-cell-strength
   "Compute a cell strength based on the number of walls it has"
+  {:pre [(coord? point)]}
   [board point]
   (let [neighbors (coord-neighbors point)
         walls (filter #(= :wall (get-in board % :wall)) neighbors)]
@@ -216,6 +230,7 @@
 (defn- move-strength
   "Compute the strength of a move, based on the converted cells"
   [cells-strength converted-filter [move converted]]
+  {:pre [(fn? converted-filter) (every? move? converted)]}
   (transduce
     (comp
       (filter converted-filter) ;; TODO - Extract this part (specific to worst move)
@@ -231,14 +246,13 @@
         all-moves (get-in game [:moves player])]
     (transduce
       (map #(move-strength (:cells-strength game) converted-filter %))
-      max
-      all-moves)))
+      max all-moves)))

 (defn best-move
   "[SIMPLISTIC] Return the best move for a player based on:
    * The immediate gain
    * The worse immediate lost afterwards"
-  {:pre (player? player)}
+  {:pre [(player? player)]}
   [game player]
   (let [moves (get-in game [:moves player])
         others (remove #{player} players)]
@@ -273,6 +287,7 @@
 (def board (reagent/cursor app-state [:board]))
 (def scores (reagent/cursor app-state [:scores]))
 (def current-player (reagent/cursor app-state [:player]))
+

 ;; -----------------------------------------
 ;; DISPLAY


Content refresh July 2018

Content refresh July 2018

Signed-off-by: Igor Mandrigin <042dc4512fa3d391c5170cf3aa61e6a638f84342@mandrigin.ru>

--- src/status_im/translations/en.cljs
+++ src/status_im/translations/en.cljs
@@ -39,17 +39,17 @@
    :status-console                       "Status Console"

    ;;sign in
-   :intro-text                           "Status is an open source decentralized chat and Ethereum browser"
-   :intro-text-description               "Status is built with the help of the community to help you use all the benefits of decentralized web in your mobile phone"
+   :intro-text                           "Status is your gateway to the decentralized web"
+   :intro-text-description               "A community-powered platform to securely chat and transact on the Ethereum blockchain"
    :create-account                       "Create account"
    :already-have-account                 "I already have an account"
-   :creating-your-account                "Creating your account on the blockchain. We can't touch it, no one can, except for you!"
-   :password-placeholder                 "Type your password"
+   :creating-your-account                "Creating your account..."
+   :password-placeholder                 "At least 6 characters"
    :password-placeholder2                "Confirm your password"
    :name-placeholder                     "Display name"
-   :password_error1                      "Password confirmation doesn't match password."
+   :password_error1                      "Passwords don't match."
    :password-description                 "You'll need this password to open the app and confirm transactions."
-   :name-description                     "This will be the name everybody who uses Status will see. You can change it later."
+   :name-description                     "Change this anytime in your Profile."
    :other-accounts                       "Other accounts"
    :sign-you-in                          "Signing you in…"

@@ -64,7 +64,7 @@
    :home                                 "Home"
    :no-recent-chats                      "There are no recent Chats or DApps here yet. Tap the “Plus” button to see the list of Dapps or discover people to chat with."
    :welcome-to-status                    "Welcome to Status"
-   :welcome-to-status-description        "Here you can chat with people in a secure\n private chat, browse and interact with DApps.\n Use the “Plus” icon to explore Status"
+   :welcome-to-status-description        "Tap the plus (+) button to get started"

    ;;chat
    :is-typing                            "is typing"
@@ -150,7 +150,7 @@
    :testnet-text                         "You’re on the {{testnet}} Testnet. Do not send real ETH or SNT to your address"
    :mainnet-text                         "You’re on the Mainnet. Real ETH will be sent"
    :dev-mode                             "Development mode"
-   :backup-your-recovery-phrase          "Backup your Recovery phrase"
+   :backup-your-recovery-phrase          "Backup your recovery phrase"

    ;;recovery phrase
    :your-data-belongs-to-you             "If you lose your recovery phrase you lose your data and funds"
@@ -166,7 +166,7 @@
    :you-are-all-set                      "You’re all set!"
    :you-are-all-set-description          "Now if you lose your phone you can restore your account and wallet using the recovery phrase."
    :ok-got-it                            "Ok, got it"
-   :backup-recovery-phrase               "Backup Recovery phrase"
+   :backup-recovery-phrase               "Backup recovery phrase"
    :step-i-of-n                          "Step {{step}} of {{number}}"
    :word-n-description                   "In order to check if you have backed up your recovery phrase correctly, enter the word #{{number}} above."
    :word-n                               "Word #{{number}}"
@@ -178,8 +178,8 @@
    :wallet-set-up-signing-phrase         "This is your personal transaction phrase that you’ll use everytime you make a transaction. Make sure to write it down on a piece of paper, store it somewhere, and only confirm transactions when you see these three words."
    :wallet-set-up-confirm-title          "Wrote it down?"
    :wallet-set-up-confirm-description    "You won’t be able to see your 3-word transaction phrase again after this."
-   :wallet-backup-recovery-title         "Backup your Recovery phrase"
-   :wallet-backup-recovery-description   "This will help you to keep your money safe"
+   :wallet-backup-recovery-title         "Backup your recovery phrase"
+   :wallet-backup-recovery-description   "This will help you to keep your assets safe"

    ;;make_photo
    :image-source-title                   "Edit picture"
@@ -416,8 +416,8 @@
    :cost-fee                             "Cost/Fee"
    :nonce                                "Nonce"
    :confirmations                        "Confirmations"
-   :confirmations-helper-text            "Please wait for at least 12 confirmations to make sure your transaction is processed securely"
-   :copy-transaction-hash                "Copy transaction hash"
+   :confirmations-helper-text            "Consider transactions complete after 12 confirmations"
+   :copy-transaction-hash                "Copy transaction ID"
    :open-on-etherscan                    "Open on Etherscan.io"
    :incoming                             "Incoming"
    :outgoing                             "Outgoing"
@@ -430,7 +430,7 @@

    ;;testfairy warning
    :testfairy-title                      "Warning!"
-   :testfairy-message                    "You are using an app installed from a nightly build. For testing purposes this build includes session recording if wifi connection is used, so all your interactions with this app is saved (as video and logs) and might be used by our development team to investigate possible issues. Saved video/logs do not include your passwords. Recording is done only if the app is installed from a nightly build. Nothing is recorded if the app is installed from PlayStore or TestFlight."
+   :testfairy-message                    "You are using an app installed from a nightly build. If you're connected to WiFi, your interactions with the app will be saved as video and logs. These recordings do not save your passwords. They are used by our development team to investigate possible issues and only occur if the app is install from a nightly build. Nothing is recorded if the app is installed from PlayStore or TestFlight."

    ;; wallet
    :wallet                               "Wallet"
@@ -593,7 +593,7 @@

    ;; Wallet Send
    :wallet-choose-recipient              "Choose Recipient"
-   :wallet-choose-from-contacts          "Choose From Contacts"
+   :wallet-choose-from-contacts          "Choose from Contacts"
    :wallet-address-from-clipboard        "Use Address From Clipboard"
    :wallet-invalid-address               "Invalid address: \n {{data}}"
    :wallet-invalid-chain-id              "Network does not match: \n {{data}} but current chain is {{chain}}"
@@ -602,7 +602,7 @@
    :wallet-browse-photos                 "Browse Photos"
    :wallet-advanced                      "Advanced"
    :wallet-transaction-fee               "Transaction Fee"
-   :wallet-transaction-fee-details       "Gas limit is the amount of gas to send with your transaction. Increasing this number will not get your transaction processed faster"
+   :wallet-transaction-fee-details       "Gas limit caps the units of gas spent on the transaction. Gas price sets the price per unit of gas. Increasing gas price can make your transaction faster."
    :wallet-transaction-total-fee         "Total Fee"
    :validation-amount-invalid-number     "Amount is not a valid number"
    :validation-amount-is-too-precise     "Amount is too precise. Max number of decimals is {{decimals}}."
@@ -649,7 +649,7 @@
    :network-settings                     "Network settings"
    :offline-messaging                    "Mailserver"
    :offline-messaging-settings           "Mailserver settings"
-   :edit-network-warning                 "Be careful, editing the network data may disable this network for you"
+   :edit-network-warning                 "Be careful! Editing the network data may disable this network for you"
    :delete-network-error                 "Please connect to a different network before deleting this one"
    :connecting-requires-login            "Connecting to another network requires login"
    :close-app-title                      "Warning!"
@@ -704,4 +704,4 @@
    :browser-not-secure                   "Connection is not secure! Do not sign transactions or send personal data on this site."
    :make-sure-you-trust-dapp             "Make sure that you trust this DApp"
    :would-like-to-access                 "Would like to Access"
-   :your-contact-code                    "Your Contact Code"})+   :your-contact-code                    "Your Contact Code"})


Updating doc-string of make-context-nc

Updating doc-string of make-context-nc

May not be clear what I want to say here, but it's still better than
being undocumented.

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

--- src/conexp/fca/contexts.clj
+++ src/conexp/fca/contexts.clj
@@ -100,7 +100,12 @@

 (defn make-context-nc
   "Context constructor similar to make-context, but does not do any
-  safety checking and is therefore faster. Use with care."
+  safety checking and is therefore faster. Use with care.
+
+  This function is useful if you want to construct new contexts from old ones.  In
+  particular, if you want to use the incidence relation if a given context as the
+  incidence relation for a new one, you can just pass it to this function without any
+  modifications."
   [objects attributes incidence]
   (Formal-Context. (to-set objects) (to-set attributes) incidence))


only build options that are used

only build options that are used

--- src/vignette/api/legacy/routes.clj
+++ src/vignette/api/legacy/routes.clj
@@ -75,9 +75,11 @@
 (defn route->options
   [map]
   (let [[_ format] (re-find #"(?i)\.([a-z]+)$" (get map :thumbname ""))
-        [_ path-prefix] (re-find #"^/([/a-z]+)$" (get map :path-prefix ""))]
-    (assoc map :options {:format (.toLowerCase format)
-                         :path-prefix path-prefix})))
+        [_ path-prefix] (re-find #"^/([/a-z]+)$" (get map :path-prefix ""))
+        options {}
+        options (if format (assoc options :format (.toLowerCase format)) options)
+        options (if path-prefix (assoc options :path-prefix path-prefix) options)]
+    (assoc map :options options)))

 (defn route->dimensions
   [map]


CMR-6751 Updating preview gem commit ref (#1071)

* CMR-6751 updating commit ref and version for preview gem to update service tab link generation.

* CMR-6751 updating to include second preview gem change

--- collection-renderer-lib/project.clj
+++ collection-renderer-lib/project.clj
@@ -10,9 +10,9 @@
    the hardcoded commit id during dev integration with cmr_metadata_preview project.
    The hardcoded commit id should be updated when MMT releases a new version of the gem."
   {:repo "https://git.earthdata.nasa.gov/scm/cmr/cmr_metadata_preview.git"
-   :version "cmr_metadata_preview-0.2.4"
+   :version "cmr_metadata_preview-0.2.5"
    :commit-id (or (System/getenv "CMR_METADATA_PREVIEW_COMMIT")
-                  "1aaef8d08e9636968e84dead10d52c7c1aae09c7")})
+                  "40320c299336c68047b27110ef1e5dae5a20a24f")})

 (def gem-install-path
   "The directory within this library where Ruby gems are installed."


Use 'to-ms'

Use 'to-ms'

--- src/cyanite_cache/cache.clj
+++ src/cyanite_cache/cache.clj
@@ -57,7 +57,7 @@
 (defn run-delayer!
   [rollup flusher]
   (let [delayer (future
-                  (Thread/sleep (* (calc-delay rollup (rand-int 59)) 1000)))]
+                  (Thread/sleep (to-ms (calc-delay rollup (rand-int 59)))))]
     (future
       (deref delayer)
       (flusher))


RS+CM - #5 fix api response for get user

--- src/d_cent/handlers/api.clj
+++ src/d_cent/handlers/api.clj
@@ -23,8 +23,8 @@
 (defn get-user-profile [request]
   (let [store (storage/request->store request)
         twitter-id (get-in request [:params :twitter])]
-    (if-let [user-profile (user/retrieve-user-record store twitter-id)]
-      (response/response (json/generate-string user-profile))
+    (if-let [user-profile (user/retrieve-user-record store twitter-id)]
+      (response/content-type (response/response user-profile) "application/json")
       (response/not-found ""))))

 (defn post-objective [{:keys [params] :as request}]


Make reduce + filter return nil when no matches

--- src/deepfns/transitive.cljc
+++ src/deepfns/transitive.cljc
@@ -20,6 +20,7 @@

 ;; I know eq is usually for checking memory equality... I just like
 ;; having => for threading and this seemed like a good second choice
+;; I'd take suggestions for a new name too
 (defn eq>
   "A transative form of = where both arguments are transitive
   expressions"
@@ -78,22 +79,24 @@
   "A transitive form of reduce where exprs are collections of transitive
   expressions. Here's an example:

-  ((reduce> + [:foo :foo :bar] [:foo]) {:foo 1})
+  ((reduce1> + [:foo :foo :bar] [:foo]) {:foo 1})

   => 3"
   ([f & exprs]
    (let [ts (to-transitive exprs)]
      (fn [m]
-       (->> (trans-vals ts m)
-            (reduce f))))))
+       (let [xs (trans-vals ts m)]
+         (when (not (empty? xs))
+           (reduce f xs)))))))

 (defn reduce2>
   "A transitive form of reduce that uses an initial seed value."
   ([f seed & exprs]
    (let [ts (to-transitive exprs)]
      (fn [m]
-       (->> (trans-vals ts m)
-            (reduce f seed))))))
+       (let [xs (trans-vals ts m)]
+         (when (not (empty? xs))
+           (reduce f seed xs)))))))

 (defn filter>
   "A transitive form of filter where exprs are collections of transitive
@@ -101,5 +104,6 @@
   [pred & exprs]
   (let [ts (to-transitive exprs)]
     (fn [m]
-      (->> (trans-vals ts m)
-           (filter pred)))))
+      (let [xs (trans-vals ts m)]
+        (when (not (empty? xs))
+          (filter pred xs))))))


preserve empty tab beats for rest

preserve empty tab beats for rest

--- ohack/src/ohack/core.clj
+++ ohack/src/ohack/core.clj
@@ -280,8 +280,11 @@
                          ;; now we need to parse the tab-line...
                          ;; collect each string's results into into {}
                          (into {}
-                               (map (fn [[k v]] (if v
-                                                 [k [string-index v]]))
+                               ;; create index -> []
+                               ;; when no string is played, for rest
+                               (map (fn [[k v]] [k (if v
+                                                    [string-index v]
+                                                    [])])
                                     (parse-guitar-tab-line tab-line)))
                          )))]
     (prn play-map))


Reformat :figwhell stanza

Reformat :figwhell stanza

--- app/pyrexia/project.clj
+++ app/pyrexia/project.clj
@@ -40,9 +40,6 @@
                                    :optimizations :advanced
                                    :pretty-print false}}]}

-  :figwheel {
-             :css-dirs ["resources/public/css"] ;; watch and update CSS
-
-             ;; if you want to disable the REPL
-             :repl false
+  :figwheel {:css-dirs ["resources/public/css"] ;; watch and update CSS
+             :repl false ;; disable the REPL
 })


Removed extraneous newline.

Removed extraneous newline.


Fix Content-Security-Policy errors on Safari

--- src/metabase/middleware.clj
+++ src/metabase/middleware.clj
@@ -142,8 +142,8 @@
                                                       :script-src  ["'unsafe-inline'"
                                                                     "'unsafe-eval'"
                                                                     "'self'"
-                                                                    "www.google-analytics.com"
-                                                                    "*.googleapis.com"
+                                                                    "https://www.google-analytics.com" ; Safari requires the protocol
+                                                                    "https://*.googleapis.com"
                                                                     "*.gstatic.com"
                                                                     "js.intercomcdn.com"
                                                                     "*.intercom.io"


RS & AB | 222 | Remove unnecessary function

--- src/mooncake/middleware.clj
+++ src/mooncake/middleware.clj
@@ -15,12 +15,6 @@
   (fn [request]
     (-> request
         (assoc-in [:context :config-m] config-m)
-        handler)))
-
-(defn wrap-activity-sources [handler activity-sources]
-  (fn [request]
-    (-> request
-        (assoc-in [:context :activity-sources] activity-sources)
         handler)))

 (defn generate-activity-sources-with-types [activity-sources activity-types]


Remove unused update count.

Remove unused update count.

--- src/oc/storage/api/orgs.clj
+++ src/oc/storage/api/orgs.clj
@@ -138,14 +138,10 @@
                              allowed-boards (filter #(access/access-level-for org % user) boards)
                              board-reps (map #(board-rep/render-board-for-collection slug %) allowed-boards)
                              authors (:authors org)
-                             author-reps (map #(org-rep/render-author-for-collection org %) authors)
-                             update-count (if user
-                                            0 ;(count (update-res/list-updates-by-author conn org-id user-id))
-                                            0)]
+                             author-reps (map #(org-rep/render-author-for-collection org %) authors)]
                           (org-rep/render-org (-> org
                                                 (assoc :boards board-reps)
-                                                (assoc :authors author-reps)
-                                                (assoc :update-count update-count))
+                                                (assoc :authors author-reps))
                                               (:access-level ctx))))
   :handle-unprocessable-entity (fn [ctx]
     (api-common/unprocessable-entity-response (schema/check common-res/Org (:updated-org ctx)))))
@@ -235,7 +231,7 @@
                                   slug (:slug new-org)]
                               (api-common/location-response
                                 (org-rep/url slug)
-                                (org-rep/render-org (assoc new-org :update-count 0) :author)
+                                (org-rep/render-org (assoc new-org) :author)
                                 mt/org-media-type)))
   :handle-unprocessable-entity (fn [ctx]
     (api-common/unprocessable-entity-response (:reason ctx))))


Resolve transform fn up front.

Resolve transform fn up front.

--- src/onyx/peer/transform.clj
+++ src/onyx/peer/transform.clj
@@ -24,10 +24,8 @@
 (defn decompress-segment [queue message]
   (extensions/read-message queue message))

-(defn apply-fn [task params segment]
-  (let [user-ns (symbol (name (namespace (:onyx/fn task))))
-        user-fn (symbol (name (:onyx/fn task)))]
-    ((reduce #(partial %1 %2) (ns-resolve user-ns user-fn) params) segment)))
+(defn apply-fn [f params segment]
+  ((reduce #(partial %1 %2) f params) segment))

 (defn compress-segment [segment]
   {:compressed (.array (fressian/write segment))
@@ -62,10 +60,8 @@
   (merge event {:onyx.core/acked (count batch)}))

 (defn apply-fn-shim
-  [{:keys [onyx.core/decompressed onyx.core/task
-           onyx.core/catalog onyx.core/params] :as event}]
-  (let [task (first (filter (fn [entry] (= (:onyx/name entry) task)) catalog))
-        results (flatten (map (partial apply-fn task params) decompressed))]
+  [{:keys [onyx.core/decompressed onyx.transform/fn onyx.core/params] :as event}]
+  (let [results (flatten (map (partial apply-fn fn params) decompressed))]
     (merge event {:onyx.core/results results})))

 (defn compress-batch-shim [{:keys [onyx.core/results] :as event}]
@@ -81,6 +77,12 @@

 (defn seal-resource-shim [{:keys [onyx.core/queue onyx.core/egress-queues] :as event}]
   (merge event (cap-queue queue egress-queues)))
+
+(defmethod l-ext/inject-lifecycle-resources :transformer
+  [_ {:keys [onyx.core/task-map]}]
+  (let [user-ns (symbol (name (namespace (:onyx/fn task-map))))
+        user-fn (symbol (name (:onyx/fn task-map)))]
+    {:onyx.transform/fn (ns-resolve user-ns user-fn)}))

 (defmethod l-ext/read-batch :default
   [event] (read-batch-shim event))


fix typo in ph blog post

fix typo in ph blog post

--- src/pc/views/blog/we_made_precursor_for_teams.clj
+++ src/pc/views/blog/we_made_precursor_for_teams.clj
@@ -61,7 +61,7 @@
      [:h3 "Best of all, prototyping will still be free."]
      [:p "Our prototyping tools are staying right where they are—free for everyone. "]
      [:p "Accessibility is part of Precursor's foundation, and we still think sharing an idea should be as simple as sharing a url. "
-         "That's why we're keeping the Precursor public app free and accessibile anywhere, on any device. "]]
+         "That's why we're keeping the Precursor public app free and accessible anywhere, on any device. "]]

     [:article
      [:h3 "We're hungry for feedback."]


Update cgdata test for chrom-pos records.

--- test/cgdata/core_test.clj
+++ test/cgdata/core_test.clj
@@ -1,6 +1,7 @@
 (ns cgdata.core-test
   (:require [clojure.test :as ct])
   (:require [clojure.java.io :as io])
+  (:require [clojure.string :as s])
   (:require [cgdata.core :as cgdata]))

 (def cwd (.getCanonicalFile (io/file ".")))
@@ -76,6 +77,9 @@
                     {:header :chromEnd :i 7}])))))

+(defn reader-from-str [s]
+ (io/reader (io/input-stream (.getBytes s))))
+
 (ct/deftest test-position-spec
   (let [field {:name "position"
                :header :position
@@ -83,15 +87,21 @@
                :columns [{:header :chrom :i 0}
                          {:header :chromStart :i 1}
                          {:header :chromEnd :i 2}]}
-        rows [["chr1" "100" "200"]
-              [" chr1" "200 " "300"]
-              ["chr2 " "100" " 200"]
-              ["chr3" "500" "600"]]
+        rows {:reader
+              (constantly
+                (reader-from-str
+                  (s/join
+                    "\n"
+                    (map #(s/join "\t" %)
+                         [["chr1" "100" "200"]
+                          [" chr1" "200 " "300"]
+                          ["chr2 " "100" " 200"]
+                          ["chr3" "500" "600"]]))))}
         spec (cgdata/field-spec field rows)]
     (ct/is (= {:field "position"
                :valueType "position"
-               :rows [{:chrom "chr1" :chromStart 100 :chromEnd 200}
-                      {:chrom "chr1" :chromStart 200 :chromEnd 300}
-                      {:chrom "chr2" :chromStart 100 :chromEnd 200}
-                      {:chrom "chr3" :chromStart 500 :chromEnd 600}]}
-              spec))))
+               :rows [{:chrom "chr1" :chromStart 100 :chromEnd 200 :strand \0}
+                      {:chrom "chr1" :chromStart 200 :chromEnd 300 :strand \0}
+                      {:chrom "chr2" :chromStart 100 :chromEnd 200 :strand \0}
+                      {:chrom "chr3" :chromStart 500 :chromEnd 600 :strand \0}]}
+              (update-in spec [:rows] #(map (fn [pos] (into {} pos)) (deref %)))))))


Specify content type

Specify content type

--- test/icecap/rest_test.clj
+++ test/icecap/rest_test.clj
@@ -19,6 +19,7 @@
   "A request for creating a cap, given a plan."
   [plan]
   (-> (mock/request :post "/v0/caps")
+      (mock/content-type "application/edn")
       (mock/body (str plan))))

 (deftest handler-tests


Added more unit tests.

Added more unit tests.

--- test/com/lemonodor/gflags_test.clj
+++ test/com/lemonodor/gflags_test.clj
@@ -46,7 +46,7 @@

 (deftest boolean-test
-  (testing "boolean flag"
+  (testing "long implicit true boolean flag"
     (binding [gflags/*flags* (gflags/make-flag-values)]
       (gflags/define-boolean "enable-unicorns"
         false
@@ -58,7 +58,46 @@
         (let [flags (gflags/flags)]
           (is (contains? flags :enable-unicorns))
           (is (not (contains? flags :unknown-flag)))
-          (is (flags :enable-unicorns)))))))
+          (is (flags :enable-unicorns))))))
+  (testing "long implicit false boolean flag"
+    (binding [gflags/*flags* (gflags/make-flag-values)]
+      (gflags/define-boolean "enable-unicorns"
+        false
+        "Whether we should enable unicorns"
+        :short-name "u")
+      (let [args ["argv0" "--noenable-unicorns" "arg1"]
+            unparsed-args (gflags/parse-flags args)]
+        (is (= unparsed-args ["arg1"]))
+        (let [flags (gflags/flags)]
+          (is (contains? flags :enable-unicorns))
+          (is (not (contains? flags :unknown-flag)))
+          (is (not (flags :enable-unicorns)))))))
+  (testing "long explicit true boolean flag"
+    (binding [gflags/*flags* (gflags/make-flag-values)]
+      (gflags/define-boolean "enable-unicorns"
+        false
+        "Whether we should enable unicorns"
+        :short-name "u")
+      (let [args ["argv0" "--enable-unicorns=true" "arg1"]
+            unparsed-args (gflags/parse-flags args)]
+        (is (= unparsed-args ["arg1"]))
+        (let [flags (gflags/flags)]
+          (is (contains? flags :enable-unicorns))
+          (is (not (contains? flags :unknown-flag)))
+          (is (flags :enable-unicorns))))))
+  (testing "long explicit false boolean flag"
+    (binding [gflags/*flags* (gflags/make-flag-values)]
+      (gflags/define-boolean "enable-unicorns"
+        false
+        "Whether we should enable unicorns"
+        :short-name "u")
+      (let [args ["argv0" "--enable-unicorns=false" "arg1"]
+            unparsed-args (gflags/parse-flags args)]
+        (is (= unparsed-args ["arg1"]))
+        (let [flags (gflags/flags)]
+          (is (contains? flags :enable-unicorns))
+          (is (not (contains? flags :unknown-flag)))
+          (is (not (flags :enable-unicorns))))))))

 (deftest redefinition-test


first test actually passing now. ahem

first test actually passing now. ahem

--- test/complico/acceptance_tests.clj
+++ test/complico/acceptance_tests.clj
@@ -6,13 +6,15 @@
       [ring.util.serve]))

 (deftest convert
-  (testing "convert should add url as base element"
-    (serve my-handler)
+  (testing "should add host url as base element to request body"
+
+    ; start the server, headless
+    (serve-headless my-handler)
+
     (let [response (app (request :get "/convert" {:url "http://localhost:3000/test"} ))]
       (is (= (:status response) 200))
 		;(println (:body response))
       (is (= (.contains (:body response)
 			"<head><base href=\"http://localhost:3000/\"/></head>Test Page") true)))
-    (stop-server))
-)
+    (stop-server)))


Avoid a lazy `pmap`ping

Avoid a lazy `pmap`ping

--- src/refactor_nrepl/core.clj
+++ src/refactor_nrepl/core.clj
@@ -102,6 +102,8 @@
   Note that files which are non-existent, hidden or build-artifacts
   are pruned by this function."
   [pred dir]
+  ;; ensure pmap is not used lazily:
+  {:post [(vector? %)]}
   (->> dir
        file-seq
        ;; `pmap` performs better in large projects.
@@ -112,7 +114,7 @@
                                   (complement build-artifact?))
                       f)
                  f)))
-       (filter identity)))
+       (filterv identity)))

 (defn read-ns-form
   ([path]


Sequential is being removed.

Sequential is being removed.

--- test/onyx/peer/sequential_test.clj
+++ test/onyx/peer/sequential_test.clj
@@ -1,101 +0,0 @@
-(ns onyx.peer.sequential-test
-  (:require [com.stuartsierra.component :as component]
-            [onyx.system :refer [onyx-development-env]]
-            [midje.sweet :refer :all]
-            [onyx.queue.hornetq-utils :as hq-util]
-            [onyx.api]))
-
-(def id (java.util.UUID/randomUUID))
-
-(def config (read-string (slurp (clojure.java.io/resource "test-config.edn"))))
-
-(def scheduler :onyx.job-scheduler/round-robin)
-
-(def env-config
-  {:hornetq/mode :udp
-   :hornetq/server? true
-   :hornetq.server/type :embedded
-   :hornetq.udp/cluster-name (:cluster-name (:hornetq config))
-   :hornetq.udp/group-address (:group-address (:hornetq config))
-   :hornetq.udp/group-port (:group-port (:hornetq config))
-   :hornetq.udp/refresh-timeout (:refresh-timeout (:hornetq config))
-   :hornetq.udp/discovery-timeout (:discovery-timeout (:hornetq config))
-   :hornetq.embedded/config (:configs (:hornetq config))
-   :zookeeper/address (:address (:zookeeper config))
-   :zookeeper/server? true
-   :zookeeper.server/port (:spawn-port (:zookeeper config))
-   :onyx/id id
-   :onyx.peer/job-scheduler scheduler})
-
-(def peer-config
-  {:hornetq/mode :udp
-   :hornetq.udp/cluster-name (:cluster-name (:hornetq config))
-   :hornetq.udp/group-address (:group-address (:hornetq config))
-   :hornetq.udp/group-port (:group-port (:hornetq config))
-   :hornetq.udp/refresh-timeout (:refresh-timeout (:hornetq config))
-   :hornetq.udp/discovery-timeout (:discovery-timeout (:hornetq config))
-   :zookeeper/address (:address (:zookeeper config))
-   :onyx/id id
-   :onyx.peer/inbox-capacity (:inbox-capacity (:peer config))
-   :onyx.peer/outbox-capacity (:outbox-capacity (:peer config))
-   :onyx.peer/job-scheduler scheduler})
-
-(def hq-config {"host" (:host (:non-clustered (:hornetq config)))
-                "port" (:port (:non-clustered (:hornetq config)))})
-
-(defn my-inc [{:keys [n] :as segment}]
-  (assoc segment :n (inc n)))
-
-(def workflow {:in {:inc :out}})
-
-(defn run-job [in-queue out-queue n-messages batch-size echo]
-  (let [env (onyx.api/start-env env-config)
-        id (str (java.util.UUID/randomUUID))
-        catalog
-        [{:onyx/name :in
-          :onyx/ident :hornetq/read-segments
-          :onyx/type :input
-          :onyx/medium :hornetq
-          :onyx/consumption :sequential
-          :hornetq/queue-name in-queue
-          :hornetq/host (:host (:non-clustered (:hornetq config)))
-          :hornetq/port (:port (:non-clustered (:hornetq config)))
-          :onyx/batch-size batch-size}
-
-         {:onyx/name :inc
-          :onyx/fn :onyx.peer.sequential-test/my-inc
-          :onyx/type :function
-          :onyx/consumption :sequential
-          :onyx/batch-size batch-size}
-
-         {:onyx/name :out
-          :onyx/ident :hornetq/write-segments
-          :onyx/type :output
-          :onyx/medium :hornetq
-          :onyx/consumption :sequential
-          :hornetq/queue-name out-queue
-          :hornetq/host (:host (:non-clustered (:hornetq config)))
-          :hornetq/port (:port (:non-clustered (:hornetq config)))
-          :onyx/batch-size batch-size}]
-        v-peers (onyx.api/start-peers! 1 peer-config)]
-
-    (hq-util/create-queue! hq-config in-queue)
-    (hq-util/create-queue! hq-config out-queue)
-
-    (hq-util/write-and-cap! hq-config in-queue (map (fn [x] {:n x}) (range n-messages)) echo)
-    (onyx.api/submit-job peer-config {:catalog catalog :workflow workflow
-                                      :task-scheduler :onyx.task-scheduler/round-robin})
-
-    (let [results (hq-util/consume-queue! hq-config out-queue echo)]
-      (doseq [v-peer v-peers]
-        (onyx.api/shutdown-peer v-peer))
-
-      (onyx.api/shutdown-env env)
-
-      (fact results => (conj (vec (map (fn [x] {:n (inc x)}) (range n-messages))) :done)))))
-
-(run-job (str (java.util.UUID/randomUUID)) (str (java.util.UUID/randomUUID)) 10 1 1)
-(run-job (str (java.util.UUID/randomUUID)) (str (java.util.UUID/randomUUID)) 100 10 10)
-(run-job (str (java.util.UUID/randomUUID)) (str (java.util.UUID/randomUUID)) 1000 100 100)
-(run-job (str (java.util.UUID/randomUUID)) (str (java.util.UUID/randomUUID)) 15000 1320 1000)
-


Adding UMM JSON to the list of format types that can be saved in Metadata DB

--- metadata-db-app/src/cmr/metadata_db/data/oracle/concepts.clj
+++ metadata-db-app/src/cmr/metadata_db/data/oracle/concepts.clj
@@ -37,7 +37,8 @@
    mt/dif      "DIF"
    mt/dif10    "DIF10"
    mt/edn      "EDN"
-   mt/serf     "SERF"})
+   mt/serf     "SERF"
+   mt/umm-json "UMM_JSON"})

 (def db-format->mime-type
   "A mapping of the format strings stored in the database to the equivalent mime type in concepts"


work in progress

work in progress

--- modules/bootstrap/src/modular/bootstrap/cylon/user_forms.clj
+++ modules/bootstrap/src/modular/bootstrap/cylon/user_forms.clj
@@ -7,7 +7,7 @@
    [modular.bootstrap :refer (ContentBoilerplate wrap-content-in-boilerplate)]
    [modular.bidi :refer (path-for)]
    [cylon.impl.authentication :refer (LoginFormRenderer)]
-   [cylon.signup.protocols :refer (SignupFormRenderer EmailVerifiedRenderer ResetPasswordRenderer WelcomeRenderer)]
+   [cylon.signup.protocols :refer (SignupFormRenderer SimpleMessageRenderer RequestResetPasswordFormRenderer WelcomeRenderer)]
    [cylon.totp :as totp]
    [hiccup.core :refer (html h)]
    [garden.core :refer (css)]
@@ -43,7 +43,10 @@
     (wrap-content-in-boilerplate bp req content)
     content))

-(defrecord BootstrapUserFormRenderer [login-prompt signup-prompt reset-pw-prompt totp-appname]
+(defrecord BootstrapUserFormRenderer [login-prompt
+                                      signup-prompt
+                                      reset-password-request-prompt
+                                      totp-appname]
   LoginFormRenderer
   (render-login-form
     [this req model]
@@ -149,25 +152,23 @@
          [:pre (h (pr-str model))]]
         (when (:redirection-uri model) [:p "Now proceed to " [:a {:href (:redirection-uri model)} "continue"]])]])))

-  EmailVerifiedRenderer
-  (render-email-verified [this req model]
+  SimpleMessageRenderer
+  (render-simple-message [this req model]
     (boilerplate
      this req
      (html
       [:div.row {:style "padding-top: 50px"}
        [:div.col-md-2]
        [:div.col-md-10
-        [:h2  (:header model)]]]
+        [:h2 (:header model)]]]
       [:div.row
        [:div.col-md-2]
        [:div.col-md-10
         [:style (styles)]
-        (:message model)]
-       ]))
-    )
-
-  ResetPasswordRenderer
-  (render-reset-password [this req model]
+        (:message model)]])))
+
+  RequestResetPasswordFormRenderer
+  (render-request-reset-password-form [this req model]
     (boilerplate
      this req
      (html
@@ -178,7 +179,7 @@
                            :style "border: 1px dotted #555"
                            :action (-> model :form :action)}

-        [:h2.form-signin-heading reset-pw-prompt]
+        [:h2.form-signin-heading reset-password-request-prompt]
         (when (-> model :reset-status)
             [:div.alert.alert-warning.alert-dismissable
              [:button.close {:type "button" :data-dismiss "alert" :aria-hidden "true"} "×"]
@@ -212,7 +213,7 @@
    (->> opts
         (merge {:login-prompt "Please sign in&#8230"
                 :signup-prompt "Please sign up&#8230"
-                :reset-pw-prompt "Reset your password&#8230"
+                :reset-password-request-prompt "Reset your password&#8230"
                 :totp-appname "cylon"})
         (s/validate new-bootstrap-user-form-renderer-schema)
         map->BootstrapUserFormRenderer)


Convert maze-sidewinder to a lazy sequence generator.

--- src/snergly/algorithms.cljc
+++ src/snergly/algorithms.cljc
@@ -74,22 +74,19 @@
                    (g/link-cells grid cell (:east cell)))]
     [new-grid (if end-run? [] run)]))

-(s/defn maze-sidewinder
-  ([grid :- g/Grid] (maze-sidewinder grid nil))
-  ([grid :- g/Grid result-chan]
-    (go-loop [grid (assoc grid :algorithm-name "sidewinder")
-              [coord & coords] (g/grid-coords grid)
-              current-run [coord]]
-             (when (and result-chan (g/changed? grid))
-               (async/>! result-chan grid))
-      (let [[new-grid processed-run] (sidewinder-step (g/begin-step grid) coord current-run)]
-        (if (empty? coords)
-          (do
-            (when result-chan (async/close! result-chan))
-            new-grid)
-          (recur new-grid
-                 coords
-                 (conj processed-run (first coords))))))))
+;; I really should have the single-arity function as just maze-sidewinder,
+;; and then the others as maze-sidewinder*
+(defn seq-sidewinder
+  ([grid]
+   (lazy-seq (cons grid (seq-sidewinder (assoc grid :changed-cells #{}) (g/grid-coords grid)))))
+  ([grid coords]
+   (seq-sidewinder grid coords [(first coords)]))
+  ([grid [coord & coords] current-run]
+   (when-not (nil? coord)
+     (let [[new-grid processed-run] (sidewinder-step grid coord current-run)]
+       (lazy-seq (cons new-grid (seq-sidewinder (g/begin-step new-grid) coords (conj processed-run (first coords))
+         )
+       ))))))

 (s/defn maze-aldous-broder
   ([grid :- g/Grid] (maze-aldous-broder grid nil))
@@ -321,7 +318,8 @@
 ;; I have to have a map.
 (def algorithm-functions
   {"binary-tree" (async-from-seq seq-binary-tree)
-   "sidewinder" maze-sidewinder
+   ;"sidewinder" maze-sidewinder
+   "sidewinder" (async-from-seq seq-sidewinder)
    "aldous-broder" maze-aldous-broder
    "wilsons" maze-wilsons
    "hunt-and-kill" maze-hunt-and-kill