Rewrite find-empty using map and keep indexed instead of for

--- src/pot/core/bl.cljs
+++ src/pot/core/bl.cljs
@@ -6,9 +6,13 @@
   [board]
   (apply
     concat
-    (for [y (range (count board))]
-      (for [x (range (count (first board))) :when (nil? (get-in board [y x]))]
-        [y x]))))
+    (map-indexed
+      (fn [y row]
+        (keep-indexed
+          (fn [x cell]
+            (when-not cell [y x]))
+          row))
+      board)))

 (defn add-cell
   [board location]


Removed rate-limiting to get things working again

--- src/qcast/server.clj
+++ src/qcast/server.clj
@@ -12,7 +12,6 @@
             [qcast.ring.middleware.xml :as xml]
             [qcast.util                :refer [parse-int]]
             [ring.middleware.json      :as json]
-            [ring.middleware.ratelimit :refer [wrap-ratelimit]]
             [ring.util.response        :as response]
             [taoensso.timbre           :refer :all]))

@@ -75,16 +74,16 @@
         wrap-request-logging
         handler/api
         (json/wrap-json-response {:key-fn json-keyword})
-        wrap-ratelimit)
+        )
     ;; RSS Feed
     (-> feed-routes
         wrap-request-logging
         xml/wrap-rss-response
-        wrap-ratelimit)
+        )
     ;; RSS Feed media
     (-> files-routes
         wrap-request-logging
-        wrap-ratelimit)
+        )
     ;; Static content
     (-> default-routes
         wrap-request-logging


Added class and attr to all tab components

--- src/re_com/tabs.cljs
+++ src/re_com/tabs.cljs
@@ -2,7 +2,7 @@
   (:require-macros [re-com.core :refer [handler-fn]])
   (:require [re-com.util     :refer [deref-or-value]]
             [re-com.box      :refer [flex-child-style]]
-            [re-com.validate :refer [css-style? vector-of-maps?] :refer-macros [validate-args-macro]]))
+            [re-com.validate :refer [css-style? html-attr? vector-of-maps?] :refer-macros [validate-args-macro]]))

 ;;--------------------------------------------------------------------------------------------------
@@ -15,10 +15,12 @@
    {:name :on-change :required true                  :type "unique-id -> nil"         :validate-fn fn?             :description "called when user alters the selection. Passed the unique identifier of the selection"}
    {:name :id-fn     :required false :default :id    :type "tab -> anything"          :validate-fn ifn?            :description [:span "given an element of " [:code ":tabs"] ", returns its unique identifier (aka id)"]}
    {:name :label-fn  :required false :default :label :type "tab -> string | hiccup"   :validate-fn ifn?            :description [:span "given an element of " [:code ":tabs"] ", returns its displayable label"]}
-   {:name :style     :required false                 :type "CSS style map"            :validate-fn css-style?      :description "CSS styles to add or override (for each individual tab rather than the container)"}])
+   {:name :class     :required false                 :type "string"                   :validate-fn string?         :description "CSS class names, space separated (applies to the outer container)"}
+   {:name :style     :required false                 :type "CSS style map"            :validate-fn css-style?      :description "CSS styles to add or override (aplies to each individual tab rather than the container)"}
+   {:name :attr      :required false                 :type "HTML attr map"            :validate-fn html-attr?      :description [:span "HTML attributes, like " [:code ":on-mouse-move"] [:br] "No " [:code ":class"] " or " [:code ":style"] "allowed (applies to the outer container)"]}])

 (defn horizontal-tabs
-  [& {:keys [model tabs on-change id-fn label-fn style]
+  [& {:keys [model tabs on-change id-fn label-fn class style attr]
       :or   {id-fn :id label-fn :label}
       :as   args}]
   {:pre [(validate-args-macro tabs-args-desc args "tabs")]}
@@ -26,8 +28,9 @@
         tabs     (deref-or-value tabs)
         _        (assert (not-empty (filter #(= current (id-fn %)) tabs)) "model not found in tabs vector")]
     [:ul
-     {:class "rc-tabs nav nav-tabs noselect"
-      :style (flex-child-style "none")}
+     (merge {:class (str "rc-tabs nav nav-tabs noselect " class)
+             :style (flex-child-style "none")}
+            attr)
      (for [t tabs]
        (let [id        (id-fn  t)
              label     (label-fn  t)
@@ -47,13 +50,14 @@
 ;;--------------------------------------------------------------------------------------------------

 (defn- bar-tabs
-  [& {:keys [model tabs on-change id-fn label-fn style vertical?]}]
+  [& {:keys [model tabs on-change id-fn label-fn vertical? class style attr]}]
   (let [current  (deref-or-value model)
         tabs     (deref-or-value tabs)
         _        (assert (not-empty (filter #(= current (id-fn %)) tabs)) "model not found in tabs vector")]
     [:div
-     {:class (str "rc-tabs noselect btn-group" (if vertical? "-vertical"))
-      :style (flex-child-style "none")}
+     (merge {:class (str "rc-tabs noselect btn-group" (if vertical? "-vertical") " " class)
+             :style (flex-child-style "none")}
+            attr)
      (for [t tabs]
        (let [id        (id-fn  t)
              label     (label-fn  t)
@@ -68,7 +72,7 @@

 (defn horizontal-bar-tabs
-  [& {:keys [model tabs on-change id-fn label-fn style]
+  [& {:keys [model tabs on-change id-fn label-fn class style attr]
       :or   {id-fn :id label-fn :label}
       :as   args}]
   {:pre [(validate-args-macro tabs-args-desc args "tabs")]}
@@ -76,13 +80,15 @@
     :model     model
     :tabs      tabs
     :on-change on-change
-    :style     style
     :id-fn     id-fn
     :label-fn  label-fn
-    :vertical? false))
+    :vertical? false
+    :class     class
+    :style     style
+    :attr      attr))

 (defn vertical-bar-tabs
-  [& {:keys [model tabs on-change id-fn label-fn style]
+  [& {:keys [model tabs on-change id-fn label-fn class style attr]
       :or   {id-fn :id label-fn :label}
       :as   args}]
   {:pre [(validate-args-macro tabs-args-desc args "tabs")]}
@@ -90,10 +96,12 @@
     :model     model
     :tabs      tabs
     :on-change on-change
-    :style     style
     :id-fn     id-fn
     :label-fn  label-fn
-    :vertical? true))
+    :vertical? true
+    :class     class
+    :style     style
+    :attr      attr))

 ;;--------------------------------------------------------------------------------------------------
@@ -101,14 +109,15 @@
 ;;--------------------------------------------------------------------------------------------------

 (defn- pill-tabs    ;; tabs-like in action
-  [& {:keys [model tabs on-change id-fn label-fn style vertical?]}]
+  [& {:keys [model tabs on-change id-fn label-fn vertical? class style attr]}]
   (let [current  (deref-or-value model)
         tabs     (deref-or-value tabs)
         _        (assert (not-empty (filter #(= current (id-fn %)) tabs)) "model not found in tabs vector")]
     [:ul
-     {:class (str "rc-tabs noselect nav nav-pills" (when vertical? " nav-stacked"))
-      :style (flex-child-style "none")
-      :role  "tabslist"}
+     (merge {:class (str "rc-tabs noselect nav nav-pills" (when vertical? " nav-stacked") " " class)
+             :style (flex-child-style "none")
+             :role  "tabslist"}
+            attr)
      (for [t tabs]
        (let [id        (id-fn  t)
              label     (label-fn  t)
@@ -124,7 +133,7 @@

 (defn horizontal-pill-tabs
-  [& {:keys [model tabs on-change id-fn style label-fn]
+  [& {:keys [model tabs on-change id-fn class style attr label-fn]
       :or   {id-fn :id label-fn :label}
       :as   args}]
   {:pre [(validate-args-macro tabs-args-desc args "tabs")]}
@@ -132,14 +141,16 @@
     :model     model
     :tabs      tabs
     :on-change on-change
-    :style     style
     :id-fn     id-fn
     :label-fn  label-fn
-    :vertical? false))
+    :vertical? false
+    :class     class
+    :style     style
+    :attr      attr))

 (defn vertical-pill-tabs
-  [& {:keys [model tabs on-change id-fn style label-fn]
+  [& {:keys [model tabs on-change id-fn class style attr label-fn]
       :or   {id-fn :id label-fn :label}
       :as   args}]
   {:pre [(validate-args-macro tabs-args-desc args "tabs")]}
@@ -147,7 +158,9 @@
     :model     model
     :tabs      tabs
     :on-change on-change
-    :style     style
     :id-fn     id-fn
     :label-fn  label-fn
-    :vertical? true))
+    :vertical? true
+    :class     class
+    :style     style
+    :attr      attr))


missing button select default label-fn

missing button select default label-fn

--- src/cljs/re_form/inputs/button_select_input_impl.cljs
+++ src/cljs/re_form/inputs/button_select_input_impl.cljs
@@ -47,7 +47,8 @@

       :reagent-render
       (fn [{:keys [value on-change label-fn value-fn items errors on-blur]}]
-        (let [value-fn (or value-fn identity)]
+        (let [value-fn (or value-fn identity)
+              label-fn (or label-fn identity)]
           [:div.re-radio-buttons
            {:tab-index 0
             :on-blur on-blur


Добавлен сеттер в one-image-uploder

Добавлен сеттер в one-image-uploder

--- radiolamp-6P3S/src/r6p3s/cpt/one_image_uploder.cljs
+++ radiolamp-6P3S/src/r6p3s/cpt/one_image_uploder.cljs
@@ -28,7 +28,6 @@

 (defn value-set! [app v]
   (assoc app :image v))
-

 (defn component [app own {:keys [class+]
                           :as   opts}]


(PDB-5022) eastwood: ignore supspicious-expressions created by alt!!

test/puppetlabs/puppetdb/command_test.clj:173:3:
suspicious-expression: or called with 1 args.  (or x) always returns
x.  Perhaps there are misplaced parentheses?

--- eastwood.clj
+++ eastwood.clj
@@ -6,3 +6,10 @@
     #"^#'puppetlabs\.trapperkeeper\.testutils\.logging/atom-appender$"
     #"^#'puppetlabs\.trapperkeeper\.testutils\.logging/atom-logger$"
     #"^#'puppetlabs\.trapperkeeper\.testutils\.logging/logs-matching$"}})
+
+(disable-warning
+ {:linter :suspicious-expression
+  :for-macro 'clojure.core/or
+  :if-inside-macroexpansion-of #{'clojure.core.async/alt!!}
+  :within-depth 6 ;; determined experimentally
+  :reason "alt!! creates one-armed or expressions"})


Fix top_banner docstring indentation

Fix top_banner docstring indentation

--- src-cljs/frontend/components/pieces/top_banner.cljs
+++ src-cljs/frontend/components/pieces/top_banner.cljs
@@ -12,18 +12,19 @@
   disappear by themselves, after an event, or be dismissable (have a little (X)
   at the top right corner), and are *not* meant to be permanent interfaces.

-  :banner-type                  Can be one of :success, :warning, or :danger,
-  determines the background color of the banner.
+  :banner-type                      Can be one of :success, :warning, or :danger,
+                                    determines the background color of the banner.

-  :impression-event-type-event-type (optional) The event banner-type which will be tracked when
-  this banner displays. If not given, no event will be
-  tracked.
+  :impression-event-type-event-type (optional) The event banner-type which will
+                                    be tracked when this banner displays. If not
+                                    given, no event will be tracked.

-  :content               Content to go inside the banner.
+  :content                          Content to go inside the banner.

-  :dismiss-fn            (optional) A function which will be called when the
-  banner's dismiss button (X) is clicked. If not given,
-  no dismiss button will be shown."
+  :dismiss-fn                       (optional) A function which will be called
+                                    when the banner's dismiss button (X) is
+                                    clicked. If not given, no dismiss button
+                                    will be shown."

   [{:keys [banner-type content impression-event-type dismiss-fn]} owner]
   (reify


add tests for one-hyde.transform

add tests for one-hyde.transform

--- test/one_hyde/test/core.clj
+++ test/one_hyde/test/core.clj
@@ -1,8 +1,19 @@
 (ns one-hyde.test.core
-  (:use one-hyde.core)
+  (:use one-hyde.core
+        one-hyde.transform)
   (:use [clojure.test]))

 (deftest replace-me ;; FIXME: write
   (is true))

+;;; TRANSFORM
+(deftest transform-test
+  (binding [*transformers* (atom [inc #(* 2 %)])]
+    (is (= 4 (transform 1)))
+    (add-transformer! inc)
+    (is (= 12 (transform #(* 3 %)))))
+
+  (let [f (transform "(apply + site)")]
+    ; f => (fn [site & contents] (list (apply + site)))
+    (is (= '(6) (f [1 2 3])))))


GAWB-1897: Remove Type field from Create New Method modal and make all methods to be workflows

--- src/cljs/main/broadfcui/page/method_repo/create_method.cljs
+++ src/cljs/main/broadfcui/page/method_repo/create_method.cljs
@@ -31,14 +31,11 @@
            (style/create-form-label "Namespace")
            [input/TextField {:ref "namespace" :style {:width "100%"}
                              :predicates [(input/nonempty "Method namespace")]}]]
-          [:div {:style {:flex "1 0 auto" :marginRight "1em"}}
+          [:div {:style {:flex "1 0 auto"}}
            (style/create-form-label "Name")
            [input/TextField {:ref "name" :style {:width "100%"}
-                             :predicates [(input/nonempty "Method name")]}]]
-          [:div {:style {:flex "0 0 100px"}}
-           (style/create-form-label "Type")
-           (style/create-identity-select {:ref "type"} ["Task" "Workflow"])]]
-
+                             :predicates [(input/nonempty "Method name")]}]]]
+         ;;GAWB-1897 removes Type field and makes all MC types "Workflow" until "Task" type is supported
          (style/create-form-label "Synopsis (optional)")
          (style/create-text-field {:ref "synopsis" :style {:width "100%"}})
          (style/create-form-label "Documentation (optional)")
@@ -101,7 +98,8 @@
    :create-method
    (fn [{:keys [props state refs]}]
      (let [[namespace name & fails] (input/get-and-validate refs "namespace" "name")
-           [synopsis documentation type] (common/get-text refs "synopsis" "documentation" "type")
+           [synopsis documentation] (common/get-text refs "synopsis" "documentation")
+           type "Workflow"
            wdl (react/call :call-method (@refs "wdl-editor") "getValue")
            fails (or fails (when (clojure.string/blank? wdl) ["Please enter the WDL payload"]))]
        (swap! state assoc :validation-errors fails)


Adds docstring to cook-coercer (#309)

Adds docstring to cook-coercer (#309)

--- scheduler/src/cook/mesos/api.clj
+++ scheduler/src/cook/mesos/api.clj
@@ -906,8 +906,15 @@
       x
       [x]))

-;;TODO (Diego): add docs for this
 (def cook-coercer
+  "This coercer adds to compojure-api's default-coercion-matchers by
+  converting keys from snake_case to kebab-case for requests and from
+  kebab-case to snake_case for responses. For example, this allows clients to
+  pass 'max_retries' when submitting a job, even though the job schema has
+  :max-retries (with a dash instead of an underscore). For more information on
+  coercion in compojure-api, see:
+
+    https://github.com/metosin/compojure-api/wiki/Validation-and-coercion"
   (constantly
     (-> c-mw/default-coercion-matchers
       (update :body


More idiomatic fill and stroke - fns {with,current}-{fill,stroke}

--- src/quil/core.clj
+++ src/quil/core.clj
@@ -1095,6 +1095,26 @@
   [filename]
   (.createOutput (current-applet) (str filename)))

+(defn
+  ^{:requires-bindings false
+    :processing-name nil
+    :category "Color"
+    :subcategory "Creating & Reading"}
+  current-fill
+  "Return the current fill color."
+  []
+  (.fillColor (current-surface)))
+
+(defn
+  ^{:requires-bindings false
+    :processing-name nil
+    :category "Color"
+    :subcategory "Creating & Reading"}
+  current-stroke
+  "Return the current stroke color."
+  []
+  (.strokeColor (current-surface)))
+
 (def ^{:private true}
   cursor-modes {:arrow PConstants/ARROW
                 :cross PConstants/CROSS
@@ -4112,6 +4132,42 @@
   called."
   []
   (.getWidth (current-applet)))
+
+(defmacro
+  ^{:requires-bindings true
+    :processing-name nil
+    :category "Color"
+    :subcategory "Utility Macros"}
+  with-fill
+  "Temporarily set the fill color for the body of this macro.
+   The code outside of with-fill form will have the previous fill color set.
+
+   The fill color has to be in a vector!
+   Example: (with-fill [255] ...)
+            (with-fill [10 80 98] ...)"
+  [fill-args & body]
+  `(let [old-fill# (current-fill)]
+     (apply fill ~fill-args)
+     ~@body
+     (fill old-fill#)))
+
+(defmacro
+  ^{:requires-bindings true
+    :processing-name nil
+    :category "Color"
+    :subcategory "Utility Macros"}
+  with-stroke
+  "Temporarily set the stroke color for the body of this macro.
+   The code outside of with-stroke form will have the previous stroke color set.
+
+   The stroke color has to be in a vector!
+   Example: (with-stroke [255] ...)
+            (with-stroke [10 80 98] ...)"
+  [stroke-args & body]
+  `(let [old-stroke# (current-stroke)]
+     (apply stroke ~stroke-args)
+     ~@body
+     (stroke old-stroke#)))

 (defmacro
   ^{:requires-bindings true


Bump cljs-devtools

Bump cljs-devtools

--- resources/leiningen/new/lambone/common/dev/boot.clj
+++ resources/leiningen/new/lambone/common/dev/boot.clj
@@ -71,7 +71,7 @@
     [org.clojure/tools.nrepl "0.2.12" :scope "test"]])

 (def dirac-repl-deps
-  '[[binaryage/devtools "0.6.1" :scope "test"]
+  '[[binaryage/devtools "0.7.0" :scope "test"]
     [binaryage/dirac "0.6.0" :scope "test"]
     [jupl/boot-cljs-devtools "0.1.1-SNAPSHOT" :scope "test"]])


cleanup settings

cleanup settings

--- src/cljs/swarmpit/component/service/info/settings.cljs
+++ src/cljs/swarmpit/component/service/info/settings.cljs
@@ -15,31 +15,6 @@
             [rum.core :as rum]))

 (enable-console-print!)
-
-(defonce digest-shown (atom false))
-
-(defn resource-provided?
-  [resource]
-  (let [cpu (:cpu resource)
-        memory (:memory resource)]
-    (or (> cpu 0)
-        (> memory 0))))
-
-(rum/defc form-subheader < rum/reactive [image image-digest]
-  (if image-digest
-    (comp/click-away-listener
-      {:onClickAway #(reset! digest-shown false)}
-      (comp/tooltip
-        {:PopperProps          {:disablePortal true}
-         :onClose              #(reset! digest-shown false)
-         :open                 (rum/react digest-shown)
-         :disableFocusListener true
-         :disableHoverListener true
-         :disableTouchListener true
-         :title                image-digest}
-        (html [:span {:onClick #(reset! digest-shown true)
-                      :style   {:cursor "pointer"}} image])))
-    (html [:span image])))

 (rum/defc form-replicas < rum/static [tasks]
   (let [data (->> tasks
@@ -78,57 +53,6 @@
     "not running" (label/info state)
     "partly running" (label/yellow state)))

-(rum/defc form-dashboard < rum/static [{:keys [limit reservation]} tasks]
-  (html
-    (cond
-      (and (resource-provided? reservation)
-           (resource-provided? limit))
-      [:table
-       [:tr
-        [:td {:rowSpan 2} (form-replicas tasks)]
-        [:td
-         [:div "Reservation"]
-         [:div
-          [:span [:b "CPU: "]]
-          [:span (:cpu reservation)]]
-         [:div
-          [:span [:b "MEMORY: "]]
-          [:span (str (:memory reservation) "MB")]]]]
-       [:tr
-        [:td
-         [:div "Limit"]
-         [:div
-          [:span [:b "CPU: "]]
-          [:span (:cpu limit)]]
-         [:div
-          [:span [:b "MEMORY: "]]
-          [:span (str (:memory limit) "MB")]]]]]
-      (resource-provided? reservation)
-      [:table
-       [:tr
-        [:td (form-replicas tasks)]
-        [:td
-         [:div "Reservation"]
-         [:div
-          [:span [:b "CPU: "]]
-          [:span (:cpu reservation)]]
-         [:div
-          [:span [:b "MEMORY: "]]
-          [:span (str (:memory reservation) "MB")]]]]]
-      (resource-provided? limit)
-      [:table
-       [:tr
-        [:td (form-replicas tasks)]
-        [:td
-         [:div "Limit"]
-         [:div
-          [:span [:b "CPU: "]]
-          [:span (:cpu limit)]]
-         [:div
-          [:span [:b "MEMORY: "]]
-          [:span (str (:memory limit) "MB")]]]]]
-      :else (form-replicas tasks))))
-
 (defn- autoredeploy-label
   [autoredeploy]
   (when autoredeploy (label/primary "autoredeploy")))
@@ -145,7 +69,7 @@
       (comp/card-header
         {:title     (:serviceName service)
          :className "Swarmpit-form-card-header"
-         :subheader (form-subheader image image-digest)
+         :subheader image
          :action    (menu/menu
                       actions
                       :serviceGeneralMenuAnchor


CMR-1354 script and temporal range setup

--- search-app/src/cmr/search/data/query_to_elastic.clj
+++ search-app/src/cmr/search/data/query_to_elastic.clj
@@ -2,6 +2,7 @@
   "Defines protocols and functions to map from a query model to elastic search query"
   (:require
    [clj-time.coerce :as time-coerce]
+   [clj-time.core :as time]
    [clojure.string :as str]
    [clojure.set :as set]
    [clojurewerkz.elastisch.query :as eq]
@@ -33,6 +34,10 @@
   so keyword search will not be broken"
   {:type Boolean
    :default true})
+
+(def default-temporal-start-date-time
+  "The default date-time to use for relevancy calculations when one is not specified in the temporal range"
+  (time-coerce/to-long (time/date-time 1970 1 1)))

 (defn- doc-values-field-name
   "Returns the doc-values field-name for the given field."
@@ -182,6 +187,7 @@
         {:keys [concept-type condition]} (query-expense/order-conditions query)
         core-query (q2e/condition->elastic condition concept-type)]
     (if-let [keywords (keywords-in-query query)]
+      ;; Forces score to be returned even if not sorting by score.
       {:track_scores true
        ;; function_score query allows us to compute a custom relevance score for each document
        ;; matched by the primary query. The final document relevance is given by multiplying
@@ -191,8 +197,9 @@
                                 :query {:filtered {:query (eq/match-all)
                                                    :filter core-query}}}}}
       (if boosts
-        (errors/throw-service-errors :bad-request ["Relevance boosting is only supported for keyword queries"])))))
-
+        (errors/throw-service-errors :bad-request ["Relevance boosting is only supported for keyword queries"])
+        {:query {:filtered {:query (eq/match-all)
+                              :filter core-query}}}))))

 (defmethod q2e/concept-type->sort-key-map :collection
   [_]
@@ -261,22 +268,40 @@
    {(q2e/query-field->elastic-field :revision-id :collection) {:order "desc"}}])

 (defn- temporal-range->elastic-param
-  "Convert a temporal range to the right format for elastic. Change the dates to longs, populate
-   the start/end dates with nil as needed, and change the keys to snake case"
+  "Convert a temporal range to the right format for the elastic script. Change the dates to longs, populate
+   the start/end dates with defaults as needed, and change the keys to snake case. Do whatever
+   processing can be done here rather than the script for performance considerations."
   [temporal-range]
   (let [{:keys [start-date end-date]} temporal-range
-        temporal-range {:start-date (when start-date
-                                      (time-coerce/to-long start-date))
-                        :end-date (when end-date
-                                    (time-coerce/to-long end-date))}]
+        temporal-range {:start-date (if start-date
+                                      (time-coerce/to-long start-date)
+                                      default-temporal-start-date-time)
+                        :end-date (if end-date
+                                    (time-coerce/to-long end-date)
+                                    (time-coerce/to-long (time/today)))}
+        temporal-range (assoc temporal-range :range (- (:end-date temporal-range) (:start-date temporal-range)))]
     (util/map-keys->snake_case temporal-range)))

 (def script
-  "def overlapStartDate = temporalRanges[0].start_date;
-   if (doc['start-date'].value > overlapStartDate) { overlapStartDate = doc['start-date'].value; }
-   def overlapEndDate = temporalRanges[0].end_date;
-   if (doc['end-date'].value < overlapEndDate) { overlapEndDate = doc['end-date'].value; }
-   ((overlapEndDate - overlapStartDate) / (temporalRanges[0].end_date - temporalRanges[0].start_date)) * 100")
+  "def totalSpan = 0;
+   def totalOverlap = 0;
+   for (range in temporalRanges)
+   {
+     def overlapStartDate = range.start_date;
+     if (doc['start-date'].value != 0 && doc['start-date'].value > overlapStartDate)
+      { overlapStartDate = doc['start-date'].value; }
+     def overlapEndDate = range.end_date;
+     if (doc['end-date'].value != 0 && doc['end-date'].value < overlapEndDate)
+      { overlapEndDate = doc['end-date'].value; }
+     totalOverlap += overlapEndDate - overlapStartDate;
+     totalSpan += range.range;
+   }
+   if (totalSpan > 0)
+   {
+     totalOverlap / totalSpan;
+   }
+   else { 0; }")
+

 (defn- temporal-overlap-sort-script
  "Create the script to sort by temporal overlap percent in descending order. Get the temporal ranges


tiny cleanups

tiny cleanups

--- src/spawner/core.clj
+++ src/spawner/core.clj
@@ -2,8 +2,9 @@
   "A spawning process controlller.

 Like a process supervisor.  This uses core.async extensively."
-  (:require [clojure.core.async
-             :refer [>! <! >!! <!! go go-loop timeout chan close! alts! alts!! thread]])
+  (:require
+   [clojure.core.async
+    :refer [>! <! >!! <!! go go-loop chan close!  alts! alts!! timeout thread]])
   (:require [clojure.string :as str])
   (:require [clojure.java.io :as io])
   (:require [org.httpkit.client :as http-kit])
@@ -78,9 +79,11 @@
        (fn [url options callback]
          (let [[command & args] (<!! command-chan)]
            (when args (println "command " command " the args were: " args))
-           ;; (println "the url is " url " options " options " and the command " command)
+           (println ">> the url is " url " options " options " and the command " command)
            (Thread/sleep (options :timeout))
-           (>!! request-chan (if args (apply conj [command] args) [command]))))]
+           (>!! request-chan (if args
+                               (apply conj [command] args)
+                               [command]))))]
       (call-http monitor-url request-chan response-chan))))

 (defn -main
@@ -92,11 +95,16 @@
     ;; read messages from the command input
     (go-loop
      [[message & args] (<! input)]
-     (let [response
+     (let [response ; capture the response from processing the message
            (case message
              :start (let [[id & rest] args]
-                      (dosync
-                       (alter started assoc id (start-process id (scripts id)))))
+                      ;; Could add a test for id == :all here
+                      (if (scripts id)
+                        (dosync
+                         (alter started assoc id (start-process id (scripts id))))
+                        ;; Else there's an error
+                        [:error :notfound]))
+             :deploy (let [[id & rest] args] (println "redeploy " id " " args))
              :kill (let [[id & rest] args]
                      (when (@started args)
                        (>! ((@started args) :from) :kill)))
@@ -105,7 +113,7 @@
              :http-error [:http-error "whoops! http error!"]
              :exit (do (println "dieing!") [:quit])
              true [:http-error "whoops! that's not a signal we understand"])]
-       (>! output (if response response []))) ; send some data so we can recur the http
+       (>! output (if response response []))) ; and send response so we recur http
      (recur (<! input)))

     ;; read the signals from the started processes
@@ -113,7 +121,7 @@
      [channels (keep #(% :from) (vals @started))]
      (let [[[message id args] ch] (alts! (conj channels (timeout 100)))]
        (case message
-         :line (println id " read " message " with args: " args)
+         :line (println "process " id " read " message " with args: " args)
          :exit (dosync (alter started dissoc id) (println id " exited"))
          nil)
        (recur (keep #(% :from) (vals @started)))))


cleanup

cleanup

--- src/babel/lexiconfn.clj
+++ src/babel/lexiconfn.clj
@@ -71,21 +71,18 @@

 (defn unify [ & args]
   "like unify/unify, but unify/copy each argument before unifying."
-  (do
-    (log/trace (str "(lexfn)unify args: " args))
-    (log/trace (str "(lexfn)unify first arg: " (first args)))
-    (let [retval (apply unifyc args)]
-      (if (not (fail? retval))
-        retval
-
-        (let [message (str "Failed to unify args:" (string/join " , " (map strip-refs args))
-                           (if (= 2 (.size args))
-                             (str "; failed path: " (get-fail-path (first args)
+  (log/trace (str "(lexfn)unify args: " args))
+  (log/trace (str "(lexfn)unify first arg: " (first args)))
+  (let [retval (apply unifyc args)]
+    (if (not (fail? retval))
+      retval
+      (let [message (str "Failed to unify args:" (string/join " , " (map strip-refs args))
+                         (if (= 2 (.size args))
+                           (str "; failed path: " (get-fail-path (first args)
                                                                  (second args)))
-                             ""))]
-
-          (log/error message)
-          (throw (Exception. message)))))))
+                           ""))]
+        (do (log/error message)
+            (throw (Exception. message)))))))

 (defn cache-serialization [entry]
   "Copying ((unify/copy)ing) lexical entries during generation or parsing is done by serializing and then deserializing.


Whitespace

Whitespace

--- src/braid/core/client/ui/views/user_hover_card.cljs
+++ src/braid/core/client/ui/views/user_hover_card.cljs
@@ -37,8 +37,8 @@
             {:on-click
               (fn [_]
                 (dispatch [:new-conversation
-                            { :group-id @open-group-id
-                              :mentioned-user-ids [user-id]}]))}
+                           {:group-id @open-group-id
+                            :mentioned-user-ids [user-id]}]))}
             "PM"]
         #_[:a.mute "Mute"]


Improvements due to comments in pull request.

--- src/foreclojure/users.clj
+++ src/foreclojure/users.clj
@@ -249,13 +249,17 @@
 (defn datatable-paging [start length users]
   (take length (drop start users)))

-(defn get-sort-by-following-fn []
+(defn sort-by-following
+  "Get function for sorting by following for current user.
+  We need nullary function to create sort function  because 'following' set depends on current user."
+  []
   (let [following (if-user [{:keys [following]}]
-                           (set following))]
-    #(if (following (:_id %)) -1 1)))
+                    (set following))]
+    (fn [user]
+      (if (contains? following (:_id user)) -1 1))))

 (defn datatable-sort-cols [sort-col users]
-  (let [column-sorts [:rank :user (comp count :solved) (get-sort-by-following-fn)]]
+  (let [column-sorts [:rank :user (comp count :solved) (sort-by-following)]]
     (if-let [sort-fn (get column-sorts sort-col)]
       (sort-by sort-fn users)
       users)))


Reconnect on closing of websocket.

Reconnect on closing of websocket.

--- src/goldrausch/okcoin.clj
+++ src/goldrausch/okcoin.clj
@@ -39,40 +39,39 @@
 (defn client-connect!
   "Connects to url. Puts [in out] channels on return channel when ready.
 Only supports websocket at the moment, but is supposed to dispatch on
-protocol of url. tag-table is an atom"
+protocol of url. "
   [url]
   (let [host (.getHost (java.net.URL. (str/replace url #"^ws" "http"))) ; HACK
         http-client (cli/create-client) ;; TODO use as singleton var?
         in (chan)
         out (chan)
         opener (chan)]
-    (try
-      (cli/websocket http-client url
-                     :open (fn [ws]
-                             (info "ws-opened" ws)
-                             (go-loop [m (<! out)]
-                                      (if m
-                                        (do
-                                          (debug "client sending msg to:" url m)
-                                          (cli/send ws :text (json/write-str m))
-                                          (recur (<! out)))
-                                        (do
-                                          (cli/close http-client)
-                                          (async/close! in))))
-                             (async/put! opener [in out])
-                             (async/close! opener))
-                     :text (fn [ws ms]
-                             (let [m (json/read-str ms)]
-                               (debug "client received msg from:" url m)
-                               (async/put! in (with-meta m {:host host}))))
-                     :close (fn [ws code reason]
-                              (info "closing" ws code reason)
-                              (async/close! in)
-                              (async/close! out))
-                     :error (fn [ws err] (error err "ws-error" url)
-                              (async/close! opener)))
-      (catch Exception e
-        (error "client-connect error:" url e)))
+    (go-loop []
+      (let [close-ch (chan)]
+        (cli/websocket http-client url
+                       :open (fn [ws]
+                               (info "ws-opened" ws)
+                               (go-loop [m (<! out)]
+                                 (when m
+                                   (do
+                                     (debug "client sending msg to:" url m)
+                                     (cli/send ws :text (json/write-str m))
+                                     (recur (<! out)))))
+                               (async/put! opener [in out])
+                               (async/close! opener))
+                       :text (fn [ws ms]
+                               (let [m (json/read-str ms)]
+                                 (debug "client received msg from:" url m)
+                                 (async/put! in (with-meta m {:host host}))))
+                       :close (fn [ws code reason]
+                                (info "closing" ws code reason)
+                                (async/close! close-ch))
+                       :error (fn [ws err] (error err "ws-error" url)
+                                (async/close! opener)
+                                (async/close! close-ch)))
+        (<! (timeout 60))
+        (<! close-ch) ;; wait on unblocking close
+        (recur)))
     opener))

 (def schema [{:db/id #db/id[:db.part/db]


Update deps

Update deps

--- frontend/project.clj
+++ frontend/project.clj
@@ -7,7 +7,7 @@
   :min-lein-version "2.6.1"

   :dependencies [[org.clojure/clojure "1.8.0"]
-                 [org.clojure/clojurescript "1.9.93"]
+                 [org.clojure/clojurescript "1.9.183"]
                  [org.clojure/core.async "0.2.385" :exclusions [org.clojure/tools.reader]]
                  [org.omcljs/om "1.0.0-alpha40"]
                  [cljs-ajax "0.5.8"]                        ; AJAX for om
@@ -17,7 +17,9 @@
                  [devcards-om-next "0.1.1" :scope "devcards"]]

   :plugins [[lein-figwheel "0.5.4-7"]
-            [lein-cljsbuild "1.1.3" :exclusions [[org.clojure/clojure]]]]
+            [lein-cljsbuild "1.1.3" :exclusions [[org.clojure/clojure]]]
+            [lein-ancient "0.6.10"]
+            [lein-kibit "0.1.2"]]

   :source-paths ["src"]


GAWB-3820: dos preview render failed (#1418)

on fileSummaryV1 api error, dont try to calculate previewability

--- src/cljs/main/broadfcui/common/gcs_file_preview.cljs
+++ src/cljs/main/broadfcui/common/gcs_file_preview.cljs
@@ -54,7 +54,7 @@
                             [:div {:style {:display "inline-block" :width 185}} (str label ": ")]
                             [:span {:data-test-id (test-utils/text->test-id label "content")} contents]])
                  data-empty (= size 0)
-                 hide-preview? (not (previewable? object))]
+                 hide-preview? (or error (not (previewable? object)))]
              [:div {:style {:width 700 :overflow "auto"}}
               (labeled "Google Bucket" bucket-name)
               (labeled "Object" object)


add about page asset paths

add about page asset paths

--- frontend/stefon.cljs
+++ frontend/stefon.cljs
@@ -14,3 +14,17 @@
       uri-string
       (utils/mwarn "Unable to find data-uri for" url
                    "Is it defined in resources/assets/js/stefon-hack-for-om.coffee.ref?"))))
+
+(defn asset-path
+  "Returns the assetified version of the path for the given url. Also returns
+   the link to the cdn version if we're in the right environment.
+   Path must be specified in resources/assets/js/stefon-hack-for-om.coffee.ref!"
+  [path]
+  (let [uri-string (-> js/window
+                       (aget "stefon_hack_for_om")
+                       (aget "asset_paths")
+                       (aget path))]
+    (if uri-string
+      (utils/cdn-path uri-string)
+      (utils/mwarn "Unable to find asset-path for" path
+                   "Is it defined in resources/assets/js/stefon-hack-for-om.coffee.ref?"))))


implement filter options for applications

--- src/cljs/salava/extra/application/ui/application.cljs
+++ src/cljs/salava/extra/application/ui/application.cljs
@@ -315,14 +315,15 @@
                 (swap! state assoc :all-applications (:applications data)))}))

 (defn init-data [state init-params]
+  (let [country (session/get-in [:filter-options :country] (:country init-params))]
   (ajax/GET
     (path-for "/obpv1/application/")
-    {:params  init-params
+    {:params  (assoc init-params :country country)
      :handler (fn [data]
                 (let [{:keys [applications countries user-country]} data]
                   (swap! state assoc :applications applications
                          :countries countries)
-                  (init-all-issuers state init-params)))}))
+                  (init-all-issuers state init-params)))})))

 (defn init-values
@@ -345,7 +346,7 @@
                                 :user-id            user-id
                                 :badges             []
                                 :countries          []
-                                :country-selected   (:country init-values) #_(or (:country init-values) (session/get-in [:user :country] "all"))
+                                :country-selected   (session/get-in [:filter-options :country] (:country init-values)) #_(or (:country init-values) (session/get-in [:user :country] "all"))
                                 :advanced-search    false
                                 :name               (or (:name init-values) "")
                                 :issuer-name        (or (:issuer-name init-values) "")
@@ -356,9 +357,10 @@
                                 :issuer-content {:name (t :core/All)}
                                 :issuer-search false
                                 :search-result []
-                                :show-featured true})]
+                                :show-featured true})
+        country (session/get-in [:filter-options :country] (:country init-values))]
     (init-data state init-values)
-    (autocomplete-search state (:country init-values))
+    (autocomplete-search state country #_(:country init-values))
     (fn []
       (if (session/get :user)
         (layout/default site-navi [content state badge_content_id])


Add todo

Add todo

--- src/clojure/clojurewerkz/cassaforte/new_query_api.clj
+++ src/clojure/clojurewerkz/cassaforte/new_query_api.clj
@@ -21,6 +21,7 @@
   [statement]
   (if *batch*
     statement
+    ;; TODO: make sure that we _CAN_ finish the query (check if it's complete)
     (.toString statement)))

 (alias/alias-ns 'clojurewerkz.cassaforte.query.query-builder)


deleting compojure-api dir

deleting compojure-api dir

--- src/banking/service/compojure_api/handler.clj
+++ src/banking/service/compojure_api/handler.clj
@@ -1,11 +0,0 @@
-(ns banking.service.compojure-api.handler
-  (:require [compojure.core :as c]
-            [compojure.route :as route]
-            [ring.middleware.defaults :as defaults]))
-
-(c/defroutes app-routes
-  (c/GET "/" [] "Hello World")
-  (route/not-found "Not Found"))
-
-(def app
-  (defaults/wrap-defaults app-routes defaults/site-defaults))


Project dump implemented.

Project dump implemented.

--- src/wat/database.clj
+++ src/wat/database.clj
@@ -5,14 +5,14 @@
 (defn define-attributes [c]
   (d/transact c
               [{:db/id (d/tempid :db.part/db)
-                :db/ident :project/name
+                :db/ident :line/pname
                 :db/valueType :db.type/string
                 :db/cardinality :db.cardinality/one
                 :db/doc "Project name text line belongs to."
                 :db.install/_attribute :db.part/db}
                {:db/id (d/tempid :db.part/db)
-                :db/ident :line/id
-                :db/valueType :db.type/bigint
+                :db/ident :line/num
+                :db/valueType :db.type/long
                 :db/cardinality :db.cardinality/one
                 :db/doc "Text line number."
                 :db.install/_attribute :db.part/db}
@@ -52,14 +52,17 @@
       (println "Database" db-name "already exist, its fine."))
     (println "Connection established!")))

-(defn create-line [id original-text male-text female-text translator]
+(defn create-line [& {:keys [pname id text male-text female-text translator], :or {male-text "" female-text "" translator ""}
+                      }]
+  (println (str "wtf" pname id text male-text female-text translator))
   {:db/id (d/tempid :db.part/user)
-   :project/name "default"
-   :line/id id
-   :line/original original-text
+   :line/pname pname
+   :line/num id
+   :line/original text
    :line/male male-text
    :line/female female-text
-   :line/translator translator})
+   :line/translator translator
+   })

 (defn get-n-words [n coll]
   (let [sum (atom 0)
@@ -69,18 +72,43 @@
                 (do
                   (swap! sum + (count (clojure.string/split (:line/original (d/touch (d/entity db y))) #"\s")))
                   (conj x y))
-              x))
+                x))
           []
           coll)))

+(defn dump-project [project-name]
+  (let [db (d/db conn)
+        content (d/q '[:find [?line ...]
+                       :in $ ?pname
+                       :where [?line :line/pname ?pname]]
+                     db project-name)
+        file ]
+    (spit (str "/tmp/" project-name)
+          (clojure.string/join "\n"
+                               (map #(let [[l o m f t] %]
+                                       (str l "," o "," m "," f "," t))
+                                    (sort #(compare (first %1) (first %2))
+                                          (map #(let [ent (d/touch (d/entity db %))]
+                                                  [(:line/num ent)
+                                                   (:line/original ent)
+                                                   (:line/male ent)
+                                                   (:line/female ent)
+                                                   (:line/translator ent)])
+                                               content)))))
+    )
+  )
+
+
 (defn get-dummy-info []
-  #_
-  @(d/transact ; add entry
+  (println "====================")
+  ;(define-attributes conn)
+  #_@(d/transact ; add entry
     conn
-    [(create-line "wolololol" "" "" "noone")])
+    [(create-line :pname "default" :id 2 :text "qwerty sdfg")])
   (println ">")
-  (println (str (d/q '[:find (wat.database/get-n-words 3 ?e) . ;; find all untranslated entries and collect till have n words
-                       :where [?e :line/translator "noone"]]
+  (dump-project "default")
+  (println (str (d/q '[:find (wat.database/get-n-words 5 ?e) .;; find all untranslated entries and collect till have n words
+                       :where [?e :line/pname "default"]]
                      (d/db conn))))
   (println "<")
   (str "Hello there, big brother greets you!"))


Assume repo is a mercurial repo, and download a tar.gz of it and untar it.

--- src/circleci/backend/proto/src/proto/main.clj
+++ src/circleci/backend/proto/src/proto/main.clj
@@ -1,17 +1,16 @@
 (ns proto.main
   (:require [clojure.contrib.io :as io])
   (:require [clojure.contrib.generic.functor :as functor])
-  (:require [clj-yaml.core :as yaml]))
+  (:require [clj-yaml.core :as yaml])
+  (:require [clojure.contrib.shell :as shell]))

-(declare autotools-handler)
-
-(def handlers '(autotools-handler))
+(def handlers [repo-handler autotools-handler])

 (defn run-handlers
   "Run all the handlers on a definition"
   [config]
-  (map #(% config) handlers))
+  (for [h handlers] (h config)))

 (defn process-handlers
@@ -25,8 +24,39 @@
     subdir :subdir
     configurations :configurations
     autoconf-version :autoconf-version}]
-  (when (= type "autotools") "print autotools"))
+  (println "autotools handler")
+  (when (= type "autotools") (println "autotools")))

+(defn shell-out [& args]
+  (if (not= (:exit (apply shell/sh :return-map true args)) 0)
+    (throw (Exception. (str "Failed thing: " args)))))
+
+(defn download
+  "Download a file, and save it to a known filename"
+  [remote-file local-file]
+  (shell-out "curl" remote-file "-o" local-file "-s"))
+
+(defn untar
+  "Untar a file, into directory"
+  [tar-file directory]
+  (shell-out "tar" "jxf" tar-file "-C" directory))
+
+(defn tar-get-directory
+  "Find the name of the directory that wraps the tar"
+  [tar-file]
+  (shell-out "tar" "tf" tar-file "|" "head" "-n" "1" "|" "sed" "'s/\\.*$//'"))
+
+
+(defn repo-handler
+  [{repo :repo
+    subdir :subdir}]
+  (let [dir "scratch/"
+        tar-file (str dir "tip.tar.bz2")]
+                                        ; for now, assume it's mercurial
+    (do
+      (download (str repo "/archive/tip.tar.bz2") tar-file)
+      (untar tar-file dir)
+      (tar-get-directory tar-file))))

 (defn init [& argv]
@@ -35,8 +65,9 @@
       io/reader
       slurp
       yaml/parse-string
-      process-handlers))
+      process-handlers
+      println))

-(defn -main [& argv]
+(defn -main []
   (init *command-line-args*))


bar for displaying remaining times

bar for displaying remaining times

--- src/cljs/iwaswhere_web/ui/entry/briefing.cljs
+++ src/cljs/iwaswhere_web/ui/entry/briefing.cljs
@@ -93,7 +93,15 @@
             day-stats (get pomodoro-stats day)
             word-stats (get wordcount-stats day)
             {:keys [tasks-cnt done-cnt closed-cnt]} (get task-stats day)
-            started (:started-tasks-cnt @stats)]
+            started (:started-tasks-cnt @stats)
+            time-allocation (-> entry :briefing :time-allocation)
+            remaining-mapper (fn [[k v]]
+                               (let [allocation (or v 0)
+                                     actual (get-in (:time-by-book day-stats) [k] 0)
+                                     remaining (- allocation actual)]
+                                 [k remaining]))
+            remaining-times (filter #(pos? (second %))
+                                    (map remaining-mapper time-allocation))]
         (when (contains? (:tags entry) "#briefing")
           [:form.briefing-details
            [:fieldset
@@ -115,9 +123,8 @@
                [:strong (:word-count word-stats)] " words written."])
             (when day-stats [time-by-stories-list day-stats])
             [:hr]
-            [:div
-             [horizontal-bar
-              @books :book-name (-> entry :briefing :time-allocation) 0.0045]]
+            [:div [horizontal-bar @books :book-name time-allocation 0.0045]]
+            [:div [horizontal-bar @books :book-name remaining-times 0.0045]]
             [:div
              "Total planned: "
              [:strong


Fix ttl name conflict

Fix ttl name conflict

--- test/clojure/clojurewerkz/cassaforte/new_query_api_test.clj
+++ test/clojure/clojurewerkz/cassaforte/new_query_api_test.clj
@@ -69,7 +69,7 @@
                               distinct*
                               (as "a"))
                           (-> "longName"
-                              ttl
+                              ttl-column
                               (as "ttla")))
                  (limit (? "limit")))))

@@ -88,7 +88,7 @@
   (is (= "SELECT writetime(a),ttl(a) FROM foo ALLOW FILTERING;"
          (select :foo
                  (columns (write-time :a)
-                          (ttl :a))
+                          (ttl-column :a))
                  (allow-filtering))))

@@ -98,7 +98,7 @@
                               (distinct*)
                               (as "a"))
                           (-> "longName"
-                              (ttl)
+                              (ttl-column)
                               (as "ttla")))
                  (where [[:in :k []]])
                  (limit (? "limit")))))
@@ -154,10 +154,10 @@
                  (where {:b (Bytes/fromHexString "0xCAFEBABE")}))))

   (is (thrown? java.lang.IllegalStateException
-       (select :foo
-               (count-all)
-               (order-by (asc "a") (desc "b"))
-               (order-by (asc "a") (desc "b")))))
+               (select :foo
+                       (count-all)
+                       (order-by (asc "a") (desc "b"))
+                       (order-by (asc "a") (desc "b")))))

   (is (thrown? java.lang.IllegalArgumentException
                (select :foo


CMR-311: Added granule attribute time search test.

--- test/cmr/system_int_test/search/granule_psa_search_test.clj
+++ test/cmr/system_int_test/search/granule_psa_search_test.clj
@@ -227,7 +227,66 @@
            ;; only max range provided
            "datetime,bravo," nil 12 [gran1 gran2]))))

-
-
-
-
+(defn make-time
+  "Creates a datetime from a number added onto a base datetime"
+  [n]
+  (when n
+    (format "01:%02d:00.0" n)))
+
+(deftest time-psas-search-test
+  (let [psa1 (dc/psa "alpha" :time)
+        psa2 (dc/psa "bravo" :time)
+        psa3 (dc/psa "charlie" :time)
+        coll1 (d/ingest "PROV1" (dc/collection {:product-specific-attributes [psa1 psa2]}))
+        gran1 (d/ingest "PROV1" (dg/granule coll1 {:product-specific-attributes
+                                                   [(dg/psa "alpha"
+                                                            [(make-time 10) (make-time 23)])
+                                                    (dg/psa "bravo"
+                                                            [(make-time 0)])]}))
+        gran2 (d/ingest "PROV1" (dg/granule coll1 {:product-specific-attributes
+                                                   [(dg/psa "bravo"
+                                                            [(make-time 10) (make-time 23)])]}))
+
+        coll2 (d/ingest "PROV1" (dc/collection {:product-specific-attributes [psa1 psa2 psa3]}))
+        gran3 (d/ingest "PROV1" (dg/granule coll2 {:product-specific-attributes
+                                                   [(dg/psa "alpha"
+                                                            [(make-time 14)])
+                                                    (dg/psa "bravo"
+                                                            [(make-time 13) (make-time 23)])]}))
+        gran4 (d/ingest "PROV1" (dg/granule coll2 {:product-specific-attributes
+                                                   [(dg/psa "charlie"
+                                                            [(make-time 14)])]}))]
+    (index/flush-elastic-index)
+
+    (testing "search by value"
+      (are [v n items]
+           (d/refs-match?
+             items (search/find-refs :granule {"attribute[]" (str v (make-time n))}))
+           "time,bravo," 23 [gran2, gran3]
+           "time,alpha," 11 []
+           "time,bravo," 0 [gran1]))
+
+    (testing "search by range"
+      (are [v min-n max-n items]
+           (let [min-v (make-time min-n)
+                 max-v (make-time max-n)
+                 full-value (str v min-v "," max-v)]
+             (d/refs-match? items (search/find-refs :granule {"attribute[]" full-value})))
+
+           ;; inside range
+           "time,alpha," 9 11 [gran1]
+           ;; beginning edge of range
+           "time,alpha," 10 11 [gran1]
+           ;; ending edge of range
+           "time,alpha," 9 10 [gran1]
+
+           ;; only min range provided
+           "time,bravo," 20 nil [gran2 gran3]
+
+           ;; only max range provided
+           "time,bravo," nil 12 [gran1 gran2]))))
+
+
+
+
+


Macros: Add `if-let` as an example of code transformation.

--- test/com/nomistech/clojure_the_language/macros/examples.clj
+++ test/com/nomistech/clojure_the_language/macros/examples.clj
@@ -81,4 +81,59 @@
 ;;;;   - `if-not` is a macro.
 ;;;;   - `if-not` is better than `my-if-not-1`.
 ;;;;   - Note that much of Clojure is implemented using macros.
-;;;;     e.g. `and`, `or`, `let`, `cond`, `while`, `letfn`, `with-redefs`, `->`.
+;;;;     e.g. `and`, `or`, `let`, `cond`, `while`, `letfn`, `with-redefs`, `->`,
+;;;;          `->>`, `as->`.
+
+;;;; ___________________________________________________________________________
+;;;; ~@ -- unquote-splicing
+
+(fact "Unquote unquotes"
+  (let [x (range 5)]
+    `[:a ~x :b])
+  => '[:a (0 1 2 3 4) :b])
+
+(fact "Unquote-splicing unquotes and splices"
+  (let [x (range 5)]
+    `[:a ~@x :b])
+  => '[:a 0 1 2 3 4 :b])
+
+;;;; ___________________________________________________________________________
+;;;; Code transformation.
+
+(defmacro lisp-let [[& bindings] & body]
+  ;; A very simple-minded implementation -- no error checking.
+  `(let ~(vec (apply concat bindings))
+     ~@body))
+
+(fact
+  (macroexpand-1 '(lisp-let [[a 2]
+                             [b 3]
+                             [c 4]]
+                            (* a b c)))
+  => '(clojure.core/let [a 2
+                         b 3
+                         c 4]
+        (* a b c)))
+
+(fact
+  (lisp-let [[a 2]
+             [b 3]
+             [c 4]]
+            (* a b c))
+  => 24)
+
+;;;; Is this a good use of macros?
+;;;; - Probably not.
+;;;; - I prefer this syntax for `let`-style things, but it's a bad idea to have
+;;;;   lots of little utility macros and functions to make the language the way
+;;;;   you want it.
+;;;;   Use the idioms of the language you are using.
+
+;;;; It's hard to come up with simple examples, because Clojure has so much
+;;;; built in.
+
+;;;; Look at examples:
+;;;; e.g. `and`, `or`, `let`, `cond`, `while`, `letfn`, `with-redefs`, `->`,
+;;;;      `->>`, `as->`.
+
+;;;; Maybe see `try+` and `throw+` in https://github.com/scgilardi/slingshot


Fixed subresource bug

Fixed subresource bug

Didn't survive the handler refactor

Need a test!

--- src/yada/handler.clj
+++ src/yada/handler.clj
@@ -72,7 +72,7 @@
                   :known-methods (:known-methods ctx)
                   ;; TODO: Could/should subresources, which are dynamic, be able
                   ;; to modify the interceptor-chain?
-                  :interceptor-chain (-> ctx :handler :interceptor-chain)})]
+                  :interceptor-chain (-> ctx :interceptor-chain)})]

             (handle-request-with-maybe-subresources
              (-> ctx


Better meadow finder by getting rid of unneeded code

--- src/main/cljc/clojure_club/meadow_finder/mgrimm.cljc
+++ src/main/cljc/clojure_club/meadow_finder/mgrimm.cljc
@@ -1,10 +1,8 @@
 (ns clojure-club.meadow-finder.mgrimm
   (:require
     [clojure.set :as set]
-    [clojure.string :as string]))
-
-(defn ->cave [cave]
-  (reduce (fn [v x] (conj v (string/split x #""))) [] cave))
+    [clojure.string :as string]
+    [clojure-club.meadow-finder.core :as mc]))

 (defn neighbors [[y x]]
   (let [ys ((juxt dec identity inc identity) y)
@@ -13,7 +11,7 @@

 (defn step-meadow [cave [meadow seen [coord & coords]]]
   (if coord
-    (if (= (get-in cave coord) " ")
+    (if (= (get-in cave coord) \space)
       [(conj meadow coord) (conj seen coord) (into coords (set/difference (neighbors coord) seen))]
       [meadow (conj seen coord) coords])
     meadow))
@@ -24,16 +22,16 @@
        (drop-while last)
        ffirst))

-(defn step-cave [cave [meadows seen [coord & coords]]]
+(defn step-cave [cave [meadows [coord & coords]]]
   (let [cell (get-in cave coord)]
     (cond
-      (seen coord) [meadows seen coords]
-      (= cell " ") (let [b (meadow-from cave coord)] [(conj meadows b) (into seen b) coords])
-      :else [meadows (conj seen coord) coords])))
+      (some (partial set/subset? #{coord}) meadows) [meadows coords]
+      (= cell \space) (let [m (meadow-from cave coord)] [(conj meadows m) coords])
+      :else [meadows coords])))

 (defn meadows [cave]
   (let [h (count cave), w (count (first cave))]
-    (->> [[] #{} (for [y (range h), x (range w)] [y x])]
+    (->> [[] (for [y (range h), x (range w)] [y x])]
          (iterate (partial step-cave cave))
          (drop-while last)
          ffirst
@@ -42,5 +40,5 @@
 ;; -----------------------------------------------------------------------------

 (comment
-  (= [[[0 0]] [[1 1]]] (meadows (->cave [" #" "# "]))))
-
+  (= [[[0 0]] [[1 1]]] (meadows mc/meadow-2x2-grid))
+  (meadows mc/meadow-32x32x4))


core: println

core: println

--- data/core.clj
+++ data/core.clj
@@ -1796,3 +1796,10 @@
          of *out*.  print and println produce output for human consumption."
          :added "1.0"}
   print print*)
+
+(defn println
+  "Same as print followed by (newline)"
+  {:added "1.0"}
+  [& more]
+  (apply print more)
+  (newline))


use <? for error detection

use <? for error detection

--- test/server/daveconservatoire/server/parser_tests.cljs
+++ test/server/daveconservatoire/server/parser_tests.cljs
@@ -1,7 +1,7 @@
 (ns daveconservatoire.server.parser-tests
   (:require-macros [cljs.core.async.macros :refer [go]])
   (:require [cljs.test :refer [is are run-tests async testing deftest do-report]]
-            [cljs.core.async :refer [<!]]
+            [cljs.core.async :refer [<?]]
             [pathom.test :refer [async-test]]
             [common.async :refer [<?]]
             [pathom.sql :as ps]
@@ -123,7 +123,7 @@
 (deftest parse-read-not-found
   (async done
     (go
-      (is (= (<! (p/parse {} [:invalid]))
+      (is (= (<? (p/parse {} [:invalid]))
              {:invalid [:error :not-found]}))
       (done))))

@@ -132,39 +132,39 @@
     (is (= (<? (p/parse env [:app/courses]))
            {:app/courses [{:db/id 4 :db/table :course} {:db/id 7 :db/table :course}]}))

-    (is (= (<! (p/parse env [{:app/courses [:db/id :course/title]}]))
+    (is (= (<? (p/parse env [{:app/courses [:db/id :course/title]}]))
            {:app/courses [{:db/id 4 :course/title "Reading Music" :db/table :course}
                           {:db/id 7 :course/title "Music:  A Beginner's Guide" :db/table :course}]}))

-    (is (= (<! (p/parse env [{:app/courses [:db/id :course/title]}]))
+    (is (= (<? (p/parse env [{:app/courses [:db/id :course/title]}]))
            {:app/courses [{:db/id 4 :course/title "Reading Music" :db/table :course}
                           {:db/id 7 :course/title "Music:  A Beginner's Guide" :db/table :course}]}))

-    (is (= (<! (p/parse env [{:app/courses [:db/id :course/home-type]}]))
+    (is (= (<? (p/parse env [{:app/courses [:db/id :course/home-type]}]))
            {:app/courses [{:db/id 4 :course/home-type :course.type/multi-topic :db/table :course}
                           {:db/id 7 :course/home-type :course.type/multi-topic :db/table :course}]}))

-    (is (= (<! (p/parse env [{:app/courses {:course.type/multi-topic  [:db/id :course/home-type]
+    (is (= (<? (p/parse env [{:app/courses {:course.type/multi-topic  [:db/id :course/home-type]
                                             :course.type/single-topic [:db/id :course/title]}}]))
            {:app/courses [{:db/id 4 :course/home-type :course.type/multi-topic :db/table :course}
                           {:db/id 7 :course/home-type :course.type/multi-topic :db/table :course}]}))))

 (deftest test-parse-read-lesson-by-slug
   (async-test
-    (is (= (->> (p/parse env [{[:lesson/by-slug "percussion"] [:db/id :lesson/title]}]) <!)
+    (is (= (->> (p/parse env [{[:lesson/by-slug "percussion"] [:db/id :lesson/title]}]) <?)
            {[:lesson/by-slug "percussion"] {:db/id 9 :db/table :lesson :lesson/title "Percussion"}}))

-    (is (= (->> (p/parse env [{[:lesson/by-slug "percussion"] [:db/id :lesson/type]}]) <!)
+    (is (= (->> (p/parse env [{[:lesson/by-slug "percussion"] [:db/id :lesson/type]}]) <?)
            {[:lesson/by-slug "percussion"] {:db/id 9 :db/table :lesson :lesson/type :lesson.type/video}}))

-    (is (= (->> (p/parse env [{[:lesson/by-slug "invalid"] [:db/id :lesson/title]}]) <!)
+    (is (= (->> (p/parse env [{[:lesson/by-slug "invalid"] [:db/id :lesson/title]}]) <?)
            {[:lesson/by-slug "invalid"] [:error :row-not-found]}))))

 (deftest parser-read-route-data
   (async-test
-    (is (= (<! (p/parse env [{:route/data [:app/courses]}]))
+    (is (= (<? (p/parse env [{:route/data [:app/courses]}]))
            {:route/data {:app/courses [{:db/id 4 :db/table :course} {:db/id 7 :db/table :course}]}}))
-    (is (= (<! (p/parse env [{:ph/anything [:app/courses]}]))
+    (is (= (<? (p/parse env [{:ph/anything [:app/courses]}]))
            {:ph/anything {:app/courses [{:db/id 4 :db/table :course} {:db/id 7 :db/table :course}]}}))))

 (deftest test-read-lesson-union
@@ -174,17 +174,17 @@
                         :lesson.type/exercise [:lesson/type :lesson/title :url/slug]}]
       (is (= (->> (p/parse env
                            [{[:lesson/by-slug "percussion"]
-                             lesson-union}]) <!)
+                             lesson-union}]) <?)
              {[:lesson/by-slug "percussion"]
               {:db/id 9 :db/table :lesson :lesson/title "Percussion" :lesson/type :lesson.type/video}}))
       (is (= (->> (p/parse env
                            [{[:lesson/by-slug "percussion-playlist"]
-                             lesson-union}]) <!)
+                             lesson-union}]) <?)
              {[:lesson/by-slug "percussion-playlist"]
               {:db/id 11 :db/table :lesson :lesson/description "" :lesson/type :lesson.type/playlist}}))
       (is (= (->> (p/parse env
                            [{[:lesson/by-slug "tempo-markings"]
-                             lesson-union}]) <!)
+                             lesson-union}]) <?)
              {[:lesson/by-slug "tempo-markings"]
               {:db/id    67 :db/table :lesson :lesson/title "Exercise: Tempo Markings Quiz" :lesson/type :lesson.type/exercise
                :url/slug "tempo-markings"}})))))
@@ -193,22 +193,22 @@
   (async-test
     (testing "reading me when logged in"
       (is (= (->> (p/parse (assoc env :current-user-id 720
-                                      :http-request (blank-request)) [{:app/me [:db/id]}]) <!
+                                      :http-request (blank-request)) [{:app/me [:db/id]}]) <?
                   :app/me)
              {:db/id 720 :db/table :user})))
     (testing "blank map when user is not signed in"
-      (is (= (->> (p/parse (assoc env :http-request (blank-request)) [{:app/me [:db/id]}]) <!
+      (is (= (->> (p/parse (assoc env :http-request (blank-request)) [{:app/me [:db/id]}]) <?
                   :app/me)
              {:db/id -1})))
     (testing "get score for guest user"
       (testing "zero when there is no information"
-        (is (= (->> (p/parse (assoc env :http-request (blank-request)) [{:app/me [:user/score]}]) <!
+        (is (= (->> (p/parse (assoc env :http-request (blank-request)) [{:app/me [:user/score]}]) <?
                     :app/me)
                {:user/score 0})))
       (testing "sum the scores"
         (let [req (js-obj "session" (js-obj ":guest-tx" (pr-str [{:guest-tx/increase-score 4}
                                                                  {:guest-tx/increase-score 3}])))]
-          (is (= (->> (p/parse (assoc env :http-request req) [{:app/me [:user/score]}]) <!
+          (is (= (->> (p/parse (assoc env :http-request req) [{:app/me [:user/score]}]) <?
                       :app/me)
                  {:user/score 7})))))))


make bootstrap stuff work again

make bootstrap stuff work again

--- src/leiningen/new/yawt/src/root_ns/client/main.cljs
+++ src/leiningen/new/yawt/src/root_ns/client/main.cljs
@@ -1,5 +1,6 @@
 (ns {{root-ns}}.client.main
   (:require
+    cljsjs.bootstrap
     [weasel.repl :as ws-repl]
     [reagent.core :as reagent]
     [secretary.core :as secretary :refer-macros [defroute]]


Add emptiness checks to one-of and frequency

--- src/main/clojure/clojure/test/check/generators.cljc
+++ src/main/clojure/clojure/test/check/generators.cljc
@@ -276,6 +276,8 @@
   [generators]
   (assert (every? generator? generators)
           "Arg to one-of must be a collection of generators")
+  (assert (seq generators)
+          "one-of cannot be called with an empty collection")
   (bind (choose 0 (dec (count generators)))
         #(nth generators %)))

@@ -299,6 +301,8 @@
   (assert (every? (fn [[x g]] (and (number? x) (generator? g)))
                   pairs)
           "Arg to frequency must be a list of [num generator] pairs")
+  (assert (seq pairs)
+          "frequency cannot be called with an empty collection")
   (core/let [total (apply + (core/map first pairs))]
     (gen-bind (choose 1 total)
               #(pick pairs (rose/root %)))))


indentation

indentation

--- src/main/clojure/clojure/test/check/generators.cljc
+++ src/main/clojure/clojure/test/check/generators.cljc
@@ -844,7 +844,7 @@
   [min max]
   (sized (fn [size]
            (core/let [size (core/max size 1) ;; no need to worry about size=0
-                 max-bit-count (core/min size #?(:clj 64 :cljs 54))]
+                      max-bit-count (core/min size #?(:clj 64 :cljs 54))]
              (gen-fmap (fn [rose]
                          (core/let [[bit-count x] (rose/root rose)]
                            (int-rose-tree (long->large-integer bit-count x min max))))


more cleanup

more cleanup

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

--- plugins/SlideExplorer2/src/slide_explorer/view.clj
+++ plugins/SlideExplorer2/src/slide_explorer/view.clj
@@ -215,7 +215,7 @@

 (defn monochrome-loader
   "Loads monochrome tiles needed for drawing."
-  [screen-state-atom memory-tile-atom acquired-images]
+  [screen-state-atom memory-tile-atom]
   (let [visible-tile-positions (tiles/tiles-in-pixel-rectangle
                                  (screen-rectangle @screen-state-atom)
                                  (:tile-dimensions @screen-state-atom))]
@@ -236,8 +236,7 @@
   (let [load-monochrome (fn [_ _]
                           (monochrome-loader
                             screen-state-atom
-                            memory-tile-atom
-                            acquired-images))
+                            memory-tile-atom))
         load-overlay (fn [_ _]
                        (overlay-loader
                          screen-state-atom


Added Polish translation

Added Polish translation

--- src/skat/i18n.clj
+++ src/skat/i18n.clj
@@ -43,7 +43,47 @@
                     :herz   "Herz"
                     :schell "Schell"
                     :null   "Null" } } }
-      :missing  "|Missing translation: [%1$s %2$s %3$s]|" } }
+        :missing  "|Missing translation: [%1$s %2$s %3$s]|" }
+      :pl
+      { :skat
+        { :cli
+          { :answer { :yes "tak"
+                      :no  "nie" }
+            :cards { :allowed! "Dozwolone karty:\n%s"
+                     :owned!   "Posiadane karty:\n%s" }
+            :figure { :r7  " 7"
+                      :r8  " 8"
+                      :r9  " 9"
+                      :r10 "10"
+                      :W   " W"
+                      :D   " D"
+                      :K   " K"
+                      :A   " A" }
+            :player { :cpu-type         "Grach CPU"
+                      :human-type       "Gracz ludzki"
+                      :name             "[Gracz %s]"
+                      :make-bid         "Licytuj (powyżej %d) lub spasuj (17):"
+                      :answer-bid!      "Otrzymany zakład: %d\nPrzyjmujesz?"
+                      :choose-suit      "Wybierz grę:"
+                      :choose-hand      "Czy gra z ręki?:"
+                      :choose-schneider "Czy zapowiedziany schneider?:"
+                      :choose-schwarz   "Czy zapowiedziany schwarz?:"
+                      :choose-ouvert    "Gra otwarta?:"
+                      :swap-skat-card   "Wybierz kartę to wymiany za %s:"
+                      :played           "%s zagrał: %s"
+                      :won-bid          "%s wygrał licytację: %d"
+                      :bid-draw         "Nikt nie wygrał licytacji" }
+            :results { :deal! "Solista: %s\nZakład:  %d\nWygrana: %s"
+                       :game! "Gracz:  %s\nPunkty: %d" }
+            :select { :nth-item    "Wybierz opcję:"
+                      :player-name "Wybierz imię gracza:" }
+            :suit { :grand  "Grand",
+                    :kreuz  "Kreuz"
+                    :grun   "Grün"
+                    :herz   "Herz"
+                    :schell "Schell"
+                    :null   "Null" } } }
+        :missing  "|Brak tłumaczenia: [%1$s %2$s %3$s]|" } }
    :dev-mode? false
    :fallback-locale :en })


fix REPL default logic

fix REPL default logic

--- src/main/shadow/cljs/devtools/server/worker/impl.clj
+++ src/main/shadow/cljs/devtools/server/worker/impl.clj
@@ -844,21 +844,23 @@
 (defn add-runtime
   [worker-state {:keys [client-id client-info] :as msg}]

-  (if (false? (:repl client-info))
-    worker-state
-    (-> worker-state
-        (cond->
-          (or (zero? (count (:runtimes worker-state)))
-              ;; android doesn't disconnect the old websocket for some reason
-              ;; when reloading the app, so instead of sending to a dead runtime
-              ;; we always pick the new one
-              (= :react-native (:host client-info))
-              ;; allow user to configure to auto switch to fresh connected runtimes
-              ;; instead of staying with the first connected one
-              (= :latest (get-in worker-state [:system-config :repl :runtime-select]))
-              (= :latest (get-in worker-state [:system-config :user-config :repl :runtime-select])))
-          (assoc :default-runtime-id client-id))
-        (update :runtimes assoc client-id (assoc client-info :client-id client-id)))))
+  (-> worker-state
+      (cond->
+        ;; don't pick runtime as repl default if opted out
+        (and (not (false? (:repl client-info)))
+             (or (zero? (count (:runtimes worker-state)))
+                 ;; the first connected may have opted out of REPL
+                 (not (:default-runtime-id worker-state))
+                 ;; android doesn't disconnect the old websocket for some reason
+                 ;; when reloading the app, so instead of sending to a dead runtime
+                 ;; we always pick the new one
+                 (= :react-native (:host client-info))
+                 ;; allow user to configure to auto switch to fresh connected runtimes
+                 ;; instead of staying with the first connected one
+                 (= :latest (get-in worker-state [:system-config :repl :runtime-select]))
+                 (= :latest (get-in worker-state [:system-config :user-config :repl :runtime-select]))))
+        (assoc :default-runtime-id client-id))
+      (update :runtimes assoc client-id (assoc client-info :client-id client-id))))

 (defmethod do-relay-msg ::cljs-runtime-notify
   [worker-state {:keys [event-op client-id] :as msg}]


Change :id to :project_id in projects.cljs

--- src-cljs/kixi/hecuba/tabs/hierarchy/projects.cljs
+++ src-cljs/kixi/hecuba/tabs/hierarchy/projects.cljs
@@ -107,7 +107,7 @@
                   [:div [:div {:class "fa fa-exclamation-triangle"} alert-body]]
                   error
                   (str "edit-project-form-failure"))
-           (bs/static-text cursor :id "Project ID")
+           (bs/static-text cursor :project_id "Project ID")
            (bs/static-text cursor :programme_id "Programme ID")
            (bs/static-text cursor :created_at "Created At")
            (bs/text-input-control cursor owner :project :description "Description")
@@ -122,19 +122,19 @@
       om/IRender
       (render [_]
         (html
-         (let [{:keys [id name type_of description
+         (let [{:keys [project_id name type_of description
                        created_at organisation project_code editable]} cursor
-               selected? (= (:selected projects) id)]
+               selected? (= (:selected projects) project_id)]
            [:tr {:onClick (fn [e]
                             (let [div-id (.-id (.-target e))]
-                              (when-not (= div-id (str id "-edit"))
-                                (om/update! projects :selected id)
-                                (history/update-token-ids! history :projects id)
+                              (when-not (= div-id (str project_id "-edit"))
+                                (om/update! projects :selected project_id)
+                                (history/update-token-ids! history :projects project_id)
                                 (common/fixed-scroll-to-element "properties-div"))))
                  :class (when selected? "success")
                  :id (str table-id "-selected")}
             [:td [:div (when editable {:class "fa fa-pencil-square-o"
-                                       :id (str id "-edit")
+                                       :id (str project_id "-edit")
                                        :onClick (fn [_]
                                                   (when selected?
                                                     (put! editing-chan cursor)))})]]
@@ -168,7 +168,7 @@
        [:thead
         [:tr [:th ""] [:th "Name"] [:th "Type"] [:th "Description"] [:th "Created At"] [:th "Organisation"] [:th "Project Code"]]]
        [:tbody
-        (for [row (sort-by :id (:data projects))]
+        (for [row (sort-by :project_id (:data projects))]
           (om/build (project-row data history projects table-id editing-chan) row))]]]]))

 (defmethod projects-table-html :default [_ _ _]
@@ -201,7 +201,7 @@
             editing        (-> data :projects :editing)
             adding-project (-> data :projects :adding-project)
             programme_id   (-> data :active-components :programmes)
-            programme      (-> (filter #(= (:id %) programme_id) (-> programmes :data)) first)]
+            programme      (-> (filter #(= (:programme_id %) programme_id) (-> programmes :data)) first)]
         (html
          [:div.row#projects-div
           [:div {:class (str "col-md-12 " (if programme_id "" "hidden"))}


whitespace

whitespace

--- src/clj_http/client.clj
+++ src/clj_http/client.clj
@@ -107,32 +107,32 @@
     (let [{:keys [status] :as resp} (client req)
           resp-r (assoc resp :trace-redirects (conj trace-redirects url))]
       (cond
-        (= false follow-redirects)
-        resp
-        (not (redirect? resp-r))
-        resp-r
-        (and max-redirects (> redirects-count max-redirects))
-        (if throw-exceptions
-          (throw+ resp-r "Too many redirects: %s" redirects-count)
-          resp-r)
-        (= 303 status)
-        (follow-redirect client (assoc req :request-method :get
-                                       :redirects-count (inc redirects-count))
+       (= false follow-redirects)
+       resp
+       (not (redirect? resp-r))
+       resp-r
+       (and max-redirects (> redirects-count max-redirects))
+       (if throw-exceptions
+         (throw+ resp-r "Too many redirects: %s" redirects-count)
+         resp-r)
+       (= 303 status)
+       (follow-redirect client (assoc req :request-method :get
+                                      :redirects-count (inc redirects-count))
+                        resp-r)
+       (#{301 302 307} status)
+       (cond
+        (#{:get :head} request-method)
+        (follow-redirect client (assoc req :redirects-count
+                                       (inc redirects-count)) resp-r)
+        force-redirects
+        (follow-redirect client (assoc req
+                                  :request-method :get
+                                  :redirects-count (inc redirects-count))
                          resp-r)
-        (#{301 302 307} status)
-        (cond
-          (#{:get :head} request-method)
-          (follow-redirect client (assoc req :redirects-count
-                                         (inc redirects-count)) resp-r)
-          force-redirects
-          (follow-redirect client (assoc req
-                                    :request-method :get
-                                    :redirects-count (inc redirects-count))
-                           resp-r)
-          :else
-          resp-r)
         :else
-        resp-r))))
+        resp-r)
+       :else
+       resp-r))))

 (defn wrap-decompression [client]
   (fn [req]
@@ -170,69 +170,68 @@

 (defmethod coerce-response-output :auto [_ {:keys [status body] :as resp}]
   (assoc resp
-         :body
-         (let [typestring (get-in resp [:headers "content-type"])]
-           (cond
-             (.startsWith (str typestring) "text/")
-             (if-let [charset (second (re-find #"charset=(.*)"
-                                               (str typestring)))]
-                     (String. #^"[B" body ^String charset)
-                     (String. #^"[B" body "UTF-8"))
-
-             (.startsWith (str typestring) "application/clojure")
-             (if-let [charset (second (re-find #"charset=(.*)"
-                                               (str typestring)))]
-                     (read-string (String. #^"[B" body ^String charset))
-                     (read-string (String. #^"[B" body "UTF-8")))
-
-             (and (.startsWith (str typestring) "application/json")
-                  json-enabled?
-                  (unexceptional-status? status))
-             (if-let [charset (second (re-find #"charset=(.*)"
-                                               (str typestring)))]
-                     (json-decode (String. #^"[B" body ^String charset) true)
-                     (json-decode (String. #^"[B" body "UTF-8") true))
-
-             :else
-             (String. #^"[B" body "UTF-8")))))
+    :body
+    (let [typestring (get-in resp [:headers "content-type"])]
+      (cond
+       (.startsWith (str typestring) "text/")
+       (if-let [charset (second (re-find #"charset=(.*)"
+                                         (str typestring)))]
+         (String. #^"[B" body ^String charset)
+         (String. #^"[B" body "UTF-8"))
+
+       (.startsWith (str typestring) "application/clojure")
+       (if-let [charset (second (re-find #"charset=(.*)"
+                                         (str typestring)))]
+         (read-string (String. #^"[B" body ^String charset))
+         (read-string (String. #^"[B" body "UTF-8")))
+
+       (and (.startsWith (str typestring) "application/json")
+            json-enabled?
+            (unexceptional-status? status))
+       (if-let [charset (second (re-find #"charset=(.*)"
+                                         (str typestring)))]
+         (json-decode (String. #^"[B" body ^String charset) true)
+         (json-decode (String. #^"[B" body "UTF-8") true))
+
+       :else
+       (String. #^"[B" body "UTF-8")))))

 (defmethod coerce-response-output :default [as {:keys [status body] :as resp}]
   (cond
-    (keyword? as) (assoc resp :body (String. #^"[B" body "UTF-8"))
-    (string? as)  (assoc resp :body (String. #^"[B" body ^String as))
-    :else (assoc resp :body (String. #^"[B" body "UTF-8"))))
+   (string? as)  (assoc resp :body (String. #^"[B" body ^String as))
+   :else (assoc resp :body (String. #^"[B" body "UTF-8"))))

 (defn wrap-output-coercion [client]
   (fn [{:keys [as] :as req}]
-      (let [{:keys [body] :as resp} (client req)]
-        (if body
-          (coerce-response-output as resp)
-          resp))))
+    (let [{:keys [body] :as resp} (client req)]
+      (if body
+        (coerce-response-output as resp)
+        resp))))

 (defn wrap-input-coercion [client]
   (fn [{:keys [body body-encoding length] :as req}]
     (if body
       (cond
-        (string? body)
-        (client (-> req (assoc :body (StringEntity. body (or body-encoding
-                                                             "UTF-8"))
-                               :character-encoding (or body-encoding
-                                                       "UTF-8"))))
-        (instance? File body)
-        (client (-> req (assoc :body (FileEntity. body (or body-encoding
-                                                           "UTF-8")))))
-        (instance? InputStream body)
-        (do
-          (when-not (and length (pos? length))
-            (throw
-             (Exception. ":length key is required for InputStream bodies")))
-          (client (-> req (assoc :body (InputStreamEntity. body length)))))
-
-        (instance? (Class/forName "[B") body)
-        (client (-> req (assoc :body (ByteArrayEntity. body))))
-
-        :else
-        (client req))
+       (string? body)
+       (client (-> req (assoc :body (StringEntity. body (or body-encoding
+                                                            "UTF-8"))
+                              :character-encoding (or body-encoding
+                                                      "UTF-8"))))
+       (instance? File body)
+       (client (-> req (assoc :body (FileEntity. body (or body-encoding
+                                                          "UTF-8")))))
+       (instance? InputStream body)
+       (do
+         (when-not (and length (pos? length))
+           (throw
+            (Exception. ":length key is required for InputStream bodies")))
+         (client (-> req (assoc :body (InputStreamEntity. body length)))))
+
+       (instance? (Class/forName "[B") body)
+       (client (-> req (assoc :body (ByteArrayEntity. body))))
+
+       :else
+       (client req))
       (client req))))

 (defn content-type-value [type]


Adapt alpha for use with p5js

Adapt alpha for use with p5js

--- src/cljc/quil/core.cljc
+++ src/cljc/quil/core.cljc
@@ -300,7 +300,7 @@
   alpha
   "Extracts the alpha value from a color."
   [color]
-  (.alpha (current-graphics) (unchecked-int color)))
+  (.alpha (current-graphics) color))

 (defn
   ^{:requires-bindings true


make IndexedSeq, Atom printable. refs #78

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -2353,6 +2353,9 @@
   LazySeq
   (-pr-seq [coll opts] (pr-sequential pr-seq "(" " " ")" opts coll))

+  IndexedSeq
+  (-pr-seq [coll opts] (pr-sequential pr-seq "(" " " ")" opts coll))
+
   List
   (-pr-seq [coll opts] (pr-sequential pr-seq "(" " " ")" opts coll))

@@ -2388,7 +2391,11 @@
   (-deref [_] state)

   IMeta
-  (-meta [_] meta))
+  (-meta [_] meta)
+
+  IPrintable
+  (-pr-seq [a opts]
+    (concat  ["#<Atom: "] (-pr-seq state opts) ">")))

 (defn atom
   "Creates and returns an Atom with an initial value of x and zero or


I got 99 problems, but now I got two easier to understand regexen

--- src/cljs_rest/core.cljs
+++ src/cljs_rest/core.cljs
@@ -121,9 +121,12 @@

 (def link-pattern
   "Matches a `link-value` according to https://tools.ietf.org/html/rfc5988#section-5,
-  capturing `URI-Reference` and a `rel` value for `link-param`, ignoring all other
-  `link-param` fields if present."
-  #"(?i)<(.*?)>(?:;\s*(?!rel)[^=]+=\".*?\")*;\s*rel=\"(.*?)\"(?:;\s*[^=]+=\".*?\")*")
+  capturing `URI-Reference`, capturing `link-param` for further processing."
+  #"<(.*?)>(.*?)(?=<|$)")
+
+(def rel-pattern
+  "Matches a `rel` `link-param`, capturing its value"
+  #"(?i);\s*rel=\"(.*?)\"")

 (defn parse-url-query-params [url]
   (let [uri (uri/parse url)
@@ -137,8 +140,9 @@
       (if (empty? matches)
           link
           (reduce
-            (fn [acc [_ url key-str]]
-              (let [k (keyword key-str)
+            (fn [acc [_ url link-params]]
+              (let [[_ rel] (re-find rel-pattern link-params)
+                    k (keyword rel)
                     params (parse-url-query-params url)
                     parsed {:url url}
                     with-params (if (empty? params)


[neko.ui] Accept already created objects in make-ui-element

--- src/clojure/neko/ui.clj
+++ src/clojure/neko/ui.clj
@@ -72,17 +72,19 @@
   to it, then recursively create its subelements and add them to the
   widget."
   [context tree options]
-  (let [[widget-kw attributes & inside-elements] tree
-        _ (assert (and (keyword? widget-kw) (map? attributes)))
-        ;; Remove :constructor-args from attribues since it is used
-        ;; by constructor and is not a real attribute.
-        wdg (construct-element widget-kw context
-                               (:constructor-args attributes))
-        new-opts (apply-attributes widget-kw wdg attributes options)]
-    (doseq [element inside-elements :when element]
-      (.addView ^android.view.ViewGroup wdg
-                (make-ui-element context element new-opts)))
-    wdg))
+  (if (sequential? tree)
+    (let [[widget-kw attributes & inside-elements] tree
+          _ (assert (and (keyword? widget-kw) (map? attributes)))
+          ;; Remove :constructor-args from attribues since it is used
+          ;; by constructor and is not a real attribute.
+          wdg (construct-element widget-kw context
+                                 (:constructor-args attributes))
+          new-opts (apply-attributes widget-kw wdg attributes options)]
+      (doseq [element inside-elements :when element]
+        (.addView ^android.view.ViewGroup wdg
+                  (make-ui-element context element new-opts)))
+      wdg)
+    tree))

 (defn make-ui
   "Takes a tree of elements and creates Android UI elements according


Add vcs-type back to the pusher channel name

--- src-cljs/frontend/pusher.cljs
+++ src-cljs/frontend/pusher.cljs
@@ -43,13 +43,17 @@
 (defn user-channel [user]
   (str "private-" (:login user)))

-(defn build-channel-from-parts [{:keys [project-name build-num]}]
-  (string/replace (str "private-" project-name "@" build-num) "/" "@"))
+(defn build-channel-from-parts
+  [{:keys [project-name build-num vcs-type]}]
+  (let [project-prefix (-> (str "private-" project-name)
+                           (string/replace "/" "@"))
+        vcs-suffix (str "vcs-" vcs-type)]
+    (str project-prefix "@" build-num "@" vcs-suffix)))

 (defn build-channel [build]
   (build-channel-from-parts {:project-name (vcs-url/project-name (:vcs_url build))
                              :build-num (:build_num build)
-                             :vcs-type (:vcs_type build)}))
+                             :vcs-type (name (:vcs_type build))}))

 (def build-messages [:build/new-action
                      :build/update-action


Fix manage project link

Fix manage project link

Don't know why the `#` was there, but removing it seems to have fixed
things

--- src-cljs/frontend/routes.cljs
+++ src-cljs/frontend/routes.cljs
@@ -183,9 +183,8 @@
                                               :org org
                                               :repo repo}))

-  (defroute v1-add-projects #"/add-projects" [_ _ maybe-fragment]
-    (let [_fragment (:_fragment maybe-fragment)]
-      (open-to-inner! nav-ch :add-projects {:tab _fragment})))
+  (defroute v1-add-projects "/add-projects" {:keys [_fragment]}
+    (open-to-inner! nav-ch :add-projects {:tab _fragment}))
   (defroute v1-insights "/build-insights" []
     (open-to-inner! nav-ch :build-insights {}))
   (defroute v1-insights-project #"/build-insights/(gh|bb)/([^/]+)/([^/]+)/([^/]+)" [short-vcs-type org repo branch]


use atom instead of volatile!

use atom instead of volatile!

no default datafy/nav support for volatile!, otherwise
it really doesn't matter at all.

--- src/main/shadow/cljs/devtools/server/supervisor.clj
+++ src/main/shadow/cljs/devtools/server/supervisor.clj
@@ -53,12 +53,12 @@
       (sys-bus/publish! system-bus ::m/supervisor {:op :worker-start
                                                          :build-id build-id})

-      (vswap! workers-ref assoc build-id proc)
+      (swap! workers-ref assoc build-id proc)

       (go (<! proc-stop)
           (sys-bus/publish! system-bus ::m/supervisor {:op :worker-stop
                                                              :build-id build-id})
-          (vswap! workers-ref dissoc build-id))
+          (swap! workers-ref dissoc build-id))

       proc
       )))
@@ -80,7 +80,7 @@
    :classpath classpath
    :npm npm
    :babel babel
-   :workers-ref (volatile! {})})
+   :workers-ref (atom {})})

 (defn stop [{:keys [workers-ref] :as svc}]
   (doseq [[id proc] @workers-ref]


Use gaussian windowing function on FFT.

Use gaussian windowing function on FFT.

--- src/org/playasophy/wonderdome/input/audio.clj
+++ src/org/playasophy/wonderdome/input/audio.clj
@@ -33,6 +33,7 @@
   (let [^FFT fft (FFT. (.bufferSize input) (.sampleRate input))
         ^BeatDetect beats (BeatDetect.)]
     (.logAverages fft 50 3)
+    (.window fft FFT/GAUSS)
     (fn []
       (try
         (loop []


Remove core.async

Remove core.async

--- roles/clojure/files/profiles.clj
+++ roles/clojure/files/profiles.clj
@@ -6,7 +6,6 @@
                        [clj-stacktrace "0.2.8"]
                        [com.cemerick/pomegranate "0.3.0"]
                        [criterium "0.4.2"]
-                       [org.clojure/core.typed "0.2.84"]
                        [org.clojure/tools.namespace "0.2.5"]
                        [org.clojure/tools.nrepl "0.2.7"]
                        [slamhound "1.5.3"]]


Fix call to configure-ssl in request

Fix call to configure-ssl in request

--- src/puppetlabs/http/client/async.clj
+++ src/puppetlabs/http/client/async.clj
@@ -62,7 +62,7 @@
 (defn request
   [opts callback]
   (check-url! (:url opts))
-  (http/request (configure-ssl opts callback)))
+  (http/request (configure-ssl opts) callback))

 (defn- wrap-with-ssl-config
   [method]


fix typo

fix typo

Former-commit-id: 31a8824d34e46a5eec2abfb61f1c6c44ee34b89b

--- src/status_im/contacts/views/new_contact.cljs
+++ src/status_im/contacts/views/new_contact.cljs
@@ -70,7 +70,7 @@
                                                             :icon_ok_blue
                                                             :icon_ok_disabled)}
                                             :style  icon-search}
-                                  :handler #(when valid-contact? dispatch [:add-new-contact (merge {:photo-path (identicon whisper-identity)} new-contact)])}}]
+                                  :handler #(when valid-contact? (dispatch [:add-new-contact (merge {:photo-path (identicon whisper-identity)} new-contact)]))}}]
      [view st/form-container
       [contact-name-input name]
       [contact-whisper-id-input whisper-identity]]


Use proper logging instead of plain old print/println

--- src/zg/server.clj
+++ src/zg/server.clj
@@ -17,16 +17,10 @@
 (require '[clojure.data.json      :as json])
 (require '[clojure.xml            :as xml])
 (require '[clojure.data.csv       :as csv])
+(require '[clojure.tools.logging  :as log])

 (require '[zg.db-interface        :as db-interface])
 (require '[zg.html-renderer       :as html-renderer])
-
-(defn println-and-flush
-    "Original (println) has problem with syncing when it's called from more threads.
-     This function is a bit better because it flushes all output immediatelly."
-    [& more]
-    (.write *out* (str (clojure.string/join " " more) "\n"))
-    (flush))

 (defn get-user-name
     [request]
@@ -65,9 +59,9 @@
           word          (get params "word")
           user-name     (get-user-name request)
           url-prefix    (get-url-prefix request)]
-        (println-and-flush "Incoming cookies: " cookies)
-        (println word)
-        (println search-results)
+        (log/info "Incoming cookies: " cookies)
+        (log/info "Word to search: " word)
+        (log/info "Search results: " search-results)
         (if user-name
             (-> (http-response/response (html-renderer/render-front-page word user-name search-results message url-prefix title emender-page mode))
                 (http-response/set-cookie :user-name user-name {:max-age 36000000})
@@ -329,16 +323,16 @@
      Special value nil / HTTP response 404 is returned in case of any I/O error."
     [file-name content-type]
     (let [file (new java.io.File "www" file-name)]
-        (println-and-flush "Returning file " (.getAbsolutePath file))
+        (log/info "Returning file " (.getAbsolutePath file))
         (if (.exists file)
             (-> (http-response/response file)
                 (http-response/content-type content-type))
-            (println-and-flush "return-file(): can not access file: " (.getName file)))))
+            (log/error "return-file(): can not access file: " (.getName file)))))

 (defn handler
     "Handler that is called by Ring for all requests received from user(s)."
     [request]
-    (println-and-flush "request URI: " (request :uri))
+    (log/info "request URI: " (request :uri))
     (let [uri          (request :uri)
           title        (get-title request)
           emender-page (get-emender-page request)]


cleanup

cleanup

--- src/clojure/zensols/model/execute_classifier.clj
+++ src/clojure/zensols/model/execute_classifier.clj
@@ -243,8 +243,6 @@
                                      :attrib attrib}
                                 e)))))))))

-(-> @x second)
-
 (defn- classify-features
   "Classify a single instance using a trained model.

@@ -263,7 +261,6 @@
           return-keys (:model-return-keys model-conf)]
       (log/tracef "instances: %s" (type instances))
       (set-instance-values (.instance instances 0) features)
-      (reset! x [instances features])
       (->> (cl/classify-instance classifier instances return-keys)
            first
            (merge (if (contains? return-keys :features) {:features features}))


Doubled max points

Doubled max points

--- src/clojush/problems/software/vector_average.clj
+++ src/clojush/problems/software/vector_average.clj
@@ -138,7 +138,7 @@
 (def argmap
   {:error-function (vector-average-error-function vector-average-data-domains)
    :atom-generators vector-average-atom-generators
-   :max-points 800
+   :max-points 1600
    :max-genome-size-in-initial-program 200
    :evalpush-limit 800
    :population-size 1000


CMR-351: Fixed typo.

CMR-351: Fixed typo.

--- src/cmr/search/services/parameter_validation.clj
+++ src/cmr/search/services/parameter_validation.clj
@@ -250,8 +250,8 @@
   "Validates that the equator_crossing_date parameter is a valid date range string."
   [concept-type params]
   (if-let [equator-crossing-date (:equator-crossing-date params)]
-    (parser/date-time-range-string-validation equator-crossing-date))
-  [])
+    (parser/date-time-range-string-validation equator-crossing-date)
+    []))

 (defn boolean-value-validation
   [concept-type params]


missing init-fn for boot devcards

missing init-fn for boot devcards

--- src/devcards/devcards_om_next/devcards/core.cljs
+++ src/devcards/devcards_om_next/devcards/core.cljs
@@ -1,9 +1,12 @@
 (ns devcards-om-next.devcards.core
   (:require [devcards-om-next.core :refer-macros [defcard-om-next om-next-root]]
-            [devcards.core :as dc :refer-macros [defcard-doc defcard]]
+            [devcards.core :as dc :refer-macros [start-devcard-ui! defcard-doc defcard]]
             [om.next :as om :refer-macros [defui ui]]
             [om.dom :as dom]
             [sablono.core :as sab :include-macros true]))
+
+(defn init! []
+  (start-devcard-ui!))

 (defcard-doc
    "## Rendering Om Next components with `om-next-root` and `defcard-om-next`


STORM-297: Add a comment about why using java collection directly in clojure

--- storm-core/src/clj/backtype/storm/daemon/worker.clj
+++ storm-core/src/clj/backtype/storm/daemon/worker.clj
@@ -119,6 +119,8 @@
         (fast-list-iter [[task tuple :as pair] tuple-batch]
           (if (local-tasks task)
             (.add local pair)
+
+            ;;Using java objects directly to avoid performance issues in java code
             (let [node+port (get @task->node+port task)]
               (when (not (.get remoteMap node+port))
                 (.put remoteMap node+port (ArrayList.)))