minor

minor

--- src-cljs/cljsbuild_ui/pages/main.cljs
+++ src-cljs/cljsbuild_ui/pages/main.cljs
@@ -478,6 +478,11 @@
 (defn- click-go-back-btn []
   (swap! state assoc :new-project-step 1))

+(defn- click-open-project-folder!
+  [filename]
+  (let [dirname (.dirname path filename)]
+    (open dirname)))
+
 ;;------------------------------------------------------------------------------
 ;; Sablono Templates
 ;;------------------------------------------------------------------------------
@@ -709,11 +714,6 @@
                  (not (zero? (:warnings bld))))
         (map warning-row (:warnings bld)))]))

-(defn open-project-folder!
-  [filename]
-  (let [dirname (.dirname path filename)]
-    (open dirname)))
-
 (quiescent/defcomponent Project [prj]
   (let [prj-key (:filename prj)]
     (sablono/html
@@ -723,7 +723,7 @@
             (:name prj)
             [:span.project-icons-dd1bb
               [:i.fa.fa-folder-open-o.project-icon-1711d
-                {:on-click #(open-project-folder! prj-key)}]
+                {:on-click #(click-open-project-folder! prj-key)}]
               (when (= (:state prj) :idle)
                 (list
                   ;; NOTE: hiding edit link for now


removed an intercom event no one was using (viewed-self-triggered-oss-build)

--- src-cljs/frontend/analytics/core.cljs
+++ src-cljs/frontend/analytics/core.cljs
@@ -165,11 +165,7 @@
         user (get-in current-state state/user-path)]
     (segment/track-event :view-build (supplement-tracking-properties {:properties properties
                                                                       :owner owner
-                                                                      :current-state current-state}))
-    (when (and (:oss build) (build-model/owner? build user))
-      (intercom/track :viewed-self-triggered-oss-build
-                      {:vcs-url (vcs-url/project-name (:vcs_url build))
-                       :outcome (:outcome build)}))))
+                                                                      :current-state current-state}))))

 (defn- get-user-properties-from-state [current-state]
   (let [analytics-id (get-in current-state state/user-analytics-id-path)


increment globally!

increment globally!

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -188,10 +188,34 @@
                 (update-in [:entity-ids] disj entity-id))]
             r)))

-(defn inc-str-id [str-id]
-  (if-let [[match base num] (re-find #"(.+)\((\d+)\)" str-id)]
-    (str base "(" (inc (js/parseInt num)) ")")
-    (str str-id " (1)")))
+;; These are used to globally increment names for layer targets and ids
+;; There is definitely a better to do this, but not sure what it is at the moment.
+;; Sorry for the complex code :/
+;; Offset is there so you can duplicate multiple shapes
+(def str-id-regex #"(.+)\((\d+)\)$")
+(defn inc-str-id [db str-id & {:keys [offset]
+                               :or {offset 0}}]
+  (let [[_ base _] (re-find str-id-regex str-id)
+        base (or base (str str-id " "))
+        ids (map first (d/q '[:find ?id :where [_ :layer/ui-id ?id]] db))
+        max-num (reduce (fn [acc str-id]
+                          (if-let [[match num] (re-find (re-pattern (str base "\\((\\d+\\))$")) str-id)]
+                            (max acc (js/parseInt num))
+                            acc))
+                        0 ids)]
+    (str base "(" (+ 1 offset max-num) ")")))
+
+(defn inc-str-target [db str-target & {:keys [offset]
+                                       :or {offset 0}}]
+  (let [[_ base _] (re-find str-id-regex str-target)
+        base (or base (str str-target " "))
+        ids (map first (d/q '[:find ?id :where [_ :layer/ui-target ?id]] db))
+        max-num (reduce (fn [acc str-target]
+                          (if-let [[match num] (re-find (re-pattern (str base "\\((\\d+\\))$")) str-target)]
+                            (max acc (js/parseInt num))
+                            acc))
+                        0 ids)]
+    (str base "(" (+ 1 offset max-num) ")")))

 (defmethod control-event :layer-duplicated
   [browser-state message {:keys [layer x y]} state]
@@ -208,9 +232,9 @@
                                         :layer/current-x (:layer/end-x layer)
                                         :layer/current-y (:layer/end-y layer)
                                         :layer/ui-id (when (:layer/ui-id layer)
-                                                       (inc-str-id (:layer/ui-id layer)))
+                                                       (inc-str-id @(:db state) (:layer/ui-id layer)))
                                         :layer/ui-target (when (:layer/ui-target layer)
-                                                           (inc-str-id (:layer/ui-target layer))))])
+                                                           (inc-str-target @(:db state) (:layer/ui-target layer))))])
         (assoc-in [:drawing :moving?] true)
         (assoc-in [:drawing :starting-mouse-position] [rx ry])
         (update-in [:entity-ids] disj entity-id))))
@@ -228,7 +252,7 @@
     (-> state
         (assoc :selected-eid group-id)
         (assoc-in [:drawing :original-layers] (conj layers group-layer))
-        (assoc-in [:drawing :layers] (conj (mapv (fn [layer entity-id]
+        (assoc-in [:drawing :layers] (conj (mapv (fn [layer entity-id index]
                                                    (assoc layer
                                                      :points (when (:layer/path layer) (parse-points-from-path (:layer/path layer)))
                                                      :db/id entity-id
@@ -237,10 +261,10 @@
                                                      :layer/current-x (:layer/end-x layer)
                                                      :layer/current-y (:layer/end-y layer)
                                                      :layer/ui-id (when (:layer/ui-id layer)
-                                                                    (inc-str-id (:layer/ui-id layer)))
+                                                                    (inc-str-id @(:db state) (:layer/ui-id layer) :offset index))
                                                      :layer/ui-target (when (:layer/ui-target layer)
-                                                                        (inc-str-id (:layer/ui-target layer)))))
-                                                 layers entity-ids)
+                                                                        (inc-str-target @(:db state) (:layer/ui-target layer) :offset index))))
+                                                 layers entity-ids (range))
                                            group-layer))
         (assoc-in [:drawing :moving?] true)
         (assoc-in [:drawing :starting-mouse-position] [rx ry])


Make composite return value more succinct.

--- src/isla/interpreter.clj
+++ src/isla/interpreter.clj
@@ -52,8 +52,8 @@

 (defn nreturn
-  ([context] {:context context :return nil})
-  ([context return] {:context context :return return}))
+  ([context] {:ctx context :ret nil})
+  ([context return] {:ctx context :ret return}))

 (defn lookup [identifier context]
   (get context identifier))


Replace usages of `get-static-fields-of-type` in format.clj with a static value.

--- src/java_time/format.clj
+++ src/java_time/format.clj
@@ -6,8 +6,23 @@
   (:import [java.time.temporal TemporalAccessor]
            [java.time.format DateTimeFormatter DateTimeFormatterBuilder ResolverStyle]))

-(def predefined-formatters
-  (->> (jt.u/get-static-fields-of-type DateTimeFormatter DateTimeFormatter)
+(defonce predefined-formatters
+  (->>
+    {"BASIC_ISO_DATE"       DateTimeFormatter/BASIC_ISO_DATE
+     "ISO_LOCAL_TIME"       DateTimeFormatter/ISO_LOCAL_TIME
+     "RFC_1123_DATE_TIME"   DateTimeFormatter/RFC_1123_DATE_TIME
+     "ISO_OFFSET_DATE"      DateTimeFormatter/ISO_OFFSET_DATE
+     "ISO_OFFSET_DATE_TIME" DateTimeFormatter/ISO_OFFSET_DATE_TIME
+     "ISO_ZONED_DATE_TIME"  DateTimeFormatter/ISO_ZONED_DATE_TIME
+     "ISO_LOCAL_DATE_TIME"  DateTimeFormatter/ISO_LOCAL_DATE_TIME
+     "ISO_TIME"             DateTimeFormatter/ISO_TIME
+     "ISO_WEEK_DATE"        DateTimeFormatter/ISO_WEEK_DATE
+     "ISO_LOCAL_DATE"       DateTimeFormatter/ISO_LOCAL_DATE
+     "ISO_OFFSET_TIME"      DateTimeFormatter/ISO_OFFSET_TIME
+     "ISO_ORDINAL_DATE"     DateTimeFormatter/ISO_ORDINAL_DATE
+     "ISO_DATE"             DateTimeFormatter/ISO_DATE
+     "ISO_DATE_TIME"        DateTimeFormatter/ISO_DATE_TIME
+     "ISO_INSTANT"          DateTimeFormatter/ISO_INSTANT}
        (jt.u/map-kv
          (fn [^String n fmt]
            [(string/lower-case (.replace n \_ \-)) fmt]))))


describe-mismatch returns english words rather than code

--- src/matcha.clj
+++ src/matcha.clj
@@ -56,7 +56,7 @@
   (matcha/run-match (matcha/= 1) 2) ; => fails"
   [a]
   {:match (fn [b] (core/= a b))
-   :description (describe-list "=" [a])
+   :description (pr-str a)
    :describe-mismatch standard-describe-mismatch})

 (defn <=
@@ -66,7 +66,7 @@
   (matcha/run-match (matcha/<= 1) 0) ; => fails"
   [a]
   {:match (fn [b] (core/<= a b))
-   :description (describe-list "<=" [a])
+   :description (str "less than or equal to " (pr-str a))
    :describe-mismatch standard-describe-mismatch})

 (defn <
@@ -76,17 +76,17 @@
   (matcha/run-match (matcha/< 1) 0) ; => fails"
   [a]
   {:match (fn [b] (core/< a b))
-   :description (describe-list "<" [a])
+   :description (str "less than " (pr-str a))
    :describe-mismatch standard-describe-mismatch})

 (defn >
-  "matches based if the value given is greater-than or equal to
+  "matches based if the value given is greater-than

   (matcha/run-match (matcha/> 1) 2) ; => passes
   (matcha/run-match (matcha/> 1) 0) ; => fails"
   [a]
   {:match (fn [b] (core/> a b))
-   :description (describe-list ">" [a])
+   :description (str "more than " (pr-str a))
    :describe-mismatch standard-describe-mismatch})

 (defn >=
@@ -96,7 +96,7 @@
   (matcha/run-match (matcha/<= 1) 0) ; => fails"
   [a]
   {:match (fn [b] (core/>= a b))
-   :description (describe-list ">=" [a])
+   :description (str "less than or equal to " (pr-str a))
    :describe-mismatch standard-describe-mismatch})

 (def empty?
@@ -105,13 +105,14 @@
   (matcha/run-match matcha/empty? [1]) ; => passes
   (matcha/run-match matcha/empty? [])  ; => fails"
   {:match core/empty?
-   :description "(empty?)"
+   :description "an empty collection"
    :describe-mismatch standard-describe-mismatch})

 (defn format-message
   "turns the results of a failing match into a human readable error message,
    suitable for printing with clojure.core/print or clojure.core/println"
   [result]
+  (assert (clojure.core/not (:pass? result true)) (str "format message should only be used with a failing result, but it was given: " (pr-str result)))
   (str "\nExpected: " (:expected result)
        "\n     but: "
        (:was result)))
@@ -126,7 +127,7 @@
    (fn [a] (reduce (fn [x y] (and x y))
                           (map #((:match %) a) ms)))
    :description
-   (describe-list "all-of" (map :description ms))
+   (string/join ", and " (map :description ms))
    :describe-mismatch
    standard-describe-mismatch})

@@ -142,30 +143,8 @@
              (map #((:match %) a) ms)))

    :description
-   (describe-list "any-of" (map :description ms))
-
-   :describe-mismatch
-   standard-describe-mismatch})
-
-(defn some
-  [m]
-  "passes if the matcher given passes on any of the items of the sequence this matcher receives
-  (matcha/run-match (matcha/some (matcha/= 1)) [1]) ; => passes
-  (matcha/run-match (matcha/some (matcha/= 0)) [1]) ; => fails"
-  {:match
-   (fn [xs] (core/some #((:match m) %) xs))
-   :description
-   (describe-list "some" [(:description m)])
-   :describe-mismatch
-   standard-describe-mismatch})
-
-(defn every?
-  [m]
-  "passes if the matcher given passes against any of the items of the sequence the resulting matcher receives"
-  {:match
-   (fn [xs] (core/every? #((:match m) %) xs))
-   :description
-   (describe-list "every?" [(:description m)])
+   (string/join ", or " (map :description ms))
+
    :describe-mismatch
    standard-describe-mismatch})

@@ -175,9 +154,9 @@
   (matcha/run-match (matcha/has-count 2) [])  ; => fails"
   [n]
   {:match (fn [xs] (clojure.core/= (count xs) n))
-   :description (describe-list "has-count" [n])
-   :describe-mismatch
-   standard-describe-mismatch})
+   :description (str "a collection with count " n)
+   :describe-mismatch
+   (fn [x] (str (standard-describe-mismatch x) " with count " (count x)))})

 (defn includes
   "passes if the sequence received includes the given item
@@ -188,7 +167,7 @@
   {:match
    (fn [xs] (core/some #{x} xs))
    :description
-   (describe-list "includes" [x])
+   (str "includes " (pr-str x))
    :describe-mismatch
    standard-describe-mismatch})

@@ -198,12 +177,15 @@
   (matcha/run-match (matcha/not (matcha/= 2)) 1) ; => fails"
   [m]
   {:match #(core/not ((:match m) %))
-   :description (describe-list "not" [m])
+   :description (str "not " (:description m))
    :describe-mismatch
    standard-describe-mismatch})

 (defn describe-class-mismatch [x]
-  (str "was " (pr-str x) " <" (class x) ">"))
+  (str "was " (pr-str x)
+       (if (nil? x)
+         ""
+         (str " <" (class x) ">"))))

 (defn instance?
   "passes if the value matches the given class
@@ -211,8 +193,7 @@
   (matcha/run-match (matcha/instance? clojure.lang.Keyword) 1) ; => fails"
   [klazz]
   {:match #(core/instance? klazz %)
-   :description (describe-list "instance?" [klazz])
-   :describe-mismatch describe-class-mismatch})
+   :description (str "an instance of " (.getName ^java.lang.Class klazz))})

 (def
   ^{:doc
@@ -221,8 +202,7 @@
     (matcha/run-match matcha/string? 1) ; => fails"}
   string?
   {:match core/string?
-   :description "(string?)"
-   :describe-mismatch describe-class-mismatch})
+   :description "a string"})

 (def
   ^{:doc
@@ -231,8 +211,7 @@
     (matcha/run-match matcha/map? 1) ; => fails"}
   map?
   {:match core/map?
-   :description "(map?)"
-   :describe-mismatch describe-class-mismatch})
+   :description "a map"})

 (def
   ^{:doc
@@ -241,8 +220,7 @@
     (matcha/run-match matcha/seq? 1) ; => fails"}
   seq?
   {:match core/seq?
-   :description "(seq?)"
-   :describe-mismatch describe-class-mismatch})
+   :description "a sequence"})

 (def
   ^{:doc
@@ -251,8 +229,7 @@
     (matcha/run-match matcha/char? 1) ; => fails"}
   char?
   {:match core/char?
-   :description "(char?)"
-   :describe-mismatch describe-class-mismatch})
+   :description "a character"})

 (def
   ^{:doc
@@ -261,8 +238,7 @@
     (matcha/run-match matcha/vector? 1) ; => fails"}
   vector?
   {:match core/vector?
-   :description "(vector?)"
-   :describe-mismatch describe-class-mismatch})
+   :description "a vector"})

 (def
   ^{:doc
@@ -271,8 +247,7 @@
     (matcha/run-match matcha/keyword? 1) ; => fails"}
   keyword?
   {:match core/keyword?
-   :description "(keyword?)"
-   :describe-mismatch describe-class-mismatch})
+   :description "a keyword"})

 (def
   ^{:doc
@@ -281,8 +256,7 @@
     (matcha/run-match matcha/symbol? 1) ; => fails"}
   symbol?
   {:match core/symbol?
-   :description "(symbol?)"
-   :describe-mismatch describe-class-mismatch})
+   :description "a symbol"})

 (def
   ^{:doc
@@ -291,8 +265,7 @@
     (matcha/run-match matcha/nil? 1) ; => fails"}
   nil?
   {:match core/nil?
-   :description "(nil?)"
-   :describe-mismatch describe-class-mismatch})
+   :description "nil"})

 (defn assert-good-matcher [{:keys [match description describe-mismatch] :as matcher}]
   (assert (not (nil? matcher)) "Matcher should not be nil")
@@ -300,8 +273,6 @@
           (str "matcher should have a :match key. Matcher: " matcher))
   (assert description
           (str "matcher should have a :description key. Matcher: " matcher))
-  (assert describe-mismatch
-          (str "matcher should have a :describe-mismatch key. Matcher: " matcher))

   (assert (core/= 0 (count (dissoc matcher :match :description :describe-mismatch)))
           (str "matcher shouldn't have extra keys, but had "
@@ -316,8 +287,9 @@

   if the matcher fails:
   {:pass? false
-  :expected (a string)
-  :was (a string)}
+   :matcher matcher
+   :expected (a string)
+   :was (a string)}

   the results can be made human readable with (format-message result)"
   [matcher a]
@@ -326,4 +298,5 @@
     {:pass? true}
     {:pass? false
      :expected (:description matcher)
-     :was ((:describe-mismatch matcher) a)}))
+     :was ((:describe-mismatch matcher describe-class-mismatch) a)
+     :matcher matcher}))


Only pass the produced_date to ABACUS if non-nil

--- src/mdr2/abacus.clj
+++ src/mdr2/abacus.clj
@@ -145,7 +145,8 @@
         (create-row 280 audio_format)
         (create-row 271 volumes) ; Number of CDs
         (create-row 281 multimedia_type)
-        (create-row 256 (format date-format produced_date)) ; Date of production end
+        (create-row 256 (and produced_date
+                             (format date-format produced_date))) ; Date of production end
         (create-row 278 (format date-format date)) ; Date of production start
         (create-row 4 (prod/dam-number production))] ; for legacy purposes
        (remove nil?) ; remove empty rows


All the column names returned by jdbc are lower case

--- src/mdr2/dtbook.clj
+++ src/mdr2/dtbook.clj
@@ -4,10 +4,11 @@

 (defn- dtbook-sexp
   [{:keys [title creator subject description publisher date identifier source language rights
-           sourceDate sourceEdition sourcePublisher sourceRights sourceTitle
-           multimediaType multimediaContent narrator producedDate
-           revision revisionDate revisionDescription
-           totalTime audioFormat]}]
+           sourcedate sourceedition sourcepublisher sourcerights sourcetitle
+           multimediatype multimediacontent narrator produceddate
+           revision revisiondate revisiondescription
+           totaltime audioformat
+           librarynumber]}] ; only books imported from the libray have this
   [:dtbook {:xmlns "http://www.daisy.org/z3986/2005/dtbook/"
             :version "2005-3" :xml:lang language}
    [:head
@@ -24,21 +25,17 @@
     [:meta {:name "dc:Language" :content language}]
     [:meta {:name "dc:Rights" :content rights}]
     [:meta {:name "dtb:uid" :content identifier}]
-    [:meta {:name "dtb:sourceDate" :content sourceDate}]
-    [:meta {:name "dtb:sourceEdition" :content sourceEdition}]
-    [:meta {:name "dtb:sourcePublisher" :content sourcePublisher}]
-    [:meta {:name "dtb:sourceRights" :content sourceRights}]
-    [:meta {:name "dtb:sourceTitle" :content sourceTitle}]
-    [:meta {:name "dtb:multimediaType" :content multimediaType}]
-    [:meta {:name "dtb:multimediaContent" :content multimediaContent}]
+    [:meta {:name "dtb:sourceDate" :content sourcedate}]
+    [:meta {:name "dtb:sourceEdition" :content sourceedition}]
+    [:meta {:name "dtb:sourcePublisher" :content sourcepublisher}]
+    [:meta {:name "dtb:sourceRights" :content sourcerights}]
+    [:meta {:name "dtb:sourceTitle" :content sourcetitle}]
+    [:meta {:name "dtb:multimediaType" :content multimediatype}]
+    [:meta {:name "dtb:multimediaContent" :content multimediacontent}]
     [:meta {:name "dtb:narrator" :content narrator}]
     [:meta {:name "dtb:producer" :content publisher}]
-    [:meta {:name "dtb:producedDate" :content producedDate}]
+    [:meta {:name "dtb:producedDate" :content produceddate}]
     [:meta {:name "dtb:revision" :content revision}]
-    [:meta {:name "dtb:revisionDate" :content revisionDate}]
-    [:meta {:name "dtb:revisionDescription" :content revisionDescription}]
-    [:meta {:name "dtb:totalTime" :content totalTime}]
-    [:meta {:name "dtb:audioFormat" :content audioFormat}]]
    [:book
     [:frontmatter
      [:doctitle title]


add micro opt for namespaced keywords

add micro opt for namespaced keywords

reducing code size a bit when using lots of namespaced keywords

--- src/main/shadow/build/closure.clj
+++ src/main/shadow/build/closure.clj
@@ -836,6 +836,17 @@
           (.resetWarningsGuard)
           (.setNumParallelThreads (get-in state [:compiler-options :closure-threads] 1))

+          ;; namespaced keywords will cause a lot of repetition for namespace strings
+          ;; allowing closure to alias them can cut the overall size a bit
+          ;; gzip actually takes quite good care of this already but this squeezes
+          ;; another few bytes out for no additional work
+          (.setAliasableStrings
+            (->> (:compiler-env state)
+                 (::ana/namespaces)
+                 (keys)
+                 (map str)
+                 (set)))
+
           (.setWarningLevel DiagnosticGroups/CHECK_TYPES CheckLevel/OFF)
           ;; really only want the undefined variables warnings
           ;; must turn off CHECK_VARIABLES first or it will complain too much (REDECLARED_VARIABLES)


:lipstick: Make the text edition textarea transparent.

--- frontend/src/uxbox/main/ui/shapes/text.cljs
+++ frontend/src/uxbox/main/ui/shapes/text.cljs
@@ -100,7 +100,8 @@
        :margin "0px"
        :padding "0px"
        :border "0px"
-       :resize "none"}
+       :resize "none"
+       :background "transparent"}
       (when user-select {:userSelect "auto"})
       (when line-height {:lineHeight line-height})
       (when letter-spacing {:letterSpacing letter-spacing})))))


[up] get-events withot params.

[up] get-events withot params.

--- src/ombs/db/old.clj
+++ src/ombs/db/old.clj
@@ -110,21 +110,23 @@
               (sql/where {:id eid}))))

 (declare subtract-feesed-parts)
-(defn get-events [status]
-  "Return list of events, and it actual count of event"
-  ; Then we update each event elent: substract from each event count of parts,
-  ; that hang in fees.
-  ; Some events haven't parts, and after join it's have nil parts. So we need
-  ; fix before substract.
-  (map
-    #(update % :rest
-             (comp (partial subtract-feesed-parts (:id %)) f/nil-fix))
-    ; First of all, we select events from it table and join for each
-    ; rest(actual) parts.
-    (sql/select events
-                (sql/fields :id :name :date :price :author :status :parts)
-                (sql/where {:status [in (status-vector status)]})
-                (sql/with goods (sql/fields :rest)))))
+(defn get-events
+  ([] (get-events [:initial :in-progress :finished]))
+  ([status]
+   "Return list of events, and it actual count of event"
+   ; Then we update each event elent: substract from each event count of parts,
+   ; that hang in fees.
+   ; Some events haven't parts, and after join it's have nil parts. So we need
+   ; fix before substract.
+   (map
+     #(update % :rest
+              (comp (partial subtract-feesed-parts (:id %)) f/nil-fix))
+     ; First of all, we select events from it table and join for each
+     ; rest(actual) parts.
+     (sql/select events
+                 (sql/fields :id :name :date :price :author :status :parts)
+                 (sql/where {:status [in (status-vector status)]})
+                 (sql/with goods (sql/fields :rest))))))

 (defn subtract-feesed-parts [eid parts]
   "Substract from given parts, founded parts in active(all) fees."


Delete the render method at the moment.

Delete the render method at the moment.

--- src/my_noir_lab/views/welcome.clj
+++ src/my_noir_lab/views/welcome.clj
@@ -27,5 +27,4 @@
    "Range"
    [:h2 (str "Display range from " start " to " end)]
    [:p#wrapper (map #(str % "<br />")
-                    (range (read-string start) (read-string end)))]
-   (render "/range" user)))
+                    (range (read-string start) (read-string end)))]))


fix tutorial tests

fix tutorial tests

--- test/cellophane/om_tutorials_test.clj
+++ test/cellophane/om_tutorials_test.clj
@@ -53,19 +53,19 @@

 (deftest test-render-animals-tutorial
   (let [result-markup (remove-whitespace
-                        "

-
Animals

-

-
1. Ant

-
2. Antelope

-
3. Bird

-
4. Cat

-
5. Dog

-
6. Lion

-
7. Mouse

-
8. Monkey

-
9. Snake

-
10. Zebra

+                        "

+
Animals

+

+
1. Ant

+
2. Antelope

+
3. Bird

+
4. Cat

+
5. Dog

+
6. Lion

+
7. Mouse

+
8. Monkey

+
9. Snake

+
10. Zebra

")]
     (testing "render with factory"
@@ -129,20 +129,20 @@
   (let [c (cellophane/add-root! links-reconciler LinksSomeList nil)]
     (is (= (#'dom/render-to-str* c)
            (remove-whitespace
-             "

-
A List!

-

-

-
Foo

-
bob.smith@gmail.com

+             "

+
A List!

+

+

+
Foo

+
bob.smith@gmail.com

-

-
Bar

-
bob.smith@gmail.com

+

+
Bar

+
bob.smith@gmail.com

-

-
Baz

-
bob.smith@gmail.com

+

+
Baz

+
bob.smith@gmail.com

")))))
@@ -257,41 +257,41 @@
 (deftest test-cian-tutorial
   (let [c (cellophane/add-root! cian-reconciler RootView nil)]
     (is (= (#'dom/render-to-str* c)
-           (remove-whitespace "

-
List A

-

-

-                                     John, points: 0
-                                     <button data-reactid=\".0.$cellophane$om_tutorials_test$ListView_[=2list/one].$John.1\">+</button>
-                                     <button data-reactid=\".0.$cellophane$om_tutorials_test$ListView_[=2list/one].$John.2\">-</button>
+           (remove-whitespace "

+
List A

+

+

+                                     John, points: 0
+                                     <button data-reactid=\"6\">+</button>
+                                     <button data-reactid=\"7\">-</button>

-

-                                     Mary, points: 0
-                                     <button data-reactid=\".0.$cellophane$om_tutorials_test$ListView_[=2list/one].$Mary.1\">+</button>
-                                     <button data-reactid=\".0.$cellophane$om_tutorials_test$ListView_[=2list/one].$Mary.2\">-</button>
+

+                                     Mary, points: 0
+                                     <button data-reactid=\"10\">+</button>
+                                     <button data-reactid=\"11\">-</button>

-

-                                     Bob, points: 0
-                                     <button data-reactid=\".0.$cellophane$om_tutorials_test$ListView_[=2list/one].$Bob.1\">+</button>
-                                     <button data-reactid=\".0.$cellophane$om_tutorials_test$ListView_[=2list/one].$Bob.2\">-</button>
+

+                                     Bob, points: 0
+                                     <button data-reactid=\"14\">+</button>
+                                     <button data-reactid=\"15\">-</button>

-
List B

-

-

-                                     Mary, points: 0
-                                     <button data-reactid=\".0.$cellophane$om_tutorials_test$ListView_[=2list/two].$Mary.1\">+</button>
-                                     <button data-reactid=\".0.$cellophane$om_tutorials_test$ListView_[=2list/two].$Mary.2\">-</button>
+
List B

+

+

+                                     Mary, points: 0
+                                     <button data-reactid=\"20\">+</button>
+                                     <button data-reactid=\"21\">-</button>

-

-                                     Gwen, points: 0
-                                     <button data-reactid=\".0.$cellophane$om_tutorials_test$ListView_[=2list/two].$Gwen.1\">+</button>
-                                     <button data-reactid=\".0.$cellophane$om_tutorials_test$ListView_[=2list/two].$Gwen.2\">-</button>
+

+                                     Gwen, points: 0
+                                     <button data-reactid=\"24\">+</button>
+                                     <button data-reactid=\"25\">-</button>

-

-                                     Jeff, points: 0
-                                     <button data-reactid=\".0.$cellophane$om_tutorials_test$ListView_[=2list/two].$Jeff.1\">+</button>
-                                     <button data-reactid=\".0.$cellophane$om_tutorials_test$ListView_[=2list/two].$Jeff.2\">-</button>
+

+                                     Jeff, points: 0
+                                     <button data-reactid=\"28\">+</button>
+                                     <button data-reactid=\"29\">-</button>

")))))
@@ -436,69 +436,69 @@
     (let [c (cellophane/add-root! union-reconciler Dashboard nil)]
       (is (= (#'dom/render-to-str* c)
             (remove-whitespace
-              "

-

-

-

-
A Post!

-
Laura Smith

-
Lorem ipsum dolor sit amet, quem atomorum te quo

+              "

+

+

+

+
A Post!

+
Laura Smith

+
Lorem ipsum dolor sit amet, quem atomorum te quo

-

-
Favorites: 0

-                    <button data-reactid=\".0.$cellophane$om_tutorials_test$DashboardItem_[=2dashboard/items 0].1.1\">Favorite!</button>
+

+
Favorites: 0

+                    <button data-reactid=\"10\">Favorite!</button>

-

-

-

-
Photo: A Photo!

-
photo.jpg

-
Caption:

+

+

+

+
Photo: A Photo!

+
photo.jpg

+
Caption:

-

-
Favorites: 0

-                    <button data-reactid=\".0.$cellophane$om_tutorials_test$DashboardItem_[=2dashboard/items 1].1.1\">Favorite!</button>
+

+
Favorites: 0

+                    <button data-reactid=\"19\">Favorite!</button>

-

-

-

-
Another Post!

-
Jim Jacobs

-
Lorem ipsum dolor sit amet, quem atomorum te quo

+

+

+

+
Another Post!

+
Jim Jacobs

+
Lorem ipsum dolor sit amet, quem atomorum te quo

-

-
Favorites: 0

-                    <button data-reactid=\".0.$cellophane$om_tutorials_test$DashboardItem_[=2dashboard/items 2].1.1\">Favorite!</button>
+

+
Favorites: 0

+                    <button data-reactid=\"28\">Favorite!</button>

-

-

-

-
Graphic: Charts and Stufff!

-
chart.jpg

+

+

+

+
Graphic: Charts and Stufff!

+
chart.jpg

-

-
Favorites: 0

-                    <button data-reactid=\".0.$cellophane$om_tutorials_test$DashboardItem_[=2dashboard/items 3].1.1\">Favorite!</button>
+

+
Favorites: 0

+                    <button data-reactid=\"36\">Favorite!</button>

-

-

-

-
Yet Another Post!

-
May Fields

-
Lorem ipsum dolor sit amet, quem atomorum te quo

+

+

+

+
Yet Another Post!

+
May Fields

+
Lorem ipsum dolor sit amet, quem atomorum te quo

-

-
Favorites: 0

-                    <button data-reactid=\".0.$cellophane$om_tutorials_test$DashboardItem_[=2dashboard/items 4].1.1\">Favorite!</button>
+

+
Favorites: 0

+                    <button data-reactid=\"45\">Favorite!</button>

")))))


Add routes for custom topics to section API.

--- src/open_company/api/sections.clj
+++ src/open_company/api/sections.clj
@@ -66,11 +66,6 @@
     :get true
     :put true
     :patch true})
-    ; (fn [ctx] (common/check-input
-    ;   (section-res/valid-section company-slug section-name
-    ;     (-> (:data ctx)
-    ;       (assoc :company-slug company-slug)
-    ;       (assoc :section-name section-name)))))

   ;; Handlers
   :handle-ok
@@ -91,10 +86,14 @@

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

+(defn- section-route [sys company-slug section-slug uuid as-of]
+  (let [db-pool (-> sys :db-pool :pool)
+        section-name (if (= section-slug "custom-:uuid") (str "custom-" uuid) section-slug)]
+    (pool/with-pool [conn db-pool] (section conn company-slug section-name as-of))))
+
 (defn section-routes [sys]
-  (let [db-pool (-> sys :db-pool :pool)]
     (apply routes
       (map #(ANY (str "/companies/:company-slug/" %)
-                  [company-slug as-of]
-                  (pool/with-pool [conn db-pool] (section conn company-slug % as-of)))
-          (map name common-res/section-names)))))+                  [company-slug uuid as-of]
+                  (section-route sys company-slug % uuid as-of))
+          (conj (map name common-res/section-names) "custom-:uuid"))))


Patch sequence type error

Patch sequence type error

Each iteration of the form analysis for comprehension produces a
sequence of top level forms. The insertion of this (reduce concat)
squashes them down into a single sequence of top level forms which is
the expected structure of a module's :forms key.

--- src/oxcart/passes/lambda_lift.clj
+++ src/oxcart/passes/lambda_lift.clj
@@ -186,6 +186,7 @@
                                                update-bindings
                                                lift-and-pop-bindings)]
            (conj @defs new-ast)))
+       (reduce concat)
        (assoc module :forms)))


Add primitive type resolver

Add primitive type resolver

--- src/clojure/clojurewerkz/cassaforte/query/types.clj
+++ src/clojure/clojurewerkz/cassaforte/query/types.clj
@@ -23,6 +23,15 @@
    :varint    (DataType/varint)
    :timeuuid  (DataType/timeuuid)})

+(defn resolve-primitive-type
+  [type-name]
+  (if-let [res (get primitive-types type-name)]
+    res
+    (throw (IllegalArgumentException. (str "Column name "
+                                           " was not found, pick one of ("
+                                           (clojure.string/join "," (keys primitive-types))
+                                           ")")))))
+
 (defn list-type
   [primitive-type]
   (DataType/list (get primitive-types primitive-type)))


Replaced \t with \tab, as proper.

Replaced \t with \tab, as proper.


Verify discovery years

Verify discovery years

--- src/clj_simple_chart/ncs/discovery_year.clj
+++ src/clj_simple_chart/ncs/discovery_year.clj
@@ -74,7 +74,8 @@
       (get manual-lookup fldName)))

 (doseq [fld production/field-names]
-  (assert (number? (discovery-year fld)) (str "Expected discovery year for " fld)))
+  (assert (and (number? (discovery-year fld))
+               (< 1960 (discovery-year fld))) (str "Expected discovery year for " fld)))

 ; TODO: Consider adding more tests.
 (test/is (= 1969 (discovery-year "EKOFISK")))


Add definition for 'ssl' field to mongo driver

--- src/metabase/driver/mongo.clj
+++ src/metabase/driver/mongo.clj
@@ -125,7 +125,7 @@
   {:driver-name                       "MongoDB"
    :details-fields                    [{:name         "host"
                                         :display-name "Host"
-                                        :default "localhost"}
+                                        :default      "localhost"}
                                        {:name         "port"
                                         :display-name "Port"
                                         :type         :integer
@@ -140,7 +140,11 @@
                                        {:name         "pass"
                                         :display-name "Database password"
                                         :type         :password
-                                        :placeholder  "******"}]
+                                        :placeholder  "******"}
+                                       {:name         "ssl"
+                                        :display-name "Use a secure connection (SSL)?"
+                                        :type         :boolean
+                                        :default      false}]
    :features                          #{:nested-fields}
    :can-connect?                      can-connect?
    :active-table-names                active-table-names


update wait time on tests

update wait time on tests

--- kafka-clj/test/kafka_clj/pool_impl_tests.clj
+++ kafka-clj/test/kafka_clj/pool_impl_tests.clj
@@ -208,8 +208,11 @@

                   ;;wait one second for objs to expire
                   (prn "idle waiting on latch")
-                  (.await count-latch 1000 TimeUnit/MILLISECONDS)
+                  (.await count-latch 10 TimeUnit/SECONDS)
                   (prn "idle got latch")
+                  (prn "count v: " (count v) " = " (count (keys @created-atoms)))
+                  (prn "vals " (clojure.string/join "," (vals @created-atoms)))
+
                   (try
                     (and
                       (= (count v) (count (keys @created-atoms)))


Fix mouseWheel method. Processing 2.0 supports it natively.

--- src/quil/applet.clj
+++ src/quil/applet.clj
@@ -25,6 +25,10 @@
 (defonce untitled-applet-id* (atom 0))
 (def ^:dynamic *applet* nil)
 (def ^:dynamic *graphics* nil)
+
+(defn- no-fn
+  "Function that does nothing."
+  [])

 (defn ^PApplet current-applet []
   *applet*)
@@ -256,15 +260,10 @@

 (generate-listeners)

-(defn wrap-mouse-wheel
-  "Wraps callback to an instance of java.awt.event.MouseEventListener
-  or returns nil if given callback is nil."
-  [mouse-wheel applet]
-  (when mouse-wheel
-    (reify java.awt.event.MouseWheelListener
-      (mouseWheelMoved [this e]
-        (with-applet applet
-          (mouse-wheel (.getWheelRotation e)))))))
+(defn -mouseWheel [this evt]
+  (with-applet this
+    (when-let [mouse-wheel (:mouse-wheel (.state this))]
+      (mouse-wheel (.getCount evt)))))

 (defn applet
   "Create and start a new visualisation applet.
@@ -344,15 +343,10 @@
         target            (validate-target! (:target options))
         title             (or (:title options) (str "Quil " (swap! untitled-applet-id* inc)))
         renderer          (or (:renderer options) :java2d)
-        draw-fn           (or (:draw options) (fn [] nil))
+        draw-fn           (or (:draw options) no-fn)
         output-file       (validate-output-file! renderer (:output-file options))
         target            (if (empty? output-file) target :none)
-        setup-fn          (fn []
-                            (when-let [wheel-listener (wrap-mouse-wheel (:mouse-wheel options)
-                                                                        (current-applet))]
-                              (.addMouseWheelListener (current-applet) wheel-listener))
-                            (when-let [f (:setup options)]
-                              (f)))
+        setup-fn          (or (:setup options) no-fn)
         safe-draw-fn      (fn []
                             (try
                               (draw-fn)
@@ -360,12 +354,12 @@
                                 (println "Exception in Quil draw-fn for sketch" title ": " e "\nstacktrace: " (with-out-str (print-cause-trace e)))
                                 (Thread/sleep 1000))))
         draw-fn           (if (:safe-draw-fn options) safe-draw-fn draw-fn)
-        on-close-fn       (or (:on-close options) (fn [] nil))
+        on-close-fn       (or (:on-close options) no-fn)
         state             (atom nil)
         target-obj        (atom nil)
         looping?          (atom true)
         listeners         (into {} (for [name listeners]
-                                     [name (or (options name) (fn [] nil))]))
+                                     [name (or (options name) no-fn)]))
         applet-state      (merge options
                                  {:state state
                                   :target-obj target-obj


Helper vars el-input-log/el-output-log and el-log.


Add utils namespace

Add utils namespace


Add convenience fn to make an Isla type.

--- src/isla/interpreter.clj
+++ src/isla/interpreter.clj
@@ -3,7 +3,7 @@
   (:use [isla.library])
   (:require [clojure.string :as str]))

-(declare run-sequence first-content lookup nreturn)
+(declare run-sequence first-content lookup nreturn instantiate-type)

 (defmulti interpret (fn [& args] (:tag (first args))))

@@ -85,6 +85,11 @@
 (defn first-content [node]
   (first (:content node)))

+(defn instantiate-type [type-hash]
+  (clojure.lang.Reflector/invokeConstructor
+   (:type type-hash)
+   (to-array (:defaults type-hash))))
+
 (defn run-sequence [nodes env]
   (if (empty? nodes)
     env ;; return env


display upload timestamp nicely

display upload timestamp nicely

--- src/braid/ui/views/pages/uploads.cljs
+++ src/braid/ui/views/pages/uploads.cljs
@@ -5,6 +5,7 @@
             [chat.client.reagent-adapter :refer [subscribe]]
             [chat.client.dispatcher :refer [dispatch!]]
             [chat.client.routes :as routes]
+            [chat.client.views.helpers :as helpers]
             [braid.ui.views.embed :refer [embed-view]]
             [braid.ui.views.pills :as pills]
             [braid.ui.views.thread :as thread]))
@@ -33,7 +34,7 @@
           [:td.uploaded-thread
            [:a {:href (routes/thread-path {:group-id @group-id
                                            :thread-id (upload :thread-id)})}
-            (str "Uploaded at " (upload :uploaded-at))]
+            (str "Uploaded at " (helpers/format-date (upload :uploaded-at)))]
            [:br]
            (if @thread
              [:span "Tagged with " [thread/thread-tags-view @thread]]


Fix string replacement

Fix string replacement

--- src/clj/cglossa/search/cwb/speech.clj
+++ src/clj/cglossa/search/cwb/speech.clj
@@ -33,9 +33,9 @@
   ;; start of the segment text instead. Similarly if the match is at the end of a segment.
   (-> result
       (str/replace #"\{\{((?:<\S+?\s+?\S+?>\s*)+)"          ; Find start tags with attributes
-                   "\1{{")                                  ; (i.e., not the match)
+                   "$1{{")                                  ; (i.e., not the match)
       (str/replace #"((?:</\S+?>\s*)+)\}\}"                 ; Find end tags
-                   "}}\1")))
+                   "}}$1")))

 (defn- find-timestamps [result]
   (for [[segment start end] (re-seq #"<sync_time\s+([\d\.]+)><sync_end\s+([\d\.]+)>.*?</sync_time>"


redirect to main page after login | sg/fs | #35

--- src/clj/conference_rating/handler.clj
+++ src/clj/conference_rating/handler.clj
@@ -2,7 +2,7 @@
   (:require [compojure.core :refer [GET POST defroutes routes]]
             [compojure.route :refer [not-found resources]]
             [ring.middleware.defaults :refer [site-defaults wrap-defaults api-defaults]]
-            [ring.util.response :refer [created response]]
+            [ring.util.response :refer [created response redirect]]
             [hiccup.core :refer [html]]
             [ring.middleware.json :as json]
             [hiccup.page :refer [include-js include-css]]
@@ -100,8 +100,7 @@
                                                   clojure.java.io/resource
                                                   slurp)))
    okta/okta-routes
-   (GET "/login" request {:headers {"Content-Type" "text/plain"}
-                          :body (str "Hello Okta: " request)})
+   (GET "/login" [] (redirect "/"))
    (GET "/" [] home-page)
    (not-found "Not Found")))


RR: use base template

RR: use base template

--- src/clj/ona/viewer/views/accounts.clj
+++ src/clj/ona/viewer/views/accounts.clj
@@ -1,12 +1,12 @@
 (ns ona.viewer.views.accounts
-  (:require [hiccup.page :refer [html5]]))
+  (:require [hiccup.page :refer [html5]]
+            [ona.viewer.helpers.tags :as tags]
+            [ona.viewer.views.template :as template]))

 (defn login-page
   "Renders the login page"
   []
-  (html5
-    [:head
-     [:title "Login"]]
-    [:body
-     [:h1 "Sorry you'll have to login first!"]]))
+  (template/base "Login"
+                 "This is the login page"
+                 (tags/js-tag "ona.login.init()")))


formatting/refactoring of admin page. works for adding and deleting
mounts.

need to figure out a way to kick off a scan on the back-end either
automatically or manually.

--- src/cljs/cljspazzer/client/pages.cljs
+++ src/cljs/cljspazzer/client/pages.cljs
@@ -143,22 +143,17 @@
           [:div.artist-bg {:style {:background-image artist-image-url}}]])]])))

 (defn delete-mount [mount]
-  (fn [e]
-    (go
-      (<! (services/delete-mount mount))
-      (secretary/dispatch! "#/admin"))))
+  (go
+    (<! (services/delete-mount mount))
+    (secretary/dispatch! "#/admin")))

 (defn mount-item [m]
   (let [path (m "mount")]
     [:li path [:a {
-                   :on-click (fn [e] (delete-mount path) false)}
+                   :on-click (fn [e]
+                               (delete-mount path)
+                               false)}
                "delete"]]))
-
-(defn add-mount [owner]
-  (let [v (.-value (om/get-node owner "new-mount"))]
-    (go
-      (<! (services/add-mount v))
-      (secretary/dispatch! "#/admin"))))

 (defn view-admin [data owner]
   (reify
@@ -167,21 +162,23 @@
       {:mount-input-value nil})
     om/IRender
     (render [this]
-      (let [mounts ((:mounts data) "mounts")]
+      (let [mounts ((:mounts data) "mounts")
+            on-add-mount (fn [e]
+                           (go (let [v (.-value (om/get-node owner "new-mount"))
+                                     result (<! (services/add-mount v))]
+                                 (secretary/dispatch! "#/admin")))
+                           false)]
         (html [:div.admin
                (main-nav-partial)
-               [:div.pure-g
-                [:div.content.pure-u-1
+               [:div.content.pure-g
+                [:div.pure-u-1
+                 [:h1 "scan this..."]]
+                [:div.pure-u-1
                  [:ul (map mount-item mounts)]]
                 [:div.new-mount.pure-u-1
-                 [:input {:type "text"
-                          :ref "new-mount"}]
-                 [:a.button
-                  {:href "#"
-                   :on-click (fn [e]
-                               (add-mount owner)
-                               false)}
-                  "create"]]]])))))
+                 [:input {:type "text" :ref "new-mount"}]
+                 [:a.button {:href "#" :on-click on-add-mount} "create"]]]])))))
+

 (defn view-browse [data]
   (om/component (browse-page data)))


Fix type extensions

Fix type extensions

--- src/cljs/gtfve/utils/google_maps.cljs
+++ src/cljs/gtfve/utils/google_maps.cljs
@@ -14,11 +14,13 @@
                            :zoom 15})
 (extend-type Maps.LatLng
   IIndexed
-  (-nth [this n] (nth (seq this) n))
-  (-nth [this n not-found] (nth (seq this) n not-found))
+  (-nth
+    ([this n] (nth (seq this) n))
+    ([this n not-found] (nth (seq this) n not-found)))
   ILookup
-  (-lookup [this key] (get (js->clj this) key))
-  (-lookup [this key not-found] (or (get (js->clj this) key) not-found))
+  (-lookup
+    ([this key] (get (js->clj this) key))
+    ([this key not-found] (or (get (js->clj this) key) not-found)))
   ISeqable
   (-seq [this] (list (.lat this) (.lng this)))
   IEncodeClojure
@@ -26,11 +28,13 @@

 (extend-type Data.Point
   IIndexed
-  (-nth [this n] (nth (seq (.get this)) n))
-  (-nth [this n not-found] (nth (seq (.get this)) n not-found))
+  (-nth
+    ([this n] (nth (seq (.get this)) n))
+    ([this n not-found] (nth (seq (.get this)) n not-found)))
   ILookup
-  (-lookup [this key] (get (js->clj this) key))
-  (-lookup [this key not-found] (or (get (js->clj this) key) not-found))
+  (-lookup
+    ([this key] (get (js->clj this) key))
+    ([this key not-found] (or (get (js->clj this) key) not-found)))
   ISeqable
   (-seq [this] (seq (.get this)))
   IEncodeClojure
@@ -38,14 +42,16 @@

 (extend-type Maps.LatLngBounds
   IIndexed
-  (-nth [this n] (nth (seq this) n))
-  (-nth [this n not-found] (nth (seq this) n not-found))
+  (-nth
+    ([this n] (nth (seq this) n))
+    ([this n not-found] (nth (seq this) n not-found)))
   ILookup
-  (-lookup [this key] (get {:sw (.getSouthWest this)
-                            :ne (.getNorthEast this)} key))
-  (-lookup [this key not-found] (or (get {:sw (.getSouthWest this)
-                                          :ne (.getNorthEast this)} key)
-                                    not-found))
+  (-lookup
+    ([this key] (get {:sw (.getSouthWest this)
+                      :ne (.getNorthEast this)} key))
+    ([this key not-found] (or (get {:sw (.getSouthWest this)
+                                    :ne (.getNorthEast this)} key)
+                              not-found)))
   ISeqable
   (-seq [this] (list (.getSouthWest this) (.getNorthEast this)))
   IEncodeClojure


Don't register HUP signal handler on Windows

Don't register HUP signal handler on Windows.

Fixes:

```
$ bin/riemann etc/riemann.config
INFO [2013-06-20 09:08:13,593] main - riemann.bin - PID 277056

ERROR [2013-06-20 09:08:13,594] main - riemann.bin - Couldn't start
java.lang.IllegalArgumentException: Unknown signal: HUP
        at sun.misc.Signal.<init>(Unknown Source)
        at riemann.bin$handle_signals.invoke(bin.clj:36)
        at riemann.bin$_main.doInvoke(bin.clj:58)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at riemann.bin.main(Unknown Source)
```

--- src/riemann/bin.clj
+++ src/riemann/bin.clj
@@ -33,12 +33,13 @@
 (defn handle-signals
   "Sets up POSIX signal handlers."
   []
-  (sun.misc.Signal/handle
-    (sun.misc.Signal. "HUP")
-    (proxy [sun.misc.SignalHandler] []
-      (handle [sig]
-              (info "Caught SIGHUP, reloading")
-              (reload!)))))
+  (if (not (. contains (. System getProperty "os.name") "Windows"))
+    (sun.misc.Signal/handle
+      (sun.misc.Signal. "HUP")
+      (proxy [sun.misc.SignalHandler] []
+        (handle [sig]
+                (info "Caught SIGHUP, reloading")
+                (reload!))))))
 (defn pid
   "Process identifier, such as it is on the JVM. :-/"
   []


Indentation.

Indentation.

--- src/monocle/rabbitmq.clj
+++ src/monocle/rabbitmq.clj
@@ -59,7 +59,8 @@
    (for [b (partition-all batch (line-seq reader))]
      (let [payload (str (apply str (interpose "\n" b)) "\n")]
        (.basicPublish chan exch key
-                      (.build (AMQP$BasicProperties$Builder.)) (.getBytes payload))))))
+                      (.build (AMQP$BasicProperties$Builder.))
+                      (.getBytes payload))))))

 (defn write-rabbitmq [[uri exch key] reader batch opts]
   (with-rabbit [chan (assoc {:uri uri


Filename incorrect.

Filename incorrect.

--- src/onyx_benchmark/submit.clj
+++ src/onyx_benchmark/submit.clj
@@ -8,7 +8,7 @@
             [onyx.api]))

 (defn -main [id batch-size & args]
-  (def zk-addr (slurp "/home/ubuntu/zoookeeper.txt"))
+  (def zk-addr (slurp "/home/ubuntu/zookeeper.txt"))
   (def riemann-host (slurp "/home/ubuntu/metrics.txt"))

   (let [batch-size (Integer/parseInt batch-size)]


fix plural attributes; make schema-map

fix plural attributes; make schema-map

--- src/navigator/schema.clj
+++ src/navigator/schema.clj
@@ -33,15 +33,16 @@
                         [:type :string] ; not null
                         ;; TODO: (:name :version :type) unique
                         [:duration-rating-days :bigint]
-                        [:comp :ref :many]
+                        [:comps :ref :many]
                         [:credit-value-numerator :bigint]
                         [:credit-value-denominator :bigint]]}]
    [:task {:attrs [[:id-sk :string :db.unique/identity]
                    [:name :string]
                    [:version :string]
+                   [:description :string]

                    ;; TODO: is this correct?
-                   [:comp :ref]]}]
+                   [:comps :ref :many]]}]
    [:user2comp {:attrs [[:sis-user-id :bigint :indexed]
                         [:comp :ref :indexed]
                         [:start-date :instant]
@@ -68,3 +69,5 @@
    [:config {:attrs [[:key :string :indexed] ; not null
                      [:value :string :indexed]]}]
    ])
+
+(def schema-map (into {} schema))


Return hydrated Card info with PUT /api/card/:id :yum:

--- src/metabase/api/card.clj
+++ src/metabase/api/card.clj
@@ -242,8 +242,11 @@
                   ;; card was unarchived
                   (and (false? archived)
                        (:archived card))       :card-unarchive
-                  :else                        :card-update)]
-      (events/publish-event! event (assoc (Card id) :actor_id *current-user-id*)))))
+                  :else                        :card-update)
+          card   (assoc (Card id) :actor_id *current-user-id*)]
+      (events/publish-event! event card)
+      ;; include same information returned by GET /api/card/:id since frontend replaces the Card it currently has with returned one -- See #4142
+      (hydrate card :creator :dashboard_count :labels :can_write :collection))))

 (defendpoint DELETE "/:id"


instructions

instructions

--- src/node/server/core.cljs
+++ src/node/server/core.cljs
@@ -18,9 +18,14 @@
     (.set res "Content-Type" "text/html")
     (.send res (<! (static-page)))))

+(def instructions-url "https://github.com/TerjeNorderhaug/nexmo-pubnub-device-monitor/blob/master/README.md")
+
 (defn server [port success]
   (doto (express)
     (.get "/" handler)
+    (.get "/testing"
+          (fn [req res]
+            (.redirect res instructions-url)))
     (.use (.static express "resources/public"))
     (.listen port success)))


Copy update.

Copy update.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -37,7 +37,7 @@

 ;; ----- Copy -----

-(def carrot-explainer-fragment "the company digest that keeps fast-growing and remote teams up to date with the information that matters.")
+(def carrot-explainer-fragment "a company digest for the team news and updates no one should miss.")
 (def carrot-explainer (str "Carrot is " carrot-explainer-fragment))

 (def invite-message "Join your team on Carrot")


importing core.clj no longer instantiate routes automatically

--- src/ruuvi_server/core.clj
+++ src/ruuvi_server/core.clj
@@ -45,12 +45,12 @@
   (route/not-found "
not found
")
   )

-(def application
+(def create-application
   (-> (handler/site main-routes)
       ))

-(def dev-application
-  (-> #'application
+(defn create-dev-application []
+  (-> create-application
       (wrap-reload '(ruuvi-server.core))
       (wrap-stacktrace)))

@@ -60,7 +60,7 @@
   [config]
   (let [port (config :server-port)]
     (info "Server (production) on port" port "starting")
-    (run-jetty application {:port port :join? false}))
+    (run-jetty (create-application) {:port port :join? false}))
   )

 (defn start-dev
@@ -68,5 +68,5 @@
   [config]
   (let [port (config :server-port)]
     (info "Server (development) on port" port "starting")
-    (run-jetty dev-application {:port port :join? false}))
+    (run-jetty (create-dev-application) {:port port :join? false}))
   )


Fixed typos

Fixed typos

--- src/stub_http/internal/server.clj
+++ src/stub_http/internal/server.clj
@@ -29,13 +29,13 @@
    body - The response body
    delay - Delay in ms added to the response"
   (let [; We see if a predefined status exists for the supplied status code
-        istatus (first (filter #(= (.getRequestStatus %) status) (NanoHTTPD$Response$Status/values)))
+        status (first (filter #(= (.getRequestStatus %) status) (NanoHTTPD$Response$Status/values)))
         ; If no match then we create a custom implementation of IStatus with the supplied status
-        istatus (or istatus (reify NanoHTTPD$Response$IStatus
+        sstatus (or status (reify NanoHTTPD$Response$IStatus
                               (getDescription [_] "")
                               (getRequestStatus [_]
                                 status)))
-        nano-response (NanoHTTPD/newFixedLengthResponse istatus content-type body)]
+        nano-response (NanoHTTPD/newFixedLengthResponse sstatus content-type body)]
     (if delay (Thread/sleep delay))
     (for [[name value] headers]
       (.addHeader nano-response name value))


♻ Add ! to side-effecting functions, remove it from read-only functions

Why:
- Some functions were marked incorrectly
- Follow Clojure conventions to improve readability

--- src/territory_bro/projections.clj
+++ src/territory_bro/projections.clj
@@ -88,14 +88,14 @@
                         (doall))]
     (seq new-events)))

-(defn- update-with-transient-events [new-events]
+(defn- update-with-transient-events! [new-events]
   (when-some [transient-events (seq (filter :event/transient? new-events))]
     (swap! *cache apply-events transient-events)
     (log/info "Updated with" (count transient-events) "transient events")))

 (defn- refresh-process-managers! []
   (when-some [new-events (run-process-managers! (cached-state))]
-    (update-with-transient-events new-events)
+    (update-with-transient-events! new-events)
     ;; Some process managers produce persisted events which in turn
     ;; trigger other process managers (e.g. :congregation.event/gis-user-created),
     ;; so we have to refresh the projections and re-run the process managers
@@ -103,7 +103,7 @@
     (refresh-projections!)
     (recur)))

-(defn- run-startup-optimizations! []
+(defn- startup-optimizations []
   (db/with-db [conn {:read-only? true}]
     (let [state (cached-state)
           injections {:get-present-schemas (fn []
@@ -116,8 +116,8 @@
        (db-admin/init-present-users state injections)))))

 (defn- refresh-startup-optimizations! []
-  (let [new-events (run-startup-optimizations!)]
-    (update-with-transient-events new-events)))
+  (let [new-events (startup-optimizations)]
+    (update-with-transient-events! new-events)))

 (defn refresh! []
   (log/info "Refreshing projections")


now it might finally work?

now it might finally work?

--- src/mafia_votecount/scraper/team_liquid.clj
+++ src/mafia_votecount/scraper/team_liquid.clj
@@ -158,7 +158,7 @@

 (defn- cycle-changes [indexed hosts]
   (filter #(and (is-host? % hosts) (is-cycle-change? (:message (val %))))
-          (rest indexed)))
+          indexed))

 (defn- dec-or-nil [num]
   (if (nil? num)


fix: do nothing on empty extract batches

--- src/main/clojure/pdok/featured/extracts.clj
+++ src/main/clojure/pdok/featured/extracts.clj
@@ -26,20 +26,22 @@

 (defn- jdbc-update-extract [db table entries]
-  (let [qualified-table (str extract-schema "." table)
-        query (str "UPDATE " qualified-table " SET valid_to = ? WHERE version = ?")]
-    (try (j/execute! db (cons query entries) :multi? true :transaction? false)
-      (catch java.sql.SQLException e (j/print-sql-exception-chain e)))))
+  (when (seq entries)
+    (let [qualified-table (str extract-schema "." table)
+          query (str "UPDATE " qualified-table " SET valid_to = ? WHERE version = ?")]
+      (try (j/execute! db (cons query entries) :multi? true :transaction? false)
+           (catch java.sql.SQLException e (j/print-sql-exception-chain e))))))

 (defn update-extract-records [db dataset feature-type extract-type items]
   (jdbc-update-extract db (str dataset "_" extract-type "_v0_" feature-type) items))

 (defn- jdbc-insert-extract [db table entries]
-  (let [qualified-table (str extract-schema "." table)
-        query (str "INSERT INTO " qualified-table
-                   " (feature_type, version, valid_from, valid_to, publication, tiles, xml) VALUES (?, ?, ?, ?, ?, ?, ?)")]
-    (try (j/execute! db (cons query entries) :multi? true :transaction? false)
-      (catch java.sql.SQLException e (j/print-sql-exception-chain e)))))
+  (when (seq entries)
+    (let [qualified-table (str extract-schema "." table)
+          query (str "INSERT INTO " qualified-table
+                     " (feature_type, version, valid_from, valid_to, publication, tiles, xml) VALUES (?, ?, ?, ?, ?, ?, ?)")]
+      (try (j/execute! db (cons query entries) :multi? true :transaction? false)
+           (catch java.sql.SQLException e (j/print-sql-exception-chain e))))))

 (defn get-or-add-extractset [db extractset version]
   "return id"
@@ -129,7 +131,7 @@
 (defn changelog->change-inserts [record]
   (condp = (:action record)
     :new (:feature record)
-    :change (:feature record)
+    :change (:feature record)
     :close (:feature record)
     nil))

@@ -155,9 +157,9 @@
       (when records
         (*process-insert-extract* dataset collection extract-type
                                   (filter (complement nil?) (map changelog->change-inserts records)))
-        (*process-update-extract* dataset collection extract-type
+        (*process-update-extract* dataset collection extract-type
                                   (filter (complement nil?) (map changelog->updates records)))
-        (*process-delete-extract* dataset collection extract-type
+        (*process-delete-extract* dataset collection extract-type
                                   (filter (complement nil?) (map changelog->deletes records)))
         (if (= 0 (mod i 10))
           (log/info "Creating extracts" (str dataset "-" collection "-" extract-type) "processed:" (* i batch-size)))
@@ -167,7 +169,7 @@
    (if-not (every? *initialized-collection?* (map (partial template/template-key dataset extract-type)
                                        collections))
       {:status "error" :msg "missing template(s)" :collections collections}
-      (do
+      (do
         (doseq [collection collections]
           (create-extract* dataset extract-type collection fn-timeline-query))
         {:status "ok" :collections collections})))


pull heroku port

pull heroku port

--- src/survey/core.clj
+++ src/survey/core.clj
@@ -106,4 +106,4 @@
       wrap-params))

 (defn -main []
-  (jetty/run-jetty app {:port 3000}))
+  (jetty/run-jetty app {:port (or (env :port) 3000)}))


Simplify chunking rules with partition-all; add doc strings

--- src/themis/core.clj
+++ src/themis/core.clj
@@ -86,27 +86,18 @@

 (defn validation
   "Validate a data structure, `t`,
-  against validation query/rule-set.  The rule-set will be normalized if
-  it is not already.
+  against validation query/rule-set.
+  The rule-set will be normalized if it is not already.
   Note: By default everything is returned in a map, keyed by
-  the coordinate vector.  Multiple validation results are conj'd together
-  in a vector."
+  the coordinate vector.
+  Multiple validation results are conj'd together in a vector.
+  You can optionally pass in a custom :merge-fn or :validation-seq-fn to process
+  the validation and tailor the results"
   [t rule-set & opts]
   (let [{:keys [merge-fn validation-seq-fn]} (merge {:merge-fn validation-seq->map
                                                      :validation-seq-fn validation-seq}
                                                     (apply hash-map opts))]
     (merge-fn (validation-seq-fn t rule-set))))
-
-(defn split-equally [num coll]
-  "Split a collection into a vector of (as close as possible) equally sized parts"
-  (loop [num num
-         parts []
-         coll coll
-         c (count coll)]
-    (if (<= num 0)
-      parts
-      (let [t (quot (+ c num -1) num)]
-        (recur (dec num) (conj parts (take t coll)) (drop t coll) (- c t))))))

 (defn pvalidation-seq
   "Like `validation-seq`, but chunks rules based on the number of
@@ -114,15 +105,18 @@
   [t rule-set]
   (let [normalized-rules (rules/normalize rule-set)
         chunks (.availableProcessors (Runtime/getRuntime))
-        chunked-rules (remove empty? (split-equally chunks normalized-rules))
-       validate-vec-fn #(validate-vec t %)]
+        rule-count (count normalized-rules)
+        chunked-rules (vec (partition-all (/ rule-count chunks) normalized-rules))
+        validate-vec-fn #(validate-vec t %)]
     (when (rules/balanced? normalized-rules)
       (into [] (mapcat deref
                        (map #(future (mapcat validate-vec-fn %))
                             chunked-rules))))))

 (defn pvalidation
-  ""
+  "Like `validation`, but will create the validation-seqs in parallel via
+  `pvalidation-seq` - which is based on the number of recognized cores.
+  Note: :validation-seq-fn is ignored in this call."
   [t rule-set & {:keys [merge-fn]}]
   (validation t rule-set
               :validation-seq-fn pvalidation-seq


Use protocol for processing

Use protocol for processing

--- src/whisper2cyanite/core.clj
+++ src/whisper2cyanite/core.clj
@@ -16,6 +16,16 @@

 (def ^:const pbar-width 35)

+(def mstore-processed (atom 0))
+(def pstore-processed (atom 0))
+
+(def mstore-error-paths (atom (sorted-set)))
+(def pstore-error-paths (atom (sorted-set)))
+
+(defprotocol Processor
+  (process-metrics [this rollup period retention path series])
+  (process-path [this path]))
+
 (defn- calc-ttl
   "Calc a TTL value."
   [time retention]
@@ -28,20 +38,26 @@
    (format (str "%s: rollup: %s, period: %s, path: %s, time: %s, "
                 "value: %s, ttl: %s") msg rollup period path time value ttl)))

-(defn- migrate-points
-  "Migrate points."
-  [mstore options tenant rollup period retention path series]
-  (let [min-ttl (:min-ttl options default-min-ttl)
-        run (:run options false)]
-    (doseq [point series]
-      (let [time (first point)
-            value (last point)
-            ttl (calc-ttl time retention)]
-        (when (> ttl min-ttl)
-          (log-point "Migrating point" rollup period path time value ttl)
-          (when run
-            (mstore/insert mstore tenant rollup period path time value
-                           ttl)))))))
+(defn- migrator
+  "Migrator."
+  [mstore pstore options tenant]
+  (let [run (:run options false)
+        min-ttl (:min-ttl options default-min-ttl)]
+    (reify
+      Processor
+      (process-metrics [this rollup period retention path series]
+        (doseq [point series]
+          (let [time (first point)
+                value (last point)
+                ttl (calc-ttl time retention)]
+            (when (> ttl min-ttl)
+              (log-point "Migrating point" rollup period path time value ttl)
+              (when run
+                (mstore/insert mstore tenant rollup period path time value
+                               ttl))))))
+      (process-path [this path]
+        (when run
+          (pstore/insert pstore tenant path))))))

 (defn- validate-value
   "Validate a value."
@@ -56,75 +72,65 @@
     (when-not valid?
       (if-not @error-reported?
         (do
-          (swap! error-paths conj path)
+          (swap! mstore-error-paths conj path)
           (wlog/error err)
           (swap! error-reported? (fn [_] true)))
         (log/debug err)))
     valid?))

-(defn- validate-points
-  "Validate points."
-  [mstore options tenant rollup period retention path series]
-  (let [series (whisper/sort-series series)
-        from (first (first series))
-        to (first (last series))
-        min-ttl (:min-ttl options default-min-ttl)
-        mstore-series (mstore/fetch-series mstore tenant rollup period path
-                                           from to)
-        error-reported? (atom false)
-        validators [[#(not= %2 nil) "Point not found"]
-                    [#(sequential? %2) "Value is not an array"]
-                    [#(= (count %2) 1) "Array size is not equal to 1"]
-                    [#(= %1 (first %2)) "Values are not equal"]]
-        error-paths (:error-paths (:data-mstore-stats options))]
-    (doseq [point series]
-      (let [time (first point)
-            w-value (last point)
-            ttl (calc-ttl time retention)]
-        (when (> ttl min-ttl)
-          (log-point "Validating point" rollup period path time w-value ttl)
-          (let [s-value (get mstore-series time)]
-            (every? #(validate-value rollup period path time w-value s-value
-                                     (first %) (second %) error-reported?
-                                     error-paths)
-                    validators)))))))
+(defn- validator
+  "Validator."
+  [mstore pstore options tenant]
+  (let [min-ttl (:min-ttl options default-min-ttl)]
+    (reify
+      Processor
+      (process-metrics [this rollup period retention path series]
+        (let [series (whisper/sort-series series)
+              from (first (first series))
+              to (first (last series))
+              mstore-series (mstore/fetch-series mstore tenant rollup period path
+                                                 from to)
+              error-reported? (atom false)
+              validators [[#(not= %2 nil) "Point not found"]
+                          [#(sequential? %2) "Value is not an array"]
+                          [#(= (count %2) 1) "Array size is not equal to 1"]
+                          [#(= %1 (first %2)) "Values are not equal"]]]
+          (doseq [point series]
+            (let [time (first point)
+                  w-value (last point)
+                  ttl (calc-ttl time retention)]
+              (when (> ttl min-ttl)
+                (log-point "Validating point" rollup period path time w-value ttl)
+                (let [s-value (get mstore-series time)]
+                  (every? #(validate-value rollup period path time w-value
+                                           s-value (first %) (second %)
+                                           error-reported? mstore-error-paths)
+                          validators)))))))
+      (process-path [this path]
+        (when-not (pstore/exist? pstore tenant path)
+          (swap! pstore-error-paths conj path)
+          (wlog/error "Path not found in the path store: " path))))))

 (defn- process-archive
   "Process an archive."
-  [ra-file file archive mstore tenant path from to retention options points-fn]
+  [ra-file file archive mstore tenant path from to retention options processor]
   (let [rollup (:seconds-per-point archive)
         points (:points archive)
         period (if retention (/ retention rollup) points)
         retention (if retention retention (* rollup points))
         data (whisper/fetch-archive-seq-ra ra-file file archive from to)
         series (whisper/remove-nulls (:series data))]
-    (when points-fn
-      (points-fn mstore options tenant rollup period retention path series))))
-
-(defn- migrate-path
-  "Migrate a path."
-  [pstore tenant path options]
-  (let [run (:run options false)]
-    (when run
-      (pstore/insert pstore tenant path))))
-
-(defn- validate-path
-  "Validate a path."
-  [pstore tenant path options]
-  (let [error-paths (:error-paths (:data-pstore-stats options))]
-    (when-not (pstore/exist? pstore tenant path)
-      (swap! error-paths conj path)
-      (wlog/error "Path not found in the path store: " path))))
+    (process-metrics processor rollup period retention path series)))

 (defn- process-file
   "Process a file."
-  [file dir mstore pstore tenant from to options path-fn points-fn]
+  [file dir mstore pstore tenant from to options processor]
   (let [path (whisper/file-to-name file dir)
         mstore-processed (:processed (:data-mstore-stats options))
         pstore-processed (:processed (:data-pstore-stats options))]
-    (when (and pstore path-fn)
+    (when pstore
       (swap! pstore-processed inc)
-      (path-fn pstore tenant path options))
+      (process-path processor path))
     (when mstore
       (let [ra-file (RandomAccessFile. file "r")
             rollups (:rollups options)]
@@ -139,7 +145,7 @@
                   (let [retention (get rollups seconds-per-point
                                        (:retention archive))]
                     (process-archive ra-file file archive mstore tenant path
-                                     from to retention options points-fn))))))
+                                     from to retention options processor))))))
           (finally
             (.close ra-file)))))))

@@ -212,11 +218,6 @@
 ;;     (assoc merged :error-paths (clojure.set/union (:error-paths total)
 ;;                                                   (:error-paths store)))))

-(defn- deref-stats
-  [stats]
-  {:processed (deref (:processed stats))
-   :error-paths (deref (:error-paths stats))})
-
 (defn- show-stats
   "Show metric store stats."
   [title data-stats store-stats]
@@ -238,7 +239,7 @@

 (defn- process
   "Process a Whisper database."
-  [source tenant cass-host es-url options path-fn points-fn start-title title]
+  [source tenant cass-host es-url options processor-fn start-title title]
   (wlog/set-logging! options)
   (try
     (wlog/info start-title)
@@ -250,19 +251,13 @@
           pool (cp/threadpool jobs)
           mstore (create-mstore cass-host options)
           pstore (create-pstore es-url options)
-          data-mstore-stats {:processed (atom 0)
-                             :error-paths (atom (sorted-set))}
-          data-pstore-stats {:processed (atom 0)
-                             :error-paths (atom (sorted-set))}
-          options (-> options
-                      (assoc :data-mstore-stats data-mstore-stats)
-                      (assoc :data-pstore-stats data-pstore-stats))
+          processor (processor-fn mstore pstore options tenant)
           process-file-fn (fn [file]
                             (wlog/info "Processing path: " file)
                             (when-not @wlog/print-log?
                               (prog/tick))
                             (process-file file root-dir mstore pstore tenant
-                                          from to options path-fn points-fn))]
+                                          from to options processor))]
       (try
         (prog/set-progress-bar!
          "[:bar] :percent :done/:total Elapsed :elapseds ETA :etas")
@@ -279,12 +274,13 @@
           (wlog/unhandled-error e))
         (finally
           (when mstore
-            (deref-stats data-mstore-stats)
-            (show-stats "Metric store stats" (deref-stats data-mstore-stats)
+            (show-stats "Metric store stats" {:processed @mstore-processed
+                                              :error-paths @mstore-error-paths}
                         (mstore/get-stats mstore))
             (mstore/shutdown mstore))
           (when pstore
-            (show-stats "Path store stats" (deref-stats data-pstore-stats)
+            (show-stats "Path store stats" {:processed @pstore-processed
+                                            :error-paths @pstore-error-paths}
                         (pstore/get-stats pstore))
             (pstore/shutdown pstore)))))
     (catch Exception e
@@ -294,14 +290,14 @@
 (defn migrate
   "Do the migration."
   [source tenant cass-host es-url options]
-  (process source tenant cass-host es-url options migrate-path migrate-points
-           "Starting migration" "Migrating"))
+  (process source tenant cass-host es-url options migrator "Starting migration"
+           "Migrating"))

 (defn validate
   "Do the validation."
   [source tenant cass-host es-url options]
-  (process source tenant cass-host es-url options validate-path validate-points
-           "Starting validation" "Validating"))
+  (process source tenant cass-host es-url options validator "Starting validation"
+           "Validating"))

 (defn list-paths
   "List paths."


Fix image boundary bug

Fix image boundary bug

--- src/zaffre/components/render.cljc
+++ src/zaffre/components/render.cljc
@@ -171,8 +171,8 @@
         overflow-bounds (or overflow-bounds (layout->bounds layout))
         [overflow-min-x overflow-min-y overflow-max-x overflow-max-y] overflow-bounds
         ;; bounds for overflow/target container (whichever is smaller)
-        min-x (dec (max 1 overflow-min-x))
-        min-y (dec (max 1 overflow-min-y))
+        min-x (dec (max 0 overflow-min-x))
+        min-y (dec (max 0 overflow-min-y))
         max-y (min overflow-max-y (count target))
         lines (last img-element)]
     (log/debug "render-img-into-container layout " layout)
@@ -186,7 +186,7 @@
           (assert (vector? fg))
           (assert (vector? bg))
           (let [^"[Ljava.lang.Object;" target-line (aget target target-y)
-                max-x (min overflow-max-x(count target-line))
+                max-x (min overflow-max-x (count target-line))
                 target-x (int (+ x dx))]
             (when (< min-x target-x max-x)
               (log/trace "rendering pixel x:" target-x " y:" target-y " " pixel " max-x:" max-x " max-y:" (count target))
@@ -320,10 +320,10 @@
         elements (-> (inherit-overflow-bounds layer-en-place)
                    element-seq
                    vec)]
-    (log/trace "render-layer-into-container elements" elements)
-    #_(log/info "render-layer-into-container layer-en-place" (zc/tree->str layer-en-place))
+    #_(log/trace "render-layer-into-container elements" elements)
+    #_(log/trace "render-layer-into-container layer-en-place" (zc/tree->str layer-en-place))
     (doseq [element elements]
-      (log/debug "render-layer-into-container element" element)
+      #_(log/debug "render-layer-into-container element" element)
       (render-component-into-container target element))))

 (defn log-layer [^"[[Ljava.lang.Object;" layer-container]


Fix for advanced compilation and google closure handline of querystrings

--- src/re_view/routing.cljs
+++ src/re_view/routing.cljs
@@ -14,7 +14,7 @@
 ;; from http://www.lispcast.com/mastering-client-side-routing-with-secretary-and-goog-history
 ;; Replace this method:
 ;;  https://closure-library.googlecode.com/git-history/docs/local_closure_goog_history_html5history.js.source.html#line237
-(aset js/goog.history.Html5History.prototype "getUrl_"
+(set! (.. js/goog -history -Html5History -prototype -getUrl_)
       (fn [token]
         (this-as this
           (if (.-useFragment_ this)


Reduce timeout and improve error catching

--- src/nightmod/sandbox.clj
+++ src/nightmod/sandbox.clj
@@ -17,15 +17,14 @@
    (jail-test/blacklist-symbols
     '#{alter-var-root eval catch
        load-string load-reader addMethod ns-resolve resolve find-var
-       *read-eval* ns-publics ns-unmap set! ns-map ns-interns the-ns
-       push-thread-bindings pop-thread-bindings future-call agent send
-       send-off pmap pcalls pvals in-ns System/out System/in System/err
+       *read-eval* ns-publics ns-unmap ns-map ns-interns the-ns
+       in-ns System/out System/in System/err
        with-redefs-fn Class/forName})
    (jail-test/blacklist-nses '[clojure.main])
    (jail-test/blanket "clojail")])

 (def sb (jail/sandbox tester
-                      :timeout 5000
+                      :timeout 2000
                       :namespace 'nightmod.game
                       :init '(require '[nightmod.public :refer :all]
                                       '[play-clj.core :refer :all]
@@ -41,16 +40,10 @@
   (System/setProperty "java.security.policy"
                       (-> "java.policy" io/resource .toString)))

-(defn run-form!
-  [form]
-  (try (sb form)
-    (catch Exception e
-      (when (nil? @u/error) (reset! u/error e)))))
-
 (defn run-file!
   [path]
   (reset! u/error nil)
-  (->> (slurp path)
-       (format "(do %s\n)")
-       jail/safe-read
-       run-form!))
+  (-> (format "(do %s\n)" (slurp path))
+      jail/safe-read
+      sb
+      (try (catch Exception e (reset! u/error e)))))


Switch paragraphs in invite email.

Switch paragraphs in invite email.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -347,6 +347,8 @@
       (when logo? (spacer 32))
       (h1 invite-message)
       (spacer 24)
+      (paragraph (format invite-instructions from org-name))
+      (spacer 16)
       [:table {:class "row "}
         [:tr
           [:th {:class "small-12 large-12 columns"}
@@ -355,8 +357,6 @@
               [:a {:href config/web-url}
                 "Learn More"]
               "."]]]]
-      (spacer 16)
-      (paragraph (format invite-instructions from org-name))
       (spacer 16)
       (when show-note? (spacer 8))
       (when show-note? (note-author from-avatar from true))


Fix bug in min-peers test helper calculation

--- src/onyx/test_helper.clj
+++ src/onyx/test_helper.clj
@@ -35,7 +35,8 @@
   [{:keys [catalog workflow] :as job}]
   (let [task-set (into #{} (apply concat workflow))]
     (mapv (fn [t]
-           {:task t :min-peers (or (:onyx/min-peers (find-task catalog t)) 1)})
+            (let [task-map (find-task catalog t)]
+              {:task t :min-peers (or (:onyx/n-peers task-map) (:onyx/min-peers task-map) 1)}))
          task-set)))

 (defn validate-enough-peers!


Remove dead code

Remove dead code

--- src/sinusoides/util.cljs
+++ src/sinusoides/util.cljs
@@ -1,9 +1,7 @@
 (ns sinusoides.util
   (:require-macros [cljs.core.async.macros :refer [go-loop]])
   (:require [cljs.core.async :refer [close! chan pipe <!]]
-            [clojure.string :refer [lower-case replace]]
-            [om.core :as om :include-macros true]
-            [om.dom :as dom :include-macros true]))
+            [clojure.string :refer [lower-case replace]]))

 (defn trace [obj & more]
   (apply prn (if more more ["TRACE:"]))
@@ -24,24 +22,6 @@
     (replace #"\s+" "-")
     (replace #"[^a-z0-9-]" "")))

-(defn chan-to-cursor-updates [cursor owner [input-channel korks]]
-  (reify
-    om/IInitState
-    (init-state [_]
-      (let [channel (pipe input-channel (chan))]
-        (go-loop []
-          (when-let [input (<! channel)]
-            (om/update! cursor korks input)
-            (recur)))
-        {:channel channel}))
-
-    om/IWillUnmount
-    (will-unmount [_]
-      (close! (om/get-state owner :channel)))
-
-    om/IRender
-    (render [_] (dom/div nil))))
-
 (defn togglej [set thing]
   (if (contains? set thing)
     (disj set thing)


Cleaned up sports

Cleaned up sports

--- src/skidskytte/namer.clj
+++ src/skidskytte/namer.clj
@@ -69,7 +69,7 @@
                 "styrkelyfts"
                 "störtlopps"
                 "snowboard"
-                "sumo"
+                "sumobrottning"
                 "telemarks"
                 "tennis"
                 "tjurfäktnings"
@@ -147,7 +147,6 @@
                 "rodel"
                 "rugby"
                 "segling"
-                "segway"
                 "simhopp"
                 "simning"
                 "skateboard"
@@ -156,7 +155,7 @@
                 "styrkelyft"
                 "störtlopp"
                 "snowboard"
-                "sumo"
+                "sumobrottning"
                 "tennis"
                 "tjurfäktning"
                 "tyngdlyftning"


Read the dynamic var only once for speed.

--- src/spec_tools/core.cljc
+++ src/spec_tools/core.cljc
@@ -158,14 +158,15 @@
     ;; function predicate
     (if (and (fn? spec) (spec x))
       x
-      ;; there is a dynamic conformer
-      (if-let [conform (if *conforming* (*conforming* this))]
-        (conform this x)
-        ;; spec or regex
-        (if (or (s/spec? spec) (s/regex? spec))
-          (s/conform spec x)
-          ;; invalid
-          +invalid+))))
+      (let [conforming *conforming*]
+        ;; there is a dynamic conformer
+        (if-let [conform (if conforming (conforming this))]
+          (conform this x)
+          ;; spec or regex
+          (if (or (s/spec? spec) (s/regex? spec))
+            (s/conform spec x)
+            ;; invalid
+            +invalid+)))))
   (unform* [_ x]
     (s/unform* (s/specize* spec) x))
   (explain* [this path via in x]


Tests hk

Tests hk

--- test/taoensso/faraday/tests/main.clj
+++ test/taoensso/faraday/tests/main.clj
@@ -5,6 +5,8 @@
             [taoensso.nippy         :as nippy]))

 ;; TODO LOTS of tests still outstanding, PRs very, very welcome!!
+
+(comment (test/run-tests '[taoensso.faraday.tests.main]))

 ;;;; Config & setup


Prioritize user routes over default ones

--- src/clj/matthiasn/systems_toolbox_sente/server.clj
+++ src/clj/matthiasn/systems_toolbox_sente/server.clj
@@ -92,7 +92,7 @@
                                                  "text/html"))
                       (GET "/chsk" req (ajax-get-or-ws-handshake-fn req))
                       (POST "/chsk" req (ajax-post-fn req))]
-          cmp-routes (into cmp-routes user-routes)
+          cmp-routes (into user-routes cmp-routes)
           cmp-routes (into cmp-routes
                            [(route/resources "/")
                             (route/resources "/" {:root "META-INF/resources/"})


connect infer/process-text-change to the editor (not working yet)

--- src/parinfer/editor.cljs
+++ src/parinfer/editor.cljs
@@ -17,6 +17,7 @@
 (defprotocol IEditor
   "Custom data/methods for a CodeMirror editor."
   (cm-key [this])
+  (get-prev-state [this])
   (frame-updated? [this])
   (set-frame-updated! [this value])
   (record-change! [this thing]))
@@ -43,6 +44,17 @@
                       (+ len-last-line (.. change -from -ch)))]
           (- end-x start-x))))))

+(defn cm-process-text-change
+  [cm change prev-state]
+  (let [start-line (.. change -from -line)
+        end-line (inc (.. change -to -line))
+        num-new-lines (alength (.-text change))
+        lines (for [i (range start-line (+ start-line num-new-lines))]
+                (.getLine cm i))]
+    (infer/process-text-change
+      prev-state
+      {:line-no [start-line end-line]
+       :new-lines lines})))

 (defn fix-text!
   "Correctly format the text from the given editor."
@@ -59,17 +71,33 @@
          scroll-y (.-scrollTop scroller)

          ;; format the text
-         opts {:cursor-line (.-line cursor)
-               :cursor-x (.-ch cursor)
-               :cursor-dx (compute-cursor-dx cursor change)}
+         cursor-data {:cursor-line (.-line cursor)
+                      :cursor-x (.-ch cursor)
+                      :cursor-dx (compute-cursor-dx cursor change)}

          key- (cm-key cm)
          mode (or (get-in @state [key- :mode]) :infer)
-         format-fn (case mode
-                    :infer infer/format-text
-                    :prep prep/format-text
-                    nil)
-         new-text (format-fn opts current-text)]
+
+         prev-state (get-prev-state cm)
+
+         new-text
+         (case mode
+           :infer
+           (let [state (if (and @prev-state change)
+                         (cm-process-text-change cm change (merge @prev-state cursor-data))
+                         (infer/process-text cursor-data current-text))]
+
+             ;; uncomment this to try fast infer
+             ;; (when state
+             ;;   (reset! prev-state state))
+             (if state
+               (join "\n" (:lines state))
+               current-text))
+
+           :prep
+           (prep/format-text cursor-data current-text)
+
+           nil)]

      ;; update the text
      (swap! state assoc-in [key- :text] new-text)
@@ -197,7 +225,8 @@
            wrapper (.getWrapperElement cm)
            watcher (js/scrollMonitor.create wrapper)
            initial-state (assoc empty-editor-state
-                                :mode (:parinfer-mode opts))]
+                                :mode (:parinfer-mode opts))
+           prev-editor-state (atom nil)]

        (set! (.-id wrapper) (str "cm-" element-id))
@@ -231,6 +260,7 @@
        ;; Extend the code mirror object with some utility methods.
        (specify! cm
                  IEditor
+                 (get-prev-state [this] prev-editor-state)
                  (cm-key [this] key-)
                  (frame-updated? [this] (get-in @frame-updates [key- :frame-updated?]))
                  (set-frame-updated! [this value] (swap! frame-updates assoc-in [key- :frame-updated?] value))


sort doc-ids

sort doc-ids

--- src/pc/views/content.clj
+++ src/pc/views/content.clj
@@ -52,4 +52,4 @@
       [:a {:href (str "/document/" doc-id)} doc-id]])])

 (defn interesting [doc-ids]
-  (h/html (layout {} (interesting* doc-ids))))
+  (h/html (layout {} (interesting* (reverse (sort doc-ids))))))


ensure that zid an lastVoteTimstamp are uploaded

--- src/polismath/poller.clj
+++ src/polismath/poller.clj
@@ -66,7 +66,9 @@
       :zid zid
       ; "$gt" 92839182312
     }
-    new-results
+    (assoc new-results
+           "zid" zid
+           "lastVoteTimestamp" timestamp)
     :multi false
     :upsert true))


revised mugshot layout again

revised mugshot layout again

--- src/prais2/mugshots.cljc
+++ src/prais2/mugshots.cljc
@@ -6,7 +6,7 @@

 (rum.core/defc mugshot [key]
   (let [data (key content/mugshot-data)]
-    [:div {:style {:max-width "100px"}}
+    [:div {:style {:max-width "200px"}}
      [:img.img-responsive
       (core/isrc (str "assets/mugshots/" (:id data) "-med.jpg"))]
      [:p.text-center {:key 2} (:name data)]])
@@ -14,9 +14,9 @@

 (rum.core/defc reformatted-mugshots []
   [:div
-   [:.row [:.col-xs-2 (mugshot :christina)]]
-   [:.row [:.col-xs-2 (mugshot :david)] [:.col-xs-2 (mugshot :tim)] [:.col-xs-2 (mugshot :emily-j)]]
-   [:.row [:.col-xs-2 (mugshot :mike)] [:.col-xs-2 (mugshot :emily-b)] [:.col-xs-2 (mugshot :joanne)]]]
+   [:.row [:.col-xs-3 (mugshot :christina)] [:.col-xs-3 (mugshot :david)] [:.col-xs-3 (mugshot :mike)] ]
+   [:.row  [:.col-xs-3 (mugshot :tim)] [:.col-xs-3 (mugshot :emily-b)]]
+   [:.row  [:.col-xs-3 (mugshot :emily-j)] [:.col-xs-3 (mugshot :joanne)]]]
   )


Added snapshot'ing to kvs.

Added snapshot'ing to kvs.

--- src/cbfg/kvs.cljs
+++ src/cbfg/kvs.cljs
@@ -13,14 +13,12 @@
 ; - fsync
 ; - stats
 ; - has compaction/maintenance abstraction
+;
+; Note that we always close the res-ch.

 ; TODO: Track age, utilization, compaction for simulated performance.
-; TODO: Cannot use atoms because they prevent time travel.
-; TODO: Add snapshot ability.
 ; TODO: Readers not blocked by writers.
 ; TODO: Mutations shadow old values.
-
-; TODO: Conventions on closing res-ch.

 (defn make-kc [] ; A kc is a keys & changes map.
   {:keys (sorted-map)      ; key -> sq
@@ -56,9 +54,13 @@
   (act kvs-do actx
        (aput kvs-do state-ch [cb res-ch])))

+(defn kvs-snapshot-do [actx res-ch kvs-snapshot cb]
+  (act kvs-snapshot-do actx
+       (aput kvs-snapshot-do res-ch (cb kvs-snapshot))))
+
 (defn make-scan-fn [kc-kind scan-kind result-key get-entry]
   (fn [actx state-ch m]
-     (let [{:keys [from to res-ch]} m
+     (let [{:keys [kvs-ident kvs-snapshot from to res-ch]} m
            cb (fn [state kvs]
                 (act scan-work actx
                      (let [kc (kc-kind kvs)]
@@ -71,7 +73,9 @@
                                                               :entry entry})))))
                        (aput-close scan-work res-ch (merge m {:status :ok}))))
                 nil)]
-       (kvs-do actx state-ch nil (kvs-checker (:kvs-ident m) cb)))))
+       (if kvs-snapshot
+         (kvs-snapshot-do actx res-ch kvs-snapshot (kvs-checker kvs-ident cb))
+         (kvs-do actx state-ch nil (kvs-checker kvs-ident cb))))))

 (def op-handlers
   {:kvs-open
@@ -98,8 +102,8 @@

    :multi-get
    (fn [actx state-ch m]
-     (let [res-m (dissoc m :keys)
-           res-ch (:res-ch m)
+     (let [{:keys [kvs-ident kvs-snapshot res-ch]} m
+           res-m (dissoc m :keys)
            cb (fn [state kvs]
                 (act multi-get actx
                      (let [kc (:clean kvs)]
@@ -111,7 +115,9 @@
                                  (merge res-m {:partial :not-found :key key}))))
                        (aput-close multi-get res-ch (merge res-m {:status :ok}))))
                 nil)]
-       (kvs-do actx state-ch nil (kvs-checker (:kvs-ident m) cb))))
+       (if kvs-snapshot
+         (kvs-snapshot-do actx res-ch kvs-snapshot (kvs-checker kvs-ident cb))
+         (kvs-do actx state-ch nil (kvs-checker kvs-ident cb)))))

    :multi-change
    (fn [actx state-ch m]
@@ -136,6 +142,11 @@

    :scan-changes
    (make-scan-fn :clean :changes :sq (fn [kc sq-key entry] entry))
+
+   :snapshot
+   (fn [actx state-ch m]
+     (kvs-do actx state-ch (:res-ch m)
+             (fn [state] [state {:status :ok :kvs-snapshot state}])))

    :sync
    (fn [actx state-ch m]


Changed entry-page template not to link to the current entry.

--- src/lambda_blog/templates/entries.clj
+++ src/lambda_blog/templates/entries.clj
@@ -5,9 +5,9 @@
             [lambda-blog.utils :refer [format-date pathcat]]
             [s-html.tags :refer [a article div footer h1 header hr i li nav p span time ul]]))

-(defn entry-title [{:keys [path path-to-root tags timestamp title]}]
+(defn entry-header [{:keys [path-to-root tags timestamp]} title]
   (text-centered
-   (h1 (a {:href (pathcat path-to-root path)} title))
+   (h1 title)
    (p "Posted on " (time (format-date timestamp)))
    (nav (map #(info-label
                (a {:class :tag
@@ -30,23 +30,24 @@
                        (i {:class [:fa :fa-chevron-right]})))))))))

 (defn entry
-  [{:keys [contents next previous] :as ent}]
+  [{:keys [contents next previous title] :as ent}]
   (article
    (header
     (well
      (row
       (pager ent previous :previous)
       (div {:class [:col-xs-8 :col-sm-6]}
-           (entry-title ent))
+           (entry-header ent title))
       (pager ent next :next))))
    contents))

 (def entry-page (partial page entry))

-(defn entry-summary [{:keys [path path-to-root summary tags] :as ent}]
+(defn entry-summary [{:keys [path path-to-root summary tags title] :as ent}]
   (article
    (-> ent
-       entry-title
+       (entry-header (a {:href (pathcat path-to-root path)}
+                        title))
        row
        well
        header)


Remove unnecessary `eval*` parse call

Remove unnecessary `eval*` parse call

--- src/taoensso/carmine.clj
+++ src/taoensso/carmine.clj
@@ -156,11 +156,10 @@
   [script numkeys key & args]
   (let [[r & _] (->> (apply evalsha* script numkeys key args)
                      (with-replies :as-pipeline))]
-    (parse protocol/*parser*
-      (if (and (instance? Exception r)
-               (.startsWith (.getMessage ^Exception r) "NOSCRIPT"))
-        (apply eval script numkeys key args)
-        (return r)))))
+    (if (and (instance? Exception r)
+             (.startsWith (.getMessage ^Exception r) "NOSCRIPT"))
+      (apply eval script numkeys key args)
+      (return r))))

 (def ^:private interpolate-script
   "Substitutes named variables for indexed KEYS[]s and ARGV[]s in Lua script.


Minor formatting

Minor formatting

--- src/test_utils/core.cljs
+++ src/test_utils/core.cljs
@@ -20,8 +20,10 @@

 (defn rand-alpha []
   "Return a random, alphabetic character."
-  (let [alpha-chars (map char(concat (range (.charCodeAt "A") (.charCodeAt "Z"))
-                               (range (.charCodeAt "a") (.charCodeAt "z"))))]
+  (let [alpha-chars (map char(concat (range (.charCodeAt "A")
+                                            (.charCodeAt "Z"))
+                               (range (.charCodeAt "a")
+                                      (.charCodeAt "z"))))]
     (nth alpha-chars (rand-range 0 (count alpha-chars)))))

 (defn rand-alphas
@@ -30,6 +32,8 @@
     ([n] (apply str (take n (rand-alphas)))))

 (defn rand-timestamp [begin-year end-year]
-  "Return a vector with random timestamp elements with years in the range [begin-year, end-year)."
-  [(rand-range begin-year end-year) (rand-range 1 13) (rand-int 31) (rand-int 24) (rand-int 60) (rand-int 60)])
+  "Return a vector with random timestamp elements with years in the range
+  [begin-year, end-year)."
+  [(rand-range begin-year end-year) (rand-range 1 13) (rand-int 31)
+   (rand-int 24) (rand-int 60) (rand-int 60)])