behave normally when there is a selection

--- src/lt/plugins/auto_paren.cljs
+++ src/lt/plugins/auto_paren.cljs
@@ -69,12 +69,14 @@
 (behavior ::try-remove-pair
           :triggers #{:backspace!}
           :reaction (fn [this]
-                      (let [ch (get-char this -1)]
-                        (if (and (pairs ch)
-                                 (= (get-char this 1) (pairs ch)))
-                          (let [loc (editor/->cursor this)]
-                            (editor/replace this (adjust-loc loc -1) (adjust-loc loc 1) ""))
-                          (passthrough)))))
+                      (if-not (editor/selection? this)
+                        (let [ch (get-char this -1)]
+                          (if (and (pairs ch)
+                                   (= (get-char this 1) (pairs ch)))
+                            (let [loc (editor/->cursor this)]
+                              (editor/replace this (adjust-loc loc -1) (adjust-loc loc 1) ""))
+                            (passthrough)))
+                        (passthrough))))

 (cmd/command {:command :editor.close-pair


Modify roles migration to make me an admin.

--- src/cadence/migrations.clj
+++ src/cadence/migrations.clj
@@ -5,7 +5,7 @@
                     [operators :refer :all]))
   (:import (org.bson.types ObjectId)))

-(defn str-id
+(defn- str-id
   "Helper function for generating an id when adding migrations."
   [] (str (ObjectId.)))

@@ -13,5 +13,6 @@

 (defmigration "Add roles to users"
   "5108749844ae8febda9c2ed4"
-  (mc/update "users" {} {$set {:roles [:user]}} :multi true)
+  (do (mc/update "users" {} {$set {:roles [:user]}} :multi true)
+      (mc/update "users" {:username "RyanMcG"} {$push {:roles :admin}}))
   (mc/update "users" {} {$unset {:roles ""}} :multi true))


Add buttons to move to older/newer issues

--- src/catalog/web/layout.clj
+++ src/catalog/web/layout.clj
@@ -1,6 +1,7 @@
 (ns catalog.web.layout
   "Define the basic page structure and layout"
-  (:require [cemerick.friend :as friend]
+  (:require [catalog.issue :as issue]
+            [cemerick.friend :as friend]
             [hiccup.page :refer [html5 include-css include-js]]))

 (defn glyphicon
@@ -56,7 +57,7 @@
       [:span.icon-bar]
       [:span.icon-bar]
       [:span.icon-bar]]
-     [:a.navbar-brand {:href (format "/%s/%s" year issue)} "Catalog"]]
+     [:a.navbar-brand {:href (format "/%s/%s" year issue)} (format "Catalog %s/%s" year issue)]]
     [:div.collapse.navbar-collapse
      {:id "navbar-collapse-target"}
      [:ul.nav.navbar-nav
@@ -66,7 +67,21 @@
                                    [(format "/%s/%s/editorial/braille" year issue) "Braille"]
                                    [(format "/%s/%s/editorial/hörbuch" year issue) "Hörbuch"]])
       (menu-item (format "/%s/%s/full-catalogs" year issue) "Full Catalogs")
-      (menu-item (format "/custom") "Custom Catalogs")]]]])
+      (menu-item (format "/custom") "Custom Catalogs")]
+
+     [:ul.nav.navbar-nav.navbar-right
+      [:li
+       [:div.btn-group {:role "group"}
+        (let [[year issue] (issue/prev-issue year issue)]
+          [:a.btn.btn-default.navbar-btn
+           {:href (format "/%s/%s" year issue) :role "button"}
+           (glyphicon "step-backward" "Older")])
+        [:a.btn.btn-default.navbar-btn
+         {:href "/" :role "button"} (glyphicon "refresh" "Current")]
+        (let [[year issue] (issue/next-issue year issue)]
+          [:a.btn.btn-default.navbar-btn
+           {:href (format "/%s/%s" year issue) :role "button"}
+           (glyphicon "step-forward" "Newer")])]]]]]])

 (defn common
   "Display a page using the bootstrap css"


Fix promesa.protocols require

Fix promesa.protocols require

--- src/cats/labs/promise.cljc
+++ src/cats/labs/promise.cljc
@@ -4,7 +4,7 @@
             [cats.context :as mc]
             [cats.protocols :as mp]
             [promesa.core :as p]
-            [promesa.impl.proto :as pp])
+            [promesa.protocols :as pp])
   #?(:clj
      (:import java.util.concurrent.CompletableFuture)))


More grouper test.

More grouper test.

--- src/cbfg/grouper-test.cljs
+++ src/cbfg/grouper-test.cljs
@@ -48,7 +48,37 @@
                     (e n
                        (atake tg (:take-all-ch g))
                        {:a :A :b :B}
-                       nil)))
+                       nil))
+                  (let [r (ago full-test0 tg
+                               (aput full-test0 (:put-ch g) [:a (fn [_] :A)])
+                               (aput full-test0 (:put-ch g) [:b (fn [_] :B)])
+                               :full-test0)]
+                    (e n
+                       (atake tg r)
+                       :full-test0
+                       (atake tg r)))
+                  (let [puts-started-ch (achan tg)
+                        r (ago full-test1 tg
+                               (aclose full-test1 puts-started-ch)
+                               (aput full-test1 (:put-ch g) [:c (fn [_] :C)])
+                               (aput full-test1 (:put-ch g) [:d (fn [_] :D)])
+                               :full-test1)]
+                    (and (e n
+                            (atake tg puts-started-ch)
+                            nil
+                            nil)
+                         (e n
+                            (atake tg (:take-all-ch g))
+                            {:a :A :b :B}
+                            nil)
+                         (e n
+                            (atake tg r)
+                            :full-test1
+                            (atake tg r))
+                         (e n
+                            (atake tg (:take-all-ch g))
+                            {:c :C :d :D}
+                            nil))))
            "pass"
            (str "FAIL: on test-grouper #" @n)))))


update wagon and clojure

update wagon and clojure


Distilling up to a high degree of purity the code for 3.1.1 assumption 6

--- EkekoAspectJ/src/damp/ekeko/aspectj/assumptions.clj
+++ EkekoAspectJ/src/damp/ekeko/aspectj/assumptions.clj
@@ -168,20 +168,24 @@
                               ; (reads-field ?unit ?field)
                                ))))

-(comment
-;; to test -- waiting for Coen to bugfix
+
+;; does not work due to issue #6
 ;; code is in AJ-LMP-RefineUsedPointcut
 ;;paper 3.1.1 assumption 6
 (defn
   refine-used-pointcut-sub-super-pointcut
-  [?subaspect ?superaspect ?pointcut]
-  (l/fresh [?newpointcut ?advice]
-    (pointcutdefinition-concretizedby ?pointcut ?newpointcut)
-    (advice-pointcut ?advice ?pointcut)
-    (aspect-advice ?advice ?superaspect)
-    (aspect-declaredsuperaspect+ ?subaspect ?superaspect) ;;better than !=
-    (aspect-pointcutdefinition ?subaspect ?newpointcut)))
-)
+  [?subaspect ?superaspect ?pointcutdef]
+  (l/fresh [?newpointcutdef ?advice]
+    (pointcutdefinition-concretizedby ?pointcutdef ?newpointcutdef)
+    (advice-pointcutdefinition ?advice ?pointcutdef)))
+ ;these are superfluous because
+ ; - advice may not be present in a third aspect outside of hierarchy due to public pointcut: needs to refer to concrete pc
+ ; - advice may be present in an intermediate sub-aspect->no problem
+ ; - advice may not be present in the new pointcut defining aspect -> matches with ?newpointcutdef
+ ;   (aspect-advice ?advice ?superaspect)
+ ;   (aspect-declaredsuperaspect+ ?subaspect ?superaspect) ;;better than !=
+ ;   (aspect-pointcutdefinition ?subaspect ?newpointcutdef)
+

 (comment


fix repo id

fix repo id

--- src/ci3/repo/bitbucket.clj
+++ src/ci3/repo/bitbucket.clj
@@ -130,10 +130,8 @@
      :apiVersion "ci3.io/v1"
      :metadata {:name  build-name}
      :hashcommit hashcommit
-     :repository {:url (:url repository)
-                  :fullName (:fullName repository)}
+     :repository (get-in repository [:metadata :name])
      :diff diff
-     :repository-id (get-in repository [:metadata :name])
      :commit (select-keys commit
                           [:id :message :timestamp
                            :url :author ]) }))


Data updates

Data updates

--- src/main/clojure/dojo/data.clj
+++ src/main/clojure/dojo/data.clj
@@ -17,8 +17,13 @@
 ;; Map of column names to column numbers
 (def COL-NUMS (zipmap HEADINGS (range)))

-;; Collect the list  of all teams
-(def TEAMS (vec (sort (into #{} (slice RESULTS 1 (COL-NUMS "HomeTeam"))))))
+;; Collect the list  of all teams (sorted alphabetically)
+(def TEAMS
+  (-> RESULTS
+    (get-column (COL-NUMS "HomeTeam"))
+    distinct
+    sort
+    vec))

 ;; check we have the right number of total teams - there should be 20!
 (count TEAMS)


fix hanging param from merge

fix hanging param from merge

--- src/clj_kafka/producer.clj
+++ src/clj_kafka/producer.clj
@@ -28,7 +28,7 @@

 (defn send-message
   [^Producer producer ^String topic value]
-  (.send producer ^KeyedMessage (keyed-message topic (message-payload value)))))
+  (.send producer ^KeyedMessage (keyed-message topic (message-payload value))))

 (defn brokers
   "Get brokers from zookeeper"


Test for true passed to devtools args

Test for true passed to devtools args

--- src/cljc/precept/core.cljc
+++ src/cljc/precept/core.cljc
@@ -371,7 +371,7 @@

 (defn start-with-devtools!
   [{:keys [session facts devtools] :as options}]
-  (let [devtools-options (if (boolean? devtools)
+  (let [devtools-options (if (true? devtools)
                            default-devtools-options
                            (merge default-devtools-options devtools))]
     (connect-devtools-socket! devtools-options


Throw error on one-to-many violation

Throw error on one-to-many violation

--- src/cljc/precept/util.cljc
+++ src/cljc/precept/util.cljc
@@ -98,9 +98,14 @@
   [m]
   (reduce
     (fn [acc [k v]]
-      (if ((@state/ancestors-fn k) :one-to-many)
-        (concat acc (map #(->Tuple (:db/id m) k % (next-fact-id!)) v))
-        (conj acc (->Tuple (:db/id m) k v (next-fact-id!)))))
+      (let [one-to-many? ((@state/ancestors-fn k) :one-to-many)]
+        (when (and one-to-many? (not (coll? v)))
+          (throw (ex-info (str "Attribute " k "is marked :one-to-many but we received an entity map
+          where its value is " v ". One to many attributes in entity maps must be collections.")
+                   {:attribute k :value v :schema-entry (@state/ancestors-fn k)})))
+        (if one-to-many?
+          (concat acc (map #(->Tuple (:db/id m) k % (next-fact-id!)) v))
+          (conj acc (->Tuple (:db/id m) k v (next-fact-id!))))))
     []
     (dissoc m :db/id)))


only allow next values between 0 and 100, fixes #5

--- src/cljs/inspect/core.cljs
+++ src/cljs/inspect/core.cljs
@@ -51,7 +51,8 @@
    [:input {:type "number"
             :value (:next-n @appstate/app)
             :on-change #(let [value (js/parseInt (-> % .-target .-value))]
-                          (when-not (or (js/isNaN value) (neg? value)) (swap! appstate/app assoc :next-n value)))}]])
+                          (when-not (or (js/isNaN value) (neg? value) (> value 100))
+                            (swap! appstate/app assoc :next-n value)))}]])

 (defn subscribed-selected
   "creates table with the current subscriptions"


compute merge and branch links

compute merge and branch links

--- src/cljs/signet/graph.cljs
+++ src/cljs/signet/graph.cljs
@@ -130,7 +130,11 @@
       (if (empty? x-order)
         (assoc icg
           :nodes (apply concat (vals (:nodes icg)))
-          :links (remove #(-> % second nil?) (apply concat (vals (:links icg))))
+          :links (remove
+                  #(or (nil? %) (-> % second nil?))
+                  (concat (apply concat (vals (:links icg)))
+                          (vals (:branch-links icg))
+                          (vals (:merge-links icg))))
           :x-positions x-positions
           :y-positions (let [m (count (:y-order icg))
                              dy (/ (- h (* 2 cs)) m )]


link click changes app state via comms

link click changes app state via comms

--- src/cljs/unfolds/core.cljs
+++ src/cljs/unfolds/core.cljs
@@ -124,8 +124,14 @@
 (defn event-loop [app event-chan]
   (go
     (while true
-      (let [foo (alts! [comm-alt event-chan])]
-      (. js/console (log "chan: ") (pr-str foo))))))
+      (let [[{:keys [tag value]} _] (alts! [comm-alt event-chan])]
+        (. js/console (log "tag: " (pr-str tag)))
+        (. js/console (log "value: " (pr-str value)))
+
+        ;; TODO: Generalize.
+        (om/transact! app :hidden #(assoc % :item false))
+        (om/transact! app :current-item (fn [_] (:id value)))))))
+

 (defn app-view [app owner]
   (reify
@@ -137,7 +143,7 @@
       (let [event-chan (om/get-state owner [:chans :event-chan])]
         (event-loop app event-chan)))
     om/IRenderState
-    (render-state [this {:keys [chan] :as state}] ;; syntax?
+    (render-state [this {:keys [chan] :as state}]
       (dom/div nil
                #_(dom/h1 nil (str (:text app) " " (:count state)))
                (dom/a #js {:href "#/notes/1"} "1")
@@ -161,11 +167,9 @@
                                     (filter (fn [[i _]] (in? (:visible app) i))
                                             (:items app))))))))

-;; TODO: Put action on channel and then do something there
 (defroute "/notes/:id" {:as params}
-  #_(om/transact! @app-state :hidden #(assoc % :item false))
-  #_(om/transact! @app-state :current-item (fn [_] (:id params)))
-  (js/console.log (str "Viewing item: " (:id params))))
+  (put! comm-alt {:tag :notes
+                  :value {:id (:id params)}}))

 (defn main []
   (om/root app-view


Allow mobile flak to also be built at a :base -First example of unit that can be built at more than one type of base

--- src/cljs/zetawar/data.cljs
+++ src/cljs/zetawar/data.cljs
@@ -420,7 +420,7 @@
                    :armor 8
                    :repair 1
                    :state-map :move-attack
-                   :buildable-at #{:airfield}
+                   :buildable-at #{:base :airfield}
                    :image "tilesets/elite-command/units/mobileflak-COLOR.png"
                    :terrain-effects
                    {:plains   {:movement-cost 3 :armor-bonus  0 :attack-bonus  0}


check jsdoc for constructor for ExceptionInfo to be a type (close #73)

--- src/cljs_api_gen/parse.clj
+++ src/cljs_api_gen/parse.clj
@@ -131,13 +131,14 @@
                         {:whole form
                          :head (take 2 form)
                          :doc doc-forms
-                         :sig-body args})]
+                         :sig-body args})
+        constructor? (some #{"@constructor"} (:jsdoc meta-))]
     (when (or *parse-private-defs?*
               (not private?))
       {:expected-docs expected-docs
        :docstring (fix-docstring docstring)
        :signature signatures
-       :type type-})))
+       :type (if constructor? "type" type-)})))

 (defn parse-def-fn
   [form]


add and change some rdd stuff

add and change some rdd stuff

--- src/clojure/flambo/api.clj
+++ src/clojure/flambo/api.clj
@@ -144,11 +144,6 @@
   ([rdd]
    (.name rdd)))

-(defn union
-  "Build the union of two or more RDDs"
-  [context rdd & rdds]
-  (.union context rdd (ArrayList. rdds)))
-
 (defn partitionwise-sampled-rdd [rdd sampler preserve-partitioning? seed]
   "Creates a PartitionwiseSampledRRD from existing RDD and a sampler object"
   (-> (PartitionwiseSampledRDD.
@@ -233,6 +228,11 @@
   [rdd f]
   (.filter rdd (function (ftruthy? f))))

+(defn union
+  "Union `rdd` and `other`. duplicate keys are kept."
+  [context rdd & rdds]
+  (.union rdd other))
+
 (defn foreach
   "Applies the function `f` to all elements of `rdd`."
   [rdd f]
@@ -254,6 +254,11 @@
   using a given associative function and a neutral 'zero value'"
   [rdd zero-value f]
   (.fold rdd zero-value (function2 f)))
+
+(defn subtract
+  "returns an `rdd` with elements from `other` removed."
+  [rdd other]
+  (.subtract rdd other))

 (defn reduce-by-key
   "When called on an `rdd` of (K, V) pairs, returns an RDD of (K, V) pairs
@@ -422,6 +427,10 @@
   [rdd storage-level]
   (.persist rdd storage-level))

+(defn unpersist
+  [rdd]
+  (.unpersist rdd))
+
 (def first
   "Returns the first element of `rdd`."
   (memfn first))


GAWB-1252 change snapshot input data error (#580)

* GAWB-1252 change snapshot date error

* Suggestion (#582)

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/method_configs/method_config_editor.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/method_configs/method_config_editor.cljs
@@ -15,7 +15,6 @@
     [org.broadinstitute.firecloud-ui.utils :as utils]
     [org.broadinstitute.firecloud-ui.config :as gconfig]
     ))
-

 (defn- filter-empty [list]
   (vec (remove blank? (map trim list))))
@@ -144,37 +143,37 @@
                                 :onClick #(stop-editing state)}])]))])

-(defn- input-output-list [config value-type invalid-values editing? all-values]
+(defn- input-output-list [values ref-prefix invalid-values editing? all-values]
   (create-section
-    [:div {}
-     (map
-       (fn [m]
-         (let [[field-name inputType outputType optional?] (map m ["name" "inputType" "outputType" "optional"])
-               type (or inputType outputType)
-               field-value (get (config value-type) field-name)
-               error (invalid-values field-name)]
-           [:div {}
-            [:div {:style {:display "flex" :alignItems "baseline" :marginBottom "0.5em"}}
-             [:div {:style {:marginRight "1em" :padding "0.5em"
-                            :backgroundColor (:background-light style/colors)
-                            :border style/standard-line :borderRadius 2}}
-              (str field-name ": (" (when optional? "optional ") type ")")]
-             (when editing?
-               (style/create-text-field {:ref (str (if (= value-type "inputs") "in" "out") "_" field-name)
-                                         :defaultValue field-value}))
-             (when-not editing?
-               (or field-value [:span {:style {:fontStyle "italic"}} "No value entered"]))
-             (when (and error (not editing?))
-               (icons/icon {:style {:margin "0 0 0 0.7em" :alignSelf "center"
-                                    :color (:exception-state style/colors)}}
-                           :error))]
-            (when error
-              [:div {:style {:padding "0.5em" :marginBottom "0.5em"
-                             :backgroundColor (:exception-state style/colors)
-                             :display "inline-block"
-                             :border style/standard-line :borderRadius 2}}
-               error])]))
-       all-values)]))
+   [:div {}
+    (map
+     (fn [m]
+       (let [[field-name inputType outputType optional?] (map m ["name" "inputType" "outputType" "optional"])
+             type (or inputType outputType)
+             field-value (get values field-name "")
+             error (invalid-values field-name)]
+         [:div {:key field-name}
+          [:div {:style {:display "flex" :alignItems "baseline" :marginBottom "0.5em"}}
+           [:div {:style {:marginRight "1em" :padding "0.5em"
+                          :backgroundColor (:background-light style/colors)
+                          :border style/standard-line :borderRadius 2}}
+            (str field-name ": (" (when optional? "optional ") type ")")]
+           (when editing?
+             (style/create-text-field {:ref (str ref-prefix "_" field-name)
+                                       :defaultValue field-value}))
+           (when-not editing?
+             (or field-value [:span {:style {:fontStyle "italic"}} "No value entered"]))
+           (when (and error (not editing?))
+             (icons/icon {:style {:margin "0 0 0 0.7em" :alignSelf "center"
+                                  :color (:exception-state style/colors)}}
+                         :error))]
+          (when error
+            [:div {:style {:padding "0.5em" :marginBottom "0.5em"
+                           :backgroundColor (:exception-state style/colors)
+                           :display "inline-block"
+                           :border style/standard-line :borderRadius 2}}
+             error])]))
+     all-values)]))

 (defn- render-main-display [this wrapped-config editing? inputs-outputs methods]
   (let [config (get-in wrapped-config ["methodConfiguration"])
@@ -206,9 +205,10 @@
                                        root-entity-types)
          [:div {:style {:padding "0.5em 0 1em 0"}} (config "rootEntityType")]))
      (create-section-header "Inputs")
-     (input-output-list config "inputs" invalid-inputs editing? (inputs-outputs "inputs"))
+     (input-output-list (config "inputs") "in" invalid-inputs editing? (inputs-outputs "inputs"))
      (create-section-header "Outputs")
-     (input-output-list config "outputs" invalid-outputs editing? (inputs-outputs "outputs"))]))
+     (input-output-list
+      (config "outputs") "out" invalid-outputs editing? (inputs-outputs "outputs"))]))

 (defn- render-display [this state refs props]
   (let [wrapped-config (:loaded-config @state)


id for info-outer div

id for info-outer div

--- src/wishlistd/cljs/main.cljs
+++ src/wishlistd/cljs/main.cljs
@@ -43,11 +43,11 @@
           you wish for!"]]])

 (defpartial info-box []
-  [:div
+  [:div#info-outer
    [:div#info-box
     [:div#info-close]
-    [:div#info-text [:p "Wishlisted.org gives you a single place for all your wishlists, no signup required. Simply create a wishlist and add some wishes and optionally URLs. You will be automatically assigned your own unique URL that you can use to return to your wishlist at any time. Anyone else with the link will also be able to view and update it."]
-                    [:p "The site was built using a combination of open source technologies by Erik Kronberg and Stina Qvarnström."]]]
+    [:div#info-text [:p "Wishlisted.org gives you a single place for all your wishlists, no signup required. Simply create a wishlist and add some wishes and optionally URLs. You will be automatically assigned your own unique URL and you can use this to return to your wishlist at any time. Anyone else with the link will also be able to view and update it."]
+                    [:p "The site was built using a combination of open source technologies by " [:a {:href "http://variadic.me"} "Erik Kronberg"] " and " [:a {:href "http://stinaq.se"} "Stina Qvarnström"] "."]]]
    [:div#info-container]])

 ; GETTING AND SETTING


Typos

Typos

--- src/wishlistd/cljs/main.cljs
+++ src/wishlistd/cljs/main.cljs
@@ -38,8 +38,8 @@
 (defpartial arrow []
   [:div#startinfo-container
    [:div#startinfo-text
-    [:p "Create your wishlist by clicking the icon above. Add wished and url to the page. Save the unique link in your
-          browsers address field to visit and update the wishlist. Share it with your friends so that they can get you all the things
+    [:p "Create your wishlist by clicking the icon above. Add wishes and URLs to your wishlist. Save the unique link in your
+          browser address field to return to and update the wishlist. Share it with your friends so that they can get you all the things
           you wish for!"]]])

 (defpartial info-box []


updating hface client / chazel versions

updating hface client / chazel versions

--- dash/project.clj
+++ dash/project.clj
@@ -9,9 +9,9 @@
   :jvm-opts ["-Dconf=./resources/conf/hface.conf"]

   :dependencies [[org.clojure/clojure "1.6.0"]
-                 [chazel "0.1.2-SNAPSHOT"]
+                 [chazel "0.1.5"]
                  [cprop "0.1.0"]
-                 [com.gitpod/hface-client "0.1.0"]
+                 [org.hface/hface-client "0.1.1"]
                  [com.facebook/react "0.11.2"]
                  [reagent "0.4.3"]
                  [reagent-utils "0.1.0"]


increased sleep time to 10 seconds when sending result, travis is being really slow

--- test/lcmap/clownfish/specifications_test.clj
+++ test/lcmap/clownfish/specifications_test.clj
@@ -221,7 +221,7 @@
                     {:content-type "application/json" :persistent true})
         ;; sleep this for just a bit so the server has time to consume and
         ;; persist the message we just sent.
-        (Thread/sleep 5)))
+        (Thread/sleep 10)))

     (testing "retrieve algorithm results once available"
       (let [body     {:algorithm "test-alg" :x 123 :y 456}


add link to user dashboard

add link to user dashboard

--- src-cljs/frontend/components/admin.cljs
+++ src-cljs/frontend/components/admin.cljs
@@ -233,7 +233,7 @@
                                         (not= "read-settings" scope) (remove #{"read-settings"}))]
           (html
             [:tr
-             [:td (:login user)]
+             [:td [:a {:href (routes/v1-dashboard-path {:vcs_type "github" :org (:login user) })} (:login user)]]
              [:td (:name user)]
              [:td
               [:div.form-inline


use relative paths in :node-script dev builds

otherwise a script built on windows won't run in WSL

--- src/main/shadow/build/node.clj
+++ src/main/shadow/build/node.clj
@@ -109,17 +109,26 @@
       (let [{:keys [prepend append sources]}
             (first build-modules)

-            abs-path
+            output-dir-path
             (-> (data/output-file state cljs-runtime-path)
-                (.getAbsolutePath)
+                (.getAbsoluteFile)
+                (.toPath))
+
+            output-to-path
+            (-> output-to
+                (.getAbsoluteFile)
+                (.getParentFile)
+                (.toPath))
+
+            rel-path
+            (-> (.relativize output-to-path output-dir-path)
                 (rc/normalize-name))

             out
             (str/join "\n"
               [prepend

-               ;; this is here and not in boostrap since defines already accesses them
-               (str "var SHADOW_IMPORT_PATH = " (pr-str abs-path) ";")
+               (str "var SHADOW_IMPORT_PATH = __dirname + '/" rel-path "';")

                "global.$CLJS = global;"


core: when-some

core: when-some


formatting

formatting

--- build.boot
+++ build.boot
@@ -8,10 +8,10 @@
                     [pandeiro/boot-http        "0.7.0"]])

 (require
- '[adzerk.boot-cljs      :refer [cljs]]
- '[adzerk.boot-reload    :refer [reload]]
- '[deraen.boot-less      :refer [less]]
- '[pandeiro.boot-http    :refer [serve]])
+ '[adzerk.boot-cljs   :refer [cljs]]
+ '[adzerk.boot-reload :refer [reload]]
+ '[deraen.boot-less   :refer [less]]
+ '[pandeiro.boot-http :refer [serve]])

 (deftask dev []
   (comp


configuring heroku

configuring heroku

--- build.boot
+++ build.boot
@@ -45,8 +45,7 @@
         (sitemap :filename "sitemap.xml")
         (rss :title "Hashobject" :description "Hashobject blog" :link "http://blog.hashobject.com")
         (gzip :regex [#".html$" #".css$" #".js$"])
-        ;(s3-sync)
-        ))
+        (s3-sync)))

 (deftask dev
   []


Fix format-commands #9

Fix format-commands #9

--- build.boot
+++ build.boot
@@ -156,7 +156,9 @@
         (compile-cljs :id "node/index")
         (target)
         (with-pass-thru _
-          (run-commands ["cd" "target/node"] ["node" "index.js"]))))))
+          (util/dosh "sh" "-c" "'cd target ; ls -l'"))))))
+        ;(with-pass-thru _
+        ;  (run-commands ["cd" "target/node"] ["node" "index.js"]))))))

 (deftask autotest
   "Runs the specified tests."


Rename run-tests -> test

Rename run-tests -> test

--- build.boot
+++ build.boot
@@ -82,7 +82,9 @@
     (start-app :port port)
     (if speak (boot.task.built-in/speak) identity)))

-(deftask run-tests
+(ns-unmap *ns* 'test)
+
+(deftask test
   []
   (comp
     (alt-test)
@@ -92,7 +94,7 @@
 (deftask autotest []
   (comp
     (watch)
-    (run-tests)))
+    (test)))

 (deftask package
   "Build the package"


set notify task options

set notify task options

Signed-off-by: Gregg Reynolds <d0f77bc71a9867acdcb4f62f012b858edad79160@norc.org>

--- build.boot
+++ build.boot
@@ -86,6 +86,7 @@
                          :war "target/bulkops"}]})

 (task-options!
+ notify {:audible true :theme "woodblock"}
  gae/run modules
  ;; test {:startup (fn []
  ;;                  (println "XXXXXXXXXXXXXXXX")


AOT compice cli namespace

AOT compice cli namespace

--- build.boot
+++ build.boot
@@ -33,7 +33,7 @@
       :description "GitHub changelog"
       :url "https://github.com/raszi/github-changelog"}
  jar {:main 'github-changelog.cli}
- aot {:all true})
+ aot {:namespace #{'github-changelog.cli}})

 (deftask check-sources
   "Checks source code for possible improvements/simplifications"


Bump replumb

Bump replumb

--- build.boot
+++ build.boot
@@ -21,7 +21,7 @@
                  [org.clojure/core.async      "0.2.374"]
                  [reagent                     "0.5.1"]
                  [re-frame                    "0.5.0"]
-                 [replumb/replumb             "0.1.5-SNAPSHOT"]
+                 [replumb/replumb             "0.1.5-3"]
                  [cljsjs/jqconsole            "2.13.1-0"]
                  [cljsjs/highlight            "8.4-0"]
                  [re-com                      "0.7.0-alpha2"]


[CIRCLE-4194] Navigate to project and branch by URL (#1884)

* Remove unused code

* Do not navigate if org repo & branch provided

--- src-cljs/frontend/controllers/api.cljs
+++ src-cljs/frontend/controllers/api.cljs
@@ -408,14 +408,15 @@
 (defmethod post-api-event! [:organizations :success]
   [target message status args previous-state current-state comms]
   (when (ld/feature-on? "top-bar-ui-v-1")
-    (let [previous-org (get-in previous-state state/selected-org-path)
-          current-org (get-in current-state state/selected-org-path)
-          nav-point (get-in current-state state/current-view-path)]
+    (let [nav-point (get-in current-state state/current-view-path)
+          nav-data-path (get-in current-state state/navigation-data-path)]
       (when (and (= nav-point :dashboard)
-                 (not= previous-org current-org))
+                 (= nil (:org nav-data-path)
+                        (:repo nav-data-path)
+                        (:branch nav-data-path)))
         ;; If org not provided in the url, we need to capture a user's
         ;; default org before we can navigate to it.
-        (put! (:nav comms) [:navigate! {:path (routes/new-org-path {:current-org current-org
+        (put! (:nav comms) [:navigate! {:path (routes/new-org-path {:current-org (get-in current-state state/selected-org-path)
                                                                     :nav-point nav-point})}])))))

 (defmethod api-event [:tokens :success]


renames and `drop` instead of `nthnext` - don't need nil result of nthnext

--- src/midje/ideas/background.clj
+++ src/midje/ideas/background.clj
@@ -85,14 +85,14 @@
       expanded

       is-start-of-checking-arrow-sequence?
-      (let [content (take-arrow-sequence in-progress)]
-        (recur (conj expanded (-> content prerequisite-to-fake tag-as-background-fake))
-          (nthnext in-progress (count content))))
+      (let [arrow-seq (take-arrow-sequence in-progress)]
+        (recur (conj expanded (-> arrow-seq prerequisite-to-fake tag-as-background-fake))
+          (drop (count arrow-seq) in-progress)))

       metaconstant-prerequisite?
-      (let [content (take-arrow-sequence in-progress)]
-        (recur (conj expanded (-> content prerequisite-to-fake))
-          (nthnext in-progress (count content))))
+      (let [arrow-seq (take-arrow-sequence in-progress)]
+        (recur (conj expanded (-> arrow-seq prerequisite-to-fake))
+          (drop (count arrow-seq) in-progress)))

       seq-headed-by-setup-teardown-form?
       (recur (conj expanded (first in-progress))


Generate parser lookup table for up to 0xa0 (everything above isn't used)

--- src/asciinema/vt/parser_macros.clj
+++ src/asciinema/vt/parser_macros.clj
@@ -141,4 +141,4 @@

 (defmacro build-lookup-table []
   (apply merge (for [state (keys states)]
-                 {state (mapv (partial parse* state) (range 256))})))
+                 {state (mapv (partial parse* state) (range 0xa0))})))


aliasing the required libs to a sensible shorthand;

--- src/mustached_hipster/core.clj
+++ src/mustached_hipster/core.clj
@@ -1,8 +1,8 @@
 (ns mustached-hipster.core
    (:require
-      [clj-http.client :as http :only [get]]
-      [clojure.java.io :only [output-stream]]
-      [clojure.string  :only [replace split-lines]])
+      [clj-http.client :as http   :only [get]]
+      [clojure.java.io :as io     :only [output-stream]]
+      [clojure.string  :as string :only [replace split-lines]])
    (:gen-class))

 (defn get-playlist
@@ -12,9 +12,9 @@
       before (System/nanoTime)
       after #(System/nanoTime)
       grab-and-process (comp
-         (partial map #(clojure.string/replace % #"\?.*" "\n"))
+         (partial map #(string/replace % #"\?.*" "\n"))
          (partial filter #(not= \# (first %)))
-         clojure.string/split-lines
+         string/split-lines
          :body
          http/get)]

@@ -32,10 +32,10 @@
    (let [
       before (System/nanoTime)
       after #(System/nanoTime)
-      filename (clojure.string/replace (clojure.string/trim-newline seg-url) #".*/" "")]
+      filename (string/replace (string/trim-newline seg-url) #".*/" "")]

       (with-open
-         [whandle (clojure.java.io/output-stream filename)]
+         [whandle (io/output-stream filename)]

          (.write whandle (:body (http/get seg-url {:as :byte-array})))


document :signature

document :signature

--- src/insn/core.clj
+++ src/insn/core.clj
@@ -54,6 +54,9 @@

     :annotations  map or sequence of tuples, described below.

+    :signature    generic type information - usually only ever needed
+                  for interop with Java libraries (reflection, etc.)
+
     :fields       sequence of field maps, described below.

     :methods      sequence of method maps, described below.
@@ -62,7 +65,8 @@
                   compatibility, a float of major.minor may be given
                   for versions 1.1 through 1.8.

-  Each field and method can also be given :annotations as per above.
+  Each field and method can also be given :annotations and a :signature
+  as per above.

   Some examples:


Completed case and filled in missing gaps

--- src/dactyl_keyboard/dactyl-manuform.clj
+++ src/dactyl_keyboard/dactyl-manuform.clj
@@ -124,43 +124,6 @@
          (rotate (/ π 12) [0 1 0])
          (translate [0 0 13]))))

-(defn case-place [column row shape]
-  (let [row-placed-shape (->> shape
-                              (translate [0 0 (- row-radius)])
-                              (rotate (* α (- 1 row)) [1 0 0])
-                              (translate [0 0 row-radius]))
-        column-offset [0 -4.35 5.64]
-        column-angle (* β (- 3 column))
-        placed-shape (->> row-placed-shape
-                          (translate [0 0 (- column-radius)])
-                          (rotate column-angle [0 1 0])
-                          (translate [0 0 column-radius])
-                          (translate column-offset))]
-    (->> placed-shape
-         (rotate (/ π 12) [0 1 0])
-         (translate [0 0 13]))))
-
-(defn bottom-place [column row shape]
-  (let [row-placed-shape (->> shape
-                              (translate [0 0 (- row-radius)])
-                              (rotate (* α (- 2 row)) [1 0 0])
-                              (translate [0 0 row-radius]))
-        column-offset (cond (< column 1.5) [-1 0 0]
-                       :else [0 0 0])
-        column-row-offset (if (not= column 6) [0 -4.35 4.8]
-                        (if (not= row 4) [-7.25 -5.8 2.1]
-                                         [-7.89 -5.8 3.6]))
-        column-angle (* β (- 2 column))
-        placed-shape (->> row-placed-shape
-                          (translate [0 0 (- column-radius)])
-                          (rotate column-angle [0 1 0])
-                          (translate [0 0 column-radius])
-                          (translate column-row-offset)
-                          (translate column-offset))]
-    (->> placed-shape
-         (rotate (/ π 12) [0 1 0])
-         (translate [0 0 13]))))
-
 (def key-holes
   (apply union
          (for [column columns
@@ -204,10 +167,8 @@
   (apply union
          (concat
           ;; Row connections
-          (for [column (range -1 ncols)
-                row rows
-                :when (or (.contains [2] column)
-                          (not= row lastrow))]
+          (for [column (range 0 (dec ncols))
+                row (range 0 lastrow)]
             (triangle-hulls
              (key-place (inc column) row web-post-tl)
              (key-place column row web-post-tr)
@@ -216,10 +177,7 @@

           ;; Column connections
           (for [column columns
-                row (range -1 lastrow)
-            ;     :when (or (.contains [2 3] column)
-            ;               (not= row 2))
-                          ]
+                row (range 0 cornerrow)]
             (triangle-hulls
              (key-place column row web-post-bl)
              (key-place column row web-post-br)
@@ -227,11 +185,8 @@
              (key-place column (inc row) web-post-tr)))

           ;; Diagonal connections
-          (for [column (range -1 ncols)
-                row (range -1 lastrow)
-            ;     :when (or (.contains [ 1 2 3] column)
-            ;               (not= row 2))
-                          ]
+          (for [column (range 0 (dec ncols))
+                row (range 0 cornerrow)]
             (triangle-hulls
              (key-place column row web-post-br)
              (key-place column (inc row) web-post-tr)
@@ -374,61 +329,39 @@
              (key-place 0 cornerrow web-post-br)
              (thumb-tr-place thumb-post-tl)
              (key-place 1 cornerrow web-post-bl)
+             (thumb-tr-place thumb-post-tr)
              (key-place 1 cornerrow web-post-br)
+             (key-place 2 lastrow web-post-tl)
+             (key-place 2 lastrow web-post-bl)
              (thumb-tr-place thumb-post-tr)
-             (key-place 2 cornerrow web-post-tl)
+             (key-place 2 lastrow web-post-bl)
+             (thumb-tr-place thumb-post-br)
+             (key-place 2 lastrow web-post-br)
+             (key-place 3 lastrow web-post-bl)
+             (key-place 2 lastrow web-post-tr)
+             (key-place 3 lastrow web-post-tl)
+             (key-place 3 cornerrow web-post-bl)
+             (key-place 3 lastrow web-post-tr)
+             (key-place 3 cornerrow web-post-br)
+             (key-place 4 cornerrow web-post-bl))
+      (triangle-hulls
+             (key-place 1 cornerrow web-post-br)
+             (key-place 2 lastrow web-post-tl)
              (key-place 2 cornerrow web-post-bl)
-      )
+             (key-place 2 lastrow web-post-tr)
+             (key-place 2 cornerrow web-post-br)
+             (key-place 3 cornerrow web-post-bl)
+             )
+      (triangle-hulls
+             (key-place 3 lastrow web-post-tr)
+             (key-place 3 lastrow web-post-br)
+             (key-place 3 lastrow web-post-tr)
+             (key-place 4 cornerrow web-post-bl))
   ))

 ;;;;;;;;;;
 ;; Case ;;
 ;;;;;;;;;;
-
-;; In column units
-(def right-wall-column (+ (last columns) 0.1))
-(def left-wall-column (- (first columns) 1/2))
-(def thumb-back-y 0.1)
-(def thumb-case-z 3)
-(def thumb-right-wall (- -1/2 0.05))
-(def thumb-front-row (+ -1 0.07))
-(def thumb-left-wall-column (+ 5/2 0.05))
-(def back-y 0.02)
-
-(defn range-inclusive [start end step]
-  (concat (range start end step) [end]))
-
-(def wall-step 0.2)
-(def wall-sphere-n 20) ;;20 Sphere resolution, lower for faster renders
-
-(defn wall-cube-at [coords]
-  (->> (cube 3 3 3)
-       (translate coords)))
-
-(defn scale-to-range [start end x]
-  (+ start (* (- end start) x)))
-
-(defn wall-cube-bottom [front-to-back-scale]
-  (wall-cube-at [0
-                   (scale-to-range
-                    (+ (/ mount-height -2) -3.5)
-                    (+ (/ mount-height 2) 5.0)
-                    front-to-back-scale)
-                   -6])) ; was -6, then 2
-
-(defn wall-cube-top [front-to-back-scale]
-  (wall-cube-at [0
-                   (scale-to-range
-                    (+ (/ mount-height -2) -3.5)
-                    (+ (/ mount-height 2) 3.5)
-                    front-to-back-scale)
-                   4])) ; case height
-
-(def wall-cube-top-back (wall-cube-top 1))
-(def wall-cube-bottom-back (wall-cube-bottom 1))
-(def wall-cube-bottom-front (wall-cube-bottom 0))
-(def wall-cube-top-front (wall-cube-top 0))
-

 (defn bottom [height p]
   (->> (project p)
@@ -439,202 +372,94 @@
   (hull p (bottom 10.001 p)))

-(def bottom-key-guard (->> (cube mount-width mount-height web-thickness)
-                           (translate [0 0 (+ (- (/ web-thickness 2)) -5)])))
-(def bottom-front-key-guard (->> (cube mount-width (/ mount-height 2) web-thickness)
-                                 (translate [0 (/ mount-height 4) (+ (- (/ web-thickness 2)) -5)])))
-
-(defn stand-at [diameter placement]
-  (let [bumper-radius (/ diameter 2)
-       stand-diameter (+ diameter 2)
-       stand-radius (/ stand-diameter 2)]
-    (difference (->> (sphere stand-radius)
-                     (translate [0 0 (+ (/ stand-radius -2) -4.5)])
-                      placement
-                      bottom-hull)
-                (->> (cube stand-diameter stand-diameter stand-radius)
-                     (translate [0 0 (/ stand-radius -2)])
-                      placement)
-                (->> (sphere bumper-radius)
-                     (translate [0 0 (+ (/ stand-radius -2) -4.5)])
-                      placement
-                     (bottom 1.5)))))
-
-(def outer-case
-  (union
-  ;  (let [shift #(translate [0 0 (+ (+ web-thickness) 0)] %)
-   (let [shift #(scale [1 1 1] %)
-         thumb-ridge-height 1
-         thumb-back-offset -1.28
-         thumb-left-offset 1.13
-         thumb-front-offset 0.56
-         front-offset 0.3
-         left-offset 0.2
-         right-offset -0.23
-         back-offset -0.25
-         web-post-tl border-post-tl
-         web-post-tr border-post-tr
-         web-post-br border-post-br
-         web-post-bl border-post-bl
-         half-shift-correction #(translate [0 (/ mount-height 2) 0] %)
-         half-post-br (half-shift-correction web-post-br)
-         half-post-bl (half-shift-correction web-post-bl)
-         row-connections (concat
-                          (for [column (drop-last columns)
-                                row (drop-last rows)
-                                :when (or (not= column 0)
-                                          (not= row 4))]
-                            (triangle-hulls
-                             (key-place (inc column) row web-post-tl)
-                             (key-place column row web-post-tr)
-                             (key-place (inc column) row web-post-bl)
-                             (key-place column row web-post-br)))
-                          (for [column (drop-last columns)
-                                row [(last rows)]
-                                :when (or (not= column 0)
-                                          (not= row 4))]
-                            (triangle-hulls
-                             (key-place (inc column) row web-post-tl)
-                             (key-place column row web-post-tr)
-                             (key-place (inc column) row half-post-bl)
-                             (key-place column row half-post-br))))
-         column-connections (for [column columns
-                                  row (drop-last rows)
-                                  :when (or (not= column 0)
-                                            (not= row 3))]
-                              (triangle-hulls
-                               (key-place column row web-post-bl)
-                               (key-place column row web-post-br)
-                               (key-place column (inc row) web-post-tl)
-                               (key-place column (inc row) web-post-tr)))
-         diagonal-connections (for [column (drop-last columns)
-                                    row (drop-last rows)
-                                    :when (or (not= column 0)
-                                              (not= row 3))]
-                                (triangle-hulls
-                                 (key-place column row web-post-br)
-                                 (key-place column (inc row) web-post-tr)
-                                 (key-place (inc column) row web-post-bl)
-                                 (key-place (inc column) (inc row) web-post-tl)))
-         main-keys-bottom (concat row-connections
-                                  column-connections
-                                  diagonal-connections)
-         front-wall (concat
-                     (for [x (range 4 6)]
-                      (union
-                       (bottom-hull
-                             (key-place (+ x 1) 2.2 web-post-bl)
-                             (key-place x 2.2 web-post-br))
-                       (bottom-hull
-                             (key-place x 2.2 web-post-bl)
-                             (key-place x 2.2 web-post-br)
-                        ))))
-         right-wall (concat
-                     (for [x (range 1 3)]
-                      (union
-                       (bottom-hull
-                             (key-place 5.2 x web-post-br)
-                             (key-place 5.2 x web-post-tr))
-                       (bottom-hull
-                             (key-place 5.2 x web-post-br)
-                             (key-place 5.2 (dec x) web-post-tr))
-                     )))
-         back-wall (concat
-                    (for [x (range  6)]
-                      (union
-                       (hull
-                             (key-place x -0.2 web-post-tl)
-                             (key-place x -0.2 web-post-tr))
-                       (hull
-                             (key-place x -0.2 web-post-tl)
-                             (key-place (- x 1) -0.2 web-post-tr))
-                      ))
-                    )
-         left-wall (concat
-                     (for [x (range 1 3)]
-                      (union
-                       (bottom-hull
-                             (key-place -1.0 x web-post-br)
-                             (key-place -1.0 x web-post-tr))
-                       (bottom-hull
-                             (key-place -1.0 x web-post-br)
-                             (key-place -1.0 (dec x) web-post-tr))
-                     )))
-         ]
-     (apply union
-            (concat
-             ;main-keys-bottom
-             front-wall
-             right-wall
-             back-wall
-             left-wall
-             ;thumbs
-            ;  thumb-back-wall
-            ;  thumb-left-wall
-            ;  thumb-front-wall
-            ;  thumb-inside
-             ;stands)))))
-             )))))
-
-(def border-web-post (cube post-size post-size web-thickness))
-(def border-post-adj (/ border-post-size 2))
-(def border-post-tr (translate [(- (/ mount-width 2) border-post-adj) (- (/ mount-height 2) border-post-adj) 0] border-web-post))
-(def border-post-tl (translate [(+ (/ mount-width -2) border-post-adj) (- (/ mount-height 2) border-post-adj) 0] border-web-post))
-(def border-post-bl (translate [(+ (/ mount-width -2) border-post-adj) (+ (/ mount-height -2) border-post-adj) 0] border-web-post))
-(def border-post-br (translate [(- (/ mount-width 2) border-post-adj) (+ (/ mount-height -2) border-post-adj) 0] border-web-post))
-
 (def upper-brace-multiplier -4)
-(defn wall-brace [x1 y1 dx1 dy1 post1 x2 y2 dx2 dy2 post2]
+
+(defn wall-brace [place1 dx1 dy1 post1 place2 dx2 dy2 post2]
   (union
     (hull
-      (key-place x1 y1 post1)
-      (key-place x1 y1 (scale [1 1 -3] post1))
-      (key-place x1 y1 (translate [(* dx1 5) (* dy1 5) 0] (scale [1 1 -3] post1)))
-      (key-place x2 y2 post2)
-      (key-place x2 y2 (scale [1 1 -3] post2))
-      (key-place x2 y2 (translate [(* dx2 5) (* dy2 5) 0] (scale [1 1 -3] post2)))
+      (place1 post1)
+      (place1 (scale [1 1 -3] post1))
+      (place1 (translate [(* dx1 5) (* dy1 5) 0] (scale [1 1 -3] post1)))
+      (place2 post2)
+      (place2 (scale [1 1 -3] post2))
+      (place2 (translate [(* dx2 5) (* dy2 5) 0] (scale [1 1 -3] post2)))
       )
     (bottom-hull
-      (key-place x1 y1 (translate [(* dx1 5) (* dy1 5) -15] post1))
-      (key-place x1 y1 (translate [0         0         -15] post1))
-      (key-place x1 y1 (translate [(* dx1 5) (* dy1 5) -15] post1))
-      (key-place x2 y2 (translate [0         0         -15] post2))
-      (key-place x2 y2 (translate [(* dx2 5) (* dy2 5) -15] post2))
+      (place1 (translate [(* dx1 5) (* dy1 5) -15] post1))
+      (place1 (translate [0         0         -15] post1))
+      (place1 (translate [(* dx1 5) (* dy1 5) -15] post1))
+      (place2 (translate [0         0         -15] post2))
+      (place2 (translate [(* dx2 5) (* dy2 5) -15] post2))
       )
-    ; (hull
-    ;   (translate [0 0 -199] (key-place x1 y1 (translate [0         0         -15] post1)))
-    ;   (translate [0 0 -199] (key-place x2 y2 (translate [0         0         -15] post2)))
+    ;  (hull
+    ;   (translate [0 0 -19] (key-place x1 y1 (translate [0         0         -15] post1)))
+    ;   (translate [0 0 -19] (key-place x2 y2 (translate [0         0         -15] post2)))
     ;   (key-place x1 y1 (translate [(* dx1 5) (* dy1 5) -15] post1))
     ;   (key-place x1 y1 (translate [0         0         -15] post1))
     ;   (key-place x1 y1 (translate [(* dx1 5) (* dy1 5) -15] post1))
     ;   (key-place x2 y2 (translate [0         0         -15] post2))
     ;   (key-place x2 y2 (translate [(* dx1 5) (* dy1 5) -15] post2))
-    ;   )
     ))

+(defn key-wall-brace [x1 y1 dx1 dy1 post1 x2 y2 dx2 dy2 post2] (wall-brace (partial key-place x1 y1) dx1 dy1 post1 (partial key-place x2 y2) dx2 dy2 post2))
+
 (def case-walls
   (union
    ; back wall
-   (for [x (range 0 6)] (wall-brace x 0 0 1 web-post-tl x       0 0 1 web-post-tr))
-   (for [x (range 1 6)] (wall-brace x 0 0 1 web-post-tl (dec x) 0 0 1 web-post-tr))
+   (for [x (range 0 6)] (key-wall-brace x 0 0 1 web-post-tl x       0 0 1 web-post-tr))
+   (for [x (range 1 6)] (key-wall-brace x 0 0 1 web-post-tl (dec x) 0 0 1 web-post-tr))
+   (key-wall-brace 0 0 0 1 web-post-tl 0 0 -1 0 web-post-tl)
+   (key-wall-brace 5 0 0 1 web-post-tr 5 0 1 0 web-post-tr)
    ; right wall
-   (for [y (range 0 3)] (wall-brace 5 y 1 0 web-post-tr 5 y       1 0 web-post-br))
-   (for [y (range 1 3)] (wall-brace 5 (dec y) 1 0 web-post-br 5 y 1 0 web-post-tr))
+   (for [y (range 0 3)] (key-wall-brace 5 y 1 0 web-post-tr 5 y       1 0 web-post-br))
+   (for [y (range 1 3)] (key-wall-brace 5 (dec y) 1 0 web-post-br 5 y 1 0 web-post-tr))
+   (key-wall-brace 5 2 0 -1 web-post-br 5 2 1 0 web-post-br)
    ; left wall
-   (for [y (range 0 3)] (wall-brace 0 y -1 0 web-post-tl 0 y       -1 0 web-post-bl))
-   (for [y (range 1 3)] (wall-brace 0 (dec y) -1 0 web-post-bl 0 y -1 0 web-post-tl))
+   (for [y (range 0 3)] (key-wall-brace 0 y -1 0 web-post-tl 0 y       -1 0 web-post-bl))
+   (for [y (range 1 3)] (key-wall-brace 0 (dec y) -1 0 web-post-bl 0 y -1 0 web-post-tl))
+   ; front wall
+  ;  (key-wall-brace 2 3 0 -1 web-post-bl 2 3 0 -1 web-post-br)
+   (key-wall-brace 3 3 0 -1 web-post-bl 3 3 0 -1 web-post-br)
+   (key-wall-brace 4 2 0 -1 web-post-bl 4 2 0 -1 web-post-br)
+   (key-wall-brace 5 2 0 -1 web-post-bl 5 2 0 -1 web-post-br)
+  ;  (key-wall-brace 2 3 0 -1 web-post-br 3 3 0 -1 web-post-bl)
+   (key-wall-brace 3 3 0 -1 web-post-br 4 2 0 -1 web-post-bl)
+   (key-wall-brace 4 2 0 -1 web-post-br 5 2 0 -1 web-post-bl)
+   ; thumb walls
+   (wall-brace thumb-mr-place  0 -1 web-post-br thumb-tr-place  0 -1 thumb-post-br)
+   (wall-brace thumb-mr-place  0 -1 web-post-br thumb-mr-place  0 -1 web-post-bl)
+   (wall-brace thumb-br-place  0 -1 web-post-br thumb-br-place  0 -1 web-post-bl)
+   (wall-brace thumb-ml-place  0  1 web-post-tr thumb-ml-place  0  1 web-post-tl)
+   (wall-brace thumb-bl-place  0  1 web-post-tr thumb-bl-place  0  1 web-post-tl)
+   (wall-brace thumb-br-place -1  0 web-post-tl thumb-br-place -1  0 web-post-bl)
+   (wall-brace thumb-bl-place -1  0 web-post-tl thumb-bl-place -1  0 web-post-bl)
+   ; thumb corners
+   (wall-brace thumb-br-place -1  0 web-post-bl thumb-br-place  0 -1 web-post-bl)
+   (wall-brace thumb-bl-place -1  0 web-post-tl thumb-bl-place  0  1 web-post-tl)
+   ; thumb tweeners
+   (wall-brace thumb-mr-place  0 -1 web-post-bl thumb-br-place  0 -1 web-post-br)
+   (wall-brace thumb-ml-place  0  1 web-post-tl thumb-bl-place  0  1 web-post-tr)
+   (wall-brace thumb-bl-place -1  0 web-post-bl thumb-br-place -1  0 web-post-tl)
+
+   (wall-brace thumb-ml-place  0  1 web-post-tr thumb-tl-place -2.5  0 thumb-post-tl)
+   (wall-brace thumb-tl-place -1  0 thumb-post-tl (partial key-place 0 2) -1  0 web-post-bl)
+  ;  (wall-brace thumb-ml-place  0  1 web-post-tr thumb-tl-place  0  1 web-post-tl)
+  ;  (wall-brace thumb-tl-place  0  1 thumb-post-tl (partial key-place 0 2)  0  1 web-post-bl)
+  ;  (wall-brace thumb-tl-place  0  1 web-post-tl thumb-tl-place  0  1 thumb-post-tl)
+  ;  (wall-brace thumb-tl-place  0  1 thumb-post-tl (partial key-place 0 2)  0  1 web-post-bl)
+  ;  (wall-brace thumb-tl-place  0  1 web-post-tl thumb-tl-place  0  1 thumb-post-tl)
+
+   (wall-brace thumb-tr-place  0 -1 thumb-post-br (partial key-place 3 3)  0 -1 web-post-bl)
   ))

 (spit "repl.scad"
-      (write-scad (difference (union
+      (write-scad (union
                    key-holes
-                  ;  connectors
+                   connectors
                    thumb
                    thumb-connectors
                   ;  thumbcaps
                   ;  caps
-                  ;  front-wall
-                  ;  right-wall
                    case-walls
-                   )
-                   (translate [0 0 -599] (cube 999 999 999)))))
+                   )))
+


Remove outdated comment

Remove outdated comment

--- src/onyx/peer/virtual_peer.clj
+++ src/onyx/peer/virtual_peer.clj
@@ -43,8 +43,6 @@
               entry (first (alts!! [kill-ch inbox-ch] :priority true))]
           (if entry
             (let [new-replica (extensions/apply-log-entry entry replica)
-                  ;;; Or could have materialized view here so things are ready for next replica application
-                  ;;; Or maybe two, materialized replica (with map-invert here)
                   diff (extensions/replica-diff entry replica new-replica)
                   reactions (extensions/reactions entry replica new-replica diff state)
                   new-peer-view (extensions/peer-replica-view entry replica new-replica peer-view diff id)


Asserts -> Exceptions.

Asserts -> Exceptions.

--- src/onyx/plugin/core_async.clj
+++ src/onyx/plugin/core_async.clj
@@ -8,8 +8,9 @@

 (defn inject-reader
   [event lifecycle]
-  (assert (:core.async/chan event)
-          ":core.async/chan not found - add it using a :before-task-start lifecycle")
+  (when-not (:core.async/chan event)
+    (throw (ex-info ":core.async/chan not found - add it using a :before-task-start lifecycle"
+                    {:event-map-keys (keys event)})))
   (let [pipeline (:onyx.core/pipeline event)]
     {:core.async/pending-messages (:pending-messages pipeline)
      :core.async/drained (:drained pipeline)
@@ -23,7 +24,9 @@

 (defn inject-writer
   [event lifecycle]
-  (assert (:core.async/chan event) ":core.async/chan not found - add it using a :before-task-start lifecycle")
+  (when-not (:core.async/chan event)
+    (throw (ex-info ":core.async/chan not found - add it using a :before-task-start lifecycle"
+                    {:event-map-keys (keys event)})))
   {})

 (def reader-calls


destructure each member of exceptions-rules into its map of keys and values and create a variable-value binding for each key/value pair

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -1695,17 +1695,15 @@
                  lexeme-kv [k lexemes]]
              (if lexemes
                (->> exceptions-rules
-                    (mapcat (fn [path-and-merge-fn]
-                              (let [path (:path path-and-merge-fn)
-                                    surface-form-fn (if (:surface-form path-and-merge-fn)
-                                                      (:surface-form path-and-merge-fn)
-                                                      (fn [lexeme]
-                                                        (get-in lexeme path :none)))
-                                    merge-fn (:merge-fn path-and-merge-fn)]
+                    (mapcat (fn [{path :path
+                                  label :label
+                                  surface-form :surface-form
+                                  merge-fn :merge-fn}]
+                              (let [surface-form-fn (or surface-form
+                                                        (fn [lexeme]
+                                                          (get-in lexeme path :none)))]
                                 ;; a lexeme-kv is a pair of a key and value. The key is a string (the word's surface form)
                                 ;; and the value is a list of lexemes for that string.
-                                (log/trace (str "lexeme key:" k))
-                                (log/trace (str (first lexeme-kv) " generating exception for path: " path))
                                 (->> lexemes
                                      (mapcat (fn [lexeme]
                                                (if (not (= :none (get-in lexeme path :none)))
@@ -1717,14 +1715,14 @@
                                                                   (= a :fail)
                                                                   (do
                                                                     (log/warn (str ":fail in exception rule:"
-                                                                                (:label path-and-merge-fn)
+                                                                                label
                                                                                "; lexeme's italiano:"
                                                                                (strip-refs (get-in lexeme [:italiano]))))
                                                                     :fail)
                                                                   (= b :fail)
                                                                   (do
                                                                     (log/warn (str ":fail in exception rule:"
-                                                                                (:label path-and-merge-fn)
+                                                                                label
                                                                                "; lexeme:"
                                                                                (or (strip-refs (get-in lexeme [:italiano :italiano]))
                                                                                (strip-refs (get-in lexeme [:italiano])))))


Oops, didn't mean to commit this

Oops, didn't mean to commit this

--- src/braid/client/mobile/views.cljs
+++ src/braid/client/mobile/views.cljs
@@ -112,7 +112,7 @@
       [:div.inbox.page
        [header-view toggle-draw-ch]
        [:div.threads
-        [swipe-view @threads #_(conj @threads
+        [swipe-view (conj @threads
                           @temp-thread) thread-view]]])))

 (defn main-view []


Render to file

Render to file

--- src/dot_utility/radial.clj
+++ src/dot_utility/radial.clj
@@ -1,7 +1,10 @@
 (ns dot-utility.radial
   (:import [javax.swing JFrame JPanel]
            [java.awt BorderLayout RenderingHints Color Dimension Graphics2D BasicStroke font.TextLayout]
-           [java.awt.geom Path2D$Double Line2D$Double]))
+           [java.awt.geom Path2D$Double Line2D$Double]
+           [java.awt.image BufferedImage]
+           [java.io File]
+           [javax.imageio ImageIO]))

 (def default-frame-options
      {:title "Radar display"
@@ -17,6 +20,7 @@
 (def color-score (Color. 156 158 222))
 (def color-outline (Color. 109 110 155))
 (def color-fill (Color. 156 158 222 64))
+(def color-background (Color. 255 255 255))

 (defn petals-on-the-rose
   [ds scale-fn]
@@ -63,6 +67,7 @@
 (defn set-color [color] (.setColor *graphics* color))
 (defn draw [shape] (.draw *graphics* shape))
 (defn fill [shape] (.fill *graphics* shape))
+(defn fill-rect [x y width height] (.fillRect *graphics* x y width height))
 (defn translate [x-off y-off] (.translate *graphics* x-off y-off))
 (defn scale [x-scale y-scale] (.scale *graphics* x-scale y-scale))
 (defn set-pen-width [pw] (.setStroke *graphics* (BasicStroke. (/ pw *scale*))))
@@ -120,6 +125,8 @@

 (defn draw-radar
   [ds w h]
+  (set-color color-background)
+  (fill-rect 0 0 w h)
   (let [scale (/ (min (- w 60) (- h 60)) 2.0)]
     (translate (/ w 2.0) (/ h 2.0))
     (with-scaling scale
@@ -143,7 +150,7 @@
                         (with-antialiasing g
                           (draw-radar ds (.getWidth this) (.getHeight this)))))))

-(defn show-radar-display
+(defn show-radar-display-in-frame
   "Display a new window with a radar plot of the given data items.

    width and height control the size of the window.
@@ -163,6 +170,13 @@
       (.show))
     radar))

+(defn write-radar-display-to-file
+  [ds filename & options]
+  (let [{:keys [width height]} (into default-frame-options (apply hash-map options))
+        image (BufferedImage. width height BufferedImage/TYPE_INT_RGB)]
+    (with-antialiasing (.createGraphics image)
+      (draw-radar ds width height))
+    (ImageIO/write image "jpeg" (File. filename))))

 (def test-data
      '[("Performance" 1 10)


Store testbed images twice in every ten minutes

--- src/env_logger/handler.clj
+++ src/env_logger/handler.clj
@@ -149,10 +149,20 @@
                                       (db/weather-query-ok? db/postgres 3))
                              (get-latest-fmi-data (get-conf-value :fmi-api-key)
                                                   (get-conf-value :station-id)))
-              testbed-image (when (t/within? (t/interval start-time
-                                                         (t/plus start-time
-                                                                 (t/minutes 2)))
-                                             (t/now))
+              testbed-image (when (or (t/within? (t/interval (t/plus start-time
+                                                                     (t/minutes
+                                                                      4))
+                                                             (t/plus start-time
+                                                                     (t/minutes
+                                                                      6)))
+                                                 (t/now))
+                                      (t/within? (t/interval (t/plus start-time
+                                                                     (t/minutes
+                                                                      7))
+                                                             (t/plus start-time
+                                                                     (t/minutes
+                                                                      9)))
+                                                 (t/now)))
                               (get-testbed-image))
               insert-status (db/insert-observation
                              db/postgres


Fix bug with missing values in date selector

--- src/env_logger/handler.clj
+++ src/env_logger/handler.clj
@@ -115,7 +115,8 @@
                           obs-dates (db/get-obs-start-and-end db/postgres)
                           formatter (f/formatter "d.M.y")
                           logged-in? (authenticated? request)
-                          common-values {:logged-in? logged-in?
+                          common-values {:obs-dates obs-dates
+                                         :logged-in? logged-in?
                                          :ws-url (get-conf-value :ws-url)
                                          :yc-image-basepath (get-conf-value
                                                              :yc-image-basepath)


Remove comments

Remove comments

--- backend/test/akvo/lumen/test_utils.clj
+++ backend/test/akvo/lumen/test_utils.clj
@@ -136,17 +136,14 @@

 (defn halt-system [system]
   (when system (ig/halt! system)))
+
 (defn start-config []
   (let [c (dissoc-prod-components (prep "akvo/lumen/config.edn" "dev.edn" "test.edn"))]
              (ig/load-namespaces c)
              c))
+
 (defn start-system []
   (ig/init (start-config)))
-
-(comment (def s (start-system))
-         (halt-system s))
-;;
-;;(ig/init config)

 (defn- seed-tenant
   "Helper function that will seed tenant to the tenants table."


fixed drag

fixed drag

--- src/frontend/renderer.cljs
+++ src/frontend/renderer.cljs
@@ -228,20 +228,12 @@
     om/IDidMount
     (did-mount [this]
       (.addEventListener js/window "resize" #(om/refresh! owner))
-
-      ;TODO: undo draggable on unmount(?)
-      (let [offset (.offset (js/$ "#progress-track-bar"))
-            top (.-top offset)
-            left (.-left offset)
-            width (.width (js/$ "#progress-track-bar"))
-            height (.height (js/$ "#progress-track-bar"))
-            containment #js [left, top, (+ width left),  (+ top height)]]
-        (.draggable (js/$ "#progress-track-ball") #js {:axis "x"
-                                                       :containment containment
-                                                       :start #(swap! player/app-state assoc
-                                                                      :ball-being-dragged?
-                                                                      true)
-                                                       :stop core/on-drag-stop})))))
+      (.draggable (js/$ "#progress-track-ball") #js {:axis "x"
+                                                     :containment "#progress-track-bar"
+                                                     :start #(swap! player/app-state assoc
+                                                                    :ball-being-dragged?
+                                                                    true)
+                                                     :stop core/on-drag-stop}))))

 (om/root resume-button core/app-state {:target (. js/document (getElementById "play-button"))})
 (om/root pause-button core/app-state {:target (. js/document (getElementById "pause-button"))})


add execution sample

add execution sample

--- src/graphql_clj/parser.clj
+++ src/graphql_clj/parser.clj
@@ -295,6 +295,15 @@
       {:data (into {} (log/spy (map (fn [definition]
                                       (execute-definition definition type-meta-fn)) definitions)))})))

+(comment
+  (parse "query {user}")
+  (parse "query {user {id}}")
+  (transformer (parse "query {user {id}}"))
+  (execute (transformer (parse "query {user {id}}")) graphql-clj.type/get-type-meta)
+  (execute (transformer (parse "query {user {id name}}")) graphql-clj.type/get-type-meta)
+  (execute (transformer (parse "query {user {id name profilePic {url}}}")) graphql-clj.type/get-type-meta)
+  (execute (transformer (parse "query {user {id name friends {name}}}")) graphql-clj.type/get-type-meta))
+
 (def statements
   [
    "query {


More clean up

More clean up

--- src/asteroids/core.clj
+++ src/asteroids/core.clj
@@ -18,11 +18,14 @@
 (def width 160)
 (def height 85)
 (def point-size 8.5)
+(def turn-millis 40)
+
 (def ship-size 1.5)
 (def ship-life 3)
 (def ship-acceleration 1)
 (def ship-rotation-speed 4)
 (def ship-damage 4)
+
 (def asteroids-start-number 1)
 (def asteroid-start-size 5)
 (def asteroid-min-size 1.3)
@@ -32,25 +35,17 @@
 (def asteroid-max-rotation-speed 4)
 (def asteroid-damage 1)
 (def debris-life-millis 3000)
-(def turn-millis 40)
-
-(def ammunition-types {
-                       :projectile {
-                                    :size         (/ ship-size 10)
+
+(def ammunition-types {:projectile {:size         (/ ship-size 10)
                                     :speed        2.5
                                     :acceleration 0
                                     :damage       3
-                                    :cooldown     300
-                                    }
-                       :missile    {
-                                    :size         (/ ship-size 3)
+                                    :cooldown     300}
+                       :missile    {:size         (/ ship-size 3)
                                     :speed        0
                                     :acceleration 3
                                     :damage       30
-                                    :cooldown     10000
-                                    }})
-
-(def sqrt (memoize #(Math/sqrt %)))
+                                    :cooldown     10000}})

 (def actions {
               (int \A) {:rotation (- ship-rotation-speed)}
@@ -60,6 +55,8 @@
               (int \K) {:shoot true}})

 ; END: constants
+
+(def sqrt (memoize #(Math/sqrt %)))

 (defn random [from to]
   (let [range (- to from)]


Improve code readability.

Improve code readability.

--- src/onyx/messaging/aeron/subscriber.clj
+++ src/onyx/messaging/aeron/subscriber.clj
@@ -226,10 +226,10 @@
         (if (> rv-msg replica-version)
           ControlledFragmentHandler$Action/ABORT
           (let [spub (.valAt ^CljInt2ObjectHashMap short-id-status-pub short-id)]
-            (when spub (status-pub/set-heartbeat! spub))
+            (some-> spub status-pub/set-heartbeat!)
             (cond (= msg-type t/message-id)
-                  (let [_ (when (nil? batch) (set! batch (transient [])))
-                        seg-dec (sdec/wrap buffer bs (+ offset (bdec/length base-dec)))]
+                  (let [seg-dec (sdec/wrap buffer bs (+ offset (bdec/length base-dec)))]
+                    (when (nil? batch) (set! batch (transient [])))
                     (if (< (count batch) batch-size)
                       (let [session-id (.sessionId header)
                             ;; FIXME: slow


Remove useless precondition.

Remove useless precondition.

--- src/buddy/core/mac.clj
+++ src/buddy/core/mac.clj
@@ -80,7 +80,6 @@
   "Noramalizes 32 bytes array key to poly1305
   formatted byte array key."
   [^bytes key]
-  {:pre [(= (count key) 32)]}
   (let [key (bytes/copy key)]
     (Poly1305KeyGenerator/clamp key)
     key))


*load-fn* must either be nil or a map of two keys :source & :lang, :lang may only be :clj or :js

--- src/main/cljs/cljs/js.cljs
+++ src/main/cljs/cljs/js.cljs
@@ -34,7 +34,13 @@
   Whatever function *load-fn* is bound to will be passed a munged relative
   library path (a string) and a callback. It is up to the implementor to
   orrectly resolve a .cljs, .cljc, or .js file (the order must be respected).
-  The callback should be invoked with the source of the library (a string)."
+  The callback should be invoked with a map of two keys:
+
+  :lang   - the language, :clj or :js
+  :source - the source of the library (a string)
+
+  If the library could not be resolved, the callback should be invoked with
+  nil."
     :dynamic true}
   *load-fn*
   (fn [name cb]
@@ -80,10 +86,18 @@
    (when-not (contains? @*loaded* name)
      (let [env (:*env* bound-vars)]
        (*load-fn* (ns->relpath name)
-         (fn [source]
-           (if source
-             (eval-str* bound-vars source opts
-               (fn [ret] (cb true)))
+         (fn [resolved]
+           (if resolved
+             (let [{:keys [lang source]} resolved]
+               (condp = lang
+                 :clj (eval-str* bound-vars source opts
+                        (fn [ret] (cb true)))
+                 :js  (do
+                        (*eval-fn* source)
+                        (cb true))
+                 (throw
+                   (js/Error.
+                     (str "Invalid :lang specified " lang ", only :clj or :js allowed")))))
              (throw
                (ana/error env
                  (ana/error-message :undeclared-ns
@@ -145,11 +159,17 @@
        (if (seq deps)
          (let [dep (first deps)]
            (*load-fn* (ns->relpath dep)
-             (fn [source]
-               (if-not (nil? source)
-                 (analyze* bound-vars source opts
-                   (fn []
-                     (analyze-deps bound-vars ana-env lib (next deps) opts cb)))
+             (fn [resolved]
+               (if resolved
+                 (let [{:keys [lang source]} resolved]
+                   (condp = lang
+                     :clj (analyze* bound-vars source opts
+                            (fn []
+                              (analyze-deps bound-vars ana-env lib (next deps) opts cb)))
+                     :js  (analyze-deps bound-vars ana-env lib (next deps) opts cb)
+                     (throw
+                       (js/Error.
+                         (str "Invalid :lang specified " lang ", only :clj or :js allowed")))))
                  (throw
                    (ana/error ana-env
                      (ana/error-message :undeclared-ns


remove explicitly stored allocator limits (bitset count will suffice), also add some doc strings

--- src/overtone/sc/machinery/allocator.clj
+++ src/overtone/sc/machinery/allocator.clj
@@ -1,4 +1,7 @@
-(ns overtone.sc.machinery.allocator
+(ns
+    ^{:doc "ID allocator system. Used to return new unique integer IDs in a threadsafe manner. IDs may be freed and therefore reused. Allows action fns to be executed in synchronisation with allocation and deallocation."
+      :author "Sam Aaron"}
+  overtone.sc.machinery.allocator
   (:use [overtone.sc.machinery defaults])
   (:require [overtone.util.log :as log]))

@@ -10,23 +13,22 @@
 ;; notifications from the server.  (e.g. When an envelope trigger fires to
 ;; free a synth.)

-(defn mk-bitset [size]
+(defn mk-bitset
+  "Create a vector representation of a bitset"
+  [size]
   (vec (repeat size false)))

 (defonce allocator-bits
   {:node         (ref (mk-bitset MAX-NODES))
    :audio-buffer (ref (mk-bitset MAX-BUFFERS))
-   :audio-bus    (ref (mk-bitset MAX-NODES))
-   :control-bus  (ref (mk-bitset MAX-NODES))})
-
-(defonce allocator-limits
-  {:node         MAX-NODES
-   :audio-buffer MAX-BUFFERS
-   :audio-bus    MAX-AUDIO-BUS
-   :control-bus  MAX-CONTROL-BUS})
+   :audio-bus    (ref (mk-bitset MAX-AUDIO-BUS))
+   :control-bus  (ref (mk-bitset MAX-CONTROL-BUS))})

 (defn- fill-gaps
-  "Fill a given vector bs with size consecutive vals from idx"
+  "Returns a new vector similar to bs except filled with with size consecutive vals from idx
+
+  example: (fill with 3 from idx 1 for 2 vals)
+  (fill-gaps [1 0 0 0 1] 1 2 3) ;=> [1 3 3 0 1]"
   [bs idx size val]
   (loop [bs bs
          idx idx
@@ -36,13 +38,20 @@
       bs)))

 (defn- find-gap
-  [bs size idx gap-found limit]
-  (when (> idx limit)
-    (throw (Exception. (str "No more ids! Unable to allocate a sequence of ids of length: " size))))
-  (if (= gap-found size)
-    (- idx gap-found)
-    (let [gap-found (if (not (get bs idx)) (inc gap-found) 0)]
-      (find-gap bs size (inc idx) gap-found limit))))
+  "Returns index of the first gap in vector bs with specified size where gap is
+  defined as a falsey value.
+
+  example:
+  (find-gap [true false true false false false true] 3) ;=> 3"
+  ([bs size] (find-gap bs size 0 0))
+  ([bs size idx gap-found]
+     (let [limit (count bs)]
+       (when (> idx limit)
+         (throw (Exception. (str "No more ids! Unable to allocate a sequence of ids of length: " size))))
+       (if (= gap-found size)
+         (- idx gap-found)
+         (let [gap-found (if (not (get bs idx)) (inc gap-found) 0)]
+           (find-gap bs size (inc idx) gap-found))))))

 (def action-fn-executor* (agent nil))

@@ -69,14 +78,11 @@
   ([k] (alloc-id k 1 nil))
   ([k size] (alloc-id k size nil))
   ([k size action-fn]
-     (let [bits  (get allocator-bits k)
-           limit (get allocator-limits k)]
+     (let [bits  (get allocator-bits k)]
        (when-not bits
          (throw (Exception. (str "Unable to get allocator bits for keyword " k))))
-       (when-not limit
-         (throw (Exception. (str "Unable to get allocator limit for keyword " k))))
        (dosync
-        (let [id (find-gap @bits size 0 0 limit)]
+        (let [id (find-gap @bits size)]
           (alter bits fill-gaps id size true)
           (when action-fn (execute-action-fn #(action-fn id) "alloc-id"))
           id)))))
@@ -95,8 +101,7 @@
   ([k id] (free-id k id 1 nil))
   ([k id size] (free-id k id size nil))
   ([k id size action-fn]
-     (let [bits (get allocator-bits k)
-           limit (get allocator-limits k)]
+     (let [bits (get allocator-bits k)]
        (dosync
         (alter bits fill-gaps id size false)
         (when action-fn (execute-action-fn action-fn "free-id"))))))
@@ -104,7 +109,8 @@
 (defn clear-ids
   "Clear all ids allocated for key."
   [k]
-  (let [bits  (get allocator-bits k)
-        limit (get allocator-limits k)]
+  (let [bits (get allocator-bits k)]
     (dosync
-     (ref-set bits (mk-bitset limit)))))
+     (let [new-bitset (mk-bitset (count @bits))]
+       (ref-set bits new-bitset)))
+    :cleared))


Added pikaday css to index page.

Added pikaday css to index page.

--- app/src/weather/ui/index.clj
+++ app/src/weather/ui/index.clj
@@ -22,7 +22,8 @@
      [:meta {:http-equiv "X-UA-Compatible" :content "IE=edge"}]
      [:meta {:name "viewport"
              :content "width=device-width, initial-scale=1.0"}]
-     (page/include-css (resource-with-checksum "css/style.css"))]
+     (page/include-css (resource-with-checksum "css/style.css"))
+     (page/include-css (resource-with-checksum "css/pikaday.css"))]
     [:body
      [:div#app]
      (page/include-js (resource-with-checksum "js/main.js"))]))


Removed a debug fn that I left by mistake

--- src/cia/properties.clj
+++ src/cia/properties.clj
@@ -31,10 +31,6 @@
        transform
        (reset! properties)))

-(defn p [x]
-  (clojure.pprint/pprint x)
-  x)
-
 (defn init!
   ([]
    (some->> (map #(-> % io/resource io/file) property-files)


Maintain unique and one-to-one indices in parallel

--- src/clj/libx/util.cljc
+++ src/clj/libx/util.cljc
@@ -105,23 +105,21 @@
   [fact]
   (let [ancestry (@state/ancestors-fn (:a fact))]
     (cond
-      (ancestry :unique) (into [:unique] (vals (select-keys fact [:a :v])))
-      (ancestry :one-to-one) (into [:one-to-one] (take 2 (vals fact)))
-      :else nil)))
+      (ancestry :unique) [:unique (:a fact) (:v fact)]
+      (ancestry :one-to-one) [:one-to-one (:e fact) (:a fact)]
+      :else :one-to-many)))

 (defn find-in-fact-index
-  "Returns nil if not in session and ok to insert. Else returns
-  existing fact to be retracted"
+  "Writes value to path in ks. Returns nil if nothing was overwritten. Else returns fact that was
+   overwritten."
   [fact ks]
-  (if (nil? ks)
-    nil
-    (if-let [existing (get-in @state/fact-index ks)]
-      (do
-        (swap! state/fact-index assoc-in ks fact)
-        existing)
-      (do
-        (swap! state/fact-index assoc-in ks fact)
-        nil))))
+  (if-let [existing (get-in @state/fact-index ks)]
+    (do
+      (swap! state/fact-index assoc-in ks fact)
+      existing)
+    (do
+      (swap! state/fact-index assoc-in ks fact)
+      nil)))

 (defn remove-from-fact-index
   "Finds in index based on supplied key.
@@ -132,8 +130,39 @@
   (let [existing (get-in @state/fact-index ks)]
     (if (= existing fact)
       (do (swap! state/fact-index dissoc-in ks)
-        true)
+          true)
       false)))
+
+(defn update-unique-index
+  "Prepreds :unique to keyseq path in second argument. Overwrites existing value and returns it if
+  found."
+  [fact ks]
+  (if-let [existing (get-in @state/fact-index (into [:unique] ks))]
+    (do
+      (swap! state/fact-index update-in (into [:unique] ks) (fn [_] fact))
+      existing)
+    (do
+      (swap! state/fact-index assoc-in (into [:unique] ks) fact)
+      nil)))
+
+(defn update-index
+  "Primary function that updates fact-index. Requires fact to index. Generates key-seq
+  to path in index."
+  ([fact]
+   (update-index fact (fact-index-path fact)))
+  ([fact ks]
+   (condp = (first ks)
+     :one-to-one (find-in-fact-index fact ks)
+     :unique (let [removed-from-cardinality (update-index fact [:one-to-one (:e fact) (:a fact)])
+                   removed-from-unique (update-unique-index fact (into [] (rest ks)))]
+               (when (and (seq removed-from-unique) (not= fact removed-from-unique))
+                 (remove-from-fact-index removed-from-unique
+                   [:one-to-one (:e removed-from-unique) (:a removed-from-unique)]))
+               (when (and (seq removed-from-cardinality) (not= fact removed-from-cardinality))
+                 (remove-from-fact-index removed-from-cardinality
+                   [:unique (:a removed-from-cardinality) (:v removed-from-cardinality)]))
+               (vector removed-from-cardinality removed-from-unique))
+    :one-to-many nil)))

 (defn insert
   "Inserts facts from outside rule context.


Show abstract states along with location

--- src/cljakstab/core.clj
+++ src/cljakstab/core.clj
@@ -73,10 +73,8 @@

 (defn- edge-flatten
   [edge]
-  (let [[from to] edge
-        from_lbl  (.getLabel from)
-        to_lbl    (.getLabel to)]
-    {from_lbl [to_lbl] to_lbl []}))
+  (let [[from to] edge]
+    {from [to] to []}))

 (defn cfg-to-stmt-map
   [cfg]
@@ -106,29 +104,40 @@
   [jumps]
   (if (empty? jumps)
     ""
-    (str ": [" (string/join "," jumps) "]")))
+    (str "-> [" (string/join "," jumps) "]")))
+
+(defn show-abstract-state
+  [cfr location]
+  (str
+   (-> cfr
+    .getReachedStates
+    (.where location))))

 (defn show-stmt-map
-  [stmt-map program]
+  [stmt-map program cfr]
   (->>
    stmt-map
    (into (sorted-map))
    (reduce remove-right-after [])
    reverse
    (map
-    (fn [[lbl jumps]]
-      (if (zero? (.getIndex lbl))
-        (let [address (.getAddress lbl)
-              instruction (.getInstruction program address)]
-          (-> program
-              (.getInstructionString address instruction)
-              println)))
-      (println
-       (str
-        lbl
-        " "
-        (.getStatement program lbl))
-       (show-jumps jumps))))
+    (fn [[location jumps]]
+      (let [lbl (.getLabel location)]
+        (if (zero? (.getIndex lbl))
+          (let [address (.getAddress lbl)
+                instruction (.getInstruction program address)]
+            (-> program
+                (.getInstructionString address instruction)
+                println)))
+        (println
+         (str
+          lbl
+          (string/join
+           " "
+           [
+            (.getStatement program lbl)
+            (show-jumps jumps)
+            (show-abstract-state cfr location)]))))))
    dorun)
   nil)

@@ -141,11 +150,11 @@
 (defn list-code
   ([] (with-loaded list-code))
   ([loaded]
-    (let [program (:program loaded)]
+    (let [{program :program cfr :cfr} loaded]
       (-> program
           get-cfg
           cfg-to-stmt-map
-          (show-stmt-map program)))))
+          (show-stmt-map program cfr)))))

 (defn show-state
   ([state-num] (with-loaded show-state state-num))


Formatting and comment cleanup in main repness function

--- src/polismath/clusters.clj
+++ src/polismath/clusters.clj
@@ -406,9 +406,12 @@
   {:ids (map :id group-clusters)
    :stats
      (->> group-clusters
-       ; XXX - Base clusters may not be necessary if we use the already compute bucket vote stats
-       ; A lazy-seq of
-       (mapv (comp columns get-matrix (partial rowname-subset data) #(group-members % base-clusters)))
+       ; XXX - Base clusters may not be necessary if we use the already computed bucket vote stats
+       ; A vector, where each entry is a column iterator for the matrix subset of the given group
+       (mapv (comp columns
+                   get-matrix
+                   (partial rowname-subset data)
+                   #(group-members % base-clusters)))
        (apply
          map
          (fn [& vote-cols-for-groups]


get username from main's args

get username from main's args

--- src/qmon/core.clj
+++ src/qmon/core.clj
@@ -25,11 +25,6 @@
   (let [fns (map #(ns-resolve 'qmon.core (symbol (str "x" (name %)))) headkeys)
         raw (fn [job] (zipmap (map #(:tag %) job) (map #(:content %) job)))]
     (zipmap headkeys (map #(% (raw job)) fns))))
-
-(defn myname []
-  (if (first *command-line-args*)
-    (first *command-line-args*)
-    (get (System/getenv) "USER")))

 (defn myjobs [user]
   (let [alljobs (map :content (filter #(= (:tag %) :Job) (tree)))
@@ -112,7 +107,7 @@
   (let [t (xtime j :resources_used)] (if (nil? t) "-" t)))

 (defn -main [& args]
-  (let [user         (myname)
+  (let [user         (or (first args) (get (System/getenv) "USER"))
         panel        (JPanel. (BorderLayout.))
         text-area    (JTextArea. waitmsg)
         button       (JButton. "Sleep")
@@ -125,6 +120,7 @@
                        (.setText button (if x "Wake" "Sleep" ))
                        (if-not x (.setText text-area waitmsg))
                        (not x))]
+    (println user)
     (do
       (doto text-area
         (.setFont (Font. "Monospaced" (Font/PLAIN) 12))


Fix metadata and place of quil.core.resize.

--- src/quil/core.clj
+++ src/quil/core.clj
@@ -3046,6 +3046,27 @@
     (let [mode (resolve-constant-key kind shader-modes)]
       (.resetShader (current-graphics) mode))))

+(defn
+  ^{:requires-bindings true
+    :processing-name "resize()"
+    :category "Image"
+    :processing-link "http://processing.org/reference/PImage_resize_.html"
+    :added "2.1.0"}
+  resize
+  "Resize the image to a new width and height.
+  To make the image scale proportionally, use 0 as the value for the wide or high parameter.
+  For instance, to make the width of an image 150 pixels, and change the height
+  using the same proportion, use resize(150, 0).
+
+  Even though a PGraphics is technically a PImage, it is not possible
+  to rescale the image data found in a PGraphics.
+  (It's simply not possible to do this consistently across renderers:
+  technically infeasible with P3D, or what would it even do with PDF?)
+  If you want to resize PGraphics content, first get a copy of its image data
+  using the get() method, and call resize() on the PImage that is returned."
+  [^PImage img w h]
+  (.resize img w h))
+
 (defn
   ^{:requires-bindings true
     :processing-name "rotate()"
@@ -4174,26 +4195,6 @@
   release, this will always be subject to change."
   ([] (update-pixels (current-graphics)))
   ([^PImage img] (.updatePixels img)))
-
-(defn
-  ^{:requires-bindings true
-    :processing-name "resize()"
-    :category "Image"
-    :added "1.0"}
-  resize
-  "Resize the image to a new width and height.
-  To make the image scale proportionally, use 0 as the value for the wide or high parameter.
-  For instance, to make the width of an image 150 pixels, and change the height
-  using the same proportion, use resize(150, 0).
-
-  Even though a PGraphics is technically a PImage, it is not possible
-  to rescale the image data found in a PGraphics.
-  (It's simply not possible to do this consistently across renderers:
-  technically infeasible with P3D, or what would it even do with PDF?)
-  If you want to resize PGraphics content, first get a copy of its image data
-  using the get() method, and call resize() on the PImage that is returned."
-  [^PImage img w h]
-  (.resize img w h))

 (defn
   ^{:requires-bindings true


added in exec-stream function, it's a doozy

--- src/duffel/fs_util.clj
+++ src/duffel/fs_util.clj
@@ -82,6 +82,34 @@
     [dir]
     (.mkdirs (java.io.File. dir)))

+(defn- print-return-stream
+    [stream]
+    (let [stream-seq (->> stream
+                          (java.io.InputStreamReader.)
+                          (java.io.BufferedReader.)
+                          line-seq)]
+        (doall (reduce
+            (fn [acc line]
+                (println line)
+                (if (empty? acc) line (str acc "\n" line)))
+            ""
+            stream-seq))))
+
+(defn exec-stream
+    "Executes a command in the given dir, streaming stdout and stderr to stdout,
+    and once the exec is finished returns a vector of the return code, a string of
+    all the stdout output, and a string of all the stderr output"
+    [dir command & args]
+    (let [runtime  (Runtime/getRuntime)
+          proc     (.exec runtime (into-array (cons command args)) nil (File. dir))
+          stdout   (.getInputStream proc)
+          stderr   (.getErrorStream proc)
+          outfut   (future (print-return-stream stdout))
+          errfut   (future (print-return-stream stderr))
+          proc-ret (.waitFor proc)]
+        [proc-ret @outfut @errfut]
+        ))
+
 (defn exec-in
     "Executes a command in the given dir, throws an exception if the command doesn't return
     an exit code of 0"


Cleaned up ns form and imports

Cleaned up ns form and imports

--- src/ez_snake/core.cljs
+++ src/ez_snake/core.cljs
@@ -1,12 +1,12 @@
 (ns ez-snake.core
-  (:require-macros [cljs.core.async.macros :refer [go go-loop]])
   (:require [goog.dom :as dom]
             [goog.style :as style]
             [goog.events :as events]
-            [goog.Timer :as timer]
-            [goog.events.KeyHandler :as keyh]
             [cljs.core.async :refer [put! chan <! close!]]
-            [ez-snake.game :refer [new-game! crawl! turn! game]]))
+            [ez-snake.game :refer [new-game! crawl! turn! game]])
+  (:require-macros [cljs.core.async.macros :refer [go go-loop]])
+  (:import goog.Timer
+           goog.events.KeyHandler))

 (defn listen [ch el type]
   (events/listen el type #(put! ch %))
@@ -19,7 +19,7 @@
     (.start)))

 (defn key-handler [target]
-  (goog.events.KeyHandler. target))
+  (KeyHandler. target))

 (defn level []
   (.-value (dom/getElement "level")))
@@ -90,7 +90,7 @@
   (new-game! level)
   (beat timer level))

-(let [timer (goog.Timer.)
+(let [timer (Timer.)
       rounds (listen (chan) (dom/getElement "new-game") "click")]
   ((juxt handle-buttons handle-keystrokes #(handle-timer timer)))
   (go (while (<! rounds)


Remove default shader.

Remove default shader.

--- src/ezglib/render.cljs
+++ src/ezglib/render.cljs
@@ -87,8 +87,6 @@
   }"
   )

-(declare default-shader)
-
 (defn init!
   "Initializes opengl. Returns gl context."
   [canvas]
@@ -104,5 +102,4 @@
     (do
       (.log js/console "Unable to load webgl context. Your browser may not support it.")
       nil)))
-   (def default-shader (load-shader default-frag-src default-vert-src))
     gl)


Fixed possible NPE issue in utils module

--- src/hurvinek/utils.clj
+++ src/hurvinek/utils.clj
@@ -15,7 +15,7 @@
 (defn third
     "Simple utility function - returns third item from a given sequence."
     [coll]
-    (nth coll 2))
+    (nth coll 2 nil))

 (defn substring
     "Call method String.substring()."


Fix output format compatibility, patch for #277 (#278)

--- src/io/cyanite/api.clj
+++ src/io/cyanite/api.clj
@@ -8,6 +8,7 @@
             [io.cyanite.engine.queue    :as q]
             [io.cyanite.index           :as index]
             [io.cyanite.store           :as store]
+            [io.cyanite.store.pure      :as pure]
             [io.cyanite.query           :as query]
             [net.http.server            :as http]
             [io.cyanite.engine.drift    :refer [epoch!]]
@@ -147,8 +148,11 @@
                                   (map #(vector % aggregate)))))
                    (map (fn [[path aggregate]]
                           (engine/resolution engine from to (:path path) aggregate)))
-                   (remove nil?))]
-    (store/fetch! store from to paths)))
+                   (remove nil?))
+        raw-series (store/fetch! store from to paths)
+        [precision series] (pure/normalize raw-series)]
+    (pure/data->series series to precision)
+    ))

 (defmethod dispatch :default
   [_]