Clean up tests

Clean up tests

--- test/structural_typing/f_type_repo.clj
+++ test/structural_typing/f_type_repo.clj
@@ -3,6 +3,144 @@
             [structural-typing.predicates :as p])
   (:require [com.rpl.specter :refer [ALL]])
   (:use midje.sweet))
+
+;;; The core
+
+;; for a little clarity in the more complicated cases
+(def type-has vector)
+
+
+;; ..t.. is an irrelevant type-rep
+(fact "type descriptions that are maps"
+  (fact "simple maps just have their keys and values vectorized"
+    (subject/canonicalize ..t.. {:a p/must-exist}) => {[:a] [p/must-exist]}
+    (subject/canonicalize ..t.. {:a p/must-exist, :b p/must-exist})
+    => {[:a] [p/must-exist]
+        [:b] [p/must-exist]})
+
+  (fact "already vectorized keys and values are left alone"
+    (subject/canonicalize ..t.. {[:a] p/must-exist}) => {[:a] [p/must-exist]}
+    (subject/canonicalize ..t.. {[:a] [p/must-exist]}) => {[:a] [p/must-exist]}
+    (subject/canonicalize ..t.. {[:a :b] p/must-exist}) => {[:a :b] [p/must-exist]})
+
+  (fact "nested maps have keys flattened into paths"
+    (subject/canonicalize ..t.. {:a {:b p/must-exist}}) => {[:a :b] [p/must-exist]}))
+
+(fact "type descriptions that are vectors"
+  (fact "vectors are shorthand for maps with `p/must-exist`"
+    (subject/canonicalize ..t.. [ :a :b ]) => {[:a] [p/must-exist] [:b] [p/must-exist]})
+  (fact "alternate for above - for clarity"
+    (subject/canonicalize ..t.. (type-has :a :b)) => {[:a] [p/must-exist] [:b] [p/must-exist]})
+  (fact "single-element vectors are the same as atoms"
+    (subject/canonicalize ..t.. (type-has [:a] [:b] ))
+    => {[:a] [p/must-exist] [:b] [p/must-exist]})
+
+  (fact "multi-element vectors are paths"
+    (subject/canonicalize ..t.. (type-has [:a :c]
+                                          [:b :d])) => {[:a :c] [p/must-exist]
+                                                        [:b :d] [p/must-exist]})
+
+  (fact "nested and unnested elements can be combined"
+    (subject/canonicalize ..t.. (type-has :a [:b :c] :d)) => {[:a] [p/must-exist]
+                                                              [:b :c] [p/must-exist]
+                                                              [:d] [p/must-exist]})
+
+  (fact "double-nesting indicates alternatives"
+    (subject/canonicalize ..t.. (type-has :a [:b [1 2] :c] :d)) => {[:a] [p/must-exist]
+                                                                    [:b 1 :c] [p/must-exist]
+                                                                    [:b 2 :c] [p/must-exist]
+                                                                    [:d] [p/must-exist]}
+
+    (subject/canonicalize ..t.. (type-has [[:a :b]])) => {[:a] [p/must-exist]
+                                                          [:b] [p/must-exist]})
+
+
+  (fact "maps within vectors contribute paths - only paths - that must exist"
+    (subject/canonicalize ..t.. [ {:a #'even?, :b #'even?} ]) => {[:a] [p/must-exist]
+                                                                  [:b] [p/must-exist]}
+    (subject/canonicalize ..t.. [ [:a {:b {:c #'even?}
+                                       :d #'even?}] ]) => {[:a :b :c] [p/must-exist]
+                                                           [:a :d] [p/must-exist]}
+
+      (subject/canonicalize ..t.. [ [:a {:b #'even?} :e] ]) => (throws)))
+
+(fact "signifiers can only be maps and vectors"
+  (subject/canonicalize ..t.. :a) => (throws #"maps or vectors"))
+
+(fact "multiple arguments are allowed"
+  (subject/canonicalize ..t.. {:a p/must-exist} {:b p/must-exist}) => {[:a] [p/must-exist]
+                                                                       [:b] [p/must-exist]}
+
+  (fact "arguments with the same keys have their values merged"
+    (subject/canonicalize ..t.. {:a p/must-exist} {:a #'even?}) => {[:a] [p/must-exist #'even?]}
+    (subject/canonicalize ..t.. {:a {:b p/must-exist}}
+                          {:a #'map?}
+                          {:a {:b #'even?}}) => {[:a] [#'map?]
+                                                 [:a :b] [p/must-exist #'even?]})
+
+  (fact "maps and vectors can be merged"
+    (subject/canonicalize ..t.. [ :a :b ] {:a #'even?}) => {[:a] [p/must-exist #'even?]
+                                                            [:b] [p/must-exist]}))
+
+(fact "And here's an example of various ways to talk about a nested structure"
+  ;; A figure has a color and many points
+  (subject/canonicalize ..t.. [ :color
+                               [:points ALL :x]
+                               [:points ALL :y] ]) => {[:color] [p/must-exist]
+                                                       [:points ALL :x] [p/must-exist]
+                                                       [:points ALL :y] [p/must-exist]}
+
+  (subject/canonicalize ..t.. [:color
+                               [:points ALL [:x :y]]]) => {[:color] [p/must-exist]
+                                                           [:points ALL :x] [p/must-exist]
+                                                           [:points ALL :y] [p/must-exist]}
+
+  (fact "maps can contribute to the `required` list"
+    (let [point {[:x] [#'integer?]
+                 [:y] [#'integer?]}]
+      ;; Here we require x and y to exist, but lose the requirement they be integers.
+      (subject/canonicalize ..t.. [:color [:points ALL point]])
+      => {[:color] [p/must-exist]
+          [:points ALL :x] [p/must-exist]
+          [:points ALL :y] [p/must-exist]}
+
+      ;; To get those options back, we use a map.
+      (subject/canonicalize ..t.. [:color [:points ALL point]]
+                            {:color #'string?
+                             [:points ALL] point})
+      => {[:color] [p/must-exist #'string?]
+          [:points ALL :x] [p/must-exist #'integer?]
+          [:points ALL :y] [p/must-exist #'integer?]})
+
+
+    ;; If a nested type has required keys, those are preserved.
+    (let [required-xy-point {[:x] [p/must-exist #'integer?]
+                             [:y] [p/must-exist #'integer?]}]
+      ;; As above, a mention in the required list transfers required-ness
+      (subject/canonicalize ..t.. [:color [:points ALL required-xy-point]])
+      => {[:color] [p/must-exist]
+          [:points ALL :x] [p/must-exist]
+          [:points ALL :y] [p/must-exist]}
+
+      ;; To get those options back, we use a map.
+      (subject/canonicalize ..t.. [:color]
+                            {:color #'string?
+                             [:points ALL] required-xy-point})
+      => {[:color] [p/must-exist #'string?]
+          [:points ALL :x] [p/must-exist #'integer?]
+          [:points ALL :y] [p/must-exist #'integer?]})))
+
+(fact "this is a pretty unlikely map to use, but it will work"
+  (subject/canonicalize ..t..
+                        {:points {ALL {:x #'integer?
+                                       :y #'integer?}}}) => {[:points ALL :x] [#'integer?]
+                                                             [:points ALL :y] [#'integer?]})
+
+
+
+
+
+;;;; Utilities

 (facts "nested-map->path-map flattens nested keys into a vector of keys"
@@ -107,12 +245,9 @@

   (fact "top level non-collections are canonicalized"
     (subject/any-required-seq->maps [:a :b]) => {[:a] [p/must-exist]
-                                                 [:b] [p/must-exist]})
-
-)
+                                                 [:b] [p/must-exist]}))

 ;;; Types can be expanded by signifier
-

 (facts expand-type-finders
   (subject/expand-type-finders {} []) => []
@@ -147,153 +282,8 @@

-;; for a little clarity in the more complicated cases
-(def type-has vector)
-
-
-;; ..t.. is an irrelevant type-rep
-(fact "various signifiers can be converted into a canonical form"
-  (fact "signifiers that are maps"
-    (fact "simple maps just have their keys and values vectorized"
-      (subject/canonicalize ..t.. {:a p/must-exist}) => {[:a] [p/must-exist]}
-      (subject/canonicalize ..t.. {:a p/must-exist, :b p/must-exist})
-      => {[:a] [p/must-exist]
-          [:b] [p/must-exist]})
-
-    (fact "already vectorized keys and values are left alone"
-      (subject/canonicalize ..t.. {[:a] p/must-exist}) => {[:a] [p/must-exist]}
-      (subject/canonicalize ..t.. {[:a] [p/must-exist]}) => {[:a] [p/must-exist]}
-      (subject/canonicalize ..t.. {[:a :b] p/must-exist}) => {[:a :b] [p/must-exist]})
-
-    (fact "nested maps"
-      (subject/canonicalize ..t.. {:a {:b p/must-exist}}) => {[:a :b] [p/must-exist]}))
-
-  (fact "signifiers that are vectors"
-    (fact "vectors are shorthand for maps with `p/must-exist`"
-      (subject/canonicalize ..t.. [ :a :b ]) => {[:a] [p/must-exist] [:b] [p/must-exist]})
-    (fact "alternate for above - for clarity"
-      (subject/canonicalize ..t.. (type-has :a :b)) => {[:a] [p/must-exist] [:b] [p/must-exist]})
-    (fact "single-element vectors are the same as atoms"
-      (subject/canonicalize ..t.. (type-has [:a] [:b] ))
-      => {[:a] [p/must-exist] [:b] [p/must-exist]})
-
-    (fact "multi-element vectors are paths"
-      (subject/canonicalize ..t.. (type-has [:a :c]
-                                            [:b :d])) => {[:a :c] [p/must-exist]
-                                                          [:b :d] [p/must-exist]})
-
-    (fact "nested and unnested can be combined"
-      (subject/canonicalize ..t.. (type-has :a [:b :c] :d)) => {[:a] [p/must-exist]
-                                                                [:b :c] [p/must-exist]
-                                                                [:d] [p/must-exist]})
-
-    (fact "double-nesting indicates alternatives"
-      (subject/canonicalize ..t.. (type-has :a [:b [1 2] :c] :d)) => {[:a] [p/must-exist]
-                                                                      [:b 1 :c] [p/must-exist]
-                                                                      [:b 2 :c] [p/must-exist]
-                                                                      [:d] [p/must-exist]}
-
-      (subject/canonicalize ..t.. (type-has [[:a :b]])) => {[:a] [p/must-exist]
-                                                          [:b] [p/must-exist]})
-
-
-
-
-    (fact "maps within vectors contribute paths - only paths - that must exist"
-      (subject/canonicalize ..t.. [ {:a #'even?, :b #'even?} ]) => {[:a] [p/must-exist]
-                                                                    [:b] [p/must-exist]}
-      (subject/canonicalize ..t.. [ [:a {:b {:c #'even?}
-                                         :d #'even?}] ]) => {[:a :b :c] [p/must-exist]
-                                                             [:a :d] [p/must-exist]}
-
-      (subject/canonicalize ..t.. [ [:a {:b #'even?} :e] ]) => (throws)))
-
-  (fact "signifiers can only be maps and vectors"
-    (subject/canonicalize ..t.. :a) => (throws #"maps or vectors"))
-
-  (fact "multiple arguments are allowed"
-    (subject/canonicalize ..t.. {:a p/must-exist} {:b p/must-exist}) => {[:a] [p/must-exist]
-                                                                         [:b] [p/must-exist]}
-
-    (fact "arguments with the same keys have their values merged"
-      (subject/canonicalize ..t.. {:a p/must-exist} {:a #'even?}) => {[:a] [p/must-exist #'even?]}
-      (subject/canonicalize ..t.. {:a {:b p/must-exist}}
-                            {:a #'map?}
-                            {:a {:b #'even?}}) => {[:a] [#'map?]
-                                                   [:a :b] [p/must-exist #'even?]})
-
-    (fact "maps and vectors can be merged"
-      (subject/canonicalize ..t.. [ :a :b ] {:a #'even?}) => {[:a] [p/must-exist #'even?]
-                                                              [:b] [p/must-exist]}))
-
-  (fact "And here's an example of various ways to talk about a nested structure"
-    ;; A figure has a color and many points
-    (subject/canonicalize ..t.. [ :color
-                           [:points ALL :x]
-                           [:points ALL :y] ]) => {[:color] [p/must-exist]
-                                                   [:points ALL :x] [p/must-exist]
-                                                   [:points ALL :y] [p/must-exist]}
-
-    (subject/canonicalize ..t.. [:color
-                           [:points ALL [:x :y]]]) => {[:color] [p/must-exist]
-                                                       [:points ALL :x] [p/must-exist]
-                                                       [:points ALL :y] [p/must-exist]}
-
-
-    (fact "maps can contribute to the `required` list"
-      (let [point {[:x] [#'integer?]
-                   [:y] [#'integer?]}]
-        ;; Here we require x and y to exist, but lose the requirement they be integers.
-        (subject/canonicalize ..t.. [:color [:points ALL point]])
-        => {[:color] [p/must-exist]
-            [:points ALL :x] [p/must-exist]
-            [:points ALL :y] [p/must-exist]}
-
-        ;; To get those options back, we use a map.
-        (subject/canonicalize ..t.. [:color [:points ALL point]]
-                              {:color #'string?
-                               [:points ALL] point})
-        => {[:color] [p/must-exist #'string?]
-            [:points ALL :x] [p/must-exist #'integer?]
-            [:points ALL :y] [p/must-exist #'integer?]})
-
-
-      ;; If a nested type has required keys, those are preserved.
-      (let [required-xy-point {[:x] [p/must-exist #'integer?]
-                               [:y] [p/must-exist #'integer?]}]
-        ;; As above, a mention in the required list transfers required-ness
-        (subject/canonicalize ..t.. [:color [:points ALL required-xy-point]])
-        => {[:color] [p/must-exist]
-            [:points ALL :x] [p/must-exist]
-            [:points ALL :y] [p/must-exist]}
-
-        ;; To get those options back, we use a map.
-        (subject/canonicalize ..t.. [:color]
-                              {:color #'string?
-                               [:points ALL] required-xy-point})
-        => {[:color] [p/must-exist #'string?]
-            [:points ALL :x] [p/must-exist #'integer?]
-            [:points ALL :y] [p/must-exist #'integer?]})))
-
-
-  (fact "this is a pretty unlikely map to use, but it will work"
-    (subject/canonicalize ..t..
-       {:points {ALL {:x #'integer?
-                      :y #'integer?}}}) => {[:points ALL :x] [#'integer?]
-                                            [:points ALL :y] [#'integer?]})
-  )
-
-
-
-
-
-;; ;; Rework into canonicalize ..t..
-;;    (subject/expand-path-shorthand :x) => [:x]
-
-      ;; (subject/expand-path-shorthand {:a #'even? :b #'even?})
-      ;; =future=> (just [:a] [:b] :in-any-order)
-      ;; (subject/expand-path-shorthand {:a {:b #'even?} :c #'even?})
-      ;; =future=> (just [:a :b] [:c] :in-any-order)
+
+
 ;; (future-fact "three-argument form allows lookup in a type-map"
 ;;     (let [type-map {:Point {[:x] [p/must-exist #'integer?]
 ;;                             [:y] [p/must-exist #'integer?]}}]


Make row-removing buttons red

Make row-removing buttons red

--- src/cljs/cglossa/search_inputs/cwb/shared.cljs
+++ src/cljs/cglossa/search_inputs/cwb/shared.cljs
@@ -9,11 +9,11 @@
     (search! query-cursor)))

 (defn remove-row-btn [show? handler]
-  [:button.btn.btn-default.btn-xs {:type     "button"
-                                   :title    "Remove row"
-                                   :on-click #(handler)
-                                   :style    {:margin-right 5
-                                              :visibility   (if show?
-                                                              "visible"
-                                                              "hidden")}}
+  [:button.btn.btn-danger.btn-xs {:type     "button"
+                                  :title    "Remove row"
+                                  :on-click #(handler)
+                                  :style    {:margin-right 5
+                                             :visibility   (if show?
+                                                             "visible"
+                                                             "hidden")}}
    [:span.glyphicon.glyphicon-remove]])


fix issue #88

fix issue #88

--- src/app/clj/one/sample/dev_server.clj
+++ src/app/clj/one/sample/dev_server.clj
@@ -22,6 +22,11 @@
 (defn- environment [uri]
   (if (= uri "/development") :development :production))

+(defn- make-bare-page [body]
+  {:status 200
+   :headers {"Content-Type" "text/html; charset=utf-8"}
+   :body body})
+
 (defn- make-host-page [request]
   {:status 200
    :headers {"Content-Type" "text/html; charset=utf-8"}
@@ -33,7 +38,7 @@
   (GET "/production" request (make-host-page request) )
   (GET "/design*" {{file :*} :route-params}
        (when (.endsWith file ".html")
-         (load-html (.substring file 1))))
+         (make-bare-page (load-html (.substring file 1)))))
   (ANY "*" request (file-response "404.html" {:root "public"})))

 (defn- js-encoding [handler]


Changed sinkmode to replace, on forma bucketing.

--- src/clj/forma/hadoop/jobs/scatter.clj
+++ src/clj/forma/hadoop/jobs/scatter.clj
@@ -109,7 +109,7 @@
   [pail-path ts-pail-path out-path run-key & countries]
   (let [{:keys [s-res t-res] :as forma-map} (:run-key forma-run-parameters)
         countries (or countries [:IDN :MYS])]
-    (?- (hfs-seqfile out-path)
+    (?- (hfs-seqfile out-path :sinkmode :replace)
         (forma/forma-query forma-map
                            (constrained-tap ts-pail-path "ndvi" s-res t-res countries)
                            (adjusted-precl-tap ts-pail-path s-res "32" t-res countries)


Added missing graph service definition.

Added missing graph service definition.

Also, changed the default endpoint to be localhost. The manner in which this is
handled, in general, is not good. Needs a ticket, and then needs to get fixed.

--- src/cljc/cmr/client/common/const.cljc
+++ src/cljc/cmr/client/common/const.cljc
@@ -22,6 +22,9 @@
   {:access-control
     {:service "/access-control"
      :local ":3011"}
+   :graph
+     {:service "/graph"
+      :local ":3012"}
    :ingest
     {:service "/ingest"
      :local ":3002"}
@@ -37,13 +40,15 @@

 (def default-environment-type
   "Default deployment type for the CMR client."
-  :prod)
+  :local)

 (def default-endpoints
-  "A map of the CMR client's default service endpoints."
+  "A map of the CMR client's default local endpoints."
   {:access-control (str (default-environment-type hosts)
-                        (get-in endpoints [:access-control :service]))
+                        (get-in endpoints [:access-control :local]))
+   :graph (str (default-environment-type hosts)
+                (get-in endpoints [:graph :local]))
    :ingest (str (default-environment-type hosts)
-                (get-in endpoints [:ingest :service]))
+                (get-in endpoints [:ingest :local]))
    :search (str (default-environment-type hosts)
-                (get-in endpoints [:search :service]))})
+                (get-in endpoints [:search :local]))})


naming

naming

--- src/cljc/commos/delta/compscribe.cljc
+++ src/cljc/commos/delta/compscribe.cljc
@@ -292,7 +292,7 @@
     (pipe source watch-ch)
     (pipe watch-ch target)))

-(defn- wrap-on-close
+(defn- on-close-source
   "Pipes a channel to target and returns it, on-close is invoked when
   it is closed."
   [target on-close]
@@ -315,7 +315,7 @@
       (subscribe [this spec target]
         (let [[spec id] spec
               [endpoint direct-hooks deep-hooks :as spec] (compile-spec spec)
-              subs-target (wrap-on-close target #(cancel this target))]
+              subs-target (on-close-source target #(cancel this target))]
           (if (and (empty? direct-hooks)
                    (empty? deep-hooks))
             ;; OPT: If there is nothing to compscribe, directly reach
@@ -410,8 +410,8 @@
                                  spec
                                  ch-in)
                       [m 0 ch-in]))
-                target-step (wrap-on-close target
-                                           #(cancel this target))]
+                target-step (on-close-source target
+                                             #(cancel this target))]
             (tap m target-step)
             (recur (assoc subs spec (update cache 1 inc))
                    (assoc chs target [spec target-step])))


fixed rendering of reagent tag view

fixed rendering of reagent tag view

--- src/braid/ui/views/pages/tag.cljs
+++ src/braid/ui/views/pages/tag.cljs
@@ -2,55 +2,60 @@
   (:require [om.core :as om]
             [om.dom :as dom]
             [reagent.core :as r]
+            [reagent.ratom :include-macros true :refer-macros [reaction]]
             [chat.client.store :as store]
             [chat.client.dispatcher :refer [dispatch!]]
+            [chat.client.reagent-adapter :refer [subscribe]]
             [braid.ui.views.thread :refer [thread-view]]
             [braid.ui.views.new-thread :refer [new-thread-view]]
             [braid.ui.views.pills :refer [tag-pill-view subscribe-button-view]]))

 (defn tag-page-view
-  [{:keys [subscribe]}]
+  []
   (let [loading? (r/atom false)
         start-loading! (fn [] (reset! loading? true))
         stop-loading! (fn [] (reset! loading? false))
         page-id (subscribe [:page-id])
         page (subscribe [:page])
         tag (subscribe [:tag @page-id])
+        tag-id (@page :id)
         user-id (subscribe [:user-id])
         threads (subscribe [:threads])
-        pagination-remaining (subscribe [:pagination-remaining])]
+        pagination-remaining (subscribe [:pagination-remaining])
+        inbox-thread-ids (subscribe [:open-thread-ids])
+        known-threads (reaction
+                        (->> @threads
+                               vals
+                               (filter
+                                 (fn [t] (contains? (set (t :tag-ids)) tag-id)))))
+        sorted-threads (reaction
+                         (->> (@page :thread-ids)
+                            (select-keys @threads)
+                            vals
+                            (into (set @known-threads))
+                            (map (fn [t] (assoc t :open? (contains? @inbox-thread-ids (t :id)))))
+                            ; sort-by last reply, newest first
+                            (sort-by
+                              (comp (partial apply max)
+                                    (partial map :created-at)
+                                    :messages))
+                            reverse))]
     (r/create-class
       {:component-did-mount
-         (fn []
-           (dispatch! :threads-for-tag {:tag-id @page-id}))
+       (fn []
+         (dispatch! :threads-for-tag {:tag-id @page-id}))
        :reagent-render
        (fn []
          (let
-           [tag-id (@page :id)
-            status (cond
+           [status (cond
                      loading? :loading
                      (not (contains? @page :thread-ids)) :searching
                      (seq (@page :thread-ids)) :done-results
-                     :else :done-empty)
-            known-threads (->> @threads
-                               vals
-                               (filter (fn [t] (contains? (set (t :tag-ids)) tag-id))))
-            inbox-thread-ids (subscribe [:open-thread-ids])
-            sorted-threads (->> (@page :thread-ids)
-                                (select-keys @threads)
-                                vals
-                                (into (set known-threads))
-                                (map (fn [t] (assoc t :open? (contains? @inbox-thread-ids (t :id)))))
-                                ; sort-by last reply, newest first
-                                (sort-by
-                                  (comp (partial apply max)
-                                        (partial map :created-at)
-                                        :messages))
-                                reverse)]
+                     :else :done-empty)]
             [:div.page.channel
               [:div.title
-                [tag-pill-view @tag subscribe]
-                [subscribe-button-view @tag subscribe]]
+                [tag-pill-view @tag]
+                [subscribe-button-view @tag]]

               [:div.content
                 [:div.description
@@ -92,5 +97,7 @@
                                     (set! (.-scrollLeft this-elt)
                                           (- (.-scrollLeft this-elt) (.-deltaY e))))))}
                   [new-thread-view]
-                  (for [thread sorted-threads]
-                    [thread-view thread])]]))})))
+                  (doall
+                    (for [thread @sorted-threads]
+                      ^{:key [thread :id]}
+                      [thread-view thread]))]]))})))


increase heartbeat timeout

increase heartbeat timeout

increase heartbeat to prevent split brain on startup.

--- src/jepsen/voltdb.clj
+++ src/jepsen/voltdb.clj
@@ -74,7 +74,7 @@
        ; isolated nodes with requests *before* they kill themselves
        ; but low enough that a new majority is elected and performs
        ; some operations.
-       [:heartbeat {:timeout 2}] ; seconds
+       [:heartbeat {:timeout 10}] ; seconds
        [:commandlog {:enabled true, :synchronous true, :logsize 128}
         [:frequency {:time 2}]]]))) ; milliseconds


refactor

refactor

--- src/cljs/gc_api_browser/core.cljs
+++ src/cljs/gc_api_browser/core.cljs
@@ -1,5 +1,5 @@
 (ns gc-api-browser.core
-  (:require-macros [cljs.core.async.macros :refer [go]])
+  (:require-macros [cljs.core.async.macros :refer [go-loop]])
   (:require [cognitect.transit :as transit]
             [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]
@@ -65,12 +65,15 @@
   (om/transact! app [:request :headers]
                 (fn [headers] (if (empty? headers) default-headers headers))))

-(defn tx-listener [sync-chan _ root-cursor]
-  (async/put! sync-chan @root-cursor))
+(defn sync-app-state! [c]
+  (let [throttled (throttle c 300)]
+    (go-loop []
+      (when-some [state (async/<! throttled)]
+        (store/write! state)
+        (recur)))))

 (defn main []
-  (let [sync-chan (async/chan (async/sliding-buffer 1))
-        throttled (throttle sync-chan 300)]
+  (let [app-state-chan (async/chan (async/sliding-buffer 1))]
     (om/root
       (fn [app _]
         (reify
@@ -79,10 +82,8 @@
             (js/setTimeout
               (fn []
                 (load-app-state! app)
-                (set-default-headers! app)))
-            (go (while true
-                  (let [state (async/<! throttled)]
-                    (store/write! state)))))
+                (set-default-headers! app)
+                (sync-app-state! app-state-chan))))
           om/IRender
           (render [_]
             (if (get-in app [:request :schema])
@@ -90,4 +91,5 @@
               (render-schema-select app)))))
       app-state
       {:target (.getElementById js/document "app")
-       :tx-listen (partial tx-listener sync-chan)})))
+       :tx-listen (fn [_ root-cursor]
+                    (async/put! app-state-chan @root-cursor))})))


Twitter oauth refactoring

Twitter oauth refactoring

--- src/export_server/sharing/twitter.clj
+++ src/export_server/sharing/twitter.clj
@@ -95,20 +95,17 @@
         token-response (try (client/request token-request)
                             (catch Exception e {}))
         creds (ring.util.codec/form-decode (:body token-response))
-        oauth-token (get creds "oauth_token")
-        oauth-token-secret (get creds "oauth_token_secret")
-        user-id (get creds "user_id")
-        screen-name (get creds "screen_name")
-        {:keys [profile_image_url name]} (user-info oauth-token oauth-token-secret user-id screen-name)]
-    (if (and oauth-token oauth-token-secret)
+        {:strs [oauth_token oauth_token_secret user_id screen_name]} creds
+        {:keys [profile_image_url name]} (user-info oauth_token oauth_token_secret user_id screen_name)]
+    (if (and oauth_token oauth_token_secret)
       (let [response (if-let [image (-> session :local :img)]
-                       (confirm-dialog image profile_image_url screen-name name)
+                       (confirm-dialog image profile_image_url screen_name name)
                        (error-dialog "Image upload time expired"))]
         (-> response
-            (assoc-in [:session :db :twitter] {:oauth-token        oauth-token
-                                               :oauth-token-secret oauth-token-secret
-                                               :user-id            user-id
-                                               :screen-name        screen-name
+            (assoc-in [:session :db :twitter] {:oauth-token        oauth_token
+                                               :oauth-token-secret oauth_token_secret
+                                               :user-id            user_id
+                                               :screen-name        screen_name
                                                :name               name
                                                :image-url          profile_image_url})
             (assoc-in [:session :local] nil)))


bumped up to latest reagent

bumped up to latest reagent

--- src/leiningen/new/reagent/project.clj
+++ src/leiningen/new/reagent/project.clj
@@ -8,7 +8,7 @@

   :dependencies [[org.clojure/clojure "1.6.0"]
                  [cljsjs/react "0.12.2-5"]
-                 [reagent "0.5.0-alpha3"]
+                 [reagent "0.5.0"]
                  [reagent-forms "0.4.4"]
                  [reagent-utils "0.1.3"]
                  [secretary "1.2.1"]{{{app-dependencies}}}]


add utf-8 charset to generated browser-test page

fixes #463

--- src/main/shadow/build/targets/browser_test.clj
+++ src/main/shadow/build/targets/browser_test.clj
@@ -31,9 +31,10 @@
           {}
           [:head
            [:title (str runner-ns)]
-           [:body
-            [:script {:src "/js/test.js"}]
-            [:script (str (cljs-comp/munge runner-ns) ".init();")]]])))
+           [:meta {:charset "utf-8"}]]
+          [:body
+           [:script {:src "/js/test.js"}]
+           [:script (str (cljs-comp/munge runner-ns) ".init();")]])))

     (-> state
         (tu/configure-common)


Added more logging.

Added more logging.

--- src/dragon/event/subscription.clj
+++ src/dragon/event/subscription.clj
@@ -3,6 +3,7 @@
             [dragon.event.message :as message]
             [dragon.event.system.core :as event]
             [dragon.event.tag :as tag]
+            [dragon.event.topic :as topic]
             [dragon.util :as util]
             [taoensso.timbre :as log]))

@@ -43,7 +44,7 @@
   ""
   [system event-type subscriber-funcs]
   (doseq [func subscriber-funcs]
-    (log/debugf "Subscribing to %s ..." event-type)
+    (log/debugf "\tSubscribing to %s ..." event-type)
     (event/subscribe system event-type debug-subscriber)
     (event/subscribe system event-type trace-subscriber)
     (if (= func :default)
@@ -53,6 +54,7 @@
 (defn subscribe-all
   ""
   [system-or-component]
+  (log/debug "Adding subscribers ...")
   (let [system (util/component->system system-or-component)]
     (doseq [[event-type subscriber-funcs] subscribers]
       (subscribe-all-event system


added effect handling

added effect handling

--- src/elm_cljs/core.cljs
+++ src/elm_cljs/core.cljs
@@ -10,6 +10,34 @@

 (def messages (chan))

+(def effects (chan))
+
+(defprotocol Effect
+  (run-effect [this]))
+
+(defrecord Random [callback]
+  Effect
+  (run-effect [this]
+    ((:callback this) (rand-int 100))))
+
+(defrecord Print []
+  Effect
+  (run-effect [this]
+    (println "Printed!")))
+
+(defn printaction [action old-model new-model effect]
+  (js/console.groupCollapsed action)
+  (js/console.info old-model)
+  (js/console.info new-model)
+  (js/console.info effect)
+  (js/console.groupEnd))
+
+(go
+  (while true
+    (let [effect (<! effects)
+          message (run-effect effect)]
+      (if-not (nil? message) (>! messages message)))))
+
 (def root (.getElementById js/document "app"))

 (defn submit [message]
@@ -17,9 +45,12 @@

 (defn main [initial-model view update]
   (go-loop [model initial-model]
-           (println model)
            (q/render (view model) root)
-           (recur (update model (<! messages)))))
+           (let [message (<! messages)
+                 [updated-model effect] (update model message)]
+             (printaction message model updated-model effect)
+             (if-not (nil? effect) (>! effects effect))
+             (recur updated-model))))

 ;; ******************************************************************

@@ -31,21 +62,32 @@
 (defrecord Increment []
   Action
   (run [this model]
-    (update model :counter inc)))
+    [(update model :counter inc) nil]))

 (defrecord Decrement []
   Action
   (run [this model]
-    (update model :counter dec)))
+    [(update model :counter dec) nil]))
+
+(defrecord SetCounter [value]
+  Action
+  (run [this model]
+    [(assoc model :counter value) nil]))

 (defrecord GenerateRandom []
   Action
-  (run [this model] model))
+  (run [this model]
+    [model (->Random ->SetCounter)]))
+
+(defrecord PrintSomething []
+  Action
+  (run [this model]
+    [model (->Print)]))

 (defrecord Type [text]
   Action
   (run [this model]
-    (assoc model :text (:text this))))
+    [(assoc model :text (:text this)) nil]))

 (defn view [model]
   (d/div {}
@@ -54,6 +96,7 @@
               (:counter model)
               (d/button {:onClick (fn [e] (submit (->Increment)))} "+"))
          (d/p {} (d/button {:onClick (fn [e] (submit (->GenerateRandom)))} "Random"))
+         (d/p {} (d/button {:onClick (fn [e] (submit (->PrintSomething)))} "Print something"))
          (d/p {}
               (d/input {:onChange (fn [e] (let [value (-> e (.-target) (.-value))]
                                             (submit (->Type value))))


Accomodate upstream changes to history API

--- src/flense_nw/app.cljs
+++ src/flense_nw/app.cljs
@@ -19,10 +19,9 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (def ^:private app-state
-  (atom
-   {:path [0]
-    :tree {:children
-           [(model/form->tree '(fn greet [name] (str "Hello, " name "!")))]}}))
+  (atom {:path [0]
+         :tree {:children (mapv model/form->tree
+                            '[(defn greet [name] (str "Hello, " name "!"))])}}))

 (def ^:private edit-chan (async/chan))
 (def ^:private error-chan (async/chan))
@@ -93,18 +92,12 @@
 ;; application setup and wiring
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(defn- handle-tx [{:keys [new-state tag] :or {tag #{}}}]
-  (when-not (tag :history)
-    (hist/push-state! new-state)))
-
 (defn init []
   (set! *keymap* (rdr/read-string (fs/slurp "resources/config/keymap.edn")))
   (let [command-chan (async/chan)]
-    (hist/push-state! @app-state)
     (om/root editor-view app-state
              {:target (.getElementById js/document "editor-parent")
-              :opts {:edit-chan edit-chan}
-              :tx-listen handle-tx})
+              :opts {:edit-chan edit-chan}})
     (om/root cli-view nil
              {:target (.getElementById js/document "cli-parent")
               :shared {:command-chan command-chan}})


limited position marker movement

limited position marker movement

--- src/frontend/core.cljs
+++ src/frontend/core.cljs
@@ -34,7 +34,8 @@
     (.val (js/$ "#m") "")
     false))

-(.draggable (js/$ "#progress-track-ball") #js {:axis "x"})
+(.draggable (js/$ "#progress-track-ball") #js {:axis "x"
+                                               :containment "#progress-track-bar"})

 ; TODO: We want to get rid of this at some point
 ;       and handle things more like the om tutorial handles things


add tests for TRDR-8

add tests for TRDR-8

--- src/test/clojure/clojure/tools/reader_test.clj
+++ src/test/clojure/clojure/tools/reader_test.clj
@@ -84,3 +84,6 @@
   (is (= (bar. 1 nil) (read-string "#clojure.tools.reader_test.bar{:baz 1}")))
   (is (= (bar. 1 nil) (read-string "#clojure.tools.reader_test.bar[1 nil]")))
   (is (= (bar. 1 2) (read-string "#clojure.tools.reader_test.bar[1 2]"))))
+
+(deftest read-ctor
+  (is (= "foo" (read-string "#java.lang.String[\"foo\"]"))))


Rewrite main-component without explicit viewport populating

--- src/gol/client/ui.cljs
+++ src/gol/client/ui.cljs
@@ -2,17 +2,13 @@
   (:require-macros [cljs.core.async.macros :refer [go]])
   (:require [reagent.core :as r :refer [atom]]
             [cljs.core.async :as async :refer [chan timeout <! put!]]
-            [gol.client.bl :refer [filter-on-viewport render create-viewport step]]))
+            [gol.client.bl :refer [filter-on-viewport step]]))

 (defn cell
   [c x y cell]
   [:b.cell
-   {:on-click (fn [] (put! (:actions c) {:msg :toggle :loc [x y]}))}
+   {:on-click (fn [] (put! c {:msg :toggle :loc [x y]}))}
    (when cell [:i])])
-
-(defn row
-  [c x row]
-  (into [:li] (map-indexed (partial cell c x) row)))

 (defn main-component
   [state channels]
@@ -26,11 +22,15 @@
             (let [ns (swap! state update-in [:universe :population] (if (= t :limited) (comp set (partial filter-on-viewport w h) step) step))]
               (when (empty? (get-in ns [:universe :population]))
                 (put! (:actions channels) {:msg :status :status :stasis})))))))
-  (fn [state c] (into [:ul.cell-area] (let [s @state
+  (fn [state channels] (into [:ul.cell-area] (let [s @state
                                             w (get-in s [:viewport :width])
                                             h (get-in s [:viewport :height])
                                             p (get-in s [:universe :population])]
-                                        (map-indexed (partial row c) (render (create-viewport w h) (filter-on-viewport w h p)))))))
+                                        (for [x (range w)]
+                                          (into
+                                            [:li]
+                                            (for [y (range h)]
+                                              [cell (:actions channels) x y (p [x y])])))))))

 (defn control-component
   [state channels]


Can tap nodes to pan to them

Can tap nodes to pan to them

--- src/graphito/core.cljs
+++ src/graphito/core.cljs
@@ -133,8 +133,10 @@
         displacement (subtract-vec pos camera-pos)
         r (scaled-distance-from-camera state pos)
         projected-r (projector r)]
-    (add-vec view-center
-             (scalar-multiply displacement (/ projected-r r)))))
+    (if (= r 0)
+      view-center
+      (add-vec view-center
+               (scalar-multiply displacement (/ projected-r r))))))

 (defn project-radius [t]
   (* max-radius (min 1 (/ 1 (.pow js/Math 2 (* 2 (- t 0.25)))))))
@@ -158,6 +160,11 @@
   (if (= (:projection state) :fisheye) fisheye-projectors zoom-out-projectors))

 ;; D3 magic
+
+(defn add-tap-listener [elem callback]
+  (let [manager (js/Hammer.Manager. elem)]
+    (.add manager (js/Hammer.Tap.))
+    (.on manager "tap" callback)))

 (defn sync-graph! [state & {:keys [animate?]}]
   (let [{:keys [svg
@@ -190,7 +197,10 @@
           (.append "line")
           (.attr "class" "link")
           (.style "stroke" "#C9CBCB")
-          (.style "stroke-width" 3))
+          (.style "stroke-width" 3)
+          (.each
+            (fn [link]
+              (this-as elem (add-tap-listener elem #(link-tap-signaller link))))))
       (-> link-selection
           maybe-transition
           (.attr "x1" #(-> % :source positions :x))
@@ -201,7 +211,10 @@
       (-> node-selection .enter
           (.append "circle")
           (.attr "class" "node")
-          (.style "fill" "#777A7A"))
+          (.style "fill" "#777A7A")
+          (.each
+            (fn [node]
+              (this-as elem (add-tap-listener elem #(node-tap-signaller node))))))
       (-> node-selection
           maybe-transition
           (.attr "cx" (fn [d i] (:x (positions i))))
@@ -396,7 +409,7 @@
         (.recognizeWith (.get manager "pan")))
     (-> manager (.add (js/Hammer.Pinch.))
         (.recognizeWith (.get manager "pan")))
-    (-> manager (.add (js/Hammer.Tap.)))
+    (.add manager (js/Hammer.Tap.))
     manager))

 (defn gesture-observable [manager svg gesture]
@@ -522,7 +535,9 @@
                           animation-observable]
   (-> node-tap-observable
       (suppress-while-animating animation-observable)
-      (.subscribe #(js/alert "FOO"))))
+      (.subscribe (fn [node]
+                    (if (= (:projection @current-state) :fisheye)
+                      (zoom-in-to-pos! current-state (:pos node)))))))

 ;; Exported function to do magic


Fix zoomed scroll speed, initial UI suppression

The scroll speed is now correctly scaled when the graph is zoomed out.

Furthermore, the UI is no longer blocked until the first animation. We
solve this problem by having the animation observable give new
subscribers its most recent event.

--- src/graphito/core.cljs
+++ src/graphito/core.cljs
@@ -96,6 +96,9 @@
     (scalar-multiply v max-ratio)))

 ;; D3 magic
+
+(defn scroll-scale-for-state [state]
+  (if (= :zoom-out (:projection state)) zoom-out-scale 1))

 (defn scaled-distance-from-camera
   "Returns the distance of the given point from the camera, scaled so that
@@ -215,7 +218,8 @@
   (sync-graph! @current-state))

 (defn move-camera! [current-state d]
-  (update-state! current-state :camera-pos add-vec d))
+  (update-state! current-state :camera-pos add-vec
+                 (scalar-multiply d (/ (scroll-scale-for-state @current-state)))))

 (defn set-projection! [current-state projection animation-signaller]
   (swap! current-state assoc :projection projection)
@@ -293,11 +297,15 @@

 (defn animation-observable-and-signaller []
   (let [observers (atom [])
-        observable (.create rx-observable #(swap! observers conj %))
+        observable (-> rx-observable
+                       (.create #(swap! observers conj %))
+                       (.replay 1))
         bool->event #(if % :animation-start :animation-end)
         animation-signaller (fn [b]
                               (doseq [o @observers]
                                 (.onNext o (bool->event b))))]
+    (.connect observable)
+    (animation-signaller false)
     [observable animation-signaller]))

 (defn suppress-while-animating [observable animation-observable]


fixing test

fixing test

--- src/jarkeeper/core.clj
+++ src/jarkeeper/core.clj
@@ -23,7 +23,9 @@

 (def fire-root (m/connect "https://jarkeeper.firebaseio.com"))
-(m/auth-custom fire-root (env :firebase-token) prn-str)
+(if (env :firebase-token)
+  (m/auth-custom fire-root (env :firebase-token) prn-str))
+

 (def last-modified-formatter "EEE, dd MMM yyyy HH:mm:ss zzz")


Add debug info

Add debug info

--- modules/bidi/src/modular/bidi.clj
+++ modules/bidi/src/modular/bidi.clj
@@ -116,6 +116,7 @@
           ;; resolvable through the handlers map.
           (keyword? handler)
         (assoc res
+               ::component ckey
                :handler (cond-> (get-in handlers [ckey handler])
                           ;; This should be based on given settings
                           add-exception-context? (wrap-capture-component-on-error :component ckey :handler handler)))


Fix

Fix

Former-commit-id: 29eab3bbb82aa74fc67b28b5730e0a423f6bfe0d

--- src/messenger/android/contacts_list.cljs
+++ src/messenger/android/contacts_list.cljs
@@ -11,6 +11,7 @@

 (def fake-contacts? true)

+(set! js/React (js/require "react-native"))
 (def react-native-contacts (js/require "react-native-contacts"))

 (def logo-icon (js/require "./images/logo.png"))


[ref] Merge peyment func of solid & partial events.

--- src/ombs/db/admin.clj
+++ src/ombs/db/admin.clj
@@ -39,6 +39,7 @@
       (replace
         (first (sql/select fees (sql/where {:id id})))
         [:users_id :events_id :money]))
+
 (defn- event-from-fee [id]
   (take 2 (read-fee id)))

@@ -46,37 +47,18 @@
   (:role (first (sql/select users (sql/where {:id uid}) (sql/fields :role)))))

 (declare process-it)
-(defn pay [{ename :event-name date :date :as params}]
-  "Add payment record in db. For current user.
-  Also, if this action, make summary event debt = 0, finish it"
-  (println "pay solid")
-  (let [uname (sess/get :username)
-        uid (get-uid uname)
-        eid (get-eid ename date)]
+(defn write-pay [{eid :events_id uid :users_id date :date parts :parts}]
     (when (isvalid/ids? eid uid)
-      (dbpay/debit-payment uid eid (dbpay/get-debt uname ename date))
+      (if (> 0 parts)
+        (process-it eid parts uid)
+        (dbpay/debit-payment uid eid (dbpay/get-debt uname ename date)))
       (if (can-finish? ename date)
-        (finish ename date)))))
+        (finish ename date)))  )

-(declare process-it)
-(defn pay-part [{ename :event-name date :date parts :parts :as params}]
-  "Add participation of current user and selected event(given as param from
-  post). Parts in params is count of parts, that user want to pay"
-  (println "pay partial")
-  (let [uname (sess/get :username)
-        uid (get-uid uname)
-        eid (get-eid ename date)
-        parts (fns/parse-int parts)]
-    (when (isvalid/ids? eid uid)
-      (process-it ename date parts uname)
-      (dbpay/debit-payment uid eid (dbpay/get-debt uname ename date))
-      (when (= 0 (get-rest-parts ename date))
-        (finish ename date)))
-  ))
-
-(defn process-it [ename date parts uname]
-  (if (isvalid/parts? ename date parts) ; its check if parts >= than free parts
-    (do
-      (dbpay/credit-payment ename date uname (parts-price ename date parts)) ; fix database logic
-      (dbpay/debit-payment (get-uid uname) (get-eid ename date) (parts-price ename date parts))
-      (shrink-goods ename date parts))))
+(defn process-it [eid parts uid]
+  ;But, it have many check on adding
+  ;(if (isvalid/parts? ename date parts) ; its check if parts >= than free parts.
+  (kdb/transaction
+    (dbpay/credit-payment eid uid (parts-price eid parts)) ; on each debit, we should have credit.
+    (dbpay/debit-payment eid uid (parts-price eid parts))
+    (shrink-goods eid parts)))


Remove clojure.contrib.str-utils usage

Remove clojure.contrib.str-utils usage

--- src/omnibus/steps.clj
+++ src/omnibus/steps.clj
@@ -18,10 +18,10 @@
 ;;

 (ns omnibus.steps
-(:use (omnibus (log :only [log-sh-result])
-               (util :only [file-str]))
+  (:use (omnibus (log :only [log-sh-result])
+                 (util :only [file-str]))
+        (clojure (string :only [join]))
         (clojure.tools (logging :only [log]))
-        (clojure.contrib (str-utils :only [str-join]))
         (clojure.java (shell :only [sh with-sh-env with-sh-dir])))
   (:gen-class))

@@ -36,7 +36,7 @@
 (defn- execute-step
   "Run a build step"
   [step path]
-  (let [step-info (str-join " " (cons (step :command) (step :args)))]
+  (let [step-info (join " " (cons (step :command) (step :args)))]
     (log :info (str "Running step: " step-info ))
     (with-sh-dir path
       (log-sh-result (run-shell step)


Fix add and remove bookmark link in entry representation.

--- src/oc/storage/representations/entry.clj
+++ src/oc/storage/representations/entry.clj
@@ -25,7 +25,7 @@
                            :team-id :author :publisher :published-at
                            :video-id :video-processed :video-image :video-duration
                            :created-at :updated-at :revision-id :new-at :follow-ups
-                           :bookmarks])
+                           :bookmarked])

 ;; ----- Utility functions -----

@@ -150,9 +150,11 @@
         board-access (:access board)
         draft? (= :draft (keyword (:status entry)))
         entry-with-comments (assoc entry :interactions comments)
+        bookmarked? ((set (:bookmarks entry)) user-id)
         full-entry (merge {:board-slug board-slug
                            :board-access board-access
                            :board-name (:name board)
+                           :bookmarked (boolean bookmarked?)
                            :new-at (-> (sort/entry-new-at user-id entry-with-comments true)
                                     vals
                                     first)} entry)
@@ -162,11 +164,10 @@
         comment-list (if (= access-level :public)
                         []
                         (take config/inline-comment-count (reverse (sort-by :created-at comments))))
-        bookmarks-links (if (= access-level :public)
-                         []
-                         (if ((set (:bookmarks entry)) user-id)
-                           [(remove-bookmark-link org-slug board-slug entry-uuid)]
-                           [(add-bookmark-link org-slug board-slug entry-uuid)]))
+        bookmarks-links (when (not= access-level :public)
+                          (if bookmarked?
+                            (remove-bookmark-link org-slug board-slug entry-uuid)
+                            (add-bookmark-link org-slug board-slug entry-uuid)))
         links (if secure-access?
                 ;; secure UUID access
                 [(secure-self-link org-slug secure-uuid)]


fix windows issue

fix windows issue

--- src/lt/objs/files.cljs
+++ src/lt/objs/files.cljs
@@ -369,3 +369,6 @@
       (let [cur (first to-walk)
             neue (filterv func (full-path-ls cur))]
         (recur (concat (rest to-walk) (dirs cur)) (concat found neue))))))
+
+(when-not (exists? (lt-user-dir))
+  (mkdir (lt-user-dir)))


Debug messages about flushing become informational.

--- src/org/spootnik/cyanite/store_cache.clj
+++ src/org/spootnik/cyanite/store_cache.clj
@@ -90,7 +90,7 @@

 (defn- run-flusher!
   [mkeys]
-  (debug "Flushing the cache...")
+  (info "Flushing the cache...")
   (doseq [[mkey pkeys] @mkeys]
     (let [m (meta @pkeys)
           delayer (get m :delayer nil)
@@ -99,7 +99,7 @@
         (future-cancel delayer)
         (when flusher
           (deref flusher)))))
-  (debug "The cache has been flushed"))
+  (info "The cache has been flushed"))

 (defn- store-chan
   [chan tenant period rollup time path data ttl]


Add unit/fetch

Add unit/fetch

--- src/obb_rules/unit.clj
+++ src/obb_rules/unit.clj
@@ -29,6 +29,11 @@
   [name]
   (@units-by-name name))

+(defn fetch
+  "Gets a unit"
+  [identifier]
+  (or (get-unit-by-name identifier) (get-unit-by-code identifier)))
+
 (defn unit-name "Gets a unit's name" [unit] (unit :name))
 (defn unit-code "Gets a unit's code" [unit] (unit :code))
 (defn unit-attack "Gets a unit's attack" [unit] (unit :attack))


Correct errors generating random units of measure

--- src/test_utils/fracture_diagnostics.cljc
+++ src/test_utils/fracture_diagnostics.cljc
@@ -33,21 +33,17 @@
 (defn rand-unit [physical-quantity]
   (rand-nth (get quantity-unit-map physical-quantity)))

-(repeatedly 25 (fn [] (let [physical-quantity (rand-physical-quantity)]
-                        [physical-quantity (rand-unit physical-quantity)])))
-
-
-(def rand-density-unit (rand-unit :density))
-(def rand-energy-unit (rand-unit :energy))
-(def rand-force-unit (rand-unit :force))
-(def rand-length-unit (rand-unit :length))
-(def rand-mass-unit (rand-unit :mass))
-(def rand-power-unit (rand-unit :power))
-(def rand-pressure-unit (rand-unit :pressure))
-(def rand-proppant-concentration-unit (rand-unit :proppant-concentration))
-(def rand-slurry-rate-unit (rand-unit :slurry-rate))
-(def rand-temperature-unit (rand-unit :temperature))
-(def rand-volume-unit (rand-unit :volume))
+(def rand-density-unit (fn []  (rand-unit :density)))
+(def rand-energy-unit (fn [] (rand-unit :energy)))
+(def rand-force-unit (fn [] (rand-unit :force)))
+(def rand-length-unit (fn [] (rand-unit :length)))
+(def rand-mass-unit (fn [] (rand-unit :mass)))
+(def rand-power-unit (fn [] (rand-unit :power)))
+(def rand-pressure-unit (fn [] (rand-unit :pressure)))
+(def rand-proppant-concentration-unit (fn [] (rand-unit :proppant-concentration)))
+(def rand-slurry-rate-unit (fn [] (rand-unit :slurry-rate)))
+(def rand-temperature-unit (fn [] (rand-unit :temperature)))
+(def rand-volume-unit (fn [] (rand-unit :volume)))

 (defn convert-units-f [from to]
   (let [factors   {[:ft-lb :J]                1.35582
@@ -636,7 +632,7 @@
        :hp (power-as (typical-power :W) :hp)))))

 (defn generate-measurement-pair [units generate-units-f generate-measurement-f measurement-as-f]
-  (let [unit        (generate-units-f)
+  (let [unit (generate-units-f)
         measurement (generate-measurement-f unit)]
     [measurement (measurement-as-f measurement (first (remove (partial = unit) units)))]))


Return make-measurement instead of double

--- src/test_utils/fracture_diagnostics.cljc
+++ src/test_utils/fracture_diagnostics.cljc
@@ -537,8 +537,14 @@
 (defn rand-depth-datum []
   (rand-nth depth-datums))

-(defn typical-kelly-bushing-elevation []
-  (tuc/draw-normal 30.48 (/ 1.00 3.00)))
+(defn typical-kelly-bushing-elevation
+  ([] (let [kb-unit (rand-length-unit)]
+        (typical-kelly-bushing-elevation kb-unit)))
+  ([kb-unit]
+   (let [kb-magnitude (condp = kb-unit
+                        :ft (tuc/draw-normal 30.48 (/ 1.00 3.00))
+                        :m (tuc/draw-normal 10.0 (/ (/ 1 3) 30.48)))]
+     (make-measurement kb-magnitude kb-unit))))

 (defn typical-pumped-volume
   ([] (let [volume-unit (rand-volume-unit)]


parsing trims

parsing trims

--- src/ontrail/mutate.clj
+++ src/ontrail/mutate.clj
@@ -54,7 +54,7 @@
   (re-matches re str))

 (defn try-parse [re-conv str]
-  (let [match (try-match (:re re-conv) str)]
+  (let [match (try-match (:re re-conv) (string/trim str))]
     (if match (apply (:conv re-conv) (rest match)))))

 (defn parse-duration [dur-str]


Use different array constructor

Use different array constructor

--- src/play_clj/utils.clj
+++ src/play_clj/utils.clj
@@ -153,7 +153,7 @@

 (defn gdx-array*
   [clj-arr]
-  (Array. true (into-array clj-arr) 0 (count clj-arr)))
+  (Array. (into-array clj-arr)))

 (defmacro gdx-array
   "Returns an [Array](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/utils/Array.html).


Add set-color-scheme! function for easier REPL control.

--- src/puget/printer.clj
+++ src/puget/printer.clj
@@ -51,6 +51,16 @@
   [& body]
   `(binding [*colored-output* true]
      ~@body))
+
+
+(defn set-color-scheme!
+  "Sets the color scheme for syntax elements. Pass either a map to merge into
+  the current color scheme, or a single element/colors pair. Colors should be
+  vector of color keywords."
+  ([colors]
+   (alter-var-root #'*color-scheme* merge colors))
+  ([element colors & more]
+   (set-color-scheme! (apply hash-map element colors more))))

 (defn set-map-commas!


add missing translations

add missing translations

--- src/om_dropzone/translations.cljs
+++ src/om_dropzone/translations.cljs
@@ -11,8 +11,10 @@
          :dictResponseError "Server responded with {{%s}} code."
          :dictCancelUpload "Cancel upload"
          :dictCancelUploadConfirmation "Are you sure you want to cancel this upload?"
-         :dictRemoveFileConfirmation ""
+         :dictRemoveFileConfirmation "Are you sure you want to delete this file?"
          :dictMaxFilesExceeded "You can not upload any more files."
+         :dictDefaultMessage "Drop files here to upload"
+         :dictRemoveFile "Remove file"
          :missing! "<Translation not found>"}

     :es {:dictFileTooBig "El archivo es muy grande ({{%s}}MiB). Tamaño máximo: {{%s}}MiB."
@@ -20,8 +22,10 @@
          :dictResponseError "El servidor respondió con el código {{%s}}."
          :dictCancelUpload "Cancelar carga de archivos"
          :dictCancelUploadConfirmation "¿Está seguro que desea cancelar la subida de archivos?"
-         :dictRemoveFileConfirmation ""
+         :dictRemoveFileConfirmation "¿Está seguro que desea borrar el archivo?"
+         :dictDefaultMessage "Arrastre aquí sus archivos para poder subirlos."
          :dictMaxFilesExceeded "No se pueden subir más archivos"
+         :dictRemoveFile "Borrar archivo"
          :missing! "<Traducción no encontrada>"}}})

 (defn _T


section is only new? if no real or placeholder section exists

--- src/open_company/api/sections.clj
+++ src/open_company/api/sections.clj
@@ -32,8 +32,10 @@
 ;; ----- Actions -----

 (defn- get-section [company-slug section-name as-of]
-  (if-let [section (section-res/get-section company-slug section-name as-of)]
-    {:section section}))
+  (let [section     (section-res/get-section company-slug section-name as-of)
+        placeholder (get (company-res/get-company company-slug) (keyword section-name))]
+    (when-let [s (or section placeholder)]
+      {:section s})))

 (defn- put-section [company-slug section-name section author]
   {:updated-section (section-res/put-section company-slug section-name section author)})
@@ -80,7 +82,7 @@
   :handle-options (fn [ctx] (options-for-section company-slug section-name ctx))

   ;; Create or update a section
-  :new? (by-method {:put (not (seq (section-res/list-revisions company-slug section-name)))})
+  :new? (by-method {:put (fn [ctx] (not (:section ctx)))})
   :put! (fn [ctx] (put-section company-slug section-name (:data ctx) (:user ctx)))
   :patch! (fn [ctx] (put-section company-slug section-name (merge (:section ctx) (:data ctx)) (:user ctx)))
   :handle-created (fn [ctx] (section-location-response (:updated-section ctx))))


move next-player binding into parent let

--- src/quoridor/core.clj
+++ src/quoridor/core.clj
@@ -133,14 +133,14 @@
     (if (game-over? state)
       (print-game-over state)
       (do (println (str current "'s move: "))
-          (let [move (s/trim (read-line))]
+          (let [move (s/trim (read-line))
+                next-player (first next)]
             (cond
               (= move "q") (println "Thanks for playing!")
-              (allowed-pawn-move? state move) (let [next-player (first next)]
-                                                (recur next-player
-                                                       (rest next)
-                                                       (-> state
-                                                           (assoc (keyword current) move)
-                                                           (assoc :current next-player))))
+              (allowed-pawn-move? state move) (recur next-player
+                                                     (rest next)
+                                                     (-> state
+                                                         (assoc (keyword current) move)
+                                                         (assoc :current next-player)))
               :else (do (println (str "Sorry, " move " is not a valid move"))
                         (recur current next state))))))))


Clarify why we get a connection and immediately return it

--- src/puppetlabs/jdbc_util/pool.clj
+++ src/puppetlabs/jdbc_util/pool.clj
@@ -65,6 +65,7 @@
           (loop []
             (if-let [result
                      (try
+                       ;; Try to get a connection to make sure the db is ready
                        (.close (.getConnection datasource))
                        (try (init-fn {:datasource datasource})
                             (catch Exception e


xymon.clj: format-line: renamed as event->status.

--- src/riemann/xymon.clj
+++ src/riemann/xymon.clj
@@ -6,7 +6,7 @@
             [clojure.math.numeric-tower :refer [ceil]])
   (:import java.net.Socket))

-(defn format-line
+(defn event->status
   "Formats an event as a Xymon status message:

   status[+LIFETIME][/group:GROUP] HOSTNAME.TESTNAME COLOR <additional text>
@@ -55,5 +55,5 @@
                      :port 1984} opts)]
     (fn [{:keys [state service] :as event}]
       (when (and state service)
-        (let [statusmessage (format-line event)]
+        (let [statusmessage (event->status event)]
           (send-line opts statusmessage))))))


Work prime number testers/generators

Work prime number testers/generators

--- src/shokunin/euler.clj
+++ src/shokunin/euler.clj
@@ -20,3 +20,22 @@
   ([x y] (cons x (lazy-seq (fib-seq y (+ x y))))))

 (def answer-2 (reduce + (filter even? (take-while (fn [x] (< x 4000000)) (fib-seq)))))
+
+;; prime number tools, useful for subsequent problems.
+
+;;; a super naive and expensive check
+(defn naive-prime? [n]
+  (cond
+   (< n 2) false
+   (= n 2) true
+   (even? n) false
+   :else (not-any? #(= 0 (rem n %)) (range 3 (Math/sqrt n) 2))))
+
+;; eratosthenes seive. does not work for large primes because the stack
+;; gets way too deep.
+(defn dirty-sieve
+  ([] (sieve (iterate inc 2)))
+  ([s]
+  (cons (first s)
+        (lazy-seq (sieve (filter #(not= 0 (rem % (first s)))
+                                 (rest s)))))))


Fix macroexpand-do

Fix macroexpand-do

--- src/shuriken/macro.clj
+++ src/shuriken/macro.clj
@@ -1,15 +1,25 @@
 (ns shuriken.macro)

+(defn dequote [expr]
+  (if (and (list? expr)
+           (= 'quote (first expr)))
+    (second expr)
+    expr))
+
 (defmacro macroexpand-do
+  ([expr]
+   `(macroexpand-do nil ~expr))
   ([mode expr]
    (let [macro-sym (case mode
-                     0    'macroexpand
+                     nil  'macroexpand
                      1    'macroexpand-1
                      :all 'clojure.walk/macroexpand-all)]
      `(do (println "-- Macro expansion -- ")
-          (clojure.pprint/pprint
-            (~macro-sym ~expr))
+          (clojure.pprint/pprint (~macro-sym ~expr))
           (newline)
+
           (println "-- Running macro --")
-          ~expr
-          (newline)))))
+          (let [result# ~(dequote expr)]
+            (clojure.pprint/pprint result#)
+            (newline)
+            result#)))))


Thunk kafka stream

Thunk kafka stream

--- src/zoo_event/component/kafka.clj
+++ src/zoo_event/component/kafka.clj
@@ -1,6 +1,5 @@
 (ns zoo-event.component.kafka
   (:require [clj-kafka.consumer.zk :as kafka]
-            [clojure.core.async :refer [>! chan pub go close!]]
             [clojure.tools.logging :as log]
             [com.stuartsierra.component :as component]
             [cheshire.core :refer [parse-string]]))
@@ -21,11 +20,8 @@

 (defn- kafka-stream
   [consumer topic threads]
-  (let [kchan (chan)]
-    (go (doseq [msg (kafka/messages consumer topic :threads threads)]
-          (log/info "Recieved Message " (:offset msg))
-          (>! kchan (kafka-json-string-to-map msg))))
-    kchan))
+  (let [msgs (map kafka-json-string-to-map (kafka/messages consumer topic :threads threads))]
+    (fn [] msgs)))

 (defrecord Kafka [zk-connect group-id topic threads consumer messages]
   component/Lifecycle


CMR-1913: Addressed a review comment

CMR-1913: Addressed a review comment

--- virtual-product-app/src/cmr/virtual_product/services/virtual_product_service.clj
+++ virtual-product-app/src/cmr/virtual_product/services/virtual_product_service.clj
@@ -307,9 +307,9 @@
                                                entries-by-src-collection))]
     (map (fn [annotated-entry]
            (let [[provider-id granule-ur] (get-prov-id-gran-ur annotated-entry)]
-             (if (nil? granule-ur)
-               annotated-entry
-               (get gran-ur-src-entry-map [provider-id granule-ur]))))
+             (if granule-ur
+               (get gran-ur-src-entry-map [provider-id granule-ur])
+               annotated-entry)))
          annotated-entries)))


generator of games

generator of games

--- test/cljs/triboard/core_test.cljs
+++ test/cljs/triboard/core_test.cljs
@@ -43,15 +43,46 @@
 ;; Generators
 ;; ----------------------------------------------------------------------------

-(def coord-gen (s/gen ::board/coord))
+(def coordinate-gen
+  "Generating random coordinates inside the board"
+  (s/gen ::board/coord))

-(def initial-empty-cell-count
+(def max-number-of-turn-by-game
+  "The maximum number of moves that can be played in a game"
   (- (* board/width board/height) (* 4 cst/init-block-count)))
+
+(defn valid-coordinate-gen
+  "Generate a valid coordinate that can be played at by the current player"
+  [game]
+  (let [transitions (turn/transitions (game/current-turn game))]
+    (if (empty? transitions)
+      (gen/return nil)
+      (gen/elements (keys transitions)))))

 (def game-gen
   (gen/fmap
     (fn [coord] (play-moves (game/new-game) coord))
-    (gen/vector coord-gen 0 initial-empty-cell-count)))
+    (gen/vector coordinate-gen 0 max-number-of-turn-by-game)))
+
+(defn play-n-moves-gen
+  "Play `n` random moves on the initial `game` provided as parameter"
+  [game n]
+  (if (zero? n)
+    (gen/return game)
+    (gen/bind
+      (valid-coordinate-gen game)
+      (fn play-coord [coord]
+        (if (nil? coord)
+          (gen/return game)
+          (play-n-moves-gen (game/play-at game coord) (dec n)))
+        ))
+    ))
+
+(def valid-game-gen
+  "Generate a valid game, where each move is valid"
+  (gen/bind
+    (gen/elements (range (inc max-number-of-turn-by-game)))
+    #(play-n-moves-gen (game/new-game) %)))

 ;; ----------------------------------------------------------------------------
@@ -68,7 +99,7 @@

 (defn game-move-properties
   [old-game]
-  (prop/for-all [coord coord-gen]
+  (prop/for-all [coord coordinate-gen]
     (let [new-game (game/play-at old-game coord)]
       (or
         (= old-game new-game)                               ;; TODO - test contained in empty cells
@@ -77,7 +108,7 @@

 #_(defn game-undo-properties
     [old-game]
-    (prop/for-all [coord coord-gen]
+    (prop/for-all [coord coordinate-gen]
       (let [new-game (game/play-at old-game coord)]
         (or
           (= old-game new-game)


be explicit about importing expect

be explicit about importing expect

--- test/digitalocean_expect/test.clj
+++ test/digitalocean_expect/test.clj
@@ -1,7 +1,7 @@
 (ns digitalocean-expect.test
   (:require [digitalocean.droplet :refer :all]
-            [environ.core :refer [env]])
-  (:use expectations))
+            [environ.core :refer [env]]
+            [expectations :refer [expect from-each]]))

 (def nodes (droplets (env :digitalocean-client-id) (env :digitalocean-api-key)))
 (def creds {:client (env :digitalocean-client-id) :key (env :digitalocean-api-key)})


Better formatting of cond statement

Better formatting of cond statement

--- src/whitman/config.clj
+++ src/whitman/config.clj
@@ -21,11 +21,11 @@

 (defn file-format [path]
   (case (file-extension path)
-        "ini"  :ini
-        "json" :json
-        "yaml" :yml
-        "yml"  :yml
-        nil))
+    "ini"  :ini
+    "json" :json
+    "yaml" :yml
+    "yml"  :yml
+    nil))

 (defmulti read-config file-format)
 (defmethod read-config :json [path]


Refactor minimax function

Refactor minimax function

--- src/tttclj/solver.clj
+++ src/tttclj/solver.clj
@@ -13,15 +13,8 @@
           (recur (rest moves) (if (> sc max_sc) sc max_sc)))
         max_sc))))

-(defn minimax-middle [game]
-  (if (is-game-over? game)
-    {}
-    (->> (possible-moves game)
-         (map (fn [m]
-                [m (minimax-inner (successor game m))]))
-         (into {}))))
-
 (defn minimax [game]
-  (if-let [scores (minimax-middle game)]
-    (key (apply max-key val scores))
-    nil))
+  (key (apply max-key val
+              (->> (possible-moves game)
+                   (map (fn [m] [m (minimax-inner (successor game m))]))
+                   (into {})))))


insights: remove unsemantic block wrapper

--- src-cljs/frontend/components/insights.cljs
+++ src-cljs/frontend/components/insights.cljs
@@ -255,15 +255,10 @@
        [:div.project-block
         [:h1 (gstring/format "%s/%s" username reponame)]
         [:h4 "Branch: " branch]
-        (cond (nil? recent_builds)
-              [:div.stats
-               [:div.loading-spinner common/spinner]]
-
-              (empty? builds)
-              [:div.stats
-               [:div.no-builds "No builds."]]
+        (cond (nil? recent_builds) [:div.loading-spinner common/spinner]
+              (empty? builds) [:div.no-builds "No builds."]
               :else
-              [:div.stats
+              (list
                [:div.above-info
                 [:dl
                  [:dt "MEDIAN BUILD"]
@@ -278,7 +273,7 @@
                [:div.below-info
                 [:dl
                  [:dt "Branches:"]
-                 [:dd (-> branches keys count)]]]])]))))
+                 [:dd (-> branches keys count)]]]))]))))

 (defrender no-projects [data owner]
   (html


fix dox

fix dox

--- src/metabase/driver/postgres/sync.clj
+++ src/metabase/driver/postgres/sync.clj
@@ -35,7 +35,7 @@
                  @table-names))))

 (defn sync-fields
-  "Sync `Fields` for TABLE. Returns number of `Fields` synced (i.e., number of columns in the Table)."
+  "Sync `Fields` for TABLE."
   [{:keys [id jdbc-columns] :as table}]
   (dorun (map (fn [{:keys [type_name column_name]}]
                 (or (exists? Field :table_id id :name column_name)


www/SearchResource.clj: fixed requires

www/SearchResource.clj: fixed requires

--- src/org/altlaw/www/SearchResource.clj
+++ src/org/altlaw/www/SearchResource.clj
@@ -1,7 +1,7 @@
 (ns org.altlaw.www.SearchResource
-  (:require [org.altlaw.pages.templates :as tmpl]
+  (:require [org.altlaw.www.render :as tmpl]
             [org.altlaw.util.date :as date]
-            [org.altlaw.util :as util]
+            [org.altlaw.util.courts :as courts]
             [org.altlaw.util.context :as context]
             [clojure.contrib.stacktrace :as stacktrace])
   (:use [clojure.contrib.str-utils :only (str-join)])
@@ -78,7 +78,7 @@
    :size (when-let [size (.getFieldValue doc "size")]
            (int (Math/ceil (/ size 1024.0))))
    :date (date/format-long-date (.getFieldValue doc "date"))
-   :court (util/*court-names* (.getFieldValue doc "court"))
+   :court (courts/*court-names* (.getFieldValue doc "court"))
    :name (tmpl/h the-name)
    :citations (map tmpl/h (.getFieldValues doc "citations"))}))


Adds smaller-than

Adds smaller-than

--- src/the_little_clojurian/chapter4.clj
+++ src/the_little_clojurian/chapter4.clj
@@ -110,6 +110,17 @@
             :else (greater-than (sub1 n) (sub1 m)))))

   (is (= (greater-than 0 0) false))
+  (is (= (greater-than 1 0) true))
   (is (= (greater-than 12 133) false))
   (is (= (greater-than 120 11) true))
   (is (= (greater-than 4 6) false)))
+
+(with-test
+  (def smaller-than
+    (fn [n m]
+      (cond (zero? m) false
+            (zero? n) true
+            :else (smaller-than (sub1 n) (sub1 m)))))
+
+  (is (= (smaller-than 0 0) false))
+  (is (= (smaller-than 0 1) true)))


Upgrade libs

Upgrade libs

--- modules/http-kit-events/project.clj
+++ modules/http-kit-events/project.clj
@@ -1,11 +1,11 @@
 ;; Copyright © 2014 JUXT LTD.

-(defproject juxt.modular/http-kit-events "0.6.0"
+(defproject juxt.modular/http-kit-events "0.6.1"
   :description "A modular extension that provides support for events over http-kit channels"
   :url "https://github.com/juxt/modular/tree/master/modules/http-kit-events"
   :license {:name "The MIT License"
             :url "http://opensource.org/licenses/MIT"}
-  :dependencies [[juxt.modular/http-kit "0.5.3"]
-                 [juxt.modular/bidi "0.9.0"]
+  :dependencies [[juxt.modular/http-kit "0.5.4"]
+                 [juxt.modular/bidi "0.9.2"]
                  [juxt.modular/async "0.5.3"]
                  ])


correct method name

correct method name

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

--- acqEngine/src/org/micromanager/control.clj
+++ acqEngine/src/org/micromanager/control.clj
@@ -28,7 +28,7 @@
         (when (vector? pos)
           (condp = (count pos)
             1 (mm/core setPosition stage (first pos))
-            2 (mm/core setPosition stage (first pos) (second pos)))))))
+            2 (mm/core setXYPosition stage (first pos) (second pos)))))))

 (defn set-camera-exposures!
   "Sets the specified camera exposure settings. The input argument should be something like
@@ -65,7 +65,8 @@
   [old-state new-state]
   (set-hardware-state! (new-values old-state new-state)))

-(def hardware-state-atom
+(def hardware-state-atom
+  "Current hardware state. Changing values will cause hardware commands to be sent."
   (let [update-function (fn [_ _ old-state new-state]
                           (update-hardware-state! old-state new-state))]
     (doto (atom {})


delaney.clj: new function (oriented-cover)

--- clojure/org/gavrog/clojure/delaney.clj
+++ clojure/org/gavrog/clojure/delaney.clj
@@ -587,6 +587,33 @@
   ([ds1 ds2 & xds]
     (reduce append (append ds1 ds2) xds)))

+(defn- oc-pairs [ori n D E]
+  (cond (= D E)
+        [[D (+ D n)] [(+ D n) D]],
+        (= (ori D) (ori E))
+        [[D (+ E n)] [(+ E n) D] [(+ D n) E] [E (+ D n)]],
+        :else
+        [[D E] [E D] [(+ D n) (+ E n)] [(+ E n) (+ D n)]]))
+
+(defn oriented-cover [ds]
+  (if (oriented? ds)
+    ds
+    (let [ds (dsymbol ds)
+          ori (partial-orientation ds)
+          d (dim ds)
+          n (size ds)
+          ops (into {} (for [i (range (inc d))]
+                         [i (into {} (apply concat
+                                            (for [D (elements ds)
+                                                  :let [E (s ds i D)]]
+                                              (oc-pairs ori n D E))))]))
+          vs (into {} (for [i (range d)]
+                        [i (into {} (apply concat
+                                           (for [D (elements ds)
+                                                 :let [x (v ds i (inc i) D)]]
+                                             [[D x] [(+ D n) x]])))]))]
+      (DSymbol. d (+ n n) ops vs))))
+
 ;; === Tests

 (deftest delaney-test


Refactoring

Refactoring

and added *default-node-style* and *default-line-style*.

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

--- conexp/graphics/base.clj
+++ conexp/graphics/base.clj
@@ -56,6 +56,12 @@

 ;;; create and connect nodes

+(def *default-node-style* (let [style (GStyle.)]
+			    (doto style
+			      (.setForegroundColor (Color.  6  6 86))
+			      (.setBackgroundColor (Color. 23 11 84)))
+			    style))
+
 (defn add-node [scn x y]
   (let [segment (GSegment.)
 	object (proxy [GObject] []
@@ -63,16 +69,21 @@
 		   (let [[x y] (position this)]
 		     (.setGeometryXy segment (Geometry/createCircle (double x) (double y) 10.0)))))
 	style (GStyle.)]
-    (.addSegment object segment)
-    (doto style
-      (.setForegroundColor (Color.  6  6 86))
-      (.setBackgroundColor (Color. 23 11 84)))
-    (.setStyle segment style)
-    (.setUserData object (ref {:type :node,
-			       :position [x y]}))
-    (.setName object (str [x y]))
-    (.add scn object)
+    (doto segment
+      (.setStyle *default-node-style*))
+    (doto object
+      (.addSegment segment)
+      (.setUserData (ref {:type :node,
+			  :position [x y]}))
+      (.setName (str [x y])))
+    (doto scn
+      (.add object))
     object))
+
+(def *default-line-style* (let [style (GStyle.)]
+			    (doto style
+			      (.setLineWidth 3.0))
+			    style))

 (defn connect-nodes [scn x y]
   (let [line (GSegment.)
@@ -81,12 +92,17 @@
 		    (let [[x1 y1] (position (lower-node this))
 			  [x2 y2] (position (upper-node this))]
 		      (.setGeometry line (double x1) (double y1) (double x2) (double y2)))))]
-    (.add scn c)
-    (.addSegment c line)
-    (.toBack c)
-    (.setUserData c (ref {:type :connection,
+    (doto scn
+      (.add c))
+    (doto line
+      (.setStyle *default-line-style*))
+    (doto c
+      (.addSegment line)
+      (.toBack)
+      (.setUserData (ref {:type :connection,
 			  :lower x,
 			  :upper y}))
+      (.setName (str (.getName x) " -> " (.getName y))))
     (dosync
      (alter (.getUserData x) update-in [:upper] conj c)
      (alter (.getUserData y) update-in [:lower] conj c))))


Add back heroku profile with mirrors.

Add back heroku profile with mirrors.

To avoid getting profile not found for users with it in their procfile.

--- opt/profiles.clj
+++ opt/profiles.clj
@@ -1,4 +1,6 @@
 {:user {:mirrors {#"central|clojars"
                   "http://s3pository.herokuapp.com/clojure"}}
  :production {:mirrors {#"central|clojars"
-                        "http://s3pository.herokuapp.com/clojure"}}}+                        "http://s3pository.herokuapp.com/clojure"}}
+ :heroku {:mirrors {#"central|clojars"
+                    "http://s3pository.herokuapp.com/clojure"}}}


core: printf

core: printf

--- core/data/core.clj
+++ core/data/core.clj
@@ -2786,6 +2786,12 @@
   ^String [fmt & args]
   (apply format* fmt args))

+(defn printf
+  "Prints formatted output, as per format"
+  {:added "1.0"}
+  [fmt & args]
+  (print (apply format fmt args)))
+
 (defn get-in
   "Returns the value in a nested associative structure,
   where ks is a sequence of keys. Returns nil if the key


Fix how static fields are displayed

Fix how static fields are displayed

--- doclet/src/clojure/play_clj_doclet/core.clj
+++ doclet/src/clojure/play_clj_doclet/core.clj
@@ -43,8 +43,8 @@
          (cond
            (isa? (type d) ExecutableMemberDoc)
            {:args (->> d .parameters (map parse-param) vec)}
-           (isa? (type d) FieldDoc)
-           {:args [[(-> d .type .typeName) "val"]]})))
+           (and (isa? (type d) FieldDoc) (not (.isStatic d)))
+           {:args [[(-> d .type .typeName) "value"]]})))

 (defn parse-class-entry
   [^ClassDoc c type]


Consistently describe our synth components as nodes.

--- src/klangmeister/synthesis.cljs
+++ src/klangmeister/synthesis.cljs
@@ -25,19 +25,18 @@
 ; Envelopes

 (defn envelope
-  "Build an envelope out of [dx y] coordinates, starting at [0 0]."
+  "Build an envelope out of [segment-duration final-level] coordinates."
   [& corners]
   (fn [context at duration]
-    (let [node (.createGain context)
-          gain (.-gain node)]
-      (.setValueAtTime gain 0.0 at)
+    (let [audio-node (.createGain context)]
+      (-> audio-node .-gain (.setValueAtTime 0.0 at))
       (reduce
         (fn [x [dx y]]
-          (.linearRampToValueAtTime gain y (+ x dx))
+          (-> audio-node .-gain (.linearRampToValueAtTime y (+ x dx)))
           (+ dx x))
         at
         corners)
-      node)))
+      audio-node)))

 (defn adshr [attack decay sustain hold release]
   (envelope [attack 1.0] [decay sustain] [hold sustain] [release 0]))
@@ -46,8 +45,8 @@
   (fn [context at duration]
     (let [remainder (- duration attack decay sustain)
           hold (max 0.0 remainder)
-          ugen (adshr attack decay sustain hold release)]
-      (-> ugen (run-with context at duration)))))
+          node (adshr attack decay sustain hold release)]
+      (-> node (run-with context at duration)))))

 (defn percussive [attack decay]
   (envelope [attack 1.0] [decay 0.0]))
@@ -56,20 +55,20 @@
 ; Combinators

 (defn connect
-  [ugen1 ugen2]
+  [node1 node2]
   (fn [context at duration]
-    (let [sink (-> ugen2 (run-with context at duration))]
-      (-> ugen1 (run-with context at duration) (.connect sink))
+    (let [sink (-> node2 (run-with context at duration))]
+      (-> node1 (run-with context at duration) (.connect sink))
       sink)))

 (defn connect-> [& nodes]
   (reduce connect nodes))

-(defn add [& ugens]
+(defn add [& nodes]
   (fn [context at duration]
     (let [sink (-> (gain 1.0) (run-with context at duration))]
-      (doseq [ugen ugens]
-        (-> ugen (run-with context at duration) (.connect sink)))
+      (doseq [node nodes]
+        (-> node (run-with context at duration) (.connect sink)))
       sink)))


Queries with unspecified result types now always return EntityProtocol objects.

--- src/appengine_magic/services/datastore.clj
+++ src/appengine_magic/services/datastore.clj
@@ -310,6 +310,9 @@
          (save!-helper this#)))))

+(defentity EntityBase [])
+
+
 (extend-type Iterable
   EntityProtocol
   (save! [this] (save-many-helper! this)))
@@ -355,16 +358,16 @@
         result-count (.countEntities prepared-query)]
     (cond count-only? result-count
           (zero? result-count) (list)
-          :else (let [results (seq (.asIterable prepared-query fetch-options-object))]
-                  (if-not result-type
-                      ;; no valid result type given; just return raw Entity objects
-                      results
-                      ;; convert into EntityProtocol records
-                      (let [model-record (record result-type)]
-                        (map #(with-meta
-                                (merge model-record (entity->properties (.getProperties %)))
-                                {:key (.getKey %)})
-                             results)))))))
+          :else (let [results (seq (.asIterable prepared-query fetch-options-object))
+                      model-record (if result-type
+                                       ;; we know this type; good
+                                       (record result-type)
+                                       ;; unknown type; just use a basic EntityProtocol
+                                       (EntityBase.))]
+                  (map #(with-meta
+                          (merge model-record (entity->properties (.getProperties %)))
+                          {:key (.getKey %)})
+                       results)))))

 (defmacro query


remove json doc generator, and keep sections one-word

--- get-symbol-metadata/src/core.clj
+++ get-symbol-metadata/src/core.clj
@@ -245,27 +245,14 @@
      (cljsdoc-section "Signature" (join "\n" (:signatures item)))
      (cljsdoc-section "Filename" (:filename item))
      (cljsdoc-section "Source" (:source item))
-     (cljsdoc-section "Github Link" (:github-link item))]))
-
-(defn make-json
-  [item]
-  (json/write-str
-    {:name (:full-name item)
-     :type (:fn-or-macro item)
-     :docstring (:docstring item)
-     :signature (map pr-str (:signatures item))
-     :filename (:filename item)
-     :source (:source item)
-     :github (:github-link item)}))
+     (cljsdoc-section "Github" (:github-link item))]))

 (defn write-item
   [item]
   (let [filename (item-filename item)
-        cljsdoc-content (make-cljsdoc item)
-        json-content (make-json item)]
+        cljsdoc-content (make-cljsdoc item)]
     (println "Writing" filename "...")
-    (spit (str filename ".cljsdoc") cljsdoc-content)
-    (spit (str filename ".json") json-content)))
+    (spit (str filename ".cljsdoc") cljsdoc-content)))

 ;;------------------------------------------------------------
 ;; Symbol Retrieval


Restore missing header items.

Restore missing header items.

--- src-cljs/frontend/components/header.cljs
+++ src-cljs/frontend/components/header.cljs
@@ -149,52 +149,54 @@
                                    :height 25})]]
             [:ul.nav.navbar-nav
              (when (config/show-marketing-pages?)
-               [:li.dropdown {:class (when (contains? #{:features
-                                                        :mobile
-                                                        :ios
-                                                        :android
-                                                        :integrations
-                                                        :enterprise}
-                                                      nav-point)
-                                       "active")}
-                [:a {:href "/features"}
-                 "Product "
-                 [:i.fa.fa-caret-down]]
-                [:ul.dropdown-menu
-                 [:li {:role "presentation"}
-                  [:a {:role "menuitem"
-                       :tabIndex "-1"
-                       :href "/features"}
-                   "Features"]]
-                 [:li {:role "presentation"}
-                  [:a {:role "menuitem"
-                       :tabIndex "-1"
-                       :href "/mobile"}
-                   "Mobile"]]
-                 [:li {:role "presentation"}
-                  [:a {:role "menuitem"
-                       :tabIndex "-1"
-                       :href "/integrations/docker"}
-                   "Docker"]]
-                 [:li {:role "presentation"}
-                  [:a {:role "menuitem"
-                       :tabIndex "-1"
-                       :href "/enterprise"}
-                   "Enterprise"]]]]
-               [:li (maybe-active nav-point :pricing)
-                [:a {:href "/pricing"} "Pricing"]])
+               (list
+                [:li.dropdown {:class (when (contains? #{:features
+                                                         :mobile
+                                                         :ios
+                                                         :android
+                                                         :integrations
+                                                         :enterprise}
+                                                       nav-point)
+                                        "active")}
+                 [:a {:href "/features"}
+                  "Product "
+                  [:i.fa.fa-caret-down]]
+                 [:ul.dropdown-menu
+                  [:li {:role "presentation"}
+                   [:a {:role "menuitem"
+                        :tabIndex "-1"
+                        :href "/features"}
+                    "Features"]]
+                  [:li {:role "presentation"}
+                   [:a {:role "menuitem"
+                        :tabIndex "-1"
+                        :href "/mobile"}
+                    "Mobile"]]
+                  [:li {:role "presentation"}
+                   [:a {:role "menuitem"
+                        :tabIndex "-1"
+                        :href "/integrations/docker"}
+                    "Docker"]]
+                  [:li {:role "presentation"}
+                   [:a {:role "menuitem"
+                        :tabIndex "-1"
+                        :href "/enterprise"}
+                    "Enterprise"]]]]
+                [:li (maybe-active nav-point :pricing)
+                 [:a {:href "/pricing"} "Pricing"]]))
              [:li (maybe-active nav-point :documentation)
               [:a {:href "/docs"} "Documentation"]]
              (when (config/show-marketing-pages?)
-               [:li {:class (when (contains? #{:about
-                                               :contact
-                                               :team
-                                               :jobs
-                                               :press}
-                                             nav-point)
-                              "active")}
-                [:a {:href "/about"} "About Us"]]
-               [:li [:a {:href "http://blog.circleci.com"} "Blog"]])]
+               (list
+                [:li {:class (when (contains? #{:about
+                                                :contact
+                                                :team
+                                                :jobs
+                                                :press}
+                                              nav-point)
+                               "active")}
+                 [:a {:href "/about"} "About Us"]]
+                [:li [:a {:href "http://blog.circleci.com"} "Blog"]]))]

             (if logged-in?
               [:ul.nav.navbar-nav.navbar-right


stub out bot movement logic

stub out bot movement logic

--- src/clj/battlebots/game/step_operators.clj
+++ src/clj/battlebots/game/step_operators.clj
@@ -9,15 +9,18 @@
             [battlebots.game.utils :as gu]
             [battlebots.arena.utils :as au]))

+(defn- calculate-ai-move
+  [[x y] arena]
+  ;; TODO Add bot movement logic
+  arena)
+
 (defn- apply-ai-decision
   [{:keys [dirty-arena] :as game-state} ai-uuid]
   (let [bot-coords (gu/get-item-coords ai-uuid dirty-arena)
         ai-bot (au/get-item bot-coords dirty-arena)
         is-current-ai-bot? (= ai-uuid (:uuid ai-bot))]
     (if is-current-ai-bot?
-      (do
-        "TODO: Apply bot logic: https://github.com/willowtreeapps/battlebots/issues/63"
-        game-state)
+      (calculate-ai-move bot-coords dirty-arena)
       game-state)))

 (defn- get-ai-bots


Formatting in ndvi.

Formatting in ndvi.

--- src/clj/forma/presentation/ndvi_filter.clj
+++ src/clj/forma/presentation/ndvi_filter.clj
@@ -143,12 +143,12 @@

 (def plot3
   (doto (c/time-series-plot forma-range
-                      ndvi
-                      :title ""
-                      :x-label ""
-                      :y-label ""
-                      :legend true
-                      :series-label "NDVI")
+                            ndvi
+                            :title ""
+                            :x-label ""
+                            :y-label ""
+                            :legend true
+                            :series-label "NDVI")
     (c/set-stroke-color java.awt.Color/green)))

@@ -233,21 +233,19 @@

 (def plot-breaks
   (doto (c/time-series-plot bfast-range
-                      Yt
-                      :title ""
-                      :x-label ""
-                      :y-label "NDVI Value"
-                      :legend false
-                      :series-label "NDVI")
+                            Yt
+                            :title ""
+                            :x-label ""
+                            :y-label "NDVI Value"
+                            :legend false
+                            :series-label "NDVI")
     (c/set-stroke-color java.awt.Color/BLUE)))

-(defn add-deseasonal
-  []
+(defn add-deseasonal []
   (c/add-lines plot-breaks bfast-range
-                Vt))
-
-(defn add-break
-  []
+               Vt))
+
+(defn add-break []
   (c/add-lines plot-breaks bfast-range
                (:series (mosum-prediction (i/matrix (hp-filter Yt 10))
                                           (i/bind-columns (repeat (count Yt) 1)


use new container maker for pixelfonts

use new container maker for pixelfonts

--- src/cljs/infinitelives/pixi/pixelfont.cljs
+++ src/cljs/infinitelives/pixi/pixelfont.cljs
@@ -43,12 +43,18 @@
 (defn make-text [font-key text & {:keys [tint scale anchor rotation
                                          x y visible
                                          xhandle yhandle]
-                                  :or {scale s/*default-scale*}}]
+                                  :or {scale s/*default-scale*
+                                       visible true}}]
   (let [font (get-font font-key)
-        batch
-        (if tint
-          (js/PIXI.Container.)
-          (js/PIXI.ParticleContainer.))]
+        batch (s/make-container
+               []
+               :particle (not tint)
+               :scale scale
+               :rotation rotation
+               :x x
+               :y y
+               :visible visible
+               )]
     (loop [[c & l] (seq text)
            xp 0 yp 0
            last-c nil]
@@ -65,25 +71,17 @@
             (recur l (+ xp (:space font)) yp c))

           (do
-            ;character is present, add the sprite to the container
+                                        ;character is present, add the sprite to the container
             (.addChild batch (s/make-sprite texture :x (+ xp koff) :y yp :xhandle 0 :yhandle 0 :tint tint :scale 1))
             (if (seq l)
               (recur l (+ xp w 1.0 koff) yp c)
               (s/set-pivot! batch (/ (+ xp w koff) 2.0) 0))))))

     ;; set setup details
-    (when scale
-      (s/set-scale! batch scale))
-    (when rotation
-      (s/set-rotation! batch rotation))
-    (when anchor
-      (s/set-anchor! batch (anchor 0) (anchor 1)))
-    (when x
-      (s/set-x! batch x))
-    (when y
-      (s/set-y! batch y))
-    (when-not (nil? visible)
-      (s/set-visible! batch visible))
+    ;; (when xhandle
+    ;;   (s/set-xhandle! batch xhandle))
+    ;; (when yhandle
+    ;;   (s/set-yhandle! batch yhandle))
     batch))

 (comment


font text appear go block

font text appear go block

--- src/cljs/infinitelives/pixi/pixelfont.cljs
+++ src/cljs/infinitelives/pixi/pixelfont.cljs
@@ -2,7 +2,9 @@
   (:require [infinitelives.pixi.texture :as t]
             [infinitelives.pixi.resources :as r]
             [infinitelives.pixi.sprite :as s]
-            [infinitelives.utils.console :refer [log]]))
+            [infinitelives.utils.console :refer [log]]
+            [cljs.core.async :refer [<! chan put! timeout close!]])
+  (:require-macros [cljs.core.async.macros :refer [go]]))

 (defonce pixel-fonts
   (atom {}))
@@ -92,6 +94,35 @@
    :xhandle xhandle
    :yhandle yhandle))

+(defn appear-text [font-key text & {:keys [tint scale anchor rotation
+                                           x y visible
+                                           xhandle yhandle
+                                           delay]
+                                    :or {scale s/*default-scale*
+                                         visible true
+                                         xhandle 0.5
+                                         yhandle 0.5
+                                         delay 32}}]
+  (let [chars (make-char-sprite-set font-key text tint)
+        batch
+        (s/make-container
+         []
+         :particle (not tint)
+         :scale scale
+         :rotation rotation
+         :x x
+         :y y
+         :visible visible
+         :xhandle xhandle
+         :yhandle yhandle)]
+    (go
+      (loop [[c & r] chars]
+        (.addChild batch c)
+        (s/update-handle! batch xhandle yhandle)
+        (<! (timeout delay))
+        (when r (recur r))))
+    batch))
+
 (comment
   (infinitelives.pixi.pixelfont/load-pixel-font :test-font :test [["A" 146 89 140 97] ["B" 154 89 148 97]])


dependant imports

dependant imports

--- src/cljs/infinitelives/pixi/resources.cljs
+++ src/cljs/infinitelives/pixi/resources.cljs
@@ -1,4 +1,11 @@
-(ns infinitielives.pixi.resources)
+(ns infinitelives.pixi.resources
+  (:require [PIXI]
+            [infinitelives.pixi.sprite :as sprite]
+            [infinitelives.utils.string :as string]
+            [infinitelives.utils.events :as events]
+            [infinitelives.utils.console :refer [log]]
+            [cljs.core.async :refer [chan put! <! timeout close!]])
+  (:require-macros [cljs.core.async.macros :refer [go]]))

 ;; where we store all the loaded textures keyed by name
 (defonce !textures (atom {}))