Remove redundant generate-file-basename calls

Turns out we do this earlier in the pipelines
already

--- src/vip/data_processor/validation/csv.clj
+++ src/vip/data_processor/validation/csv.clj
@@ -12,7 +12,6 @@
             [vip.data-processor.errors :as errors]
             [vip.data-processor.errors.process :as process]
             [vip.data-processor.output.tree-xml :as tree-xml]
-            [vip.data-processor.output.xml-helpers :as xml-helpers]
             [vip.data-processor.util :as util]
             [vip.data-processor.validation.csv.file-set :as csv-files]
             [vip.data-processor.validation.data-spec :as data-spec]
@@ -269,15 +268,13 @@
   {"3.0" [sqlite/attach-sqlite-db
           process/process-v3-validations
           (csv-files/validate-dependencies csv-files/v3-0-file-dependencies)
-          load-csvs
-          xml-helpers/generate-file-basename]
+          load-csvs]
    "5.1" (concat [(fn [ctx] (assoc ctx :tables postgres/v5-1-tables))
                   (fn [ctx] (assoc ctx :ltree-index 0))
                   process/process-v5-validations
                   load-csvs]
                  v5-1-transformers/transformers
-                 tree-xml/pipeline
-                 [xml-helpers/generate-file-basename])})
+                 tree-xml/pipeline)})

 (defn branch-on-spec-version [{:keys [spec-version] :as ctx}]
   (if-let [pipeline (get version-pipelines


comment tests

comment tests

--- test/infinitelives/utils/events_test.cljs
+++ test/infinitelives/utils/events_test.cljs
@@ -13,6 +13,7 @@
   (is (= 97 (events/ascii "a")))
   (is (= 122 (events/ascii "z"))))

+;; just test the keys are there. we assume the codes are correct.
 (deftest key-codes
   (let [ks (set (keys events/key-codes))]
     (doseq [c "0123456789abcdefghijklmnopqrstuvwxyz,.;'[]-=`/\\"]


satellite-master: Validate url strings using cemerick's url libary.

We're already using it rather than clojure.java.ui/as-url for related
functionality in the same file.

--- satellite-master/src/satellite/core.clj
+++ satellite-master/src/satellite/core.clj
@@ -52,7 +52,7 @@
    :riemann-tcp-server-options riemann-tcp-server-schema
    :sleep-time s/Int
    :mesos-master-url cemerick.url.URL
-   :riak (s/maybe {:endpoint (s/pred clojure.java.io/as-url)
+   :riak (s/maybe {:endpoint (s/pred url/url)
                    :bucket s/Str})
    :service-host s/Str
    :service-port s/Int


Collapse two exception checked catches into one.

--- src/onyx/log/zookeeper.clj
+++ src/onyx/log/zookeeper.clj
@@ -803,18 +803,17 @@
        (loop []
          (let [node (latest-checkpoint-path tenancy-id job-id)]
            (if-let [version (try
-                              (try
-                               (let [{:keys [data stat]} (zk/data conn node)]
-                                 ;; rewrite existing data to bump version number to kick
-                                 ;; off other writers
-                                 (:version (zk/set-data conn node data (:version stat))))
-                               (catch org.apache.zookeeper.KeeperException$NoNodeException nne
-                                 ;; initialise to nil
-                                 (zk/create-all conn node :persistent? true
-                                                :data (zookeeper-compress nil))
-                                 (:version (zk/exists conn node))))
-                              (catch KeeperException$BadVersionException bve
-                                false))]
+                             (let [{:keys [data stat]} (zk/data conn node)]
+                               ;; rewrite existing data to bump version number to kick
+                               ;; off other writers
+                               (:version (zk/set-data conn node data (:version stat))))
+                             (catch org.apache.zookeeper.KeeperException$NoNodeException nne
+                               ;; initialise to nil
+                               (zk/create-all conn node :persistent? true
+                                              :data (zookeeper-compress nil))
+                               (:version (zk/exists conn node)))
+                             (catch KeeperException$BadVersionException bve
+                               false))]
              version
              (recur))))))
    #(let [args {:event :zookeeper-read-checkpoint-coordinate-version :id job-id :latency %}]


whitelist group-aware-consensus export

whitelist group-aware-consensus export

--- src/polismath/conv_man.clj
+++ src/polismath/conv_man.clj
@@ -59,6 +59,7 @@
                                :n-cmts
                                :pca
                                :repness
+                               :group-aware-consensus
                                :consensus
                                :zid
                                :tids


parinfer tweaks

parinfer tweaks

--- src/polismath/conv_man.clj
+++ src/polismath/conv_man.clj
@@ -77,20 +77,20 @@
       (assoc :lastVoteTimestamp (:last-vote-timestamp results))
       (assoc :lastModTimestamp (:last-mod-timestamp results))
       (hash-map-subset #{
-        :base-clusters
-        :group-clusters
-        :in-conv
-        :lastVoteTimestamp
-        :lastModTimestamp
-        :n
-        :n-cmts
-        :pca
-        :repness
-        :consensus
-        :zid
-        :user-vote-counts
-        :votes-base
-        :group-votes})))
+                         :base-clusters
+                         :group-clusters
+                         :in-conv
+                         :lastVoteTimestamp
+                         :lastModTimestamp
+                         :n
+                         :n-cmts
+                         :pca
+                         :repness
+                         :consensus
+                         :zid
+                         :user-vote-counts
+                         :votes-base
+                         :group-votes})))

 (defn mongo-upsert-results
@@ -325,7 +325,7 @@
               msgs      (take-all! msgbox)
               msgs      (concat [first-msg] msgs)
               {votes :votes mods :moderation}
-                        (split-batches msgs)]
+              (split-batches msgs)]
           (when mods
             (swap! conv conv/mod-update mods))
           (swap! conv update-fn (or votes []) err-handler))


Improved date format on chart.

Improved date format on chart.

--- src-cljs/kixi/hecuba/widgets/chart.cljs
+++ src-cljs/kixi/hecuba/widgets/chart.cljs
@@ -30,6 +30,7 @@
         y                (.addMeasureAxis dimple-chart "y" "value")
         s                (.addSeries dimple-chart type js/dimple.plot.line (clj->js [x y]))]
     (aset s "data" (clj->js data))
+    (set! (.-tickFormat x) "%a %d %b %Y %H:%M")
     (.addLegend dimple-chart "5%" "10%" "20%" "10%" "right")
     (.draw dimple-chart)
     (.text (.-titleShape y) unit)


Add :placeholder option for datepicker dropdown

--- src/re_com/datepicker.cljs
+++ src/re_com/datepicker.cljs
@@ -240,7 +240,7 @@

 (defn- anchor-button
   "Provide clickable field with current date label and dropdown button e.g. [ 2014 Sep 17 | # ]"
-  [shown? model format]
+  [shown? model format placeholder]
   [:div {:class    "rc-datepicker-dropdown-anchor input-group display-flex noselect"
          :style    (flex-child-style "none")
          :on-click (handler-fn (swap! shown? not))}
@@ -251,15 +251,16 @@
     :children  [[:label {:class "form-control dropdown-button"}
                  (if (instance? js/goog.date.Date (deref-or-value model))
                    (unparse (if (seq format) (formatter format) date-format) (deref-or-value model))
-                   "")]
+                   [:span {:style {:color "#999999"}} placeholder])]
                 [:span.dropdown-button.activator.input-group-addon
                  {:style {:padding "3px 0px 0px 0px"}}
                  [:i.zmdi.zmdi-apps {:style {:font-size "24px"}}]]]]])

 (def datepicker-dropdown-args-desc
   (conj datepicker-args-desc
-        {:name :format    :required false  :default "yyyy MMM dd"  :type "string"   :description "[datepicker-dropdown only] a represenatation of a date format. See cljs_time.format"}
-        {:name :no-clip?  :required false  :default true           :type "boolean"  :description "[datepicker-dropdown only] when an anchor is in a scrolling region (e.g. scroller component), the popover can sometimes be clipped. When this parameter is true (which is the default), re-com will use a different CSS method to show the popover. This method is slightly inferior because the popover can't track the anchor if it is repositioned"}))
+        {:name :format       :required false  :default "yyyy MMM dd"  :type "string"   :description "[datepicker-dropdown only] a represenatation of a date format. See cljs_time.format"}
+        {:name :no-clip?     :required false  :default true           :type "boolean"  :description "[datepicker-dropdown only] when an anchor is in a scrolling region (e.g. scroller component), the popover can sometimes be clipped. When this parameter is true (which is the default), re-com will use a different CSS method to show the popover. This method is slightly inferior because the popover can't track the anchor if it is repositioned"}
+        {:name :placeholder  :required false                          :type "string"   :description "[datepicker-dropdown only] placeholder text for when a date is not selected."}))

 (defn datepicker-dropdown
   [& {:as args}]
@@ -268,22 +269,22 @@
         cancel-popover #(reset! shown? false)
         position       :below-left]
     (fn
-      [& {:keys [model show-weeks? on-change format no-clip?]
+      [& {:keys [model show-weeks? on-change format no-clip? placeholder]
           :or {no-clip? true}
           :as passthrough-args}]
       (let [collapse-on-select (fn [new-model]
                                  (reset! shown? false)
-                                 (when on-change (on-change new-model)))    ;; wrap callback to collapse popover
-            passthrough-args   (dissoc passthrough-args :format :no-clip?)  ;; :format and :no-clip? only valid at this API level
+                                 (when on-change (on-change new-model)))                 ;; wrap callback to collapse popover
+            passthrough-args   (dissoc passthrough-args :format :no-clip? :placeholder)  ;; :format, :no-clip? and :placeholder only valid at this API level
             passthrough-args   (->> (assoc passthrough-args :on-change collapse-on-select)
-                                    (merge {:hide-border? true})            ;; apply defaults
+                                    (merge {:hide-border? true})                         ;; apply defaults
                                     vec
                                     flatten)]
         [popover-anchor-wrapper
          :class    "rc-datepicker-dropdown-wrapper"
          :showing? shown?
          :position position
-         :anchor   [anchor-button shown? model format]
+         :anchor   [anchor-button shown? model format placeholder]
          :popover  [popover-content-wrapper
                     :position-offset (if show-weeks? 43 44)
                     :no-clip?       no-clip?


refine monitors

refine monitors

--- src/cljs/clj_money/views/dashboard.cljs
+++ src/cljs/clj_money/views/dashboard.cljs
@@ -74,7 +74,7 @@
                         ["url(#negative-fill)" "var(--white)"]
                         ["url(#positive-fill)" "var(--primary)"])
         line-x (str (* 100 percentage) "%")]
-    [:svg (merge opts {:version "1.1"
+    [:svg.rounded (merge opts {:version "1.1"
                        :xmlns "http://www.w3.org/2000/svg"})
      [:defs
       [:linearGradient {:id :positive-fill
@@ -153,7 +153,7 @@
      :style {:margin "0.5em"
              :cursor "pointer"}
      :title "Click here to remove this budget monitor."}
-    (bs/icon :x-circle)]])
+    (bs/icon :x-circle {:size :small})]])

 (defn- monitor-nav-tab
   [scope state]


Break check-waypoints up into smaller pieces

General refactoring for clojurey-ness

--- src/cljs/comic_reader/ui/waypoints.cljs
+++ src/cljs/comic_reader/ui/waypoints.cljs
@@ -39,33 +39,39 @@
 (defn- page-offset []
   (.-pageYOffset js/window))

-(defn check-waypoints [last-scroll-y]
+(defn- crossed? [trigger-point old-scroll-y new-scroll-y]
+  (let [was-before-trigger (<  old-scroll-y trigger-point)
+        now-after-trigger  (>= new-scroll-y trigger-point)
+        crossed-forward?  (and was-before-trigger
+                               now-after-trigger)
+        crossed-backward? (and (not was-before-trigger)
+                               (not now-after-trigger))]
+    (cond
+      crossed-forward?  :forward
+      crossed-backward? :backward
+      :else             nil)))
+
+(defn check-waypoints [old-scroll-y]
   (let [new-scroll-y (page-offset)]
-    (doseq [[id {:keys [options trigger-point]}] @waypoints]
-      (when trigger-point
-        (let [was-before-trigger (< last-scroll-y trigger-point)
-              now-after-trigger (>= new-scroll-y trigger-point)
-              crossed-forward (and was-before-trigger now-after-trigger)
-              crossed-backward (and (not was-before-trigger)
-                                    (not now-after-trigger))]
-          (when (or crossed-forward crossed-backward)
-            (let [direction (if crossed-forward :forward :backward)]
-              (.log js/console "Passed" id "going" direction)
-              (when-let [callback (:callback @options)]
-                (callback direction)))))))))
+    (doseq [[id {:keys [options trigger-point]}] @waypoints
+            :when trigger-point]
+      (when-let [direction (crossed? trigger-point old-scroll-y new-scroll-y)]
+        (.log js/console "Passed" id "going" direction)
+        (when-let [callback (:callback @options)]
+          (callback direction))))))

 (defn waypoint-context [_]
   (let [state (atom {})
-        throttler (Throttle. #(let [last-scroll-y (:last-scroll-y @state)]
+        throttler (Throttle. #(let [old-scroll-y (:old-scroll-y @state)]
                                 (swap! state assoc
                                        :ticking false
-                                       :last-scroll-y nil)
-                                (check-waypoints last-scroll-y)) 250)
+                                       :old-scroll-y nil)
+                                (check-waypoints old-scroll-y)) 250)
         listener-fn (fn []
                       (when (not (:ticking @state))
                         (swap! state assoc
                                :ticking true
-                               :last-scroll-y (page-offset)))
+                               :old-scroll-y (page-offset)))
                       (.fire throttler))]
     (reagent/create-class
      {:display-name "waypoint-context"


Code cleanup, added docs.

Code cleanup, added docs.

--- src/com/lemondronor/leaflet_gorilla.clj
+++ src/com/lemondronor/leaflet_gorilla.clj
@@ -5,8 +5,6 @@
             [gorilla-renderable.core :as render]
             [selmer.parser :as selmer]))

-(set! *warn-on-reflection* true)
-

 (defn- uuid [] (str (java.util.UUID/randomUUID)))

@@ -16,19 +14,19 @@
   [lon lat])

-(defn multipoint-feature [coords]
+(defn- multipoint-feature [coords]
   {:type :Feature
    :geometry {:type :MultiPoint
                :coordinates (map transpose-coord coords)}})

-(defn linestring-feature [coords]
+(defn- linestring-feature [coords]
   {:type :Feature
    :geometry {:type :LineString
                :coordinates (map transpose-coord coords)}})

-(defn polygon-feature [coords-arrays]
+(defn- polygon-feature [coords-arrays]
   {:type :Feature
    :geometry {:type :Polygon
                :coordinates (map #(map transpose-coord %) coords-arrays)}})
@@ -45,12 +43,12 @@
       (geojson-feature [:points geodesc]))))

-(defn geojson-features [geometries]
+(defn- geojson-features [geometries]
   {:features
    (map geojson-feature geometries)})

-(defn geojson [geometries]
+(defn- geojson [geometries]
   (json/write-str (geojson-features geometries)))

@@ -76,7 +74,9 @@
                 options))))))

-(defn leaflet [& args]
+(defn leaflet
+  "Plots geo data."
+  [& args]
   (let [[geometries opts] (parse-args args)]
     (LeafletView. geometries opts)))

@@ -91,12 +91,24 @@
    :opacity 1.0})

-;; Use IDs for these tags that theoretically some other renderer could
-;; reference?
-(def leaflet-js-tag-id "leafjet-js")
+;; Might as well use an ID for this tags that theoretically some other
+;; renderer could reference.
 (def leaflet-css-tag-id "leaflet-css")

+;; This, unfortunately, is a lot of javascript.
+;;
+;; First it loads the Leaflet CSS if it hasn't already been loaded.
+;;
+;; The complicated part is properly loading the Leaflet javascript. If
+;; it hasn't already been loaded, we check to see if it is currently
+;; being loaded. If it is being loaded, we add our map creation
+;; function to a queue of callbacks. If it isn't being loaded, we
+;; start loading it. When it's finally loaded we call all the
+;; functions in the callback queue.
+;;
+;; If the Leaflet javascript has already been fully loaded, we just
+;; create our map.

 (def content-template
   "<div>
@@ -116,9 +128,7 @@
     return jQuery.ajax(options);
   };
   var createMap = function() {
-    console.log('Running createMap for {{map-id}}');
     var map = L.map('{{map-id}}')
-    console.log('createMap ran for {{map-id}}');
     L.tileLayer('{{tile-layer-url}}')
         .addTo(map);
     var geoJson = L.geoJson(
@@ -133,7 +143,6 @@
     }
   };
   if (!document.getElementById('{{css-tag-id}}')) {
-    console.log('Adding css for {{map-id}}');
     $('<link>')
       .attr('rel', 'stylesheet')
       .attr('href', '{{leaflet-css-url}}')
@@ -142,13 +151,10 @@
   }
   if (!window.leafletJsLoaded) {
     if (!window.leafletJsIsLoading) {
-      console.log('Adding js for {{map-id}}');
       window.leafletJsLoadedCallbacks = [createMap];
       window.leafletJsIsLoading = true;
       cachedScript('{{leaflet-js-url}}')
         .done(function() {
-          console.log('js loaded');
-          console.log('callbacks: ' + window.leafletJsLoadedCallbacks);
           window.leafletJsIsLoading = false;
           window.leafletJsLoaded = true;
           _.each(window.leafletJsLoadedCallbacks, function(cb) { cb(); });
@@ -156,11 +162,9 @@
         })
         .fail(function() { console.log('failed'); });
     } else {
-      console.log('Adding callback for {{map-id}}');
       window.leafletJsLoadedCallbacks.push(createMap);
     }
   } else {
-    console.log('Calling createMap directly for {{map-id}}');
     createMap();
   }
 });
@@ -168,6 +172,7 @@
 </div>")

+;; Implement the Gorilla renderable protocol.
 (extend-type LeafletView
   render/Renderable
   (render [self]
@@ -175,8 +180,7 @@
           opts (:opts self)
           values (merge default-options
                         opts
-                        {:js-tag-id leaflet-js-tag-id
-                         :css-tag-id leaflet-css-tag-id
+                        {:css-tag-id leaflet-css-tag-id
                          :map-id (uuid)
                          :view (json/write-str (:view opts))
                          :geojson [:safe (geojson geometries)]})


Add debug message when acquiring semaphore.

--- src/uswitch/bifrost/s3.clj
+++ src/uswitch/bifrost/s3.clj
@@ -37,7 +37,7 @@
    topic partition
    first-offset last-offset
    file-path]
-  (info "Asked to step" {:state state :file-path file-path})
+  (debug "Asked to step" {:state state :file-path file-path})
   (case state
     nil          {:goto :upload-file}
     :upload-file (try (info "Starting S3 upload for" {:topic topic
@@ -89,6 +89,7 @@
          (info "Terminating S3 uploader")

          (let [{:keys [topic partition file-path first-offset last-offset]} msg]
+           (debug "Attempting to acquire semaphore to begin upload" {:file-path file-path})
            (.acquire semaphore)
            (info "Starting S3 upload of" file-path)
            (loop [state nil]


Use ->>

Use ->>

--- clojure/word_count.clj
+++ clojure/word_count.clj
@@ -1,5 +1,5 @@
 (let [counts (apply merge-with +
-  (map #(frequencies (re-seq #"[a-z']+" (.toLowerCase %)))
+  (map #(->> % .toLowerCase (re-seq #"[a-z']+") frequencies)
     (line-seq (java.io.BufferedReader. *in*))))]
   (doseq [[word count] (into (sorted-map) counts)]
     (println word count)))


add comment

add comment

--- test/cljam/t_bam.clj
+++ test/cljam/t_bam.clj
@@ -47,4 +47,5 @@
         (with-open [r (bam/reader (str temp-dir "/test.incomplete.sorted.bam"))]
           (io/read-alignments r {:chr "ref" :start 0 :end 1000})) => (filter #(= "ref" (:rname %)) (:alignments test-sam-incomplete-alignments-sorted-by-pos))
         ;; TODO: need more strictly check to .bai files
+        ;; (it will use https://gitlab.xcoo.jp/chrovis/cljam/issues/8 later)
         ))


Ajouté dépendance à core.async

Ajouté dépendance à core.async

--- core-async/project.clj
+++ core-async/project.clj
@@ -1,9 +1,10 @@
 (defproject core-async "0.1.0-SNAPSHOT"
-  :description "FIXME: write this!"
-  :url "http://example.com/FIXME"
+  :description "Learning core.async and ClojureScript, following ClojureScript 101 (http://swannodette.github.io/2013/11/07/clojurescript-101/)"
+  :url "https://github.com/olange/learning-clojure/tree/master/core-async"

   :dependencies [[org.clojure/clojure "1.5.1"]
-                 [org.clojure/clojurescript "0.0-2173"]]
+                 [org.clojure/clojurescript "0.0-2173"]
+                 [org.clojure/core.async "0.1.256.0-1bf8cf-alpha"]]

   :plugins [[lein-cljsbuild "1.0.2"]]


Turning some dials up to 11.

Turning some dials up to 11.

--- ClojureScript/hello.cljs
+++ ClojureScript/hello.cljs
@@ -10,23 +10,23 @@
         ))

 (def my-code-url "https://github.com/pauldoo/scratch/blob/master/ClojureScript/hello.cljs")
-(def tick-step (/ 1 100))
+(def tick-step (/ 1 200))
 (def render-step (/ 1 30))
-(def gravity-strength 15)
-(def ground-strength 10)
+(def gravity-strength 500)
+(def ground-strength 200)
 (def initial-game-state {
     :nodes {
         :t {
             :pos [150 100]
-            :vel [(- 10) 0]
+            :vel [0 0]
         }
         :u {
             :pos [350 200]
-            :vel [(- 10) 0]
+            :vel [0 0]
         }
         :v {
             :pos [250 100]
-            :vel [(- 10) 0]
+            :vel [0 0]
         }
     }
     :springs [
@@ -34,19 +34,19 @@
             :node-a :t
             :node-b :u
             :rest-length 224.0
-            :strength 50
+            :strength 2000
         }
         {
             :node-a :u
             :node-b :v
             :rest-length 141.0
-            :strength 50
+            :strength 2000
         }
         {
             :node-a :t
             :node-b :v
             :rest-length 100.0
-            :strength 50
+            :strength 2000
         }
     ] })

@@ -87,7 +87,7 @@
     (zipmap (keys nodes)
         (map (fn [{[ x y ] :pos [ xv yv ] :vel }]
             (if (< y 0)
-                (vec* [(- xv) (+ (- yv) (- y))] ground-strength)
+                (vec* [(- xv) (+ (Math/max 0 (- yv)) (- y))] ground-strength)
                 [0 0])) (vals nodes))))

 (defn calculate-all-node-forces [nodes springs]
@@ -175,11 +175,12 @@
         (do
             (. tick-timer (start))
             (. render-timer (start))
-            (goog.events/listen button goog.events.EventType/CLICK (partial input-event input-state-ref))
-            (goog.events/listen document.body goog.events.EventType/KEYDOWN (partial input-event input-state-ref) true)
-            (goog.events/listen document.body goog.events.EventType/KEYUP (partial input-event input-state-ref) true)
-            (goog.events/listen tick-timer goog.Timer/TICK #(tick game-state-ref (deref input-state-ref)))
-            (goog.events/listen render-timer goog.Timer/TICK #(rerender canvas (deref game-state-ref)))
+            (dorun (map (partial apply goog.events/listen) [
+                [button goog.events.EventType/CLICK (partial input-event input-state-ref)]
+                [document.body goog.events.EventType/KEYDOWN (partial input-event input-state-ref) true]
+                [document.body goog.events.EventType/KEYUP (partial input-event input-state-ref) true]
+                [tick-timer goog.Timer/TICK #(tick game-state-ref (deref input-state-ref))]
+                [render-timer goog.Timer/TICK #(rerender canvas (deref game-state-ref))]]))
             (goog.dom/appendChild document.body (goog.dom/createDom "div" {}
                 (goog.dom/createDom "h1" {} "Work in progress..")
                 (goog.dom/createDom "div" {} "Try clicking the button, or pressing keys.")


Fix up tree-diff test to use new expr-operator

--- test/atom_finder/tree_diff_test.clj
+++ test/atom_finder/tree_diff_test.clj
@@ -11,6 +11,7 @@
             [clj-jgit.internal :as giti]
             [clojure.pprint :refer :all]
             [clj-cdt.clj-cdt :refer :all]
+            [clj-cdt.expr-operator :refer :all]
             ))

 ; Have lines that contain atoms been changed in a meaningful way?


New test cases added to test-format-date

--- test/clj_calendar/calendar_test.clj
+++ test/clj_calendar/calendar_test.clj
@@ -186,11 +186,17 @@
         (let [calendar (get-calendar)]
             (.set calendar 2000 01 01 10 20 30)
             (is (= "2000" (format-date-using-desired-format calendar "yyyy")))
+            (is (= "00"   (format-date-using-desired-format calendar "yy")))
             (is (= "02"   (format-date-using-desired-format calendar "MM")))
             (is (= "01"   (format-date-using-desired-format calendar "dd")))
-            (is (= "10"   (format-date-using-desired-format calendar "hh")))
+            (is (= "032"  (format-date-using-desired-format calendar "DDD")))   ; day in year
+            (is (= "10"   (format-date-using-desired-format calendar "hh")))    ; hour 0..11
+            (is (= "10"   (format-date-using-desired-format calendar "HH")))    ; hour 0..23
             (is (= "20"   (format-date-using-desired-format calendar "mm")))
-            (is (= "30"   (format-date-using-desired-format calendar "ss"))))))
+            (is (= "30"   (format-date-using-desired-format calendar "ss")))
+            (is (= "AM"   (format-date-using-desired-format calendar "aa")))    ; AM/PM
+            (is (= "2"    (format-date-using-desired-format calendar "u")))     ; day number
+            (is (= "AD"   (format-date-using-desired-format calendar "GG")))))) ; era

 (deftest test-format-date-using-desired-format-2
     "Check the function clj-calendar.calendar/format-date-using-desired-format"


fix :queued-at time for canceled builds

fix :queued-at time for canceled builds

--- frontend/components/build_head.cljs
+++ frontend/components/build_head.cljs
@@ -35,7 +35,7 @@
          (if-not builds
            [:div.loading-spinner common/spinner]
            [:div.build-queue.active
-            (when-not usage-queued?
+            (when (and (:queued_at build) (not usage-queued?))
               [:p "Circle " (when run-queued? "has") " spent "
                (om/build common/updating-duration {:start (:queued_at build)
                                                    :stop (or (:start_time build) (:stop_time build))})


check identity length

check identity length

Former-commit-id: fa2e2c2f28f95160b252f0e78e9de55dc7462fa7

--- src/status_im/contacts/validations.cljs
+++ src/status_im/contacts/validations.cljs
@@ -2,14 +2,20 @@
   (:require [cljs.spec :as s]
             [status-im.persistence.realm :as realm]))

-(s/def ::not-empty-string (s/and string? not-empty))
 (defn unique-identity? [identity]
   (println identity)
   (not (realm/exists? :contacts :whisper-identity identity)))

+(defn valid-length? [identity]
+  (= 64 (count identity)))
+
+(s/def ::identity-length valid-length?)
 (s/def ::unique-identity unique-identity?)
+(s/def ::not-empty-string (s/and string? not-empty))
 (s/def ::name ::not-empty-string)
-(s/def ::whisper-identity (s/and ::not-empty-string ::unique-identity))
+(s/def ::whisper-identity (s/and ::not-empty-string
+                                 ::unique-identity
+                                 ::identity-length))

 (s/def ::contact (s/keys :req-un [::name ::whisper-identity]
                          :opt-un [::phone ::photo-path ::address]))


correct help string

correct help string

Fix #101

--- plugin/src/leiningen/doo.clj
+++ plugin/src/leiningen/doo.clj
@@ -187,8 +187,8 @@
   - build-id: any of the ids under the :cljsbuild map in your project.clj
   - watch-mode: either auto (default) or once\n

-All arguments are optional provided there is a corresponding default
-under :doo in the project.clj.\n")
+build-id is optional provided there is a corresponding default under :doo
+in project.clj.\n")

 (defn ^{:doc help-string}
   doo


Change bullet example text to prevent Pygments colorization bug.

--- vrepl/resources/samples/bullet.clj
+++ vrepl/resources/samples/bullet.clj
@@ -20,9 +20,9 @@
 ")

-(let [data [{:title "Revenue" :subtitle "US$ in thousands" :ranges [150 225 300] :measures [220 270] :markers [250]}
+(let [data [{:title "Revenue" :subtitle "USD in thousands" :ranges [150 225 300] :measures [220 270] :markers [250]}
             {:title "Profit" :subtitle "%" :ranges [20 25 30] :measures [21 23] :markers [26]}
-            {:title "Order Size" :subtitle "US$ average" :ranges [350 500 600] :measures [100 320] :markers [550]}
+            {:title "Order Size" :subtitle "USD average" :ranges [350 500 600] :measures [100 320] :markers [550]}
             {:title "New Customers" :subtitle "count" :ranges [1400 2000 2500] :measures [1000 1650] :markers [2100]}
             {:title "Satisfaction" :subtitle "out of 5" :ranges [3.5 4.25 5] :measures [3.2 4.7] :markers [4.4]}]]


anchor text change on ref to docs

anchor text change on ref to docs

The button "set up test summary" is broken. it should point to
https://circleci.com/docs/2.0/configuration-reference/#store_test_results, not
https://circleci.com/docs/2.0/configuration-reference/#storetestresults

--- src-cljs/frontend/components/build_head.cljs
+++ src-cljs/frontend/components/build_head.cljs
@@ -365,7 +365,7 @@

 (defn tests-ad [owner language platform build-succeeded?]
   (let [junit-link (if (= platform "2.0")
-                     "/docs/2.0/configuration-reference/#storetestresults"
+                     "/docs/2.0/configuration-reference/#store_test_results"
                      (case language
                        "Clojure" "/docs/test-metadata/#test2junit-for-clojure-tests"
                        "Ruby" "/docs/test-metadata/#rspec"


Fixing arity

Fixing arity

--- src/clj/fortress/ring/server.clj
+++ src/clj/fortress/ring/server.clj
@@ -76,13 +76,15 @@
   :threads        - Number of threads (defaults to cores * 2)
   :thread-prefix  - Thread prefix (defaults to fortress-http
   :debug-requests - Wether to debug requests (defaults to false)"
-  [handler & {:keys [debug-requests]
-              :as options}]
+  ([handler]
+   (run-fortress handler {}))
+  ([handler {:keys [debug-requests]
+            :as options}]
   (let [options (merge default-options options)]
     (reset! fhandler/debug-request debug-requests)
     (if debug-requests
       (log/info "Setting up requests debug"))
-    (create-channel handler options)))
+    (create-channel handler options))))

 (defn stop-fortress [{:keys [group channel secure-channel]}]
   (.close channel)


Reload the hyphen dicts after an export

Reload the hyphen dicts after an export

--- src/clj/hyphen_keeper/export.clj
+++ src/clj/hyphen_keeper/export.clj
@@ -74,7 +74,9 @@
       (sh substrings-program white-list (str tmp-file))
       (log/infof "Ran substrings.pl on %s producing %s" white-list tmp-file)
       (nio/move! tmp-file dictionary StandardCopyOption/REPLACE_EXISTING)
-      (log/infof "Move %s to %s" tmp-file dictionary))))
+      (log/infof "Move %s to %s" tmp-file dictionary))
+    ;; reload the hyphenation dictionaries
+    (hyphenate/reload!)))

 (defn- exporter
   "Create a channel and attach a listener to it so that events can be


working heatmap

working heatmap

--- src/clj/ux_analyzer/heat_map.clj
+++ src/clj/ux_analyzer/heat_map.clj
@@ -1,6 +1,7 @@
 (ns ux-analyzer.heat-map
   (:use [mikera.image.core]
-        [mikera.image.colours])
+        [mikera.image.colours]
+        [mikera.image.spectrum])
   (:import [Math])
   (:require [clojure.core.reducers :as r]))

@@ -17,10 +18,10 @@

 (defn get-neighbour-coords
   [x y width height]
-  (for  [ny (range (- y 1) (+ y 2))
-         nx (range (- x 1) (+ x 2))
-         :when (and (not (and (= nx x) (= ny y))))]
-      [nx ny]))
+  [[(- x 1) y]
+   [(+ x 1) y]
+   [x (- y 1)]
+   [x (+ y 1)]])

 (defn- all-coords-with-neighbours
   [width height]
@@ -34,17 +35,8 @@
             (let [v (get-in hm [x y] 0)]
               (if (> v 0) (inc count) count)))
           0 coords))
-;
-; (defn improved-round
-;   [hm all-coords]
-;   (r/fold (fn [acc [x y neighbours]]
-;             (let [n (count-pos-coords neighbours hm)]
-;               (update-in acc [x y] #(if (= % 0) (+ % n) (+ % n 1)))))
-;           hm
-;           all-coords))
-;
-
-(defn improved-round
+
+(defn round
   [hm all-coords]
   (reduce (fn [acc [x y neighbours]]
             (let [n (count-pos-coords neighbours hm)]
@@ -53,38 +45,49 @@
           all-coords))

-(defn improved-head-map
+(defn head-map-vec
   [width height coords rounds]
   (let [all-coords (all-coords-with-neighbours width height)]
     (loop [hm (init-positions (init-vec-2d width height 0) coords)
            r rounds]
       (if (= r 0)
         hm
-        (recur (improved-round hm all-coords) (dec r)))))
-  "done")
+        (recur (round hm all-coords) (dec r))))))

 (def coords
   [[1 1]
    [3 3]
-   [8 8]])
-;
-; (defn normalize-hm
-;   [img]
-;   (let [min-v (min img)
-;         max-v (max img)]
-;     (map #(/ (- % min-v) (- max-v min-v)) img)))
-;
-; (def hm-img (new-image 200 200))
-;
-; (def hm-pixels (get-pixels hm-img))
-;
-; (for [i (range 0 (count hm-pixels))]
-;   (aset hm-pixels i (rgb (nth normalized-img i) 0 0)))
-;
-; (set-pixels hm-img hm-pixels)
-;
-; (show hm-img :zoom 2.0 :title "Isn't it beautiful?")
+   [8 8]
+   [30 50]
+   [35 45]
+   [30 55]
+   [30 50]
+   [20 70]])

+(defn normalize-seq
+ [seq]
+ (let [min-v (apply min seq)
+       max-v (apply max seq)]
+   (map #(/ (- % min-v) (- max-v min-v)) seq)))
+
+(def rand-coords (partition 2 (take 500 (repeatedly #(rand-int 100)))))
+
+(def my-heat-map-vec (head-map-vec 100 100 rand-coords 1))
+
+(def my-flat-heat-map-vec (flatten my-heat-map-vec))
+
+(def normalized-hm-vec (normalize-seq my-flat-heat-map-vec))
+
+(def hm-img (new-image 100 100))
+
+(def hm-pixels (get-pixels hm-img))
+
+(for [i (range 0 (count normalized-hm-vec))]
+  (aset hm-pixels i (heatmap (nth normalized-hm-vec i))))
+
+(set-pixels hm-img hm-pixels)
+
+(show hm-img :zoom 3.0 :title "Isn't it beautiful?")

 ; (defn test-hm-creation
 ;   [width height coords rounds]


implement logic for parsing ext. trading actions

--- src/clj_money/import/gnucash.clj
+++ src/clj_money/import/gnucash.clj
@@ -121,23 +121,78 @@
     (= :template (:exchange commodity))
     (vary-meta assoc :ignore? true)))

-(defn- append-trading-attributes
+(defmulti ^:private append-trading-attributes
+  (fn [transaction _]
+    (case (:actions transaction)
+      #{} :none
+      #{:buy} :purchase
+      #{:buy :sell} :transfer
+      #{:split} :split
+      :unknown)))
+
+(defmethod ^:private append-trading-attributes :none
+  [transaction _]
+  (dissoc transaction :actions))
+
+(defmethod ^:private append-trading-attributes :unknown
   [transaction node]
-  (with-namespace-context namespace-map
-    (if (= :buy (:action transaction))
-      (let [commodity-item-node (first ($x "trn:splits/trn:split[split:action = \"Buy\"]" node))
-            commodity-account-node (first ($x (format "//gnc:book/gnc:account[act:id = \"%s\"]"
-                                                      ($x:text "split:account" commodity-item-node))
-                                              node))
-            symbol ($x:text "act:commodity/cmdty:id" commodity-account-node)
-            exchange (keyword (s/lower-case ($x:text "act:commodity/cmdty:space" commodity-account-node)))]
-        (assoc transaction
-               :shares (parse-decimal ($x:text "split:quantity" commodity-item-node))
-               :commodity-account-id ($x:text "split:account" commodity-item-node)
-               :account-id ($x:text "act:parent" commodity-account-node)
-               :symbol symbol
-               :exchange exchange))
-      transaction)))
+  (println "*** unknown trading transaction type ***")
+  (println (:actions transaction))
+  (println "*** unknown trading transaction type ***")
+  transaction)
+
+(defmethod ^:private append-trading-attributes :transfer
+  [transaction node]
+  (with-namespace-context namespace-map
+    (let [[to-node
+           from-node] (->> ["Buy" "Sell"]
+                           (map #(format
+                                   "trn:splits/trn:split[split:action = \"%s\"]"
+                                   %))
+                           (map #($x % node))
+                           (map first))
+          [to-account-id
+           from-account-id] (mapv #($x:text "split:account" %)
+                                 [to-node from-node])]
+      (-> transaction
+          (dissoc :actions)
+          (assoc
+            :action :transfer
+            :shares (parse-decimal ($x:text "split:quantity" to-node))
+            :value (parse-decimal ($x:text "split:value" to-node))
+            :to-account-id to-account-id
+            :from-account-id from-account-id)))))
+
+(defmethod ^:private append-trading-attributes :split
+  [transaction node]
+  (with-namespace-context namespace-map
+    (let [split-node (first ($x
+                              "trn:splits/trn:split[split:action = \"Split\"]"
+                              node))]
+      (-> transaction
+          (dissoc :actions)
+          (assoc :action :split
+                 :shares-gained (parse-decimal ($x:text "split:quantity" split-node))
+                 :commodity-account-id ($x:text "split:account" split-node))))))
+
+(defmethod ^:private append-trading-attributes :purchase
+  [transaction node]
+  (with-namespace-context namespace-map
+    (let [commodity-item-node (first ($x "trn:splits/trn:split[split:action = \"Buy\"]" node))
+          commodity-account-node (first ($x (format "//gnc:book/gnc:account[act:id = \"%s\"]"
+                                                    ($x:text "split:account" commodity-item-node))
+                                            node))
+          symbol ($x:text "act:commodity/cmdty:id" commodity-account-node)
+          exchange (keyword (s/lower-case ($x:text "act:commodity/cmdty:space" commodity-account-node)))]
+      (-> transaction
+          (dissoc :actions)
+          (assoc
+            :action :buy
+            :shares (parse-decimal ($x:text "split:quantity" commodity-item-node))
+            :commodity-account-id ($x:text "split:account" commodity-item-node)
+            :account-id ($x:text "act:parent" commodity-account-node)
+            :symbol symbol
+            :exchange exchange)))))

 (defn- refine-transaction
   [transaction node]
@@ -229,14 +284,13 @@
                                    :transform-fn parse-date}
                                   {:attribute :description
                                    :xpath "trn:description"}
-                                  {:attribute :action
+                                  {:attribute :actions
                                    :col-xpath "trn:splits/trn:split/split:action"
-                                   :transform-fn #(when (seq %)
-                                                    (-> %
-                                                        first
-                                                        :text
-                                                        s/lower-case
-                                                        keyword))}]
+                                   :transform-fn #(->> %
+                                                       (map (comp keyword
+                                                               s/lower-case
+                                                               :text))
+                                                       set)}]
                      :meta {:record-type :transaction}
                      :refine-fn refine-transaction}})


Small style change in problem57.clj

Small style change in problem57.clj

--- euler_clojure/src/euler/problem57.clj
+++ euler_clojure/src/euler/problem57.clj
@@ -23,7 +23,8 @@
   (count (str n)))

 (defn more-numerator-digits? [r]
-  (> (num-digits (numerator r)) (num-digits (denominator r))))
+  (> (num-digits (numerator r))
+     (num-digits (denominator r))))

 (defn tail
   "The repeating pattern at the end of the expansions"


use stdin for passing message to growl

use stdin for passing message to growl

--- bake/bake/notify.clj
+++ bake/bake/notify.clj
@@ -8,5 +8,5 @@
   (when-not (= "true" (get *config* "notifications.disable"))
     (try (sh "growlnotify"
              "-s" (str "cake " *current-task*)
-             "-m" (str message))
+             :in (str message))
          (catch java.io.IOException e))))


applying brandon's patch to wip

applying brandon's patch to wip

--- example/src/example/client.cljs
+++ example/src/example/client.cljs
@@ -386,7 +386,7 @@
      (when (not-empty res)
        (.debug js/console "Figwheel: loaded these files")
        (.log js/console (pr-str (map :file res)))
-       (apply on-jsload [res])))))
+       (js/setTimeout #(apply on-jsload [res]) 10)))))

 (defn default-on-compile-warning [{:keys [message] :as w}]
   (.warn js/console "Figwheel: Compile Warning -" message)


Add Pull example

Add Pull example


Make recursive inode lookup work

Make recursive inode lookup work

--- src/main/cljs/lean_map/core.cljs
+++ src/main/cljs/lean_map/core.cljs
@@ -118,7 +118,7 @@
             (aget arr (inc (* 2 idx)))
             not-found))
         (not (zero? (bit-and nodemap bit)))
-        (.inode-lookup (node-at arr nodemap bit) (+ shift 5) hash key not-found)
+        (.inode-lookup (aget arr (node-at arr nodemap bit)) (+ shift 5) hash key not-found)
         :else
         not-found)))


Removed test code that was breaking box! drawer

Doesn't work in a more constructive way now :)

--- go-fighweel/src/cloj/lwjgl/render.clj
+++ go-fighweel/src/cloj/lwjgl/render.clj
@@ -54,12 +54,12 @@
 (defn draw-quad [x y w h r g b a]
   (let [w 1000
         h 1000
-        r 0
-        g 0
-        b 0
+        r r
+        g g
+        b b
         a 1]
+    (GL11/glBegin GL11/GL_QUADS)
     (GL11/glColor4f r g b a)
-    (GL11/glBegin GL11/GL_QUADS)
     (GL11/glVertex2f x y)
     (GL11/glVertex2f x (+ y h))
     (GL11/glVertex2f (+ x w) (+ y h))


Add optimized version of index-by.

Add optimized version of index-by.

--- frontend/uxbox/util/data.cljs
+++ frontend/uxbox/util/data.cljs
@@ -6,47 +6,13 @@
 ;; Data structure manipulation
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-;; NOTE: commented because tansients are buggy in cljs?
-;; (defn index-by
-;;   "Return a indexed map of the collection
-;;   keyed by the result of executing the getter
-;;   over each element of the collection."
-;;   [coll getter]
-;;   (let [data (transient {})]
-;;     (run! #(do
-;;              (println (getter %))
-;;              (assoc! data (getter %) %)) coll)
-;;     (println "test1:" (keys data))
-;;     (let [r (persistent! data)]
-;;       (println "test2:" (keys r))
-;;       r)))
-
-;; (defn index-by
-;;   "Return a indexed map of the collection
-;;   keyed by the result of executing the getter
-;;   over each element of the collection."
-;;   [coll getter]
-;;   (let [data (transient {})]
-;;     (loop [coll coll]
-;;       (let [item (first coll)]
-;;         (if item
-;;           (do
-;;             (assoc! data (getter item) item)
-;;             (recur (rest coll)))
-;;           (let [_ 1 #_(println "test1:" (keys data))
-;;                 r (persistent! data)]
-;;             (println "test2:" (keys r))
-;;             r))))))
-
 (defn index-by
   "Return a indexed map of the collection
   keyed by the result of executing the getter
   over each element of the collection."
   [coll getter]
-  (reduce (fn [acc item]
-            (assoc acc (getter item) item))
-          {}
-          coll))
+  (persistent!
+   (reduce #(assoc! %1 (getter %2) %2) (transient {}) coll)))

 (def ^:static index-by-id #(index-by % :id))


Add core helper for stress/spam.

Add core helper for stress/spam.

--- src/clj/com/draines/postal/core.clj
+++ src/clj/com/draines/postal/core.clj
@@ -1,6 +1,7 @@
 (ns com.draines.postal.core
   (:use [com.draines.postal.sendmail :only [sendmail-send]]
-        [com.draines.postal.smtp :only [smtp-send]]))
+        [com.draines.postal.smtp :only [smtp-send]]
+        [com.draines.postal.stress :only [spam]]))

 (defn send-message [msg]
   (when-not (and (:from msg)
@@ -13,3 +14,16 @@
     (smtp-send msg)
     (sendmail-send msg)))

+(defn stress [profile]
+  (let [defaults {:host "localhost"
+                  :port 25
+                  :from "foo@lolz.dom"
+                  :to "bar@lolz.dom"
+                  :num 1
+                  :delay 100
+                  :threads 1}
+        {:keys [host port from to num delay threads]}
+        (merge defaults profile)]
+    (println (format "sent %s msgs to %s:%s"
+                     (spam host port from to num delay threads)
+                     host port))))


Check for sane message.

Check for sane message.

--- src/clj/com/draines/postal/core.clj
+++ src/clj/com/draines/postal/core.clj
@@ -3,6 +3,11 @@
         [com.draines.postal.smtp :only [smtp-send]]))

 (defn send-message [msg]
+  (when-not (and (:from msg)
+                 (:to msg)
+                 (:subject msg)
+                 (:body msg))
+    (throw (Exception. "message needs at least :from, :to, :subject, and :body")))
   (if (:host msg)
     (smtp-send msg)
     (sendmail-send msg)))


refactoring

refactoring

--- src/cljs/salava/badge/ui/modal.cljs
+++ src/cljs/salava/badge/ui/modal.cljs
@@ -20,15 +20,12 @@
             [salava.badge.ui.verify :refer [check-badge]]
             [salava.core.ui.tag :as tag]))

-(declare show-settings-dialog)
-(declare badge-content)

 (defn init-badge-connection [state badge-id]
   (ajax/GET
    (path-for (str "/obpv1/social/connected/" badge-id))
    {:handler (fn [data]
-               (swap! state assoc :receive-notifications data)
-                )}))
+               (swap! state assoc :receive-notifications data))}))

 (defn init-data [state id tab-no]
   (ajax/GET
@@ -40,11 +37,7 @@
                                 :content-language (init-content-language (:content data))
                                 :tab-no tab-no
                                 :permission "success"))
-                 (init-badge-connection state (:badge_id data))
-                 (cond
-                   (== 2 (:tab-no @state))(show-settings-dialog id state init-data "settings")
-                   (== 3 (:tab-no @state))(show-settings-dialog id state init-data "share")
-                   )))}
+                 (init-badge-connection state (:badge_id data))))}
     (fn [] (swap! state assoc :permission "error"))))

 (defn show-settings-dialog [badge-id state init-data context]
@@ -53,11 +46,10 @@
     {:handler (fn [data]
                 (swap! state assoc :badge-settings data (assoc data :new-tag ""))
                 (if (= context "settings")
-                  (swap! state assoc :tab [se/settings-tab-content data state init-data true]
+                  (swap! state assoc :tab [se/settings-tab-content data state init-data]
                                      :tab-no 2)
                   (swap! state assoc :tab [se/share-tab-content data state init-data]
-                                     :tab-no 3)
-                  ))}))
+                                     :tab-no 3)))}))

 (defn congratulate [state]
   (ajax/POST
@@ -67,14 +59,13 @@
 (defn badge-endorsement-modal-link [badge-id endorsement-count]
   (when (pos? endorsement-count)
     [:div.endorsement-link
-      [:span [:i {:class "fa fa-handshake-o"}]]
-      [:a;.endorsementlink {:class "endorsement-link"
-                           {:href "#"
-                           :on-click #(do (.preventDefault %)
-                                        (mo/open-modal [:badge :endorsement] badge-id))}
-       (if (== endorsement-count 1)
-         (str  endorsement-count " " (t :badge/endorsement))
-         (str  endorsement-count " " (t :badge/endorsements)))]]))
+     [:span [:i {:class "fa fa-handshake-o"}]]
+     [:a {:href "#"
+          :on-click #(do (.preventDefault %)
+                       (mo/open-modal [:badge :endorsement] badge-id))}
+      (if (== endorsement-count 1)
+        (str  endorsement-count " " (t :badge/endorsement))
+        (str  endorsement-count " " (t :badge/endorsements)))]]))

 (defn issuer-modal-link [issuer-id name]
   [:div {:class "issuer-data clearfix"}


Push type/item maps rather than just items on :return stack

--- src/clojush/instructions/return.clj
+++ src/clojush/instructions/return.clj
@@ -9,7 +9,7 @@
     (if (empty? (type state))
       state
       (let [item (top-item type state)]
-        (push-item item :return (pop-item type state))))))
+        (push-item {:type type :item item} :return (pop-item type state))))))

 (define-registered return_fromexec (with-meta (returner :exec) {:stack-types [:environment :exec] :parentheses 1}))
 (define-registered return_frominteger (with-meta (returner :integer) {:stack-types [:environment :integer]}))
@@ -96,4 +96,3 @@
             new-env (assoc top-env :tag (:tag state))]
         (push-item new-env :environment (pop-item :environment state))))))

-


added a ?group uri param to filter games


Add print support for records.

Add print support for records.


Used when some instead of reduce.

Used when some instead of reduce.

Aaron Miller pointed out that this is better way of clojure'ing.

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -126,12 +126,10 @@
                (swap! vis #(dissoc-in % [:chs result-ch :msgs result-msg]))
                (when (nil? result-msg) ; The ch is closed.
                  (swap! vis #(dissoc-in % [:chs result-ch])))
-               (reduce (fn [acc ch-binding]
-                         (if acc acc
-                             (when (and (not (seq? ch-binding))
-                                        (= result-ch ch-binding))
-                               [[:msg-move result-msg :ch result-ch :actx actx]])))
-                       nil ch-bindings)))}})
+               (when (some #(and (not (seq? ch-binding))
+                                 (= result-ch ch-binding))
+                           ch-bindings)
+                 [[:msg-move result-msg :ch result-ch :actx actx]])))}})

 ;; ------------------------------------------------


delete directories

delete directories

--- src/cetcd/core.clj
+++ src/cetcd/core.clj
@@ -63,8 +63,11 @@
                                   {:waitIndex waitIndex}))
            :callback callback))

-(defn delete-key! [key & {:keys [callback]}]
-  (api-req :delete (format "keys/%s" key) :callback callback))
+(defn delete-key! [key & {:keys [recursive callback]
+                          :or {recursive false}}]
+  (api-req :delete (format "keys/%s" key)
+           :query-params {:recursive recursive}
+           :callback callback))

 (defn compare-and-swap! [key value conditions & {:keys [ttl callback dir] :as opts}]
   (apply-map set-key! key value :cas conditions opts))


Optimize imports

Optimize imports

--- src/discuss/communication/main.cljs
+++ src/discuss/communication/main.cljs
@@ -3,6 +3,7 @@
   (:require [ajax.core :refer [GET POST]]
             [goog.string :refer [htmlEscape]]
             [clojure.walk :refer [keywordize-keys]]
+            [clojure.string :refer [join]]
             [discuss.config :as config]
             [discuss.utils.common :as lib]))

@@ -188,5 +189,5 @@

    ** TODO: Update route **"
   [slug arg-id]
-  (let [url (clojure.string/join "/" ["api" slug "jump" arg-id])]
+  (let [url (join "/" ["api" slug "jump" arg-id])]
     (ajax-get-and-change-view url :discussion)))


Don't really need kleen* tests.

Don't really need kleen* tests.

--- src/kolmogorov_music/kolmogorov.clj
+++ src/kolmogorov_music/kolmogorov.clj
@@ -57,11 +57,6 @@
 (defn subsequence [start end s]
   (->> s (drop start) (take (- end start))))

-(fact "The Kleene star describes all possible sequences of a set of elements."
-  (->> #{} kleene* (subsequence 0 1)) => [[]]
-  (->> #{true} kleene* (subsequence 0 5)) => [[] [true] [true true] [true true true] [true true true true]]
-  (->> #{true false} kleene* (subsequence 0 5)) => [[] [true] [false] [true true] [true false]])
-
 (fact "We can construct all strings as a lazy sequence."
   (->> (lexicon) (subsequence 0 5)) => ["" " " "!" "\"" "#"]
   (->> (lexicon) (subsequence 95 100)) => ["~" "  " " !" " \"" " #"]


resolve conflict

resolve conflict

--- src/leiningen/new/figwheel/user.clj
+++ src/leiningen/new/figwheel/user.clj
@@ -22,7 +22,7 @@
 (defn fig-start
   "This starts the figwheel server and watch based auto-compiler."
   []
-  ;; this call will only work are long as your :cljsbuild and
+  ;; this call will only work as long as your :cljsbuild and
   ;; :figwheel configurations are at the top level of your project.clj
   ;; and are not spread across different lein profiles


Properly handle filenames with spaces, fix #12

--- src/main/clojure/powderkeg/core.clj
+++ src/main/clojure/powderkeg/core.clj
@@ -93,7 +93,7 @@
             ; not spark-submitted
             (.setJars conf
               (into-array
-                (map #(str (.toURL %))
+                (map #(str (.toURI %))
                   (conj
                     (guess-all-jars-but-spark)
                     (package-env!))))))


fix compile-cond to really throw when no match and fix the failing test with 1.5

--- src/main/clojure/powderkeg/core.clj
+++ src/main/clojure/powderkeg/core.clj
@@ -85,8 +85,8 @@
 (defmacro ^:private compile-cond [& choices]
   (let [x (Object.)
         expr
-        (reduce (fn [_ [test expr]]
-                  (when (eval test) (reduced expr)))
+        (reduce (fn [x [test expr]]
+                  (if (eval test) (reduced expr) x))
           x (partition 2 choices))]
     (when (= x expr)
       (throw (ex-info "No valid choice." {:form &form})))
@@ -342,7 +342,7 @@
                   (compile-cond
                     (has-method? org.apache.spark.api.java.function.FlatMapFunction '[java.util.Iterator "call" [?]])
                     (.iterator ((df) it))
-                    (has-method? org.apache.spark.api.java.function.FlatMapFunction '[Iterable "call" [?]])
+                    (has-method? org.apache.spark.api.java.function.FlatMapFunction '[java.lang.Iterable "call" [?]])
                     ((df) it))))
               preserve-partitioning)]
     rdd))


make the ball small and circle around hero

--- src/mccarthy_animation/core.cljc
+++ src/mccarthy_animation/core.cljc
@@ -77,7 +77,7 @@
   (quil/image (:bg state) 0 0)

   ;; bg fill color
-  (quil/fill (:color state) 255 255)
+  ;(quil/fill (:color state) 255 255)

   ;;(js/console.log (str "hero: " (:position (:hero state))))

@@ -90,13 +90,13 @@

   ;; calculate x and y coordinates of the circle.
   (let [angle (:angle state)
-        x (* 150 (quil/cos angle))
-        y (* 150 (quil/sin angle))]
+        x (* 50 (quil/cos angle)) ; distance from center
+        y (* 50 (quil/sin angle))]

-    ;; Move origin point to the center of the sketch.
-    (quil/with-translation [(/ (quil/width) 2)
-                         (/ (quil/height) 2)]
-      (quil/ellipse x y 100 100) ) ; draw the circle
+    ;; Move origin point to the center of the hero
+    (quil/with-translation [(get-in state [:hero :position :x]) (get-in state [:hero :position :y])]
+      (quil/ellipse x y 16 16) ; ball size
+      )
     )

   ;; draw the text?


Allow nil slack mirror in board to turn it off.

--- src/oc/storage/resources/common.clj
+++ src/oc/storage/resources/common.clj
@@ -68,7 +68,7 @@
   :access AccessLevel
   :authors [lib-schema/UniqueID]
   :viewers [lib-schema/UniqueID]
-  (schema/optional-key :slack-mirror) lib-schema/SlackChannel
+  (schema/optional-key :slack-mirror) (schema/maybe lib-schema/SlackChannel)
   :author lib-schema/Author
   :created-at lib-schema/ISO8601
   :updated-at lib-schema/ISO8601})


Add another live-sequenser

Add another live-sequenser

--- src/overtone_workspace/grunbles.clj
+++ src/overtone_workspace/grunbles.clj
@@ -99,7 +99,8 @@
     (apply-by (metro (inc beat)) #'latchbellplayer (inc beat) [])
     ))
 ;; (init-latchbell-mod (:rate @latchbell-arg))
-;; (latchbellplayer (metro))
+
+;; (Latchbellplayer (metro))
 ;; (stop)

 (comment
@@ -124,6 +125,7 @@
 (def _ 0)
 (def beats {laserbeam [1 _ _ _ _ _ _ 1 _ _ 1 _ _ _ _ 1]
             latchbell [1 _ 1 _ 1 _ 1 _ 1 _ 1 _ 1 _ _ 1]})
+; (def beats {laserbeam [1 _ _ _ _ _ _ 1 _ _ 1 _ _ _ _ 1]})

 (def *beats (atom beats))

@@ -134,44 +136,83 @@
 ;   (let [next-beat (+ scale beat)]
 ;     (apply-by (nome next-beat) live-sequencer [nome next-beat live-patterns scale (inc idx)])))

+; (defn live-sequencer [nome beat live-patterns scale idx]
+;   (doseq [[sound pattern] @live-patterns
+;           :let [v (nth pattern (mod idx (count pattern)))
+;                 v (cond
+;                     (= 1 v)
+;                     []
+;
+;                     (map? v)
+;                     (flatten1 v)
+;
+;                     :else
+;                     nil)]
+;           :when v]
+;     (at (nome beat) (apply sound v)))
+;   (let [next-beat (+ scale beat)]
+;     (apply-by (nome next-beat) live-sequencer [nome next-beat live-patterns scale (inc idx)])))
+
+
 (defn flatten1
   "Takes a map and returns a seq of all the key val pairs:
       (flatten1 {:a 1 :b 2 :c 3}) ;=> (:b 2 :c 3 :a 1)"
   [m]
   (reduce (fn [r [arg val]] (cons arg (cons val r))) [] m))

-
-(defn live-sequencer [nome beat live-patterns scale idx]
-  (doseq [[sound pattern] @live-patterns
-          :let [v (nth pattern (mod idx (count pattern)))
-                v (cond
-                    (= 1 v)
-                    []
-
-                    (map? v)
-                    (flatten1 v)
-
-                    :else
-                    nil)]
-          :when v]
-    (at (nome beat) (apply sound v)))
-  (let [next-beat (+ scale beat)]
-    (apply-by (nome next-beat) live-sequencer [nome next-beat live-patterns scale (inc idx)])))
-
-(def a {:rate 100 :amp 0.5 :time-scale-max 10})
-(def a {:rate 2 :amp 0.05 :time-scale-max 5})
+(defn normalise-beat-info
+  [beat]
+  (cond
+   (= 0 beat)         nil
+   (= 1 beat)         {}
+   (map? beat)        beat
+   (sequential? beat) beat
+   :else              {}))
+
+(defn schedule-pattern
+  [curr-t pat-dur sound pattern]
+  {:pre [(sequential? pattern)]}
+  (let [beat-sep-t (/ pat-dur (count pattern))]
+    (doseq [[beat-info idx] (partition 2 (interleave pattern (range)))]
+      (let [beat-t    (+ curr-t (* idx beat-sep-t))
+            beat-info (normalise-beat-info beat-info)]
+        (if (sequential? beat-info)
+          (schedule-pattern beat-t beat-sep-t sound beat-info)
+          (at beat-t (when beat-info (apply sound (flatten1 beat-info)))))))))
+
+(defn live-sequencer
+  [curr-t pat-dur live-patterns]
+  (doseq [[sound pattern] @live-patterns]
+    (schedule-pattern curr-t pat-dur sound pattern))
+  (let [new-t (+ curr-t pat-dur)]
+    (apply-by new-t #'live-sequencer [new-t pat-dur live-patterns])))
+
+(def a {:rate 100 :amp 0.2 :time-scale-max 10})
+(def a {:rate 2 :amp 0.2 :time-scale-max 10})
 (def b {:pan -1 :freq 1000})
 (def c {:freq 25000 :amp 0.2})
 (def d {:amp 3.0 :dur 0.25})
+(def g {:freq-mul 0.25})

 (metro :bpm 110)
-(volume 0.5)
+(volume 0.25)
+
+(comment
+  (live-sequencer (now) 2000 *beats)
+  (init-latchbell-mod (:rate @latchbell-arg))
+
+  (swap! *beats assoc laserbeam [d _ _ [d d] (vec (repeat 128 0.8)) _ _ d _ _ d _ b _ _ [d d d]])
+  (swap! *beats assoc laserbeam [_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _])
+  (swap! *beats assoc latchbell [a _ a _ a _ a _ a _ a _ a _ a _])
+  (swap! *beats assoc latchbell (vec (repeat 128 a)))
+  (swap! *beats assoc laserbeam [d c c c b c c d c c d c b c c d])
+  (swap! *beats assoc grumble [g _ _ _ _ _ _ _ _  _ _ _ _ _ _ _])
+
+  (reset! *beats beats)
+  (stop))
+
 (comment
   (live-sequencer metro (metro) *beats 1/4 0)
-
-  (swap! *beats assoc laserbeam [d _ _ _ b _ _ d _ _ d _ b _ _ d])
-  (swap! *beats assoc latchbell [a _ a _ a _ a _ a _ a _ a _ a _])
-  (swap! *beats assoc laserbeam [d c c c b c c d c c d c b c c d])
-
-  (reset! *beats beats)
   (stop))
+
+(odoc metronome)


Comment change.

Comment change.

--- src/oc/storage/util/generate.clj
+++ src/oc/storage/util/generate.clj
@@ -71,7 +71,7 @@
           :body
           (s/replace #"(~|`|!|@|#|$|%|^|&|\*|\(|\)|\{|\}|\[|\]|;|:|\"|'|<|,|\.|>|\?|\/|\\|\||-|_|\+|=)" "") ; punctuation
           (s/split #" "))
-    (drop 8) ; first 8 don't change
+    (drop 8) ; first 8 words don't change so we don't want them
     (take (inc (int (* (rand) size))))
     (s/join " ")))


Move the state control logic into a state machine

--- src/onyx/messaging/netty_tcp.clj
+++ src/onyx/messaging/netty_tcp.clj
@@ -233,7 +233,6 @@
         ch (.channel ch-fut)]
     (if (and (.isSuccess ch-fut)
              (established? ch))
-      ;; should set to connected now and then flush pending messages
       ch
       (do (.close ch)
           nil))))
@@ -312,92 +311,106 @@
       (recur)))
   (.flush channel))

-(defprotocol ConnectionManager
+(defprotocol IConnectionManager
   (connect [_])
   (write [connection buf])
-  (reset-connection [_ previous-link-val])
+  (reset-connection [_])
   (enqueue-pending [_ buf])
   (close [_]))
+
+(defprotocol IConnectionState
+  (initializing [this])
+  (reset [this])
+  (connecting [this])
+  (failed [this])
+  (connected [this]))

 (defn add-failed-check
   "Check if the future failed. link-val is used as a staleness check
   for the connection as it should not be reset if it has already been reset."
-  [f connection link-val buf]
+  [f connection buf]
   (.addListener f (reify GenericFutureListener
                     (operationComplete [_ _]
                       (when-not (.isSuccess f)
                         (timbre/error "Message failed to send: " (.cause f))
-                        (reset-connection connection link-val))))))
+                        (reset-connection connection))))))
+

 (defn make-pending-chan [messenger]
   (chan (sliding-buffer (:pending-buffer-size messenger))))

-(defrecord Connection [messenger site link]
-  ConnectionManager
-  (reset-connection [connection previous-link-val]
-    (when (compare-and-set! link
-                            previous-link-val
-                            {:state :reset
-                             :pending-ch (make-pending-chan messenger)})
+(defrecord ConnectionState [state]
+  IConnectionState
+  (initializing [_]
+    (compare-and-set! state :initializing :connecting))
+  (reset [_]
+    (compare-and-set! state :connected :reset))
+  (connecting [_]
+    (or (compare-and-set! state :reset :connecting)
+        (compare-and-set! state :initializing :connecting)
+        (compare-and-set! state :failed :connecting)))
+  (failed [_]
+    (compare-and-set! state :connecting :failed))
+  (connected [_]
+    (compare-and-set! state :connecting :connected)))
+
+(defrecord ConnectionManager [messenger site state pending-ch channel]
+  IConnectionManager
+  (reset-connection [connection]
+    (when (reset state)
+      (reset! pending-ch (make-pending-chan messenger))
+      (reset! channel nil)
       (connect connection)))

   (enqueue-pending [connection buf]
-    (let [link-val @link
-          channel ^Channel (:channel link-val)]
-      (case (:state link-val)
-        :initializing (>!! (:pending-ch link-val) buf)
-        :connecting (>!! (:pending-ch link-val) buf)
-        :reset (connect connection)
-        :failed (connect connection)
-        ;; may have finished connecting in the time between
-        ;; so we should check if it's established now before trying to reconnect
-        :connected (if (established? channel)
-                     (.writeAndFlush channel buf (.voidPromise channel))
-                     (reset-connection connection link-val)))))
+    (case @(:state state)
+      :initializing (>!! @pending-ch buf)
+      :connecting (>!! @pending-ch buf)
+      :reset (connect connection)
+      :failed (connect connection)
+      ;; may have finished connecting in the time between
+      ;; so we should check if it's established now before trying to reconnect
+      :connected (let [channel-val @channel]
+                   (if (established? channel-val)
+                     (.writeAndFlush channel-val buf (.voidPromise channel-val))
+                     (reset-connection connection)))))

   (write [connection buf]
-    (let [link-val @link
-          channel ^Channel (:channel link-val)]
-      (if (and channel (.isActive channel))
-        (let [fut (.writeAndFlush channel ^ByteBuf buf)]
-          (add-failed-check fut connection link-val ^ByteBuf buf))
+    (let [channel-val ^Channel @channel]
+      (if (and channel-val (.isActive channel-val))
+        (let [fut (.writeAndFlush channel-val ^ByteBuf buf)]
+          (add-failed-check fut connection ^ByteBuf buf))
         (enqueue-pending connection buf))))

   (close [_]
-    (some-> @link :channel .close)
-    (some-> @link :pending-ch close!))
+    (some-> @channel .close)
+    (some-> @pending-ch close!))

   (connect [_]
-    ; Ensures only a single thread will connect by only allowing the connection that performed
-    ; the CAS to go ahead and connect.
-    ; The spawned future will be the one to set the channel in the peer-link.
-    ; All sending threads will continue on adding to the pending-ch until the
-    ; connection has been established
-    (let [link-val @link
-          state (:state link-val)
-          connecting-link-val (assoc link-val :state :connecting)]
-      (when (#{:initializing :reset :failed} state)
-        (when (compare-and-set! link link-val connecting-link-val)
-          (future
-            (if-let [channel (create-client (:client-group messenger) (:netty/external-addr site) (:netty/port site))]
-              (let [pending-ch (:pending-ch connecting-link-val)
-                    connected-link-val (assoc connecting-link-val
-                                              :channel channel
-                                              :state :connected
-                                              :pending-ch nil)
-                    was-set? (compare-and-set! link connecting-link-val connected-link-val)]
-                (assert was-set?)
-                (flush-pending channel pending-ch))
-              (reset! link {:state :failed
-                            :pending-ch (make-pending-chan messenger)}))))))))
+    ; The state machine decides who gets to connect to ensure only one thread
+    ; will connect, and the remaining will write out to the pending channel
+    (when (connecting state)
+      (future
+        (if-let [opened-channel (create-client (:client-group messenger)
+                                               (:netty/external-addr site)
+                                               (:netty/port site))]
+          (let [connected? (connected state)]
+            (assert connected?)
+            (flush-pending opened-channel @pending-ch)
+            (reset! channel opened-channel))
+          (do
+            (failed state)
+            (reset! channel nil)
+            (reset! pending-ch (make-pending-chan messenger))))))))

 (defmethod extensions/connect-to-peer NettyTcpSockets
   [messenger event site]
   (doto
-    (->Connection messenger
-                  site
-                  (atom {:state :initializing
-                         :pending-ch (make-pending-chan messenger)}))
+    (->ConnectionManager messenger
+                         site
+                         (->ConnectionState (atom :initializing))
+                         (atom (make-pending-chan messenger))
+                         (atom nil))
     connect))

 (defmethod extensions/receive-messages NettyTcpSockets
@@ -412,13 +425,6 @@
           segments)
         segments))))

-; (defn reset-connection-enqueue [messenger event peer-link buf]
-;   (let [site (:site link-val)
-;         peer-link-new (extensions/initialize-peer-link messenger event site)
-;         link-val (reset! peer-link peer-link-new)]
-;     (>!! (:pending-ch link-val) buf)
-;     (extensions/connect-to-peer messenger event peer-link site)))
-
 (defmethod extensions/send-messages NettyTcpSockets
   [messenger event peer-link messages]
   (write peer-link (protocol/build-messages-msg-buf (:compress-f messenger) messages)))


extract/cites.clj: added "cite" class to HTML links

--- src/org/altlaw/extract/cites.clj
+++ src/org/altlaw/extract/cites.clj
@@ -12,7 +12,7 @@
     (loop []
       (if (.find matcher)
         (let [cite (.group matcher)
-              link (str "<a href=\"/cite/" (URLEncoder/encode cite)
+              link (str "" cite "")]
           (.appendReplacement matcher buffer link)
           (recur))


Some tweaks

Some tweaks

--- src/overtone_workspace/beats.clj
+++ src/overtone_workspace/beats.clj
@@ -30,7 +30,7 @@
       (let [idx (Math/floor (* x (count logistics-scale)))
             note (nth logistics-scale idx)
             freq (midi->hz note)
-            dur (* 4/8 (/ 60.0 (metro :bpm)))
+            dur (* 1 4/8 (/ 60.0 (metro :bpm)))
             next-beat (+ 2/8 beat)
             next-x (* logistics-r x (- 1 x))] ;; x = r * x * (1 - x)
         (if (< 0 (rand-int 3))
@@ -179,6 +179,7 @@
   (swap! *beats assoc latchbell [a a  a  a [a a a]])
   (swap! *beats assoc laserbeam [d c c c b c c d c c d c b c c d])
   (swap! *beats assoc laserbeam (take 16 (cycle [d b c d c b [d] c c [c c c] d])))
+  (swap! *beats assoc laserbeam (take 16 (cycle [b [d d] [c c c c c] d [d d]])))
   (swap! *beats assoc laserbeam (vec (repeat 16 c)))
   (swap! *beats assoc grumble [g _ _ _ _ _ _ _ _  _ _ _ _ _ _ _])
   (swap! *beats assoc kick [[1 _ _ [1 1]] [_ _ _ 1] [_ _ 1 _] [_ _ _ [1 1 1]]])
@@ -209,6 +210,7 @@
 (def *fn-beats (atom fn-beats))
 (comment
   (start-live-fn-sequencer (sequencer-metro (next-beat (sequencer-metro) 0 (* 8 beat-per-pattern))) (* 1 beat-per-pattern) *fn-beats "fn-beats")
+  (stop-live-sequencer "fn-beats")
   ;;(live-fn-sequencer (now) 4 *fn-beats "fn-beats")
   (swap! *fn-beats assoc ambi-rand [_])
   (swap! *fn-beats assoc ambi-rand [1 _ 1 _ 1 _ 1 _ 1 _ 1 _ 1 _ 1 _])
@@ -217,6 +219,7 @@
   (swap! *fn-beats assoc rand-laser (vec (repeat 16 1)))
   (swap! *fn-beats assoc rand-laser [_])
   (swap! *fn-beats assoc rand-latchbell (vec (repeat 8 1)))
+  (swap! *fn-beats assoc rand-latchbell (vec (repeat 16 1)))
   (swap! *fn-beats assoc rand-latchbell [_])
   (do
     ;; prob-beats
@@ -224,6 +227,10 @@
     (swap! *fn-beats assoc prob-sd (take 32 (cycle [0 0 1.1 0 1.1 0 6 0 6 0 1.1 0 1.1 0 6 0])))
     (swap! *fn-beats assoc prob-hat (take 32 (cycle [10 2 8 2 1 2])))
     (swap! *fn-beats assoc prob-openhh (take 32 (cycle [0 0 0 0 5 0 0 0 0 0 0 0 0 0 5 0]))))
+  (swap! *fn-beats assoc prob-openhh [10])
+  (swap! *fn-beats assoc prob-kick [10])
+  (swap! *fn-beats assoc prob-sd [[[0] [10 _ _ [8]] ] [0 10]])
+
   (do
     (swap! *fn-beats assoc prob-kick [_])
     (swap! *fn-beats assoc prob-sd [_])


Explicitly set player's current room.

Explicitly set player's current room.

--- src/isla/story.clj
+++ src/isla/story.clj
@@ -8,7 +8,6 @@

 (declare types name-into-objs extract-by-class get-story-ctx)

-  (get-current-room [this])
 (defprotocol Queryable
   (get-all-items [this])
   (get-item [this name]))
@@ -18,8 +17,6 @@
   (look [this arguments]))

 (defrecord Story [player rooms]
-  (get-current-room [this]
-    (first (filter (fn [x] (= (:order x) (:current-room player))) rooms)))
   Queryable
   (get-all-items [this]
     (concat (map (fn [x] (:items x)) rooms)))
@@ -35,7 +32,7 @@
   ;;   (println "move!"))
   (look [this arguments]
     (if (nil? arguments)
-      (:summary (get-current-room this))
+      (:summary (get player :room))
       (let [arguments-vec (str/split arguments #" ")]
         (if (= "at" (first arguments-vec))
           (if-let [item (get-item this (second arguments-vec))]
@@ -46,8 +43,8 @@
 (defrecord Monster [name summary])
 (def monster-defaults ["" ""])

-(defrecord Player [name summary current-room])
-(def player-defaults ["" "" 0])
+(defrecord Player [name summary room])
+(def player-defaults ["" "" :undefined])

 (defrecord Room [name summary order items])
 (def room-defaults ["" "" 0 []])


update good-enough? and apply sgn for results

--- ann/src/ann/ab.clj
+++ ann/src/ann/ab.clj
@@ -24,7 +24,7 @@

 (defn good-enough?
   [delta]
-  (let [result (< (abs delta) 0.1)]
+  (let [result (< (abs delta) 0.9)]
     (log "Good-enough?" delta result)
     result))

@@ -85,7 +85,7 @@

   (defn gen
     [inputs]
-    ; (println (calc inputs perceptron))
+    (println (sgn (calc inputs my-perceptron)))
     )

   (gen [1 1])


Have load-facts return count of errors (for lein-midje)

--- src/midje/repl.clj
+++ src/midje/repl.clj
@@ -9,6 +9,8 @@
             [midje.clojure-test-facade :as ctf]
             [midje.ideas.facts :as fact]
             [midje.ideas.reporting.levels :as levelly]
+            ;; This is so gross. The reporting stuff needs to be fixed.
+            [midje.ideas.reporting.string-format :as string-format]
             [midje.ideas.metadata :as metadata]
             [midje.internal-ideas.compendium :as compendium]
             [midje.internal-ideas.project-state :as project-state]
@@ -204,8 +206,8 @@
           ;; come from the last-loaded namespace.
           (levelly/report-changed-namespace ns)
           (require ns :reload))
-        (levelly/report-summary (ctf/run-clojure-test namespaces)))
-      nil))
+        (levelly/report-summary (ctf/run-clojure-test namespaces))
+        (string-format/previous-failure-count))))
   "Load given namespaces, as in:
      (load-facts 'midje.t-sweet 'midje.t-repl)


split out cljs.spec from clojure.spec in spec.cljc

Covers 485356186d13c3cfc12c3212a421924f7bd2af73.

--- src/onyx/spec.cljc
+++ src/onyx/spec.cljc
@@ -1,6 +1,7 @@
 (ns onyx.spec
-  (:require [clojure.spec :as s]
-            [clojure.future :refer [any? boolean? uuid?]]
+  (:require #?(:clj [clojure.spec :as s]
+               :cljs [cljs.spec :as s :refer-macros [coll-of]])
+            #?(:clj [clojure.future :refer [any? boolean? uuid?]])
             [onyx.information-model :as i]
             [onyx.refinements :as r]
             [onyx.triggers :as t]))
@@ -14,6 +15,8 @@

 (defn namespaced-keyword? [x]
   (and (keyword? x) (namespace x)))
+
+(s/def :onyx/name keyword?)

 (defn pos-int? [x]
   (and (integer? x) (pos? x)))
@@ -54,8 +57,6 @@
 (s/def :onyx/min-peers pos-int?)

 (s/def :onyx/n-peers pos-int?)
-
-(s/def :onyx/name keyword?)

 (s/def :onyx/params
   (s/coll-of keyword? :kind vector?))
@@ -587,7 +588,7 @@
                 :onyx.peer/state-log-impl
                 :onyx.peer/state-filter-impl
                 :onyx.peer/tags
-                :onyx.peer/trigger-timer-resolution
+                :onyx.peer/trigger-timer-resolution
                 :onyx.messaging/peer-port
                 :onyx.messaging/external-addr
                 :onyx.messaging/inbound-buffer-size


no default method in ring

no default method in ring

--- modules/reitit-ring/src/reitit/ring.cljc
+++ modules/reitit-ring/src/reitit/ring.cljc
@@ -129,7 +129,7 @@
        (fn
          ([request]
           (if-let [match (r/match-by-path router (:uri request))]
-            (let [method (:request-method request :any)
+            (let [method (:request-method request)
                   path-params (:path-params match)
                   result (:result match)
                   handler (-> result method :handler (or default-handler))
@@ -141,7 +141,7 @@
             (default-handler request)))
          ([request respond raise]
           (if-let [match (r/match-by-path router (:uri request))]
-            (let [method (:request-method request :any)
+            (let [method (:request-method request)
                   path-params (:path-params match)
                   result (:result match)
                   handler (-> result method :handler (or default-handler))


Fixed issue in speaker ui

Fixed issue in speaker ui

--- src/tango/cljs/speaker/core.cljs
+++ src/tango/cljs/speaker/core.cljs
@@ -106,10 +106,9 @@
     [this]
     (let [{:keys [heat-number starting]} (om/props this)]
       (dom/div #js {:className "Row"}
-        (dom/h4 #js {:className "col-xs-2"} (str "Heat " heat-number ":"))
-        (dom/div #js {:className "col-xs-8"}
-                 (map #(dom/h4 #js {:className "col-xs-1"} (:participant/number %)) starting))
-        (dom/h4 #js {:className "col-xs-2"} (str "(" (count starting) " couples)"))))))
+        (dom/h4 #js {:className "col-xs-2"} (str "Heat " heat-number " (" (count starting) "):"))
+        (dom/div #js {:className "col-xs-10"}
+                 (map #(dom/h4 #js {:className "col-xs-1"} (:participant/number %)) starting))))))

 (defui HeatsComponent
   static om/IQuery


Fixup mail init

Fixup mail init

--- src/yetibot/core/models/mail.clj
+++ src/yetibot/core/models/mail.clj
@@ -24,8 +24,8 @@
 ;; TODO - move into start
 (when (configured?)
   (def store (gen-store))
-  (let [{:keys user pass} (:value (config))]
-  (auth! user pass))
+  (let [{:keys [user pass]} (:value (config))]
+    (auth! user pass)))

 (def pool (mk-pool))
 (def poll-interval (* 1000 60))


Fix dpkg warning

Fix dpkg warning

--- tasks/leiningen/fatdeb.clj
+++ tasks/leiningen/fatdeb.clj
@@ -82,7 +82,6 @@
     (write (file dir "DEBIAN" "conffiles")
            (join "\n" ["/etc/cyanite/cyanite.yaml"
                        "/etc/cyanite/aggregator.yaml"
-                       "/etc/cyanite/"
                        "/etc/init.d/cyanite"
                        "/etc/default/cyanite"]))


Minimal parser refactor

Minimal parser refactor

--- parser/parser.clj
+++ parser/parser.clj
@@ -26,13 +26,14 @@
             Empty       b
             (Cons x xs) (Cons x (string-concat xs b))))

+(def 'string-join-reducer (separator)
+     (fn (x xs)
+         (match xs
+                Empty x
+                _     (string-concat (string-concat xs separator) x))))
+
 (def string-join (separator list)
-     (list-foldr (fn (x xs)
-                     (match xs
-                            Empty       x
-                            (Cons _ __) (string-concat (string-concat xs separator) x)))
-                 Empty
-                 list))
+     (list-foldr ('string-join-reducer separator) Empty list))

 (data boolean True False)
 (data (pair a b) (Pair a b))


still trying to get it to launch 3rd party application


don't move manifest pointer, we'll do that manually after deploy

--- src/pc/assets.clj
+++ src/pc/assets.clj
@@ -220,10 +220,10 @@
                      :metadata {:content-length (count manifest-bytes)
                                 :content-type "application/edn"})
       (validate-manifest! (fetch-specific-manifest cdn-bucket manifest-key))
-      (log/infof "moving manifest pointer to %s" manifest-key)
-      (move-manifest-pointer cdn-bucket manifest-key)
-      (log/infof "skipping uploading sourcemap to rollbar, cause they're down")
-      ;(upload-sourcemap sha1 manifest)
+      (log/infof "skipping moving manifest pointer to %s while we deploy BE" manifest-key)
+      ;;(move-manifest-pointer cdn-bucket manifest-key)
+      (log/infof "uploading sourcemap to rollbar")
+      (upload-sourcemap sha1 manifest)
       )))

 ;; single agent to prevent dos


Fixed i18n for Polish language

Fixed i18n for Polish language

--- src/skat/i18n.clj
+++ src/skat/i18n.clj
@@ -123,6 +123,7 @@
                                          "%s wziął sztych")
                        :deal!  (long-str "Solista: %s"
                                          "Zakład:  %d"
+                                         "Gra:     %d"
                                          "Wygrana: %s")
                        :game!  (long-str "Gracz:  %s"
                                          "Punkty: %d") }


fixed the link to facebook in the footer

--- src-cljs/bitfondue/core.cljs
+++ src-cljs/bitfondue/core.cljs
@@ -115,7 +115,7 @@
        [:li [:a {:href "http://blog.bitfondue.com"} "Blog"]]
        [:li [:a {:href "https://github.com/bitfondue"} "GitHub"]]
        [:li [:a {:href "https://twitter.com/bitfondue"} "Twitter"]]
-       [:li [:a {:href "https://twitter.com/bitfondue"} "Facebook"]]]]
+       [:li [:a {:href "https://www.facebook.com/bitfondue"} "Facebook"]]]]
      [:div.col-md-3
       [:ul
        [:li [:h6 "Legal"]]


complete the navigation using the HTML5 History API to route to /about, /features etc.

--- src-cljs/bitfondue/core.cljs
+++ src-cljs/bitfondue/core.cljs
@@ -8,6 +8,34 @@
             [goog.events :as events])
   (:import [goog.history Html5History EventType]))

+;; Make the Html 5 History API work
+(defn get-token []
+  (str js/window.location.pathname js/window.location.search))
+
+(defn make-history []
+  (doto (Html5History.)
+    (.setPathPrefix (str js/window.location.protocol
+                         "//"
+                         js/window.location.host))
+    (.setUseFragment false)))
+
+(defn handle-url-change [e]
+  ;; log the event object to console for inspection
+  (js/console.log e)
+  ;; and let's see the token
+  (js/console.log (str "Navigating: " (get-token)))
+  ;; we are checking if this event is due to user action,
+  ;; such as click a link, a back button, etc.
+  ;; as opposed to programmatically setting the URL with the API
+  (when-not (.-isNavigation e)
+    ;; in this case, we're setting it
+    (js/console.log "Token set programmatically")
+    ;; let's scroll to the top to simulate a navigation
+    (js/window.scrollTo 0 0))
+  ;; dispatch on the token
+  (secretary/dispatch! (get-token)))
+
+(defonce history (make-history))
 (defonce chunks-state (atom '()))

 ;; ---
@@ -37,23 +65,31 @@
       (for [item chunk-row]
         [chunk-card item])])])

+(defn nav-helper
+  "Creating the map so that links will be routed without server-refresh"
+  [token]
+  {:href token
+   :on-click #(do
+                (.preventDefault %)
+                (.setToken history token))})
+
 (defn header
   []
   [:nav.navbar.navbar-light.bg-faded
    [:div.container
-    [:a.navbar-brand {:href "#"} "bitfondue"]
+    [:a.navbar-brand (nav-helper "/") "bitfondue"]
     [:ul.nav.navbar-nav
      [:li.nav-item
-      [:a.nav-link {:href "#features"} "Features"]]
-     [:li.nav-item
-      [:a.nav-link {:href "#pricing"} "Pricing"]]
-     [:li.nav-item
-      [:a.nav-link {:href "#about"} "About"]]]
+      [:a.nav-link (nav-helper "/features") "Features"]]
+     [:li.nav-item
+      [:a.nav-link (nav-helper "/pricing") "Pricing"]]
+     [:li.nav-item
+      [:a.nav-link (nav-helper "/about") "About"]]]
     [:ul.nav.navbar-nav.pull-right
      [:li.nav-item
-      [:a.nav-link {:href "#login"} "Login"]]
-     [:li.nav-item
-      [:a.nav-link {:href "#register"} "Register"]]]]])
+      [:a.nav-link (nav-helper "/login") "Login"]]
+     [:li.nav-item
+      [:a.nav-link (nav-helper "/register") "Register"]]]]])

 (defn footer
   []
@@ -154,9 +190,6 @@
   (reagent/render-component
    [page-component]
    application))
-
-;; set secretary to use # for the routing, eg. /#dashboard
-(secretary/set-config! :prefix "#")

 (defroute "/" [] (page home-anonymous))
 (defroute "/dashboard" [] (page home-authenticated))
@@ -167,10 +200,11 @@
 (defroute "/register" [] (page register))
 (defroute "*" [] (page not-found))

-;; Quick and dirty history configuration.
-(let [h (History.)]
-  (goog.events/listen h EventType/NAVIGATE #(secretary/dispatch! (.-token %)))
-  (doto h (.setEnabled true)))
+;; init the html5-history support
+(goog.events/listen history
+                    EventType.NAVIGATE
+                    #(handle-url-change %))
+(.setEnabled history true)

 ;; load the data from the API
 (fetch-chunks)