Apply (auto-icebreaker) to pumpable breakers

--- src/clj/game/cards.clj
+++ src/clj/game/cards.clj
@@ -18,7 +18,9 @@
                                                          (or (:current-strength card) (:strength card)))))
                       pumpnum (when strdif (int (Math/ceil (/ strdif (:pump pumpabi)))))]
                   (update! state side (assoc card :abilities
-                           (if (and (:rezzed current-ice) (some #(has? current-ice :subtype %) (:breaks card))
+                           (if (and (:rezzed current-ice)
+                                    (or (some #(has? current-ice :subtype %) (:breaks card))
+                                        (= (first (:breaks card)) "All"))
                                     (> strdif 0))
                              (vec (cons {:auto-pump true :cost [:credit (* pumpcst pumpnum)]
                                          :label (str "Match strength of " (:title current-ice))} abs))
@@ -2894,14 +2896,16 @@
    ;; Icebreakers

    "Alpha"
-   {:abilities [{:cost [:credit 1] :req (req (and run (zero? (:position run))))
-                 :msg "break 1 subroutine on the outermost ICE protecting this server"}
-                {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1))}]}
+   (auto-icebreaker ["All"]
+     {:abilities [{:cost [:credit 1] :req (req (and run (zero? (:position run))))
+                   :msg "break 1 subroutine on the outermost ICE protecting this server"}
+                  {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1)) :pump 1}]})

    "Alias"
-   {:abilities [{:cost [:credit 1] :req (req (#{:hq :rd :archives} (first (:server run))))
-                 :msg "break 1 sentry subroutine"}
-                {:cost [:credit 2] :msg "add 3 strength" :effect (effect (pump card 3))}]}
+   (auto-icebreaker ["Sentry"]
+     {:abilities [{:cost [:credit 1] :req (req (#{:hq :rd :archives} (first (:server run))))
+                   :msg "break 1 sentry subroutine"}
+                  {:cost [:credit 2] :msg "add 3 strength" :effect (effect (pump card 3)) :pump 3}]})

    "Atman"
    {:prompt "How many power counters?" :choices :credit :msg (msg "add " target " power counters")
@@ -2912,37 +2916,44 @@
                              :effect (effect (update-breaker-strength card))}}}

    "Aurora"
-   {:abilities [{:cost [:credit 2] :msg "break 1 barrier subroutine"}
-                {:cost [:credit 2] :msg "add 3 strength" :effect (effect (pump card 3))}]}
+   (auto-icebreaker ["Barrier"]
+     {:abilities [{:cost [:credit 2] :msg "break 1 barrier subroutine"}
+                  {:cost [:credit 2] :msg "add 3 strength" :effect (effect (pump card 3)) :pump 3}]})

    "Battering Ram"
-   {:abilities [{:cost [:credit 2] :msg "break up to 2 barrier subroutines"}
-                {:cost [:credit 1] :msg "add 1 strength for the remainder of this run"
-                 :effect (effect (pump card 1 :all-run))}]}
+   (auto-icebreaker ["Barrier"]
+     {:abilities [{:cost [:credit 2] :msg "break up to 2 barrier subroutines"}
+                  {:cost [:credit 1] :msg "add 1 strength for the remainder of this run"
+                   :effect (effect (pump card 1 :all-run)) :pump 1}]})

    "BlacKat"
-   {:abilities [{:cost [:credit 1] :msg "break 1 barrier subroutine"}
-                {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1))}]}
+   (auto-icebreaker ["Barrier"]
+     {:abilities [{:cost [:credit 1] :msg "break 1 barrier subroutine"}
+                  {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1)) :pump 1}]})

    "Breach"
-   {:abilities [{:cost [:credit 2] :req (req (#{:hq :rd :archives} (first (:server run))))
-                 :msg "break 3 barrier subroutines"}
-                {:cost [:credit 2] :msg "add 4 strength" :effect (effect (pump card 4))}]}
+   (auto-icebreaker ["Barrier"]
+     {:abilities [{:cost [:credit 2] :req (req (#{:hq :rd :archives} (first (:server run))))
+                   :msg "break 3 barrier subroutines"}
+                  {:cost [:credit 2] :msg "add 4 strength" :effect (effect (pump card 4)) :pump 4}]})

    "Cerberus \"Cuj.0\" H3"
-   {:data {:counter 4}
-    :abilities [{:counter-cost 1 :msg "break up to 2 sentry subroutines"}
-                {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1))}]}
+   (auto-icebreaker ["Sentry"]
+     {:data {:counter 4}
+      :abilities [{:counter-cost 1 :msg "break up to 2 sentry subroutines"}
+                  {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1)) :pump 1}]})

    "Cerberus \"Rex\" H2"
-   {:data {:counter 4}
-    :abilities [{:counter-cost 1 :msg "break up to 2 code gate subroutines"}
-                {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1))}]}
+   (auto-icebreaker ["Code Gate"]
+     {:data {:counter 4}
+      :abilities [{:counter-cost 1 :msg "break up to 2 code gate subroutines"}
+                  {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1)) :pump 1}]})

    "Cerberus \"Lady\" H1"
-   {:data {:counter 4}
-    :abilities [{:counter-cost 1 :msg "break up to 2 barrier subroutines"}
-                {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1))}]}
+   (auto-icebreaker ["Barrier"]
+     {:data {:counter 4}
+      :abilities [{:counter-cost 1 :msg "break up to 2 barrier subroutines"}
+                  {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1)) :pump 1}]})

    "Chameleon"
    {:prompt "Choose one subtype" :choices ["Barrier" "Code Gate" "Sentry"]
@@ -2956,8 +2967,9 @@
                   {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1)) :pump 1}]})

    "Creeper"
-   {:abilities [{:cost [:credit 2] :msg "break 1 sentry subroutine"}
-                {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1))}]}
+   (auto-icebreaker ["Sentry"]
+     {:abilities [{:cost [:credit 2] :msg "break 1 sentry subroutine"}
+                  {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1)) :pump 1}]})

    "Crowbar"
    {:abilities [{:msg "break up to 3 code gate subroutines" :effect (effect (trash card {:cause :ability-cost}))}]
@@ -2967,19 +2979,22 @@
     :strength-bonus (req (count (filter #(has? % :subtype "Icebreaker") (all-installed state :runner))))}

    "Crypsis"
-   {:abilities [{:cost [:credit 1] :msg "break ICE subroutine"}
-                {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1))}
-                {:cost [:click 1] :msg "place 1 virus counter"
-                 :effect (effect (add-prop card :counter 1))}
-                {:counter-cost 1 :label "Remove 1 hosted virus counter" :msg "remove 1 virus counter"}]}
+   (auto-icebreaker ["All"]
+     {:abilities [{:cost [:credit 1] :msg "break ICE subroutine"}
+                  {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1)) :pump 1}
+                  {:cost [:click 1] :msg "place 1 virus counter"
+                   :effect (effect (add-prop card :counter 1))}
+                  {:counter-cost 1 :label "Remove 1 hosted virus counter" :msg "remove 1 virus counter"}]})

    "Cyber-Cypher"
-   {:abilities [{:cost [:credit 1] :msg "break 1 code gate subroutine"}
-                {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1))}]}
+   (auto-icebreaker ["Code Gate"]
+     {:abilities [{:cost [:credit 1] :msg "break 1 code gate subroutine"}
+                  {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1)) :pump 1}]})

    "Dagger"
-   {:abilities [{:cost [:credit 1] :msg "break 1 sentry subroutine"}
-                {:cost [:credit 1] :msg "add 5 strength" :effect (effect (pump card 5))}]}
+   (auto-icebreaker ["Sentry"]
+     {:abilities [{:cost [:credit 1] :msg "break 1 sentry subroutine"}
+                  {:cost [:credit 1] :msg "add 5 strength" :effect (effect (pump card 5)) :pump 5}]})

    "Darwin"
    {:events {:runner-turn-begins
@@ -2994,13 +3009,15 @@
                  :effect (effect (trash card {:cause :ability-cost}) (damage-prevent :net Integer/MAX_VALUE))}]}

    "Eater"
-   {:abilities [{:cost [:credit 1] :msg "break ICE subroutine and access 0 cards this run"
-                 :effect (effect (max-access 0))}
-                {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1))}]}
+   (auto-icebreaker ["All"]
+     {:abilities [{:cost [:credit 1] :msg "break ICE subroutine and access 0 cards this run"
+                   :effect (effect (max-access 0))}
+                  {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1)) :pump 1}]})

    "Faerie"
-   {:abilities [{:msg "break any number of sentry subroutines" :effect (effect (trash card))}
-                {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1))}]}
+   (auto-icebreaker ["Sentry"]
+     {:abilities [{:msg "break any number of sentry subroutines" :effect (effect (trash card))}
+                  {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1)) :pump 1}]})

    "Faust"
    {:abilities [{:label "Trash 1 card from Grip to break 1 subroutine"
@@ -3013,16 +3030,19 @@
                  :effect (effect (trash target) (pump card 2))}]}

    "Femme Fatale"
-   {:abilities [{:cost [:credit 1] :msg "break 1 sentry subroutine"}
-                {:cost [:credit 2] :msg "add 1 strength" :effect (effect (pump card 1))}]}
+   (auto-icebreaker ["Sentry"]
+     {:abilities [{:cost [:credit 1] :msg "break 1 sentry subroutine"}
+                  {:cost [:credit 2] :msg "add 1 strength" :effect (effect (pump card 1)) :pump 1}]})

    "Force of Nature"
-   {:abilities [{:cost [:credit 2] :msg "break up to 2 code gate subroutines"}
-                {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1))}]}
+   (auto-icebreaker ["Code Gate"]
+     {:abilities [{:cost [:credit 2] :msg "break up to 2 code gate subroutines"}
+                  {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1)) :pump 1}]})

    "Garrote"
-   {:abilities [{:cost [:credit 1] :msg "break 1 sentry subroutine"}
-                {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1))}]}
+   (auto-icebreaker ["Sentry"]
+     {:abilities [{:cost [:credit 1] :msg "break 1 sentry subroutine"}
+                  {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1)) :pump 1}]})

    "Gordian Blade"
    (auto-icebreaker ["Code Gate"]
@@ -3031,13 +3051,15 @@
                    :effect (effect (pump card 1 :all-run))}]})

    "Gingerbread"
-   {:abilities [{:cost [:credit 1] :msg "break 1 tracer subroutine"}
-                {:cost [:credit 2] :msg "add 3 strength" :effect (effect (pump card 3))}]}
+   (auto-icebreaker ["Tracer"]
+     {:abilities [{:cost [:credit 1] :msg "break 1 tracer subroutine"}
+                  {:cost [:credit 2] :msg "add 3 strength" :effect (effect (pump card 3)) :pump 3}]})

    "Inti"
-   {:abilities [{:cost [:credit 1] :msg "break 1 barrier subroutine"}
-                {:cost [:credit 2] :msg "add 1 strength for the remainder of this run"
-                 :effect (effect (pump card 1 true))}]}
+   (auto-icebreaker ["Barrier"]
+     {:abilities [{:cost [:credit 1] :msg "break 1 barrier subroutine"}
+                  {:cost [:credit 2] :msg "add 1 strength for the remainder of this run"
+                   :effect (effect (pump card 1 :all-run)) :pump 1}]})

    "Knight"
    {:abilities [{:label "Host Knight on a piece of ICE" :cost [:click 1]
@@ -3049,8 +3071,9 @@
                 {:cost [:credit 2] :msg "break 1 subroutine on the host ICE"}]}

    "Leviathan"
-   {:abilities [{:cost [:credit 3] :msg "break up to 3 code gate subroutines"}
-                {:cost [:credit 3] :msg "add 5 strength" :effect (effect (pump card 5))}]}
+   (auto-icebreaker ["Code Gate"]
+     {:abilities [{:cost [:credit 3] :msg "break up to 3 code gate subroutines"}
+                  {:cost [:credit 3] :msg "add 5 strength" :effect (effect (pump card 5)) :pump 5}]})

    "Morning Star"
    {:abilities [{:cost [:credit 1] :msg "break any number of barrier subroutines"}]}
@@ -3059,36 +3082,43 @@
    {:abilities [{:cost [:credit 1] :msg "break 1 sentry subroutine"}]}

    "Ninja"
-   {:abilities [{:cost [:credit 1] :msg "break 1 sentry subroutine"}
-                {:cost [:credit 3] :msg "add 5 strength" :effect (effect (pump card 5))}]}
+   (auto-icebreaker ["Sentry"]
+     {:abilities [{:cost [:credit 1] :msg "break 1 sentry subroutine"}
+                  {:cost [:credit 3] :msg "add 5 strength" :effect (effect (pump card 5)) :pump 5}]})

    "Passport"
-   {:abilities [{:cost [:credit 1] :req (req (#{:hq :rd :archives} (first (:server run))))
-                 :msg "break 1 code gate subroutine"}
-                {:cost [:credit 2] :msg "add 2 strength" :effect (effect (pump card 2))}]}
+   (auto-icebreaker ["Code Gate"]
+     {:abilities [{:cost [:credit 1] :req (req (#{:hq :rd :archives} (first (:server run))))
+                   :msg "break 1 code gate subroutine"}
+                  {:cost [:credit 2] :msg "add 2 strength" :effect (effect (pump card 2)) :pump 2}]})

    "Omega"
-   {:abilities [{:cost [:credit 1] :req (req (= (:position run) (dec (count (:ices run)))))
-                 :msg "break 1 subroutine on the innermost ICE protecting this server"}
-                {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1))}]}
+   (auto-icebreaker ["All"]
+     {:abilities [{:cost [:credit 1] :req (req (= (:position run) (dec (count (:ices run)))))
+                   :msg "break 1 subroutine on the innermost ICE protecting this server"}
+                  {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1)) :pump 1}]})

    "Overmind"
-   {:effect (effect (set-prop card :counter (:memory runner)))
-    :abilities [{:counter-cost 1 :msg "break 1 subroutine"}
-                {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1))}]}
+   (auto-icebreaker ["All"]
+     {:effect (effect (set-prop card :counter (:memory runner)))
+      :abilities [{:counter-cost 1 :msg "break 1 subroutine"}
+                  {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1)) :pump 1}]})

    "Peacock"
-   {:abilities [{:cost [:credit 2] :msg "break 1 code gate subroutine"}
-                {:cost [:credit 2] :msg "add 3 strength" :effect (effect (pump card 3))}]}
+   (auto-icebreaker ["Code Gate"]
+     {:abilities [{:cost [:credit 2] :msg "break 1 code gate subroutine"}
+                  {:cost [:credit 2] :msg "add 3 strength" :effect (effect (pump card 3)) :pump 3}]})

    "Pipeline"
-   {:abilities [{:cost [:credit 1] :msg "break 1 sentry subroutine"}
-                {:cost [:credit 2] :msg "add 1 strength for the remainder of this run"
-                 :effect (effect (pump card 1 :all-run))}]}
+   (auto-icebreaker ["Sentry"]
+     {:abilities [{:cost [:credit 1] :msg "break 1 sentry subroutine"}
+                  {:cost [:credit 2] :msg "add 1 strength for the remainder of this run"
+                   :effect (effect (pump card 1 :all-run)) :pump 1}]})

    "Refractor"
-   {:abilities [{:cost [:credit 1] :msg "break 1 code gate subroutine"}
-                {:cost [:credit 1] :msg "add 3 strength" :effect (effect (pump card 3))}]}
+   (auto-icebreaker ["Code Gate"]
+     {:abilities [{:cost [:credit 1] :msg "break 1 code gate subroutine"}
+                  {:cost [:credit 1] :msg "add 3 strength" :effect (effect (pump card 3)) :pump 3}]})

    "Sage"
    {:abilities [{:cost [:credit 2] :msg "break 1 code gate or barrier subroutine"}]
@@ -3101,13 +3131,15 @@
     :strength-bonus (req (:memory runner))}

    "Snowball"
-   {:abilities [{:cost [:credit 1] :msg "break 1 barrier subroutine"
-                 :effect (effect (pump card 1 :all-run))}
-                {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1))}]}
+   (auto-icebreaker ["Barrier"]
+     {:abilities [{:cost [:credit 1] :msg "break 1 barrier subroutine"
+                   :effect (effect (pump card 1 :all-run))}
+                  {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1)) :pump 1}]})

    "Sharpshooter"
-   {:abilities [{:msg "break any number of destroyer subroutines" :effect (effect (trash card {:cause :ability-cost}))}
-                {:cost [:credit 1] :msg "add 2 strength" :effect (effect (pump card 2))}]}
+   (auto-icebreaker ["Destroyer"]
+     {:abilities [{:msg "break any number of destroyer subroutines" :effect (effect (trash card {:cause :ability-cost}))}
+                  {:cost [:credit 1] :msg "add 2 strength" :effect (effect (pump card 2)) :pump 2}]})

    "Shiv"
    {:abilities [{:msg "break up to 3 sentry subroutines" :effect (effect (trash card {:cause :ability-cost}))}]
@@ -3130,12 +3162,14 @@
     :strength-bonus (req (or (:counter card) 0))}

    "Switchblade"
-   {:abilities [{:cost [:credit 1] :msg "break any number of sentry subroutines"}
-                {:cost [:credit 1] :msg "add 7 strength" :effect (effect (pump card 7))}]}
+   (auto-icebreaker ["Sentry"]
+     {:abilities [{:cost [:credit 1] :msg "break any number of sentry subroutines"}
+                  {:cost [:credit 1] :msg "add 7 strength" :effect (effect (pump card 7)) :pump 7}]})

    "Torch"
-   {:abilities [{:cost [:credit 1] :msg "break 1 code gate subroutine"}
-                {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1))}]}
+   (auto-icebreaker ["Code Gate"]
+     {:abilities [{:cost [:credit 1] :msg "break 1 code gate subroutine"}
+                  {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1)) :pump 1}]})

    "Wyrm"
    {:abilities [{:cost [:credit 3] :msg "break 1 subroutine on ICE with 0 or less strength"}
@@ -3144,19 +3178,20 @@
                  :req (req current-ice)
                  :effect (req (update! state side (update-in card [:wyrm-count] (fnil #(+ % 1) 0)))
                               (update-ice-strength state side current-ice))}
-                {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1))}]
+                {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1)) :pump 1}]
     :events (let [wy {:effect (req (update! state side (dissoc card :wyrm-count)))}]
-                 {:pre-ice-strength {:req (req (and (= (:cid target) (:cid current-ice)) (:wyrm-count card)))
-                                     :effect (req (let [c (:wyrm-count (get-card state card))]
-                                                       (ice-strength-bonus state side (- c))))}
-                  :pass-ice wy :run-ends wy})}
+              {:pre-ice-strength {:req (req (and (= (:cid target) (:cid current-ice)) (:wyrm-count card)))
+                                  :effect (req (let [c (:wyrm-count (get-card state card))]
+                                                 (ice-strength-bonus state side (- c))))}
+               :pass-ice wy :run-ends wy})}

    "Yog.0"
    {:abilities [{:msg "break 1 code gate subroutine"}]}

    "ZU.13 Key Master"
-   {:abilities [{:cost [:credit 1] :msg "break 1 code gate subroutine"}
-                {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1))}]}
+   (auto-icebreaker ["Code Gate"]
+     {:abilities [{:cost [:credit 1] :msg "break 1 code gate subroutine"}
+                  {:cost [:credit 1] :msg "add 1 strength" :effect (effect (pump card 1)) :pump 1}]})

    ;; ICE
    "Archer"


updated the influxdb api to new version

updated the influxdb api to new version

--- src/clj/ibclj/core.clj
+++ src/clj/ibclj/core.clj
@@ -14,6 +14,15 @@
 ;First time to create db
 ;(influx/create-db db-client)

+(comment
+  ;Added Simple Moving Average calculations
+  ;5-day SMA: (11 + 12 + 13 + 14 + 15) / 5 = 13
+  ;can I use partition on dynamic list?
+
+  (defn average [lst] (/ (reduce + lst) (count lst)))
+  (defn moving-average [window lst] (map average (partition window 1 lst)))
+
+  )

 (defn create-controller []
@@ -89,11 +98,11 @@
 (defn update-ticker [symbol row column value]
   (if (= column "LAST_TIMESTAMP")
               (do
-                (influx/post-points db-client (series-name symbol) [@row])
+                (influx/write-point db-client [ (series-name symbol) {"symbol" symbol} @row])
                 (reset! row {:type column }))
               (swap! row assoc column value)))

-(def tickers ["VXX" "SPY" "AAPL" "GOOG"])
+(def tickers ["VXX" "SPY"])   ;; "AAPL" "GOOG"

 (defn start []
   (let [api (api-ctrl)


Make the actual interface of Beckon.

Make the actual interface of Beckon.

--- src/clojure/beckon.clj
+++ src/clojure/beckon.clj
@@ -1,20 +1,25 @@
 (ns beckon
-  (:import [com.hypirion.beckon SignalAtoms]
-           [sun.misc Signal]))
+  (:import (com.hypirion.beckon SignalAtoms SignalRegisterer)))

 (defn signal-atom [signal-name]
   (SignalAtoms/getSignalAtom signal-name))

 (defn raise! [signal-name]
-  (Signal/raise (Signal. signal-name)))
+  (SignalRegisterer/raiseSignal signal-name))

-(defn true!
+(defn re-init! [signal-name]
+  (SignalRegisterer/resetDefaultHandler signal-name))
+
+(defn re-init-all! []
+  (SignalRegisterer/resetAllHandlers))
+
+(defn always-true
   "Takes a function of no arguments, and returns a function taking no arguments
   which calls f and returns true. f has presumably side effects."
   [f]
   (fn [] (f) true))

-(defn false!
+(defn always-false
   "Takes a function of no arguments, and returns a function taking no arguments
   which calls f and returns false. f has presumably side effects."
   [f]


add :pre and :post test to makesurce i/o is string

Signed-off-by: Yen-Chin Lee <082d453d72dce940e12089a4ad48b97cfe1f3ec4@gmail.com>

--- src/coldnew/pangu.cljc
+++ src/coldnew/pangu.cljc
@@ -1,9 +1,13 @@
 (ns coldnew.pangu
-  (:require [coldnew.pangu.impl :as impl]))
+  (:require [coldnew.pangu.impl :as impl]
+            #?(:clj  [clojure.test :refer [is]]
+               :cljs [cljs.test :refer-macros [is]])))

 (defn spacing
   "Performs a paranoid text spacing on str."
   [str]
+  {:pre  [(is (string? str))]
+   :post [(is (string? %))]}
   (->> str
        impl/spacing-quote
        impl/spacing-hash


Switch from using `doall` to `dorun`

Switch from using `doall` to `dorun`

--- src/re_frame/fx.cljs
+++ src/re_frame/fx.cljs
@@ -41,7 +41,7 @@
   "There are cases where eitherone event is to be dipatch "
   [effect]
   (cond
-    (list? effect)   (doall (map dispatch effect))
+    (list? effect)   (dorun (map dispatch effect))
     (vector? effect) (dispatch effect)
     :else (console :error "re-frame: expected :dispatch effect to be a list or vector, but got: " effect)))


now sends files to clients

now sends files to clients

--- src/server/core.cljs
+++ src/server/core.cljs
@@ -75,12 +75,19 @@
             data (transit/read reader message)
             absolute-file-path (:file data)
             socket-id (:socket-id data)]
-        (println (str "users:" socket-id))
         (.get rooms/redis-client (string/join ["users:" socket-id])
           (fn [err reply]
             (let [room (.toString reply)
                   clients (js->clj (aget (.-rooms (.-adapter (aget (.-nsps io) "/"))) room))]
-              (println clients))))))))
+              (doseq [client clients]
+                (let [client-socket-id (first client)
+                      client-socket (aget (.-connected (.-sockets io)) client-socket-id)
+                      stream (.createStream socketio-stream)
+                      read-stream (.createReadStream fs absolute-file-path)]
+                  (println (str "Sending file to " client-socket-id))
+
+                  (.emit client-socket "file-to-client" stream)
+                  (.pipe read-stream stream))))))))))

 (.on io "connection" connection)


add comment for reader monad application

--- src/monad/clojure/applications.clj
+++ src/monad/clojure/applications.clj
@@ -156,7 +156,8 @@
   [_]
   (prn "Compute clone for user"))

-;;    clone! :: Number -> String -> Reader UserRepository Number
+;;type hint
+;;clone! :: Number -> String -> Reader UserRepository Number
 (defn clone! [id user]
   (do-m reader-m
         [repo (ask)]
@@ -176,3 +177,4 @@
 ;;这里实现依赖注入的意义在于 如果不用reader monad那么就需要用namespace/function来使用另一个名字空间的函数 这样就会变得很冗余
 ;;每次都要加上namespace前缀很繁琐 用reader monad就可以只写一次 后面所有依赖另一个namespace中函数的位置都不用再显示生命namespace前缀了
 ;;但是貌似defprotocol和reify的组合本身就可以这样弄 就是repo那里使用let绑定为mk-user-repo的位置 用reader monad会让代码描述性更强 repo就是单独传入的一个module一样的意思
+;;如果不用reader monad那么用mk-user-repo函数生成的repo值还需要显示的被传入clone!函数 现在只要在最外层显式地写一次就好了


Use a symbol instead of a string to specify export name in example.

--- samples/hello/src/hello/core.cljs
+++ samples/hello/src/hello/core.cljs
@@ -1,7 +1,7 @@
 (ns hello.core
   (:require [hello.foo.bar :as bar]))

-(defn ^{:export "greet"} greet [n]
+(defn ^{:export greet} greet [n]
   (str "Hello " n))

 (defn ^:export sum [xs]


Handle extra whitespace around time

Handle extra whitespace around time

--- src/nextbus/next_three_fetcher.clj
+++ src/nextbus/next_three_fetcher.clj
@@ -29,7 +29,7 @@
     (s/replace (first (:content td)) #"[\n\t\r]" ""))

 (defn format-time [s]
-  (let [z (s/replace s #"^\d:" #(str "0" %1))]
+  (let [z (s/replace (s/trim s) #"^\d:" #(str "0" %1))]
     (if (.endsWith z "a")
       (s/replace z "a" "")
       (s/replace (s/replace (s/replace z #"^\d+" #(str (+ 12 (Integer/parseInt %1)))) "p" "") #"^24" "12"))))


Whitespace and comment typo.

Whitespace and comment typo.

--- src/open_company/api/companies.clj
+++ src/open_company/api/companies.clj
@@ -66,30 +66,30 @@

 (defn malformed-post-req?
   "If the request contains valid JSON POST data to create
-   companies retun the parsed JSON, otherwise nil."
+   companies, return the parsed JSON, otherwise return nil."
   [ctx]
   (let [[invalid-json? parsed] (common/malformed-json? ctx)
         with-reason (fn [r] (assoc parsed :malformed-reason r))]
     (cond invalid-json?
-          [true (with-reason :malformed-json)]
-          ;; Ensure all required keys are present and valid
-          ;; s/check returns nil if data complies
-          (->> (keys common-res/CompanyMinimum)
-               (select-keys (:data parsed))
-               (s/check common-res/CompanyMinimum))
-          [true (with-reason :missing-fields)]
-          ;; Ensure all extra fields match with our sections
-          ;; if superset? returns true no superfluous fields are found
-          (not (->> (into (set (keys common-res/CompanyMinimum))
-                          (set (keys common-res/CompanyOptional)))
-                    (cset/difference (-> parsed :data keys set))
-                    (cset/superset? common-res/section-names)))
-          [true (with-reason :unexpected-fields)]
-          :else [false parsed])))
+      [true (with-reason :malformed-json)]
+      ;; Ensure all required keys are present and valid
+      ;; s/check returns nil if data complies
+      (->> (keys common-res/CompanyMinimum)
+           (select-keys (:data parsed))
+           (s/check common-res/CompanyMinimum))
+      [true (with-reason :missing-fields)]
+      ;; Ensure all extra fields match with our sections
+      ;; if superset? returns true no superfluous fields are found
+      (not (->> (into (set (keys common-res/CompanyMinimum))
+                      (set (keys common-res/CompanyOptional)))
+                (cset/difference (-> parsed :data keys set))
+                (cset/superset? common-res/section-names)))
+      [true (with-reason :unexpected-fields)]
+      :else [false parsed])))

 (defn slug-processable [slug]
   (cond
-    (nil? slug)                    true
+    (nil? slug) true
     (s/check common-res/Slug slug) [false {:reason :invalid-slug-format}]
     (not (company/slug-available? slug)) [false {:reason :slug-taken}]))


Statistics are calculated from the whole dataset.

--- src/fist/models/db.clj
+++ src/fist/models/db.clj
@@ -90,7 +90,7 @@
                    :player %
                    :stats (stats-fn
                             (:id %)
-                            (time/first-day-of-the-month (time/now))
+                            (time/date-time 2013 1 1)
                             (time/plus (time/last-day-of-the-month (time/now)) (time/days 1)))})
       (get-players))))


Improve threading.

Improve threading.

Previously, when using futures, additional threads were started
when the initial thread took longer than 1 second. This new
strategy ensures only one thread per process (lookups for
location and forecast).

--- src/forecast/parse.clj
+++ src/forecast/parse.clj
@@ -46,36 +46,35 @@
   []
   (doseq [loc (location/new-locations)]
     (location/find-forecast loc)))
-;; (doseq [loc (location/new-locations)] (println loc))

-(defn infinite-loop [f]
-  (f)
-  (future (infinite-loop f))
-  nil)
+(def stop-threads? (atom false))
+
+(defn infinite-loop
+  ([f] (infinite-loop f nil))
+  ([f delay]
+   (go
+     (loop []
+       (f)
+       (if delay (Thread/sleep delay))
+       (when-not @stop-threads? (recur))
+       ))))
+
+(defn sleep-forever []
+  (loop []                           ;; prevent program from closing
+    (Thread/sleep 1e9)
+    (recur)))

 (defn daemon
   []
-  (.start
-   (Thread.
-    (infinite-loop
-     #(do
-        (Thread/sleep 1000)
-        (process-new-ips)
-        ))))
-  (.start
-   (Thread.
-    (infinite-loop
-     #(do
-        (Thread/sleep 1000)
-        (process-new-locations)
-        )))))
+  (infinite-loop process-new-ips 1000)
+  (infinite-loop process-new-locations 1000)
+  (sleep-forever))

 (defn get-histogram
   [num-bins]
   (let [temps (location/done-temperatures)]
     (if (empty? temps)
       []
-      ;; (h/histogram (map :temp temps) num-bins))))
       (h/histogram temps num-bins))))

 (defn print-histogram
@@ -89,20 +88,6 @@
       (println "no temperatures found"))
     )
   )
-
-;; (defn run
-;;   [filename num-bins]
-;;   (println "\n\n-------------")
-;;   (metrics/reset-metrics)
-;;   ;; (memory/clear)
-;;   (parse-logfile filename log-parser)
-;;   (process-new-ips)
-;;   (process-new-locations)
-;;   ;; (metrics/print-metrics)
-;;   ;; (println "ip metrics:" (:metrics @ip/ip-repo))
-;;   ;; (println "location metrics: " (:metrics @location/location-repo))
-;;   (print-histogram)
-;;   )

 (defn use-live []
   (ip/use-ipinfo-service)


fixed progress marker jitter on drag

fixed progress marker jitter on drag

--- src/frontend/core.cljs
+++ src/frontend/core.cljs
@@ -77,8 +77,11 @@
   (.css (js/$ "#progress-track-ball") #js {"left" (str percent-completed "%")}))

 (defn while-playing []
-  (let [sound (:current-sound @app-state)]
-    (set-progress-ball-position (* 100 (/ (.-position sound) (.-duration sound))))))
+  (if-not (:ball-being-dragged? @app-state)
+    (let [sound (:current-sound @app-state)]
+      (set-progress-ball-position (* 100
+                                    (/ (.-position sound)
+                                       (.-duration sound)))))))

 (defn play-track [track-id]
   (let [reader (new js/FileReader)


Handle window resizes/rotations

Handle window resizes/rotations

We now seamlessly handle window resizes, including those when the
physical device is rotated.

Also tweak the gesture settings to make taps easier once again.

--- src/graphito/core.cljs
+++ src/graphito/core.cljs
@@ -45,27 +45,26 @@

 (def zoom-out-scale 0.25)

+(def resize-delay-ms 100)
+
 ;; SVG setup

 (defn disable-touchmove! [container]
   (.on container "touchmove" #(-> d3 .-event .preventDefault)))

-(defn add-background! [svg width height]
+(defn add-background! [svg]
   (-> svg
       (.append "rect")
-      (.attr "width" width)
-      (.attr "height" height)
+      (.attr "class" "background")
       (.attr "fill" "#EDF0F2")
       (.attr "stroke" 0)))

-(defn setup-svg! [selector width height]
+(defn setup-svg! [selector]
   (let [container (.select d3 selector)
         svg (-> container
-                (.append "svg")
-                (.attr "width" width)
-                (.attr "height" height))]
+                (.append "svg"))]
     (disable-touchmove! container)
-    (add-background! svg width height)
+    (add-background! svg)
     svg))

 ;; Geometry
@@ -364,6 +363,30 @@

 (def tick-observable (js/Rx.Observable.interval update-interval-ms))

+;; Resize
+
+(defn sync-on-container-size! [current-state selector]
+  (let [container (.select d3 selector)
+        element (.node container)
+        width (.-clientWidth element)
+        height (.-clientHeight element)
+        svg (:svg @current-state)
+        background (.select svg ".background")]
+    (-> svg (.attr "width" width) (.attr "height" height))
+    (-> background (.attr "width" width) (.attr "height" height))
+    (swap-state! current-state assoc :view-size (v/create width height))))
+
+(def resize-observable
+  (-> rx-observable (.fromEvent js/window "resize")
+      (.map :resize)
+      (.debounce resize-delay-ms)))
+
+(defn respond-to-resize! [current-state selector]
+  (.subscribe resize-observable
+              #(sync-on-container-size! current-state selector)))
+
+;; Animation
+
 (defn animation-subject []
   (js/Rx.BehaviorSubject. :animation-end))

@@ -418,15 +441,15 @@
 (defn hammer-manager [svg]
   (let [manager (js/Hammer.Manager. (.node svg))]
     (.add manager (js/Hammer.Pan.
-                    (js-obj "threshold" 10)))
+                    (js-obj "threshold" 15)))
     (-> manager (.add (js/Hammer.Swipe.
-                        (js-obj "threshold" 10
+                        (js-obj "threshold" 15
                                 "velocity" 0)))
         (.recognizeWith (.get manager "pan")))
     (-> manager (.add (js/Hammer.Pinch.))
         (.recognizeWith (.get manager "pan")))
     (.add manager (js/Hammer.Tap.
-                    (js-obj "threshold" 10)))
+                    (js-obj "threshold" 15)))
     manager))

 (defn gesture-observable [manager gesture]
@@ -555,7 +578,7 @@
   (let [element (-> d3 (.select selector) .node)
         width (.-clientWidth element)
         height (.-clientHeight element)
-        svg (setup-svg! selector width height)
+        svg (setup-svg! selector)
         gesture-manager (hammer-manager svg)
         animation-subject (animation-subject)
         node-tap-subject (js/Rx.Subject.)
@@ -566,11 +589,12 @@
                                            animation-subject
                                            node-tap-subject
                                            link-tap-subject))]
-    (sync-graph! @current-state)
+    (sync-on-container-size! current-state selector)
     (load-graph "miserables.json"
                 (fn [graph]
                   (let [{:keys [nodes links]} graph]
                     (swap-state! current-state assoc :nodes nodes :links links))))
+    (respond-to-resize! current-state selector)
     (move-camera-on-arrow-keys! current-state animation-subject)
     (move-camera-on-pan! gesture-manager current-state animation-subject)
     (move-camera-on-swipe! gesture-manager current-state animation-subject)


Pinch handling

Pinch handling

We can detech a pinch, which we will later use to zoom out.

--- src/graphito/core.cljs
+++ src/graphito/core.cljs
@@ -24,6 +24,7 @@
 (def world-height 800)
 (def update-interval-ms 15)
 (def swipe-damping-factor 1)
+(def min-slide-speed-sq 16)

 ;; SVG setup

@@ -212,6 +213,8 @@
     (.add manager (js/Hammer.Pan.))
     (-> manager (.add (js/Hammer.Swipe.))
         (.recognizeWith (.get manager "pan")))
+    (-> manager (.add (js/Hammer.Pinch.))
+        (.recognizeWith (.get manager "pan")))
     manager))

 (defn gesture-observable [manager svg gesture]
@@ -271,17 +274,29 @@
             (.generateWithRelativeTime rx-observable
               {:dx (* update-interval-ms (or vx 0)), :dy (* update-interval-ms (or vy 0))}
               (fn [d]
-                (> (dist-sq (:dx d) (:dy d)) 10))
+                (> (dist-sq (:dx d) (:dy d)) min-slide-speed-sq))
               (fn [d] (let [[x y] (apply dampen (map d [:dx :dy]))] {:dx x :dy y}))
               identity
               (constantly update-interval-ms))))))))
-

 (defn move-camera-on-swipe! [manager current-state]
   (.subscribe
     (swipe-displacements-observable manager (:svg @current-state))
     (fn [d]
       (let [{:keys [dx dy]} d] (move-camera! current-state dx dy)))))
+
+;; Gestures - pinch
+
+(defn pinch-observable
+  "Returns a stream of the scale."
+  [manager svg]
+  (.map (gesture-observable manager svg "pinchmove")
+        #(.-scale %)))
+
+(defn zoom-out-on-pinch! [manager current-state]
+  (-> (pinch-observable manager (:svg @current-state))
+      (.filter #(< % 0.5))
+      (.subscribe #(js/alert "TODO: zoom out"))))

 ;; Exported function to do magic

@@ -297,4 +312,5 @@
                                     (swap-state! current-state assoc :nodes nodes)))
     (move-camera-on-arrow-keys! current-state)
     (move-camera-on-pan! gesture-manager current-state)
-    (move-camera-on-swipe! gesture-manager current-state)))
+    (move-camera-on-swipe! gesture-manager current-state)
+    (zoom-out-on-pinch! gesture-manager current-state)))


Fix 'tag-projects -> 'tag-repo-projects name to be more clear.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -371,7 +371,7 @@
                    [nil nil])
        (keep second)))

-(defn tag-projects
+(defn tag-repo-projects
   [gitdir]
   (let [proj-shas (project-change-shas gitdir)]
     (doseq [{:keys [sha refs ops]} (report-progress gitdir proj-shas)


revert to a working variant

revert to a working variant

--- src/lights/my_show.clj
+++ src/lights/my_show.clj
@@ -149,6 +149,10 @@
     "midi-net" 1 5 :audio-solo :max 30)
 )

+(def main-color
+  "Main color of the show"
+  (afterglow.effects.params/build-color-param :h 120))
+
 (defn light-sawtooth
   "Change light according to sawtooth osc"
   ([beat-ratio]
@@ -160,10 +164,6 @@
   ([]
     (light-sawtooth 2))
 )
-
-(def main-color
-  "Main color of the show"
-  (afterglow.effects.params/build-color-param :h 120))

 (def light-beat (params/build-oscillated-param


Make sure ltcache/default.clj exists before attempting to open it.

--- src/lt/objs/cache.cljs
+++ src/lt/objs/cache.cljs
@@ -10,6 +10,9 @@
 (def settings (atom {}))

 (defn on-disk [cb]
+  ;; We must ensure the file's existence before attempting to open it.
+  (when-not (files/file? settings-path)
+    (files/save settings-path {}))
   (files/open settings-path (fn [data]
                               (if-not (empty? data)
                                 (cb (reader/read-string (:content data)))


add test case for 'get-service-fn' error handling

--- test/puppetlabs/trapperkeeper/services_test.clj
+++ test/puppetlabs/trapperkeeper/services_test.clj
@@ -3,6 +3,7 @@
             [plumbing.fnk.pfnk :as pfnk]
             [puppetlabs.trapperkeeper.services :refer :all]
             [puppetlabs.trapperkeeper.app :refer [service-graph?]]
+            [puppetlabs.trapperkeeper.examples.bootstrapping.test-services :refer [hello-world-service]]
             [puppetlabs.trapperkeeper.testutils.bootstrap :refer [bootstrap-services-with-empty-config bootstrap-framework-with-no-services]]))

 (deftest defservice-macro
@@ -72,4 +73,10 @@
           #"(?s)^.*Service .* not found in graph.*$"
           (->
             (bootstrap-framework-with-no-services)
-            (get-service-fn :service :service-fn))))))+            (get-service-fn :service :service-fn))))
+    (is (thrown-with-msg?
+          IllegalArgumentException
+          #"(?s)^.*service function.* not found in graph.*$"
+          (->
+            (bootstrap-services-with-empty-config [(hello-world-service)])
+            (get-service-fn :simple-service :invalid-service-fn))))))


Update en.cljs

Update en.cljs

Removed unused commands and cleaned up to prepare for other translations.

--- src/status_im/translations/en.cljs
+++ src/status_im/translations/en.cljs
@@ -26,11 +26,7 @@
    :photos-access-error                   "To grant the required photos permission, please go to your system settings and make sure that Status > Photos is selected."

    ;;drawer
-   :invite-friends                        "Invite friends"
-   :faq                                   "FAQ"
    :switch-users                          "Switch users"
-   :feedback                              "Got feedback?\nShake your phone!"
-   :view-all                              "View all"
    :current-network                       "Current network"

    ;;chat
@@ -58,7 +54,6 @@
    :sync-synced                           "In sync"

    ;;messages
-   :status-sending                        "Sending"
    :status-pending                        "Pending"
    :status-sent                           "Sent"
    :status-seen-by-everyone               "Seen by everyone"
@@ -76,7 +71,6 @@
                                            :other "hours"}
    :datetime-day                          {:one   "day"
                                            :other "days"}
-   :datetime-multiple                     "s"
    :datetime-ago                          "ago"
    :datetime-yesterday                    "yesterday"
    :datetime-today                        "today"
@@ -84,13 +78,10 @@
    ;;profile
    :profile                               "Profile"
    :edit-profile                          "Edit profile"
-   :report-user                           "REPORT USER"
    :message                               "Message"
-   :username                              "Username"
    :not-specified                         "Not specified"
    :public-key                            "Public key"
    :phone-number                          "Phone number"
-   :email                                 "Email"
    :update-status                         "Update your status..."
    :add-a-status                          "Add a status..."
    :status-prompt                         "Set your status. Using #hastags will help others discover you and talk about what's on your mind"
@@ -99,10 +90,6 @@
    :remove-from-contacts                  "Remove from contacts"
    :start-conversation                    "Start conversation"
    :send-transaction                      "Send transaction"
-   :share-qr                              "Share QR"
-   :error-incorrect-name                  "Please select another name"
-   :error-incorrect-email                 "Incorrect e-mail"
-   :profile-testnet-icon                  "Testnet"
    :testnet-text                          "You’re on the {{testnet}} Testnet. Do not send real ETH or SNT to your address"
    :mainnet-text                          "You’re on the Mainnet. Real ETH will be sent"

@@ -110,7 +97,6 @@
    :image-source-title                    "Profile image"
    :image-source-make-photo               "Capture"
    :image-source-gallery                  "Select from gallery"
-   :image-source-cancel                   "Cancel"

    ;;sharing
    :sharing-copy-to-clipboard             "Copy to clipboard"
@@ -127,12 +113,9 @@
    :confirmation-code                     (str "Thanks! We've sent you a text message with a confirmation "
                                                "code. Please provide that code to confirm your phone number")
    :incorrect-code                        (str "Sorry the code was incorrect, please enter it again")
-   :generate-passphrase                   (str "I'll generate a passphrase for you so you can restore your "
-                                               "account or log in from another device.")
    :phew-here-is-your-passphrase          "Phew, that was hard. Here is your passphrase, *write this down and keep it safe!* You will need it to recover your account."
    :here-is-your-passphrase               "Here is your passphrase, *write this down and keep this safe!* You will need it to recover your account."
    :here-is-your-signing-phrase           "Here is your signing phrase. You will use it to verify your transactions. *Write it down and keep it safe!*"
-   :written-down                          "Make sure you have written it down somewhere secure."
    :phone-number-required                 "Tap here to validate your phone number & I'll find your friends."
    :shake-your-phone                      "Found a bug or have a suggestion? Just ~shake~ your phone!"
    :intro-status                          "Chat with me to setup your account and change your settings."
@@ -149,7 +132,6 @@

    ;;chats
    :chats                                 "Chats"
-   :new-chat                              "New chat"
    :delete-chat                           "Delete chat"
    :new-group-chat                        "New group chat"
    :new-public-group-chat                 "Join public chat"
@@ -189,9 +171,6 @@
    :remove-from-group                     "Remove from group"
    :edit-contacts                         "Edit contacts"
    :search-contacts                       "Search contacts"
-   :show-all                              "SHOW ALL"
-   :contacts-group-dapps                  "ÐApps"
-   :contacts-group-people                 "People"
    :contacts-group-new-chat               "Start new chat"
    :choose-from-contacts                  "Choose from contacts"
    :no-contacts                           "No contacts yet"
@@ -203,34 +182,15 @@
    :remove                                "Remove"
    :save                                  "Save"
    :delete                                "Delete"
-   :change-color                          "Change color"
    :clear-history                         "Clear history"
    :mute-notifications                    "Mute notifications"
    :leave-chat                            "Leave chat"
-   :delete-and-leave                      "Delete and leave"
    :chat-settings                         "Chat settings"
    :edit                                  "Edit"
    :add-members                           "Add members"
-   :blue                                  "Blue"
-   :purple                                "Purple"
-   :green                                 "Green"
-   :red                                   "Red"

    ;;commands
-   :money-command-description             "Send money"
-   :location-command-description          "Send location"
-   :phone-command-description             "Send phone number"
-   :phone-request-text                    "Phone number request"
-   :confirmation-code-command-description "Send confirmation code"
-   :confirmation-code-request-text        "Confirmation code request"
-   :send-command-description              "Send command"
-   :request-command-description           "Send request"
-   :keypair-password-command-description  ""
-   :help-command-description              "Help"
-   :request                               "Request"
    :chat-send-eth                         "{{amount}} ETH"
-   :chat-send-eth-to                      "{{amount}} ETH to {{chat-name}}"
-   :chat-send-eth-from                    "{{amount}} ETH from {{chat-name}}"

    ;;location command
    :your-current-location                 "Your current location"
@@ -243,23 +203,14 @@
    :sharing-copy-to-clipboard-coordinates "Copy coordinates"

    ;;new-group
-   :group-chat-name                       "Chat name"
-   :empty-group-chat-name                 "Please enter a name"
-   :illegal-group-chat-name               "Please select another name"
    :new-group                             "New group"
    :reorder-groups                        "Reorder groups"
-   :group-name                            "Group name"
    :edit-group                            "Edit group"
    :delete-group                          "Delete group"
    :delete-group-confirmation             "This group will be removed from your groups. This will not affect your contacts"
    :delete-group-prompt                   "This will not affect your contacts"
-   :group-members                         "Group members"
    :contact-s                             {:one   "contact"
                                            :other "contacts"}
-
-   ;;participants
-   :add-participants                      "Add Participants"
-   :remove-participants                   "Remove Participants"

    ;;protocol
    :received-invitation                   "received chat invitation"
@@ -271,12 +222,9 @@

    ;;new-contact
    :add-new-contact                       "Add new contact"
-   :import-qr                             "Import"
    :scan-qr                               "Scan QR code"
    :name                                  "Name"
-   :whisper-identity                      "Whisper Identity"
    :address-explication                   "Your public key is used to generate your address on Ethereum and is a series of numbers and letters. You can find it easily in your profile"
-   :enter-valid-address                   "Please enter a valid address or scan a QR code"
    :enter-valid-public-key                "Please enter a valid public key or scan a QR code"
    :contact-already-added                 "The contact has already been added"
    :can-not-add-yourself                  "You can't add yourself"
@@ -286,24 +234,18 @@
    :connect                               "Connect"
    :address                               "Address"
    :password                              "Password"
-   :login                                 "Login"
    :sign-in-to-status                     "Sign in to Status"
    :sign-in                               "Sign in"
    :wrong-password                        "Wrong password"
    :enter-password                        "Enter password"

    ;;recover
-   :recover-from-passphrase               "Recover from passphrase"
-   :recover-explain                       "Please enter the passphrase for your account to recover access"
    :passphrase                            "Passphrase"
    :recover                               "Recover"
-   :enter-valid-passphrase                "Please enter a passphrase"
-   :enter-valid-password                  "Please enter a password"
    :twelve-words-in-correct-order         "12 words in correct order"

    ;;accounts
    :recover-access                        "Recover access"
-   :add-account                           "Add account"
    :create-new-account                    "Create new account"

    ;;wallet-qr-code
@@ -312,35 +254,17 @@
    ;;validation
    :invalid-phone                         "Invalid phone number"
    :amount                                "Amount"
-   :not-enough-eth                        (str "Insufficient funds. Your balance is: "
-                                               "({{balance}} ETH)")

    ;;transactions
    :confirm                               "Confirm"
-   :confirm-transactions                  {:one   "Confirm transaction"
-                                           :other "Confirm {{count}} transactions"
-                                           :zero  "No transactions"}
-   :transactions-confirmed                {:one   "Transaction confirmed"
-                                           :other "{{count}} transactions confirmed"
-                                           :zero  "No transactions confirmed"}
    :transaction                           "Transaction"
-   :unsigned-transactions                 "Unsigned transactions"
-   :no-unsigned-transactions              "No unsigned transactions"
    :unsigned-transaction-expired          "Unsigned transaction expired"
-   :enter-password-transactions           {:one   "Confirm transaction by entering your password"
-                                           :other "Confirm transactions by entering your password"}
    :status                                "Status"
-   :pending-confirmation                  "Pending confirmation"
    :recipient                             "Recipient"
-   :one-more-item                         "One more item"
-   :fee                                   "Fee"
-   :estimated-fee                         "Est. fee"
-   :value                                 "Value"
    :to                                    "To"
    :from                                  "From"
    :data                                  "Data"
    :got-it                                "Got it"
-   :contract-creation                     "Contract creation"
    :block                                 "Block"
    :hash                                  "Hash"
    :gas-limit                             "Gas limit"
@@ -388,8 +312,6 @@
    :transactions-sign-all                 "Sign all"
    :transactions-sign-transaction         "Sign transaction"
    :transactions-sign-later               "Sign later"
-   :transactions-sign-all-text            "Sign all transactions by entering your password.\nMake sure that the words above match your secret signing phrase"
-   :transactions-sign-input-placeholder   "Enter your password"
    :transactions-delete                   "Delete transaction"
    :transactions-delete-content           "Transaction will be removed from 'Unsigned' list"
    :transactions-history                  "History"
@@ -410,14 +332,11 @@
    :not-applicable                        "Not applicable for unsigned transactions"

    ;; Wallet Send
-   :wallet-send-transaction               "Send Transaction"
-   :wallet-send-step                      "Step {{step}} of {{number}}"
    :wallet-choose-recipient               "Choose Recipient"
    :wallet-choose-from-contacts           "Choose From Contacts"
    :wallet-address-from-clipboard         "Use Address From Clipboard"
    :wallet-invalid-address                "Invalid address: \n {{data}}"
    :wallet-browse-photos                  "Browse Photos"
-   :validation-amount-invalid             "Amount is not valid"
    :validation-amount-invalid-number      "Amount is not a valid number"
    :validation-amount-is-too-precise      "Amount is too precise. The smallest unit you can send is 1 Wei (1x10^-18 ETH)"

@@ -432,7 +351,6 @@
    :paste-json-as-text                    "Paste JSON as text"
    :paste-json                            "Paste JSON"
    :specify-rpc-url                       "Specify a RPC URL"
-   :edit-rpc-url                          "Edit a RPC URL"
    :edit-network-config                   "Edit network config"
    :connected                             "Connected"
    :process-json                          "Process JSON"


stub out delay

stub out delay

--- src/splash/core.cljs
+++ src/splash/core.cljs
@@ -208,7 +208,7 @@

     (go
-      (loop [n 1000]
+      #_ (loop [n 1]
         (when (pos? n)
           (<! (events/next-frame))
           (recur (dec n))))


Note about doc properties with define-record-type.

--- src/active/clojure/record.cljc
+++ src/active/clojure/record.cljc
@@ -11,6 +11,7 @@

 #?(:clj
 (defmacro define-record-type
+  "Attach doc properties to the type and the field names to get reasonable docstrings."
   [?type ?constructor-call ?predicate ?field-specs & ?opt+specs]
   (when-not (and (list? ?constructor-call)
                  (not (empty? ?constructor-call)))


Convert lesson 06 to function-first-api

Convert lesson 06 to function-first-api

--- src/cljs/gampg/learn_gamma/lesson_06.cljs
+++ src/cljs/gampg/learn_gamma/lesson_06.cljs
@@ -1,14 +1,11 @@
 (ns ^:figwheel-load gampg.learn-gamma.lesson-06
     (:require [clojure.string :as s]
-            [gamma.api :as g]
-            [gamma.program :as p]
-            [gamma.tools :as gt]
-            [gamma-driver.drivers.basic :as driver]
-            [gamma-driver.protocols :as dp]
-            [goog.webgl :as ggl]
-            [thi.ng.geom.core :as geom]
-            [thi.ng.geom.core.matrix :as mat :refer [M44]]
-            [thi.ng.geom.webgl.arrays :as arrays]))
+              [gamma.api :as g]
+              [gamma.program :as p]
+              [gamma-driver.api :as gd]
+              [gamma-driver.drivers.basic :as driver]
+              [thi.ng.geom.core :as geom]
+              [thi.ng.geom.core.matrix :as mat :refer [M44]]))

 (def title
   "6. Keyboard input and texture filters")
@@ -36,11 +33,9 @@
    {:vertex-shader   {(g/gl-position) (-> u-p-matrix
                                           (g/* u-mv-matrix)
                                           (g/* (g/vec4 a-position 1)))
-                      v-texture-coord a-texture-coord
-                      }
+                      v-texture-coord a-texture-coord}
     :fragment-shader {(g/gl-frag-color)
-                      (g/texture2D u-sampler (g/vec2 (g/swizzle v-texture-coord :st)))
-                      }}))
+                      (g/texture2D u-sampler (g/vec2 (g/swizzle v-texture-coord :st)))}}))

 (defn get-perspective-matrix
   "Be sure to
@@ -171,21 +166,20 @@
                    (geom/rotate-around-axis [1 0 0] cube-rotation)
                    (geom/rotate-around-axis [0 1 0] cube-rotation)
                    (geom/rotate-around-axis [0 0 1] cube-rotation))]
-        (driver/draw-elements driver program
-                          (assoc (get-data p mv cube-vertices texture cube-texture-coords)
-                            {:tag :element-index} cube-indices)
+        (gd/draw-elements driver (gd/bind driver program
+                                          (assoc (get-data p mv cube-vertices texture cube-texture-coords)
+                                                 {:tag :element-index} cube-indices))
                           {:draw-mode :triangles
-                           :first 0
-                           :count 36 ;;Hard-coded
-                           })))))
+                           :first     0
+                           ;; Hard-coded
+                           :count     36})))))

 (defn animate [draw-fn step-fn current-value]
   (js/requestAnimationFrame
    (fn [time]
      (let [next-value (step-fn time current-value)]
        (draw-fn next-value)
-       (animate draw-fn step-fn next-value)
-       ))))
+       (animate draw-fn step-fn next-value)))))

 (defn tick
   "Takes the old world value and produces a new world value, suitable
@@ -204,9 +198,9 @@
   (let [width     (.-clientWidth node)
         height    (.-clientHeight node)
         driver    (make-driver gl)
-        program   (dp/program driver program-source)
+        program   program-source
         state (app-state width height)]
-
+
     (reset-gl-canvas! node)
     (.enable gl (.-DEPTH_TEST gl))
     (.clearColor gl 0 0 0 1)
@@ -214,10 +208,10 @@

     (let [image (js/Image.)]
       (aset image "onload"
-            (fn [] (let [texture {:data {:data image
-                                        :filter {:min :linear
-                                                 :mag :linear-mipmap-nearest}
-                                        :flip-y true
-                                        :texture-id 0}}]
+            (fn [] (let [texture {:data image
+                                 :filter {:min :linear
+                                          :mag :linear}
+                                 :flip-y true
+                                 :texture-id 0}]
                     (animate (draw-fn gl driver program) tick (assoc-in state [:scene :texture] texture)))))
       (aset image "src" "/images/crate.gif"))))


Add function to test for TBoxes

Add function to test for TBoxes

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

--- src/conexp/contrib/dl/framework/boxes.clj
+++ src/conexp/contrib/dl/framework/boxes.clj
@@ -14,6 +14,11 @@
 ;;; TBox definitions

 (defrecord TBox [language definition-map])
+
+(defn tbox?
+  "Returns true iff thing is a TBox."
+  [thing]
+  (instance? TBox thing))

 (defn tbox-language
   "Returns language for which tbox is a tbox."


"name" checks gender and number of determiner (e.g. "our" or "his")

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1202,8 +1202,12 @@
                    :pred :I}
              :subcat '()}}
    "name"
-   (let [of (atom :top)
-         agr (atom :top)]
+   (let [gender (atom :top)
+         number (atom :top)
+         agr (atom {:gender gender
+                    :number number})
+         of (atom {:gender gender
+                   :number number})]
      (unify agreement-noun
             common-noun
             countable-noun


want: use {:modal-with :infinitive}

want: use {:modal-with :infinitive}

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1966,19 +1966,12 @@
                                             :2 '()}}
                                :3 '()}}})

-   "want" (let [modal-subject (atom {:cat :noun
-                                     :sem :top})]
-            [{:synsem {:cat :verb
-                       :sem {:pred :want}
-                       :subcat {:1 modal-subject
-                                :2 {:cat :verb
-                                    :infl :infinitive
-                                    :subcat {:1 modal-subject
-                                             :2 '()}}
-                                :3 '()}}}
-             {:synsem {:cat :verb
-                       :sem {:pred :want}
-                       :subcat {:1 modal-subject}}}])
+   "want" [{:modal-with :infinitive
+            :synsem {:cat :verb
+                     :sem {:pred :want}}}
+
+           {:synsem {:cat :verb
+                     :sem {:pred :want}}}]

    "warm" {:synsem {:cat :verb
                 :sem {:pred :warm}}}


+"hear","praise"

+"hear","praise"

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -920,6 +920,11 @@
                   :sem {:human true
                         :pred :lui}
                   :subcat '()}}
+
+   "hear" {:synsem {:cat :verb
+                    :sem {:pred :hear}}
+           :english {:past "heard"}}
+
    "help"
    {:synsem {:cat :verb
              :sem {:pred :aiutare
@@ -1561,6 +1566,9 @@
             :synsem {:cat :verb
                      :sem {:pred :suonare}}}]

+   "praise" {:synsem {:cat :verb
+                      :sem {:pred :praise}}}
+
    ;; TODO: all reflexive verbs should have this subject-object agreement like this one does:
    "prepare" (let [subject-semantics (atom :top)
                    subject-agreement (atom :top)]


throw errors when user is missing rabbitmq management rights

langohr's http/list-queues returns nil if the user does not have
management rights.

throw an error with an informative error message in that case.

--- src/brainbot/nozzle/manage.clj
+++ src/brainbot/nozzle/manage.clj
@@ -57,12 +57,30 @@
     (rmq/close ch)
     (rmq/close conn)))

+(defn throw-management-api-error []
+  "throw a somewhat informative message about missing management rights"
+  (throw
+   (ex-info
+    "no response from RabbitMQ's management API. make sure you have added the management tag for the user in RabbitMQ"
+    {:endpoint rmqapi/*endpoint*
+     :username rmqapi/*username*})))
+
+(defn list-queues
+  "wrapper around langohr's http/list-queues. this one raises an error
+  instead of returning nil when the user has no management rights for
+  the RabbitMQ management plugin"
+  [& args]
+  (let [qs (apply rmqapi/list-queues args)]
+    (when-not qs
+      (throw-management-api-error))
+    qs))
+
 (defn get-num-messages
   "return number of messages in the given rabbitmq vhost for the given
   filesystem and id/prefix"
   [vhost id filesystem]
   (num-messages-from-queue-state
-   (rmqapi/list-queues)
+   (list-queues vhost)
    vhost
    {:id id
     :filesystem filesystem}))


Added event string storing and retrieving.

--- src/vertigo/core.clj
+++ src/vertigo/core.clj
@@ -19,13 +19,14 @@
       [:th "Action"]
       [:th "Drama"]
       [:th "Others"]]
-    (for [[day genres] shows]
+    (for [{date           :date
+           shows-by-genre :shows-by-genre} shows]
       [:tr
-        [:td day]
-        [:td (map render-show (:comedy genres))]
-        [:td (map render-show (:action genres))]
-        [:td (map render-show (:drama genres))]
-        [:td (map render-show (:other genres))]])])
+        [:td date]
+        [:td (map render-show (:comedy shows-by-genre))]
+        [:td (map render-show (:action shows-by-genre))]
+        [:td (map render-show (:drama shows-by-genre))]
+        [:td (map render-show (:other shows-by-genre))]])])

 (defn calendar [shows]
   (layout (show-table shows)))
@@ -40,7 +41,7 @@
             [clj-time.format]
             [clj-time.core :only (now)]))

-(defrecord Show [id
+(defrecord Show [event-id
                  title
                  theatre
                  genres
@@ -73,13 +74,35 @@
       (let [new-shows (parse-shows-and-group-by-genre
                         (zip/xml-zip
                           (xml/parse
-                            (str "http://finnkino.fi/xml/Schedule/?area=1002&dt="
-                                 formatted-date))))]
-        [formatted-date (get (swap! shows-db assoc formatted-date new-shows) formatted-date)]))))
+                            (str
+                              "http://finnkino.fi/xml/Schedule/?area=1002&dt="
+                              formatted-date))))]
+        {:date           formatted-date
+         :shows-by-genre (get
+                           (swap! shows-db assoc
+                                             formatted-date
+                                             new-shows)
+                           formatted-date)}))))

 (defn retrieve-shows-for-whole-week []
   (let [dates (take 7 (iterate #(.plusDays % 1) (now)))]
     (map retrieve-shows-by-date dates)))
+
+(def events-db (atom {}))
+
+(defn retrieve-event [event-id]
+  (let [cached-event (get @events-db event-id)]
+    (if cached-event
+      {:event-id event-id
+       :event    cached-event}
+      (let [new-event (slurp
+                        (str
+                          "http://finnkino.fi/xml/Events/?eventId="
+                          event-id))]
+        {:event-id event-id
+         :event    (get
+                     (swap! events-db assoc event-id new-event)
+                     event-id)}))))

 (defroutes handler
   (GET "/" []


Normalize get-page-list and get-image-data

They use similar patterns of taking an object that contains an url
parameter and binding it so made the code more reflective of that
similarity.

--- src/clj/comic_reader/sites.clj
+++ src/clj/comic_reader/sites.clj
@@ -262,16 +262,15 @@
             (extract-chapters-list comic-url)
             doall))))

-  (get-page-list [this comic-chapter]
-    (binding [options opt-map]
-      (if-let [chapter-url (:url comic-chapter)]
-        (-> chapter-url
-            scrape/fetch-url
-            (extract-pages-list chapter-url)
-            doall))))
+  (get-page-list [this {chapter-url :url}]
+    (binding [options opt-map]
+      (some-> chapter-url
+              scrape/fetch-url
+              (extract-pages-list chapter-url)
+              doall)))

   (get-image-data [this {page-url :url}]
     (binding [options opt-map]
-      (-> page-url
-          scrape/fetch-url
-          extract-image-tag))))
+      (some-> page-url
+              scrape/fetch-url
+              extract-image-tag))))


implement Rebranding Team

implement Rebranding Team

--- src/clj/game/cards-agendas.clj
+++ src/clj/game/cards-agendas.clj
@@ -305,6 +305,21 @@
    {:data [:counter 3]
     :abilities [{:counter-cost 1 :msg "add an 'End the run' subroutine to the approached ICE"}]}

+   "Rebranding Team"
+   {:effect (req (doseq [c (filter #(= (:type %) "Asset") (all-installed state :corp))]
+                   (update! state side (assoc c :subtype
+                                                (->> (vec (.split (:subtype c) " - "))
+                                                     (cons "Advertisement")
+                                                     distinct
+                                                     (join " - "))))))
+    :msg "make all assets gain Advertisement"
+    :events {:corp-install
+             {:req (req (and (= (:type target) "Asset") (not (has? target :subtype "Advertisement"))))
+              :effect (effect (update! (assoc target :subtype
+                                                     (->> (vec (.split (:subtype target) " - "))
+                                                          (cons "Advertisement")
+                                                          (join " - ")))))}}}
+
    "Restructured Datapool"
    {:abilities [{:cost [:click 1]
                  :trace {:base 2 :msg "give the Runner 1 tag" :effect (effect (tag-runner :runner 1))}}]}


Make step-generator return either a step or step/context tuple

As discussed in issue #48

--- src/clj_gatling/simulation.clj
+++ src/clj_gatling/simulation.clj
@@ -65,7 +65,11 @@
     [(first steps) context [(rest steps) nil]]

     (ifn? step-fn)
-    (conj (step-fn context) [nil step-fn])
+    (let [result (step-fn context)
+          ret (if (vector? result)
+                result
+                [result context])]
+      (conj ret [nil step-fn]))

     :else
     [nil context [nil nil]]))


Make namespace aliases always show up as the correct namespace in doc-tf

--- src/clj_ns_browser/browser.clj
+++ src/clj_ns_browser/browser.clj
@@ -503,7 +503,11 @@
       (b/selection (id :vars-lb))
       (b/transform (fn [v]
         (if v
-          (let [fqn (fqname (selection (id :ns-lb)) v)]
+          (let [fqn (if (= "aliases" (selection (id :vars-cbx)))
+                      (str (get (ns-aliases (the-ns (symbol
+                                                     (selection (id :ns-lb)))))
+                                (symbol v)))
+                      (fqname (selection (id :ns-lb)) v))]
             (if (and fqn (not= fqn ""))
               fqn
               (when (= (selection (id :vars-cbx)) "aliases")


special component for non-editable elements

Had to make special dispatcher for xml rendering, to avoid dealing with
the distinction between editable and not-editable in that part of the
interface.

--- src/cljs/greffe/doc_comps.cljs
+++ src/cljs/greffe/doc_comps.cljs
@@ -25,10 +25,16 @@
       (and
         (contains? val :content)
         (contains? val :tag))
-      (let [el-type (get-in mk/markup [(:tag val) :type])]
+      (let [el-type (get-in mk/markup [(:tag val) :type])
+            edit-type (:edit-type val)]
         (cond
+          (= :unknown-element edit-type)
+          :unknown-element
+
           (#{:container :multi-chunk :chunk} el-type)
-          :elem
+          (if (= edit-type :no-text-edit)
+            :elem-no-edit
+            :elem)

           (= :inner el-type)
           :inner-elem
@@ -42,14 +48,31 @@

 (defmulti element-component dispatch-on-element-type)

-
 (defmethod element-component :text [elem owner]
   (reify
     om/IRenderState
     (render-state [_ state]
       (dom/span #js {:className "xml-text-element"} elem))))

+
+
+(defmethod element-component :elem-no-edit [elem owner]
+  (reify
+    om/IRender
+    (render [_]
+      (dom/div #js {:className
+                    (str "xml-" (name (:tag elem)) " tei-block col-md-12 no-edit")}
+        (dom/div #js {:className "row"}
+          (dom/div #js {:className "block-data col-md-1"}
+            (dom/div #js {:className "name"} (name (:tag elem)))
+            (om/build element-attributes-component (:attrs elem)))
+          (when (pos? (count (:content elem)))
+            (apply dom/div #js {:className "block-contents col-md-10"}
+              (om/build-all element-component (:content elem)))))))))
+
+
 (defmethod element-component :elem [elem owner]
+  "This is for editable nodes, assumes :edit-type is :edit."
   (reify
     om/IInitState
     (init-state [_] {:hoverTimeout nil
@@ -112,7 +135,6 @@
            (apply dom/div #js {:className "block-contents col-md-10"}
              (om/build-all element-component (:content elem)))))))))

-
 (defmethod element-component :inner-elem [elem owner]
   (reify
     om/IRender
@@ -151,7 +173,14 @@
              (dom/span #js {:className "attribute-quote"} "\"")])
           atts)))))

-(defmulti xml-display dispatch-on-element-type)
+
+(defn dispatch-on-element-type-xml [el]
+  (let [t (dispatch-on-element-type el)]
+    (if (= :elem-no-edit t)
+      :elem
+      t)))
+
+(defmulti xml-display dispatch-on-element-type-xml)

 (defmethod xml-display :elem [elem owner]
   (reify
@@ -211,6 +240,6 @@
   (reify
     om/IRender
     (render [_]
-      (.log js/console "WTF?")
-      (dom/div nil (str "WTF? " (type (om/value elem)) " " elem)))))
-
+      (.log js/console "xml WTF?")
+      (dom/div nil (str "xml WTF? " (type (om/value elem)) " " elem)))))
+


Commenting out ECHO request logging.

Commenting out ECHO request logging.

--- src/cmr/transmit/echo/rest.clj
+++ src/cmr/transmit/echo/rest.clj
@@ -29,9 +29,9 @@
          url (format "%s%s" (conn/root-url conn) url-path)
          params (merge (request-options conn) options)
          ;; Uncoment to log requests
-         _ (debug "Making ECHO GET Request" url)
+         ; _ (debug "Making ECHO GET Request" url)
          response (client/get url params)
-         _ (debug "Completed ECHO GET Request" url)
+         ; _ (debug "Completed ECHO GET Request" url)
          {:keys [status body headers]} response
          parsed (if (.startsWith ^String (get headers "Content-Type" "") "application/json")
                   (json/decode body true)


Lazy seq output flushes stream after each write

--- src/compojure/http/servlet.clj
+++ src/compojure/http/servlet.clj
@@ -82,7 +82,8 @@
     (seq? body)
       (with-open [writer (.getWriter response)]
         (doseq [chunk body]
-          (.print writer (str chunk))))
+          (.print writer (str chunk))
+          (.flush writer)))
     (instance? InputStream body)
       (with-open [out (.getOutputStream response)]
         (IOUtils/copy body out)


Function to export any data into EDN format

--- src/emender_jenkins/metadata_exporter.clj
+++ src/emender_jenkins/metadata_exporter.clj
@@ -28,6 +28,12 @@
     [products]
     (json/write-str products))

+(defn data->edn
+    "Convert/format any data to EDN format."
+    [data]
+    (with-out-str
+        (clojure.pprint/pprint data)))
+
 (defn export2csv
     [columns data]
     (data->csv (cons columns data)))


Updated draft iframe version of defviewport

--- src/css-guide/styles/util.cljc
+++ src/css-guide/styles/util.cljc
@@ -119,14 +119,21 @@
           (om.next/defui ~root
             ~'Object
             (~'render [this#]
-              ;; TODO Need to feed in dimensions and stylesheet path
-              #_(untangled.ui.elements/ui-iframe {})
-                (om.dom/span (cljs.core/clj->js {:className "ui-viewport-container"})
+              (om.dom/span (cljs.core/clj->js {:className "ui-viewport-container"})
                  (om.dom/div (cljs.core/clj->js {:className "ui-viewport ui-viewport--mobile ui-viewport--android"})
                    (~symfn this#))
                  (om.dom/div (cljs.core/clj->js {:className "c-message c-message--neutral u-leader--quarter"})
                    (om.dom/div nil (devcards.core/markdown->react ~doc)))
-                 )))
+                 )
+              ;; TODO Figure out why the link isn't loading with this code
+              #_(untangled.ui.elements/ui-iframe {:width "360px" :height "640px"}
+                (om.dom/span (cljs.core/clj->js {:className "ui-viewport-container"})
+                 (om.dom/link #js {:rel "stylesheet" :href "css/untangled-ui-stylekit.css"})
+                 (om.dom/div (cljs.core/clj->js {:className "ui-viewport ui-viewport--mobile ui-viewport--android"})
+                   (~symfn this#))
+                 (om.dom/div (cljs.core/clj->js {:className "c-message c-message--neutral u-leader--quarter"})
+                   (om.dom/div nil (devcards.core/markdown->react ~doc)))
+                 ))))
           (def ~sym {:name          ~(name sym)
                      :documentation ~doc
                      :search-terms  ~(str/join " " (map str/lower-case [doc (name sym)]))


Fix rat spawning

Fix rat spawning

--- src/dungeon_crusade/update.clj
+++ src/dungeon_crusade/update.clj
@@ -636,7 +636,7 @@
     (let [[_ x y] (first (shuffle (filter (fn [[cell _ _]] (and (not (nil? cell))
                                                                 (= (cell :type) :floor)))
                                           (with-xy (current-place state)))))]
-      (add-npc state (-> state :word :current-place) {:type :rat :hp 9 :attacks #{:bite :claw}} x y))
+      (add-npc state (-> state :world :current-place) {:type :rat :hp 9 :attacks #{:bite :claw}} x y))
     state))

 (defn update-quests


Fixed typo

Fixed typo

--- src/emender_jenkins/config.clj
+++ src/emender_jenkins/config.clj
@@ -11,7 +11,7 @@
 ;

 (ns emender-jenkins.config
-    "Module that contains all functions required to to load configuration from the INI file.")
+    "Module that contains all functions required to load configuration from the INI file.")

 (require '[clojure.pprint :as pprint])


Document fhofherr.simple.engine.

Document fhofherr.simple.engine.

--- src/fhofherr/simple/engine.clj
+++ src/fhofherr/simple/engine.clj
@@ -1,6 +1,10 @@
-(ns fhofherr.simple.engine)
+(ns fhofherr.simple.engine
+  "FIXME: Add documentation.")

 (defn find-ci-jobs
+  "Find Simple CI jobs in the `projectdef-ns` namespace. All mappings with
+  a truthy value for the key `:ci-job?` in their meta data are treated as
+  Simple CI jobs. Returns all found Simple CI jobs as a set."
   [projectdef-ns]
   (->> projectdef-ns
        (ns-publics)


fixed make-dataset: works with dataset and swaped args

--- src/grafter/tabular/common.clj
+++ src/grafter/tabular/common.clj
@@ -31,15 +31,21 @@
   and creates an incanter dataset with columns named alphabetically as
   by grafter.sequences/column-names-seq."

+  ([]
+   {:column-names [], :rows ()})
+
   ([data]
    (if (sequential? data)
-     (make-dataset (seqs/alphabetical-column-names) data)
+     (make-dataset data (seqs/alphabetical-column-names))
      data))

-  ([columns-or-f data]
+  ([data columns-or-f]
      {:pre [(or (ifn? columns-or-f) (sequential? columns-or-f))]}
      (let [[column-names data] (if (sequential? columns-or-f)
-                                 [(take (-> data first count) columns-or-f) data]
+                                 [(if (inc/dataset? data)
+                                    (take (-> data :column-names count) columns-or-f)
+                                    (take (-> data first count) columns-or-f))
+                                   data]
                                  (columns-or-f data))
            data (if (sequential? data)
                   data


Rename `as-interval` to `interval`

Rename `as-interval` to `interval`

--- src/tick/interval.cljc
+++ src/tick/interval.cljc
@@ -350,27 +350,25 @@
 ;; Comparison. We have now built up the capability of comparing
 ;; intervals using the normal <, >, <=, >= operators.

-(defn as-interval [t]
-  (when (= (t/beginning t) (t/end t))
-    (throw (ex-info "t is a zero length interval!" {:t t})))
+(defn interval [t]
   (make-interval (t/beginning t) (t/end t)))

 (extend-protocol t/ITimeComparison
   LocalDate
-  (< [x y] (t/< (as-interval x) (as-interval y)))
-  (<= [x y] (t/<= (as-interval x) (as-interval y)))
-  (> [x y] (t/> (as-interval x) (as-interval y)))
-  (>= [x y] (t/>= (as-interval x) (as-interval y)))
+  (< [x y] (t/< (interval x) (interval y)))
+  (<= [x y] (t/<= (interval x) (interval y)))
+  (> [x y] (t/> (interval x) (interval y)))
+  (>= [x y] (t/>= (interval x) (interval y)))
   YearMonth
-  (< [x y] (t/< (as-interval x) (as-interval y)))
-  (<= [x y] (t/<= (as-interval x) (as-interval y)))
-  (> [x y] (t/> (as-interval x) (as-interval y)))
-  (>= [x y] (t/>= (as-interval x) (as-interval y)))
+  (< [x y] (t/< (interval x) (interval y)))
+  (<= [x y] (t/<= (interval x) (interval y)))
+  (> [x y] (t/> (interval x) (interval y)))
+  (>= [x y] (t/>= (interval x) (interval y)))
   Year
-  (< [x y] (t/< (as-interval x) (as-interval y)))
-  (<= [x y] (t/<= (as-interval x) (as-interval y)))
-  (> [x y] (t/> (as-interval x) (as-interval y)))
-  (>= [x y] (t/>= (as-interval x) (as-interval y)))
+  (< [x y] (t/< (interval x) (interval y)))
+  (<= [x y] (t/<= (interval x) (interval y)))
+  (> [x y] (t/> (interval x) (interval y)))
+  (>= [x y] (t/>= (interval x) (interval y)))
   #?(:clj clojure.lang.APersistentMap :cljs PersistentArrayMap)
   (< [x y] (#{precedes? meets?} (basic-relation x y)))
   (<= [x y] (#{precedes? meets? equals? starts? overlaps? finished-by?} (basic-relation x y)))
@@ -433,7 +431,7 @@
                                                                                :relation (relation ival1 ival2)})))))))]
     (unite intervals)))

-(defn as-interval-group
+(defn make-interval-group
   "Return an interval group. Interval groups are maps with
   a :tick/intervals entry that contain a time-ordered sequence of
   disjoint intervals."
@@ -449,10 +447,10 @@
   (letfn [(normalize [intervals]
             (lazy-seq
               (let [[ival1 ival2 & r] intervals]
-                (if (nil? ival2) (if ival1 (list (as-interval-group ival1)) (list))
+                (if (nil? ival2) (if ival1 (list (make-interval-group ival1)) (list))
                     (case (relation ival1 ival2)
                       :meets (normalize (cons (splice ival1 ival2) r))
-                      (cons (as-interval-group ival1)
+                      (cons (make-interval-group ival1)
                             (normalize (assert-proper-head (rest intervals)))))))))]
     (normalize (assert-proper-head intervals))))


added some type fixes to get rid of reflection errors

--- src/tile_game/core.clj
+++ src/tile_game/core.clj
@@ -67,7 +67,7 @@
 (defn legal-moves [board]
   (filter #(can-move? board %) board))

-(defn solved? [board]
+(defn solved? [board]
   (= (concat (range 1 (count board)) '(0)) board))

 (defn solver [best-move history board]
@@ -123,10 +123,10 @@
          (.setColor Color/BLACK)
          (.setFont (Font. "Serif" (. Font PLAIN) 32)))
        (when (> tile 0) (.drawString g (format "%d" tile)
-                                     (+ cx (quot scale 2))
-                                     (+ cy (quot scale 2))))))
+                                     (int (+ cx (quot scale 2)))
+                                     (int (+ cy (quot scale 2)))))))

-(def *board* (ref (shuffle (vec (range 0 (* dim dim))))))
+(def *board* (ref (shuffle (vec (range (* dim dim))))))

 (defn main []
   (let [size (* dim scale)
@@ -149,7 +149,7 @@
       (.setFocusable true)
       (.addKeyListener
        (proxy [KeyAdapter] []
-         (keyPressed [e]
+         (keyPressed [#^KeyEvent e]
                      (let [dir-move (comp move! (partial move-direction @*board*))]
                        (condp = (.getKeyCode e)
                            KeyEvent/VK_LEFT  (dir-move :left)


[skip ci] Modify leaf-children to return a set

--- src/main/cljc/mikron/compiler/schema.cljc
+++ src/main/cljc/mikron/compiler/schema.cljc
@@ -157,7 +157,7 @@
     [hierarchy tag]
     (let [children (descendants hierarchy tag)]
       (if (empty? children)
-        [tag]
-        (filter (fn [tag']
-                  (empty? (descendants hierarchy tag')))
-                children)))))
+        #{tag}
+        (set (filter (fn [tag']
+                       (empty? (descendants hierarchy tag')))
+                     children))))))


RS & AB | 15 | Remove client and user test registrations from lein-ring-init

--- src/stonecutter/handler.clj
+++ src/stonecutter/handler.clj
@@ -113,10 +113,6 @@
   (log-config/init-logger!)
   (vh/disable-template-caching!)
   (s/setup-in-memory-stores!)
-  (client-seed/load-client-credentials-and-store-clients (config/client-credentials-file-path))
-  (let [user (clauth.user/register-user "user@email.com" "password")
-        client-details (clauth.client/register-client "MYAPP" "myapp.com")]
-    (log/info (str "TEST USER DETAILS:" user))
-    (log/info (str "TEST CLIENT DETAILS:" client-details))))
+  (client-seed/load-client-credentials-and-store-clients (config/client-credentials-file-path)))

 (def lein-app (create-app :dev-mode? true))


Remove backported repl trampoline bugfix. Add :offline to production profile.

--- opt/profiles.clj
+++ opt/profiles.clj
@@ -2,11 +2,11 @@
                   ;; TODO: re-enable once clojars releases repo is up
                   ;; "clojars" "http://s3pository.herokuapp.com/clojars"
                   }
-        :aliases {"repl" "standalone-repl"}
-        :plugins [[lein-standalone-repl "0.1.3"]]}
+        :aliases {"repl" ["trampoline" "repl"]}}
  :production {:mirrors {"central" "http://s3pository.herokuapp.com/maven-central"
                         ;; "clojars" "http://s3pository.herokuapp.com/clojars"
-                        }}
+                        }
+              :offline true}
  :heroku {:mirrors {"central" "http://s3pository.herokuapp.com/maven-central"
                     ;; "clojars" "http://s3pository.herokuapp.com/clojars"
                     }}}


Indent fix.

Indent fix.

--- src-cljs/pepa/workflows/dashboard.cljs
+++ src-cljs/pepa/workflows/dashboard.cljs
@@ -128,8 +128,8 @@
          true
          "Dashboard")
        (when-not active-search?
-        (om/build document-count documents
-                  {:react-key "document-count"}))])))
+         (om/build document-count documents
+                   {:react-key "document-count"}))])))

 ;;; Should be twice the document-height or so.
 (def +scroll-margin+ 500)


Add test for cdm

Add test for cdm

--- test/forma/hadoop/jobs/cdm_test.clj
+++ test/forma/hadoop/jobs/cdm_test.clj
@@ -1,5 +1,38 @@
 (ns forma.hadoop.jobs.cdm-test
   (:use cascalog.api
         forma.hadoop.jobs.cdm
-        [midje sweet cascalog]))
+        [midje sweet cascalog]
+        [forma.gfw.cdm :only (latlon->google-tile)]
+        [forma.utils :only (positions)])
+  (:require [forma.date-time :as date]
+            [forma.postprocess.output :as o]
+            [forma.reproject :as r]))

+(comment
+  (let [est-map {:est-start "2005-12-31"}
+        forma-src [["500" 28 8 1 1 [1 2 50]]]
+        thresh 50
+        t-res "16"
+        out-t-res "32"]
+        (convert-for-vizz est-map forma-src thresh t-res out-t-res) => (produces [1, 1, 16, 137])))
+
+(comment
+  (let [est-map {:est-start "2005-12-31"}
+        forma-src [["500" 28 8 1 1 [1 2 50]]]
+        thresh 50
+        t-res "16"
+        out-t-res "32"
+        epoch-period (date/datetime->period out-t-res "2000-01-01")
+        ts-start-period (date/datetime->period t-res (:est-start est-map))
+        z 16]
+    (<- [?x ?y ?z ?p]
+        (forma-src ?s-res ?mod-h ?mod-v ?s ?l ?prob-series)
+        (o/clean-probs ?prob-series :> ?clean-series)
+        (first-hit thresh ?clean-series :> ?first-hit-idx)
+        (+ ts-start-period ?first-hit-idx :> ?period)
+        (date/convert-period-res t-res out-t-res ?period :> ?period-new-res)
+        (- ?period-new-res epoch-period :> ?rp)
+        (min-period ?rp :> ?p)
+        (r/modis->latlon ?s-res ?mod-h ?mod-v ?s ?l :> ?lat ?lon)
+        (latlon->google-tile ?lat ?lon z :> ?x ?y)
+        (identity z :> ?z))))


fix truncate-children parameter-passing to generate

--- src/babel/engine.cljc
+++ src/babel/engine.cljc
@@ -41,7 +41,7 @@
                                             do-enrich true
                                             max-total-depth generate/max-total-depth
                                             truncate-children true}}]
-  (log/debug (str "engine/generate with spec: " (strip-refs spec) "; max-total-depth: " max-total-depth "; enrich: " do-enrich))
+  (log/debug (str "engine/generate with spec: " (strip-refs spec) "; max-total-depth: " max-total-depth "; enrich: " do-enrich "; truncate-children: " truncate-children))
   (let [grammar (:grammar language-model)]
     (if (empty? grammar)
       (do
@@ -323,11 +323,12 @@
               :sem (get-in input-map [:synsem :sem] :top)
               :subcat (get-in input-map [:synsem :subcat] :top)}}))

-(defn expression [model spec]
+(defn expression [model spec & {:keys [truncate-children]
+                                :or {truncate-children true}}]
   (let [no-language (if (nil? model)
                              (throw (Exception. "No target language model was supplied.")))

-        sentence (generate spec model :enrich true)
+        sentence (generate spec model :truncate-children truncate-children)

         check (if (nil? sentence)
                 (let [message (str "Could not generate a sentence for spec: " spec " for language: " (:language model)


Remove unused import.

Remove unused import.

--- src/uxbox/services/auth.clj
+++ src/uxbox/services/auth.clj
@@ -6,7 +6,6 @@

 (ns uxbox.services.auth
   (:require [clojure.spec :as s]
-            [mount.core :as mount :refer (defstate)]
             [suricatta.core :as sc]
             [buddy.hashers :as hashers]
             [buddy.sign.jwt :as jwt]


Remove debug messages on storage ns.

Remove debug messages on storage ns.

--- src/uxbox/util/storage.cljs
+++ src/uxbox/util/storage.cljs
@@ -17,7 +17,6 @@

 (defn- load
   [alias]
-  (println "load" *target*)
   (if (= *target* "nodejs")
     {}
     (when-let [data (.getItem js/localStorage (name alias))]


Доработка галереи

Доработка галереи

--- radiolamp-6P3S/src/ixinfestor/omut.cljs
+++ radiolamp-6P3S/src/ixinfestor/omut.cljs
@@ -318,7 +318,7 @@
    (date-com-format-datetime d)))

-
+

 (defn ui-cdate-udate [{:keys [cdate udate]}]
   (dom/span
@@ -2851,8 +2851,7 @@
            (dom/div #js {:style #js {:position "fixed" :left 0 :top 0 :zIndex 3005}}
                     (dom/button #js {:className "close"
                                      :onClick   #(om/transact! app :zoom? not)}
-                                (ui-glyphicon (if zoom? "zoom-out" "zoom-in")
-                                              "" "3em"))
+                                (ui-glyphicon (if zoom? "zoom-out" "zoom-in") "" "3em"))
                     (dom/button #js {:className "close"
                                      :onClick   #(om/transact!
                                                   app :deg (fn [deg]
@@ -3126,52 +3125,83 @@

 (defn images-gallery-1 [app own]
   (reify
+
     om/IInitState
     (init-state [_]
-      {:i 0})
+      {:i          0               :deg            0
+       :div-id     (uniq-id "div") :img-id         (uniq-id "img")
+       :div-height nil             :img-margin-top nil})
+
     om/IWillReceiveProps
     (will-receive-props [_ next-props]
       (om/set-state! own :i 0))
+
     om/IRenderState
-    (render-state [_ {:keys [i]}]
-      (if (empty? @app)
-        (dom/h2 nil "Изображений нет")
-        (dom/div
-         #js {}
-         (dom/b #js {:style #js {:fontSize "26px"}} "Изображение " (inc i) " из " (count @app))
-         (dom/div #js {:className "btn-group" :style #js {:float "right"}}
-                  (ui-button {:type     :default
-                              :size     :lg
-                              :on-click (fn [_]
-                                          (om/update-state!
-                                           own :i
-                                           #(let [i (dec %)]
-                                              (if (< i 0) (dec (count @app)) i)))
-                                          1)
-                              :text     (dom/span nil
-                                                  (dom/span #js {:className   "glyphicon glyphicon-chevron-left"
-                                                                 :aria-hidden "true"}))
-                              })
-                  (ui-button {:type     :default
-                              :size     :lg
-                              :on-click (fn [_]
-                                          (om/update-state!
-                                           own :i
-                                           #(let [i (inc %)]
-                                              (if (= i (count @app)) 0  i)))
-                                          1)
-                              :text     (dom/span nil
-                                                  (dom/span #js {:className   "glyphicon glyphicon-chevron-right"
-                                                                 :aria-hidden "true"}))
-                              }))
-         (dom/br nil)
-         (dom/br nil)
-         (dom/div
-          #js {:className "thumbnail"}
-          (dom/img #js {:className ""
-                        :src       (get-in @app [i :path] "")}))
-         (dom/h2 nil (get-in @app [i :top_description] ""))
-         (dom/p nil (get-in @app [i :description] "")))))))
+    (render-state [_ {:keys [i deg div-id div-height img-id img-margin-top]}]
+      (let [deg-2 (str  "rotate(" deg "deg)")
+            src (get-in @app [i :path] "")]
+        (if (empty? @app)
+          (dom/h2 nil "Изображений нет")
+          (dom/div
+           #js {}
+           (dom/b #js {:style #js {:fontSize "26px"}} "Изображение " (inc i) " из " (count @app))
+
+
+           (dom/div #js {:className "btn-toolbar" :style #js {:float "right"}}
+                    (dom/div #js {:className "btn-group"}
+                             (ui-button
+                              {:text (ui-glyphicon "retweet")
+                               :type :default
+                               :size :lg
+                               :on-click
+                               #(om/update-state!
+                                 own
+                                 (fn [{:keys [deg div-id img-id] :as state}]
+                                   (let [deg (+ deg 90)
+                                         deg (if (> deg 270) 0 deg)
+                                         r? (or (= deg 90) (= deg 270))
+                                         img-w (-> img-id by-id .-clientWidth)
+                                         img-h (-> img-id by-id .-clientHeight)]
+                                     (assoc state
+                                            :deg deg
+                                            :img-margin-top
+                                            (when r? (js/Math.abs (* 0.5 (- img-h img-w))))
+                                            :div-height (when r? (+ 12 img-w))))))}))
+
+                    (dom/div #js {:className "btn-group"}
+                             (ui-button {:text     (ui-glyphicon "chevron-left")
+                                         :type     :default
+                                         :size     :lg
+                                         :on-click (fn [_]
+                                                     (om/update-state!
+                                                      own :i
+                                                      #(let [i (dec %)]
+                                                         (if (< i 0) (dec (count @app)) i)))
+                                                     1)})
+                             (ui-button {:text     (ui-glyphicon "chevron-right")
+                                         :type     :default
+                                         :size     :lg
+                                         :on-click (fn [_]
+                                                     (om/update-state!
+                                                      own :i
+                                                      #(let [i (inc %)]
+                                                         (if (= i (count @app)) 0  i)))
+                                                     1)})))
+           (dom/br nil)
+           (dom/br nil)
+           (dom/div
+            #js {:id div-id :className "thumbnail" :style #js {:height div-height}}
+            (dom/img #js {:id        img-id
+                          :className ""
+                          :src       src
+                          :style     #js {:msTransform     deg-2
+                                          :WebkitTransform deg-2
+                                          :transform       deg-2
+                                          :marginTop       img-margin-top
+                                          }
+                          :onClick #(put! chan-thumb-show-in-full-screen-app-init {:src src})}))
+           (dom/h2 nil (get-in @app [i :top_description] ""))
+           (dom/p nil (get-in @app [i :description] ""))))))))

 ;; END Thumbs
 ;;..................................................................................................
@@ -3716,38 +3746,3 @@

 ;; END Ввод элементов из справочника
 ;;..................................................................................................
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-