add filters

add filters

--- src/cljs/uberblick/core.cljs
+++ src/cljs/uberblick/core.cljs
@@ -10,6 +10,7 @@
             [reagent.session :as session]
             [secretary.core :as secretary :include-macros true]
             [clojure.walk :as walk]
+            [cljs.pprint :as pprint]

             [cljs.tools.reader :refer [read-string]]
             [cljs.js :refer [empty-state eval js-eval]])
@@ -20,7 +21,9 @@
 ;; State

 (defonce people-atom (atom []))
-
+(defonce filters (atom ["(.startsWith :Name \"Ma\")"]))
+(def all-profile-keys '(:IsObjectivesAdmin :LaborCategoryID :FirstName :LaborRoleID :OversightPercent :WorkTeamID :BusinessUnitName :MobileNumber :PhotoFileName :IsCandidateAdmin :CanCommunicateClient :UserSystemID :Email :CreatedDate :BillingTargetHoursPerYear :Title :MobileNumberCountryCode :IsClient :IsScheduleConfirmationRulesEnforced :LastName :IsScheduleAdmin :UserName :Extension :TimeZoneName :HomeNumber :IsNotAPerson :UserID :KeyscanUpdated :HasDirectReports :IsAdmin :BusinessUnitID :CountryID :CompanyBusinessUnitID :TimeZoneID :PhotoPath :Name :Roles :CompanyBusinessUnitName :IsWeeklyReviewAdmin :Enabled :TagName :Supervisors :KeyscanStatus :OutOfOfficeReason :Status))
+; (take! (genome/<get-all-active-klickster-profiles) (fn [profiles] (->> (apply merge profiles ) keys prn)))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Actions
@@ -53,34 +56,63 @@
         (fn [result] result)))

+;; Todo: Add ":my-bla"
 (defn create-filter-fn
-  "creates a filter function thing"
-  [keys expr]
+  "Creates a filter function of the form:
+  (fn [user] expr-as-fn)
+  from a string 'expr' with one twist:
+  If a keyword is part of the passed-in 'keys' vector then this keyword will be transformed into a lookup of the 'user' binding.
+  For instance, calling
+  (create-filter-fn [:Name]  \"(.startsWith :Name \"Max\")\")
+  will result in a function like
+  (fn [user] (.startsWith (:name user) \"Max\"))
+
+  This can be later used to filter genome users by arbitrary criteria at runtime
+  "
+  [thekeys expr]
   (let [my-user (gensym "user")
         replace-where-appropriate (fn [sym]
                                     (cond
                                       (not (keyword? sym)) sym
-                                      (some #{sym} keys) `(~sym ~my-user)
+                                      (some #{sym} thekeys) `(~sym ~my-user)
                                       :else sym))]
     (->>
      (read-string expr)
      (walk/postwalk replace-where-appropriate ,,,)
      ((fn [new-expr]
-        `(fn [~my-user] ~new-expr)) ,,,))))
-
-
-(def exp "(.startsWith :Name \"Max\")")
-(defn try-filter []
-  (= '({:Name "Maximilian"})
-     (filter
-      (create-filter-fn [:Name] exp)
-      [{:Name "Bob"} {:Name "Maximilian"}]))
-  )
+         `(fn [~my-user] ~new-expr)))
+     (eval-str))))
+
+

 ;; Todo:
 ;; partition-by :KeyscanStatus. Then display and add filters.
 ;; add a <users-details test data set monday morning
 ;; partition the users by 200
+
+(defn filtered-people-atom []
+  (if-not (empty? @filters)
+    (let [my-filters (map #(create-filter-fn all-profile-keys %) @filters)]
+      (for [[floor people] @people-atom]
+        [floor (filter (apply every-pred my-filters) people)]))
+    @people-atom))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; filter functions
+(defn add-filter
+  [filter-str]
+  (swap! filters conj filter-str))
+
+(defn vec-remove
+  "remove elem in coll"
+  [coll pos]
+  (vec (concat (subvec coll 0 pos) (subvec coll (inc pos)))))
+
+(defn remove-filter
+  [idx]
+  (when @filters
+    (reset! filters
+            (vec-remove @filters idx))))

 ;; -------------------------
@@ -94,7 +126,8 @@
                   :height 100
                   :background-image (str "url(" (:PhotoPath user) ")")
                   :background-size "100% auto"
-                  :background-repeat :no-repeat}}]
+                  :background-repeat :no-repeat}
+          :on-click #(.open js/window (genome/profile-link user))}]
    [:span {:style {:width "100%"
                    :font-size 16}}
     (:FirstName user)]])
@@ -112,7 +145,7 @@

 (defn home-page []
   [:div
-   (for [[floor people] @people-atom]
+   (for [[floor people] (filtered-people-atom)]
     ^{:key floor} [Floor floor people])])

 (defn About
@@ -131,6 +164,47 @@

 (defn about [] (About))

+(defn prettify [data]
+  (with-out-str (cljs.pprint/pprint data)))
+
+(defn Instructions
+  []
+  (let [current-profile (atom "Nothing here")]
+    (go
+      (let [profile (<! (genome/<current-user-profile))]
+        (prn 'current-profile '=> profile)
+        (reset! current-profile (-> profile prettify ))
+        ))
+    (fn []
+      [:div
+       [:p "Here is a list of all available attributes:"
+        [:p (str all-profile-keys)]
+        "And for the record, here is your profile:"]
+       [:pre @current-profile]])))
+
+(defn New-Filter-Field []
+  (let [inputatm (atom "")]
+    [:div.row
+     [:input.col.s9.offset-s1 {:type "text"
+                      :placeholder "Add a new filter"
+                      :on-change #(reset! inputatm (-> % .-target .-value))}]
+     [:button.col.s1.btn {:on-click #(add-filter @inputatm)} "Add"]]))
+
+(defn Current-Filters []
+  [:ul.collection
+   (map-indexed (fn [idx filter]
+                  ^{:key filter}
+                  ;; [:li (str filter)]
+                  [:li.collection-item (str filter) [:a.secondary-content {:on-click #(remove-filter idx)} [:i.material-icons "delete"]]]) @filters)])
+
+(defn Filters []
+  [:div
+   [:h3 "Filters"]
+   [Current-Filters]
+   [New-Filter-Field]
+   [:hr]
+   [:h3 "References"]
+   [Instructions]])

 (defn current-page []
   [:div [(session/get :current-page)]])
@@ -146,6 +220,8 @@
 (secretary/defroute "/about" []
   (session/put! :current-page #'about))

+(secretary/defroute "/filters" []
+  (session/put! :current-page #'Filters))
 ;; -------------------------
 ;; History
 ;; must be called after routes have been defined


refactoring: no need to "amend" the pieces with screen-pos, just calculate when needed

--- src/glory_of_empires/map.clj
+++ src/glory_of_empires/map.clj
@@ -118,11 +118,8 @@
     { :x (* logical-x tile-width 0.75)
       :y (* tile-height (+ (* logical-x 0.5) logical-y)) } )

-(defn- add-screen-coord [ { pos :logical-pos :as piece } ]
-  (assoc piece :screen-pos (screen-pos pos) ))
-
 (defn- tile-on-table? [ piece map-size ]
-  (let [ { { x :x y :y } :screen-pos } (add-screen-coord piece) ]
+  (let [ { x :x y :y } (screen-pos (:logical-pos piece)) ]
     (< (distance x y) (* tile-height map-size 1.01 ))))

 (defn- random-system [ x y ]
@@ -147,19 +144,19 @@

 ;------------------ to svg ------------------------

-(defn- piece-to-svg [ { { x :x y :y } :screen-pos system :system :as tile } ]
-  [ :image { :x (int x) :y (int y) :width tile-width :height tile-height
-             "xlink:href" (str resources-url "Tiles/" (system :image)) } ] )
+(defn- piece-to-svg [ { logical-pos :logical-pos system :system :as tile } ]
+  (let [ { x :x y :y } (screen-pos logical-pos) ]
+    [ :image { :x (int x) :y (int y) :width tile-width :height tile-height
+               "xlink:href" (str resources-url "Tiles/" (system :image)) } ] ))

 (defn map-to-svg [ map-pieces ]
-  (let [ pieces2 (map add-screen-coord map-pieces)
-         { min-x :x min-y :y } (min-pos (map :screen-pos pieces2))
+  (let [ { min-x :x min-y :y } (->> map-pieces (map :logical-pos) (map screen-pos) (min-pos))
          counter-translate (str (- min-x) "," (- min-y)) ]
     [ :html {}
       [ :body { :style "background: #202020;" }
         [ :svg { :width 1500, :height 1000, "xmlns:xlink" "http://www.w3.org/1999/xlink" }
           (concat [ :g { :transform (str "scale(0.5) translate(" counter-translate ")") } ]
-                  (map piece-to-svg pieces2)) ] ] ] ))
+                  (map piece-to-svg map-pieces)) ] ] ] ))

 ;----------------- web server ----------------------

@@ -169,7 +166,7 @@
   (println (pretty-pr request))
   {:status 200
    :headers {"Content-Type" "text/html"}
-   :body big-map } )
+   :body (xml-to-text (map-to-svg (make-random-map 3))) } )

 (defn -main [& args]


Depend on Clojure 1.6.0

Depend on Clojure 1.6.0

--- metrics-clojure-core/project.clj
+++ metrics-clojure-core/project.clj
@@ -1,6 +1,6 @@
 (defproject metrics-clojure "1.1.0-SNAPSHOT"
   :description "A Clojure façade for Coda Hale's metrics library."
-  :dependencies [[org.clojure/clojure "1.5.1"]
+  :dependencies [[org.clojure/clojure "1.6.0"]
                  [com.yammer.metrics/metrics-core "2.2.0"]]
   :repositories {"repo.codahale.com" "http://repo.codahale.com"
                  ;; to get Clojure snapshots
@@ -12,7 +12,7 @@
                                        :releases {:checksum :fail :update :always}}}
     :profiles {:1.3    {:dependencies [[org.clojure/clojure "1.3.0"]]}
                :1.4    {:dependencies [[org.clojure/clojure "1.4.0"]]}
-               :1.6    {:dependencies [[org.clojure/clojure "1.6.0-master-SNAPSHOT"]]}
+               :1.5    {:dependencies [[org.clojure/clojure "1.5.1"]]}
                :master {:dependencies [[org.clojure/clojure "1.6.0-master-SNAPSHOT"]]}}
-  :aliases  {"all" ["with-profile" "+dev:+1.3:+1.4:+1.6:+master"]}
+  :aliases  {"all" ["with-profile" "+dev:+1.3:+1.4:+1.5:+master"]}
   :global-vars {*warn-on-reflection* true})


CMR-1809: Fixed Content-Length for pretty print response.

--- common-app-lib/src/cmr/common_app/api/routes.clj
+++ common-app-lib/src/cmr/common_app/api/routes.clj
@@ -110,7 +110,7 @@
   (let [new-body (f (:body response))]
     (-> response
         (assoc-in [:body] new-body)
-        (assoc-in [:headers "Content-Length"] (str (count new-body))))))
+        (assoc-in [:headers "Content-Length"] (str (count (.getBytes new-body "UTF-8")))))))

 (defn- pretty-print-body


Tweak slides

Tweak slides

--- src/honeysql_talk/slides.clj
+++ src/honeysql_talk/slides.clj
@@ -99,35 +99,35 @@
     [:section
      [:p "Basic HoneySQL"]
      [:p "Inserts"
-      (clj-code
-       (-> (insert-into :cities)
-           (values {:name "Chicago" :pizza-rank 1}
-                   {:name "New York" :pizza-rank 2})))
-      (clj-code
-       (-> (insert-into :cities)
-           (columns :name :pizza-rank)
-           (values ["Chicago" 1]
-                   ["New York" 2])))]
+       (clj-code
+        (-> (insert-into :cities)
+            (values {:name "Chicago" :pizza-rank 1}
+                    {:name "New York" :pizza-rank 2})))
+       (clj-code
+        (-> (insert-into :cities)
+            (columns :name :pizza-rank)
+            (values ["Chicago" 1]
+                    ["New York" 2])))]
      [:p "Updates"
-      (clj-code
-       (-> (update :cities)
-           (sset {:rank 1})
-           (where [:= :name "New York"])))
-      (clj-code
-       (-> (update :daily-sales)
-           (sset {:total (call :+ :total 1)})
-           (where [:= :date (raw "current_date")])))]
+       (clj-code
+        (-> (update :cities)
+            (sset {:rank 1})
+            (where [:= :name "New York"])))
+       (clj-code
+        (-> (update :daily-sales)
+            (sset {:total (call :+ :total 1)})
+            (where [:= :date (raw "current_date")])))]
      [:p "Queries"
-      (clj-code
-       (-> (select :c.name, :c.pizza-rank, :p.population)
-           (from [:cities :c])
-           (join [:population :c] [:= :c.name :p.city-name])
-           (order-by [:c.pizza-rank :asc])
-           (limit 1)))]
+       (clj-code
+        (-> (select :c.name, :c.pizza-rank, :p.population)
+            (from [:cities :c])
+            (join [:population :c] [:= :c.name :p.city-name])
+            (order-by [:c.pizza-rank :asc])
+            (limit 1)))]
      [:p "Deletes"
-      (clj-code
-       (-> (delete-from :cities)
-           (where [:< :rank 1])))]]
+       (clj-code
+        (-> (delete-from :cities)
+            (where [:< :rank 1])))]]
     [:section
      [:p "HoneySQL Provides An AST"]
      (clj-code
@@ -248,7 +248,7 @@
             (values {:event 232391630
                      :meta (value {"keywords" ["USA" "Illinois" "Chicago" "softwaredev" "Clojurians" "Meetup"]
                                    "geo.position" ["41.881966" "-87.632362"]})})))]
-      [:li "Vectors are handled by the individual clause. When it makes sense, it is used for aliasing."
+      [:li.fragment "Vectors are handled by the individual clause. When it makes sense, it is used for aliasing."
        (clj-code
         (from [:foo :f]))
        (clj-code
@@ -266,7 +266,7 @@
                                  args
                                  (cons {} args))]
              (assoc m :union (vec queries)))))]
-       [:li "Raw SQL access is available, see " [:a {:href "https://crossclj.info/doc/honeysql/latest/honeysql.core.html#_raw"} [:code "honeysql.core/raw"]]
+       [:li.fragment "Raw SQL access is available, see " [:a {:href "https://crossclj.info/doc/honeysql/latest/honeysql.core.html#_raw"} [:code "honeysql.core/raw"]]
         (clj-code
          (raw "current_date"))
         [:pre [:code "#sql/raw \"current_date\""]]]]]
@@ -333,19 +333,18 @@
       [:li [:a {:href "https://github.com/krisajenkins/yesql"} "yesql"]
        [:ul
         [:li "SQL is already a DSL, why do we need another abstraction?"]
-        [:li "parses SQL into clojure functions"]
-        [:li "kinda leaky"]]]
+        [:li "parses SQL into clojure functions"]]]
       [:li [:a {:href "http://hugsql.com/"} "HugSQL"]
        [:ul
         [:li "inspired by yesql"]
         [:li "parses SQL into clojure functions"]
-        [:li "supports vastly more SQL than yesql"]
+        [:li "supports more use cases than yesql"]
         [:li "actively maintained"]]]]]
     [:section
      [:p "Exercises"]
      [:br]
      [:p "See " [:a {:href "https://github.com/emidln/honeysql-talk"} "this talk's github"]
-      " for examples of extending and using HoneySQL using " [:a {:href "https://pgexercises.com"} "PGExercises.com"]]]))
+      " for examples of extending and using HoneySQL using " [:a {:href "https://pgexercises.com"} "PGExercises.com. A Dockerfile is included with instructions in the README.md to get started."]]]))

 (defn render
   []


refactor

refactor

--- src/leiningen/namespaces.clj
+++ src/leiningen/namespaces.clj
@@ -193,46 +193,48 @@
     (update-resource! resource target-project source-project-desc (project-clj-of target-projects-desc target-project)))
   (m/info "*\n****************************************************************\n"))

-(defn aggregate-result [result ns p]
-  (if (contains? result ns)
-    (assoc result ns (merge-with str p (get result ns)))
-    (assoc result ns p)))
-
-(defn reduce-occurence
-  ([ns-occurence] (reduce-occurence ns-occurence {}))
-  ([[[ns p] & r] result]
-   (let [aggregated-result (aggregate-result result ns p)]
-     (if (empty? r)
+(defn aggregate [result [namespace project]]
+  (let [project-occurence (if (contains? result namespace)
+                            (merge-with str project (get result namespace))
+                            project)]
+    (assoc result namespace project-occurence)))
+
+(defn merge-project-occurence
+  ([data] (merge-project-occurence data {}))
+  ([[first & rest] result]
+   (let [aggregated-result (aggregate result first)]
+     (if (empty? rest)
        aggregated-result
-       (recur r aggregated-result)))))
-
-(defn determin-occurence [projects resource-selector]
+       (recur rest aggregated-result)))))
+
+(defn resource-name->project [projects selector]
   (let [initial-m (zipmap (keys projects) (take (count projects) (repeat "")))]
     (reduce-kv
      (fn [m project desc]
        (into m
-             (map (fn [ns] [(keyword ns)
-                            (merge-with str {project "X"} initial-m)])
-                  (get-in desc resource-selector))))
+             (map (fn [ns]
+                    [(keyword ns)
+                     (merge-with str {project "X"} initial-m)])
+                  (get-in desc selector))))
      []
      projects)))

-(defn pretty-print-table [m]
+(defn ->pretty-print-structure [data]
   (reduce-kv
-   (fn [m k v]
-     (conj m (merge {:name (name k)} v)))
+   (fn [m k v] (conj m (merge {:name (name k)} v)))
    []
-   m))
-
-(defn log-resouces-table [m]
+   data))
+
+(defn log-resouces-table [m selector]
+  (m/info "\n* List of" (name (last selector)))
   (pp/print-table (sort-by :name m))
   (m/info "\n"))

-(defn build-resource-table [projects resource-selector]
+(defn build-resource-table [projects selector]
   (-> projects
-      (determin-occurence resource-selector)
-      (reduce-occurence)
-      (pretty-print-table)))
+      (resource-name->project selector)
+      (merge-project-occurence)
+      (->pretty-print-structure)))

 ;;;;; Command Actions ;;;;;

@@ -319,9 +321,10 @@
     (m/info "To commit      : lein sync" passed-projects "--commit")
     (m/info "To push        : lein sync" passed-projects "--push")))

-(defn list-resources [all-projects-desc selector]
-  (m/info "\n* List of" (name (last selector)))
-  (log-resouces-table (build-resource-table all-projects-desc selector)))
+(defn list-resources [projects-desc selector]
+  (-> projects-desc
+      (build-resource-table selector)
+      (log-resouces-table selector)))

 ;;;;; Sync Commands ;;;;;

@@ -372,9 +375,9 @@
                          (map :project)
                          (str/join ",")))))

-(defn list [target-projects {source-project-name :name :as source-project-desc}]
+(defn list [target-projects {source-project :name :as source-project-desc}]
   (let [all-projects-desc (-> target-projects
                               (read-all-target-project-clj)
-                              (assoc (keyword source-project-name) source-project-desc))]
+                              (assoc (keyword source-project) source-project-desc))]
     (list-resources all-projects-desc namespace-def)
     (list-resources all-projects-desc resource-def)))


Better error message when you don't nest dependencies correctly.

Thanks to abedra for "reporting" this bug. =)

--- src/leiningen/util/maven.clj
+++ src/leiningen/util/maven.clj
@@ -1,5 +1,5 @@
 (ns leiningen.util.maven
-  (:use [leiningen.core :only [repositories-for]]
+  (:use [leiningen.core :only [repositories-for abort]]
         [clojure.java.io :only [file reader]])
   (:import [org.apache.maven.model Build Model Parent Dependency
             Exclusion Repository Scm License MailingList Resource]
@@ -144,8 +144,11 @@
 dependency (as a string). The value for the :exclusions key, if
 present, is a seq of symbols, identifying group ids and artifact ids
 to exclude from transitive dependencies."
-  [[dep version & extras]]
-  (let [extras-map (apply hash-map extras)
+  [dependency]
+  (when-not (vector? dependency)
+    (abort "Dependencies must be specified as vector:" dependency))
+  (let [[dep version & extras] dependency
+        extras-map (apply hash-map extras)
         exclusions (:exclusions extras-map)
         classifier (:classifier extras-map)
         type (:type extras-map)


talisman move speed

talisman move speed

--- src/lolitemsets/overlay.cljs
+++ src/lolitemsets/overlay.cljs
@@ -8,7 +8,7 @@
    3092 {:stats {:PercentMPRegenMod 0.5}} ;Frost Queen's Claim
    3222 {:stats {:PercentMPRegenMod 1}} ;Mikael's Crucible
    3165 {:stats {:PercentMPRegenMod 1}} ;Morellonomicon
-   3069 {:stats {:PercentMPRegenMod 1}} ;Talisman of Ascension
+   3069 {:stats {:PercentMPRegenMod 1 :FlatMovementSpeedMod 20}} ;Talisman of Ascension

    3003 {:stats {:PercentMPRegenMod 0.5 :FlatMPPoolMod 1000}} ;Archangel's Staff - stacked
    3004 {:stats {:PercentMPRegenMod 0.25 :FlatMPPoolMod 1000}} ;Manamune - stacked


Change template-for macro to use doseq not for

--- src/main/clojure/cascade.clj
+++ src/main/clojure/cascade.clj
@@ -58,9 +58,9 @@
     `(fn ~fn-params (template ~@template-forms)))

 (defmacro template-for
-  "A combination of a for list comprehension with the template macro: the body of the for is template DSL."
+  "Executes a doseq on the bindings, with the body evaluated as an implicit template."
   [bindings & template-forms]
-  `(combine (for ~bindings (template ~@template-forms))))
+  `(doseq ~bindings (template ~@template-forms)))

 (def #^{:doc "A DOM text node for a line break."}
   linebreak


[#2620] Refactor

[#2620] Refactor

--- backend/src/akvo/lumen/lib/aggregation/pie.clj
+++ backend/src/akvo/lumen/lib/aggregation/pie.clj
@@ -9,7 +9,7 @@
   [tenant-conn {:keys [columns table-name]} query]
   (let [filter-sql    (sql-str columns (:filters query))
         bucket-column (find-column columns (:bucketColumn query))
-        query         (format "SELECT %1$s, count(*) FROM %2$s WHERE %3$s GROUP BY %1$s"
+        query         (format "SELECT %1$s as x, count(*) FROM %2$s WHERE %3$s GROUP BY x"
                               (sql-option-bucket-column bucket-column) table-name filter-sql)
         counts        (run-query tenant-conn query)
         max-segments  50]


Fix names.

Fix names.

--- src/fhofherr/clj_db_util/db.clj
+++ src/fhofherr/clj_db_util/db.clj
@@ -3,8 +3,8 @@

 (defn from-datasource
   "Create an object representing a database for use by clj-db-utils functions."
-  [d ^DataSource ds & {:as options}]
-  {::dialect d
+  [dialect ^DataSource ds & {:as options}]
+  {::dialect dialect
    ::db-spec {:datasource ds}})

 (defn from-db-spec
@@ -13,9 +13,9 @@

   **Warning**: This function is mostly for internal use. Clients should not
   need to call it! Use [[from-datasource]] instead!"
-  [d dbs]
-  {::dialect d
-   ::db-spec dbs})
+  [dialect db-spec]
+  {::dialect dialect
+   ::db-spec db-spec})

 (defn db-spec
   [db]


linter

linter

--- src/java_time/defconversion.clj
+++ src/java_time/defconversion.clj
@@ -53,11 +53,11 @@
   (g/types (map type xs)))

 (defn ^:internal call-conversion [nm tp args]
-  (if-let [[path fn] (g/conversion-fn
+  (if-let [[path f] (g/conversion-fn
                        @graph
                        (types-of args)
                        (g/types [tp]))]
-    (or (try (first (fn args))
+    (or (try (first (f args))
              (catch Exception e
                (throw
                  (ex-info "Conversion failed"


do not ignore ':no-colors' flag.

do not ignore ':no-colors' flag.

--- src/leiningen/ancient/utils.clj
+++ src/leiningen/ancient/utils.clj
@@ -141,8 +141,12 @@
          fx# ~fixed]
      (-> (defn ~sym
            [project# & args#]
-           (when-let [~opts (parse project# args#
+           (when-let [opts# (parse project# args#
                                    :exclude ex#
                                    :fixed fx#)]
-             ~@body))
+             (if (:colors? opts#)
+               (color/enable!)
+               (color/disable!))
+             (let [~opts opts#]
+               ~@body)))
          (cli/doc! ~docstring :exclude ex#))))


Permit custom entry point servlet names as a project.clj directive.

--- src/leiningen/appengine_new.clj
+++ src/leiningen/appengine_new.clj
@@ -34,7 +34,7 @@
         WEB-INF-dir (File. resources-dir "WEB-INF")
         prj-application (or (:appengine-application project) (:name project))
         prj-display-name (or (:appengine-display-name project) (:name project))
-        prj-servlet "app_servlet"]
+        prj-servlet (or (:appengine-entry-servlet project) "app_servlet")]
     (println "making a skeleton for a Google App Engine application")
     ;; set up the required paths
     (when-not (.exists resources-dir)


cljs.compiler alias in cljs.core macros file

--- src/main/clojure/cljs/core.cljc
+++ src/main/clojure/cljs/core.cljc
@@ -46,7 +46,7 @@
   (:require clojure.walk
             clojure.set
             [clojure.string :as string]
-            cljs.compiler
+            [cljs.compiler :as comp]
             [cljs.env :as env]
             #?(:cljs [cljs.core :as core])
             #?(:cljs [cljs.analyzer :as ana])))
@@ -707,7 +707,7 @@
             (core/number? default)
             (core/true? default)
             (core/false? default)) "a string, number or boolean as default value")
-  (core/let [defname (cljs.compiler/munge (core/str *ns* "/" sym))
+  (core/let [defname (comp/munge (core/str *ns* "/" sym))
              type    (core/cond
                        (core/string? default) "string"
                        (core/number? default) "number"
@@ -1258,7 +1258,7 @@
              this-sym (gensym "_")
              locals   (keys (:locals &env))
              ns       (core/-> &env :ns :name)
-             munge    cljs.compiler/munge]
+             munge    comp/munge]
     `(do
        (when-not (exists? ~(symbol (core/str ns) (core/str t)))
          (deftype ~t [~@locals ~meta-sym]
@@ -2602,7 +2602,7 @@
                          (= quote1 'quote) (core/symbol? sym))
     "Arguments to ns-unmap must be quoted symbols")
   (swap! env/*compiler* update-in [::ana/namespaces ns :defs] dissoc sym)
-  `(js-delete ~(cljs.compiler/munge ns) ~(cljs.compiler/munge (core/str sym))))
+  `(js-delete ~(comp/munge ns) ~(comp/munge (core/str sym))))

 (core/defmacro vswap!
   "Non-atomically swaps the value of the volatile as if:


fix logging in production

fix logging in production

--- src/name_bazaar/ui/core.cljs
+++ src/name_bazaar/ui/core.cljs
@@ -23,9 +23,9 @@
 (def debug? ^boolean js/goog.DEBUG)

 (defn dev-setup []
+  (d0x-logging/setup! ui-db/log-level)
   (when debug?
     (enable-console-print!)
-    (d0x-logging/setup! ui-db/log-level)
     (enable-re-frisk!)))

 (defn mount-root []


Fixed k accumulators for non-diagonal a matrices.

--- src/numerics/runge_kutta.clj
+++ src/numerics/runge_kutta.clj
@@ -52,14 +52,26 @@

 ;; http://en.wikipedia.org/wiki/List_of_Runge–Kutta_methods
 (prn "YYYYYYYYY")
-(defn ki [f [tn yn] dt a c k]
-  (let [ys (+ yn (* dt (reduce + (map * a k))))]
-    (f (into [(+ tn (* dt c))] [ys]))))
+(defn ki [f [tn & yn] dt a c k]
+  (do
+    ;(prn "iter")
+    ;(prn "yn: " yn)
+    ;(prn (str "a: " a))
+    ;(prn (str "c: " c))
+    ;(prn (str "k: " k))
+    (let [t (+ tn (* dt c))
+          dy (map #(* dt (reduce + (map * a %))) k)
+          ys (map + yn dy)]
+      (f (into [t] ys)))))

-(defn ks1 [f [tn yn] dt { :keys [a c] }]
-  (loop [ks [] ai a ci c]
+(defn ks1 [f ic dt { :keys [a c] }]
+  (let [fsys (apply juxt f)]
+    (loop [ks (repeat (count f) []) ai a ci c]
     (if-not (first ci)
       ks
-      (recur (conj ks (ki f [tn yn] dt (first ai) (first ci) ks)) (rest ai) (rest ci)))))
+      (recur
+        (map conj ks (ki fsys ic dt (first ai) (first ci) ks))
+        (rest ai)
+        (rest ci))))))

-(prn (ks1 f [0 2] 2 tableaus/cash-karp))+(prn (ks1 [f] [0 2] 2 tableaus/cash-karp))


reify is best practice now, not proxy

reify is best practice now, not proxy

--- src/onyx/messaging/aeron.clj
+++ src/onyx/messaging/aeron.clj
@@ -86,13 +86,13 @@

 (defn fragment-data-handler [f]
   (FragmentAssemblyAdapter.
-    (proxy [FragmentHandler] []
-      (onFragment [buffer offset length header]
+    (reify FragmentHandler
+      (onFragment [this buffer offset length header]
         (f buffer offset length header)))))

 (defn data-handler [f]
-  (proxy [FragmentHandler] []
-    (onFragment [buffer offset length header]
+  (reify FragmentHandler
+    (onFragment [this buffer offset length header]
       (f buffer offset length header))))

 (defn backoff-strategy [strategy]
@@ -108,15 +108,15 @@
                                                 (.toNanos TimeUnit/MICROSECONDS 10000))))

 (defn consumer [handler ^IdleStrategy idle-strategy limit]
-  (proxy [Consumer] []
-    (accept [subscription]
+  (reify Consumer
+    (accept [this subscription]
       (while (not (Thread/interrupted))
         (let [fragments-read (.poll ^uk.co.real_logic.aeron.Subscription subscription ^FragmentHandler handler ^int limit)]
           (.idle idle-strategy fragments-read))))))

 (def no-op-error-handler
-  (proxy [ErrorHandler] []
-    (onError [x] (taoensso.timbre/warn x))))
+  (reify ErrorHandler
+    (onError [this x] (taoensso.timbre/warn x))))

 (defrecord AeronConnection [peer-group bind-addr external-addr
                             inbound-ch send-idle-strategy receive-idle-strategy ports resources


Switch back to dedicated mode now that we have less subscriptions.

--- src/onyx/messaging/aeron.clj
+++ src/onyx/messaging/aeron.clj
@@ -25,7 +25,7 @@
              (false? (opts :onyx.messaging.aeron/embedded-driver)))
       component
       (let [ctx (doto (MediaDriver$Context.)
-                  (.threadingMode ThreadingMode/SHARED)
+                  (.threadingMode ThreadingMode/DEDICATED)
                   (.dirsDeleteOnExit true))
             media-driver (MediaDriver/launch ctx)]
         (assoc component :media-driver media-driver))))


Adding basic helper for creating midi parameter controllers.

--- src/overtone/studio/midi.clj
+++ src/overtone/studio/midi.clj
@@ -81,3 +81,45 @@
     {:notes* notes*
      :on-key on-key
      :off-key off-key}))
+
+(defn- midi-control-handler
+  [state-atom handler mapping msg]
+  (let [[ctl-name scale-fn] (get mapping (:note msg))
+        ctl-val  (scale-fn (:velocity msg))]
+    (swap! state-atom assoc ctl-name ctl-val)
+    (handler ctl-name ctl-val)))
+
+(defn midi-inst-controller
+  "Create a midi instrument controller for manipulating the parameters of an instrument
+  using an external device.  Requires an atom to store the state of the parameters, a
+  handler that will be called each time a parameter is modified, and a mapping table to
+  specify how midi control messages should manipulate the parameters.
+
+  (def ding-mapping
+    {22 [:attack     #(* 0.3 (/ % 127.0))]
+     23 [:decay      #(* 0.6 (/ % 127.0))]
+     24 [:sustain    #(/ % 127.0)]
+     25 [:release    #(/ % 127.0)]})
+
+  (def ding-state (atom {}))
+
+  (midi-inst-controller ding-state (partial ctl ding) ding-mapping)
+  "
+  [state-atom handler mapping]
+  (let [ctl-key (keyword (gensym 'control-change))]
+    (on-event [:midi :control-change]
+              #(midi-control-handler state-atom handler mapping %)
+              ctl-key)))
+
+
+; TODO: remove-handler doesn't seem to work... ask Sam
+(defn stop-player
+  [player]
+  (remove-handler (:on-key player))
+  (remove-handler (:off-key player)))
+
+(defn stop-all-players
+  []
+  (remove-event-handlers [:midi :note-on])
+  (remove-event-handlers [:midi :note-off]))
+


Clean up unnecessary code

Clean up unnecessary code

--- src/photon/default_projs.clj
+++ src/photon/default_projs.clj
@@ -13,10 +13,6 @@
      p
      {(:stream-name n)
       {:total-events 1}})))
-
-(def cambio-updates
-  (sfn/fn [p n]
-    ))

 (def default-projections
   [{:projection-name "__streams__"


updated to the latest version of lib-noir

--- luminus/hello/project.clj
+++ luminus/hello/project.clj
@@ -3,7 +3,7 @@
   "luminus"
   :dependencies
   [[org.clojure/clojure "1.5.1"]
-   [lib-noir "0.5.5"]
+   [lib-noir "0.6.6"]
    [compojure "1.1.5"]
    [ring-server "0.2.8"]
    [selmer "0.3.6"]


Capture body keystrokes.

Capture body keystrokes.

--- src/mash_commander/core.cljs
+++ src/mash_commander/core.cljs
@@ -9,7 +9,10 @@
 (enable-console-print!)

 (defonce app-state
-  (atom {:line ["m" "a" "s" "h"]}))
+  (atom {:line ["m" "a" "s" "h" "!" " "]}))
+
+(defn line []
+  (om/ref-cursor (:line (om/root-cursor app-state))))

 (defn line-view [cursor]
   (reify
@@ -17,8 +20,14 @@
     (render [_]
       (dom/div nil (clojure.string/join "" (:line cursor))))))

-(defn app-view [cursor]
+(defn app-view [cursor owner]
   (reify
+    om/IDidMount
+    (did-mount [this]
+      (set! (.-onkeydown js/document.body)
+            (fn [e]
+              (let [l (om/observe owner (line))]
+                (om/transact! l #(conj % (.-key e)))))))
     om/IRender
     (render [_]
       (dom/div #js {:style #js {:color "#0b0"
@@ -27,3 +36,4 @@

 (om/root app-view app-state
          {:target (. js/document (getElementById "app"))})
+


Use comment creation date for sorting instead of last edit date.

--- src/oc/storage/util/sort.clj
+++ src/oc/storage/util/sort.clj
@@ -7,9 +7,9 @@
   "Return a map {entry-uuid most-recent-comment-timestap} excluding the user authored comments"
   [user-id start order entry]
   (let [all-comments (filterv #(and (:body %) (not= (-> % :author :user-id) user-id)) (:interactions entry))
-        sorted-comments (sort-by :updated-at all-comments)]
+        sorted-comments (sort-by :created-at all-comments)]
     (when (seq sorted-comments)
-      (hash-map (:uuid entry) (-> sorted-comments last :updated-at)))))
+      (hash-map (:uuid entry) (-> sorted-comments last :created-at)))))

 (defn sort-activity
   "Given a set of entries, return up to the default limit of them, intermixed and sorted."


Aeron works. :)

Aeron works. :)

--- src/onyx/messaging/aeron.clj
+++ src/onyx/messaging/aeron.clj
@@ -1,7 +1,7 @@
 (ns ^:no-doc onyx.messaging.aeron
     (:require [clojure.core.async :refer [chan >!! <!! alts!! timeout close!]]
               [com.stuartsierra.component :as component]
-              [taoensso.timbre :as timbre]
+              [taoensso.timbre :refer [warn] :as timbre]
               [onyx.messaging.acking-daemon :as acker]
               [onyx.compression.nippy :refer [compress decompress]]
               [onyx.extensions :as extensions])
@@ -23,15 +23,19 @@
         (>!! inbound-ch message)))))

 (defn handle-acker-message [daemon buffer offset length header]
-  (let [thawed (decompress buffer)]
-    (acker/ack-message daemon
-                       (:id thawed)
-                       (:completion-id thawed)
-                       (:ack-val thawed))))
+  (let [dst (byte-array length)]
+    (.getBytes buffer offset dst)
+    (let [thawed (decompress dst)]
+      (acker/ack-message daemon
+                         (:id thawed)
+                         (:completion-id thawed)
+                         (:ack-val thawed)))))

 (defn handle-completion-message [release-ch buffer offset length header]
-  (let [thawed (decompress buffer)]
-    (>!! release-ch (:id thawed))))
+  (let [dst (byte-array length)]
+    (.getBytes buffer offset dst)
+    (let [thawed (decompress dst)]
+      (>!! release-ch (:id thawed)))))

 (defn data-handler [f]
   (proxy [DataHandler] []
@@ -49,6 +53,10 @@
           (let [fragments-read (.poll subscription limit)]
             (.idle idle-strategy fragments-read)))))))

+(def no-op-error-handler
+  (proxy [Consumer] []
+    (accept [_] (prn "Conductor is down."))))
+
 (defrecord AeronConnection [opts]
   component/Lifecycle

@@ -59,7 +67,7 @@
           daemon (:acking-daemon component)
           release-ch (chan (clojure.core.async/dropping-buffer 100000))

-          port (+ 40000 (rand-int 250))
+          port (+ 40000 (rand-int 10000))
           channel (str "udp://localhost:" port)

           rand-stream-id (fn [] (rand-int 1000000))
@@ -68,7 +76,7 @@
           completion-stream-id (rand-stream-id)

           driver (MediaDriver/launch)
-          ctx (Aeron$Context.)
+          ctx (.errorHandler (Aeron$Context.) no-op-error-handler)
           aeron (Aeron/connect ctx)

           send-handler (data-handler (partial handle-sent-message inbound-ch))
@@ -79,18 +87,20 @@
           acker-subscriber (.addSubscription aeron channel acker-stream-id acker-handler)
           completion-subscriber (.addSubscription aeron channel completion-stream-id completion-handler)]

-      (future (.accept (consumer 10) send-subscriber))
-      (future (.accept (consumer 10) acker-subscriber))
-      (future (.accept (consumer 10) completion-subscriber))
+      (future (try (.accept (consumer 10) send-subscriber) (catch Exception e (warn e))))
+      (future (try (.accept (consumer 10) acker-subscriber) (catch Exception e (warn e))))
+      (future (try (.accept (consumer 10) completion-subscriber) (catch Exception e (warn e))))

       (assoc component :driver driver :channel channel :send-stream-id send-stream-id
-             :acker-stream-id acker-stream-id :completion-stream-id completion-stream-id)))
+             :acker-stream-id acker-stream-id :completion-stream-id completion-stream-id
+             :release-ch release-ch)))

   (stop [component]
     (taoensso.timbre/info "Stopping Aeron")

     (CloseHelper/quietClose (:driver component))
-    (assoc component :driver nil :channel nil)))
+    (close! (:release-ch component))
+    (assoc component :driver nil :channel nil :release-ch nil)))

 (defn aeron [opts]
   (map->AeronConnection {:opts opts}))
@@ -98,23 +108,23 @@
 (defmethod extensions/send-peer-site AeronConnection
   [messenger]
   {:channel (:channel messenger)
-   :send-stream-id (:send-stream-id messenger)})
+   :stream-id (:send-stream-id messenger)})

 (defmethod extensions/acker-peer-site AeronConnection
   [messenger]
   {:channel (:channel messenger)
-   :acker-stream-id (:acker-stream-id messenger)})
+   :stream-id (:acker-stream-id messenger)})

 (defmethod extensions/completion-peer-site AeronConnection
   [messenger]
   {:channel (:channel messenger)
-   :completion-stream-id (:completion-stream-id messenger)})
+   :stream-id (:completion-stream-id messenger)})

 (defmethod extensions/connect-to-peer AeronConnection
-  [messenger event {:keys [channel send-stream-id]}]
-  (let [ctx (Aeron$Context.)
+  [messenger event {:keys [channel stream-id]}]
+  (let [ctx (.errorHandler (Aeron$Context.) no-op-error-handler)
         aeron (Aeron/connect ctx)]
-    (.addPublication aeron channel send-stream-id)))
+    (.addPublication aeron channel stream-id)))

 (defmethod extensions/receive-messages AeronConnection
   [messenger {:keys [onyx.core/task-map] :as event}]


Bump lein profile's wagon-provider-api version

--- lein/profiles.clj
+++ lein/profiles.clj
@@ -30,7 +30,7 @@
                                                                                potemkin
                                                                                slingshot]]
                        ;; Q: How many of any of the rest of these do I actually use?
-                       [org.apache.maven.wagon/wagon-provider-api "2.10"]
+                       [org.apache.maven.wagon/wagon-provider-api "2.12"]
                        [org.codehaus.plexus/plexus-utils "3.0.24"]
                        ;; I use this everywhere. But it doesn't belong in here
                        #_[org.clojure/tools.namespace "0.2.10"]


Update clojure plugin versions

Update clojure plugin versions

--- lein/profiles.clj
+++ lein/profiles.clj
@@ -1,4 +1,4 @@
-{:user {:plugins [[cider/cider-nrepl "0.11.0-SNAPSHOT"]
-                  [refactor-nrepl "1.2.0-SNAPSHOT"]
-                  [lein-pprint "1.1.1"]]
+{:user {:plugins [[cider/cider-nrepl "0.14.0-SNAPSHOT"]
+                  [refactor-nrepl "2.3.0-SNAPSHOT"]
+                  [lein-pprint "1.1.2"]]
         :dependencies [[org.clojure/tools.nrepl "0.2.12"]]}}


correct documentation

correct documentation

--- src/overtone/music/pitch.clj
+++ src/overtone/music/pitch.clj
@@ -372,8 +372,8 @@
     chord))

 (defn chord
-  "Returns a set of notes for the specified chord at the specified octave
-  (defaulting to 4).
+  "Returns a set of notes for the specified chord. The root must be in midi note
+  format i.e. :C3.

   (chord :c3 :major)  ; c major           -> #{60 64 67}
   (chord :a4 :minor)  ; a minor           -> #{57 60 64}


Check if scroll done right after touch end for swipe view

There is a race condition where sometimes the view can be stuck
between panels when there is no momentum in the scroll, so scrolling
finishes before touch up; this addresses that by always checking for
scroll finished when touch ends.

--- src/retouch/views/swipe.cljs
+++ src/retouch/views/swipe.cljs
@@ -86,7 +86,8 @@
         scroll-prev! (fn [] (scroll-page! -1))

         touch-end! (fn [e]
-                     (swap! state assoc :dragging? false))
+                     (swap! state assoc :dragging? false)
+                     (put! scroll-chan true))

         touch-start! (fn [e]
                        (swap! state assoc


add allowed? predicate that checks for valid jwtoken

--- src/open_company/api/common.clj
+++ src/open_company/api/common.clj
@@ -117,6 +117,11 @@
   [ctx]
   (boolean (or (nil? (:jwtoken ctx)) (:jwtoken ctx))))

+(defn allow-authenticated
+  "Allow unless there is a JWToken provided and it's invalid"
+  [ctx]
+  (boolean (:jwtoken ctx)))
+
 (defn allow-org-members
   "Allow only if there is no company, or the user's JWToken indicates membership in the company's org."
   [company-slug ctx]


Correct version of load-conv being used in polismath.darwin.export

--- src/polismath/darwin/export.clj
+++ src/polismath/darwin/export.clj
@@ -524,7 +524,7 @@
         comments (enriched-comments-data (get-comments-data darwin zid) votes)
         participants (get-participation-data darwin zid)
         ;; Should factor out into separate function
-        conv (utils/apply-kwargs db/load-conv (:postgres darwin) kw-args)]
+        conv (utils/apply-kwargs load-conv (:postgres darwin) kw-args)]
     {:votes votes
      :summary (summary-data darwin conv votes comments participants)
      :stats-history (stats-history votes participants comments)


fix margintop

fix margintop

--- src/styles/nossal/simple.clj
+++ src/styles/nossal/simple.clj
@@ -23,7 +23,7 @@
    {:background "#fff"
     :padding (em 5)
     :text-align "center"
-    :margin-top (em 5)}]
+    :margin-top (em 1)}]
   [:strong {:font-weight "bold"}]
   [:h1
    {:font-size (em 3)
@@ -70,7 +70,7 @@
     :font-size (em 0.7)}]

   (at-media {:max-width (px 736)}
-    [:section {:padding (em 1) :padding-bottom (em 5) :margin-top (em 2)}]
+    [:section {:padding (em 1) :padding-bottom (em 5)}]
     [:h1 {:font-size (em 2.3)}]
     [:footer {:margin-top (em 1)}]
     [:.call-button {:margin-top (em 0.5)}]))


added :interval-subtract; started on :interval-multiply

--- src/push/type/item/interval.clj
+++ src/push/type/item/interval.clj
@@ -122,6 +122,23 @@
     (calculate [:i1 :i2] #(interval/interval-intersection %1 %2) :as :result)
     (push-onto :interval :result)
     ))
+
+
+
+; (def interval-multiply
+;   (build-instruction
+;     interval-multiply
+;     "`:interval-multiply` pops the top two `:interval` items and pushes a new `:interval` which is the product of the two. If either `:min` (or `:max`) is open, the result `:min` (or `:max`) is also open."
+;     :tags #{:interval}
+;     (consume-top-of :interval :as :i2)
+;     (consume-top-of :interval :as :i1)
+;     (calculate [:i1 :i2]
+;         #(interval/make-interval
+;             (-' (:min %1) (:max %2))
+;             (-' (:max %1) (:min %2))
+;             :min-open? (or (:min-open? %1) (:max-open? %2))
+;             :max-open? (or (:max-open? %1) (:min-open? %2))) :as :result)
+;     (push-onto :interval :result)))


Enable full screen button on OS X

Enable full screen button on OS X

--- desktop/src/nightmod/core/desktop_launcher.clj
+++ desktop/src/nightmod/core/desktop_launcher.clj
@@ -7,7 +7,7 @@
             [nightmod.core.ui :as ui]
             [nightmod.core.utils :as utils]
             [seesaw.core :as s])
-  (:import [java.awt BorderLayout Canvas Dimension]
+  (:import [java.awt BorderLayout Canvas Dimension Window]
            [java.awt.event ComponentAdapter WindowAdapter]
            [javax.swing JLayeredPane]
            [com.badlogic.gdx.backends.lwjgl LwjglApplication]
@@ -49,6 +49,16 @@
     (System/exit 0)
     true))

+(defn enable-full-screen!
+  "Enables full screen mode on OS X."
+  [window]
+  (try
+    (some-> (Class/forName "com.apple.eawt.FullScreenUtilities")
+            (.getMethod "setWindowCanFullScreen"
+                        (into-array Class [Window Boolean/TYPE]))
+            (.invoke nil (object-array [window true])))
+    (catch Exception _)))
+
 (defn create-window
   "Creates the main window."
   []
@@ -78,7 +88,8 @@
           ;87 (editors/close-selected-editor!)
           ; else
           false)))
-    ; when the window state changes
+    ; set various window properties
+    enable-full-screen!
     (.addWindowListener (proxy [WindowAdapter] []
                           (windowClosing [e]
                             (confirm-exit-app!))))))


Forgot to add .last

Forgot to add .last

--- src/wishlistd/cljs/main.cljs
+++ src/wishlistd/cljs/main.cljs
@@ -23,8 +23,8 @@
 (defpartial wish-li-last []
   [:li.wish.last
    [:div.delete]
-   [:input {:type "text" :class "description"}]
-   [:input {:type "text" :class "url"}]])
+   [:input {:type "text" :class "description last"}]
+   [:input {:type "text" :class "url last"}]])

 (defpartial wish-ul [wishes]
   [:ul.wishes


Updated wish-from-elem

Updated wish-from-elem

--- src/wishlistd/cljs/main.cljs
+++ src/wishlistd/cljs/main.cljs
@@ -54,7 +54,7 @@
   (val (find $header ".title")))

 (defn wish-from-elem [$elem]
-  {:id (data $elem :id)
+  {:id (.attr $elem "id")
    :description (val (find $elem ".description"))
    :url (val (find $elem ".url"))
    :wishlist_code (get-path)})


formatting

formatting

--- src/wishlistd/cljs/main.cljs
+++ src/wishlistd/cljs/main.cljs
@@ -38,8 +38,7 @@
 ; GETTING AND SETTING

 (defn get-path []
-  (.pop
-    (.split js/window.location.pathname "/")))
+  (.pop (.split js/window.location.pathname "/")))

 (defn set-path! [code]
   (.pushState js/window.history nil "" code))
@@ -50,10 +49,6 @@
   (append $content (wish-ul wish))
   (append $header  (wishlist-title title))
   (set-path! code))
-
-(defn show-wishlist-title! [{:keys [title]}]
-  (empty $header)
-  (append $header (wishlist-title title)))

 (defn show-wishlist-wish! [{:keys [description url]} $wish]
   (val (find $wish ".description") description)
@@ -85,14 +80,16 @@
   (letrem [neu (create-wishlist {:title "Default"})]
     (show-wishlist! neu)))

+(defn read-wishlist-rem [code]
+  (letrem [neu (read-wishlist code)]
+    (show-wishlist! neu)))
+
 (defn update-wishlist-title-rem []
   (let [wishlist {:code (get-path) :title (title-from-html)}]
     (letrem [neu (update-wishlist wishlist)]
       (fn [e] nil))))

-(defn read-wishlist-rem [code]
-  (letrem [neu (read-wishlist code)]
-    (show-wishlist! neu)))
+

 ; DELEGATES


Fix regex

Fix regex

--- planck-cljs/src/planck/core.cljs
+++ planck-cljs/src/planck/core.cljs
@@ -87,7 +87,7 @@
   (let [namespace-candidates (map str
                                (keys (:cljs.analyzer/namespaces @planck.core/st)))
         top-form? (re-find #"^\s*\(\s*[^()\s]*$" buffer)
-        typed-ns (second (re-find #"(\b[a-zA-Z-.]+)\/[a-zA-Z-]+$" buffer))
+        typed-ns (second (re-find #"(\b[a-zA-Z-.]+)/[a-zA-Z-]+$" buffer))
         all-candidates (set (if typed-ns
                               (completion-candidates-for-ns (symbol typed-ns) false)
                               (concat namespace-candidates


fixes roles bar

fixes roles bar

--- src/cljs/conference_rating/conference_list_page/conference_list_entry.cljs
+++ src/cljs/conference_rating/conference_list_page/conference_list_entry.cljs
@@ -46,7 +46,7 @@
      (roles (perc count (:ba rolesMap)) "bg-ba" "BA")
      (roles (perc count (:pm rolesMap)) "bg-pm" "PM")
      (roles (perc count (:sales rolesMap)) "bg-sales" "SALES")
-     (roles (perc count (:recruting rolesMap)) "bg-recruting" "RECRUITING")
+     (roles (perc count (:recruiting rolesMap)) "bg-recruting" "RECRUITING")
      (roles (perc count (:other rolesMap)) "bg-other" "OTHER")]))

 (defn display-conference-list-item [conference]


Store images indexed in the state.

Store images indexed in the state.

--- src/uxbox/main/data/images.cljs
+++ src/uxbox/main/data/images.cljs
@@ -214,13 +214,16 @@
 (defrecord ImagesFetched [coll-id items]
   rs/UpdateEvent
   (-apply-update [_ state]
-    (assoc-in state [:image-colls-by-id coll-id :images] (set items))))
+    (reduce (fn [state {:keys [id] :as image}]
+              (assoc-in state [:images-by-id id] image))
+            state
+            items)))

 (defn images-fetched
   [coll-id items]
   (ImagesFetched. coll-id items))

-;; --- Load Images
+;; --- Fetch Images

 (defrecord FetchImages [coll-id]
   rs/WatchEvent


remove debug print

remove debug print

--- boot/core/src/boot/task/built_in.clj
+++ boot/core/src/boot/task/built_in.clj
@@ -162,7 +162,6 @@
                     (try (reset! return (-> fileset core/reset-fileset core/commit! next-task))
                          (catch Throwable ex (util/print-ex ex)))
                     (util/info "Elapsed time: %.3f sec\n\n" (float (/ (etime) 1000)))))
-                (println "recuring...")
                 (recur (util/guard [(.take q)]))))))
         @return))))


CMR-710: Added test of searching with multiple values on a single science keyword field.

--- test/cmr/system_int_test/search/collection_science_keyword_search_test.clj
+++ test/cmr/system_int_test/search/collection_science_keyword_search_test.clj
@@ -59,7 +59,7 @@
            (d/refs-match? items
                           (search/find-refs
                             :collection
-                            {"science-keywords" {:0 {science-keyword value}}}))
+                            {:science-keywords {:0 {science-keyword value}}}))
            :category "Cat1" [coll1]
            :topic "Topic1" [coll1]
            :term "Term1" [coll1]
@@ -75,24 +75,31 @@
       (is (d/refs-match? [coll2]
                          (search/find-refs
                            :collection
-                           {"science-keywords" {:0 {:category "Hurricane"
-                                                    :topic "Popular"
-                                                    :term "Extreme"}}}))))
+                           {:science-keywords {:0 {:category "Hurricane"
+                                                   :topic "Popular"
+                                                   :term "Extreme"}}}))))

     (testing "search by science keywords, multiple."
       (is (d/refs-match? [coll2 coll6]
                          (search/find-refs
                            :collection
-                           {"science-keywords" {:0 {:category "Hurricane"
-                                                    :topic "Popular"}
-                                                :1 {:term "Extreme"}}}))))
+                           {:science-keywords {:0 {:category "Hurricane"
+                                                   :topic "Popular"}
+                                               :1 {:term "Extreme"}}}))))
+
+    (testing "search by science keywords, multiple values in one field."
+      (is (d/refs-match? [coll2 coll5 coll6 coll7]
+                         (search/find-refs
+                           :collection
+                           {:science-keywords {:0 {:category ["Hurricane" "Tornado"]
+                                                   :term "Extreme"}}}))))

     (testing "search by science keywords, ignore case"
       (are [items science-keyword value ignore-case]
            (d/refs-match? items
                           (search/find-refs
                             :collection
-                            {"science-keywords" {:0 {science-keyword value}}
+                            {:science-keywords {:0 {science-keyword value}}
                              "options[science-keywords][ignore-case]" ignore-case}))

            [coll1] :category "Cat1" false
@@ -103,42 +110,42 @@
       (is (d/refs-match? [coll2 coll6]
                          (search/find-refs
                            :collection
-                           {"science-keywords" {:0 {:category "Hurricane"
-                                                    :topic "Popular"}
-                                                :1 {:term "Extreme"}}
+                           {:science-keywords {:0 {:category "Hurricane"
+                                                   :topic "Popular"}
+                                               :1 {:term "Extreme"}}
                             "options[science-keywords][or]" "false"}))))

     (testing "search by science keywords, multiple. options :or true"
       (is (d/refs-match? [coll2 coll3 coll5 coll6 coll7]
                          (search/find-refs
                            :collection
-                           {"science-keywords" {:0 {:category "Hurricane"
-                                                    :topic "Popular"}
-                                                :1 {:term "Extreme"}}
+                           {:science-keywords {:0 {:category "Hurricane"
+                                                   :topic "Popular"}
+                                               :1 {:term "Extreme"}}
                             "options[science-keywords][or]" "true"}))))

     (testing "search by science keywords, multiple and legacy :or format"
       (is (d/refs-match? [coll2 coll6]
                          (search/find-refs
                            :collection
-                           {"science-keywords" {:0 {:category "Hurricane"
-                                                    :topic "Popular"}
-                                                :1 {:term "Extreme"}
-                                                :or "false"}})))
+                           {:science-keywords {:0 {:category "Hurricane"
+                                                   :topic "Popular"}
+                                               :1 {:term "Extreme"}
+                                               :or "false"}})))
       (is (d/refs-match? [coll2 coll3 coll5 coll6 coll7]
                          (search/find-refs
                            :collection
-                           {"science-keywords" {:0 {:category "Hurricane"
-                                                    :topic "Popular"}
-                                                :1 {:term "Extreme"}
-                                                :or "true"}}))))
+                           {:science-keywords {:0 {:category "Hurricane"
+                                                   :topic "Popular"}
+                                               :1 {:term "Extreme"}
+                                               :or "true"}}))))

     (testing "search by science keywords, default case insensitive."
       (are [science-keyword value items]
            (d/refs-match? items
                           (search/find-refs
                             :collection
-                            {"science-keywords" {:0 {science-keyword value}}}))
+                            {:science-keywords {:0 {science-keyword value}}}))
            :category "cat1" [coll1]
            :topic "TOPIC1" [coll1]
            :term "term1" [coll1]
@@ -191,6 +198,6 @@

 (deftest search-science-keywords-error-scenarios
   (testing "search by invalid format."
-    (let [{:keys [status errors]} (search/find-refs :collection {"science-keywords" {:0 {:and "true"}}})]
+    (let [{:keys [status errors]} (search/find-refs :collection {:science-keywords {:0 {:and "true"}}})]
       (is (= 400 status))
       (is (re-find #"parameter \[and\] is not a valid science keyword search term." (first errors))))))


Fix AHSS to use just above neg-inf

Fix AHSS to use just above neg-inf

--- src/edu/berkeley/ai/angelic/hierarchies/algorithms.clj
+++ src/edu/berkeley/ai/angelic/hierarchies/algorithms.clj
@@ -16,8 +16,8 @@

 ; TODO: this priority fn won't work well on hard domains -- need to take portion with
  ; non-inf pessimistic value into account ...
-(defn ahss-search
-  ([node] (ahss-search node Double/NEGATIVE_INFINITY))
+(defn ahss-search "Pass a *finite* threshold"
+  ([node] (ahss-search node (- Double/MAX_VALUE)))
   ([node threshold] (ahss-search node threshold
 		      (fn ahss-priority-fn [node]
 			(- 0
@@ -36,11 +36,13 @@
 		     good-refs (filter #(>= (search/upper-reward-bound %) threshold) refs)
 		     sols      (filter identity (map search/extract-a-solution good-refs))
 		     good-sols (filter #(>= (second %) threshold) sols)]
+;		 (println (search/node-str next))
 		 (if good-sols  ; Found a good enough primitive refinement
 		     (util/first-maximal-element second good-sols)
 		   (do
                      (if-let [great-refs (filter #(>= (search/lower-reward-bound %) threshold) good-refs)]
 		         (let [best-ref (util/first-maximal-element search/lower-reward-bound great-refs)]
+			   (println "committing to " (search/node-str best-ref))
 			   (queues/pq-remove-all! pq)
 			   (queues/pq-add! pq best-ref (priority-fn best-ref)))
 		       (doseq [ref good-refs]
@@ -49,7 +51,9 @@

-
+(comment
+ (dotimes [_ 2] (let [env (constant-predicate-simplify (make-nav-switch-strips-env 505 505 (prln (take 20 (repeatedly #(vector (rand-int 505) (rand-int 505))))) [504 0] true [0 504]))] (doseq [h [*nav-switch-hierarchy* *nav-switch-hierarchy-improved*]] (let [node (get-hierarchy h env )] (println h) (dotimes [_ 1] (time (println (second (aha-star-search (alt-node node))))) (time (println (second (ahss-search (alt-node node))))) )))))
+ )


Small improvements to the Slider page. Closes #25.

--- src/cljs/reagent_toolbox_docs/components/slider.cljs
+++ src/cljs/reagent_toolbox_docs/components/slider.cljs
@@ -16,32 +16,39 @@
       "levels, such as volume, brightness, or color saturation."]
      [ui/display-and-eval-code "
 (defn slider-test []
-  (let [sliders (reagent.ratom/atom {:slider2 5 :slider3 1 :slider4 3})]
+  (let [slider-1 (reagent.ratom/atom nil)
+        slider-2 (reagent.ratom/atom 5)
+        slider-3 (reagent.ratom/atom 1)
+        slider-4 (reagent.ratom/atom 3)]
     (fn []
       [:section
-       [:p \"Value: \" (pr-str @sliders)]
        [:p \"Normal slider\"]
-       [reagent-toolbox.core/slider {:value     (@sliders :slider1)
-                                     :on-change #(swap! sliders assoc :slider1 %)}]
+       [:p \"Value: \" @slider-1]
+       [reagent-toolbox.core/slider {:value     @slider-1
+                                     :on-change #(reset! slider-1 %)}]
        [:p \"With steps, initial value, and editable\"]
-       [reagent-toolbox.core/slider {:value     (@sliders :slider2)
+       [:p \"Value: \" @slider-2]
+       [reagent-toolbox.core/slider {:value     @slider-2
                                      :min       0
                                      :max       10
                                      :editable  true
-                                     :on-change #(swap! sliders assoc :slider2 %)}]
+                                     :on-change #(reset! slider-2 %)}]
        [:p \"Pinned and with snaps\"]
-       [reagent-toolbox.core/slider {:value     (@sliders :slider3)
+       [:p \"Value: \" @slider-3]
+       [reagent-toolbox.core/slider {:value     @slider-3
                                      :editable  true
                                      :pinned    true
                                      :snaps     true
                                      :min       0
                                      :max       10
                                      :step      1
-                                     :on-change #(swap! sliders assoc :slider3 %)}]
+                                     :on-change #(reset! slider-3 %)}]
        [:p \"Disabled\"]
-       [reagent-toolbox.core/slider {:value     (@sliders :slider4)
+       [:p \"Value: \" @slider-4]
+       [reagent-toolbox.core/slider {:value     @slider-4
                                      :disabled  true
-                                     :on-change #(swap! sliders assoc :slider4 %)}]])))
+                                     :on-change #(reset! slider-4 %)}]])))
+
 [slider-test]"]

      [:p "This component can be styled by context providing a theme with the key " [:code "RTSwitch"] "through the "
@@ -95,7 +102,7 @@
          [:td [:code "on-focus"]]
          [:td [:code "function"]]
          [:td]
-         [:td "Callback function that is fired when the switch is focused."]]        ]]]
+         [:td "Callback function that is fired when the switch is focused."]]]]]
      [:section
       [:h2 "Theme"]
       [:table


More buflen

More buflen

--- src/caesium/magicnonce/secretbox.clj
+++ src/caesium/magicnonce/secretbox.clj
@@ -116,7 +116,7 @@

   All three arrays should be of identical length. Returns `out`."
   [^bytes out ^bytes a ^bytes b]
-  (dotimes [i (alength a)]
+  (dotimes [i (buflen a)]
     (aset-byte out i (bit-xor (aget a i) (aget b i))))
   out)

@@ -146,7 +146,7 @@
   Analogous to [[caesium.crypto.secretbox/secretbox-open-easy-to-buf!]]."
   [^bytes out ^bytes nonced-ctext ^bytes key]
   (let [noncebuf (ByteBuffer/wrap nonced-ctext 0 s/noncebytes)
-        ctextlen (- (alength nonced-ctext) s/noncebytes)
+        ctextlen (- (buflen nonced-ctext) s/noncebytes)
         ctextbuf (ByteBuffer/wrap nonced-ctext s/noncebytes ctextlen)]
     (s/secretbox-open-easy-from-byte-bufs! out ctextbuf ctextlen noncebuf key)))

@@ -155,7 +155,7 @@

   Analogous to [[caesium.crypto.secretbox/secretbox-open-easy]]."
   [^bytes nonced-ctext ^bytes key]
-  (let [out (byte-array (- (alength nonced-ctext) s/noncebytes s/macbytes))]
+  (let [out (byte-array (- (buflen nonced-ctext) s/noncebytes s/macbytes))]
     (open-to-buf! out nonced-ctext key)))

 (defn decrypt-to-buf!


Use new fancy API

Use new fancy API

--- src/caesium/magicnonce/secretbox.clj
+++ src/caesium/magicnonce/secretbox.clj
@@ -134,7 +134,7 @@
   (let [noncebuf (ByteBuffer/wrap nonced-ctext 0 s/noncebytes)
         ctextlen (- (alength nonced-ctext) s/noncebytes)
         ctextbuf (ByteBuffer/wrap nonced-ctext s/noncebytes ctextlen)]
-    (s/decrypt-to-byte-buf! out key noncebuf ctextbuf)))
+    (s/secretbox-open-easy-from-byte-bufs! out ctextbuf ctextlen noncebuf key)))

 (defn open
   "Decrypts any secretbox message with a prefix nonce.


Remove cyclic load

Remove cyclic load

--- src/checkin_halake/models/events.clj
+++ src/checkin_halake/models/events.clj
@@ -1,8 +1,7 @@
 (ns checkin-halake.models.events
   (:require [monger.collection :as mc]
             [environ.core :refer [env]])
-  (:use checkin-halake.core
-        checkin-halake.models.core))
+  (:use checkin-halake.models.core))

 (defn- fix-event [doc]
   (dissoc doc :password))


preparing dockerhub user repo

preparing dockerhub user repo

--- src/clj/swarmpit/registry/client.clj
+++ src/clj/swarmpit/registry/client.clj
@@ -1,7 +1,7 @@
 (ns swarmpit.registry.client
   (:refer-clojure :exclude [get])
   (:require [org.httpkit.client :as http]
-            [cheshire.core :refer [parse-string]]
+            [cheshire.core :refer [parse-string generate-string]]
             [swarmpit.token :as token]))

 (defn- build-url
@@ -23,7 +23,7 @@
           (throw
             (ex-info "Registry error!"
                      {:status status
-                      :body   {:error (:errors response)}})))))))
+                      :body   {:error response}})))))))

 (defn- get
   [registry api headers params]
@@ -33,7 +33,33 @@
                  :query-params params}]
     (execute @(http/get url options))))

+(defn- post
+  [registry api headers body]
+  (let [url (build-url registry api)
+        options {:headers (merge headers {"Content-Type" "application/json"})
+                 :body    (generate-string body)}]
+    (execute @(http/post url options))))
+
+(defn- basic-auth
+  [registry]
+  {:Authorization (token/generate-basic (:username registry)
+                                        (:password registry))})
+
+(defn- jwt-auth
+  [token]
+  {:Authorization (str "JWT " token)})
+
 ;; Dockerhub
+
+(defn dockerhub-login
+  [registry]
+  (let [body (select-keys registry [:username :password])]
+    (post registry "/users/login" {} body)))
+
+(defn dockerhub-user-repo
+  [registry token]
+  (let [api (str "/repositories/" (:username registry))]
+    (get registry api {} (jwt-auth token))))

 (defn dockerhub-repositories
   [registry query page]
@@ -44,18 +70,15 @@

 (defn dockerhub-tags
   [registry repository-name]
-  (let []
-    (get registry (str "/repositories/" repository-name "/tags") {} {})))
+  (get registry (str "/repositories/" repository-name "/tags") {} {}))

 ;; Classic v2 registry

 (defn- headers
   [registry]
-  (let [headers {}]
-    (if (:withAuth registry)
-      (assoc headers "Authorization" (token/generate-basic (:username registry)
-                                                           (:password registry)))
-      headers)))
+  (if (:withAuth registry)
+    (basic-auth registry)
+    {}))

 (defn repositories
   [registry]
@@ -70,5 +93,6 @@

 (defn tags
   [registry repository-name]
-  (let [headers (headers registry)]
-    (get registry (str "/" repository-name "/tags/list") headers {})))
+  (let [headers (headers registry)
+        api (str "/" repository-name "/tags/list")]
+    (get registry api headers {})))


Switch heartbeating to peer-group-manager action.

--- src/onyx/peer/peer_group_manager.clj
+++ src/onyx/peer/peer_group_manager.clj
@@ -192,6 +192,10 @@
         (update :peer-count dec)
         (update :peer-owners dissoc peer-owner-id))
     state))
+
+(defmethod action :heartbeat [{:keys [heartbeat-fn!] :as state} _]
+  (heartbeat-fn!)
+  state)

 (defmethod action :apply-log-entry [{:keys [replica group-state comm peer-config
                                             vpeers query-server messenger-group] :as state} [type entry]]
@@ -216,10 +220,6 @@

 (def heartbeat-period-ms 500)

-(defn heartbeat! [state]
-  ((:heartbeat-fn! state))
-  state)
-
 (defn peer-group-manager-loop [state]
   (try
    (loop [state (action state [:start-peer-group])]
@@ -232,14 +232,18 @@
            new-state (cond (= ch shutdown-ch)
                            (action state [:stop-peer-group])
                            (= ch timeout-ch)
-                           (heartbeat! state)
+                           (action state [:heartbeat])
                            (= ch group-ch)
-                           (-> state heartbeat! (action entry))
+                           (-> state
+                               (action [:heartbeat])
+                               (action entry))
                            ;; log reader threw an exception
                            (and (= ch inbox-ch) (instance? java.lang.Throwable entry))
                            (action state [:restart-peer-group])
                            (= ch inbox-ch)
-                           (-> state heartbeat! (action [:apply-log-entry entry])))]
+                           (-> state
+                               (action [:heartbeat])
+                               (action [:apply-log-entry entry])))]
        (when (and new-state (not= ch shutdown-ch))
          (recur new-state))))
    (catch Throwable t


Avoids NPE when pod metadata is nil (#1537)

--- scheduler/src/cook/kubernetes/api.clj
+++ scheduler/src/cook/kubernetes/api.clj
@@ -110,12 +110,12 @@

 (defn get-pod-namespaced-key
   [^V1Pod pod]
-  {:namespace (-> pod
-                  .getMetadata
-                  .getNamespace)
-   :name (-> pod
-             .getMetadata
-             .getName)})
+  (if-let [^V1ObjectMeta pod-metadata (some-> pod .getMetadata)]
+    {:namespace (-> pod-metadata .getNamespace)
+     :name (-> pod-metadata .getName)}
+    (throw (ex-info
+             (str "Unable to get namespaced key for pod: " pod)
+             {:pod pod}))))

 (defn get-all-pods-in-kubernetes
   "Get all pods in kubernetes."


only build source maps in dev mode

only build source maps in dev mode

--- src/leiningen/new/reagent/project.clj
+++ src/leiningen/new/reagent/project.clj
@@ -27,7 +27,6 @@
   :cljsbuild {:builds {:app {:source-paths ["src/cljs"{{{cljx-cljsbuild-spath}}}]
                              :compiler {:output-to     "resources/public/js/app.js"
                                         :output-dir    "resources/public/js/out"
-                                        :source-map    "resources/public/js/out.js.map"
                                         :externs       ["react/externs/react.js"]
                                         :optimizations :none
                                         :pretty-print  true}}}}
@@ -61,7 +60,8 @@
                                     :output-path "target/generated/cljs"
                                     :rules :cljs}]}
                    {{/cljx-build?}}
-                   :cljsbuild {:builds {:app {:source-paths ["env/dev/cljs"]}}}}
+                   :cljsbuild {:builds {:app {:source-paths ["env/dev/cljs"]
+                                              :compiler {:source-map "resources/public/js/out.js.map"}}}}}

              :uberjar {:hooks [{{cljx-uberjar-hook}}leiningen.cljsbuild minify-assets.plugin/hooks]
                        :env {:production true}


CMR-3281 fixes test

CMR-3281 fixes test

--- access-control-app/int_test/cmr/access_control/int_test/acl_search_test.clj
+++ access-control-app/int_test/cmr/access_control/int_test/acl_search_test.clj
@@ -850,8 +850,8 @@
                                   :access-value 2
                                   :provider-id "PROV2"})

-        gran1 (u/save-granule coll1 {:provider "PROV1"})
-        gran2 (u/save-granule coll6 {:provider "PROV2"})
+        gran1 (u/save-granule coll1 {:provider-id "PROV1"})
+        gran2 (u/save-granule coll6 {:provider-id "PROV2"})

         ;; For testing that a full range encompassing multiple collections will
         ;; properly match all collections
@@ -877,7 +877,7 @@
         acl4 (ingest-acl token (assoc (catalog-item-acl "Access value 2-3")
                                       :catalog_item_identity {:name "Access value 2-3"
                                                               :collection_applicable true
-                                                              :collection_identifier {:access_value {:min_value 2 :max_value 3}}
+                                                              :collection_identifier {:access_value {:min_value 2 :max_value 3}}
                                                               :provider_id "PROV1"}))
         ;; For testing an access value which will match no collections
         acl5 (ingest-acl token (assoc (catalog-item-acl "Access value 4")


Fix tests

Fix tests

--- test/expound/alpha_test.cljc
+++ test/expound/alpha_test.cljc
@@ -78,8 +78,8 @@
               :clj (-> exception-data :via last :data))
         cause (-> #?(:cljs (:message exception-data)
                      :clj (:cause exception-data))
-                  (clojure.string/replace #"Call to #'(.*) did not conform to spec."
-                                          "Call to $1 did not conform to spec."))]
+                  (clojure.string/replace #"Call to (#')?(.*) did not conform to spec."
+                                          "Call to $2 did not conform to spec."))]

     (str cause
          (if (re-find  #"Detected \d+ error" cause)


OMW/OGW-laskenta bye-pelaajille

OMW/OGW-laskenta bye-pelaajille

--- mtg-pairings-server/src/mtg_pairings_server/mtg_util.clj
+++ mtg-pairings-server/src/mtg_pairings_server/mtg_util.clj
@@ -21,12 +21,16 @@
      :team_name (:team1_name (first matches))}))

 (defn ^:private calculate-omw-ogw [teams-results]
-  (map-values (fn [results]
+  (map-values (fn [results]
                 (let [opponents (for [opp (:opponents results)]
                                   (teams-results opp))
                       cnt (count opponents)
-                      omw (/ (reduce + 0 (map :pmw opponents)) cnt)
-                      ogw (/ (reduce + 0 (map :pgw opponents)) cnt)]
+                      omw (if (zero? cnt)
+                            0
+                            (/ (reduce + 0 (map :pmw opponents)) cnt))
+                      ogw (if (zero? cnt)
+                            0
+                            (/ (reduce + 0 (map :pgw opponents)) cnt))]
                   (assoc results
                          :omw omw
                          :ogw ogw)))
@@ -57,18 +61,18 @@
 (defn ^:private check-digit [n]
   (let [primes [43 47 53 71 73 31 37 41 59 61 67 29]
         checksum (reduce + (map * n primes))]
-    (-> checksum
-      (/ 10)
+    (-> checksum
+      (/ 10)
       int
       (mod 9)
       (+ 1))))

 (defn add-check-digits [dci-number]
   (let [digits (map #(Integer/parseInt (str %)) dci-number)
-        length (count digits)]
+        length (count digits)]
     (cond->> digits
       (>= 6 length) (cons 0)
       (>= 7 length) (#(cons (check-digit %) %))
       (>= 8 length) (cons 0)
       (>= 9 length) (#(cons (check-digit %) %))
-      true (apply str))))+      true (apply str))))


[#2080]Move http details to endpoint layer

--- backend/src/akvo/lumen/endpoint/collection.clj
+++ backend/src/akvo/lumen/endpoint/collection.clj
@@ -43,7 +43,9 @@
                :parameters {:path-params {:id string?}}
                :handler (fn [{tenant :tenant
                               {:keys [id]} :path-params}]
-                          (collection/fetch (p/connection tenant-manager tenant) id))}
+                          (if-let [c (collection/fetch (p/connection tenant-manager tenant) id)]
+                              (lib/ok c)
+                              (lib/not-found {:id id})))}
          :put {:responses {200 {}}
                :parameters {:body map?
                             :path-params {:id string?}}


Add tests of pattern/local?

Add tests of pattern/local?

--- test/oxcart/pattern_test.clj
+++ test/oxcart/pattern_test.clj
@@ -132,6 +132,16 @@
 ;;   test. Omitted for now, fix later.

+(deftest local?-tests
+  (doseq [op ops]
+    (if (not= op :local)
+      (is-not (p/local? {:op op}))
+      (is (p/local? {:op op}))))
+
+  (is (p/local?
+       (-> addition :body :ret :args first))))
+
+
 (def private-defn
   (ast
    (defn ^:private baz [x]


Add tests of pattern/binding?

Add tests of pattern/binding?

--- test/oxcart/pattern_test.clj
+++ test/oxcart/pattern_test.clj
@@ -110,6 +110,13 @@
   (is-not (p/letfn? (:init fail))))

+(deftest binding?-tests
+  (doseq [op ops]
+    (if (not= op :binding)
+      (is-not (p/binding? {:op op}))
+      (is (p/binding? {:op op})))))
+
+
 (def private-defn
   (ast
    (defn ^:private baz [x]


tasklib fixes

tasklib fixes

--- tasklib/src/boot_bowdlerize.clj
+++ tasklib/src/boot_bowdlerize.clj
@@ -200,9 +200,9 @@
                   (flatten
                    (for [config-sym nss]
                         (let [config-ns (symbol (namespace config-sym))]
-                          ;; (println "CONFIG-SYM: " config-sym)
                           ;; (println "CONFIG-NS: " config-ns)
                           (require config-ns)
+                          ;; (doseq [[ivar isym] (ns-interns config-ns)] (println "interned: " ivar isym))
                           (if (not (find-ns config-ns)) (throw (Exception. (str "can't find config ns"))))
                           (let [config-var (if-let [v (resolve config-sym)]
                                              v (throw
@@ -220,15 +220,14 @@
         ;; (println "CONFIG-MAPS: " (count config-nss))
         ;; (pp/pprint config-nss)
         (doseq [config-map config-nss]
-          (do ;; (println "config-map for stencil: " config-map)
-            (let [config-file-name (str (ns->filestr (-> config-map :config-ns)) ".clj")
+            (let [config-file-name (str outdir "/" (ns->filestr (-> config-map :config-ns)) ".clj")
+                  _ (println "writing: " config-file-name)
                   config-file (stencil/render-file "boot_bowdlerize/bower.mustache"
                                                    config-map)
-                  out-file (doto (io/file tgt (str outdir "/" config-file-name))
+                  out-file (doto (io/file tgt config-file-name)
                              io/make-parents)]
-              (spit out-file config-file)))))
-        #_(util/warn (format "not a bower config ns: %s\n" n))
-        (-> fileset (boot/add-resource tgt) boot/commit!))))
+              (spit out-file config-file))))
+      (-> fileset (boot/add-resource tgt) boot/commit!))))

 ;;FIXME: make rm an option to config?
 (boot/deftask config-rm
@@ -241,22 +240,24 @@
         config-pod    (future (pod/make-pod pod-env))
         ]
     (boot/with-pre-wrap [fileset]
-      (let [newfs (loop [nsx nss fs fileset]
-                    (if (empty? nsx)
-                          fs
-                          (let [;;_ (println "foo" nsx)
-                                config-sym (first nsx)
-                                ;; _ (println "config-sym: " config-sym)
-                                config-ns (symbol (namespace config-sym))
-                                ;; _ (println "config-ns: " config-ns)
-                                ]
-                            (require config-ns)
-                            (if (not (find-ns config-ns))
-                              (throw (Exception. (str "can't find config ns"))))
-                            (let [bower-file-path (str (ns->filestr config-ns) ".clj")
-                                  bower-file (boot/tmp-get fs bower-file-path)]
-                              (recur (rest nsx)
-                                     (boot/rm fs [bower-file]))))))]
+      (let [newfs
+            (loop [nsx (set (map #(symbol (namespace %)) nss)) fs fileset]
+              (if (empty? nsx)
+                fs
+                (let [;;_ (println "foo" nsx)
+                      config-sym (first nsx)
+                      ;; _ (println "config-sym: " config-sym)
+                      config-ns config-sym
+                      ;; _ (println "config-ns: " config-ns (type config-ns))
+                      ]
+                  (require config-ns)
+                  (if (not (find-ns config-ns))
+                    (throw (Exception. (str "can't find config ns"))))
+                  (let [bower-file-path (str (ns->filestr config-ns) ".clj")
+                        bower-file (boot/tmp-get fs bower-file-path)]
+                    ;; (println "removing: " (str config-sym))
+                    (recur (rest nsx)
+                           (boot/rm fs [bower-file]))))))]
         (boot/commit! newfs)))))

 (boot/deftask install
@@ -279,11 +280,10 @@
       (boot/empty-dir! tgt)
       (doseq [config-sym nss]
         (let [config-ns (symbol (namespace config-sym))]
-          ;; (println "CONFIG-SYM: " config-sym)
-          ;; (println "CONFIG-NS: " config-ns)
           (require config-ns)
           (if (not (find-ns config-ns)) (throw (Exception. (str "can't find config ns"))))
-          ;;(if (:bower (meta (find-ns config-ns)))
+          ;; (println "CONFIG-NS 2: " config-ns)
+          ;; (doseq [[isym ivar] (ns-interns config-ns)] (println "ISYM2: " isym ivar))
           (let [config-var (if-let [v (resolve config-sym)]
                              v (throw (Exception. (str "can't find config var for: " config-sym))))
                 configs (deref config-var)


fix exception at fetching of the contacts

Former-commit-id: 084f067ae82eca5576f2fc84450c961b3b75cc2b

--- src/status_im/contacts/handlers.cljs
+++ src/status_im/contacts/handlers.cljs
@@ -5,7 +5,8 @@
             [clojure.string :as s]
             [status-im.utils.utils :refer [http-post]]
             [status-im.utils.phone-number :refer [format-phone-number]]
-            [status-im.utils.handlers :as u]))
+            [status-im.utils.handlers :as u]
+            [status-im.utils.utils :refer [require]]))

 (defn save-contact
   [_ [_ contact]]
@@ -26,7 +27,7 @@
 (register-handler :load-contacts load-contacts!)

 ;; TODO see https://github.com/rt2zz/react-native-contacts/issues/45
-(def react-native-contacts #_(js/require "react-native-contacts"))
+(def react-native-contacts (require "react-native-contacts"))

 (defn contact-name [contact]
   (->> contact


set nosniff on content type

set nosniff on content type

--- src/cavm/core.clj
+++ src/cavm/core.clj
@@ -127,6 +127,7 @@
   (fn [request]
     (-> (handler request)
         (assoc-in [:headers "Xena-API"] version)
+        (assoc-in [:headers "X-Content-Type-Options"] "nosniff")
         (update-in [:headers "Vary"] #(if % (s/join ", " [% "Origin"]) "Origin")))))

 (defn- attr-middleware [app k v]


added jetty

added jetty

--- src/ubb_api/crawler/cs_timetable.clj
+++ src/ubb_api/crawler/cs_timetable.clj
@@ -1,6 +1,7 @@
 (ns ubb-api.crawler.cs-timetable
   (:require [net.cgrand.enlive-html :as html]
-            [clojure.java.io :refer [as-url]]))
+            [clojure.java.io :refer [as-url]]
+            [ring.adapter.jetty :as jetty]))

 (def row-size 8)


Remove commented code.

Remove commented code.


Cleanup

Cleanup

--- src/vignette/util/image_response.clj
+++ src/vignette/util/image_response.clj
@@ -113,4 +113,3 @@
         (header "Vary" "Accept"))
     response-map)
 )
-


adding reload

adding reload

--- test/celestial/features/kvm.clj
+++ test/celestial/features/kvm.clj
@@ -29,14 +29,18 @@
   (with-conf local-conf
     (with-state-changes [(before :facts (populate-system redis-type redis-kvm))]
       (fact "kvm creation workflows" :integration :kvm :workflow
-           (wf/create (spec)) => nil
-           (wf/stop (spec)) => nil
-           (wf/start (spec)) => nil
-           (wf/destroy (spec)) => nil
-          )
+         (wf/create (spec)) => nil
+         (wf/stop (spec)) => nil
+         (wf/start (spec)) => nil
+         (wf/destroy (spec)) => nil)

       (fact "kvm puppetization" :integration :kvm :workflow :puppet
         (wf/create (spec)) => nil
         (wf/provision redis-type (spec)) => nil
         (wf/destroy (spec)) => nil)
+
+      (fact "kvm reload" :integration :kvm :workflow :puppet
+        (wf/create (spec)) => nil
+        (wf/reload (spec)) => nil
+        (wf/destroy (spec)) => nil)
       )))


Mock server includes pagination link header

--- test/cljs_rest/mock_server.cljs
+++ test/cljs_rest/mock_server.cljs
@@ -1,6 +1,7 @@
 (ns cljs-rest.mock-server
   (:require-macros [cljs.core.async.macros :refer [go]])
-  (:require [cljs-http.client :as http]
+  (:require [clojure.string :as string]
+            [cljs-http.client :as http]
             [cljs-http.util :refer [json-encode json-decode]]))

 (def routes
@@ -85,21 +86,49 @@
   (response {:body {:name "Entries"}}))

 (defn pagination-params [req]
-  (let [params (http/parse-query-params (:query-string req))]
-    {:per-page (int (:per-page params 10))
-     :page (int (:page params 1))}))
-
-(defn paginate [params entries]
-  (let [{:keys [per-page page]} params
+  (let [params (http/parse-query-params (:query-string req))
+        per-page (int (:per-page params 10))
+        page (int (:page params 1))
         skip (* per-page (dec page))]
-    (->> entries
+    {:per-page per-page
+     :page page
+     :skip skip}))
+
+(defn paginate [params items]
+  (let [{:keys [per-page page skip]} params]
+    (->> items
          (drop skip)
          (take per-page))))

+(defn pagination-url [base-url per-page page]
+  (str base-url "?" (http/generate-query-string {:per-page per-page :page page})))
+
+(defn link-header [links]
+  (string/join ", "
+    (reduce
+      (fn [acc [k url]]
+        (when url
+          (conj acc (str "<" url ">; rel=\"" (name k) "\""))))
+      []
+      links)))
+
+(defn pagination-headers [base-url params items]
+  (let [{:keys [per-page page skip]} params
+        total (count items)
+        prev (when (> skip 0)
+               (pagination-url base-url per-page (dec page)))
+        next (when (> total (+ skip per-page))
+               (pagination-url base-url per-page (inc page)))
+        link-header (link-header {:prev prev :next next})]
+    (when link-header
+      {"link" link-header})))
+
 (defmethod request [:get :entries] [req]
   (let [params (pagination-params req)
-        results (paginate params @entries)]
-    (response {:body results})))
+        items @entries]
+    (response
+      {:headers (pagination-headers (:uri req) params items)
+       :body (paginate params items)})))

 (defmethod request [:post :entries] [req]
   (let [data (json-decode (:body req))


Fixed namespace for clouseau.test-products

--- test/clouseau/test_products.clj
+++ test/clouseau/test_products.clj
@@ -36,7 +36,7 @@
 ;;; exception statement from your version.
 ;;;

-(ns clouseau.test-core
+(ns clouseau.test-products
   (:require [clojure.test :refer :all]
             [clouseau.products :refer :all]))


sped up stress test code

sped up stress test code

--- test/acceptance/new_stress_tests.clj
+++ test/acceptance/new_stress_tests.clj
@@ -26,9 +26,9 @@
     (push/run
       interpreter
       program
-      20000
+      5000
       :bindings bindings
-      :config {:step-limit 20000
+      :config {:step-limit 5000
                :lenient true
                :max-collection-size 131072} ;131072
                )))


Add test for no configuration differences.

--- test/active/clojure/config_test.cljc
+++ test/active/clojure/config_test.cljc
@@ -219,6 +219,17 @@

 (deftest diff
+  (is (empty?
+       (c/diff-configurations
+        schema3
+        (c/make-configuration
+         schema3
+         []
+         {:inherits {:foo 5}})
+        (c/make-configuration
+         schema3
+         []
+         {:inherits {:foo 5}}))))
   (is (= '([[:inherits :foo] 5 0] [[:outer :inherits :foo] 5 0])
          (c/diff-configurations
           schema3


Add test for checking that sent request match the count in response

--- test/clj_gatling/simulation_test.clj
+++ test/clj_gatling/simulation_test.clj
@@ -2,6 +2,10 @@
   (:use clojure.test)
   (:require [clj-gatling.simulation :as simulation]
             [clj-time.core :as time]))
+
+(def request-count (atom 0))
+
+(defn counting-request [id cb] (do (swap! request-count inc) (cb true)))

 (defn successful-request [id cb] (cb true))

@@ -19,6 +23,10 @@
   {:name "Test scenario"
    :requests [{:name "Request1" :fn successful-request}
               {:name "Request2" :fn failing-request}]})
+
+(def counting-scenario
+  {:name "Counting scenario"
+   :requests [{:name "Request1" :fn counting-request}]})

 (def scenario2
   {:name "Test scenario2"
@@ -62,8 +70,10 @@
     (is (= 2 (-> result second :requests count)))))

 (deftest with-multiple-number-of-requests
-  (let [result (simulation/run-simulation [scenario] 10 {:requests 100})]
-    (is (= 100 (->> result (map :requests) count)))))
+  (reset! request-count 0)
+  (let [result (simulation/run-simulation [counting-scenario] 100 {:requests 2000})]
+    (is (= 2000 (->> result (map :requests) count))
+    (is (= 2000 @request-count)))))

 (deftest duration-given
   (let [result (simulation/run-simulation [scenario] 1 {:duration (time/millis 50)})]


oops, broke the tests

oops, broke the tests

--- test/spicerack/core_test.clj
+++ test/spicerack/core_test.clj
@@ -2,7 +2,7 @@
   (:require [clojure.test :refer :all]
             [spicerack.core :refer :all]))

-(def test-filename "test-db")
+(def test-filename "./test-db")

 (defn cleanup
   "Removes the test database. To be used before and after testing."


Versionumero

Versionumero

--- mtg-pairings-server/project.clj
+++ mtg-pairings-server/project.clj
@@ -1,4 +1,4 @@
-(defproject mtg-pairings-server "2.0.0"
+(defproject mtg-pairings-server "2.0.1"
   :license {:name "MIT License"
             :url  "http://www.opensource.org/licenses/mit-license.php"}
   :dependencies [[org.clojure/clojure "1.9.0"]


Quick batch test

Quick batch test

--- test/semantic_csv/core_test.clj
+++ test/semantic_csv/core_test.clj
@@ -186,3 +186,13 @@
                ["x" "y"]))))))

+(deftest batch-test
+  (let [xs (for [i (range 20)] [i (* i 2)])]
+    (testing "makes the right number of batches"
+      (is (= (count (batch 7 xs))
+             3)))
+    (testing "doesn't put more things than it should in final batch"
+      (is (= (->> xs (batch 7) last count)
+             6)))))
+
+


evaluate program string

evaluate program string

--- src/flax/core.clj
+++ src/flax/core.clj
@@ -408,7 +408,7 @@
   ;; A program's main is a collection of one or more entry point groups
   ;; that are kicked off concurrently.
   (let [program (try
-                  (resolve-program (:data-connector config) (:program config))
+                  (resolve-program (:data-connector config) (evaluate (:program config) config))
                   (catch Exception e
                     (die
                       "The configuration must have a program property, which must be a path to a valid yaml document:"


'test-external-shutdown' uses new 'run' function

This is equivalent to the previous behavior of manually calling
'bootstrap' and then 'run-app'.

--- test-resources/shutdown_app/test_external_shutdown.clj
+++ test-resources/shutdown_app/test_external_shutdown.clj
@@ -8,9 +8,8 @@

 (defn -main
   [& args]
-  (let [app (trapperkeeper/bootstrap
-              {:config "./test-resources/config/empty.ini"
-               :bootstrap-config "test-resources/shutdown_app/bootstrap.cfg"})]
-    (println "Waiting for a shutdown signal - use Ctrl-C or kill.")
-    (println "You should see a message printed out when services are being shutdown.")
-    (trapperkeeper/run-app app)))
+  (println "Waiting for a shutdown signal - use Ctrl-C or kill.")
+  (println "You should see a message printed out when services are being shutdown.")
+  (trapperkeeper/run
+    {:config "./test-resources/config/empty.ini"
+     :bootstrap-config "test-resources/shutdown_app/bootstrap.cfg"}))


don't render empty cell

don't render empty cell


(MAINT) removed unused imports

(MAINT) removed unused imports

--- test/unit/puppetlabs/puppetserver/shell_utils_test.clj
+++ test/unit/puppetlabs/puppetserver/shell_utils_test.clj
@@ -1,9 +1,8 @@
 (ns puppetlabs.puppetserver.shell-utils-test
   (:require [clojure.test :refer :all]
             [puppetlabs.puppetserver.shell-utils :as sh-utils]
-            [puppetlabs.trapperkeeper.testutils.logging :as logging]
             [me.raynes.fs :as fs])
-  (:import (java.io ByteArrayInputStream IOException)))
+  (:import (java.io ByteArrayInputStream)))

 (def test-resources
   (fs/absolute-path


DM & CM - Render username to index page

DM & CM - Render username to index page

--- src/d_cent/core.clj
+++ src/d_cent/core.clj
@@ -35,14 +35,12 @@
 (defn twitter-login [_]
   (let [request-token (oauth/request-token consumer "http://localhost:8080/twitter-callback")
         approval-uri (oauth/user-approval-uri consumer (:oauth_token request-token))]
-    (log/info "Twitter login")
     (response/redirect approval-uri)))

 (defn twitter-callback [{params :params}]
   (let [access-token-response (oauth/access-token consumer
                                                   params
                                                   (:oauth_verifier params))]
-    (log/info "Twitter callback")
     (friend/merge-authentication
      (response/redirect "/")
      (workflows/make-auth {:username (access-token-response :screen_name)}
@@ -58,11 +56,12 @@

 (defn index [{:keys [t' locale]}]
-  (rendered-response "index.mustache"
-                     {:title (t' :index/title)
-                      :welcome (t' :index/welcome)
-                      :twitter-login (t' :index/twitter-login)
-                      :locale (subs (str locale) 1)}))
+  (let [username (get (friend/current-authentication) :username "")]
+    (rendered-response "index.mustache"
+                       {:title (t' :index/title)
+                        :welcome (str (t' :index/welcome) " " username)
+                        :twitter-login (t' :index/twitter-login)
+                        :locale (subs (str locale) 1)})))

 (def handlers {:index index})

@@ -83,6 +82,7 @@
   (wrap-core-middleware
    (make-handler routes (some-fn handlers #(when (fn? %) %)))))

+
 (defn start-server []
   (let [port (Integer/parseInt (get environment "PORT" "8080"))]
     (log/info (str "Starting d-cent on port " port))


Prevent name conflict with core.async's go macro

--- clstreams/dev/user.clj
+++ clstreams/dev/user.clj
@@ -24,13 +24,13 @@
   (alter-var-root #'system
                   (fn [s] (when s (component/stop s)))))

-(defn go []
+(defn reset []
+  (stop)
+  (refresh :after 'user/after-reset))
+
+(defn after-reset []
   (init)
   (start))
-
-(defn reset []
-  (stop)
-  (refresh :after 'user/go))

 (defn -main


Modify normalise so it doesn't throw an IndexOutOfBoundsException when last column is nil.

--- src/grafter/csv.clj
+++ src/grafter/csv.clj
@@ -184,7 +184,7 @@
                         (let [rowv (->> row (take srange) (apply vector))]
                           (-> rowv
                               (conj (nth header-row id))
-                              (conj (nth row id)))))
+                              (conj (nth row id nil)))))

         expand-rows (fn [row] (map normalise-row colids (repeat ncols row)))]


add toString to convert type

add toString to convert type

--- src/neuseg/db.clj
+++ src/neuseg/db.clj
@@ -63,10 +63,11 @@
     (if idx (get-row ngram idx) (zero-vector dim))))

 (defn get-vector [s]
-  (case (.length s)
-    1 (retrieve-vector "unigram" s)
-    2 (retrieve-vector "bigram" s)
-    3 (retrieve-vector "trigram" s)
-    4 (retrieve-vector "quadgram" s)
-    (zero-vector 0)))
+  (let [wd (.toString s)]
+    (case (.length s)
+      1 (retrieve-vector "unigram" wd)
+      2 (retrieve-vector "bigram" wd)
+      3 (retrieve-vector "trigram" wd)
+      4 (retrieve-vector "quadgram" wd)
+      (zero-vector 0))))


fix broken svg and png rendering

fix broken svg and png rendering

--- src/pc/render.clj
+++ src/pc/render.clj
@@ -27,7 +27,7 @@
 ;; If they've drawn in negative directions, then we to shift the viewport in the
 ;; that direction with a transform.
 (defn render-layers [layers & {:keys [invert-colors? size-limit]}]
-  (let [layers (filter #(not= :layer.type/group (:layer/type %)) layers)
+  (let [layers (map #(into {} %) (filter #(not= :layer.type/group (:layer/type %)) layers))
         start-xs (remove #(.isNaN %) (map :layer/start-x layers))
         start-ys (remove #(.isNaN %) (map :layer/start-y layers))
         end-xs (remove #(.isNaN %) (map :layer/end-x layers))


handle creating svgs for empty documents

--- src/pc/render.clj
+++ src/pc/render.clj
@@ -26,8 +26,8 @@
         start-ys (remove #(.isNaN %) (map :layer/start-y layers))
         end-xs (remove #(.isNaN %) (map :layer/end-x layers))
         end-ys (remove #(.isNaN %) (map :layer/end-y layers))
-        xs (concat start-xs end-xs)
-        ys (concat start-ys end-ys)
+        xs (or (seq (concat start-xs end-xs)) [0])
+        ys (or (seq (concat start-ys end-ys)) [0])
         min-x (apply min xs)
         min-y (apply min ys)
         max-x (apply max xs)


Lets capture the time it takes to get a list endpoint out. (#1205)

--- scheduler/src/cook/rest/api.clj
+++ scheduler/src/cook/rest/api.clj
@@ -2606,7 +2606,7 @@
                  (timers/time!
                    (timers/timer ["cook-scheduler" "handler" "list-endpoint-duration"])
                    (let [job-ents (list-job-ents db false ctx)]
-                     (mapv (partial fetch-job-map-from-entity db) job-ents))))))
+                     (doall (mapv (partial fetch-job-map-from-entity db) job-ents)))))))

 ;;
 ;; /unscheduled_jobs


Whoops!

Whoops!

--- src/tick/core.clj
+++ src/tick/core.clj
@@ -136,7 +136,7 @@
   (year [f] (year (f)))
   (year-month [f] (year-month (f)))
   (zone [f] (zone (f)))
-  (zoned-date-time [f] (zone (f)))
+  (zoned-date-time [f] (zoned-date-time (f)))
   (local-date-time [f] (local-date-time (f)))

   Instant


Finer-grained sleep in test

Finer-grained sleep in test

--- caching/test/immutant/caching_test.clj
+++ caching/test/immutant/caching_test.clj
@@ -122,10 +122,9 @@
 (deftest test-put-idle
   (let [c (new-cache :idle 200)]
     (.put c :a 1)
-    (Thread/sleep 100)
-    (is (= 1 (get c :a)))
-    (Thread/sleep 100)
-    (is (= 1 (get c :a)))
+    (dotimes [_ 4]
+      (Thread/sleep 50)
+      (is (= 1 (get c :a))))
     (Thread/sleep 250)
     (is (nil? (get c :a)))))


core typed

core typed

--- vif-navigator-libs2/src/ru/vif/model/vif_xml_tools.clj
+++ vif-navigator-libs2/src/ru/vif/model/vif_xml_tools.clj
@@ -1,6 +1,7 @@
 (ns ru.vif.model.vif-xml-tools
   (:require [clojure.string :refer [blank?]]
             [ru.vif.model.records :refer :all]
+            [clojure.core.typed :as t]
             )
   (:import (java.util Date)
            (clojure.lang Keyword IPersistentMap)
@@ -18,7 +19,12 @@
                      nil   :mode-not-unfixed}
   )

+(t/defalias NillableString (t/U nil String))
+(t/defalias NillableLong (t/U nil Long))
+(t/ann clojure.core/some? [t/Any -> Boolean :filters {:then (! nil 0), :else (is nil 0)}])
+(t/non-nil-return java.text.SimpleDateFormat/parse :all)

+(t/ann safe-parse-date [NillableString -> NillableLong])
 (defn safe-parse-date [^String str]
   (if (some? str)
     (.getTime (.parse TIME_FORMAT str))


my butlast

my butlast

--- practice/alfa.clj
+++ practice/alfa.clj
@@ -61,5 +61,11 @@
       (reverse res)
       (recur (inc n) (cons n res)))))

+(defn butlast$$ [col]
+  (loop [ls col res []]
+        (if (= 1 (count ls))
+            res
+            (recur (rest ls) (conj res (first ls))))))
+
 ;; Reimplementing Clojure in pure recursion
 ;; last, butlast, keep, map, take, take-while, remove, drop, drop-while, distinct, range, for


CMR-7753 fixing broken test. (#1386)

CMR-7753 fixing broken test. (#1386)

--- system-int-test/test/cmr/system_int_test/search/collection_consortium_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/collection_consortium_search_test.clj
@@ -49,9 +49,9 @@
                                     (get-in [:results :entries])
                                     first
                                     :consortiums)]
-        (is (= ["cst11" "cst12"] consortiums-in-json))
-        (is (= ["cst21" "cst22"] consortiums-in-atom))))
-
+        (is (= ["consortium11" "consortium12"] consortiums-in-json))
+        (is (= ["consortium21" "consortium22"] consortiums-in-atom))))
+
     (testing "consortium parameter search"
       (are3 [items consortium options]
         (let [params (merge {:consortium consortium}