Better destructuring in geometry/crossing-number.

--- src/clj/hbg_crime/geometry.clj
+++ src/clj/hbg_crime/geometry.clj
@@ -6,15 +6,14 @@
 (defn- crossing-number
   "Determine crossing number for given point and segment of a polygon.
    See http://geomalgorithms.com/a03-_inclusion.html"
-  [point [[x1 y1] [x2 y2]]]
-  (let [[px py] point]
-    (if (or (and (<= y1 py) (> y2 py))
-            (and (> y1 py) (<= y2 py)))
-      (let [vt (/ (- py y1) (- y2 y1))]
-        (if (< px (+ x1 (* vt (- x2 x1))))
-          1 0))
-      0)))
-
+  [[px py] [[x1 y1] [x2 y2]]]
+  (if (or (and (<= y1 py) (> y2 py))
+          (and (> y1 py) (<= y2 py)))
+    (let [vt (/ (- py y1) (- y2 y1))]
+      (if (< px (+ x1 (* vt (- x2 x1))))
+        1 0))
+    0))
+
 (defn inside?
   "Is point inside the given polygon?"
   [point polygon]


Keyword those trains

Keyword those trains

--- src/clj/mokkameister/train.clj
+++ src/clj/mokkameister/train.clj
@@ -1,59 +1,65 @@
 (ns mokkameister.train
   (:require [mokkameister.random :refer [rand-nth-weighted rand-sexp]]))

-(def ^:private locomotives {":steam_locomotive:" 9
-                            ":bybane2:" 3
-                            ":bullettrain_front:" 3
-                            ":train:" 1
-                            ":horse:" 2
-                            ":unicorn_face:" 1
-                            ":boar:" 1
-                            ":tractor:" 1})
+(def ^:private locomotives {:steam_locomotive 9
+                            :bybane2 3
+                            :bullettrain_front 3
+                            :train 1
+                            :horse 2
+                            :unicorn_face 1
+                            :boar 1
+                            :tractor 1})

-(def ^:private train-endings {":dash:" 8
-                              "" 2
-                              ":afterburner:" 2
-                              ":sparkles:" 2
-                              ":exclamation:" 1})
+(def ^:private train-endings {:dash 8
+                              :afterburner 2
+                              :sparkles 2
+                              :exclamation 1
+                              :rainbow 1})

 (def ^:private num-wagons 7)

+(defn- key->emoji [s]
+  (str s ":"))
+
 (defn- train [& wagons]
-  (let [front  (rand-nth-weighted locomotives)
-        back   (rand-nth-weighted train-endings)
-        middle (apply str (take num-wagons (cycle wagons)))]
+  (let [front  (key->emoji (rand-nth-weighted locomotives))
+        back   (key->emoji (rand-nth-weighted train-endings))
+        middle (->> (map key->emoji wagons)
+                    (cycle)
+                    (take num-wagons)
+                    (apply str))]
     (str front middle back)))

-(def ^:private coffee-train (partial train ":coffee:"))
+(def ^:private coffee-train (partial train :coffee))

 (defn rand-train []
   (rand-sexp
    (coffee-train)
    (coffee-train)
-   (coffee-train ":heart:")
-   (coffee-train ":heart:")
-   (coffee-train ":heart:")
-   (coffee-train ":syringe:")
-   (coffee-train ":mushroom:")
-   (coffee-train ":coffeepot:")
-   (coffee-train ":coffeealarm:")
-   (coffee-train ":hocho:")
-   (coffee-train ":wrench:")
-   (coffee-train ":tada:")
-   (coffee-train ":bacon:")
-   (coffee-train ":nuclear:")
-   (coffee-train ":timwendelboe:")
-   (coffee-train ":jan-richter:")
-   (coffee-train ":scream:")
-   (coffee-train ":heavy_heart_exclamation_mark_ornament:")
-   (coffee-train ":badger:" ":mushroom:")
-   (coffee-train ":coffeepot:" ":heart:")
-   (coffee-train ":simply_overcaffeinated:" ":coffeespin:")
-   (coffee-train ":smoking:")
-   (train ":coffeealarm:" ":coffeealarm:")
-   (train ":nespresso:" ":ali:")
-   (train ":ali:" ":gruff:")
-   (train ":syringe:" ":hocho:")
+   (coffee-train :heart)
+   (coffee-train :heart)
+   (coffee-train :heart)
+   (coffee-train :syringe)
+   (coffee-train :mushroom)
+   (coffee-train :coffeepot)
+   (coffee-train :coffeealarm)
+   (coffee-train :hocho)
+   (coffee-train :wrench)
+   (coffee-train :tada)
+   (coffee-train :bacon)
+   (coffee-train :nuclear)
+   (coffee-train :timwendelboe)
+   (coffee-train :jan-richter)
+   (coffee-train :scream)
+   (coffee-train :smoking)
+   (coffee-train :heavy_heart_exclamation_mark_ornament)
+   (coffee-train :badger :mushroom)
+   (coffee-train :coffeepot :heart)
+   (coffee-train :simply_overcaffeinated :coffeespin)
+   (train :coffeealarm)
+   (train :nespresso :ali)
+   (train :ali :gruff)
+   (train :syringe :hocho)
    ":steam_locomotive::coffee::coffee::running::running::running::dash:"
    "All aboard the coffee train\n:steam_locomotive::coffee::coffee::running::running::running::dash:"
    "Det er kaffi å få på kjøken!"


Make multiline input prompt copy/pasteable

--- src/clj/reply/reader/jline.clj
+++ src/clj/reply/reader/jline.clj
@@ -53,12 +53,14 @@
   (when f (reset! prompt-fn f)))

 (defn set-empty-prompt []
-  (.setPrompt
-    @jline-reader
-    (apply str
-      (concat (repeat (- (count (@prompt-fn (eval-state/get-ns))) (count prompt-end))
-                      \space)
-              prompt-end))))
+  (let [prompt-end (str "#_" prompt-end)]
+    (.setPrompt
+      @jline-reader
+      (apply str
+        (concat (repeat (- (count (@prompt-fn (eval-state/get-ns)))
+                           (count prompt-end))
+                        \space)
+                prompt-end)))))

 (defn setup-reader! [options]
   (when-not (System/getenv "JLINE_LOGGING")


added a note for future improvement

added a note for future improvement

--- src/clj/test/cards-agendas.clj
+++ src/clj/test/cards-agendas.clj
@@ -21,6 +21,7 @@
       (is (= 0 (:agenda-point (get-runner))))
       (is (= 0 (count (:scored (get-runner))))))
     (is (= "15 Minutes" (:title (first (:deck (get-corp))))))
+    ; TODO: could also check for deck shuffle
     (is (= 2 (:click (get-corp))))
     ; use 15 minutes to take it away from corp (hey, maybe some obscure case happens where corp would want that)
     (core/click-draw state :corp 1)


correct error rendering new-account after failed create

--- src/clj_money/web/accounts.clj
+++ src/clj_money/web/accounts.clj
@@ -411,8 +411,9 @@
                                                    :parent-id])
                                      (tag-resource :account)
                                      (authorize :create)))]
+
     (if (validation/has-error? account)
-      (new-account {:params (select-keys account [:entity-id])} account)
+      (new-account {:params (select-keys params [:entity])} account)
       (redirect (str "/entities/" (:entity-id account) "/accounts")))))

 (defn edit


first shot at implementing view-routing and displaying different build numbers

--- src/cljs/lambdacd/ui_core.cljs
+++ src/cljs/lambdacd/ui_core.cljs
@@ -1,16 +1,27 @@
 (ns lambdacd.ui-core
   (:require-macros [cljs.core.async.macros :refer [go go-loop]])
   (:require [reagent.core :as reagent :refer [atom]]
+            [secretary.core :as secretary :refer-macros [defroute]]
+            [goog.events :as events]
+            [goog.history.EventType :as EventType]
+            [reagent.session :as session]
             [cljs.core.async :as async]
             [lambdacd.utils :as utils]
             [lambdacd.api :as api]
             )
   (:import goog.History))

+
+(secretary/set-config! :prefix "#")
+
+(defroute build-route "/builds/:buildnumber" [buildnumber] (session/put! :build-number buildnumber))
+(defroute default-route "/" []
+          (.setToken (History.) "/builds/1"))
+
+
 (enable-console-print!)

 (def history-poll-frequency 5000)
-

 (defn poll [atom fn]
   (go-loop []
@@ -22,11 +33,11 @@
 (defn poll-history [history-atom]
   (poll history-atom api/get-build-history))

-(defn poll-state [history-atom build-number-atom]
-  (poll history-atom #(api/get-build-state @build-number-atom)))
+(defn poll-state [history-atom build-number]
+  (poll history-atom #(api/get-build-state build-number)))

 (defn history-item-component [{build-number :build-number status :status}]
-  [:li {:key build-number} [:a {:href (str "?build=" build-number)} (str "Build " build-number)]])
+  [:li {:key build-number} [:a {:href (build-route {:buildnumber build-number})} (str "Build " build-number)]])

 (defn build-history-component [history]
   (let [history-to-display (sort-by :build-number @history)]
@@ -50,7 +61,7 @@

 (defn current-build-component [build-state-atom build-number output-atom]
   [:div {:key build-number :class "blocked"}
-   [:h2 (str "Current Build " @build-number)]
+   [:h2 (str "Current Build " build-number)]
    [:div {:id "pipeline" }
     [:ol
      (map #(build-step-component % output-atom) @build-state-atom)]]
@@ -61,15 +72,32 @@
 (defn root []
   (let [history (atom [])
         state (atom [])
-        build-number (atom 1)
+        build-number (session/get :build-number)
         output-atom (atom "")]
-    (poll-history history)
-    (poll-state state build-number)
-    [:div
-     [:div {:id "builds"} [build-history-component history]]
-      [:div {:id "currentBuild"} [current-build-component state build-number output-atom]]]))
+    (if build-number
+      (do
+        (poll-history history)
+        (poll-state state build-number)
+        [:div
+         [:div {:id "builds"} [build-history-component history]]
+          [:div {:id "currentBuild"} [current-build-component state build-number output-atom]]])
+      [:div {:id "loading"}
+       :h1 "Loading..."]
+    )))
+
+;; -------------------------
+;; History
+;; must be called after routes have been defined
+(defn hook-browser-navigation! []
+  (doto (History.)
+    (events/listen
+      EventType/NAVIGATE
+      (fn [event]
+        (secretary/dispatch! (.-token event))))
+    (.setEnabled true)))

 (defn init! []
+  (hook-browser-navigation!)
   ; #' is necessary so that fighweel can update: https://github.com/reagent-project/reagent/issues/94
   (reagent/render-component [#'root] (.getElementById js/document "dynamic")))


fix tools.reader tag name, bronsa said format will probably change due to CI


fix github-link to work for clojure symbols

--- src/cljs_api_gen/repo_cljs.clj
+++ src/cljs_api_gen/repo_cljs.clj
@@ -106,8 +106,12 @@
 (defn get-github-file-link
   ([repo path] (get-github-file-link repo path nil))
   ([repo path [start-line end-line]]
-   (let [strip-path (subs path (inc (count repo)))]
-     (cond-> (str "https://github.com/clojure/" repo "/blob/" *cljs-tag* "/" strip-path)
+   (let [strip-path (subs path (inc (count repo)))
+         tag (case repo
+               "clojure" *clj-tag*
+               "clojurescript" *cljs-tag*
+               nil)]
+     (cond-> (str "https://github.com/clojure/" repo "/blob/" tag "/" strip-path)
        start-line (str "#L" start-line)
        (and start-line end-line) (str "-L" end-line)))))


Updated Clojure version to 1.2.0-RC1

Updated Clojure version to 1.2.0-RC1

--- ring-core/project.clj
+++ ring-core/project.clj
@@ -1,8 +1,8 @@
 (defproject ring/ring-core "0.3.0-beta1"
   :description "Ring core libraries."
   :url "http://github.com/mmcgrana/ring"
-  :dependencies [[org.clojure/clojure "1.2.0-beta1"]
-                 [org.clojure/clojure-contrib "1.2.0-beta1"]
+  :dependencies [[org.clojure/clojure "1.2.0-RC1"]
+                 [org.clojure/clojure-contrib "1.2.0-RC1"]
                  [commons-codec "1.4"]
                  [commons-io "1.4"]
                  [commons-fileupload "1.2.1"]


fix string formatting

fix string formatting

--- src/cljs/early_vote_site/election_detail/views.cljs
+++ src/cljs/early_vote_site/election_detail/views.cljs
@@ -46,7 +46,7 @@
     (when election
       [:div
        [:h1 (-> election :state-fips utils/format-fips)]
-       [:h2 (-> election :election-date utils/format-date)]])))
+       [:h2 (-> election :election-date utils/format-date-string)]])))

 (defn main-panel []
   (fn []


Fixed error in simple-layered-layout

Fixed error in simple-layered-layout

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

--- src/conexp/layouts/layered.clj
+++ src/conexp/layouts/layered.clj
@@ -50,10 +50,10 @@
 (defn simple-layered-layout
   "Simple layered layout for lattice visualization."
   [lattice]
-  (make-layout (into {}
-                     (mapcat layer-coordinates
-                             (iterate inc 0)
-                             (layers lattice)))
+  (make-layout (apply hash-map
+                      (mapcat layer-coordinates
+                              (iterate inc 0)
+                              (layers lattice)))
                (edges lattice)))

 ;;;


Debugging mapbox

Debugging mapbox

--- src/pasmo_gigi/geo/ui/core.cljs
+++ src/pasmo_gigi/geo/ui/core.cljs
@@ -17,6 +17,7 @@
   (.log js/console "mapbox api: " mapbox-api)

   (let [mapbox (.-mapbox mapbox-api)]
+    (.log js/console "mapbox prop from api: " mapbox)
     (set! (.-accessToken mapbox) "pk.eyJ1IjoidXJpczc3IiwiYSI6InRuYTZRa3MifQ._Bo-JRcA7QVGocCJvdSoJg")
     (swap! db/settings assoc :mapbox-api mapbox-api))


New functions: get-preview|stage|prod-test-jobs-suffix

--- src/emender_jenkins/config.clj
+++ src/emender_jenkins/config.clj
@@ -101,3 +101,19 @@
     [request]
     (-> request :configuration :jenkins :credentials-id))

+(defn get-test-jobs-prefix
+    [request]
+    (-> request :configuration :jobs :test-jobs-prefix))
+
+(defn get-preview-test-jobs-suffix
+    [request]
+    (-> request :configuration :jobs :preview-test-jobs-suffix))
+
+(defn get-stage-test-jobs-suffix
+    [request]
+    (-> request :configuration :jobs :stage-test-jobs-suffix))
+
+(defn get-prod-jobs-prefix
+    [request]
+    (-> request :configuration :jobs :prod-test-jobs-suffix))
+


hotfix styles.cljs

hotfix styles.cljs

Signed-off-by: yenda <96f164ad4d9b2b0dacf8ebee2bb1eeb3aa69adf1@status.im>

--- src/status_im/utils/styles.cljs
+++ src/status_im/utils/styles.cljs
@@ -1,3 +1,3 @@
 (ns status-im.utils.styles
-  (:require-macros status-im.utils.fx)
+  (:require-macros status-im.utils.styles)
   (:require status-im.utils.platform))


Snapshot version

Snapshot version

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.32.1"
+(defproject cook "1.32.2-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.8.0"]


Bumps version to 1.44.1-SNAPSHOT

Bumps version to 1.44.1-SNAPSHOT

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.44.0"
+(defproject cook "1.44.1-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.8.0"]


Correct for nodejs target

Correct for nodejs target

--- scripts/node_repl.clj
+++ scripts/node_repl.clj
@@ -7,7 +7,7 @@
                       {:main 'test-utils.core
                        :output-to "out/test-utils.js"
                        :output-dir "out"
-                       :target :nodesj
+                       :target :nodejs
                        :verbose true})

 ;; Invoke the node.js REPL.


orbifoldInvariant3d.clj: added filtering of redundant edges

--- clojure/org/gavrog/clojure/orbifoldInvariant3d.clj
+++ clojure/org/gavrog/clojure/orbifoldInvariant3d.clj
@@ -40,10 +40,14 @@
                [[idcs D] {:type (orbifold-type ds idcs D)
                           :adjs (sub-orbits idcs D)}]))))

-(defn- filter-graph [p g]
+(defn- filter-nodes [p g]
   (let [good (set (filter (comp p g) (keys g)))]
     (into {} (for [[k v] g :when (good k)]
                [k (assoc v :adjs (filter good (:adjs v)))]))))
+
+(defn- filter-edges [p g]
+  (into {} (for [[k v] g]
+             [k (assoc v :adjs (filter #(p (g k) (g %)) (:adjs v)))])))

 (defn- edges [g]
   (for [[a v] g
@@ -73,8 +77,12 @@
 (defn orbifold-graph [ds]
   (->>
     (raw-orbifold-graph ds)
-    (filter-graph #(not= "1" (:type %)))
+    (filter-nodes #(not= "1" (:type %)))
     (quotient-graph #(= (:type %1) (:type %2)))
+    (filter-edges (fn [v w]
+                    (let [[s t] (map :type [v w])]
+                      (not (and (= "1*" t)
+                                (= \* (first s)) (= 4 (count s)))))))
     sort))

 (defn orbifold-invariant [ds]


Removed unnecessary dependencies

Removed unnecessary dependencies

--- src/flybe_logging/logstash.clj
+++ src/flybe_logging/logstash.clj
@@ -1,5 +1,5 @@
 (ns socket-rocket.logstash
-  (:import (java.io InputStreamReader BufferedReader PrintWriter ObjectOutputStream OutputStream)
+  (:import (java.io  PrintWriter )
            (java.net InetAddress Socket))
   (:require [taoensso.timbre :refer [stacktrace]]
             [cheshire.core :refer  [generate-string]]


Increase the time a stress test is allowed to take as TravisCI seems a bit slow

--- test/clj/lambdacd/stress_test.clj
+++ test/clj/lambdacd/stress_test.clj
@@ -91,6 +91,6 @@
       (is (not= :timeout
                   (deref (future
                            (execution/run (:pipeline-def pipeline) (:context pipeline)))
-                         120000 :timeout)))
+                         300000 :timeout)))

       (is (= 42 @count-finished)))))


Cleaning code

Cleaning code

--- test/fogus/me/invariant_tests.clj
+++ test/fogus/me/invariant_tests.clj
@@ -12,8 +12,8 @@
 ;; remove this notice, or any other, from this software.

 (ns fogus.me.invariant-tests
-  (:use [trammel.core :only [defconstrainedrecord defconstrainedtype]])
-  (:use [clojure.test :only [deftest is testing]]))
+  (:use [trammel.core :only (defconstrainedrecord defconstrainedtype)])
+  (:use [clojure.test :only (deftest is testing)]))

 (defconstrainedrecord AllNumbersRecord [a b]
   "AllNumbersRecord record fields are expected to hold only numbers."


fix who opened issue, was broken when adding auto-comment

--- src/gh_waiting_room/github.clj
+++ src/gh_waiting_room/github.clj
@@ -40,7 +40,8 @@
              ""
              (str (re-find #"^.{0,100}(?=\s|$)" body)
                   (if (> (count body) 100) " ..." ""))))
-   :user (get-in! issue [:repository :owner :login])
+   :owner (get-in! issue [:repository :owner :login])
+   :user (get-in! issue [:user :login])
    :name (get-in! issue [:repository :name])
    :created (or (re-find #"\d{4}-\d\d-\d\d"(get! issue :created_at))
                 (throw (ex-info "Failed to parse date from an issue" {:issue issue})))})
@@ -100,4 +101,4 @@
                (some #(and (= (:id %) issue-id) %) (viewable-issues db))
                (throw (ex-info "No issue found for webhook" {:issue-id issue-id})))
         body (comment-body issue)]
-    (create-comment (:user issue) (:name issue) issue-num body (gh-auth))))+    (create-comment (:owner issue) (:name issue) issue-num body (gh-auth))))


ship-id:s shown on map

ship-id:s shown on map

--- src/glory_of_empires/ships.clj
+++ src/glory_of_empires/ships.clj
@@ -32,5 +32,6 @@
   (let [ ship-data (all-ship-types type)
          tile-size (ship-data :image-size)
          center-shift (mul-vec tile-size -0.5) ]
-    (svg/g { :translate center-shift }
-      [ (svg/image loc tile-size (ship-image-url ship race)) ] )))
+    (svg/g { :translate (map + center-shift loc) }
+      [ (svg/image [0 0] tile-size (ship-image-url ship race))
+        (svg/double-text (name id) [ 0 (+ (last tile-size) 24 ) ] { :size 24 }) ] )))


CMR-2023: Added a java doc for a function.

--- virtual-product-app/src/cmr/virtual_product/config.clj
+++ virtual-product-app/src/cmr/virtual_product/config.clj
@@ -317,6 +317,7 @@
   (subset-opendap-data-access-url provider-id source-short-name virtual-short-name virtual-umm "ClrOLR_A,ClrOLR_D,Latitude,Longitude"))

 (defn- update-ast-l1t-related-urls
+  "Filter online access urls corresponding to the virtual collection from the source related urls"
   [virtual-umm virtual-short-name]
   (let [online-access-urls (filter #(= (:type %) "GET DATA") (:related-urls virtual-umm))
         frb-url-matches (fn [related-url suffix fmt]


[inbox] Always show document count.

[inbox] Always show document count.

--- src-cljs/pepa/workflows/inbox2.cljs
+++ src-cljs/pepa/workflows/inbox2.cljs
@@ -52,9 +52,7 @@
 (defrecord InboxColumnSource [id]
   ColumnSource
   (column-title [inbox state]
-    (str "Inbox "
-         (when-let [ps (seq (column-pages inbox state))]
-           (str "(" (count ps) ")"))))
+    (str "Inbox (" (count (column-pages inbox state)) ")"))
   (column-header-url [_]
     nil)
   (column-pages [_ state]


Fix client test

Fix client test

--- test/clojure/clojurewerkz/cassaforte/client_test.clj
+++ test/clojure/clojurewerkz/cassaforte/client_test.clj
@@ -35,8 +35,8 @@
           (catch Exception _ nil))
         (create-keyspace s "new_cql_keyspace"
                          (with {:replication
-                                {:class "SimpleStrategy"
-                                 :replication_factor 1 }}))
+                                {"class"              "SimpleStrategy"
+                                 "replication_factor" 1 }}))
         (let [s2 (client/connect-with-uri "cql://127.0.0.1:9042/new_cql_keyspace")]
           (is (= (.isClosed s2) false))
           (client/disconnect s2)


Fix stuck lockdown assignment bug

Fix stuck lockdown assignment bug

--- src/korhal/strategy/engine.clj
+++ src/korhal/strategy/engine.clj
@@ -72,11 +72,11 @@
 (defmethod assign-special-orders :ghost [squad members]
   (when (researched? :lockdown)
     (let [state @strategy-state
+          lockdown-capable (filter #(>= (energy %) 100) members)
           previous-orders (-> (get-in state [:squad-orders squad :lockdown])
-                              (select-keys members)
+                              (select-keys lockdown-capable)
                               (map-invert))
           assigned-ghosts (set (keys (map-invert previous-orders)))
-          lockdown-capable (filter #(>= (energy %) 100) members)
           mech? (fn [x] (and (not (building? x)) (or (mechanical? x) (robotic? x))))
           mechs (filter mech? (enemy-units))
           nearby-mechs (->> (map #(units-nearby % 300 mechs) members)


Add function for creating a set of meters from configuration

--- src/loggerbotter/irc/meter.clj
+++ src/loggerbotter/irc/meter.clj
@@ -22,7 +22,7 @@
 (defn- nicks-from-message [message]
   (cond
     ((some-fn join? quit? part?) message) (-> message :name :nick vector)
-    (kick? message) (-> (:parameters message) second vector)
+    (kick? message) (-> message :parameters second vector)
     (names-reply? message) (string/split (:body message) #" ")
     :else []))

@@ -34,11 +34,11 @@
             (concat previous-nicks nicks)
             (remove (set nicks) previous-nicks)))))

-(defn channel-nicks-meter [server channel]
+(defn channel-nicks-meter [server-id channel]
   (map->ReduceMeter
-    {:meter-id    (str "channel-nicks/" server "/" channel)
+    {:meter-id    (str "channel-nicks/" server-id "/" channel)
      :start-value []
-     :predicate   (partial match-for-server server
+     :predicate   (partial match-for-server server-id
                            (partial channel-nicks-change? channel))
      :reducer     (partial reduce-for-message collect-nicks)}))

@@ -55,4 +55,17 @@
   (map->MappingMeter
     {:meter-id  (str "contains-text/" text)
      :predicate #(chat-message-contains-text? text (:content %))
-     :mapper    #(extract-chat-message (:content %))}))+     :mapper    #(extract-chat-message (:content %))}))
+
+(defn- contains-text-meters-from-configuration [conf]
+  (map contains-text-meter (:follow-tags conf)))
+
+(defn- channel-nicks-meters-from-configuration [conf]
+  (mapcat (fn [[server-id server]]
+            (map (partial channel-nicks-meter server-id)
+                 (:channels server)))
+          (:servers conf)))
+
+(defn meters-from-configuration [conf]
+  (concat (contains-text-meters-from-configuration conf)
+          (channel-nicks-meters-from-configuration conf)))


Testing after-event; removing fake failure, since there is coverage of all the individual public functions

--- test/test_huh/test_core.cljs
+++ test/test_huh/test_core.cljs
@@ -1,6 +1,7 @@
 (ns test.test-huh.core
   (:require-macros [cemerick.cljs.test
-                    :refer (is deftest with-test run-tests testing test-var)])
+                    :refer [is deftest with-test run-tests testing test-var
+                            done]])
   (:require [cemerick.cljs.test :as t]
             [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]
@@ -29,11 +30,6 @@
     om/IRender
     (render [this]
       (dom/div #js {}))))
-
-;; To be deleted when there is reasonable test coverage for the
-;; library.
-(deftest test-coverage-is-good-enough
-  (is (= 2 3)))

 ;; tag
 (deftest tag-returns-true-when-tag-name-matches
@@ -361,3 +357,15 @@
                          "#grandchild")]
     (is (= "SPAN" (.-tagName selected)))
     (is (= "grandchild" (.-id selected)))))
+
+(deftest ^:async after-event-triggers-event-and-calls-callback-asynchronously
+  (let [event-args (atom nil)
+        state (huh/setup-state {})]
+    (huh/after-event
+     :click #js {:event "args"}
+     (huh/in (huh/rendered-component
+              (div-component #js {:onClick #(reset! event-args %)}) state))
+     (fn [clicked-node]
+       (is (= "DIV" (.-tagName clicked-node)))
+       (is (= "args" (aget @event-args "event")))
+       (done)))))


It's com.pupeno/jar-copier now

It's com.pupeno/jar-copier now

--- resources/leiningen/new/kraken_works/project.clj
+++ resources/leiningen/new/kraken_works/project.clj
@@ -19,7 +19,7 @@
                  [org.immutant/core "2.1.6"]
                  [democracyworks/kehaar "0.10.4"]]
   :plugins [[lein-immutant "2.1.0"]
-            [com.carouselapps/jar-copier "0.4.0"]]
+            [com.pupeno/jar-copier "0.4.0"]]
   :java-agents [[com.newrelic.agent.java/newrelic-agent "3.35.1"]]
   :jar-copier {:java-agents true
                :destination "resources/jars"}


:integration-fast -> :integration-slow for certain deployment error tests (#123)

--- waiter/integration/waiter/deployment_errors_test.clj
+++ waiter/integration/waiter/deployment_errors_test.clj
@@ -15,7 +15,7 @@
             [waiter.client-tools :refer :all]
             [waiter.settings :as settings]))

-(deftest ^:parallel ^:integration-fast test-invalid-health-check-response
+(deftest ^:parallel ^:integration-slow test-invalid-health-check-response
   (testing-using-waiter-url
     (let [headers {:x-waiter-name (rand-name)
                    ; health check endpoint always returns status 402
@@ -28,7 +28,7 @@
       (is (str/starts-with? body (str "Deployment error: " (-> (waiter-settings waiter-url) :messages :invalid-health-check-response))))
       (delete-service waiter-url service-id))))

-(deftest ^:parallel ^:integration-fast test-cannot-connect
+(deftest ^:parallel ^:integration-slow test-cannot-connect
   (testing-using-waiter-url
     (let [headers {:x-waiter-name (rand-name)
                    ; nothing to connect to
@@ -41,7 +41,7 @@
       (is (str/starts-with? body (str "Deployment error: " (-> (waiter-settings waiter-url) :messages :cannot-connect))))
       (delete-service waiter-url service-id))))

-(deftest ^:parallel ^:integration-fast test-health-check-timed-out
+(deftest ^:parallel ^:integration-slow test-health-check-timed-out
   (testing-using-waiter-url
     (let [headers {:x-waiter-name (rand-name)
                    ; health check endpoint sleeps for 300000 ms (= 5 minutes)


Fix bug in named integer (0..19) (#134)

Fix bug in named integer (0..19) (#134)

There were missing production rules for "0"; the optional "r" in "keiner?" is already matched by the first alternative

--- resources/languages/de/rules/numbers.clj
+++ resources/languages/de/rules/numbers.clj
@@ -13,11 +13,12 @@
  ;;

  "integer (0..19)"
-  #"(?i)(keine?|keine?s|keiner?|keinen|null|nichts|eins?(er)?|zwei|dreizehn|drei|vierzehn|vier|fünf|sechzehn|sechs|siebzehn|sieben|achtzehn|acht|neunzehn|neun|elf|zwölf|füfzehn)"
+  #"(?i)(keine?|keine?s|keiner|keinen|null|nichts|eins?(er)?|zwei|dreizehn|drei|vierzehn|vier|fünf|sechzehn|sechs|siebzehn|sieben|achtzehn|acht|neunzehn|neun|elf|zwölf|füfzehn)"
   ; fourteen must be before four, or it won't work because the regex will stop at four
   {:dim :number
    :integer true
-   :value (get {"keines" 0 "keiner" 0 "keinen" 0 "null" 0 "nichts" 0 "ein" 1 "eins" 1 "eine" 1 "einer" 1 "zwei" 2 "drei" 3 "vier" 4 "fünf" 5
+   :value (get {"kein" 0 "keine" 0 "keins" 0 "keines" 0 "keiner" 0 "keinen" 0 "null" 0 "nichts" 0
+                "ein" 1 "eins" 1 "eine" 1 "einer" 1 "zwei" 2 "drei" 3 "vier" 4 "fünf" 5
                 "sechs" 6 "sieben" 7 "acht" 8 "neun" 9 "zehn" 10 "elf" 11
                 "zwölf" 12 "dreizehn" 13 "vierzehn" 14 "fünfzehn" 15 "sechzehn" 16
                 "siebzehn" 17 "achtzehn" 18 "neunzehn" 19}


ignore bad jar files on classpath

ignore bad jar files on classpath

for some reason node_jre contains a file that is not a jar
./node-jre/jre/jre1.8.0_112.jre/Contents/Home/lib/ext/._jfxrt.jar

closes #14

--- src/main/shadow/cljs/build.clj
+++ src/main/shadow/cljs/build.clj
@@ -27,7 +27,8 @@
            [java.util.concurrent Executors Future ExecutorService]
            (java.security MessageDigest)
            (javax.xml.bind DatatypeConverter)
-           (cljs.tagged_literals JSValue)))
+           (cljs.tagged_literals JSValue)
+           (java.util.zip ZipException)))

 (defn compiler-state? [x]
   (util/compiler-state? x))
@@ -289,31 +290,41 @@
   [state path]
   {:pre [(util/compiler-state? state)]}
   (let [file (io/file path)
-        abs-path (.getCanonicalPath file)
-        jar-file (JarFile. file)
-        last-modified (.lastModified file)
-        entries (.entries jar-file)
-        slurp-entry (fn [entry]
-                      (with-open [in (.getInputStream jar-file entry)]
-                        (slurp in)))]
-    (loop [result (transient {})]
-      (if (not (.hasMoreElements entries))
-        (persistent! result)
-        (let [^JarEntry jar-entry (.nextElement entries)
-              name (.getName jar-entry)]
-          (if (or (not (is-cljs-resource? name))
-                  (should-ignore-resource? state name))
-            (recur result)
-            (let [url (URL. (str "jar:file:" abs-path "!/" name))
-                  rc (inspect-resource state
-                       {:name (normalize-resource-name name)
-                        :from-jar true
-                        :source-path path
-                        :last-modified last-modified
-                        :url url
-                        :input (atom (slurp-entry jar-entry))})]
-              (recur (assoc! result name rc))
-              )))))))
+        abs-path (.getCanonicalPath file)]
+
+    (try
+      (let [
+            jar-file (JarFile. file)
+            last-modified (.lastModified file)
+            entries (.entries jar-file)
+            slurp-entry (fn [entry]
+                          (with-open [in (.getInputStream jar-file entry)]
+                            (slurp in)))]
+        (loop [result (transient {})]
+          (if (not (.hasMoreElements entries))
+            (persistent! result)
+            (let [^JarEntry jar-entry (.nextElement entries)
+                  name (.getName jar-entry)]
+              (if (or (not (is-cljs-resource? name))
+                      (should-ignore-resource? state name))
+                (recur result)
+                (let [url (URL. (str "jar:file:" abs-path "!/" name))
+                      rc (inspect-resource state
+                           {:name (normalize-resource-name name)
+                            :from-jar true
+                            :source-path path
+                            :last-modified last-modified
+                            :url url
+                            :input (atom (slurp-entry jar-entry))})]
+                  (recur (assoc! result name rc))
+                  ))))))
+      (catch ZipException e
+        (util/log state {:type :bad-jar :path abs-path})
+        ;; just pretend its empty
+        {})
+      (catch Exception e
+        (throw (ex-info (str "failed to generate jar manifest for file: " abs-path) {:abs-path abs-path} e)))
+      )))

 (defn write-jar-manifest [file manifest]
   (let [data (->> (vals manifest)


Minor cleanup :shower:

Minor cleanup :shower:

--- src/metabase/api/dashboard.clj
+++ src/metabase/api/dashboard.clj
@@ -38,20 +38,19 @@
   (dashboard/create-dashboard! dashboard *current-user-id*))

 (defn- hide-unreadable-card
-  "Replace unreadable card with object containing only the id"
+  "If CARD is unreadable, replace it with an object containing only its `:id`."
   [card]
   (if (models/can-read? card)
     card
-    {:id (:id card)}))
+    (select-keys card [:id])))

 (defn- hide-unreadable-cards
-  "Replace the `:card` and `:series` entries from dashcards that they user isn't allowed to read with empty object."
+  "Replace the `:card` and `:series` entries from dashcards that they user isn't allowed to read with empty objects."
   [dashboard]
-  (update dashboard :ordered_cards (fn [dashcards]
-                                     (vec (for [dashcard dashcards]
-                                            (assoc dashcard :card (hide-unreadable-card (:card dashcard))
-                                                            :series (for [card (:series dashcard)]
-                                                                      (hide-unreadable-card card))))))))
+  (update dashboard :ordered_cards (partial mapv (fn [dashcard]
+                                                   (-> dashcard
+                                                       (update :card hide-unreadable-card)
+                                                       (update :series (partial mapv hide-unreadable-card)))))))

 (defendpoint GET "/:id"
   "Get `Dashboard` with ID."


Fix load-from-h2 command :wrench:

Fix load-from-h2 command :wrench:

--- src/metabase/db/migrations.clj
+++ src/metabase/db/migrations.clj
@@ -1,5 +1,11 @@
 (ns metabase.db.migrations
-  "Clojure-land data migration definitions and fns for running them."
+  "Clojure-land data migration definitions and fns for running them.
+   These migrations are all ran once when Metabase is first launched, except when transferring data from an existing H2 database.
+   When data is transferred from an H2 database, migrations will already have been ran against that data; thus, all of these migrations
+   need to be repeatable, e.g.:
+
+     CREATE TABLE IF NOT EXISTS ... -- Good
+     CREATE TABLE ...               -- Bad"
   (:require [clojure.string :as s]
             [clojure.tools.logging :as log]
             (metabase [config :as config]
@@ -228,13 +234,15 @@
         {admin-group-id :id}     (perm-group/admin)]
     (binding [perm-membership/*allow-changing-all-users-group-members* true]
       (doseq [{user-id :id, superuser? :is_superuser} (db/select [User :id :is_superuser])]
-        (db/insert! PermissionsGroupMembership
-          :user_id  user-id
-          :group_id all-users-group-id)
-        (when superuser?
+        (u/ignore-exceptions
           (db/insert! PermissionsGroupMembership
             :user_id  user-id
-            :group_id admin-group-id))))))
+            :group_id all-users-group-id))
+        (when superuser?
+          (u/ignore-exceptions
+            (db/insert! PermissionsGroupMembership
+              :user_id  user-id
+              :group_id admin-group-id)))))))

 ;; admin group has a single entry that lets it access to everything
 (defmigration add-admin-group-root-entry


Run build in docker

Run build in docker

--- src/midara/builder/builder.clj
+++ src/midara/builder/builder.clj
@@ -75,8 +75,8 @@
     ; then `.main` function in `.midara` is kicked off and run
     (def docker (str "docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v " workdir "/src:/workspace /run.sh"))
     (println "docker" "run" "--rm" "-v" "/var/run/docker.sock:/var/run/docker.sock" "-v" (str workdir "/src:/workspace") "source /workspace/.midara; main" " >> " build-log " 2>&1")
-    (sh "docker" "run" "--rm" "-v" "/var/run/docker.sock:/var/run/docker.sock" "-v" (str workdir "/src:/workspace") "-v" "" "docker" "'source /workspace/.midara; main'" " >> " build-log " 2>&1")))
-    ;(sh "/bin/sh" "-c" (str cmd "; " docker " >> " build-log " 2>&1"))))
+    ;(sh "docker" "run" "--rm" "-v" "/var/run/docker.sock:/var/run/docker.sock" "-v" (str workdir "/src:/workspace") "-v" "" "docker" "'source /workspace/.midara; main'" " >> " build-log " 2>&1")))
+    (sh "/bin/sh" "-c" (str "docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v " workdir "/src:/workspace docker -v " pwd "/resources/scripts/build:/build /build >> " build-log " 2>&1"))))

 (defn build
   ; Start the build process


Do not let viewers change entry labels. Fix error message on 422 responses.

--- src/oc/storage/api/entries.clj
+++ src/oc/storage/api/entries.clj
@@ -678,7 +678,7 @@
                         (select-keys ctx [:access-level :role])
                         (-> ctx :user :user-id)))})
   :handle-unprocessable-entity (fn [ctx]
-    (api-common/unprocessable-entity-handler (merge ctx {:reason (schema/check common-res/Entry (:updated-entry ctx))}))))
+    (api-common/unprocessable-entity-handler (merge ctx {:reason (str (schema/check common-res/Entry (:updated-entry ctx)))}))))

 ;; A resource for operations on all entries of a particular board
 (defresource entry-list [conn org-slug board-slug-or-uuid]
@@ -907,7 +907,7 @@
                                                (select-keys ctx [:access-level :role])
                                                (-> ctx :user :user-id)))
   :handle-unprocessable-entity (fn [ctx]
-    (api-common/unprocessable-entity-handler (merge ctx {:reason (map #(schema/check common-res/ShareRequest %) (:share-requests ctx))}))))
+    (api-common/unprocessable-entity-handler (merge ctx {:reason (s/join "\n" (map #(str (schema/check common-res/ShareRequest %)) (:share-requests ctx)))}))))

 ;; A resource for access to a particular entry by its secure UUID
@@ -989,7 +989,7 @@
                                                (select-keys ctx [:access-level :role])
                                                (-> ctx :user :user-id)))
   :handle-unprocessable-entity (fn [ctx]
-                                 (api-common/unprocessable-entity-handler (merge ctx {:reason (schema/check common-res/Entry (:updated-entry ctx))}))))
+                                 (api-common/unprocessable-entity-handler (merge ctx {:reason (str (schema/check common-res/Entry (:updated-entry ctx)))}))))

 (defresource inbox [conn org-slug board-slug entry-uuid action-type]
   (api-common/open-company-authenticated-resource config/passphrase) ; verify validity and presence of required JWToken
@@ -1043,8 +1043,8 @@
   ;; Authorization
   :allowed? (by-method {
     :options true
-    :post (fn [ctx] (access/allow-members conn org-slug (:user ctx)))
-    :delete (fn [ctx] (access/allow-members conn org-slug (:user ctx)))})
+    :post (fn [ctx] (access/allow-authors conn org-slug board-slug (:user ctx)))
+    :delete (fn [ctx] (access/allow-authors conn org-slug board-slug (:user ctx)))})

   ;; Media type client accepts
   :available-media-types (by-method {
@@ -1094,7 +1094,7 @@
   ;; Authorization
   :allowed? (by-method {
     :options true
-    :post (fn [ctx] (access/allow-members conn org-slug (:user ctx)))})
+    :post (fn [ctx] (access/allow-authors conn org-slug board-slug (:user ctx)))})

   ;; Media type client accepts
   :available-media-types (by-method {
@@ -1133,7 +1133,7 @@
                                                (select-keys ctx [:access-level :role])
                                                (-> ctx :user :user-id)))
   :handle-unprocessable-entity (fn [ctx]
-    (api-common/unprocessable-entity-handler (merge ctx {:reason (schema/check common-res/Entry (:updated-entry ctx))}))))
+    (api-common/unprocessable-entity-handler (merge ctx {:reason (str (schema/check common-res/Entry (:updated-entry ctx)))}))))

 ;; ----- Routes -----


core.async: :priority? should be :priority

--- src/onyx/peer/virtual_peer.clj
+++ src/onyx/peer/virtual_peer.clj
@@ -36,7 +36,7 @@
                            :task-lifecycle-fn task-lifecycle}
                           (:onyx.peer/state opts))]
         (let [replica @replica-atom
-              position (first (alts!! [kill-ch inbox-ch] :priority? true))]
+              position (first (alts!! [kill-ch inbox-ch] :priority true))]
           (if position
             (let [entry (extensions/read-log-entry log position)
                   new-replica (extensions/apply-log-entry entry replica)


Defensively code onyx-bookkeeper to deal with faults

--- src/onyx/plugin/bookkeeper.clj
+++ src/onyx/plugin/bookkeeper.clj
@@ -17,7 +17,7 @@
             [onyx.static.uuid :refer [random-uuid]]
             [onyx.peer.operation :refer [kw->fn]]
             [onyx.types :refer [dec-count! inc-count!]]
-            [taoensso.timbre :refer [info error debug fatal]])
+            [taoensso.timbre :refer [info warn error trace debug fatal]])
   (:import [org.apache.zookeeper KeeperException$BadVersionException KeeperException$ConnectionLossException]
            [org.apache.bookkeeper.client
             LedgerHandle LedgerEntry BookKeeper BKException$Code BKException$ZKException BookKeeper$DigestType AsyncCallback$AddCallback]))
@@ -65,12 +65,15 @@

 (defn close-read-ledgers-resources
   [{:keys [bookkeeper/producer-ch bookkeeper/commit-ch bookkeeper/read-ch bookkeeper/shutdown-ch] :as event} lifecycle]
+  (info "Closing read ledger resources:" (:onyx.core/task event))
   (close! shutdown-ch)
   (close! read-ch)
   ;; Drain the read-ch to unblock the producer
   (while (poll! read-ch))
   (close! commit-ch)
-  (<!! producer-ch)
+  (let [timeout-ms 15000]
+    (when-not (= producer-ch (second (alts!! [producer-ch (timeout timeout-ms)])))
+      (warn (format "Timed out after %s ms waiting for BookKeeper plugin producer thread to finish." timeout-ms))))
   {})

 (defn set-starting-offset! [log task-map checkpoint-key start]
@@ -165,6 +168,8 @@
     (throw (ex-info "Read log tasks must set :onyx/max-peers 1" task-map)))
   (when-not (:bookkeeper/password-bytes task-map)
     (throw (Exception. ":bookkeeper/password-bytes must be supplied")))
+
+  (info "Inject read ledger resources:" (:onyx.core/task event))

   (let [{:keys [bookkeeper/ledger-start-id bookkeeper/ledger-end-id bookkeeper/zookeeper-ledgers-root-path
                 bookkeeper/zookeeper-addr bookkeeper/deserializer-fn bookkeeper/no-recovery?] :as defaulted-task-map}
@@ -222,7 +227,7 @@

 (defrecord BookKeeperLogInput
   [log task-id max-pending batch-size batch-timeout pending-messages drained?
-   top-index top-acked-index pending-indexes error read-ch commit-ch shutdown-ch]
+   top-index top-acked-index pending-indexes error retry-ch read-ch commit-ch shutdown-ch]
   p-ext/Pipeline
   (write-batch
     [this event]
@@ -238,11 +243,10 @@
           batch (if (zero? max-segments)
                       (<!! timeout-ch)
                       (->> (range max-segments)
-                           (keep (fn [_] (first (alts!! [read-ch timeout-ch] :priority true))))))]
+                           (keep (fn [_] (first (alts!! [retry-ch read-ch timeout-ch] :priority true))))))]
       (doseq [m batch]
         (let [message (:message m)]
-          (info "Read message in batch" message)
-
+          (trace "Read message in batch" task-id message)
           (when-not (= message :done)
             (swap! top-index max (:entry-id message))
             (swap! pending-indexes conj (:entry-id message))))
@@ -271,7 +275,7 @@
   (retry-segment
     [_ event segment-id]
     (when-let [msg (get @pending-messages segment-id)]
-      (>!! read-ch (assoc msg :id (random-uuid))))
+      (>!! retry-ch (assoc msg :id (random-uuid))))
     (swap! pending-messages dissoc segment-id))

   (pending?
@@ -287,6 +291,7 @@
         batch-size (:onyx/batch-size task-map)
         batch-timeout (or (:onyx/batch-timeout task-map) (:onyx/batch-timeout defaults))
         read-ch (chan (or (:bookkeeper/read-buffer task-map) 1000))
+        retry-ch (chan max-pending)
         error (atom nil)
         commit-ch (chan (sliding-buffer 1))
         shutdown-ch (chan 1)
@@ -303,6 +308,7 @@
                           top-acked-id
                           pending-indexes
                           error
+                          retry-ch
                           read-ch
                           commit-ch
                           shutdown-ch)))


util/hadoop.clj: added json-map

util/hadoop.clj: added json-map

--- src/org/altlaw/util/hadoop.clj
+++ src/org/altlaw/util/hadoop.clj
@@ -1,5 +1,7 @@
 (ns org.altlaw.util.hadoop
-  (:require [org.altlaw.util.log :as log]))
+  (:require [org.altlaw.util.log :as log]
+            [clojure.contrib.json.read :as json]
+            [clojure.contrib.walk :as walk]))

 (defn import-hadoop
   []
@@ -98,6 +100,18 @@
         (.collect output (Text. (pr-str key))
                   (Text. (pr-str value)))))))

+(defn json-map [map-fn this wkey wvalue output reporter]
+  (let [key (str wkey)
+        value (walk/keywordize-keys (json/read-json-string (str wvalue)))]
+    (log/debug "Mapper input: " (pr-str key)
+               " => " (log/logstr value))
+    (binding [*reporter* reporter]
+      (doseq [[key value] (map-fn key value)]
+        (log/debug "Mapper OUTPUT: " (pr-str key)
+                   " => " (log/logstr value))
+        (.collect output (Text. (pr-str key))
+                  (Text. (pr-str value)))))))
+
 (defn byteswritable-map [map-fn self #^Text wkey #^BytesWritable wvalue
                          #^OutputCollector output reporter]
   (let [key (str wkey)


Simplify mount-count

Simplify mount-count

--- src/reagent/impl/batching.cljs
+++ src/reagent/impl/batching.cljs
@@ -8,10 +8,10 @@

 ;;; Update batching

-(defonce mount-count #js {:count 0})
+(defonce mount-count 0)

 (defn next-mount-count []
-  (.! mount-count :count (inc (.' mount-count :count))))
+  (set! mount-count (inc mount-count)))

 (defn fake-raf [f]
   (js/setTimeout f 16))


(PE-4372) Added test for dns_alt_name setting

--- test/puppetlabs/master/certificate_authority_test.clj
+++ test/puppetlabs/master/certificate_authority_test.clj
@@ -4,6 +4,7 @@
             [puppetlabs.trapperkeeper.testutils.logging :as logutils]
             [puppetlabs.certificate-authority.core :as utils]
             [puppetlabs.kitchensink.core :as ks]
+            [clojure.string :as string]
             [schema.test :as schema-test]
             [clojure.test :refer :all]
             [clojure.java.io :as io]
@@ -357,6 +358,40 @@
           (fs/delete serial-number-file)
           (fs/delete-dir ssldir)))))

+  (deftest initialize-master!-alt-dns-names-test
+    (let [serial-number-file (temp-serial-number-file)]
+      (try
+        (let [alt-names ["onefish", "twofish"]
+              master-name "master"
+              ca-name "Puppet CA: localhost"
+              alt-name-settings (assoc master-settings
+                                  :dns-alt-names
+                                  (string/join "," alt-names))]
+          (initialize-master! alt-name-settings master-name ca-name
+                              (utils/pem->private-key cakey)
+                              (utils/pem->cert cacert)
+                              512
+                              serial-number-file)
+
+          (testing "Generated SSL files"
+            (doseq [file (vals ssldir-contents)]
+              (testing file
+                (is (fs/exists? file)))))
+
+          (testing "Cert has alt names extension"
+            (let [cert (-> ssldir-contents
+                           :hostcert
+                           utils/pem->certs first)
+                  alt-names-ext (utils/get-extension cert "2.5.29.17")
+                  expected (set (conj alt-names master-name))]
+              (is (= expected (set (get-in alt-names-ext [:value :dns-name])))
+                  (str "The Subject Alternative Names extension should contain "
+                       "all the hostnames listed in the dns_alt_names setting in "
+                       "addition to the master name itsef.")))))
+
+        (finally
+          (fs/delete-dir ssldir)))))
+
   (deftest initialize!-test
     (testing "Generated SSL file"
       (try


add a test case for thread-safety

add a test case for thread-safety

Add a test case which spawns multiple threads that simultaneously call
next-serial-number! and tests that it always returns a unique serial
number.

--- test/puppetlabs/master/certificate_authority_test.clj
+++ test/puppetlabs/master/certificate_authority_test.clj
@@ -429,3 +429,36 @@
         (is (= "0004" (slurp serial-number-file))))

       (fs/delete serial-number-file))))
+
+(defn contains-duplicates? [coll]
+  (not= (count coll) (count (distinct coll))))
+
+; If the locking is deleted from `next-serial-number!`, this test will hang,
+; which is not as nice as simply failing ...
+; This seems to happen due to a deadlock caused by concurrently reading and
+; writing to the same file (via `slurp` and `spit`)
+(deftest next-serial-number-threadsafety
+  (testing "next-serial-number! is thread-safe and
+            never returns a duplicate serial number"
+    (let [serial-number-file (fs/temp-file nil)
+          _ (spit serial-number-file "0001")
+          serial-numbers (atom [])
+
+          ; spin off a new thread for each CPU
+          promises (for [_ (range (ks/num-cpus))]
+                     (let [p (promise)]
+                       (future
+
+                         ; get a bunch of serial numbers and keep track of them
+                         (dotimes [_ 100]
+                           (let [serial-number (next-serial-number!
+                                                 serial-number-file)]
+                             (swap! serial-numbers conj serial-number)))
+                         (deliver p 'done))
+                       p))]
+
+      ; wait on all the threads to finish
+      (doseq [p promises] (deref p))
+
+      (is (false? (contains-duplicates? @serial-numbers))
+          "Got a duplicate serial number"))))


Restore a test that got left behind

Restore a test that got left behind

--- test/vip/data_processor/db/translations/util_test.clj
+++ test/vip/data_processor/db/translations/util_test.clj
@@ -3,15 +3,11 @@
             [vip.data-processor.db.translations.util :as util]))

 (deftest index-generator-test
-  (testing "a generator is a function that yields new values on each call"
+  (testing "a generator yields monotonically increasing values on each call"
     (let [idx (util/index-generator 13)
           values (into [] (take 5 (repeatedly idx)))]
-      (is (= [13 14 15 16 17] values))))
-
-  (testing "values increase monotonicly"
-    (let [idx (util/index-generator 0)
-          values (into [] (take 5 (repeatedly idx)))]
-)))
+      (is (= [13 14 15 16 17] values))
+      (is (every? > values)))))

 (deftest column->xml-elment-test
   (testing "column names are given as keywords"


if user isnt root

if user isnt root

--- src/celestial/puppet_standalone.clj
+++ src/celestial/puppet_standalone.clj
@@ -29,8 +29,8 @@

 (env {})

-(defn as-root [remote cmd]
-  (if (remote :user)
+(defn as-root [{:keys [user] :as remote} cmd]
+  (if (and user (not= user "root"))
     (<< "sudo ~{cmd}") cmd))

 (defn args-of [type]


Moved test

Moved test

--- test/puppetlabs/certificate_authority/core_test.clj
+++ test/puppetlabs/certificate_authority/core_test.clj
@@ -137,6 +137,12 @@
       (is (x500-name? x500-name))
       (is (= "common name" common-name)))))

+(deftest cn-from-x500principal-test
+  (testing "cn extracted from an X500Principal"
+    (let [x500-principal (X500Principal.
+                           "CN=myagent, OU=Users, OU=Department A, DC=mydomain, DC=com")
+          cn (get-cn-from-x500-principal x500-principal)]
+      (is (= "myagent" cn)))))

 (deftest certification-request-test
   (testing "create CSR"
@@ -401,13 +407,6 @@
 (let [cert-with-exts (-> "certs/cert-with-exts.pem"
                          open-ssl-file
                          pem->cert)]
-
-  (deftest cn-from-x500principal-test
-    (testing "cn extracted from an X500Principal"
-      (let [x500-principal (.getSubjectX500Principal cert-with-exts)
-            cn (get-cn-from-x500-principal x500-principal)]
-        (is (= "myagent" cn)))))
-
   (deftest extensions-returned
     (testing "Found all extensions"
       (let [extensions (get-extensions cert-with-exts)]


clj print-method overrides

clj print-method overrides

--- src/thi/ng/fabric/triples.cljc
+++ src/thi/ng/fabric/triples.cljc
@@ -224,6 +224,8 @@
   (query-for-pattern
     [_ pattern] (@queries pattern)))

+#?(:clj (prefer-method print-method clojure.lang.IRecord clojure.lang.IDeref))
+
 (defrecord BasicTripleQuery [id acc result pattern]
   #?@(:clj
        [clojure.lang.IDeref (deref [_] (when result @result))]


Formatting

Formatting

--- test/clojure/clojurewerkz/cassaforte/collections_test.clj
+++ test/clojure/clojurewerkz/cassaforte/collections_test.clj
@@ -1,10 +1,12 @@
 (ns clojurewerkz.cassaforte.collections-test
   (:refer-clojure :exclude [update])
   (:require [clojurewerkz.cassaforte.test-helper :as th]
-            [clojurewerkz.cassaforte.client :as client]
-            [clojurewerkz.cassaforte.cql :as cql :refer :all]
-            [clojure.test :refer :all]
-            [clojurewerkz.cassaforte.query :refer :all]))
+            [clojurewerkz.cassaforte.client      :as client]
+            [clojurewerkz.cassaforte.cql         :as cql :refer :all]
+
+            [clojure.test                        :refer :all]
+
+            [clojurewerkz.cassaforte.query       :refer :all]))

 (let [s (th/make-test-session)]
   (use-fixtures :each (fn [f]


Add test to cover fatal error on ident

Add test to cover fatal error on ident

--- test/com/wsscode/pathom/connect/planner_readers_test.cljc
+++ test/com/wsscode/pathom/connect/planner_readers_test.cljc
@@ -8,6 +8,11 @@
             [com.wsscode.pathom.test-helpers :as th]
             [com.wsscode.pathom.misc :as p.misc]
             [clojure.core.async :as async :refer [go]]))
+
+(defn index-query? [tx]
+  (try
+    (= (first (ffirst tx)) ::pc/indexes)
+    (catch #?(:clj Throwable :cljs :default) _ false)))

 (defn run-parser [{::keys [resolvers query entity foreign error-stack? plugins]}]
   (let [foreign-calls (atom {})
@@ -26,7 +31,7 @@
                           foreign
                           (assoc ::ps/foreign-parsers
                             (mapv
-                              (fn [{::keys [resolvers foreign-id]}]
+                              (fn [{::keys [resolvers foreign-id fatal-error?]}]
                                 (let [source-id (or foreign-id (gensym "foreign-source-"))]
                                   (ps/connect-serial-parser
                                     {::ps/connect-reader pc/reader3
@@ -35,7 +40,7 @@
                                                              {::p/wrap-parser
                                                               (fn [parser]
                                                                 (fn [env tx]
-                                                                  (if (= tx [:critical-error])
+                                                                  (if (and fatal-error? (not (index-query? tx)))
                                                                     (throw (ex-info "Parser Error" {:foo "bar"})))
                                                                   (swap! foreign-calls update source-id p.misc/vconj tx)
                                                                   (parser env tx)))}))}
@@ -484,13 +489,26 @@

       (testing "fatal error on remote parser"
         (is (= (run-parser
-                 {::foreign [{::foreign-id 'remote
-                              ::resolvers  [(pc/resolver 'a
-                                              {::pc/output [:critical-error]}
-                                              (fn [_ _] {:critical-error 4}))]}]
+                 {::foreign [{::foreign-id   'remote
+                              ::resolvers    [(pc/resolver 'a
+                                                {::pc/output [:critical-error]}
+                                                (fn [_ _] {:critical-error 4}))]
+                              ::fatal-error? true}]
                   ::query   [:critical-error]})
                {:critical-error                 :com.wsscode.pathom.core/reader-error,
-                :com.wsscode.pathom.core/errors {[:critical-error] "class clojure.lang.ExceptionInfo: Parser Error - {:foo \"bar\"}"}}))))
+                :com.wsscode.pathom.core/errors {[:critical-error] "class clojure.lang.ExceptionInfo: Parser Error - {:foo \"bar\"}"}}))
+
+        (testing "in ident request"
+          (is (= (run-parser
+                   {::foreign [{::foreign-id   'remote
+                                ::resolvers    [(pc/resolver 'a
+                                                  {::pc/input  #{:id}
+                                                   ::pc/output [:critical-error]}
+                                                  (fn [_ _] {:critical-error 4}))]
+                                ::fatal-error? true}]
+                    ::query   [{[:id 123] [:critical-error]}]})
+                 {[:id 123]                       {:critical-error :com.wsscode.pathom.core/reader-error},
+                  :com.wsscode.pathom.core/errors {[[:id 123] :critical-error] "class clojure.lang.ExceptionInfo: Parser Error - {:foo \"bar\"}"}})))))

     (testing "nested queries"
       (is (= (run-parser


make collision resolution feel slightly nicer

--- src/voke/system/collision.cljs
+++ src/voke/system/collision.cljs
@@ -57,19 +57,19 @@
                             [:x true] (- (shape2 :x)
                                          (/ (shape2 :width) 2)
                                          (/ (shape1 :width) 2)
-                                         0.1)
+                                         0.01)
                             [:x false] (+ (shape2 :x)
                                           (/ (shape2 :width) 2)
                                           (/ (shape1 :width) 2)
-                                          0.1)
+                                          0.01)
                             [:y true] (- (shape2 :y)
                                          (/ (shape2 :height) 2)
                                          (/ (shape1 :height) 2)
-                                         0.1)
+                                         0.01)
                             [:y false] (+ (shape2 :y)
                                           (/ (shape2 :height) 2)
                                           (/ (shape1 :height) 2)
-                                          0.1))]
+                                          0.01))]
     (when-not (find-contacting-entity (assoc-in (event :entity)
                                                 [:shape (event :axis)]
                                                 axis-value-to-try)


Fix "Keep shutter open" for channels

Fix "Keep shutter open" for channels

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

--- acqEngine/src/org/micromanager/sequence_generator.clj
+++ acqEngine/src/org/micromanager/sequence_generator.clj
@@ -20,7 +20,7 @@
 (def MAX-Z-TRIGGER-DIST 5.0)

 (defstruct acq-settings :frames :positions :channels :slices :slices-first
-  :time-first :keep-shutter-open-slices :keep-shuftter-open-channels
+  :time-first :keep-shutter-open-slices :keep-shutter-open-channels
   :use-autofocus :autofocus-skip :relative-slices :exposure :interval-ms :custom-intervals-ms)

 (defn all-equal?


complete the basic logic of commit function

--- tsask/src/clj/tsask/form/crud.clj
+++ tsask/src/clj/tsask/form/crud.clj
@@ -152,17 +152,17 @@
                           :trnCardNumber   (:trnCardNumber params)
                           :trnExpMonth     (:trnExpMonth params)
                           :trnExpYear      (:trnExpYear params)}]
-        (println query-params)
         (if (every? #(not-empty (val %)) query-params)
           (let [response (client/get "https://www.beanstream.com/scripts/process_transaction.asp" {:query-params (assoc query-params :requestType "BACKEND" :merchant_id "257900000")})]
-            (println response))))
-
-      ;; mail to client, I'm sorry, It's need you to finish
-      #_(send-message
-       (assoc MAIL_TEMPLATE
-         :to "clientEmail"
-         :subject "subject"
-         :body "body"))
-      (pages [:div "the order's information sent to you inbox already, please check it later!"]))))
+            (if (.contains (:body response) "invlid")
+              (pages [:div "pay failed"])
+              ;; mail to client, It's need you to finish
+              #_(send-message
+                 (assoc MAIL_TEMPLATE
+                   :to "clientEmail"
+                   :subject "subject"
+                   :body "body"))
+              (pages [:div "pay success"])))
+          (pages [:div "need to payment"]))))))


Fixed listify tests.

Fixed listify tests.

--- test/lambda_blog/templates_test.clj
+++ test/lambda_blog/templates_test.clj
@@ -4,15 +4,15 @@
             [s-html.tags :refer [a li ul span] :as tags]))

 (deftest navigation-is-properly-rendered
-  (is (= (listify {1 2 2 3})
+  (is (= (listify [[1 2] [2 3]])
          (ul {:class "nav navbar-nav"}
              (li (a {:href 2} 1))
              (li (a {:href 3} 2)))))
-  (is (= (listify {1 2 2 3} true)
+  (is (= (listify [[1 2] [2 3]] true)
          (ul {:class :dropdown-menu}
              (li (a {:href 2} 1))
              (li (a {:href 3} 2)))))
-  (is (= (listify {1 2 2 {3 4}})
+  (is (= (listify [[1 2] [2 [[3 4]]]])
          (ul {:class "nav navbar-nav"}
              (li (a {:href 2} 1))
              (li {:class :dropdown}


Re-add facts around fn-grouping-test for schema ck

--- test/onyx/peer/fn_grouping_test.clj
+++ test/onyx/peer/fn_grouping_test.clj
@@ -7,6 +7,8 @@
             [onyx.api]))

 (namespace-state-changes [(around :facts (s/with-fn-validation ?form))])
+
+(facts

 (def id (java.util.UUID/randomUUID))

@@ -188,3 +190,4 @@
 (onyx.api/shutdown-peer-group peer-group)

 (onyx.api/shutdown-env env)
+)


added bad test to check hudson.

added bad test to check hudson.

--- test/forma/source/fire_test.clj
+++ test/forma/source/fire_test.clj
@@ -2,6 +2,8 @@
   (:use forma.source.fire
         cascalog.api
         midje.sweet))
+
+(fact (+ 1 1) => 3)

 (def fire-tap
   (memory-source-tap


Add first test for services and transaction log.

--- test/uxbox/tests/test_txlog.clj
+++ test/uxbox/tests/test_txlog.clj
@@ -1,12 +1,19 @@
 (ns uxbox.tests.test-txlog
   "A txlog and services abstraction generic tests."
   (:require [clojure.test :as t]
+            [promesa.core :as p]
+            [uxbox.services.core :as usc]
+            [uxbox.services :as usv]
             [uxbox.tests.helpers :as th]))

 (t/use-fixtures :each th/database-reset)

-(t/deftest experiment-spec1
-  (t/is (= 1 1)))
+(defmethod usc/-novelty ::testype1
+  [data]
+  true)

-(t/deftest experiment-spec2
-  (t/is (= 1 1)))
+(t/deftest txlog-spec1
+  (let [data {:type ::testype1 :foo 1 :bar "baz"}
+        response (usv/novelty data)]
+    (t/is (p/promise? response))
+    (t/is (= 1 @response))))


share RO DB for tests

share RO DB for tests

--- test/clojento/magento/t_db.clj
+++ test/clojento/magento/t_db.clj
@@ -34,14 +34,23 @@

 (def system (atom nil))

+; TODO review (namespace-state-changes)
+
+; TODO wrap in (facts ...), maybe?
 (with-state-changes [(before :facts (reset! system (fresh-system (fn []) db-config-in-memory)))
                      (after  :facts (component/stop @system))]
+  (log/info "starting tests with in-memory DB")
   (fact "db exists"
-        (first (run-query (:db @system) :check [])) => {:check "passed"}))
+        (first (run-query (:db @system) :check [])) => {:check "passed"})
+  (log/info "completed tests with in-memory DB"))

-(with-state-changes [(before :facts (reset! system (fresh-system prepare-test-db db-config-ro)))
-                     (after  :facts (component/stop @system))]
+
+; TODO wrap in (facts ...), possibly?
+(with-state-changes [(before :contents (reset! system (fresh-system prepare-test-db db-config-ro)))
+                     (after  :contents (component/stop @system))]
+  (log/info "starting tests with read-only DB")
   (fact "migration table exists"
         (raw-jdbc-fetch (:db @system) "show tables;") => (contains {:table_name "ragtime_migrations", :table_schema "public"}))
   (fact "migration table exists"
-        (raw-jdbc-fetch (:db @system) "show tables;") => (contains {:table_name "core_store", :table_schema "public"})))
+        (raw-jdbc-fetch (:db @system) "show tables;") => (contains {:table_name "core_store", :table_schema "public"}))
+  (log/info "completed tests with read-only DB"))


Added combine routes test

Added combine routes test

--- test/compojure/http/routes.clj
+++ test/compojure/http/routes.clj
@@ -103,3 +103,10 @@
                 (is (= (:route-params request) {:foo "bar"}))
                 "")]
     (route {:request-method :get, :uri "/bar"})))
+
+(deftest combine-routes
+  (let [r1 (fn [req] (if (= (:uri req) "/") {:body "x"}))
+        r2 (fn [req] {:body "y"})
+        rs (routes r1 r2)]
+    (is (rs {:uri "/"}) "x")
+    (is (rs {:uri "/foo"}) "y")))


Added now

Added now

--- src/tick/core.clj
+++ src/tick/core.clj
@@ -13,6 +13,16 @@

 (defn clock-ticking-in-seconds []
   (Clock/tickSeconds (ZoneId/systemDefault)))
+
+(defn now
+  ([]
+   (ZonedDateTime/now))
+  ([clock]
+   (ZonedDateTime/now clock)))
+
+(defn just-now "Now, but truncated to the nearest second"
+  ([] (.truncatedTo (now) (ChronoUnit/SECONDS)))
+  ([clock] (.truncatedTo (now clock) (ChronoUnit/SECONDS))))

 (defn fixed-clock [^ZonedDateTime zdt]
   (Clock/fixed (.toInstant zdt) (.getZone zdt)))


SecurityOptions desc fn

SecurityOptions desc fn

--- src/uruk/core.clj
+++ src/uruk/core.clj
@@ -251,6 +251,15 @@
      (when (seq cipher-suites)
        (.setEnabledCipherSuites sec-opts (into-array String cipher-suites)))
      sec-opts)))
+
+(defn security-options->map
+  "Given a SecurityOptions object, returns a map describing its
+  configuration."
+  [security-options]
+  {:hashcode (.hashCode security-ptions)
+   :cipher-suites (.getEnabledCipherSuites security-ptions)
+   :protocols (.getEnabledProtocols security-ptions)
+   :ssl-context (.getSslContext security-ptions)})

 (defn configure-content-source
   "Given a ContentSource object, modifies that object according to the


canged tense names to english

canged tense names to english

--- babel/english/morphology.clj
+++ babel/english/morphology.clj
@@ -195,14 +195,14 @@
      (str "would " stem))

    ;; TODO: s/futuro/future/
-   (and (= (get-in word '(:infl)) :futuro)
+   (and (= (get-in word '(:infl)) :future)
         (get-in word '(:english))
         (not (nil? (get-in word '(:agr :number))))
         (not (nil? (get-in word '(:agr :person))))
         (string? (get-in word [:future])))
    (str "will " (get-in word [:future]))

-   (and (= (get-in word '(:infl)) :futuro)
+   (and (= (get-in word '(:infl)) :future)
         (get-in word '(:english))
         (not (nil? (get-in word '(:agr :number))))
         (not (nil? (get-in word '(:agr :person)))))
@@ -211,7 +211,7 @@
      (str "will " stem))

    ;; TODO: s/imperfetto/imperfect/
-   (and (= (get-in word '(:infl)) :imperfetto)
+   (and (= (get-in word '(:infl)) :imperfect)
         (get-in word '(:english)))
    (let [infinitive (get-in word '(:english))
          stem (replace infinitive #"^to " "")


get document-id from the url

get document-id from the url

--- src-cljs/frontend/core.cljs
+++ src-cljs/frontend/core.cljs
@@ -91,10 +91,15 @@
 (def navigation-ch
   (chan))

+;; hack to pull document-id out of the url
+(def document-id utils/parsed-uri)
+
 (defn app-state []
-  (let [initial-state (state/initial-state)]
+  (let [initial-state (state/initial-state)
+        document-id (js/parseInt (last (re-find #"document/(.+)$" (.getPath utils/parsed-uri))))]
     (atom (assoc initial-state
-            :db  (ds/make-initial-db (:document/id initial-state))
+            :document/id document-id
+            :db  (ds/make-initial-db document-id)
             :comms {:controls      controls-ch
                     :api           api-ch
                     :errors        errors-ch


Make more like Java one, where possible

Make more like Java one, where possible

--- yatzy-clj/src/yatzy_clj/yatzy.clj
+++ yatzy-clj/src/yatzy_clj/yatzy.clj
@@ -3,6 +3,25 @@

 (defn chance [d1 d2 d3 d4 d5]
   (+ d1 d2 d3 d4 d5))
+
+(defn tally-die [dice]
+  (for [i (range 1 7)]
+    (apply + (for [die dice] (if (= die i) 1 0))))
+  )
+
+(defn yatzy [dice]
+  (let [counts (tally-die dice)
+        result (first
+                 (remove nil?
+                         (for [i (range 0 6)]
+                           (if (= (nth counts i) 5)
+                             50
+                             nil
+                             )
+                           )
+                         )
+                 )]
+    (if (= nil result) 0 50)))

 (defn ones [d1 d2 d3 d4 d5]
   (+ (if (= d1 1) 1 0)
@@ -29,24 +48,29 @@
   )

 (defn fours [d1 d2 d3 d4 _5]
-  (let [dice [d1 d2 d3 d4 _5]]
-    (apply +
+  (let [dice [d1 d2 d3 d4 _5]
+        sum (apply +
            (for [at (range 0 5)]
              (if (= 4 (nth dice at)) 4 0)
              )
-           )
+           )]
+    sum
     )
   )

+
 (defn fives_ [d1 d2 d3 d4 _5]
-  (let [dice [d1 d2 d3 d4 _5]]
-    (apply +
+  (let [dice [d1 d2 d3 d4 _5]
+        s (apply +
            (for [i (range 0 (count dice))]
              (if (= 5 (nth dice i)) 5 0)
              )
-           )
+           )]
+    s
     )
   )
+
+

 (defn sixes [d1 d2 d3 d4 _5]
   (let [dice [d1 d2 d3 d4 _5]]
@@ -59,10 +83,7 @@
   )

-(defn tally-die [dice]
-  (for [i (range 1 7)]
-    (apply + (for [die dice] (if (= die i) 1 0))))
-  )
+

@@ -78,11 +99,6 @@
                     (first))]
     (if (= nil result) 0 result)))

-
-
-
-
-
 (defn two-pair [dice]
   (let [tallies (tally-die dice)
         result (->> (range 0 6)
@@ -92,44 +108,57 @@
                     (* 2))]
     (if (= nil result) 0 result)))

+;public static int yatzy(int... dice)
+;{
+; int[] counts = new int[6];
+;    for (int die : dice)
+;    counts[die-1]++;
+; for (int i = 0; i != 6; i++)
+;    if (counts[i] == 5)
+;        return 50;
+; return 0;
+; }
+
+
+
 (defn get-first-tally [tallies value]
   (->> (range 0 6)
        (filter #(= value (nth tallies %)))
        (first)))

-(defn yatzy [dice]
-  (let [tallies (tally-die dice)]
-    (if (= nil (get-first-tally tallies 5))
-      0
-      50)))
-
-
-(defn three-of-a-kind [dice]
+(defn four-of-a-kind [dice]
   (let [tallies (tally-die dice)
-        result (first (remove nil?
-            (for [i (range 0 6)]
-              (if (>= (nth tallies i) 3)
-                (* (+ i 1) 3)
-                nil
-                )
-              )
-            ))]
+        result (first
+                 (remove nil?
+                         (for [i (range 0 6)]
+                           (if (>= (nth tallies i) 4)
+                             (* (+ i 1) 4)
+                             nil
+                             )
+                           )
+                         ))]
     (if (= nil result)
       0 result
       )
     )
   )

-
-
-
-(defn four-of-a-kind [dice]
-  (let [tallies (tally-die dice)
-        result (->> (range 0 6)
-                    (filter #(>= (nth tallies %) 4))
-                    (map (fn [i] (* (+ i 1) 4)))
-                    (first))]
-    (if (= nil result) 0 result)))
+(defn three-of-a-kind [dice]
+  (let [t (tally-die dice)
+        result (first
+                 (remove nil?
+                         (for [i (range 0 6)]
+                           (if (>= (nth t i) 3)
+                             (* (+ i 1) 3)
+                             nil
+                             )
+                           )
+                         ))]
+    (if (= nil result)
+      0 result
+      )
+    )
+  )

 (defn small-straight [dice]


fix typo in comment

fix typo in comment

--- src/babel/italiano/morphology/nouns.cljc
+++ src/babel/italiano/morphology/nouns.cljc
@@ -7,7 +7,7 @@
    #?(:cljs [babel.logjs :as log])
    [dag_unify.core :refer (copy dissoc-paths fail? get-in ref? strip-refs unifyc)]))

-;; TODO: add :g as with babel.italiano.morphlogy.verbs/patterns.
+;; TODO: add :g as with babel.italiano.morphology.verbs/patterns.
 (defonce patterns
   [


fix bugs

fix bugs

--- src/clj/backtype/storm/daemon/nimbus.clj
+++ src/clj/backtype/storm/daemon/nimbus.clj
@@ -139,7 +139,7 @@
      (transition! nimbus storm-id event false))
   ([nimbus storm-id event error-on-no-transition?]
      (locking (:submit-lock nimbus)
-       (let [[event & event-args] (if (keyword? event) [event []] event)
+       (let [[event event-args] (if (keyword? event) [event []] event)
              status (topology-status nimbus storm-id)]
          (if status ; handles the case where event was scheduled but has been removed
            (let [get-event (fn [m e]
@@ -532,7 +532,7 @@
 (defn cleanup-storm-ids [conf storm-cluster-state]
   (let [heartbeat-ids (set (.heartbeat-storms storm-cluster-state))
         error-ids (set (.task-error-storms storm-cluster-state))
-        assigned-ids (set (.active-storms storm-cluster-state nil))]
+        assigned-ids (set (.active-storms storm-cluster-state))]
     (set/difference (set/union heartbeat-ids error-ids) assigned-ids)
     ))


remove unecessary todo comments

remove unecessary todo comments

--- src/clj/collect_earth_online/routing.clj
+++ src/clj/collect_earth_online/routing.clj
@@ -8,8 +8,6 @@
             [collect-earth-online.db.users        :as users]
             [collect-earth-online.proxy           :as proxy]))

-;; TODO: Flatten url structure, conform name and fn, and rename geo-dash to geodash everywhere.
-;; TODO: The call to render-page does not need the '/'.
 (def routes
   {;; Page Routes
    [:get  "/"]                               {:handler     (render-page "/home")}


add visibility status to profile block, show not activated banner

--- src/cljs/salava/social/ui/dashboard.cljs
+++ src/cljs/salava/social/ui/dashboard.cljs
@@ -7,11 +7,12 @@
             [salava.core.i18n :as i18n :refer [t translate-text]]
             [salava.core.time :refer [date-from-unix-time]]
             [reagent-modals.modals :as m]
-            [salava.core.ui.helper :refer [path-for plugin-fun]]
+            [salava.core.ui.helper :refer [path-for plugin-fun not-activated?]]
             [salava.badge.ui.my :as my]
             [reagent.session :as session]
             [salava.core.helper :refer [dump]]
-            [salava.user.ui.helper :refer [profile-picture]]))
+            [salava.user.ui.helper :refer [profile-picture]]
+            [salava.core.ui.notactivated :refer [not-activated-banner]]))

 (defn init-dashboard [state]
   (ajax/GET
@@ -124,7 +125,7 @@
       [:div.media-body
        [:div.content-text
         [:p.content-heading (str issuer_content_name " " (t :social/Publishedbadge) " " name)]
-       [:span.date (date-from-unix-time (* 1000 ctime) "days") ]]]]]))
+        [:span.date (date-from-unix-time (* 1000 ctime) "days") ]]]]]))

 (defn welcome-block [state]
@@ -183,7 +184,7 @@
           [:div.heading_1
            [:i.fa.fa-certificate.icon]
            [:a {:href (path-for "/badge")} [:span.title "Badges"]]]
-          [application-button]; [:button.btn.button "Earn badges"]
+          (when-not (not-activated?)  [application-button]); [:button.btn.button "Earn badges"]
           [:div.content
            [:div.stats
             [:div.total-badges
@@ -209,17 +210,10 @@
                                                           (mo/open-modal [:badge :info] {:badge-id (:id badge )}))} [:img {:src (str "/" (:image_file badge)) :alt (:name badge) :title (:name badge)}]])
                       ) [:div] badges)
             ]
-           [latest-earnable-badges]
-           #_[:div.badges
-              [:p.header (t :badge/Latestearnablebadges)]
-              ;[earnable-badges state]
-              ]
-           ]
-          ]]]])))
+           [latest-earnable-badges]]]]]])))

 (defn explore-block [state]
   [:div.box.col-md-4
-
    [:div#box_1 {:class "row_2"}
     [:div.col-md-12.block
      [:div.row_2;.block-content
@@ -245,10 +239,7 @@
                                                    [:i.fa.fa-user.icon]
                                                    [:div.text
                                                     [:p.num (get-in @state [:gallery :profiles :all])]
-                                                    [:p.desc (t :gallery/Profiles)]]]]]
-
-       ]
-      ]]]])
+                                                    [:p.desc (t :gallery/Profiles)]]]]]]]]]])

 (defn user-connections-stats []
   (let [blocks (first (plugin-fun (session/get :plugins) "block" "userconnectionstats"))]
@@ -280,10 +271,8 @@
            [:i.fa.fa-thumbs-up.icon]
            [:div.text
             [:p.num (:endorsing @state)]
-            [:p.desc "Endorsing" #_(t :badge/Endorsing)]
-            ]
-           ]
-          ]]
+            [:p.desc "Endorsing" #_(t :badge/Endorsing)]]]]]
+
         [:div.info-block.endorsement
          [:a {:href (path-for "/connections/endorsement")}
           [:div.info
@@ -293,20 +282,35 @@
            [:div.text
             [:p.num (:endorsers @state)]
             [:p.desc "Endorsers" #_(t :badge/Endorsing)]
-            ]
-           ]
-          ]]
-        ]]]]]])
+            ]]]]]]]]]])

 (defn profile-block [state]
-  [:div.box.col-md-3
-   [:div.row_1 {:id "box_1"}
-    [:div.col-md-12.block
-     [:div.profile-block;.block-content
-      [:div.heading_1
-       [:i.fa.fa-user.icon]
-       [:span.title
-        "Profile"]]]]]])
+  (let [user (:user-profile @state)]
+    [:div.box.col-md-3
+     [:div {:id "box_3"}
+      [:div.col-md-12.block
+       [:div.profile-block.row_1;.block-content
+        [:div.heading_1
+         [:i.fa.fa-user.icon]
+         [:span.title
+          (t :user/Profile)]]
+        [:div.content
+         (when-not (not-activated?) [:a.btn.button {:href (path-for "/user/edit/profile")} (t :page/Edit)])
+         [:div.visibility
+          (case (get-in user [:user :profile_visibility])
+            "public" [:div [:i.fa.fa-eye.icon] [:span.text (t :core/Public)]]
+            "internal" [:div [:i.fa.fa-eye-slash.icon ] [:span.text (t :core/Internal)]]
+            nil)]
+
+         [:div
+          [:img.img-rounded {:src (profile-picture (get-in user [:user :profile_picture]))}]
+          [:div.stats
+           [:div.text
+            [:p.num (:pages_count @state)]
+            [:p.desc (t :page/Pages)]]
+           [:div.text
+            [:p.num (:files_count @state)]
+            [:p.desc (t :file/Files)]]]]]]]]]))

 (defn help-block [state]
   [:div {:class "box col-md-3"}
@@ -318,36 +322,28 @@
        [:span.title.help
         "Help"]]
       [:div.content
-       [:a {:href (str (path-for "/user/profile/") (session/get-in [:user :id]))}[:p (t :badge/Iwanttoseeprofile)]]
-       [:a {:href (str (path-for "/user/edit/profile"))}[:p (t :badge/Iwanttoeditprofile)]]
-       [:a {:href (str (path-for "/badge"))}[:p (t :badge/Iwanttoseemysbadges)]]
-       (when (some #(= % :extra/application) (session/get :plugins))[:p (t :badge/Iwanttoearnnewbadges)])
-       [:a {:href (str (path-for "/gallery/badges"))} [:p (t :badge/Iwanttofindbadges)]]
-
-       ]
-      ]
-     ]]]
-  )
+       [:a {:href (str (path-for "/user/profile/") (session/get-in [:user :id]))}[:p (t :social/Iwanttoseeprofile)]]
+       [:a {:href (str (path-for "/user/edit/profile"))}[:p (t :social/Iwanttoeditprofile)]]
+       [:a {:href (str (path-for "/badge"))}[:p (t :social/Iwanttoseemysbadges)]]
+       (when (some #(= % :extra/application) (session/get :plugins))[:p (t :social/Iwanttoearnnewbadges)])
+       [:a {:href (str (path-for "/gallery/badges"))} [:p (t :social/Iwanttofindbadges)]]]]]]])

 (defn content [state]
   [:div#dashboard-container
    [m/modal-window]
+   (if (not-activated?)
+     (not-activated-banner))
    [welcome-block state]
    [:div.row
     [notifications-block state]
     [badges-block state]
-    [profile-block state]
-    ]
+    [profile-block state]]

    [:div.row
     ;[profile-block state]
-
     [explore-block state]
     [connections-block state]
-    [help-block]
-
-
-    ]])
+    [help-block]]])

 (defn handler [site-navi]


Added dotimes

Added dotimes

--- src/clj/cljs/core.clj
+++ src/clj/cljs/core.clj
@@ -294,3 +294,17 @@
        (if (< ~idx  (alength a#))
          (recur (inc ~idx) ~expr)
          ~ret))))
+
+(defmacro dotimes
+  "bindings => name n
+
+  Repeatedly executes body (presumably for side-effects) with name
+  bound to integers from 0 through n-1."
+  [bindings & body]
+  (let [i (first bindings)
+        n (second bindings)]
+    `(let [n# ~n]
+       (loop [~i 0]
+         (when (< ~i n#)
+           ~@body
+           (recur (inc ~i)))))))


stop satisfies? from returning true for nil. Copied docstring over from clojure core. Refs #55

--- src/clj/cljs/core.clj
+++ src/clj/cljs/core.clj
@@ -131,13 +131,16 @@
        ~@(map method methods))))

 (defmacro satisfies?
+  "Returns true if x satisfies the protocol"
   [psym x]
   (let [p (:name (cljs.compiler/resolve-var (dissoc &env :locals) psym))
         prefix (protocol-prefix p)]
     `(let [x# ~x]
-       (if (and x# (. x# ~(symbol prefix)))
-         true
-         (cljs.core/type_satisfies_ ~psym x#)))))
+       (if (cljs.core/nil? x#)
+	 false
+	 (if (and x# (. x# ~(symbol prefix)))
+	   true
+	   (cljs.core/type_satisfies_ ~psym x#))))))

 (defmacro lazy-seq [& body]
   `(new cljs.core.LazySeq nil false (fn [] ~@body)))


re-add missing import to cljs.repl, cleanup

--- src/clj/cljs/repl.clj
+++ src/clj/cljs/repl.clj
@@ -19,7 +19,8 @@
             [clojure.tools.reader.reader-types :as readers]
             [cljs.util :as util]
             [clojure.stacktrace :as trace])
-  (:import [javax.xml.bind DatatypeConverter]))
+  (:import [java.io File PushbackReader]
+           [javax.xml.bind DatatypeConverter]))

 (def ^:dynamic *cljs-verbose* false)

@@ -388,7 +389,7 @@
            (print (str "ClojureScript:" ana/*cljs-ns* "> "))
            (flush)
            (let [rdr (readers/source-logging-push-back-reader
-                       (java.io.PushbackReader. (io/reader *in*))
+                       (PushbackReader. (io/reader *in*))
                        1
                        "NO_SOURCE_FILE")
                  form (try


get-agenda-points

get-agenda-points

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -874,6 +874,14 @@
     (update-breaker-strength state side (get-card state card))))

 (defn get-agenda-points [state side card]
+  (let [base-points (:agendapoints card)
+        runner-fn (:agendapoints-runner (card-def card))
+        corp-fn (:agendapoints-corp (card-def card))]
+    (if (and (= side :runner) (not (nil? runner-fn)))
+      (runner-fn state side card nil)
+        (if (and (= side :corp) (not  (nil? corp-fn)))
+          (corp-fn state side card nil)
+          base-points)
   ))
 )


Fix copy/paste error.

Fix copy/paste error.

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -832,9 +832,10 @@
 (defn access-helper-hq [cards]
   {:prompt "Select a card to access."
    :choices (concat (when (some #(= (first (:zone %)) :hand) cards) ["Card from hand"])
-                    (map #(if (:rezzed %) (:title %) "Upgrade in HQ") (filter #(= (last (:zone %)) :content) cards)))
+                    (map #(if (:rezzed %) (:title %) "Unrezzed upgrade in HQ")
+                         (filter #(= (last (:zone %)) :content) cards)))
    :effect (req (case target
-                  "Upgrade in HQ"
+                "Unrezzed upgrade in HQ"
                   ; accessing an unrezzed upgrade
                   (let [unrezzed (filter #(and (= (last (:zone %)) :content) (not (:rezzed %))) cards)]
                     (if (= 1 (count unrezzed))
@@ -877,9 +878,10 @@
 (defn access-helper-rd [cards]
   {:prompt "Select a card to access."
    :choices (concat (when (some #(= (first (:zone %)) :deck) cards) ["Card from deck"])
-                    (map #(if (:rezzed %) (:title %) "Upgrade in R&D") (filter #(= (last (:zone %)) :content) cards)))
+                    (map #(if (:rezzed %) (:title %) "Unrezzed upgrade in R&D")
+                         (filter #(= (last (:zone %)) :content) cards)))
    :effect (req (case target
-                  "Upgrade in R&D"
+                  "Unrezzed upgrade in R&D"
                   ; accessing an unrezzed upgrade
                   (let [unrezzed (filter #(and (= (last (:zone %)) :content) (not (:rezzed %))) cards)]
                     (if (= 1 (count unrezzed))
@@ -922,10 +924,10 @@
 (defn access-helper-archives [cards]
   {:prompt "Select a card to access. You must access all cards."
    :choices (map #(if (= (last (:zone %)) :content)
-                   (if (:rezzed %) (:title %) "Upgrade in Archives")
+                   (if (:rezzed %) (:title %) "Unrezzed upgrade in Archives")
                    (:title %)) cards)
    :effect (req (case target
-                  "Upgrade in Archives"
+                  "Unrezzed upgrade in Archives"
                   ; accessing an unrezzed upgrade
                   (let [unrezzed (filter #(and (= (last (:zone %)) :content) (not (:rezzed %))) cards)]
                     (if (= 1 (count unrezzed))


Remove pr url

Remove pr url

--- src/antlion_clojure/bot.clj
+++ src/antlion_clojure/bot.clj
@@ -287,6 +287,7 @@

 (defn- remove-me
   [reviewers slack]
+  (println reviewers slack)
   (remove #(= (-> slack :rtm-connection :start :self :id) (:id %)) reviewers))

 (defn- get-reviewer
@@ -325,8 +326,7 @@
             (map->Payload {:type :message
                            :user id
                            :channel channel
-                           :text (str "っ＝[レビューをお願いします]\n"
-                                      pr)})))))
+                           :text (str "っ＝[レビューをお願いします]\n")})))))

 (defn- help
   [{:keys [user channel] :as res} me]


Fix input channel buffer omission

Fix input channel buffer omission

The input channel to the pipeline needs a sliding-buffer of length 1
set in order to only keep the last result around, which is sampled by
the throttle channel on a time interval.

--- src/cljs/app/app.cljs
+++ src/cljs/app/app.cljs
@@ -44,7 +44,7 @@
     c'))

 ; Process pipeline entry point
-(def query-chan (chan))
+(def query-chan (chan (sliding-buffer 1)))
 (def throttled-query-chan (throttle query-chan 1000))

 ; Rest of process pipeline


Update dimple example

Update dimple example

--- src/cljs/d4/core.cljs
+++ src/cljs/d4/core.cljs
@@ -8,7 +8,7 @@
 (enable-console-print!)

 (defonce d3 js/d3)
-(defonce nv js/nv)
+; (defonce nv js/nv)
 (defonce dimple js/dimple)
 (defonce rickshaw js/Rickshaw)
 (defonce body (-> js/d3 (.select "body")))
@@ -26,56 +26,52 @@
                        {:x x :y (.cos js/Math (/ x 10))})}]))

-(defn nv-example
-  []
-  (let [svg (-> body
-                (.append "svg")
-                (.attr "width" 300)
-                (.attr "height" 300))]
-    (.addGraph nv
-               (fn []
-                 (let [chart (-> nv.models
-                                 (.lineChart)
-                                 (.margin #js {:left 100})
-                                 (.useInteractiveGuideline true)
-                                 (.transitionDuration 350)
-                                 (.showLegend true)
-                                 (.showYAxis true)
-                                 (.showYAxis true))]
-                   (-> (.-xAxis chart)
-                       (.axisLabel "Time (ms)")
-                       (.tickFormat (.format d3 ",r")))
-                   (-> (.-yAxis chart)
-                       (.axisLabel "Voltage (v)")
-                       (.tickFormat (.format d3 ".02f")))
-                   ; render
-                   (-> svg
-                       (.datum (sin-cos))
-                       (.call chart))
-                   chart)))))
+; (defn nv-example
+;   []
+;   (let [svg (-> body
+;                 (.append "svg")
+;                 (.attr "width" 300)
+;                 (.attr "height" 300))]
+;     (.addGraph nv
+;                (fn []
+;                  (let [chart (-> nv.models
+;                                  (.lineChart)
+;                                  (.margin #js {:left 100})
+;                                  (.useInteractiveGuideline true)
+;                                  (.transitionDuration 350)
+;                                  (.showLegend true)
+;                                  (.showYAxis true)
+;                                  (.showYAxis true))]
+;                    (-> (.-xAxis chart)
+;                        (.axisLabel "Time (ms)")
+;                        (.tickFormat (.format d3 ",r")))
+;                    (-> (.-yAxis chart)
+;                        (.axisLabel "Voltage (v)")
+;                        (.tickFormat (.format d3 ".02f")))
+;                    ; render
+;                    (-> svg
+;                        (.datum (sin-cos))
+;                        (.call chart))
+;                    chart)))))

 (defn dimple-example
   "Dimple line chart. This requires a .tsv file which can be downloaded from
    https://raw.githubusercontent.com/PMSI-AlignAlytics/dimple/master/data/example_data.tsv"
   []
-  ; create a container
-  (-> body
-      (.append "div")
-      (.attr "id" "chartContainer"))
   (let [svg (-> dimple
-                (.newSvg "#chartContainer" 590 400))]
+                (.newSvg "#chart_container" 590 400))]
     (.tsv d3 "/data/example_data.tsv"
       (fn [d]
         (let [Chart (.-chart dimple)
               data (.filterData dimple d "Owner" #js ["Aperture" "Black Mesa"])
               myChart (Chart. svg data)
+              _ (.setBounds myChart 60 30 505 305)
               x (.addCategoryAxis myChart "x" "Month")]
           (.addOrderRule x "Date")
-          ; (.setBounds myChart 60 30 505 305)
           (.addMeasureAxis myChart "y" "Unit Sales")
-          (.addSeries myChart nil (-> js/dimple (.-plot) (.-line)))
-          (.draw myChart))))))
+          (.addSeries myChart "Channel" (-> js/dimple (.-plot) (.-line)))
+          (.draw myChart 1000))))))

 (defn influxdb-stream
@@ -122,7 +118,7 @@
   []
   (let []
     (log d3)
-    (log nv)
+    ; (log nv)
     (log dimple)
     (log rickshaw)
     (rickshaw-example)))


refactor: removed some useless routines

refactor: removed some useless routines

--- src/crawler/crawl.clj
+++ src/crawler/crawl.clj
@@ -590,33 +590,4 @@
                           leaf-paths
                           leaf-limit))))))))

-(defn crawl-site-extract
-  ([site model]
-     (crawl-site-extract
-      site
-      model
-      (set [])
-      [{:url             site
-        :remaining-model model}]))
-
-  ([site model visited queue]
-     (let [url (-> queue first :url)])))
-
-(defn crawl-site
-  [start {to-eliminate :to-remove models :models}]
-  (map
-   (fn [[model score]]
-     (let [in-order-model (reverse model)]
-       (crawl-site-extract start in-order-model)))
-   models))
-
-(defn crawl
-  [start crawler-type num-docs]
-  (cond (= :richness crawler-type)
-        (crawl-richest {:content [{:url start}]
-                        :pagination []}
-                       (set [])
-                       1
-                       0
-                       num-docs
-                       {})))
+


fix emit-form for :js-array

fix emit-form for :js-array

--- src/main/clojure/clojure/tools/analyzer/passes/js/emit_form.clj
+++ src/main/clojure/clojure/tools/analyzer/passes/js/emit_form.clj
@@ -53,9 +53,8 @@
                      (map #(-emit-form* % opts) vals))))

 (defmethod -emit-form :js-array
-  [{:keys [keys vals]} opts]
-  (->JSValue (zipmap (map #(-emit-form* % opts) keys)
-                     (map #(-emit-form* % opts) vals))))
+  [{:keys [items]} opts]
+  (->JSValue (mapv #(-emit-form* % opts) items)))

 (defmethod print-method JSValue [^JSValue o ^Writer w]
   (.write w "#js ")


more bootstrap proxy routes

more bootstrap proxy routes

--- src/frontend/core.clj
+++ src/frontend/core.clj
@@ -46,12 +46,34 @@
 (def port 3000)

 (def proxy-config
-  {:patterns [#"/"
+  ;; Incomplete lists of routes to proxy. Unfortuantely duplicated knowledge between
+  ;; here and various places in the backend. Ultimately, this will get cleaned up
+  ;; once we have production web servers separate from backend API servers.
+  {:patterns [;; These are owned by the backend. Add to this list if you expect
+              ;; the backend to handle these routes without frontend codebase help.
+              #"/api/.*"
+              #"/auth/.*"
+              #"/cc.xml"
               #"/changelog.rss"
               #"/logout"
+              ;; These bootstrap the frontend.  Add to this list if you expect
+              ;; the backend to serve HTML to bootstrap the client-side code.
+              #"/"
+              #"/about"
+              #"/account.*"
+              #"/add-projects"
+              #"/changelog.*"
+              #"/docs.*"
+              #"/enterprise"
+              #"/features.*"
               #"/gh/.*"
-              #"/auth/.*"
-              #"/api/.*"]
+              #"/home"
+              #"/integrations.*"
+              #"/invite-teammates"
+              #"/jobs"
+              #"/pricing"
+              #"/privacy"
+              #"/security.*"]
    :backends {"dev.circlehost" {:proto "http" :host "circlehost:8080"}
               "prod.circlehost" {:proto "https" :host "circleci.com"}
               "staging.circlehost" {:proto "https" :host "staging.circleci.com"}}})


tweaks

tweaks

--- src/gitmirth/core.clj
+++ src/gitmirth/core.clj
@@ -27,8 +27,9 @@
       :insecure? true})
     (func)))

-(defn fetch-all-channels-zip
-  "Fetch all channels from remote server"
+(defn fetch-all-channel-locs
+  "Fetch all channels from remote server and return a sequence of
+  channel locs within the zipper"
   [base-url]
   (-> base-url
       (str "/channels")                 ;combine the base url with the rest path
@@ -36,13 +37,13 @@
        {:insecure? true})
       :body                             ;extract the response body
       to-zip                            ;get an xml zipper
-      (zx/xml-> :list :channel)         ;get a zipper per channel
+      (zx/xml-> :list :channel)         ;get a loc per channel
       ))

 (defn process-channel
   "Take a channel zip and write to the filesystem"
   [chanzip]
-  (let [channel-name (first (zx/xml-> chanzip :name zip/node))
+  (let [channel-name (zx/xml1-> chanzip :name zip/down zip/node)
         channel-xml (xml/indent-str (zip/node chanzip))
         base-dir "blarfnarg" ;; (java.util.UUID/randomUUID)
         file-path (str base-dir "/" channel-name)]
@@ -53,7 +54,7 @@
   "App logic"
   [base-url username password]
   (with-authentication base-url username password
-    #(map process-channel (fetch-all-channels-zip base-url))))
+    #(map process-channel (fetch-all-channel-locs base-url))))

 (defn -main
   [& args]


Enough is enough.

Enough is enough.

--- src/leiningen/new.clj
+++ src/leiningen/new.clj
@@ -9,6 +9,8 @@

 (defn new
   ([project-name project-dir]
+     (when (re-find #"(?<!clo)jure" project-name)
+       (throw (IllegalArgumentException. "*jure names are no longer allowed.")))
      (let [project-name (symbol project-name)
            group-id (namespace project-name)
            artifact-id (name project-name)]


Fixing what I meant to do for d702649a169cfd27e599096f33a1e56be4111e6e

--- src/marcgrep/core.clj
+++ src/marcgrep/core.clj
@@ -93,7 +93,7 @@
     (let [[predicate options] (if (vector? (predicates (:operator query)))
                                 (predicates (:operator query))
                                 [(predicates (:operator query))])
-          value (if (or (not (string? query))
+          value (if (or (not (string? (:value query)))
                         (:case-sensitive options))
                   (:value query)
                   (.toLowerCase (:value query)))


Fix docstrings: use correct phrase

Fix docstrings: use correct phrase

snake_case is underscores. kebab-case is hyphens.
crisis averted.

--- src/om_tools/dom.cljx
+++ src/om_tools/dom.cljx
@@ -14,12 +14,12 @@
   (JSValue. v))

 (defn camel-case
-  "Converts snake-case to camelCase"
+  "Converts kebab-case to camelCase"
   [s]
   (str/replace s #"-(\w)" (comp str/upper-case second)))

 (defn opt-key-case
-  "Converts attributes that are snake-case and should be camelCase"
+  "Converts attributes that are kebab-case and should be camelCase"
   [attr]
   (if (or (< (count attr) 5)
           (#{"data-" "aria-"} (subs attr 0 5)))


minor mods to the interval checking

minor mods to the interval checking

--- src/ontrail/group.clj
+++ src/ontrail/group.clj
@@ -63,10 +63,10 @@
 ;; marrasputki
 (def min-jog-time (* 25 60 100)) ; 25 minutes

-(defn november-stats-query [users last-day]
+(defn november-stats-query [users days]
   {:sport "Juoksu" "$or" (mapv (partial assoc {} :user) users) :duration {"$gte" min-jog-time}
    "$and" [{:creationDate {"$gte" (time/date-time 2012 11 1 0 0)}}
-           {:creationDate {"$lte" (time/date-time 2012 11 last-day 0 0)}}]
+           {:creationDate {"$lte" (time/plus (time/date-time 2012 11 0 0) (time/days days))}}]
    })

 (defn jogs-from-beginning-of-november [users last-day]
@@ -86,11 +86,14 @@
 (defn november-race-stats-with-day [day-now users]
   (let [last-day (inc day-now)
         days (range 1 last-day)
-        all-results (jogs-from-beginning-of-november users last-day)]
+        all-results (jogs-from-beginning-of-november users day-now)]
     (mapv (partial analyze-jogs all-results days) users)))

-(def november-race-stats
-  (partial november-race-stats (time/day (time/now))))
+(defn november-race-stats [users]
+  (let [now (time/now)
+        month-now (time/month now)
+        day-now (if (= month-now 11) (time/day now) 1)]
+    (november-race-stats-with-day day-now users)))

 (defn fetch-stats [group-map]
   (let [users (:users group-map)]