Spel chekin

Spel chekin

--- clojure-programming/src/clojure_programming/chp03.clj
+++ clojure-programming/src/clojure_programming/chp03.clj
@@ -18,14 +18,14 @@

 "
 Clojure collections are idiomatically used in terms of abstractions and not as
-concrete implementations.
+concrete implementationis.
 They are immutable and persistent.
 "

 [[:section {:title "Abstractions over Implementations --  page: 84"}]]

 "
-Clojures insistence on using abstractions over collections is similar to
+Clojure's insistence on using abstractions over collections is similar to
  polymorphism and interface types in OO languages, but more general and more
  powerful.

@@ -79,7 +79,7 @@
   (fact "... adds to front"
     (conj lst 0 -1)
     => '(-1 0 1 2 3))
-  (fact "immuatable"
+  (fact "immutable"
     (seq lst)
     => '(1 2 3)))

@@ -115,7 +115,7 @@
 useful, for instance the clojure collections don't implement Java's mutable
 interfaces.

-There seven primary abstractions that Clojures data structures implement:
+There seven primary abstractions that Clojure's data structures implement:
 - Collection
 - Sequence
 - Associative
@@ -272,7 +272,7 @@
   => '(\l \o \j \u \r \e))

 "
-'rest' underlies the the implementation of variadic functions
+'rest' underlies the implementation of variadic functions

 'rest' and 'next' differ on the way that they treat sequences containing 0 or 1
  values:
@@ -410,7 +410,12 @@

 "Is this list lazy? Let's check:
 "
-(defn random-ints
+(defnure and Java collections, Java maps, Java
+CharSequences (including Strings), Java Iterables, Arrays, nil (null), anything
+clojure.lang.Seq.
+
+"
+(facts "some examples:" random-ints
   [limit]
   (lazy-seq
    (println "realizing random number") ;print when value is realized
@@ -522,7 +527,7 @@
     (dissoc m :b)
     => {:c 3, :a 1}))

-(facts "'assoc' and 'dissoc can be used for mutiple entries"
+(facts "'assoc' and 'dissoc can be used for multiple entries"
   (fact
     (assoc m
       :x 4
@@ -598,7 +603,12 @@
 (facts
   (fact "String"
     (get "Clojure" 3)
-    => \j)
+ure and Java collections, Java maps, Java
+CharSequences (including Strings), Java Iterables, Arrays, nil (null), anything
+clojure.lang.Seq.
+
+"
+(facts "some examples:"    => \j)
   (fact "Java map"
     (contains? (java.util.HashMap.) "not-there")
     => false)
@@ -663,7 +673,7 @@
   (fact
     (get [:a :b :c] 2)
     => :c)
-  (fact "Opps!"
+  (fact "Oops!"
     (nth  [:a :b :c] 3)
     => (throws IndexOutOfBoundsException))
   (fact "Better."
@@ -685,15 +695,15 @@
     => :not-found))

 "
-'nth' can only work with numberical idices and only works on things that
-are numerically indexd, vectors lists, sequences, Java arrays, Java lists,
+'nth' can only work with numerical idices and only works on things that
+are numerically indexed, vectors lists, sequences, Java arrays, Java lists,
 strings, and regular expression matchers.
-'get' is more general, and more resiliant. "
+'get' is more general, and more resilient. "

 (fact "'get' returns nil for things that aren't collections"
   (get 42 3)
   => nil)
-(fact "opps!"
+(fact "oops!"
   (nth 42 0)
   => (throws UnsupportedOperationException))

@@ -747,7 +757,7 @@
     (pop [1])
     => []))
 "
-poping an empty stack results in error
+popping an empty stack results in error
 "

@@ -775,7 +785,7 @@
     (disj #{1 2 3} 3 1)
     => #{2}))

-"clojure.set include more highlevel set operations"
+"clojure.set include more high level set operations"

 [[:subsection {:title "Sorted abstraction --  page: 106"}]]
@@ -783,7 +793,7 @@
 sorted collections ensure that the values they contain will maintain
 a sorted order depending on a predicate, or a special comparator interface.

-funtions: 'rseq', 'subseq', 'rsubseq'
+functions: 'rseq', 'subseq', 'rsubseq'

 only maps and sets have sorted variants.
 "
@@ -838,7 +848,7 @@

 A comparator is a two argument function that returns a positive
  integer if the first argument is > than the second, a negative
- if the second arguent is greater, zero if they are equal
+ if the second argument is greater, zero if they are equal

 All Clojure functions implement Comparator, so any two argument
  predicate will do
@@ -867,7 +877,7 @@
     (sorted-map-by (comp - compare) :z 5 :x 9 :y 0 :b 2 :a 3 :c 4)
     => {:z 5, :y 0, :x 9, :c 4, :b 2, :a 3})  )

-"rational but surprisesing results: "
+"rational but surprising results: "
 (defn magnitude
   [x]
   (-> x
@@ -896,7 +906,7 @@
     => 0)  )

 (facts "use our new comparator in a sorted collection"
-  (fact "10,1000,500 have differen orders of magnatued, so they sort"
+  (fact "10,1000,500 have different orders of magnitude, so they sort"
     (def a
       (sorted-set-by compare-magnitude 10 1000 500))
     a => #{10 500 1000})
@@ -918,7 +928,12 @@
   (let [diff (- (magnitude a) (magnitude b))]
     (if (zero? diff)
       (compare a b)
-      diff)))
+ure and Java collections, Java maps, Java
+CharSequences (including Strings), Java Iterables, Arrays, nil (null), anything
+clojure.lang.Seq.
+
+"
+(facts "some examples:"      diff)))
 (facts
   (def a
     (sorted-set-by compare-magnitude 10 1000 500))
@@ -997,7 +1012,7 @@
               {:name "Sara" :location "NYC"}])
   => '("David" "Suzanne" "Sara"))

-(facts "'some' searches for the first values in  a sequnce that
+(facts "'some' searches for the first values in  a sequence that
          logically returns true"
   (fact
     (some #{1 3 7} [0  2 4 5 6])
@@ -1037,9 +1052,9 @@
 "
 [[:subsection {:title "Lists --  page: 114"}]]
 "
-The original type in Lisp but mustly used to represent function calls
+The original type in Lisp but mostly used to represent function calls
 in Clojure.
-They are singly linked lists so they are most efficiently accesd at
+They are singly linked lists so they are most efficiently accessed at
 their 'head' using 'conj' 'pop', or 'rest' They don't have efficient random access. 'nth' runs in linear time. 'get' is not supported for lists. Lists are their own sequences
 "
 (fact "list literal:"
@@ -1055,14 +1070,19 @@
   => '(1 2 3))

 [[:subsection {:title "Vectors --  page: 115"}]]
-"
-Vectors are sequenctial data structures that support random lookup
-Vectors partiscipate in associative, indexed and stack abstractions
+ure and Java collections, Java maps, Java
+CharSequences (including Strings), Java Iterables, Arrays, nil (null), anything
+clojure.lang.Seq.
+
+"
+(facts "some examples:""
+Vectors are sequential data structures that support random lookup
+Vectors participate in associative, indexed and stack abstractions
 "
 (fact "vectors can be created with 'vector' and 'vec'"
   (vector 1 2 3)  ; 'vector' is the analog of 'list'
   => '[1 2 3]
-  (vec (range 5)) ; 'vec' expects a sequectial arguement to construct
+  (vec (range 5)) ; 'vec' expects a sequential argument to construct
   => [0 1 2 3 4]) ; to construct a vector.

 (fact "'vector?' is used to test whether a value is a vector "
@@ -1075,21 +1095,26 @@
 Vectors as tuples - a common use case.
 "

-(defn euclidian-division
-  "return a euclidian tuple"
+(defn euclidean-division
+  "return a euclidean tuple"
   [x y]
   [(quot x y) (rem x y)])

 (fact "returning multiple values from a function"
-  (euclidian-division 42 8)
+  (euclidean-division 42 8)
   => [5 2])

 (fact "simpler:"
   ((juxt quot rem) 42 8)
   => [5 2])

-(fact "using destructuring to unpack return values "
-  (let [[q r] (euclidian-division 53 7)]
+(fact "using destructuringure and Java collections, Java maps, Java
+CharSequences (including Strings), Java Iterables, Arrays, nil (null), anything
+clojure.lang.Seq.
+
+"
+(facts "some examples:" to unpack return values "
+  (let [[q r] (euclidean-division 53 7)]
     (str "53/7 = " q " * 7 + " r))
   => "53/7 = 7 * 7 + 4")
 "
@@ -1098,7 +1123,7 @@
   tuples are inflexible, you have to provide values for all the slots
   and tuples are hard to extend.

-maps are more flexible, but vectors as tuples make sence in some
+maps are more flexible, but vectors as tuples make sense in some
  domains, such a points in graphics
 "
 (def point-3d [42 26 -7])
@@ -1124,7 +1149,7 @@
   => (contains #{1 3 6 7 8}))

 "
-'set' works for anything seqable giving very useful idioms, where
+'set' works for anything seq-able giving very useful idioms, where
 sets are functions
 "

@@ -1170,7 +1195,7 @@
 "
 Maps as ad-hoc structs

-Maps a very flexible and alow data modeling even before the design
+Maps a very flexible and allow data modeling even before the design
  is nailed down.
 "
 (def playlist
@@ -1184,7 +1209,7 @@
 "
 the (:slot data) idiom
 "
-(fact "querying data agregates"
+(fact "querying data aggregates"
   (map :title playlist)
   => '("Elephant" "Helioself" "Stories from the City, Stories from the Sea" "Buildings and Grounds" "Zen Rodeo"))

@@ -1321,7 +1346,7 @@

 (def v2 (conj v 1e6)) ; 'conj' a value to 'v'

-(fact "Clojures data structures are immuatable"
+(fact "Clojure's data structures are immutable"
   (count v)
   => 1000000
   (count v2)
@@ -1345,7 +1370,7 @@
 (fact b => '(0 1 2 3))

 "
-poping the head of a list is also a constant time operation
+popping the head of a list is also a constant time operation
 (it just move a pointer):
 "
 (def c (rest a))
@@ -1387,15 +1412,15 @@
   version2
   => {:info {:age 34}, :name "Chas"})
 "
-'update-in' updates the value identified by the vector arguement located
+'update-in' updates the value identified by the vector argument located
 in the nested structure by applying the given function and producing
 a new structure.
 "

 [[:subsection {:title "Transients --  page: 130"}]]
 "
-transient data structures are the opposite of pesistent.
-based on the notion if noone notices if a data structure is mutated, does
+transient data structures are the opposite of persistent.
+based on the notion if no-one notices if a data structure is mutated, does
 that mutation hurt anyone?
 "
 (def x (transient []))  ; a transient vector using a persistent
@@ -1411,7 +1436,7 @@
     => 1))

 "
-this is useful for implementing efficient functions that use datastructures.
+this is useful for implementing efficient functions that use data-structures.

 "
 (fact "example 'into'"
@@ -1454,7 +1479,12 @@
   (transient-capable? '(1 2 3)) => false
   (transient-capable? #{1 2 3}) => true
   (transient-capable? {:a 1 :b 2}) => true
-  (transient-capable? [1 2 3]) => true)
+  (transient-capable? [1 2 ure and Java collections, Java maps, Java
+CharSequences (including Strings), Java Iterables, Arrays, nil (null), anything
+clojure.lang.Seq.
+
+"
+(facts "some examples:"3]) => true)

 "
 a persistent collection used as a transient is unaffected


CMR-5503: Remove unneccessary trim newline.

--- common-lib/src/cmr/common/validations/json_schema.clj
+++ common-lib/src/cmr/common/validations/json_schema.clj
@@ -17,7 +17,7 @@
    Throws an exception if the provided JSON is not valid JSON."
   [^String json-string]
   (try
-    (let [tokener (JSONTokener. (string/trim (string/trim-newline json-string)))
+    (let [tokener (JSONTokener. (string/trim json-string))
           json-type (.nextValue tokener)]
       (if (.more tokener)
         (throw (.syntaxError tokener "Trailing characters are not permitted."))


adding delay feature to upmap

adding delay feature to upmap

--- src/flax/core.clj
+++ src/flax/core.clj
@@ -33,7 +33,8 @@
               (map
                 #(do
                    (Thread/sleep (or delay 0))
-                   (future (fn %)) coll)))]
+                   (future (fn %)))
+                coll))]
       @p)))


Fix docstring for pst

Fix docstring for pst

--- planck-cljs/src/planck/core.cljs
+++ planck-cljs/src/planck/core.cljs
@@ -51,8 +51,7 @@
     doc            {:arglists ([name])
                     :doc      "Prints documentation for a var or special form given its name"}
     pst            {:arglists ([] [e])
-                    :doc      (str "Prints a stack trace of the exception. If none supplied, uses the root cause of the "
-                                   "most recent repl exception (*e)")}})
+                    :doc      "Prints a stack trace of the exception.\n  If none supplied, uses the root cause of the most recent repl exception (*e)"}})

 (defn- repl-special-doc [name-symbol]
   (assoc (repl-special-doc-map name-symbol)


Use the proper name for source map cache

This change deals with macros ns

--- planck-cljs/src/planck/repl.cljs
+++ planck-cljs/src/planck/repl.cljs
@@ -527,7 +527,7 @@
   [path name source cache]
   (when (and path source cache (:cache-path @app-env))
     (let [cache-json (cljs->transit-json cache)
-          sourcemap-json (when-let [sm (get-in @planck.repl/st [:source-maps name])]
+          sourcemap-json (when-let [sm (get-in @planck.repl/st [:source-maps (:name cache)])]
                            (cljs->transit-json sm))]
       (log-cache-activity :write path cache-json sourcemap-json)
       (js/PLANCK_CACHE (cache-prefix-for-path path (is-macros? cache))


Add a job that runs every 10 secs

Add a job that runs every 10 secs

--- src/odva/server.clj
+++ src/odva/server.clj
@@ -2,6 +2,11 @@
   (:gen-class) ; for -main method in uberjar
   (:require [io.pedestal.http :as server]
             [io.pedestal.http.route :as route]
+            [clojurewerkz.quartzite.scheduler :as qs]
+            [clojurewerkz.quartzite.triggers :as t]
+            [clojurewerkz.quartzite.jobs :refer [defjob]]
+            [clojurewerkz.quartzite.schedule.simple :refer [schedule repeat-forever with-interval-in-milliseconds]]
+            [clojurewerkz.quartzite.jobs :as j]
             [odva.service :as service]))

 ;; This is an adapted service map, that can be started and stopped
@@ -27,9 +32,25 @@
       server/create-server
       server/start))

+(defjob NoOpJob
+  [ctx]
+  (println "This job does nothing"))
+
 (defn -main
   "The entry-point for 'lein run'"
   [& args]
+  (let [s (-> (qs/initialize) qs/start)
+        job (j/build
+             (j/of-type NoOpJob)
+             (j/with-identity (j/key "jobs.noop.1")))
+        trigger (t/build
+                 (t/with-identity (t/key "triggers.1"))
+                 (t/start-now)
+                 (t/with-schedule (schedule
+                                   (repeat-forever)
+                                   (with-interval-in-milliseconds 10000))))
+        ]
+    (qs/schedule s job trigger))
   (println "\nCreating your server...")
   (server/start runnable-service))


rollback not commit

rollback not commit

--- src/ophion/core.clj
+++ src/ophion/core.clj
@@ -86,9 +86,7 @@
      source
      (fn []
        (log/debug "query complete")
-       ;; (db/commit graph)
-       ;; (db/rollback graph)
-       (.commit transaction)))
+       (.rollback transaction)))
     {:status 200
      :headers {"content-type" "application/json"}
      :body source}))


Added extra information to the local environment.

--- src/appengine_magic/local_env_helpers.clj
+++ src/appengine_magic/local_env_helpers.clj
@@ -8,6 +8,9 @@

 (defonce *current-app-id* (atom nil))
+(defonce *current-app-version* (atom nil))
+
+(defonce *current-server-port* (atom nil))

 (defn make-thread-environment-proxy [& {:keys [user-email user-admin?]}]
@@ -19,7 +22,8 @@
     (getAttributes [] (java.util.HashMap.))
     (getEmail [] (or user-email ""))
     (isAdmin [] (or (Boolean/parseBoolean user-admin?) false))
-    (getAppId [] @*current-app-id*)))
+    (getAppId [] @*current-app-id*)
+    (getVersionId [] @*current-app-version*)))

 (defn appengine-init [#^File dir, port]
@@ -27,6 +31,9 @@
         application-id (if (.exists appengine-web-file)
                            (first (xpath-value appengine-web-file "//application"))
                            "appengine-magic-app")
+        application-version (if (.exists appengine-web-file)
+                                (first (xpath-value appengine-web-file "//version"))
+                                "none")
         proxy-factory (ApiProxyLocalFactory.)
         environment (proxy [LocalServerEnvironment] []
                       (getAppDir [] dir)
@@ -35,6 +42,8 @@
                       (waitForServerToStart [] nil))
         api-proxy (.create proxy-factory environment)]
     (reset! *current-app-id* application-id)
+    (reset! *current-app-version* application-version)
+    (reset! *current-server-port* port)
     (ApiProxy/setDelegate api-proxy)
     ;; This installs a thread environment onto the REPL thread and allows App
     ;; Engine API calls to work in the REPL.


Implement branching history datastructure.

--- src-cljs/cljs_workspace/om_test.cljs
+++ src-cljs/cljs_workspace/om_test.cljs
@@ -67,41 +67,83 @@

 ;; snapshot the state when it is changed:

-; (def app-history (atom [@app-state]))
+; The history actually stores each state as a first class object,
+; even after branching happens:
+;
+; -----\----
+;       \------
+;
+; [ . . . . . {new-branch: \ old-val: _ } . . . ] <
+;                           \                      \
+;                            V                      \
+;                           {:offset-index _ :parent | :coll [ . . . .  ] }

-; (defn pluralize [n w]
-;   (if (> n 1)
-;       (str w "s")
-;       (str w)))
+(def app-history (atom {:offset-index 0 :coll (atom [@app-state])}))

-; (add-watch app-state :history
-;   (fn [_ _ _ n]
-;     (when-not (= (last @app-history) n)
-;       (swap! app-history conj n))
-;     (let [c (count @app-history)]
-;         (prn (str c " Saved " (pluralize c "State"))))))
+(def current-branch (atom @app-history))
+
+(def reverted-to (atom -1))
+
+(defn pluralize [n w]
+  (if (> n 1)
+      (str w "s")
+      (str w)))
+
+(defn nth-history
+  ([i]
+    (nth-history i current-branch))
+  ([i branch]
+    (nth @(@branch :coll) i)))
+
+(defn branch-at [i n]
+  (prn "Branching at " i)
+  (let [index i
+        new-branch {:offset-index i :coll (atom []) :parent (atom @current-branch)}
+        ; split the current branch
+        coll @(@current-branch :coll)
+        [pre-branch post-branch] [(vec (take index coll)) (vec (drop index coll))]
+        ; insert the branching point into the old branch
+        branched-branch (into [] (concat pre-branch [{:new-branch new-branch :old-value (first post-branch)}] (rest post-branch)))]
+      ; update the old branch with the inserted version
+      (reset! (@current-branch :coll) branched-branch)
+      ; let current branch pointer point to new branch
+      (reset! current-branch new-branch)
+      (reset! reverted-to -1)))
+
+(defn save-state [n]
+    (cond (> @reverted-to -1)
+      ; we have to branch because a modification based on a reverted state:
+      (branch-at @reverted-to n)
+      ; else just append to history
+      :else
+      (let [b @(@current-branch :coll)]
+        (when-not (= (last b) n)
+          (swap! (@current-branch :coll) conj n))
+        (let [c (+ (@current-branch :offset-index) (count b))]
+            (prn (str c " Saved " (pluralize c "State")))))))
+
+(defn revert-to [i]
+  (prn "request revert: " i)
+  (let [index (* (dec (count @(@current-branch :coll))) (/ i 100))]
+    (when-let [state (when (>= index 1) (nth-history index))]
+      (prn "revert to: " index)
+      (reset! app-state state)
+      (reset! reverted-to index))))

 ; (defn undo [e]
 ;   (when (> (count @app-history) 1)
 ;     (swap! app-history pop)
 ;     (reset! app-state (last @app-history))))

-; (om/root
-;   (fn [app owner]
-;     (om/component (dom/button #js {:onClick undo} "Undo!")))
-;   app-state
-;   {:target (. js/document (getElementById "inspector"))})
+(om/root
+  (fn [app owner]
+    (om/component (dom/input #js {:type "range" :min 0 :max 100 :defaultValue 100
+                                  :onChange #(revert-to (.. % -target -value))})))
+  {}
+  {:target (. js/document (getElementById "inspector"))})

 (defn send-update [state]
-  (.send @socket (pr-str (select-keys (state :tx-data) [:new-value :path])))
-
-  ; (edn-xhr
-  ;   {:method :put
-  ;   :url "/data"
-  ;   :on-error (fn [res tx-data] (prn tx-data))
-  ;   :on-complete (fn [res] (prn "updated"))
-  ;   :data (select-keys (state :tx-data) [:new-value :path])})
-)
+  (.send @socket (pr-str (select-keys (state :tx-data) [:new-value :path]))))

 (let [sub-chan (chan)]
 (defn app-view [app owner opts]
@@ -122,6 +164,7 @@
                       :sync-chan sub-chan
                       :on-error
                       (fn [err tx-data]
+                        (prn "Error:")
                         (reset! app-state (:old-state tx-data))
                         (om/set-state! owner :err-msg
                           "Ooops! Sorry something went wrong try again later."))}})
@@ -134,7 +177,7 @@
   (edn-xhr
     {:method :get
      :url "/data"
-     :on-error (fn [res tx-data] (println res))
+     :on-error (fn [res tx-data] (prn "Error: ")(println res))
      :on-complete
      (fn [res]
        (let [host (aget js/window "location" "hostname")
@@ -143,11 +186,12 @@
             (set! (.-onmessage conn) (fn [e]
               (.log js/console (read-string (.-data e)))
               (reset! app-state (read-string (.-data e)))))
-            (swap! socket (fn [_] conn))) ; set the socket, so that it can be used for sending things
+            (reset! socket conn)) ; set the socket, so that it can be used for sending things
         (reset! app-state res)
         (om/root app-view app-state
            {:target (. js/document (getElementById "app"))
             :shared {:tx-chan tx-pub-chan}
             :tx-listen
             (fn [tx-data root-cursor]
+                (save-state (:new-state tx-data)) ; to enable the timeline
                 (put! tx-chan [tx-data root-cursor]))}))}))


Increase truncation limit to 200k.

Increase truncation limit to 200k.

--- src-cljs/frontend/models/action.cljs
+++ src-cljs/frontend/models/action.cljs
@@ -86,4 +86,4 @@
 (def max-output-size
   "Limits the number of chacaters we will try to display in the dom.
    The full output is availible for download."
-  (* 100 1000))
+  (* 200 1000))


Ready to release modular.aleph

Ready to release modular.aleph

--- modules/aleph/project.clj
+++ modules/aleph/project.clj
@@ -1,6 +1,6 @@
 ;; Copyright © 2014 JUXT LTD.

-(defproject juxt.modular/aleph "0.0.1-SNAPSHOT"
+(defproject juxt.modular/aleph "0.0.1"
   :description "A modular extension that provides support for aleph"
   :url "https://github.com/juxt/modular/tree/master/modules/aleph"
   :license {:name "The MIT License"


Release of new async

Release of new async

--- modules/async/project.clj
+++ modules/async/project.clj
@@ -1,6 +1,6 @@
 ;; Copyright © 2014 JUXT LTD.

-(defproject juxt.modular/async "0.5.2-SNAPSHOT"
+(defproject juxt.modular/async "0.5.2"
   :description "A modular extension that provides support core.async"
   :url "https://github.com/juxt/modular/tree/master/modules/http-kit"
   :license {:name "The MIT License"
@@ -8,5 +8,6 @@
   :dependencies [
                  [prismatic/schema "0.2.1"]
                  #_[org.clojure/core.async "0.1.267.0-0d7780-alpha"]
-                 [org.clojure/core.async "0.1.303.0-886421-alpha"]
+                 #_[org.clojure/core.async "0.1.303.0-886421-alpha"]
+                 [org.clojure/core.async "0.1.346.0-17112a-alpha"]
                  ])


solve the nil or zero problem

solve the nil or zero problem

--- src/cljs/just_married/home/countdown.cljs
+++ src/cljs/just_married/home/countdown.cljs
@@ -48,6 +48,10 @@
   []
   (reset! time-left (extract (get-time-left))))

+(defn- or-zero
+  [unit]
+  (or (unit @time-left) 0))
+
 ;; sample code found https://stackoverflow.com/questions/30280484/making-a-simple-countdown-timer-with-clojure-reagent
 (defn countdown-component
   "Generic component for the countdown"
@@ -57,9 +61,9 @@
                 #(swap! time-left reset-left-time) 1000)]

     [:div.timer {:class ["col-xs" "row"]}
-     [:div (str (:days @time-left) " " (tr :days))]
-     [:div (str (:hours @time-left) " " (tr :hours))]
-     [:div (str (:minutes @time-left) " " (tr :minutes))]]
+     [:div (str (or-zero :days) " " (tr :days))]
+     [:div (str (or-zero :hours) " " (tr :hours))]
+     [:div (str (or-zero :minutes) " " (tr :minutes))]]

     (finally (js/clearInterval timer-fn))))


Fix #110.

Fix #110.

--- src/quil/applet.clj
+++ src/quil/applet.clj
@@ -167,7 +167,7 @@
                     sketchFullScreen sketchFullScreenParent
                     exit exitParent})

-(defn -exit [this] (.dispose this))
+(defn -exit [this] (applet-close this))

 (defn -sketchFullScreen [this] (:present (meta this)))


up version

up version

--- kafka-clj/project.clj
+++ kafka-clj/project.clj
@@ -1,4 +1,4 @@
-(defproject kafka-clj "3.0.0-SNAPSHOT"
+(defproject kafka-clj "3.0.0"
   :description "fast kafka library implemented in clojure"
   :url "https://github.com/gerritjvv/kafka-fast"
   :license {:name "Eclipse Public License"


Add query timeout to defaults.

Add query timeout to defaults.

--- src/cavm/core.clj
+++ src/cavm/core.clj
@@ -163,6 +163,7 @@
   {:cache_size 65536
    :undo_log 1
    :log 1
+   :max_query_timeout 60000
    :multi_threaded "TRUE"
    :trace_level_file 4}) ; 4 == slf4j


Whitespace.

Whitespace.

--- src/cbfg/net.cljs
+++ src/cbfg/net.cljs
@@ -7,7 +7,7 @@
               [ts 0
                request-listen-ch request-listen-ch
                request-connect-ch request-connect-ch
-               listens {} ; Keyed by [addr port], value is accept-ch.
+               listens {}  ; Keyed by [addr port], value is accept-ch.
                streams {}] ; A conn is represented by dual streams, where streams
                            ; is keyed by send-ch and a value of...
                            ; {:send-addr :send-port :send-ch


Use the is-ip? util for proxies.

Use the is-ip? util for proxies.

--- src/shale/redis.clj
+++ src/shale/redis.clj
@@ -116,7 +116,7 @@
    (s/optional-key :tags)         #{s/Str}})

 (s/defschema IPAddress
-  (s/pred #(re-matches #"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" %)))
+  (s/pred is-ip?))

 (defmodel ProxyInRedis
   "A proxy, as represented in redis."


Refactored k8s data shape of (:service-id transient-store) (#1127)

--- waiter/src/waiter/scheduler/kubernetes.clj
+++ waiter/src/waiter/scheduler/kubernetes.clj
@@ -193,7 +193,7 @@
                 newest-failure-start-time (-> newest-failure :startedAt timestamp-str->datetime)
                 newest-failure-id (pod->instance-id pod (dec restart-count))
                 failures (-> service-id->failed-instances-transient-store deref (get service-id))]
-            (when-not (contains? failures newest-failure-id)
+            (when-not (some #(= (:id %) newest-failure-id) failures)
               (let [newest-failure-instance (cond-> (assoc live-instance
                                                       :flags failure-flags
                                                       :healthy? false
@@ -204,9 +204,11 @@
                                               ;; To match the behavior of the marathon scheduler,
                                               ;; we don't include the exit code in failed instances that were killed by k8s.
                                               (not (killed-by-k8s? newest-failure))
-                                              (assoc :exit-code (:exitCode newest-failure)))]
-                (swap! service-id->failed-instances-transient-store
-                       update-in [service-id] assoc newest-failure-id newest-failure-instance)))))))
+                                              (assoc :exit-code (:exitCode newest-failure)))
+                    max-instances-to-keep 10]
+                (scheduler/add-instance-to-buffered-collection!
+                  service-id->failed-instances-transient-store max-instances-to-keep service-id newest-failure-instance
+                  (fn [] #{}) (fn [instances] (-> (scheduler/sort-instances instances) (rest) (set))))))))))
     (catch Throwable e
       (log/error e "error converting failed pod to waiter service instance" pod)
       (comment "Returning nil on failure."))))
@@ -388,7 +390,7 @@
    Grouped by liveness status, i.e.: {:active-instances [...] :failed-instances [...] :killed-instances [...]}"
   [{:keys [service-id->failed-instances-transient-store] :as scheduler} {service-id :id :as basic-service-info}]
   {:active-instances (get-service-instances! scheduler basic-service-info)
-   :failed-instances (-> @service-id->failed-instances-transient-store (get service-id) vals vec)})
+   :failed-instances (-> @service-id->failed-instances-transient-store (get service-id) vec)})

 (defn- patch-object-json
   "Make a JSON-patch request on a given Kubernetes object."
@@ -736,7 +738,7 @@
           (log/error ex "request to fileserver failed")))))

   (service-id->state [_ service-id]
-    {:failed-instances (vals (get @service-id->failed-instances-transient-store service-id))
+    {:failed-instances (get @service-id->failed-instances-transient-store service-id)
      :syncer (retrieve-syncer-state-fn service-id)})

   (state [_ include-flags]


Solved 6.8 and 6.9 and translated where necessary, added some extra examples

--- src/fpinscala/purely_functional_state.clj
+++ src/fpinscala/purely_functional_state.clj
@@ -153,7 +153,7 @@

 ;6.6
 ;mine
-(defn map-rng-2
+(defn map2-rng
   "map2 for exercise 6.6, takes two actions ra and rb and binary function f which combines results of them"
   [ra rb f]
   (fn [rng]
@@ -166,7 +166,7 @@
 (defn both
   "Translating 'both' from section 6.4.1 - Combining state actions"
   [ra rb]
-  (map-rng-2 ra rb #(identity [% %2])))
+  (map2-rng ra rb #(identity [% %2])))

 (def int-double-via-both
   "int-double via both (via map2 (: )"
@@ -183,7 +183,7 @@
   "sequence function for exercise 6.7"
   [fs]
   (reduce                                                   ;check out comment below to see why I've used reduce instead of fold-right
-    #(map-rng-2 % %2 (fn [a b]
+    #(map2-rng % %2 (fn [a b]
                        (if (vector? a)
                          (conj a b)
                          [a b])))
@@ -200,9 +200,86 @@
   [fs]
   (fpinscala.strictness-and-laziness/fold-right             ;Notice that this variant is using fold-right
     (unit '())                                              ;Check out that "unit-produced" function is used as z value (now - it wouldn't be really
-    #(map-rng-2 % %2 (fn [a b] (cons a b)))                 ;correct to say it is "initial" but rather neutral (or terminating?) element
+    #(map2-rng % %2 (fn [a b] (cons a b)))                 ;correct to say it is "initial" but rather neutral (or terminating?) element
     fs))
 ;THIS WORKS!!! - THUS IN TERMS OF FPINS (AS FAR AS I UNDERSTOOD) Z IS UNIT/NEUTRAL ELEMENT

 (defn random-ints-via-rng-sequence [n rng]
   ((rng-sequence-fpins (repeat n non-negative-int)) rng))
+
+;6.8
+;mine
+;I haven't really got the point of what flat-map should look like (I did actually got to some point but got stuck there)
+;I missed the point that g is returning Rand[B] function (check exercise 6.8 text, page 87) and that it
+;accepts RNG
+;fpins
+(defn flat-map
+  "flatMap for exercise 6.8 from FPINS"
+  [f g]
+  #(from-rng (f %) :let [n rng2]
+            ((g n) rng2)))
+
+;nonNegativeLessThan via flatMap
+(defn non-negative-less-than
+  "nonNegativeLessThan for exercise 6.8 of FPINS"
+  [n]
+  (flat-map non-negative-int (fn [x]
+                               (let [m (mod x n)]
+                                 (if (>= (- (+ x (dec n)) m) 0)
+                                   ; Ha! I got it right that >>unit<< should be used here
+                                   (unit m)
+                                   (non-negative-less-than n))))))
+;fpins
+;Conceptually - the same
+
+;6.9
+;mine
+(defn map-via-flat-map
+  "map in terms of flatMap for exercise 6.9 of FPINS"
+  [s f]
+  (flat-map s (fn [x] (unit (f x)))))
+
+;usage example
+(def non-negative-int-via-map-via-flat-map
+  (map-via-flat-map non-negative-int-fpins #(- % (mod % 2))))
+
+(defn map2-via-flat-map
+  "map2 in terms of flatMap for exercise 6.9 of FPINS"
+  [ra rb f]
+  (flat-map ra (fn [n1]
+                 (fn [r1]
+                   (from-rng (rb r1) :let [n2 r2]
+                             (make-result (f n1 n2) r2))))))
+
+;usage example
+(defn both-via-map2-via-flat-map
+  "Translating 'both' from section 6.4.1 - Combining state actions"
+  [ra rb]
+  (map2-via-flat-map ra rb #(identity [% %2])))
+
+(def int-double-via-both-map2-flat-map
+  "int-double via both (via map2 (: )"
+  (both-via-map2-via-flat-map non-negative-int-fpins a-double-fpins))
+
+(def double-int-via-both-map2-flat-map
+  "double-int via both (via map2 (: )"
+  (both-via-map2-via-flat-map a-double-fpins non-negative-int))
+
+;fpins
+;Check this out, this is much better :) of course :)
+(defn map2-via-flat-map-fpins
+  [ra rb f]
+  (flat-map ra (fn [a] (map-rng rb #(f a %)))))
+
+(defn both-via-map2-via-flat-map-fpins
+  "Translating 'both' from section 6.4.1 - Combining state actions"
+  [ra rb]
+  (map2-via-flat-map-fpins ra rb #(identity [% %2])))
+
+(def int-double-via-both-map2-flat-map-fpins
+  "int-double via both (via map2 (: )"
+  (both-via-map2-via-flat-map non-negative-int-fpins a-double-fpins))
+
+(def double-int-via-both-map2-flat-map-fpins
+  "double-int via both (via map2 (: )"
+  (both-via-map2-via-flat-map-fpins a-double-fpins non-negative-int))


wait for the user to scroll down before autoscrolling

--- frontend/components/build_steps.cljs
+++ frontend/components/build_steps.cljs
@@ -152,7 +152,7 @@
   (reify
     om/IInitState
     (init-state [_]
-      {:autoscroll? true})
+      {:autoscroll? false})
     om/IDidMount
     (did-mount [_]
       (let [container (om/get-node owner)
@@ -164,9 +164,7 @@
         (om/set-state! owner [:scroll-listener-key] (goog.events/listen
                                                      (sel1 "main.app-main")
                                                      "scroll"
-                                                     scroll-listener))
-        ;; call it initially to set things up
-        (scroll-listener)))
+                                                     scroll-listener))))
     om/IWillUnmount
     (will-unmount [_]
       (goog.events/unlistenByKey (om/get-state owner [:scroll-listener-key])))


working on webhook handler

working on webhook handler

--- src/chat/server/extensions/asana.clj
+++ src/chat/server/extensions/asana.clj
@@ -92,10 +92,15 @@

 (defmethod handle-webhook :asana
   [extension event-req]
-  (if-let [secret (get-in event-req [:headers "X-Hook-Secret"])]
-    {:status 200 :headers {"X-Hook-Secret" secret}}
-    (do (println "webhook" event-req)
-        {:status 200})))
+  (if-let [secret (get-in event-req [:headers "x-hook-secret"])]
+    (do (println "webhook handshake")
+        (db/with-conn
+          (db/set-extension-config! (extension :id) :webhook-secret secret))
+      {:status 200 :headers {"X-Hook-Secret" secret}})
+    (let [signature (get-in event-req [:headers "x-hook-signature"])]
+      (println "webhook" event-req)
+      ; verify signature
+      {:status 200})))

 ;; watched thread notification


send user-id when we report exceptions

send user-id when we report exceptions

--- src/pc/server.clj
+++ src/pc/server.clj
@@ -262,7 +262,7 @@
       (try
         (log-request req resp (time/in-millis (time/interval start stop)))
         (catch Exception e
-          (rollbar/report-exception e :request req)
+          (rollbar/report-exception e :request req :user-id (get-in req [:auth :cust :cust/uuid]))
           (log/error e)))
       resp)))


fix some reflection warnings

fix some reflection warnings

--- src/main/clojure/org/dada/demo/whales.clj
+++ src/main/clojure/org/dada/demo/whales.clj
@@ -274,7 +274,7 @@
 		    (doall
 		     (map
 		      (fn [#^Update insertion]
-			  (let [[src-model & extra-values] (.getNewValue insertion)
+			  (let [[#^Model src-model & extra-values] (.getNewValue insertion)
 				count-model (do-reduce-count
 					     (.getName src-model)
 					     (.getMetadata src-model)
@@ -299,7 +299,7 @@
 		    (doall
 		     (map
 		      (fn [#^Update insertion]
-			  (let [[src-model & extra-values] (.getNewValue insertion)
+			  (let [[#^Model src-model & extra-values] (.getNewValue insertion)
 				sum-model (do-reduce-sum
 					   (.getName src-model)
 					   (.getMetadata src-model)


Added new comments block.

Added new comments block.

--- src/clj/mx/roads/forgotten/blog/web/content/data.clj
+++ src/clj/mx/roads/forgotten/blog/web/content/data.clj
@@ -18,8 +18,9 @@
     "pre-head-scripts"
     "post-head-scripts"
     "head-postpends"
-    "post-body-ads"
-    "post-post-scripts"})
+    "post-post-scripts"
+    "article-body-ads"
+    "article-sidebar-comments-links"})

 (defn legal-block-file?
   [^java.io.File file]


Add error handler for login ajax call. Currently just removes progress indicator.

--- src/cljs/my_money/app/controller/authentication.cljs
+++ src/cljs/my_money/app/controller/authentication.cljs
@@ -13,6 +13,7 @@
 (defrecord LogoutSucceeded [])
 (defrecord Register [username password])
 (defrecord RegistrationSucceeded [username])
+(defrecord ErrorHandler [])

 (defn- encode-auth [username password]
   (->> (str username ":" password)
@@ -28,7 +29,8 @@
   (process-event [{{:keys [username password] :as data} :credentials} app]
     (tuck/action! (fn [e!]
                     (ajax/POST "/login" {:headers {"Authorization" (encode-auth username password)}
-                                         :handler #(e! (->LoginSucceeded data))})))
+                                         :handler #(e! (->LoginSucceeded data))
+                                         :error-handler #(e! (->ErrorHandler))})))
     (assoc app :in-progress true))

   LoginSucceeded
@@ -64,4 +66,8 @@
     (tuck/action! (fn [_]
                     (session/remove! :modal)
                     (session/put! :identity username)))
-    app))
+    app)
+
+  ErrorHandler
+  (process-event [_ app]
+    (assoc app :in-progress false)))


made distribute-meta (and fixed up some other stuff), so meta.json files are now properly read in and applied to their appropriate structs

--- src/duffel/fs.clj
+++ src/duffel/fs.clj
@@ -1,6 +1,7 @@
 (ns duffel.fs
-    (:require [duffel.ext  :as ext]
-              [duffel.util :as util])
+    (:require [duffel.ext  :as dext]
+              [duffel.meta :as dmeta]
+              [duffel.util :as dutil])
     (:import java.io.File))

@@ -20,7 +21,7 @@
     the base filename (possibly with duffel extension), and the
     second is the host specifier (or '_default')"
     (if-let [re-res (re-find dot-underscore-split file-name)]
-        (if (ext/is-extension (last re-res))
+        (if (dext/is-extension (last re-res))
             (list file-name "_default")
             (rest re-res))
         (list file-name "_default")))
@@ -30,7 +31,7 @@
     returns a list where first item is the base filename and the
     second is the extension to apply"
     (if-let [re-res (re-find dot-underscore-split file-name)]
-        (if (ext/is-extension (last re-res))
+        (if (dext/is-extension (last re-res))
             (rest re-res)
             (list file-name "put"))
         (list file-name "put")))
@@ -46,10 +47,10 @@
 (defn index-of-specified-entry [host-seq]
     "Given a list of host specifiers, returns index of most specific one, or nil
     if none match"
-    (util/thread-until host-seq
-        (partial util/index-when fdqn-matches)
-        (partial util/index-when hostname-matches)
-        (partial util/index-when #(= "_default" %))))
+    (dutil/thread-until host-seq
+        (partial dutil/index-when fdqn-matches)
+        (partial dutil/index-when hostname-matches)
+        (partial dutil/index-when #(= "_default" %))))

 (defmulti explode-file seq?)
 (defmethod explode-file false [file-name]
@@ -188,20 +189,28 @@
 (defn merge-meta
     "Given a file-struct and some metadata merges the file-struct's meta field
     with the given metadata"
-    [file-struct meta-struct]
-    (assoc file-struct :meta (merge (file-struct :meta {}) meta-struct)))
+    [file-struct meta-file-struct]
+    (assoc file-struct :meta (merge (file-struct :meta {}) meta-file-struct)))
+
+(defn merge-meta-dir
+    "Given a dir-tree and metadata, merges the dir-tree's root element's metadata
+    with the given metadata"
+    [dir-tree meta-file-struct]
+    (cons (merge-meta (first dir-tree) meta-file-struct) (rest dir-tree)))

 (defn assoc-meta
     "Given a dir-tree looks through the dir-tree for a file with :base-name == filename
     and merges the given meta-struct with that file's :meta field. If the filename is .
     then apply the merge on the top level item (the directory struct). Does not go recursively
     down the tree."
-    [dir-tree filename meta-struct]
+    [dir-tree filename meta-file-struct]
     (if (= "." filename)
-        (cons (merge-meta (first dir-tree) meta-struct) (rest dir-tree))
-        (cons (first dir-tree) (map #(if (basename-is? % filename)
-                                     (merge-meta % meta-struct)
-                                     %) (rest dir-tree)))))
+        (merge-meta-dir dir-tree meta-file-struct)
+        (cons (first dir-tree)
+            (map #(if (basename-is? % filename) (merge-meta % meta-file-struct)
+                  (if (and (seq? %)
+                           (basename-is? (first %) filename)) (merge-meta-dir % meta-file-struct)
+                   %))(rest dir-tree)))))

 (defn pull-meta-file
     "Given a dir-tree and the local prefix for the dir-tree, tries to find a _meta.json in the tree.
@@ -211,9 +220,24 @@
     [dir-tree local-prefix]
     (if-let [meta-file (some #(when (basename-is? % "_meta.json") %) dir-tree)]
         [ (remove #(basename-is? % "_meta.json") dir-tree)
-          (slurp (str local-prefix (meta-file :full-name))) ]
+          (slurp (str local-prefix (append-slash ((first dir-tree) :full-name)) (meta-file :full-name))) ]
         [ dir-tree "{}" ]))

-(def test-tree
+(defn distribute-meta
+    "A function to be passed into tree map which will find (and remove) all _meta.json files from the
+    map, read them in, and apply the meta object inside of them to the appropriate file-structs"
+    [dir-tree _ local-prefix]
+    (let [ pull-meta-ret (pull-meta-file dir-tree local-prefix)
+           new-dir-tree  (first  pull-meta-ret)
+           meta-string   (second pull-meta-ret) ]
+        (if-let [ meta-struct (dmeta/parse-meta-string meta-string) ]
+            (reduce #(assoc-meta %1 (key %2) (val %2)) new-dir-tree meta-struct)
+            (throw (Exception. (str "Could not parse _meta.json file in "
+                                    local-prefix ((first dir-tree) :full-name)
+                                    ", it might not be valid json"))))))
+
+(defn test-tree []
     (->> (specify-tree "my-duffel")
-         (chroot-tree "/tmp")))
+         (chroot-tree "/tmp")
+         (tree-map distribute-meta)
+         ))


Changed table component to show table type in button selection

--- src/css-guide/styles/components.cljs
+++ src/css-guide/styles/components.cljs
@@ -903,16 +903,16 @@
         (dom/button #js {:aria-label "Swipe View" :onClick #(set-kind "swipe")
                          :className  (str "c-button c-button--small " (when (= kind "swipe") "is-active"))}
           (dom/svg #js {:xmlns "http://www.w3.org/2000/svg" :width "24" :height "24" :className "c-icon" :viewBox "0 0 24 24"}
-            (dom/path #js {:d "M4 15h16v-2H4v2zm0 4h16v-2H4v2zm0-8h16V9H4v2zm0-6v2h16V5H4z"})))
+            (dom/path #js {:d "M4 15h16v-2H4v2zm0 4h16v-2H4v2zm0-8h16V9H4v2zm0-6v2h16V5H4z"})) "Swipe")
         (dom/button #js {:aria-label "Toggle View" :onClick #(set-kind "toggle")
                          :className  (str "c-button c-button--small " (when (= kind "toggle") "is-active"))}
           (dom/svg #js {:xmlns "http://www.w3.org/2000/svg" :width "24" :height "24" :className "c-icon" :viewBox "0 0 24 24"}
-            (dom/path #js {:d "M10 18h5V5h-5v13zm-6 0h5V5H4v13zM16 5v13h5V5h-5z"})))
+            (dom/path #js {:d "M10 18h5V5h-5v13zm-6 0h5V5H4v13zM16 5v13h5V5h-5z"})) "Toggle")
         (dom/button #js {:aria-label "Stacked View" :onClick #(set-kind "stacked")
                          :className  (str "c-button c-button--small " (when (= kind "stacked") "is-active"))}
           (dom/svg #js {:xmlns "http://www.w3.org/2000/svg" :width "24" :height "24" :className "c-icon" :viewBox "0 0 24 24"}
-            (dom/path #js {:d "M4 18h17v-6H4v6zM4 5v6h17V5H4z"}))))
-      (dom/table #js {:className (str "c-table c-table--toggle c-table--" kind)}
+            (dom/path #js {:d "M4 18h17v-6H4v6zM4 5v6h17V5H4z"})) "Stacked"))
+      (dom/table #js {:className (str "c-table c-table--" kind)}
                  (dom/thead #js {}
                             (dom/tr #js {}
                                     (dom/th #js {:scope "col"})


Fix error in worker

Fix error in worker

--- src/worker/core.clj
+++ src/worker/core.clj
@@ -26,6 +26,12 @@
       (String. "utf-8")
       (json/read-str :key-fn keyword)))

+(defn rand-between
+  "Genartes random int between a (inclusive)
+  and b (exclusive)"
+  [a b]
+  (+ a  (rand (- b a))))
+
 (defn print-job-info
   "Prints info"
   [{:keys [input jobId serverId clientId]}]
@@ -36,7 +42,7 @@
   "Simulates a long-running CPU-intensive computation.
   Reverses the input string after a forced delay"
   [input]
-  (Thread/sleep (* 1000 (rand-int 5 11)))
+  (Thread/sleep (* 1000 (rand-between 5 11)))
   (s/reverse input))

 (defn emit-event


Looks much nicer without the superfluous spaces

--- src/desdemona/lifecycles/logging.clj
+++ src/desdemona/lifecycles/logging.clj
@@ -5,7 +5,7 @@
     (doseq [m (map :message (mapcat :leaves (:tree (:onyx.core/results event))))]
 (defn log-batch
   [event lifecycle]
-      (info task-name " logging segment: " m)))
+      (info task-name "logging segment:" m)))
   {})

 (def log-calls


changed ordering

changed ordering

--- src/distributions/normal-laplace.clj
+++ src/distributions/normal-laplace.clj
@@ -2,7 +2,7 @@

 (defn normal-laplace
   "N(x|mu, s2 gamma)Laplace(x| tau/s)"
-  [mu gamma tau s2]
+  [mu s2 gamma tau]
   (let [s (sqrt s2)
         mu+ (- mu (* gamma s tau))
         mu- (+ mu (* gamma s tau))


Fix typo

Fix typo

--- src/yaml/reader.clj
+++ src/yaml/reader.clj
@@ -11,7 +11,7 @@
   (decode [data]))

 (defn- decode-key
-  "When *keywordize* is bound to true decode map keys into keywords else leaave them
+  "When *keywordize* is bound to true decode map keys into keywords else leave them
   as strings. When *keywordize* is a function, calls function on the key."
   [k]
   (cond (true? *keywordize*)


Minor `valid-binary?` refactor

Minor `valid-binary?` refactor

--- src/main/cljc/mikron/runtime/processor/validate.cljc
+++ src/main/cljc/mikron/runtime/processor/validate.cljc
@@ -37,9 +37,11 @@
   [value]
   (valid-integer? value 8 true))

+(def binary-type #?(:clj  (Class/forName "[B")
+                    :cljs js/ArrayBuffer))
+
 (defn valid-binary?
   "Returns `true` if `value` is a binary value, `false` otherwise."
-  #?(:clj {:inline (fn [value] `(bytes? ~value))})
+  #?(:clj {:inline (fn [value] `(instance? binary-type ~value))})
   [value]
-  #?(:clj  (bytes? value)
-     :cljs (instance? js/ArrayBuffer value)))
+  (instance? binary-type value))


Better doc

Better doc

--- src/such/vars.clj
+++ src/such/vars.clj
@@ -3,7 +3,8 @@

 (defprotocol Rootable
   "A protocol to look at \"root\" values of Vars. The root value is
-   the value before any `binding` - it's the value altered by `alter-var-root`."
+   the value before any `binding` - it's the value altered by `alter-var-root`.
+   Defines `has-root-value?` and `root-value`."
   (has-root-value? [this]
     "Does this var have a root value?" )
   (root-value [this]


Grab clothing colors from result

Grab clothing colors from result

--- src/tobias/cv.clj
+++ src/tobias/cv.clj
@@ -60,7 +60,8 @@
   (map (fn [r]
          {:age       (age->sym (get-in r [:age :value]))
           :gender    (str->kw  (get-in r [:gender :value]))
-          :ethnicity (str->kw  (get-in r [:ethnicity :value]))})
+          :ethnicity (str->kw  (get-in r [:ethnicity :value]))
+          :clothing  (get r :clothingcolors [])})
        (:persons result)))

 (defn normalize-microsoft [result]


[CS] Allow zip files to not include "data" dir

--- src/vip/data_processor/validation/zip.clj
+++ src/vip/data_processor/validation/zip.clj
@@ -27,16 +27,28 @@
       (xml-file? path) (assoc ctx :input path)
       :else (assoc ctx :stop (str path " is not a zip or xml file!")))))

+(defn zip-contents
+  "Returns a seq of Files from the path of a extracted zip file. If
+  the zip file included a directory named 'data' it will be the files
+  in that directory. Otherwise, it will be the files from the
+  top-level."
+  [path]
+  (let [data-dir (-> path
+                     (.resolve "data")
+                     .toFile)
+        base-dir (if (.exists data-dir)
+                   data-dir
+                   (.toFile path))]
+    (-> base-dir
+        .listFiles
+        seq)))
+
 (defn extracted-contents [ctx]
   (let [path (:input ctx)]
     (if (xml-file? path)
       (assoc ctx :input
              [(.toFile path)])
-      (let [files (-> path
-                      (.resolve "data")
-                      .toFile
-                      .listFiles
-                      seq)]
+      (let [files (zip-contents path)]
         (-> ctx
             (assoc :input files)
             (update :to-be-cleaned concat files))))))


removed selected-org from navigation-data, put it at root

the way we set nav-data is fucking bonkers, but we're getting rid of it
anyways so rather than clean it up im going to ignore it and just ensure
my feature doesn't get blocked by the decisions of my fore fathers.


Add utility function that collects info about action from page.

--- test/clj/hatnik/selenium/actions_test.clj
+++ test/clj/hatnik/selenium/actions_test.clj
@@ -25,6 +25,31 @@
   (open-edit-action-dialog driver action)
   (.click (find-element driver "#iModalAddAction .modal-header .btn-danger"))
   (wait-until-dialog-invisible driver :action))
+
+(defn action-params [driver]
+  (let [element-value #(if-let [el (->> %
+                                        name
+                                        (str "#")
+                                        (find-elements driver)
+                                        first)]
+                         (.getAttribute el "value")
+                         nil)
+        params (into {}
+                     (for [id [:library-input :action-type :email-subject :email-body
+                               :gh-repo :gh-issue-title :gh-issue-body
+                               :gh-title :gh-body]
+                           :let [value (element-value id)]
+                           :when value]
+                       [id value]))
+        gh-pr-operations (map-indexed (fn [ind operation]
+                                        {:file (element-value (str "gh-pull-req-op-file-" ind))
+                                         :regex (element-value (str "gh-pull-req-op-regex-" ind))
+                                         :replacement (element-value (str "gh-pull-req-op-repl-" ind))})
+                                      (find-elements driver ".operations .operation"))]
+    (if (empty? gh-pr-operations)
+      params
+      (assoc params
+        :gh-pr-operations gh-pr-operations))))

 (deftest create-delete-test
   (let [driver (create-and-login)]


Fix make-config-policy calling map->ConfigPolicy


New members!

New members!

--- resources/members.clj
+++ resources/members.clj
@@ -1,4 +1,7 @@
 [{:name "Phil Hagelberg" :url "http://technomancy.us"}
  {:name "Brendan Ribera" :url "http://threebrothers.org/brendan/"}
  {:name "Eric Hanchrow"}
- {:name "Kevin Downey"}]
+ {:name "Kevin Downey"}
+ {:name "Russell Branca" :url "http://chewbranca.com"}
+ {:name "Chris Bilson"}
+ {:name "Stan Dyck" :url "http://sgd.homelinux.net"}]


Turn off optimizations and turn on pretty printing for the release build.

--- metlog-vault/project.clj
+++ metlog-vault/project.clj
@@ -70,19 +70,20 @@
                            {:source-paths ["src-client"]
                             :compiler
                             {:optimizations :none
-                             :pretty-print true}}}}}
+                             :pretty-print true}
+                            }}}}

              :uberjar
              {:source-paths ^:replace ["src-server"]
               :hooks [leiningen.cljsbuild]
-              :omit-source true
               :aot :all
               :cljsbuild {:builds
                           {:app
                            {:source-paths ^:replace ["src-client"]
                             :compiler
-                            {:optimizations :advanced
-                             :pretty-print false}}}}}}
+                            {:optimizations :none
+                             :pretty-print true}
+                            }}}}}

     :release-tasks [["vcs" "assert-committed"]
                     ["change" "version" "leiningen.release/bump-version" "release"]


Version 0.5.0

Version 0.5.0

--- metlog-vault/project.clj
+++ metlog-vault/project.clj
@@ -1,4 +1,4 @@
-(defproject metlog-vault "0.5.0-SNAPSHOT"
+(defproject metlog-vault "0.5.0"
   :description "Repository for long term storage of series data."

   :license {:name "Eclipse Public License"


fix loader button on large screens

fix loader button on large screens


Version bump to v1.59.5-SNAPSHOT

Version bump to v1.59.5-SNAPSHOT

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


Remove debug statement.

Remove debug statement.

--- src/onyx/peer/peer_group_manager.clj
+++ src/onyx/peer/peer_group_manager.clj
@@ -47,7 +47,6 @@

 (defmulti action
   (fn [state [type arg]]
-    (info "DISPATCH: " type arg)
     type))

 ;; ONLY FOR USE IN TESTING


Fix group-by error when task has a group-by task and a non-group by task downstream.

--- src/onyx/plugin/messaging_output.clj
+++ src/onyx/plugin/messaging_output.clj
@@ -77,14 +77,12 @@
                   replica messenger]
     (.clear ^java.util.ArrayList segments)
     (let [;; generate this on each new replica / messenger
-          get-pub-fn (if (empty? task->group-by-fn)
-                       (fn [segment dst-task-id]
-                         (rand-nth (m/task->publishers messenger dst-task-id)))
-                       (fn [segment dst-task-id]
-                         (let [group-fn (task->group-by-fn dst-task-id)
-                               hsh (hash (group-fn segment))
+          get-pub-fn (fn [segment dst-task-id]
+                       (if-let [group-fn (task->group-by-fn dst-task-id)]
+                         (let [hsh (hash (group-fn segment))
                                dest-pubs (m/task->publishers messenger dst-task-id)]
-                           (get dest-pubs (mod hsh (count dest-pubs))))))
+                           (get dest-pubs (mod hsh (count dest-pubs))))
+                         (rand-nth (m/task->publishers messenger dst-task-id))))
           ;; TODO, avoid initial flattening preprocessing step
           _ (run! (fn [{:keys [leaves] :as result}]
                     (run! (fn [seg]


Fix spurious error bug

Fix spurious error bug

- If the end of a prefix/env editor is plain whitespaced, it causes an
  error in pipeline compilation. A working solution seems to be
  trimming the contents of those editors before stepping through the pipeline.

--- src/org/knotation/editor/update.cljs
+++ src/org/knotation/editor/update.cljs
@@ -70,7 +70,7 @@
         out! (fn []
                (let [intermediate
                      (conj
-                      (vec (map #(api/env :kn (.getValue %)) (concat env prefix)))
+                      (vec (map #(api/env :kn (string/trim (.getValue %))) (concat env prefix)))
                       (api/input :kn (.getValue input)))]
                  (clear-line-errors! inputs)
                  (doseq [out outputs]


format fix

format fix

--- src/org/spootnik/cyanite/es_path.clj
+++ src/org/spootnik/cyanite/es_path.clj
@@ -62,7 +62,10 @@
 (defn search
   "search for a path"
   [query scroll tenant path leafs-only]
-  (let [res (query :query (build-es-query path tenant leafs-only) :size 100 :search_type "query_then_fetch" :scroll "1m")
+  (let [res (query :query (build-es-query path tenant leafs-only)
+                   :size 100
+                   :search_type "query_then_fetch"
+                   :scroll "1m")
         hits (scroll res)]
     (map #(:_source %) hits)))


add comments

add comments

--- src/overtone/sc/ugen/special_ops.clj
+++ src/overtone/sc/ugen/special_ops.clj
@@ -115,9 +115,9 @@
 ;   "-" 1           ; subtraction
 ;   "*" 2           ; multiplication
 ;   "/" 4           ; floating point division
-   "mod" 5         ; modulus
-   "<=" 10         ; less than or equal
-   ">=" 11
+   "mod" 5          ; modulus
+   "<=" 10          ; less than or equal
+   ">=" 11          ; greater than or equal
    })

 (defn unary-op-num [name]
@@ -125,4 +125,3 @@

 (defn binary-op-num [name]
   (get BINARY-OPS (str name) false))
-


cleanup

cleanup

--- src/cljx/jamesmacaulay/async_tools/signals.cljx
+++ src/cljx/jamesmacaulay/async_tools/signals.cljx
@@ -139,93 +139,6 @@
         (recur msg)))
     (->Signal v (async/mult c-out))))

-;(defn- channel-input
-;  [ch v]
-;  (let [id (gen-id)
-;        events (async/map (partial vector id) [ch])]
-;    (async/pipe events new-event)
-;    (input* event-notify id v)))
-;
-;
-;(defn write-port
-;  [init]
-;  (let [ch (chan 1)
-;        sig (channel-input ch init)]
-;    (reify
-;      impl/Channel
-;      (close! [_] (impl/close! ch))
-;      (closed? [_] (impl/closed? ch))
-;      impl/WritePort
-;      (put! [_ val fn1] (impl/put! ch val fn1))
-;      SignalProtocol
-;      (sprout [_] (sprout sig)))))
-
-
-
-;(defn async
-;  [sig]
-;  (let [s (sprout sig)
-;        c-in (:channel s)
-;        c-out (chan 1 (comp (filter change?)
-;                            (map body)))]
-;    (channel-input (async/pipe c-in c-out)
-;                   (:value s))))
-;
-;(defn constant
-;  [value]
-;  (let [msg (no-change value)
-;        out (async/tap event-notify (chan 1 (map (constantly msg))))]
-;    (->Signal value (async/mult out))))
-
-;(defn merge
-;  [& sigs]
-;  (let [sprouts (mapv sprout sigs)
-;        first-value (:value (first sprouts))
-;        msg-vectors (->> sprouts
-;                         (mapv :channel)
-;                         (async/map vector))
-;        c-out (chan)]
-;    (go-loop [prev first-value]
-;      (let [msgs (<! msg-vectors)
-;            first-change (first (filter change? msgs))
-;            msg (or first-change (no-change prev))]
-;        (>! c-out msg)
-;        (recur (body msg))))
-;    (Node. first-value (async/mult c-out))))
-
-;(defn merge
-;  [& sigs]
-;  (apply lift-msgs*
-;         (fn [& msgs]
-;           (->> msgs (filter change?) first))
-;         sigs))
-
-;(defn sample-on
-;  [sampler-sig value-sig]
-;  (let [sample-channel (:channel (sprout sampler-sig))
-;        {init :value
-;         value-channel :channel} (sprout value-sig)
-;        c-in (async/map vector [sample-channel value-channel])
-;        c-out (chan)]
-;    (go-loop []
-;      (let [[sample-msg value-msg] (<! c-in)
-;            value (body value-msg)
-;            msg (if (change? sample-msg)
-;                  (change value)
-;                  (no-change value))]
-;        (>! c-out msg)
-;        (recur)))
-;    (Node. init (async/mult c-out))))
-
-;(defn sample-on
-;  [sampler-sig value-sig]
-;  (lift-msgs (fn [sample-msg value-msg]
-;               (when (change? sample-msg)
-;                 (change (body value-msg))))
-;             sampler-sig
-;             value-sig))
-
-
 (defprotocol NodeProtocol
   (node->signal [n source-node->signal])
   (sources [n]))
@@ -273,30 +186,6 @@
       (event-channel-fn [_] (event-channel-fn node)))))

-;(defrecord Input
-;  [init event-channel-fn topic])
-
-;(defn async*
-;  [id sig]
-;  (let [s (sprout sig)
-;        c-in (:channel s)
-;        c-out (chan 1 (comp (filter change?)
-;                            (map body)))]
-;    (async/pipe c-in c-out)
-;    (input* id (:value s))))
-;
-;(def async
-;  [source-node]
-;  (let [topic (gen-id)]
-;    (reify
-;      NodeProtocol
-;      (node->signal [_ source-node->signal]
-;        (async* topic (source-node->signal source-node)))
-;      (sources [_] [source-node])
-;      InputNodeProtocol
-;      (event-topic [_] topic)
-;      (event-channel-fn [_] ()))))
-
 (defn lift-msgs
   [f & source-nodes]
   (reify
@@ -349,14 +238,11 @@

 (defn node-graph-zipper
-  [output-nodes]
+  [output-node]
   (zip/zipper (constantly true)
-              (fn [x]
-                (if (sequential? x)
-                  (seq x)
-                  (seq (sources x))))
+              (comp seq sources)
               nil
-              output-nodes))
+              output-node))

 (defn skip-subtree
   [loc]
@@ -367,28 +253,27 @@
               (recur (zip/up p)))
           [(zip/node p) :end]))))

-(defn output-nodes->dependency-map
-  [output-nodes]
-  (let []
-    (loop [deps {}
-           loc (node-graph-zipper output-nodes)]
-      (cond
-        (zip/end? loc)
-          deps
-        (contains? deps (zip/node loc))
-          (recur deps
-                 (skip-subtree loc))
-        :else
-          (let [n (zip/node loc)]
-            (recur (if (sequential? n)
-                     deps
-                     (assoc deps n (set (sources n))))
-                   (zip/next loc)))))))
+(defn output-node->dependency-map
+  [output-node]
+  (loop [deps {}
+         loc (node-graph-zipper output-node)]
+    (cond
+      (zip/end? loc)
+      deps
+      (contains? deps (zip/node loc))
+      (recur deps
+             (skip-subtree loc))
+      :else
+      (let [n (zip/node loc)]
+        (recur (if (sequential? n)
+                 deps
+                 (assoc deps n (set (sources n))))
+               (zip/next loc))))))

 (defn topsort
-  [outputs]
-  (-> outputs
-      output-nodes->dependency-map
+  [output]
+  (-> output
+      output-node->dependency-map
       kahn/kahn-sort
       reverse))

@@ -431,21 +316,11 @@

 (defn wire-up
   [input-nodes output-node spawned-world signal-map]
-  (let [output-sprout (sprout (get signal-map output-node))
-        output-channel (tools/concat (async/to-chan [(:value output-sprout)])
-                                     (async/pipe (:channel output-sprout)
-                                                 (chan 1 (comp (filter change?)
-                                                               (map body)))))
-        event-mult (->> input-nodes
-                        (sequence (comp (map event-topic)
-                                        (map spawned-world)
-                                        (filter identity)))
-                        async/merge
-                        async/mult)]
-
-    (doseq [n input-nodes]
-      (connect-events (get signal-map n) event-mult))
-    output-channel))
+  (let [output-sprout (sprout (get signal-map output-node))]
+    (tools/concat (async/to-chan [(:value output-sprout)])
+                  (async/pipe (:channel output-sprout)
+                              (chan 1 (comp (filter change?)
+                                            (map body)))))))

 (defrecord CompiledGraph
@@ -453,8 +328,16 @@
   CompiledGraphProtocol
   (spawn* [_ world-overrides]
     (let [spawned-world (spawn-world default-world world-overrides)
+          event-mult (->> input-nodes
+                          (sequence (comp (map event-topic)
+                                          (map spawned-world)
+                                          (filter identity)))
+                          async/merge
+                          async/mult)
           signal-map (build-signal-map sorted-nodes)
           output-channel (wire-up input-nodes output-node spawned-world signal-map)]
+      (doseq [n input-nodes]
+        (connect-events (get signal-map n) event-mult))
       (->RunningGraph spawned-world output-channel))))

 (defn remove-duplicate-inputs
@@ -498,4 +381,13 @@
   (>!! letters-in :z)
   (async/close! out)
   (<!! (async/into [] out))
+
+
+  (def mouse-position
+    (signals/input :mouse-position [0 0] #(...)))
+
+  (def events-input (chan))
+
   )
+
+


Request auto-selection on typing [chat-ui]

--- src/status_im/chat/models/input.cljs
+++ src/status_im/chat/models/input.cljs
@@ -58,14 +58,14 @@
          command-args     (split-command-args input-text)
          command-name     (first command-args)]
      (when (.startsWith (or command-name "") const/command-char)
-       (when-let [command (-> (filter (fn [[{:keys [name]} message-id]]
-                                        (and (= name (subs command-name 1))
-                                             (= message-id (or (:to-message-id input-metadata)
-                                                               :any))))
-                                      possible-actions)
-                              (ffirst))]
+       (when-let [[command to-message-id] (-> (filter (fn [[{:keys [name]} message-id]]
+                                                        (= name (subs command-name 1)))
+                                                      possible-actions)
+                                              (first))]
          {:command  command
-          :metadata input-metadata
+          :metadata (if (not= :any to-message-id)
+                      (assoc input-metadata :to-message-id to-message-id)
+                      input-metadata)
           :args     (remove empty? (rest command-args))}))))
   ([{:keys [current-chat-id] :as db} chat-id]
     (selected-chat-command db chat-id (get-in db [:chats chat-id :input-text]))))


add exemplar for special numbers

add exemplar for special numbers

--- test/exemplar.clj
+++ test/exemplar.clj
@@ -281,7 +281,15 @@
       dir
       "vector_unrecognized_vals"
       "Vector with vals with unrecognized encodings"
-      ["~Unrecognized"])))
+      ["~Unrecognized"])
+
+    (write-exemplar
+     dir
+     "vector_special_numbers"
+     "Vector with special numbers"
+     [java.lang.Double/NaN
+      java.lang.Double/POSITIVE_INFINITY
+      java.lang.Double/NEGATIVE_INFINITY])))

 (defn -main [& args]
  (write-exemplars "simple-examples"))


Prevent adding empty filter items

Prevent adding empty filter items


drain-to is no longer necessary

drain-to is no longer necessary


fix user update

fix user update

--- server/src/gratefulplace/controllers/users.clj
+++ server/src/gratefulplace/controllers/users.clj
@@ -41,10 +41,11 @@

 (defn update!*
   [params]
-  (db/t [(c/mapify
-          params
-          mr/user->txdata
-          {:exclude [:user/username :user/password]})]))
+  (db/t [(remove-nils-from-map
+          (c/mapify
+           params
+           mr/user->txdata
+           {:exclude [:user/username :user/password]}))]))

 (defresource update! [params auth]
   :allowed-methods [:put :post]


fix missing import in model_test

fix missing import in model_test

--- test/greybear/model_test.clj
+++ test/greybear/model_test.clj
@@ -4,6 +4,7 @@
   (:use midje.sweet
         [cemerick.friend.credentials :only [bcrypt-verify]]
         [korma core db]
+        greybear.model.ddl
         greybear.model))

 (def ^:dynamic test-db-spec {:classname "org.postgresql.Driver"


inner plans description update

inner plans description update

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -254,7 +254,7 @@
         (html
           [:div.osx-plans
            [:fieldset
-            [:legend (str "OS X Plans")]]
+            [:legend (str "OSX Limited Release Plans - The below selection only applies to OSX service and will not affect the LXE Containers above.")]]
            [:div.plan-selection
             (om/build osx-plan {:plan plan :price 79 :plan-type "starter" :current-plan current-plan})
             (om/build osx-plan {:plan plan :price 139 :plan-type "standard" :current-plan current-plan})
@@ -328,7 +328,7 @@
             [:div.main-content
              [:div.left-section
               [:div.pricing-calculator-controls
-               [:h3 "Containers"]
+               [:h3 "LXE Containers"]
                [:form
                 [:div.container-picker
                  [:p "More containers means faster builds and lower queue times."]


check-ns isn't a macro

check-ns isn't a macro

--- roles/clojure/files/profiles.clj
+++ roles/clojure/files/profiles.clj
@@ -37,7 +37,7 @@
                        ^:lazy cemerick.pomegranate/resources
                        ^:lazy clj-diff.core/diff
                        ^:lazy ^:macro clojure.core.typed/cf
-                       ^:lazy ^:macro clojure.core.typed/check-ns
+                       ^:lazy clojure.core.typed/check-ns
                        ^:lazy clojure.java.javadoc/javadoc
                        ^:lazy clojure.java.shell/sh
                        ^:lazy clojure.pprint/pp


duplicate dependencies removed

duplicate dependencies removed

--- build.boot
+++ build.boot
@@ -9,12 +9,12 @@
                  [http-kit                   "2.1.18"]
                  [re-frame                   "0.8.0"]
                  [secretary                  "1.2.3"]
-                 [adzerk/boot-cljs           "1.7.228-2" :scope "test"]
-                 [binaryage/devtools         "0.8.2"     :scope "test"]
                  [com.stuartsierra/component "0.3.1"]
                  [com.taoensso/tempura       "1.0.0-RC3"]
                  [com.taoensso/sente         "1.11.0"]
-                                  [adzerk/boot-cljs           "1.7.228-2" :scope "test"]
+
+
+                 [adzerk/boot-cljs           "1.7.228-2" :scope "test"]
                  [deraen/boot-less           "0.6.0"     :scope "test"]
                  [deraen/boot-sass           "0.3.0"     :scope "test"]
                  [binaryage/devtools         "0.8.2"     :scope "test"]
@@ -32,7 +32,7 @@

 (task-options!
  pom {:project 'codamic/hellhound
-      :version "0.7.0-SNAPSHOT"}
+      :version "0.8.0-SNAPSHOT"}
  jar {:manifest {"Description" "A simple full-stack web framework for clojure"
                  "Url" "http://github.com/Codamic/hellhound"}})


improve inject task

improve inject task

--- build.boot
+++ build.boot
@@ -50,7 +50,7 @@
               txt (slurp f)]
           (spit f (inject-scripts txt (->> fs
                                            core/input-files
-                                           (by-name scripts)
+                                           (by-path scripts)
                                            (map (comp slurp core/tmp-file)))))
           (-> fs
               (core/rm [html-file])


Fix #72. :asset-path is now configurable

--- src/adzerk/boot_cljs/middleware.clj
+++ src/adzerk/boot_cljs/middleware.clj
@@ -54,7 +54,8 @@
     (-> ctx
         (assoc-in [:opts :output-to] js-path)
         (assoc-in [:opts :main] cljs-ns)
-        (assoc-in [:opts :asset-path] asset-path)
+        ; Do not overwrite users settings
+        (update-in [:opts] #(merge {:asset-path asset-path} %))
         (update-in [:opts] (partial merge-with util/into-or-latest) (:compiler-options main-edn)))))

 (defn source-map


Fix auth check on group endpoint (#631)

Fix auth check on group endpoint (#631)

--- scheduler/src/cook/mesos/api.clj
+++ scheduler/src/cook/mesos/api.clj
@@ -1325,11 +1325,11 @@
 (defn retrieve-groups
   "Returns a tuple that either has the shape:

-    [true {::guuids ...}]
+    [false {::guuids ...}]

   or:

-    [false {::error ...}]
+    [true {::error ...}]

   Given a collection of group uuids, attempts to return the corresponding
   set of existing group uuids. By default (or if the 'partial' query
@@ -1346,22 +1346,18 @@
                                 (mapv #(UUID/fromString %)))
           allow-partial-results (get-in ctx [:request :query-params :partial])
           exists? #(group-exists? (db conn) %)
-          existing-groups (filter exists? requested-guuids)]
-      (if (or (= (count existing-groups) (count requested-guuids))
-              (and allow-partial-results (pos? (count existing-groups))))
-        [true {::guuids existing-groups}]
-        [false {::error (str "UUID "
-                             (str/join
-                               \space
-                               (set/difference (set requested-guuids) (set existing-groups)))
-                             " didn't correspond to a group")}]))
+          {existing-groups true missing-groups false} (group-by exists? requested-guuids)]
+      [false {::allow-partial-results? allow-partial-results
+              ::guuids existing-groups
+              ::non-existing-guuids missing-groups}])
     (catch Exception e
-      [false {::error e}])))
+      [true {::error e}])))

 (defn groups-action-handler
   [conn task-constraints is-authorized-fn]
   (base-cook-handler
     {:allowed-methods [:get :delete]
+     :malformed? (partial retrieve-groups conn)
      :allowed? (fn [ctx]
                  (let [user (get-in ctx [:request :authorization/user])
                        guuids (::guuids ctx)
@@ -1371,16 +1367,24 @@
                        authorized? (fn [guuid] (is-authorized-fn user
                                                                  request-method
                                                                  {:owner (group-user guuid) :item :job}))
-                       unauthorized-guuids (mapv :uuid (remove authorized? guuids))]
-                   (if (empty? unauthorized-guuids)
-                     true
+                       {authorized-guuids true unauthorized-guuids false} (group-by authorized? guuids)]
+                   (if (or (empty? unauthorized-guuids) (::allow-partial-results? ctx))
+                     [true {::guuids (with-meta
+                                       authorized-guuids
+                                       ; Liberator will concatenate vectors by default when composing context values,
+                                       ; but we want to replace our vector with only the filtered entries.
+                                       {:replace true})}]
                      [false {::error (str "You are not authorized to "
                                           (case request-method
                                             :get "view"
                                             :delete "kill")
                                           " the following groups "
                                           (str/join \space unauthorized-guuids))}])))
-     :exists? (partial retrieve-groups conn)
+     :exists? (fn [ctx]
+                (or (::allow-partial-results? ctx)
+                    (empty? (::non-existing-guuids ctx))
+                    [false {::error (str "The following UUIDs didn't correspond to a group: "
+                                         (str/join \space (::non-existing-guuids ctx)))}]))
      :handle-ok (fn [ctx]
                   (if (Boolean/valueOf (get-in ctx [:request :query-params "detailed"]))
                     (mapv #(merge (fetch-group-map (db conn) %)


change cases of "conn" to "db-conn"

change cases of "conn" to "db-conn"

--- src/navigator.clj
+++ src/navigator.clj
@@ -47,21 +47,21 @@
   "Gets an entity using query and bindings. The db conn is assumed to
   be the first binding of the query and doesn't need to be included in
   the bindings part of the arguments."
-  ([conn query & bindings]
-     (d/entity (d/db conn) (ffirst (apply d/q query (d/db conn) bindings)))))
+  ([db-conn query & bindings]
+     (d/entity (d/db db-conn) (ffirst (apply d/q query (d/db db-conn) bindings)))))

 (defn get-competency
   "Get competency by shared key"
-  [conn id-sk]
-  (get-entity conn '[:find ?e
+  [db-conn id-sk]
+  (get-entity db-conn '[:find ?e
                      :in $ ?id-sk
                      :where [?e :comp/id-sk ?id-sk]]
               id-sk))

 (defn get-competency-by-name-version
   "Get competency by name+verion"
-  [conn name version]
-  (get-entity conn '[:find ?e
+  [db-conn name version]
+  (get-entity db-conn '[:find ?e
                      :in $ ?name ?version
                      :where [?e :comp/name ?name]
                             [?e :comp/version ?version]]


cljfmt formatting fix

cljfmt formatting fix

Signed-off-by: Dmitry Novotochinov <b5b1b877a7d2fe39ba1f1c39d1fd1abc6e284505@gmail.com>

--- src/status_im/ui/screens/extensions/events.cljs
+++ src/status_im/ui/screens/extensions/events.cljs
@@ -1,7 +1,7 @@
 (ns status-im.ui.screens.extensions.events
   (:require [re-frame.core :as re-frame]
-            [pluto.registry :as registry]
-            [status-im.utils.handlers :as handlers]
+            [pluto.registry :as registry]
+            [status-im.utils.handlers :as handlers]
             status-im.ui.screens.extensions.add.events))

 (handlers/register-handler-db


Fix server-side-driven error pages

Fix server-side-driven error pages

--- src-cljs/frontend/core.cljs
+++ src-cljs/frontend/core.cljs
@@ -298,7 +298,7 @@

     (if-let [error-status (get-in legacy-state [:render-context :status])]
       ;; error codes from the server get passed as :status in the render-context
-      (put! (:nav comms) [:error {:status error-status}])
+      (routes/open-to-inner! application (:nav comms) :error {:status error-status})
       (routes/dispatch! (str "/" (.getToken history-imp))))
     (when-let [user (:current-user legacy-state)]
       (analytics/track {:event-type :init-user


allow for multiple source paths as input.

--- src/asset_builder/builders/cljs.clj
+++ src/asset_builder/builders/cljs.clj
@@ -5,7 +5,10 @@
   (or
     (try
       (require 'cljs.build.api)
-      (some-> (resolve 'cljs.build.api/build) deref)
+      (let [build (some-> (resolve 'cljs.build.api/build) deref)
+            inputs (some-> (resolve 'cljs.build.api/inputs) deref)]
+        (fn [paths options]
+          (build (apply inputs paths) options)))
       (catch Throwable _))
     (fn [& _]
       (throw
@@ -13,13 +16,15 @@
           "dependency 'org.clojure/clojurescript' missing (or incompatible).")))))

 (defn build
-  [{:keys [source-path]
-    :or {source-path "src/cljs"}
+  [{:keys [source-path source-paths]
+    :or {source-paths ["src/cljs"]}
     :as cljs}]
-  (with-reporting [(format "Compiling ClojureScript [%s] ..." source-path)
-                   (format "ClojureScript [%s] has been compiled." source-path)]
-    (->> (merge
-           {:output-dir "target/out"}
-           (dissoc cljs :source-path)
-           {:verbose true})
-         (cljs-build! source-path))))
+  (let [paths (or (some-> source-path vector)
+                  (vec source-paths))]
+    (with-reporting [(format "Compiling ClojureScript %s ..." paths)
+                     (format "ClojureScript %s has been compiled." paths)]
+      (->> (merge
+             {:output-dir "target/out"}
+             (dissoc cljs :source-path :source-paths)
+             {:verbose true})
+           (cljs-build! paths)))))


expand -> path

expand -> path

--- src/atom_finder/util/30_fs_util.clj
+++ src/atom_finder/util/30_fs_util.clj
@@ -15,7 +15,7 @@
 (defn list-dirs
   [path]
   (->>
-   expand-home
+   path
    clojure.java.io/file
    .listFiles
    (filter #(.isDirectory %))))


bump gorillalabs/config to 1.0.4 for the new (assoc-in) extension

--- core/project.clj
+++ core/project.clj
@@ -2,7 +2,7 @@
             :plugins [[lein-modules "0.3.11"]]
             :description "basic microservice."
             :dependencies [[mount "0.1.10"]
-                           [gorillalabs/config "1.0.3"]
+                           [gorillalabs/config "1.0.4"]
                            [org.clojure/data.json "0.2.6"]
                            [beckon "0.1.1"]
                            [environ "1.0.3"]


Whitespace reformatting

Whitespace reformatting

--- ClojureScript/replete/src/replete/core.cljs
+++ ClojureScript/replete/src/replete/core.cljs
@@ -48,7 +48,7 @@
 (defn calc-x-line [text pos line]
   (let [x (s/index-of text "\n")]
     (if (or (nil? x)
-          (< pos (inc x)))
+            (< pos (inc x)))
       {:cursorX    pos
        :cursorLine line}
       (recur (subs text (inc x)) (- pos (inc x)) (inc line)))))
@@ -123,9 +123,9 @@

 (defn reflow [text]
   (and text
-    (-> text
-      (s/replace #" \n  " "")
-      (s/replace #"\n  " " "))))
+       (-> text
+         (s/replace #" \n  " "")
+         (s/replace #"\n  " " "))))

 ;; Copied from cljs.analyzer.api (which hasn't yet been converted to cljc)
 (defn resolve
@@ -150,7 +150,7 @@
     (when-let [cache (js/REPLETE_LOAD (str path ".cljs.cache.edn"))]
       {:lang   :js
        :source js-source
-       :cache (r/read-string cache)})))
+       :cache  (r/read-string cache)})))

 (defn- source-callback-data [path extension]
   (when-let [source (js/REPLETE_LOAD (str path extension))]
@@ -259,11 +259,11 @@
   (some
     (fn [quoted-spec-or-kw]
       (and (not (keyword? quoted-spec-or-kw))
-        (let [spec (second quoted-spec-or-kw)
-              ns   (if (sequential? spec)
-                     (first spec)
-                     spec)]
-          (= ns @current-ns))))
+           (let [spec (second quoted-spec-or-kw)
+                 ns   (if (sequential? spec)
+                        (first spec)
+                        spec)]
+             (= ns @current-ns))))
     specs))

 (defn- make-ns-form
@@ -575,7 +575,7 @@
                      (prn value)
                      (when-not
                        (or ('#{*1 *2 *3 *e} expression-form)
-                         (ns-form? expression-form))
+                           (ns-form? expression-form))
                        (set! *3 *2)
                        (set! *2 *1)
                        (set! *1 value))


Remove comment

Remove comment

--- src/braid/core/client/ui/views/hover_menu.cljs
+++ src/braid/core/client/ui/views/hover_menu.cljs
@@ -10,7 +10,7 @@
     [:polyline {:points "0,-5 5,0 0,5"
                 :transform (str "rotate("
                                 (case position
-                                  :top 90 ;
+                                  :top 90
                                   :bottom 270
                                   :left 0
                                   :right 180)


[#244] Example to connect to remote instance

--- api/src/clojure/org/akvo/flow_api/datastore/stats.clj
+++ api/src/clojure/org/akvo/flow_api/datastore/stats.clj
@@ -1,5 +1,6 @@
 (ns org.akvo.flow-api.datastore.stats
-  (:require [akvo.commons.gae.query :as q]
+  (:require [akvo.commons.gae :as gae]
+            [akvo.commons.gae.query :as q]
             [cheshire.core :as json]
             [org.akvo.flow-api.anomaly :as anomaly]
             [org.akvo.flow-api.datastore :as ds])
@@ -59,3 +60,14 @@
                                (map #(parse-value (.getProperty ^Entity % "value")) answers))))
                      []
                      (get-form-instance-ids ds form-id))))))
+
+
+(comment
+  (def ds-spec {:hostname "akvoflow-xx.appspot.com"
+                :port 443
+                :service-account-id "sa-akvoflow-xx@akvoflow-xx.iam.gserviceaccount.com"
+                :private-key-file "/server-config/akvoflow-xx/akvoflow-xx.p12"})
+  (gae/with-datastore [ds ds-spec]
+    (doto (question-counts ds {:formId "313200912"
+                               :questionId "311160912"}) prn))
+  )


render user details on proj detail pages

--- src/clj/hsm/controllers/project.clj
+++ src/clj/hsm/controllers/project.clj
@@ -167,8 +167,12 @@

 (defhtml user-list
   [users]
-  [:ul (for [x users]
-    [:li [:a {:href (format "/user2/%s" x)} x]])])
+  [:ul (for [x (reverse (sort-by :followers users))]
+    [:li [:a {:href (format "/user2/%s" (:login x))}
+    [:img.img-rounded {:src (:image x) :style "width:24px;height:24px;"}]
+    [:span (:login x)]
+    [:span.badge.badge-default.pull-right (:followers x)]
+     ]])])

 (defn get-proj-module
   [spec request]
@@ -199,6 +203,15 @@
               owner-obj (actions/load-user2 db owner)]
           (if is-json
             (json-resp (assoc proj :owner owner-obj))
+            (let [contributors (take 10 (:contributors proj-extras))
+                  watchers (take 10 (:watchers proj-extras))
+                  stargazers (take 10 (:stargazers proj-extras))
+                  people (vec (set (concat contributors watchers stargazers)))
+                  users (actions/load-users-by-id db people)
+                  contributors (filter #(in? contributors (:login %)) users)
+                  watchers (filter #(in? watchers (:login %)) users)
+                  stargazers (filter #(in? stargazers (:login %)) users)
+                  ]
             (html-resp
               (views/layout host
                 (project-header id proj admin? owner contributor-count watcher-count)
@@ -208,11 +221,11 @@
                       (get-project-readme* redis id))]
                   [:div.col-lg-2
                     (panel [:a {:href (str "/p/" id "/contributors")} [:span [:i.fa.fa-users] " Contributors" ]]
-                      (user-list (take 10 (:contributors proj-extras))))
+                      (user-list contributors ))
                     (panel [:a {:href (str "/p/" id "/watchers") } [:span [:i.fa.fa-users] "Watchers"]]
-                      (user-list (take 10 (:watchers proj-extras))))
+                      (user-list watchers))
                     (panel [:a {:href (str "/p/" id "/stargazers") } [:span [:i.fa.fa-users] "Stargazers"]]
-                      (user-list (take 10 (:stargazers proj-extras))))
+                      (user-list stargazers))

                     (panel "Related Projects"
                       [:ul
@@ -221,4 +234,4 @@
                             [:a {:href (str "/p/"(:full_name x))} (:full_name x)
                             [:p {:style "color:gray"} (cutoff (:description x) 50)]]
                             ]
-                          )])]]))))))))+                          )])]])))))))))


Fix hash check

Fix hash check

--- src/clj/sbsk/components/crawler.clj
+++ src/clj/sbsk/components/crawler.clj
@@ -92,18 +92,19 @@
   (fn []
     (log/debug "Starting crawler process...")
     (let [records (map scrub (fetch app-id app-secret page-id))
-          new-hash #_(hash records) nil] ;; hash is unreliable so disable until we can do this better
-      (if (not= new-hash @hash-atom)
-        (do
-          (log/info "New hash was observed:" new-hash)
-          (log/info "Found" (count records) "records...")
-          (log/info "Uploading full...")
-          (upload-full records database bucket-full)
-          (log/info "Uploading"
-                    (int (Math/ceil (/ (count records) records-per-segment)))
-                    "segments...")
-          (upload-segments records database bucket-segments records-per-segment))
-        (log/debug "No change observed"))
+          new-hash (hash records)]
+      ;; hash is unreliable so disable until we can do this better
+      (if true #_(not= new-hash @hash-atom)
+          (do
+            (log/info "New hash was observed:" new-hash)
+            (log/info "Found" (count records) "records...")
+            (log/info "Uploading full...")
+            (upload-full records database bucket-full)
+            (log/info "Uploading"
+                      (int (Math/ceil (/ (count records) records-per-segment)))
+                      "segments...")
+            (upload-segments records database bucket-segments records-per-segment))
+          (log/debug "No change observed"))
       (reset! hash-atom new-hash))))

 (defrecord Crawler [database


reorganized declarations in deckbuilder a little

--- src/cljs/netrunner/deckbuilder.cljs
+++ src/cljs/netrunner/deckbuilder.cljs
@@ -107,11 +107,6 @@
   (for [deck decks]
     (let [cards (map #(str (:qty %) " " (:card %)) (:cards deck))]
       (assoc deck :cards (parse-deck (get-in deck [:identity :side]) (join "\n" cards))))))
-
-(go (let [cards (<! cards-channel)
-          decks (process-decks (:json (<! (GET (str "/data/decks")))))]
-      (load-decks decks)
-      (>! cards-channel cards)))

 (defn distinct-by [f coll]
   (letfn [(step [xs seen]
@@ -610,4 +605,9 @@
            [:textarea {:ref "deck-edit" :value (:deck-edit state)
                        :on-change #(handle-edit owner)}]]]]]))))

+(go (let [cards (<! cards-channel)
+          decks (process-decks (:json (<! (GET (str "/data/decks")))))]
+      (load-decks decks)
+      (>! cards-channel cards)))
+
 (om/root deck-builder app-state {:target (. js/document (getElementById "deckbuilder"))})


Fix sync tests not running

Fix sync tests not running

--- test/lt/plugins/kukui/sync_test.cljs
+++ test/lt/plugins/kukui/sync_test.cljs
@@ -10,7 +10,9 @@
   (db/init)
   (reset! sync/last-edits {}))

-(use-fixtures :each reset-sync!)
+(use-fixtures :each (fn [f]
+                      (reset-sync!)
+                      (f)))

 (defn ->nodes [nodes]
   (->> nodes


Made a future-fact about data prerequisites

Interaction between background data prerequisites and local ones needs to be made right.

--- test/midje/ideas/t_metaconstants.clj
+++ test/midje/ideas/t_metaconstants.clj
@@ -105,7 +105,7 @@
   (merge ..m.. ..n..) => {:a 3, :b 4}
   (merge ..m.. ..n..) => map?)

-(fact "keys, values, and contains"
+(fact "keys, values, and contains work on metaconstants"
   (against-background ..m.. =contains=> {:a 3, :b 4})
   (keys ..m..) => [:a :b]
   (vals ..m..) => [3 4]
@@ -136,9 +136,46 @@
   ..m.. => (contains {:a (exactly even?), :b (exactly odd?)}))

+(defn fullname [person]
+  (str (:given person) " " (:family person)))
+
+(fact
+  (fullname ...person...) => "Brian Marick"
+  (provided
+    ...person... =contains=> {:given "Brian", :family "Marick"}))
+
 (fact "background metaconstants"
   (against-background ..m.. =contains=> {:a 1})
   (:a ..m..) => 1)
+
+(fact "metaconstants can be mentioned multiple times"
+  (+ (:a ..m..) (:b ..m..)) => 3
+  (provided
+    ..m.. =contains=> {:a 1}
+    ..m.. =contains=> {:b 2})
+
+  "Later takes precedence over the former."
+  (+ (:a ..m..) (:b ..m..)) => 3
+  (provided
+    ..m.. =contains=> {:a 1, :b 333333}
+    ..m.. =contains=> {:b 2}))
+
+(future-fact "combining background and `provided` prerequisites"
+  (against-background ..m.. =contains=> {:b 2})
+
+  (+ (:a ..m..) (:b ..m..)) => 3
+  (provided
+    ..m.. =contains=> {:a 1})
+
+  "`provided` keys take precedence"
+  (+ (:a ..m..) (:b ..m..)) => 301
+  (provided
+    ..m.. =contains=> {:a 1, :b 300}))
+
+
+(fact
+  (:a ..m..) => 1
+  (provided ..m.. =contains=> {:a 1}))

 (future-fact "an error case"
    (against-background ..m.. => {:a 1}))


Removed unused code.

Removed unused code.

--- src/com/lemondronor/turboshrimp.clj
+++ src/com/lemondronor/turboshrimp.clj
@@ -15,6 +15,9 @@

 ;; The default port to use for AT control commands.
 (def default-at-port 5556)
+
+;; The default port for streaming video.
+(def default-video-port 5555)

 ;; The default drone communication timeout, in milliseconds.
 (def socket-timeout (atom 60000))
@@ -188,41 +191,3 @@
   (util/cancel-scheduled-task @(:command-executor drone))
   (util/shutdown-pool @(:thread-pool drone))
   (network/close-socket @(:socket drone)))
-
-
-(defn drone-do-for [drone seconds command-key & [w x y z]]
-  (when (pos? seconds)
-    (command drone command-key w x y z)
-    (Thread/sleep 30)
-    (recur drone (- seconds 0.03) command-key [w x y z])))
-
-
-(defn do-led-animation [drone name hz duration]
-  (log/info name)
-  (command drone :animate-leds name hz duration)
-  (Thread/sleep 6000))
-
-
-(defn -main [& args]
-  (log/info "HELLO")
-  (let [drone (make-drone
-               :event-handler (fn [& args]
-                                ;;(println args)
-                                ))]
-    (connect! drone)
-    (log/info "Connected")
-    ;;(video/init-video "192.168.1.1")
-    ;;(video/start-video "192.168.1.1")
-    (command drone :ref {:emergency true})
-    (Thread/sleep 1000)
-    ;;(command drone :flat-trim)
-    (Thread/sleep 100000)
-    ;;(do-led-animation drone :blink-green-red 3 4000)
-    ;;(do-led-animation drone :fire 0.5 4000)
-    ;;(do-led-animation drone :red-snake 3 4000)
-    ;;(do-led-animation drone :blank 2 0)
-    ;;(takeoff drone)
-    ;;(clockwise drone 1.0)
-    (Thread/sleep 5000)
-    (land drone)
-    (Thread/sleep 500)))


Update layouts.clj dependencies

Update layouts.clj dependencies

--- src/clj/clojure_template/templates/layouts.clj
+++ src/clj/clojure_template/templates/layouts.clj
@@ -1,6 +1,6 @@
 (ns clojure-template.templates.layouts
-  (:require [environ.core :refer [env]])
-  (:use [hiccup.page :only [html5 include-css include-js]]))
+  (:require [environ.core :refer [env]]
+            [hiccup.page :refer [html5 include-css include-js]]))

 (defn application [& content]
   (html5 [:head


Fix disqus reset

Fix disqus reset

--- src/cljs/daveconservatoire/site/ui/disqus.cljs
+++ src/cljs/daveconservatoire/site/ui/disqus.cljs
@@ -41,8 +41,7 @@
 (defn start-thread [this]
   (go
     (<! (require-disqus (-> (om/props this) ::shortname)))
-    (let [d (Disqus)
-          props (om/props this)
+    (let [props (om/props this)
           props (cond-> props
                   (gstr/isEmpty (::url props)) (assoc ::url (current-url)))
           props (-> props (rename-keys prop-map) clj->js)
@@ -53,7 +52,7 @@
                                  (str "#!newthread"))]
                      (gobj/extend (gobj/get t "page") props)
                      (gobj/set (gobj/get t "page") "url" url)))]
-      (.reset d (js-obj "reload" true "config" config)))))
+      (js/window.DISQUS.reset (js-obj "reload" true "config" config)))))

 (om/defui ^:once DisqusThread
   Object


Refactor so that tests actually fail if jboss fails to start

--- support/fntest/src/main/clojure/fntest/core.clj
+++ support/fntest/src/main/clojure/fntest/core.clj
@@ -6,9 +6,7 @@
   (try
     (println "Starting JBoss")
     (jboss/start)
-    (if (jboss/wait-for-ready? 20)
-      (f)
-      (println "JBoss failed to start"))
+    (f)
     (finally
      (println "Stopping JBoss")
      (jboss/stop))))
@@ -17,7 +15,7 @@
   "Returns a test fixture for deploying/undeploying an app to a running JBoss"
   (fn [f]
     (try
-      (jboss/deploy name descriptor)
+      (when (jboss/wait-for-ready? 20) (jboss/deploy name descriptor))
       (f)
       (finally
        (jboss/undeploy name)))))