Fix testcase collection?

Fix testcase collection?

--- src/runbld/post/test/junit.clj
+++ src/runbld/post/test/junit.clj
@@ -17,30 +17,44 @@
 (defn content-text [xml]
   (apply str (map x/text xml)))

+(defn collect-errors-and-failures [class test xml]
+  (merge
+   {:error-type (:tag xml)
+    :class class
+    :test test
+    :stacktrace (content-text (:content xml))}
+   (:attrs xml)))
+
 (defn failed-testcase [xml]
-  (merge (:attrs xml)
-         {:stacktrace (content-text (:content xml))}))
+  (let [{:keys [classname name]} (:attrs xml)]
+    (map (partial collect-errors-and-failures classname name)
+         (x/select xml [#{:failure :error :skipped}]))))

 (defn failed-testcases [xml]
-  (map failed-testcase
-       (x/select xml [[:testcase (x/has [:failure])]])))
+  (mapcat failed-testcase
+          (x/select xml [:testcase])))

 (defn make-failure-report [xml]
   (let [meta (select-keys
               (testcase-meta xml)
               [:name :errors :failures :tests :skipped])]
-    (when (pos? (:failures meta))
+    (when (or (pos? (:failures meta))
+              (pos? (:errors meta)))
       (assoc meta
              :testcases
              (failed-testcases xml)))))

 (defn combine-failure-reports [total testsuite]
-  (-> total
-      (update :errors + (:errors testsuite))
-      (update :failures + (:failures testsuite))
-      (update :tests + (:tests testsuite))
-      (update :skipped + (:skipped testsuite))
-      (update :testcases concat (:testcases testsuite))))
+  (try
+    (-> total
+        (update :errors + (:errors testsuite))
+        (update :failures + (:failures testsuite))
+        (update :tests + (:tests testsuite))
+        (update :skipped + (:skipped testsuite))
+        (update :testcases concat (:testcases testsuite)))
+    (catch Throwable t
+      (clojure.pprint/pprint testsuite)
+      (throw t))))

 (defn find-failures [dir]
   (when dir
@@ -53,7 +67,8 @@
          (map #(str "file://" %))
          (map #(java.net.URL. %))
          (map x/xml-resource)
-         (map make-failure-report)
+         (pmap make-failure-report)
+         (filter identity)
          (reduce combine-failure-reports {:errors 0
                                           :failures 0
                                           :tests 0


read-stat-for-product and read-stat-for-product-repo

--- src/arachnida/server.clj
+++ src/arachnida/server.clj
@@ -337,13 +337,24 @@
         (-> (html-renderer/render-author-week-repo-page author-name selected-week stat-for-week product repo)
             continue-processing)))

+(defn read-stat-for-product
+    [product-id]
+    (db-interface/read-statistic-for-product product-id))
+
+(defn read-stat-for-product-repo
+    [product-id]
+    (db-interface/read-statistic-for-product-repo product-id))
+
 (defn perform-product-page
     [request]
     (let [params (:params request)
           product-name (get params "name")
           product-id   (db-interface/read-product-id product-name)
-          repositories (db-interface/read-repo-list product-id)]
-        (-> (html-renderer/render-product-page product-name repositories)
+          repositories (db-interface/read-repo-list product-id)
+          last-week    (calendar/get-week (calendar/get-calendar))
+          product-stat (read-stat-for-product product-id)
+          product-repo (read-stat-for-product-repo product-id)]
+        (-> (html-renderer/render-product-page product-name repositories product-stat product-repo)
             continue-processing)))

 (defn update-file-name


[#1450] Fix reference

[#1450] Fix reference

--- backend/dev/src/dev.clj
+++ backend/dev/src/dev.clj
@@ -50,7 +50,7 @@
                                      (let [file-name (->> (format "%s-%s-%s-%s-%s" instance survey-id form-id (name rows-cols) version)
                                                           (format "./dev/resources/%s/%s.edn" dev-flow-datasets-dir))]
                                        (doseq [d data]
-                                         (spit file-name data :append true)))
+                                         (spit file-name d :append true)))
                                      (f nil data))))
   (commons/config)
   (ir/go))


remove interpreter ref

remove interpreter ref

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/aurora/compiler.cljs
+++ src/aurora/compiler.cljs
@@ -1,7 +1,6 @@
 (ns aurora.compiler
   (:require [aurora.jsth :as jsth]
             [aurora.ast :as ast]
-            [aurora.interpreter :as i]
             [aurora.util :refer [map!]])
   (:require-macros [aurora.macros :refer [for! check deftraced]]))


Unknow should update delta instead of normal

--- src/aurora/language.cljs
+++ src/aurora/language.cljs
@@ -85,7 +85,7 @@
                       (dotimes [i (alength facts&vals)]
                         (when (== 1 (mod i 2))
                           (aset facts&vals i (- (aget facts&vals i)))))
-                      (.update-facts this kind name (into-array fields) facts&vals)))))
+                      (.update-facts this kind (str "delta-" name) (into-array fields) facts&vals)))))
   (merge-facts [this name]
                (let [[fields delta-know-index] (first (get-in kind->name->fields->index ["know" (str "delta-" name)]))]
                  #_(prn :merging name (when delta-know-index (alength (.elems delta-know-index))))


alphabetize

alphabetize

--- src/babel/directory.cljc
+++ src/babel/directory.cljc
@@ -45,8 +45,6 @@
 (defn write-lexicons []
   (db/init-db)
   (transaction
-   (print (str "it.."))
-   (println (write-lexicon "it" (it-lex/compile-lexicon)))

    (print (str "en.."))
    (println (write-lexicon "en" (en/compile-lexicon)))
@@ -55,5 +53,7 @@
    (println (write-lexicon "es" (es/compile-lexicon)))

    (print (str "fr.."))
-   (println (write-lexicon "fr" (fr/compile-lexicon)))))
+   (println (write-lexicon "fr" (fr/compile-lexicon)))

+   (print (str "it.."))
+   (println (write-lexicon "it" (it-lex/compile-lexicon)))))


swank needs to depend on compile

swank needs to depend on compile

--- src/cake/tasks/swank.clj
+++ src/cake/tasks/swank.clj
@@ -44,7 +44,7 @@
     (println "error loading swank-clojure.")
     (println "see http://clojure-cake.org/swank for installation instructions")))

-(deftask swank
+(deftask swank #{compile}
   "Report status of swank server and start it if not running."
   {[host] :swank}
   (if @current-port


Node.js works fine under :optimizations :none now

--- src/clj/cljs/closure.clj
+++ src/clj/cljs/closure.clj
@@ -1438,7 +1438,7 @@
                        (apply output-unoptimized all-opts js-sources))]
              ;; emit Node.js bootstrap script for :none & :whitespace optimizations
              (when (and (= (:target opts) :nodejs)
-                        (#{:none :whitespace} (:optimizations opts)))
+                        (not= (:optimizations opts) :whitespace))
                (let [outfile (io/file (util/output-directory opts)
                                "goog" "bootstrap" "nodejs.js")]
                  (util/mkdirs outfile)


plugin api

plugin api

--- src/clj/swarmpit/api.clj
+++ src/clj/swarmpit/api.clj
@@ -429,6 +429,21 @@
   (dmi/->task (dc/task task-id)
               (dc/nodes)
               (dc/services)))
+
+;; Plugin API
+
+(defn plugins
+  []
+  (->> (dc/nodes)
+       (map #(get-in % [:Description :Engine :Plugins]))
+       (flatten)
+       (distinct)
+       (group-by :Type)))
+
+(defn plugins-by-type
+  [type]
+  (->> (get (plugins) type)
+       (map :Name)))

 ;; Placement API


Added ability to set max text message size for jetty client.

--- src/clj_discord/core.clj
+++ src/clj_discord/core.clj
@@ -3,7 +3,9 @@
   (:require [clojure.java.io :as io]
             [clj-http.client :as http]
             [clojure.data.json :as json]
-            [gniazdo.core :as ws]))
+            [gniazdo.core :as ws])
+  (:import (org.eclipse.jetty.util.ssl SslContextFactory)
+           (org.eclipse.jetty.websocket.client WebSocketClient)))

 (defonce the-token (atom nil))
 (defonce the-gateway (atom nil))
@@ -12,6 +14,8 @@
 (defonce the-keepalive (atom false))
 (defonce the-seq (atom nil))
 (defonce reconnect-needed (atom false))
+
+(def default-max-text-message-size (* 64 1024))

 (defn disconnect []
   (reset! reconnect-needed false)
@@ -23,53 +27,61 @@
   (reset! the-seq nil)
   (reset! the-heartbeat-interval nil))

-(defn connect [token functions log-events]
-  (disconnect)
-  (reset! the-keepalive true)
-  (reset! the-token (str "Bot " token))
-  (reset! the-gateway (str
+(defn connect
+  ([token functions log-events]
+   (connect token functions log-events default-max-text-message-size))
+  ([token functions log-events max-text-message-size]
+   (disconnect)
+   (reset! the-keepalive true)
+   (reset! the-token (str "Bot " token))
+   (reset! the-gateway (str
                         (get
-                          (json/read-str
-                            (:body (http/get "https://discordapp.com/api/gateway"
-                                             {:headers {:authorization @the-token}})))
-                          "url")
+                         (json/read-str
+                          (:body (http/get "https://discordapp.com/api/gateway"
+                                           {:headers {:authorization @the-token}})))
+                         "url")
                         "?v=6&encoding=json"))
-  (reset! the-socket
-          (ws/connect
-            @the-gateway
-            :on-receive #(let [received (json/read-str %)
-                               logevent (if log-events (println "\n" %))
-                               op (get received "op")
-                               type (get received "t")
-                               data (get received "d")
-                               seq (get received "s")]
-                           (if (= 10 op) (reset! the-heartbeat-interval (get data "heartbeat_interval")))
-                           (if (not (nil? seq)) (reset! the-seq seq))
-                           (if (not (nil? type)) (doseq [afunction (get functions type (get functions "ALL_OTHER" []))] (afunction type data))))))
-  (.start (Thread. (fn []
-                     (try
-                       (while @the-keepalive
-                         (if (nil? @the-heartbeat-interval)
-                           (Thread/sleep 100)
-                           (do
-                             (if log-events (println "\nSending heartbeat " @the-seq))
-                             (ws/send-msg @the-socket (json/write-str {:op 1, :d @the-seq}))
-                             (Thread/sleep @the-heartbeat-interval)
-                             )))
-                       (catch Exception e (do
-                                            (println "\nCaught exception: " (.getMessage e))
-                                            (reset! reconnect-needed true)
-                                            ))))))
-  (Thread/sleep 1000)
-  (ws/send-msg @the-socket (json/write-str {:op 2, :d {"token" @the-token
-                                                       "properties" {"$os" "linux"
-                                                                     "$browser" "clj-discord"
-                                                                     "$device" "clj-discord"
-                                                                     "$referrer" ""
-                                                                     "$referring_domain" ""}
-                                                       "compress" false}}))
-  (while (not @reconnect-needed) (Thread/sleep 1000))
-  (connect token functions log-events))
+   (reset! the-socket
+           (let [client (new WebSocketClient (new SslContextFactory))]
+             (.setMaxTextMessageSize (.getPolicy client) max-text-message-size)
+             (.start client)
+             (ws/connect
+              @the-gateway
+              :client client
+              :on-receive #(let [received (json/read-str %)
+                                 logevent (if log-events (println "\n" %))
+                                 op (get received "op")
+                                 type (get received "t")
+                                 data (get received "d")
+                                 seq (get received "s")]
+                             (if (= 10 op) (reset! the-heartbeat-interval (get data "heartbeat_interval")))
+                             (if (not (nil? seq)) (reset! the-seq seq))
+                             (if (not (nil? type)) (doseq [afunction (get functions type (get functions "ALL_OTHER" []))]
+                                                     (afunction type data)))))))
+   (.start (Thread. (fn []
+                      (try
+                        (while @the-keepalive
+                          (if (nil? @the-heartbeat-interval)
+                            (Thread/sleep 100)
+                            (do
+                              (if log-events (println "\nSending heartbeat " @the-seq))
+                              (ws/send-msg @the-socket (json/write-str {:op 1, :d @the-seq}))
+                              (Thread/sleep @the-heartbeat-interval)
+                              )))
+                        (catch Exception e (do
+                                             (println "\nCaught exception: " (.getMessage e))
+                                             (reset! reconnect-needed true)
+                                             ))))))
+   (Thread/sleep 1000)
+   (ws/send-msg @the-socket (json/write-str {:op 2, :d {"token" @the-token
+                                                        "properties" {"$os" "linux"
+                                                                      "$browser" "clj-discord"
+                                                                      "$device" "clj-discord"
+                                                                      "$referrer" ""
+                                                                      "$referring_domain" ""}
+                                                        "compress" false}}))
+   (while (not @reconnect-needed) (Thread/sleep 1000))
+   (connect token functions log-events)))

 (defn post-message [channel_id message]
   (http/post (str "https://discordapp.com/api/channels/" channel_id "/messages")


Use user given reporters when specified

Use user given reporters when specified

--- src/clj_gatling/core.clj
+++ src/clj_gatling/core.clj
@@ -58,7 +58,7 @@
     [report/short-summary-reporter r]))

 (defn run [simulation {:keys [concurrency concurrency-distribution root timeout-in-ms context
-                              requests duration reporter error-file executor nodes]
+                              requests duration reporter reporters error-file executor nodes]
                        :or {concurrency 1
                             root "target/results"
                             executor pipeline/local-executor
@@ -66,7 +66,7 @@
                             timeout-in-ms 5000
                             context {}}}]
   (let [results-dir (create-results-dir root (:name simulation))
-        reporters (create-reporters reporter results-dir simulation)
+        reporters (or reporters (create-reporters reporter results-dir simulation))
         _ (validate [schema/Reporter] reporters)
         summary (pipeline/run simulation {:concurrency concurrency
                                           :concurrency-distribution concurrency-distribution


function names changed to add-cookie and clear-cookies

--- src/clj_http/cookies.clj
+++ src/clj_http/cookies.clj
@@ -135,3 +135,15 @@
   [^CookieStore cookie-store]
   (when cookie-store
     (into {} (map to-cookie (.getCookies cookie-store)))))
+
+(defn add-cookie
+  "Add a ClientCookie to a cookie-store"
+  [^CookieStore cookie-store ^ClientCookie cookie]
+  (.addCookie cookie-store cookie)
+  )
+
+(defn clear-cookies
+  "Clears all cookies from cookie-store"
+  [^CookieStore cookie-store]
+  (.clear cookie-store)
+  )


Flesh out pixel-pusher display a bit more.

--- src/org/playasophy/wonderdome/display/pixel_pusher.clj
+++ src/org/playasophy/wonderdome/display/pixel_pusher.clj
@@ -2,24 +2,53 @@
   (:require
     [com.stuartsierra.component :as component]
     [org.playasophy.wonderdome.display.core :as display])
-  #_
   (:import
-    [com.heroicrobot.dropbit.registry *]
-    com.heroicrobot.dropbit.devices.pixelpusher.Strip))
+    #_
+    (com.heroicrobot.dropbit.devices.pixelpusher
+      Strip)
+    #_
+    (com.heroicrobot.dropbit.registry
+      DeviceRegistry)))

-;;;;; WONDERDOME DISPLAY ;;;;;
+;;;;; CONFIGURATION ;;;;;
+
+; Suppress spurious log output.
+#_
+(->
+  DeviceRegistry
+  .getName
+  java.util.logging.Logger/getLogger
+  (.setLevel java.util.logger.Level/WARNING))
+
+
+(defn- registry-observer
+  "Constructs a new callback function which will update the strips in the given
+  atom when the device registry changes."
+  [registry strips]
+  (reify java.util.Observer
+    (update [this target device]
+      (let [new-strips (vec (.getStrips registry))]
+        (println "Updated device:" device (str "(" (count new-strips) " strips)"))
+        (reset! strips new-strips)))))
+
+
+
+;;;;; PIXEL PUSHER DISPLAY ;;;;;

 (defrecord PixelPusherDisplay
-  [registry strips running])
+  [registry strips running]

-(extend-type PixelPusherDisplay
   component/Lifecycle

   (start
     [this]
     (println "Starting PixelPusher display...")
-    ; TODO: add device observer
+    (doto registry
+      (.addObserver (registry-observer registry strips))
+      (.startPushing)
+      (.setExtraDelay 0)
+      (.setAutoThrottle true))
     (assoc this :running true))

@@ -27,6 +56,7 @@
     [this]
     (println "Stopping PixelPusher display...")
     ; TODO: clear strips, remove device observer?
+    (.stopPushing registry)
     (assoc this :running false))

@@ -38,8 +68,8 @@
     nil))

-(defn pixel-pusher-display
+(defn pixel-pusher
   "Creates a new display streaming color commands to connected pixel-pusher
   hardware."
-  ([registry]
-   (PixelPusherDisplay. registry (atom []) false)))
+  [registry]
+  (PixelPusherDisplay. registry (atom []) false))


Small refactoring of example.clj for anagram

`frequencies` is a core function that will make the word into a
map of letter frequencies, e.g.:

(canonicalize "hello")
;=> {\h 1, \e 1, \l 2, \o 1}

`frequencies` seems a bit clearer than the `split #""` then `sort`.

(Interestingly, the `split` is not necessary even if `sort`ing, since
Clojure will represent `word` as an Object array of Characters,
then return it sorted. `frequencies` probably ends up slower than `sort`
over large strings due to the incremental object allocation, but also
is likely _faster_ than `split` ... `sort`.)

--- assignments/clojure/anagram/example.clj
+++ assignments/clojure/anagram/example.clj
@@ -5,8 +5,7 @@
   [word]
   (-> word
       lower-case
-      (split #"")
-      sort))
+      frequencies))

 (defn anagrams-for
   [word candidates]


Fix #5

Fix #5

--- src/structural_typing/guts/compile/to_specter_path.clj
+++ src/structural_typing/guts/compile/to_specter_path.clj
@@ -11,24 +11,34 @@
             [structural-typing.assist.oopsie :as oopsie]
             [structural-typing.guts.preds.wrap :as wrap]))

-(extend-type clojure.lang.Keyword
-  sp/StructurePath
-  (select* [kw structure next-fn]
+
+;; NOTE: I don't know why Specter requires `extend-type/extend-protocol` instead of
+;; defining the protocol functions in the deftype. But it does.
+
+(deftype KeywordVariantType [keyword])
+
+(extend-type KeywordVariantType
+  sp/StructurePath
+  (select* [this structure next-fn]
     (cond (map? structure)
-          (next-fn (get structure kw))
+          (next-fn (get structure (.-keyword this)))

           (nil? structure)
           (next-fn nil)

           :else
           (boom! "%s is not a map" structure)))
-  (transform* [kw structure next-fn]
-    (assoc structure kw (next-fn (get structure kw)))
-    ))
-
-(extend-type java.lang.Long
-  sp/StructurePath
-  (select* [this structure next-fn]
+  (transform* [this structure next-fn] (boom! "structural-typing does not use transform")))
+
+(defmethod clojure.core/print-method KeywordVariantType [o, ^java.io.Writer w]
+  (.write w (str (.-keyword o))))
+
+
+(deftype IntegerVariantType [value])
+
+(extend-type IntegerVariantType
+  sp/StructurePath
+  (select* [this structure next-fn]
     (cond (nil? structure)
           (next-fn nil)

@@ -37,10 +47,15 @@

           :else
           (try
-            (next-fn (nth structure this))
+            (next-fn (nth structure (.-value this)))
             (catch IndexOutOfBoundsException ex
               (next-fn nil)))))
   (transform* [kw structure next-fn] (boom! "structural-typing does not use transform")))
+
+(defmethod clojure.core/print-method IntegerVariantType [o, ^java.io.Writer w]
+  (.write w (str (.-value o))))
+
+

                                  ;;; ALL, RANGE
@@ -154,6 +169,16 @@
                         (surround-with-index-collector elt))
                   :indexed-path)

+           (keyword? elt)
+           (recur remainder
+                  (conj specter-path (->KeywordVariantType elt))
+                  path-type)
+
+           (integer? elt)
+           (recur remainder
+                  (conj specter-path (->IntegerVariantType elt))
+                  path-type)
+
            :else
            (recur remainder (conj specter-path elt) path-type))))


adjust ifn hack again

adjust ifn hack again

--- src/main/shadow/build/cljs_hacks.cljc
+++ src/main/shadow/build/cljs_hacks.cljc
@@ -753,7 +753,9 @@
                  ;; experiment with allowing not-native for ftag
                  ;; (^not-native thing 1 2 3) as a way to tell the compiler to use IFn invoke
                  ;; without checking. breaks if arity is not implemented, just like not-native for other protocols?
-                 (and (not proto?) (= 'not-native ftag))
+                 ;; needs to back off on protocol fns tagged with not-native
+                 ;; (defprotocol Something (^not-native some-fn [x]))
+                 (and (not protocol) (= 'not-native ftag))
                  (let [f (ana/unwrap-quote f)]
                    (and (= (-> f :op) :const)
                         (keyword? (-> f :form)))))


[WM] update deps in generated project.clj

--- resources/leiningen/new/kraken_works/project.clj
+++ resources/leiningen/new/kraken_works/project.clj
@@ -6,15 +6,15 @@
   :dependencies [[org.clojure/clojure "1.7.0"]
                  [org.clojure/tools.logging "0.3.1"]
                  [turbovote.resource-config "0.2.0"]
-                 [com.novemberain/langohr "3.3.0"]
                  [democracyworks/datomic-toolbox "1.1.0" :exclusions [com.datomic/datomic-pro]]
-                 [prismatic/schema "1.0.0"]
-                 [com.datomic/datomic-pro "0.9.5153" :exclusions [org.slf4j/slf4j-nop
+                 [com.novemberain/langohr "3.4.2"]
+                 [prismatic/schema "1.0.4"]
+                 [com.datomic/datomic-pro "0.9.5327" :exclusions [org.slf4j/slf4j-nop
                                                                   org.slf4j/slf4j-log4j12]]
                  [ch.qos.logback/logback-classic "1.1.3"]
-                 [org.immutant/core "2.0.2"]
+                 [org.immutant/core "2.1.1"]
                  [democracyworks/kehaar "0.5.0"]]
-  :plugins [[lein-immutant "2.0.0"]]
+  :plugins [[lein-immutant "2.1.0"]]
   :main ^:skip-aot {{name}}.core
   :target-path "target/%s"
   :repositories {"my.datomic.com" {:url "https://my.datomic.com/repo"


message tool

message tool

--- src/cljs/salava/extra/spaces/ui/message_tool.cljs
+++ src/cljs/salava/extra/spaces/ui/message_tool.cljs
@@ -145,7 +145,7 @@

-(defn content [state]
+(defn content [space-id state]
   [:div#space
    [m/modal-window]
    [:p (t :extra-spaces/Aboutmessagetool)]
@@ -188,7 +188,54 @@
            [:span [:b (count @(cursor state [:emails])) " emails found"]]
            [:div#admin-report
             (reduce
-             #(conj %1 ^{:key %2}[:li.list-group-item %2]) [:ul.list-group] @(cursor state [:emails]))]])]]]]])
+             #(conj %1 ^{:key %2}[:li.list-group-item %2]) [:ul.list-group] @(cursor state [:emails]))]])]]
+      (if (seq @(cursor state [:emails]))
+       [:div.well.well-sm;.panel.panel-default
+        #_[:div.panel-heading.weighted
+           (t :extra-space/Composemessage)]
+        [:div.panel-body
+         [:div.form-group
+          [:label {:for "subject"} (t :extra-spaces/Subject) [:span.form-required " *"]]
+          [:input#subject.form-control
+           {:style {:max-width "500px"}
+            :type "text"
+            :value @(cursor state [:message :subject])
+            :on-change #(reset! (cursor state [:message :subject]) (.-target.value %))
+            :required true}]]
+         [:div.form-group
+          [:label {:for "message"} (t :extra-spaces/Message) [:span.form-required " *"]]
+          [:textarea#message.form-control
+           {:style {:max-width "500px"}
+            :on-change #(reset! (cursor state [:message :content]) (.-target.value %))
+            :rows 8
+            :value @(cursor state [:message :content])
+            :required true}]]
+         [:div.btn-toolbar
+          [:div.btn-group
+           [:button.btn.btn-primary.btn-bulky
+            {:aria-label (t :extra-spaces/Sendmessages)
+             :on-click #(do
+                         (.preventDefault %)
+                         (reset! (cursor state [:sending_messages]) true)
+                         (ajax/POST
+                           (path-for (str "/obpv1/space/message_tool/send_message/" space-id))
+                           {:handler (fn [data]
+                                       (when (= "success" (:status data))
+                                         (reset! (cursor state [:sending_messages]) true)))}))
+
+             :disabled (or (clojure.string/blank? @(cursor state [:message :subject]))
+                           (clojure.string/blank? @(cursor state [:message :content])))}
+            [:span (when @(cursor state [:sending_messages]) [:i.fa.fa-cog.fa-spin.fa-lg]) " " (t :extra-spaces/Sendmessages)]]
+           [:button.btn.btn-warning.btn-bulky
+            {:aria-label (t :core/Cancel)
+             :on-click #(do
+                          (.preventDefault %)
+                          (reset! (cursor state [:message]) {:content "" :subject ""}))}
+            (t :core/Cancel)]]]]]
+       [:div.well.well-sm
+        (t :extra-spaces/Selectbadgefirst)])]]])
+
+

 (defn init-badges [space-id state]
   (ajax/POST
@@ -202,7 +249,15 @@

 (defn handler [site-navi]
   (let [space-id (session/get-in [:user :current-space :id] 0)
-        state (atom {:space-id space-id :badges [] :search "" :selected-issuer "" :selected-badges [] :select-all false :emails []})]
+        state (atom {:space-id space-id
+                     :badges []
+                     :search ""
+                     :selected-issuer ""
+                     :selected-badges []
+                     :select-all false
+                     :emails []
+                     :message {:content "" :subject ""}
+                     :sending_messages false})]
    (init-data space-id state)
    (fn []
-    (layout/default site-navi [content state]))))
+    (layout/default site-navi [content space-id state]))))


lein-release plugin: preparing 0.2.2 release

--- prosemirror/project.clj
+++ prosemirror/project.clj
@@ -1,4 +1,4 @@
-(defproject re-view/prosemirror "0.2.2-SNAPSHOT"
+(defproject re-view/prosemirror "0.2.2"

   :description "Rich text editors built with ProseMirror in Re-View"


Refactor using conss

Refactor using conss

--- src/the_little_clojurian/chapter3.clj
+++ src/the_little_clojurian/chapter3.clj
@@ -10,7 +10,9 @@
             (eq? (car lat) a) (cdr lat)
             :else (conss (car lat) (rember a
                                            (cdr lat))))))
-
+
+  (is (= (rember 'and '()) '()))
+  (is (= (rember 'and '(and)) '()))
   (is (= (rember 'and '(bacon lettuce and tomato)) '(bacon lettuce tomato)))
   (is (= (rember 'mint '(lamb chops and mint jelly)) '(lamb chops and jelly)))
   (is (= (rember 'mint '(lamb chops and mint flavored mint jelly)) '(lamb chops and flavored mint jelly))))
@@ -23,6 +25,7 @@
             :else (cons (car (car l))
                         (firsts (cdr l))))))

+  (is (= (firsts '()) '()))
   (is (= (firsts '((apple peach pumpkin)
                    (plum pear cherry)
                    (grape raisin pea)
@@ -39,9 +42,7 @@
                    ((no) more)))
          '((five plums)
            eleven
-           (no))))
-  (is (= (firsts '())
-         '())))
+           (no)))))

 (with-test
   (def insertR
@@ -78,8 +79,8 @@
   (def subst
     (fn [new old lat]
       (cond (null? lat) '()
-            (eq? (car lat) old) (cons new (cdr lat))
-            :else (cons (car lat)
+            (eq? (car lat) old) (conss new (cdr lat))
+            :else (conss (car lat)
                         (subst new old (cdr lat))))))

   (is (= (subst 'topping 'fudge '())
@@ -92,8 +93,8 @@
     (fn [new o1 o2 lat]
       (cond (null? lat) '()
             (or (eq? (car lat) o1)
-                (eq? (car lat) o2)) (cons new (cdr lat))
-            :else (cons (car lat) (subst2 new o1 o2 (cdr lat))))))
+                (eq? (car lat) o2)) (conss new (cdr lat))
+            :else (conss (car lat) (subst2 new o1 o2 (cdr lat))))))

   (is (= (subst2 'vanilla 'chocolate 'banana '())
          '()))
@@ -106,7 +107,7 @@
     (fn [a lat]
       (cond (null? lat) '()
             (eq? (car lat) a) (multirember a (cdr lat))
-            :else (cons (car lat) (multirember a (cdr lat))))))
+            :else (conss (car lat) (multirember a (cdr lat))))))
   (is (= (multirember 'cup '())
          '()))
   (is (= (multirember 'cup '(coffee cup tea cup and hick cup))
@@ -116,8 +117,8 @@
   (def multiinsertR
     (fn [new old lat]
       (cond (null? lat) '()
-            (eq? (car lat) old) (cons old (cons new (multiinsertR new old (cdr lat))))
-            :else (cons (car lat) (multiinsertR new old (cdr lat))))))
+            (eq? (car lat) old) (conss old (conss new (multiinsertR new old (cdr lat))))
+            :else (conss (car lat) (multiinsertR new old (cdr lat))))))

   (is (= (multiinsertR 'new 'old '())
          '()))
@@ -128,7 +129,7 @@
   (def multiinsertL
     (fn [new old lat]
       (cond (null? lat) '()
-            (eq? (car lat) old) (cons new (cons old (multiinsertL new old (cdr lat))))
+            (eq? (car lat) old) (conss new (conss old (multiinsertL new old (cdr lat))))
             :else (cons (car lat) (multiinsertL new old (cdr lat))))))

   (is (= (multiinsertL 'new 'old '())
@@ -140,8 +141,8 @@
   (def multisubst
     (fn [new old lat]
       (cond (null? lat) '()
-            (eq? (car lat) old) (cons new (multisubst new old (cdr lat)))
-            :else (cons (car lat) (multisubst new old (cdr lat))))))
+            (eq? (car lat) old) (conss new (multisubst new old (cdr lat)))
+            :else (conss (car lat) (multisubst new old (cdr lat))))))
   (is (= (multisubst 'new 'old '())
          '()))
   (is (= (multisubst 'new 'old '(frog))


Adds occur*

Adds occur*

--- src/the_little_clojurian/chapter5.clj
+++ src/the_little_clojurian/chapter5.clj
@@ -30,6 +30,7 @@
             (atom? (car l)) (cond (eq? (car l) old) (cons old
                                                           (cons new (insertR* new old
                                                                               (cdr l))))
+
                                   :else (cons (car l)
                                               (insertR* new old
                                                         (cdr l))))
@@ -40,3 +41,19 @@
   (is (= (insertR* 'new 'old '(old)) '(old new)))
   (is (= (insertR* 'new 'old '((old))) '((old new))))
   (is (= (insertR* 'new 'old '((these) old ((shoes old) perfume))) '((these) old new ((shoes old new) perfume)))))
+
+(with-test
+  (def occur*
+    (fn [a l]
+      (cond (null? l) 0
+            (atom? (car l)) (cond (eq? (car l) a) (add1 (occur* a (cdr l)))
+                                  :else (occur* a (cdr l)))
+            :else (pluss (occur* a (car l))
+                         (occur* a (cdr l))))))
+
+  (is (= (occur* 'beer '()) 0))
+  (is (= (occur* 'beer '(beer)) 1))
+  (is (= (occur* 'beer '(coffee)) 0))
+  (is (= (occur* 'beer '((beer))) 1))
+  (is (= (occur* 'orange '((orange (beer)))) 1))
+  (is (= (occur* 'orange '((banana split) and (orange) with sherbet (((and orange peanut) butter)))) 2)))


Send value as 1 for each event

Send value as 1 for each event

--- src/javascript_externs_generator/ui/handlers.cljs
+++ src/javascript_externs_generator/ui/handlers.cljs
@@ -77,7 +77,7 @@
     (let [ga (aget js/window "ga")
           {:keys [category action label]} event
           {:keys [dimension value]} custom]
-      (ga "send" "event" category action label (clj->js {dimension value})))
+      (ga "send" "event" category action label 1 (clj->js {dimension value})))
     db))

 (rf/register-handler


CMR-1223: Address review comments

CMR-1223: Address review comments

--- system-int-test/test/cmr/system_int_test/jobs_test.clj
+++ system-int-test/test/cmr/system_int_test/jobs_test.clj
@@ -30,15 +30,15 @@
     (is (= 204 (:status (perform-action-on-jobs :post url :pause token)))))
   (s/only-with-real-database
     (testing "jobs are marked as paused"
-      (is (= [200 true]
-             (let [response (perform-action-on-jobs :get url :status token)]
+      (let [response (perform-action-on-jobs :get url :status token)]
+        (is (= [200 true]
                [(:status response)
                 (paused? response)])))))
   (testing "resume returns 204"
     (is (= 204 (:status (perform-action-on-jobs :post url :resume token)))))
   (testing "jobs are not marked as paused"
-    (is (= [200 false]
-           (let [response (perform-action-on-jobs :get url :status token)]
+    (let [response (perform-action-on-jobs :get url :status token)]
+      (is (= [200 false]
              [(:status response)
               (paused? response)])))))


Copy changes

Copy changes

--- src-cljs/frontend/components/add_projects.cljs
+++ src-cljs/frontend/components/add_projects.cljs
@@ -81,10 +81,9 @@

 (def repos-explanation
   [:div.add-repos
-   [:h3 "Welcome to Circle"]
    [:ul
     [:li
-     "Get started by selecting your GitHub username or organization on the left."]
+     "Get started by selecting your GitHub username or organization above."]
     [:li "Choose a repo you want to test and we'll do the rest!"]]])

 (defn repo-item [data owner]


Add t! variant

Add t! variant

--- etc/scratch.clj
+++ etc/scratch.clj
@@ -15,6 +15,7 @@
 (R/find-test-ns  #\"some-regex\") - find test namespace matching regex
 (R/find-ns  #\"some-regex\") - find namespace matching regex
 (R/t (R/find-test-ns  #\"some-regex\")) - run tests for matching namespaces
+(R/t! (R/find-test-ns  #\"some-regex\")) - run tests for matching namespaces but also refresh (dangerous!)
 (R/time+ \"tag\"  (some expr)) - like time, but better
 (R/refresh) - refresh all namespaces
 (scrtach/refresh-all) - refresh all project + dep namespaces
@@ -49,6 +50,14 @@
   ([ns-list]
    (apply kaocha.repl/run ns-list)))

+(defn t!
+  ([]
+   (refresh)
+   (kaocha.repl/run :unit))
+  ([ns-list]
+   (refresh)
+   (apply kaocha.repl/run ns-list)))
+
 (defmacro time+
   "Like time but:
   - accepts a `tag` argument


Throw on stop in case of unsuccesfull shutdown

--- src/puppetlabs/trapperkeeper/internal.clj
+++ src/puppetlabs/trapperkeeper/internal.clj
@@ -616,8 +616,12 @@
         (inc-restart-counter! this)
         this)
       (a/stop [this]
-        (shutdown! app-context)
-        this)
+        (if-let [errors (not-empty (shutdown! app-context))]
+          (let [msg (i18n/trs "Error during app shutdown!")
+                e (ex-info msg {:errors errors})]
+            (log/error e msg)
+            (throw e))
+          this))
       (a/restart [this]
         (try
           (run-lifecycle-fns app-context s/stop "stop" (reverse ordered-services))


fix aget usage

fix aget usage

fixes #680

--- support/src/figwheel/client/utils.clj
+++ support/src/figwheel/client/utils.clj
@@ -22,4 +22,4 @@
 (defmacro feature?
   [obj feature]
   `(and (cljs.core/exists? ~obj)
-        (cljs.core/exists? (cljs.core/aget ~obj ~feature))))
+        (cljs.core/exists? (goog.object/get ~obj ~feature))))


Emoji and numeric keyboards are shown when tap on /send while emojis are opened (#1056)

--- src/status_im/chat/views/input/input.cljs
+++ src/status_im/chat/views/input/input.cljs
@@ -154,6 +154,7 @@
                               :placeholder       placeholder
                               :blur-on-submit    false
                               :editable          (not @sending-in-progress?)
+                              :on-focus          #(dispatch [:set-chat-ui-props :show-emoji? false])
                               :on-submit-editing (fn []
                                                    (when-not (str/blank? @seq-arg-input-text)
                                                      (dispatch [:send-seq-argument]))


[ISSUE #3396] Fixed incorrect atom access

Signed-off-by: Julien Eluard <c768e13f1ba4c3ebed2909a1fc1e4b50bb021a2f@gmail.com>

--- src/status_im/chat/views/input/input.cljs
+++ src/status_im/chat/views/input/input.cljs
@@ -32,10 +32,11 @@
       :blur-on-submit         false
       :on-focus               #(re-frame/dispatch [:set-chat-ui-props {:input-focused? true}])
       :on-blur                #(re-frame/dispatch [:set-chat-ui-props {:input-focused? false}])
-      :on-submit-editing      (fn [e]
+      :on-submit-editing      (fn [_]
                                 (if single-line-input?
                                   (re-frame/dispatch [:send-current-message])
-                                  (.setNativeProps input-ref (clj->js {:text input-text}))))
+                                  (when @input-ref
+                                    (.setNativeProps @input-ref (clj->js {:text input-text})))))
       :on-layout              (fn [e]
                                 (set-container-width-fn (.-width (.-layout (.-nativeEvent e)))))
       :on-change              (fn [e]


Fix for red screen on login

Fix for red screen on login

Former-commit-id: fcf44737a4ed7759b68ce8f7ac9e4b6390466fc3

--- src/status_im/protocol/web3/delivery.cljs
+++ src/status_im/protocol/web3/delivery.cljs
@@ -207,12 +207,10 @@

 (defn reset-pending-messages! [to]
   (doseq [key (@recipient->pending-message to)]
-    (swap! messages
-           (fn [messages]
-             (when (get-in messages key)
-               (update-in messages key assoc
-                          :last-attempt 0
-                          :attempts 0))))))
+    (when (get-in @messages key)
+      (swap! messages #(update-in % key assoc
+                                  :last-attempt 0
+                                  :attempts 0)))))

 (defn reset-all-pending-messages! []
   (reset! messages {}))


Change output location of unit test

Change output location of unit test

--- src/test/clojure/pigpen/tutorial_test.clj
+++ src/test/clojure/pigpen/tutorial_test.clj
@@ -1,13 +1,14 @@
 (ns pigpen.tutorial-test)

+(.mkdirs (java.io.File. "build/tutorial-test"))
 (ns pigpen-demo.core)

 (require '[pigpen.core :as pig])

 (defn my-data []
-  (pig/load-tsv "input.tsv"))
+  (pig/load-tsv "build/tutorial-test/input.tsv"))

-(spit "input.tsv" "1\t2\tfoo\n4\t5\tbar")
+(spit "build/tutorial-test/input.tsv" "1\t2\tfoo\n4\t5\tbar")

 (pig/dump (my-data))

@@ -55,7 +56,7 @@
     (is (= (pig/dump (my-func data))
            [{:sum 3, :name "foo"}]))))

-(pig/write-script "my-script.pig" (my-query "input.tsv" "output.clj"))
+(pig/write-script "build/tutorial-test/my-script.pig" (my-query "input.tsv" "output.clj"))

 (deftest test-join
   (let [left  (pig/return [{:a 1 :b 2} {:a 1 :b 3} {:a 2 :b 4}])


Fix tests on foreign

Fix tests on foreign

--- test/com/wsscode/pathom/connect/foreign_test.cljc
+++ test/com/wsscode/pathom/connect/foreign_test.cljc
@@ -3,7 +3,8 @@
             [com.wsscode.pathom.connect :as pc]
             [com.wsscode.pathom.connect.foreign :as pcf]
             [com.wsscode.pathom.connect.planner :as pcp]
-            [com.wsscode.pathom.core :as p]))
+            [com.wsscode.pathom.core :as p]
+            [edn-query-language.core :as eql]))

 (deftest remove-internal-keys-test
   (is (= (pcf/remove-internal-keys {:foo                   "bar"
@@ -23,21 +24,21 @@

 (deftest compute-foreign-query-test
   (testing "no inputs"
-    (is (= (pcf/compute-foreign-query {::pcp/node {::pcp/requires {:a {}}}})
+    (is (= (pcf/compute-foreign-query {::pcp/node {::pcp/foreign-ast (eql/query->ast [:a])}})
            {::pcf/base-query [:a]
             ::pcf/query      [:a]})))

   (testing "inputs, but no parent ident, single attribute always goes as ident"
-    (is (= (pcf/compute-foreign-query {::pcp/node {::pcp/requires {:a {}}
-                                                   ::pcp/input    {:z {}}}
+    (is (= (pcf/compute-foreign-query {::pcp/node {::pcp/foreign-ast (eql/query->ast [:a])
+                                                   ::pcp/input       {:z {}}}
                                        ::p/entity {:z "bar"}})
            {::pcf/base-query [:a]
             ::pcf/query      '[{([:z "bar"] {:pathom/context {}}) [:a]}]
             ::pcf/join-node  [:z "bar"]})))

   (testing "inputs, with parent ident"
-    (is (= (pcf/compute-foreign-query {::pcp/node {::pcp/requires {:a {}}
-                                                   ::pcp/input    {:z {}}}
+    (is (= (pcf/compute-foreign-query {::pcp/node {::pcp/foreign-ast (eql/query->ast [:a])
+                                                   ::pcp/input       {:z {}}}
                                        ::p/path   [[:z "bar"] :a]
                                        ::p/entity {:z "bar"}})
            {::pcf/base-query [:a]
@@ -45,8 +46,8 @@
             ::pcf/join-node  [:z "bar"]})))

   (testing "inputs, with parent ident"
-    (is (= (pcf/compute-foreign-query {::pcp/node {::pcp/requires {:a {}}
-                                                   ::pcp/input    {:z {}}}
+    (is (= (pcf/compute-foreign-query {::pcp/node {::pcp/foreign-ast (eql/query->ast [:a])
+                                                   ::pcp/input       {:z {}}}
                                        ::p/path   [[:z "bar"] :a]
                                        ::p/entity {:z "bar"}})
            {::pcf/base-query [:a]
@@ -54,9 +55,9 @@
             ::pcf/join-node  [:z "bar"]}))

     (testing "with multiple inputs"
-      (is (= (pcf/compute-foreign-query {::pcp/node {::pcp/requires {:a {}}
-                                                     ::pcp/input    {:x {}
-                                                                     :z {}}}
+      (is (= (pcf/compute-foreign-query {::pcp/node {::pcp/foreign-ast (eql/query->ast [:a])
+                                                     ::pcp/input       {:x {}
+                                                                        :z {}}}
                                          ::p/path   [[:z "bar"] :a]
                                          ::p/entity {:x "foo"
                                                      :z "bar"}})


GAWB-1622: Editting method config snapshot will also update wdl shown

--- src/cljs/main/broadfcui/common/codemirror.cljs
+++ src/cljs/main/broadfcui/common/codemirror.cljs
@@ -3,6 +3,7 @@
     [dmohs.react :as react]
     [broadfcui.common.style :as style]
     [broadfcui.utils :as utils]
+    [goog.dom :as gdom]
     ))

 (def ^:private CodeMirror-js (aget js/window "webpack-deps" "CodeMirror"))
@@ -45,6 +46,7 @@
                    :else
                    (do (.next stream) nil)))}))

+
 (react/defc CodeMirror
   {:add-listener
    (fn [{:keys [this]} event-type listener]
@@ -63,8 +65,14 @@
    (fn [{:keys [props]}]
      [:div {:style {:border style/standard-line}}
       [:textarea {:ref "ref" :defaultValue (:text props)}]])
-   :component-did-mount
+   :component-did-mount #((:this %) :display-wdl)
+   :display-wdl
    (fn [{:keys [refs props locals]}]
      (swap! locals assoc :code-mirror-component
             (js-invoke CodeMirror-js "fromTextArea" (@refs "ref")
-               #js{:mode "wdl" :lineNumbers (:line-numbers? props) :readOnly (:read-only? props)})))})
+                       #js{:mode "wdl" :lineNumbers (:line-numbers? props) :readOnly (:read-only? props)})))
+   :component-will-receive-props
+   (fn [{:keys [refs props next-props locals]}]
+     (-> (@locals :code-mirror-component)
+         (js-invoke "getDoc")
+         (js-invoke "setValue" (:text next-props))))})


indentation

indentation

--- src/clojure_fabric/generated/configuration.clj
+++ src/clojure_fabric/generated/configuration.clj
@@ -277,12 +277,12 @@

 ;;;  writeTo
 (defn
- write-to
- [^org.hyperledger.fabric.protos.peer.Configuration$AnchorPeer
-  configuration$-anchor-peer
-  ^com.google.protobuf.CodedOutputStream
-  coded-output-stream0]
- (. configuration$-anchor-peer writeTo coded-output-stream0))
+  write-to
+  [^org.hyperledger.fabric.protos.peer.Configuration$AnchorPeer
+   configuration$-anchor-peer
+   ^com.google.protobuf.CodedOutputStream
+   coded-output-stream0]
+  (. configuration$-anchor-peer writeTo coded-output-stream0))

 ;;;  HOST_FIELD_NUMBER
 (defn


finished simple breadcrumb

finished simple breadcrumb

--- src-cljs/mappt/components/header_breadcrumb.cljs
+++ src-cljs/mappt/components/header_breadcrumb.cljs
@@ -8,8 +8,18 @@
   [state name url]
   (swap! state update-in [:breadcrumbs] conj {:name name :url url}))

+(defn splice-breadcrumb!
+  "splices the breadcrumb to the given url"
+  [state url]
+  (let [crumbs (:breadcrumbs @state)
+        sp (split-with #(not= (:url %) url) crumbs)]
+    (when (not (empty? (second sp)))
+      (let [breadcrumbs (conj (first sp) (first (second sp)))]
+        (om/transact! state :breadcrumbs #(vec breadcrumbs))))))
+
 (defn click-handler [state url e]
-  (.log js/console "breadcrumb clicked! - " url))
+  (.log js/console "breadcrumb clicked! - " url)
+  (splice-breadcrumb! state url))

 (defn gen-breadcrumb [state crumb]
   [:a {:href (crumb :url)


This... doesn't.... look terrible?

This... doesn't.... look terrible?

--- src/doctopus/storage/storage_impls/temp_fs.clj
+++ src/doctopus/storage/storage_impls/temp_fs.clj
@@ -1,6 +1,7 @@
 (ns doctopus.storage-impls.temp-fs
-  (:require [me.raynes.fs :as fs]
-            [doctopus.files.storage-impls :refer :all])
+  (:require [doctopus.files :as files]
+            [doctopus.files.storage-impls :refer :all]
+            [me.raynes.fs :as fs])
   (:import [doctopus.files.storage-impls.BackendImplementation]))

 ;; The root of the temp filesystem. Each Thing will store its stuff
@@ -16,7 +17,7 @@
   [rel-path]
   (let [html-re #"\.html$"
         assure-suffix #(if (re-find html-re rel-path) rel-path (str rel-path ".html"))
-        file-handle (fs/file @*temp-dir* rel-path)]
+        file-handle (fs/file @temp-dir rel-path)]
     (slurp file-handle)))

 (defn save-html-file
@@ -33,4 +34,10 @@
   (doseq [[path html] path-html-pairs] (save-html-file key path html)))

 (defn load-fn
-  [key])
+  "This is as Version 1 a way of doing this as I can think of:
+
+  1. We load html
+  2. We wrap that html in a function that returns itself, so we can Bidi"
+  [key]
+  (let [rel-path-html-pairs (files/read-html key)]
+    (into [] (map #([rel-path (fn [_] html)]) rel-path-html-pairs))))


make remove-deps syntax more like deftask

--- src/cake/core.clj
+++ src/cake/core.clj
@@ -19,7 +19,7 @@
 (defmacro undeftask [taskname]
   `(append-task! ~taskname {:replace true}))

-(defmacro remove-deps [taskname & deps]
+(defmacro remove-deps [taskname deps]
   `(append-task! ~taskname {:remove-deps ~deps}))

 (defmacro require-tasks [& namespaces]


Take out figwheel for the moment, it is annoying me.

--- examples/todomvc/devsrc/todomvc/dev.cljs
+++ examples/todomvc/devsrc/todomvc/dev.cljs
@@ -2,9 +2,6 @@
   (:require [todomvc.core :as todomvc]
             [figwheel.client :as fw]))

-#_(fw/start {:on-jsload todomvc/main
-           :websocket-url "ws://localhost:3449/figwheel-ws"})
-
 (defn start []
-  (fw/start {:jsload-callback (fn [] (todomvc/main))})
+  ;(fw/start {:jsload-callback (fn [] (todomvc/main))})
   (todomvc/main))


Fixed it for real this time. - statuses can be #{:passed :pending :failed :error}

--- src/untangled_spec/reporters/terminal.clj
+++ src/untangled_spec/reporters/terminal.clj
@@ -154,7 +154,7 @@

 (defn when-fail-only-keep-failed [coll]
   (remove #(when (env :fail-only?)
-             (not= :failed (:status %))) coll))
+             (#{:passed :pending} (:status %))) coll))

 (defn print-test-item [test-item print-level]
   (t/with-test-out


Add stroke colors into recent colors summary.

--- src/uxbox/ui/workspace/recent_colors.cljs
+++ src/uxbox/ui/workspace/recent_colors.cljs
@@ -26,16 +26,20 @@
   #(rs/emit! (dw/toggle-tool :workspace/colorpalette)))

 (defn- count-color
-  [state shape]
-  (let [color (:fill shape)]
+  [state shape prop]
+  (let [color (prop shape)]
     (if (contains? state color)
       (update state color inc)
       (assoc state color 1))))

 (defn- calculate-colors
   [shapes]
-  (let [result (reduce count-color {} shapes)]
-    (take 5 (map first (sort-by second (into [] result))))))
+  (as-> (comp
+         #(count-color %1 %2 :fill)
+         #(count-color %1 %2 :stroke)) $
+    (reduce $ {} shapes)
+    (sort-by second (into [] $))
+    (take 5 (map first $))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Component


augment docstring

augment docstring

--- src/vip/data_processor/validation/zip.clj
+++ src/vip/data_processor/validation/zip.clj
@@ -21,7 +21,8 @@

 (defn get-uncompressed-size
   "Given a net.lingala.zip4j.core.ZipFile returns the uncompressed
-  size as provided by the first header in the file."
+  size as provided by the first (and presumably only) header in the
+  file."
   [zip-file]
   (.getUncompressedSize (first (.getFileHeaders zip-file))))


fix eg11

fix eg11

--- src/demo/eg11.clj
+++ src/demo/eg11.clj
@@ -7,4 +7,6 @@
 (defmethod path String [x] x)
 (defmethod path File [^File x] (.getPath x))

-(path "dir/a") ;=> "a"
+(path (File. "dir/a")) ;=> "dir/a"
+
+(assert (= "dir/a" (path (File. "dir/a"))))


Fix cursor, add bomb speeds

Fix cursor, add bomb speeds

--- src/clojure/playasophy/wonderdome/mode/bombs.clj
+++ src/clojure/playasophy/wonderdome/mode/bombs.clj
@@ -24,8 +24,9 @@
   [barrel-radius pixel bomb]
   (do
     #_(log/warn pixel bomb)
-    (let [delta (distance barrel-radius (:center bomb) (:barrel pixel))
-          radius (* (:age bomb) 0.00003)]
+    (let [speed (:speed bomb)
+          delta (distance barrel-radius (:center bomb) (:barrel pixel))
+          radius (* (:age bomb) speed)]
       (if (<= delta radius)
         (color/rainbow (/ delta radius))
         color/none))))
@@ -41,10 +42,10 @@
       [:time/tick nil]
       (let [elapsed (or (:elapsed event) 0.0)]
         (assoc this :bombs
-          (map (fn [bomb]
+          (mapv (fn [bomb]
                  (let [age' (+ (:age bomb) elapsed)]
                    (assoc bomb :age age')))
-               (filter #(< (:age %) 10000) bombs))))
+                (filter #(< (:age %) 10000) bombs))))

       [:axis/direction :y-axis]
       (assoc-in this [:cursor-position :z]
@@ -64,7 +65,19 @@

       [:button/press :A]
       (assoc-in this [:bombs]
-        (conj bombs {:center cursor-position :age 0}))
+        (conj bombs {:center cursor-position :age 0 :speed 0.00001}))
+
+      [:button/press :B]
+      (assoc-in this [:bombs]
+        (conj bombs {:center cursor-position :age 0 :speed 0.00003}))
+
+      [:button/press :X]
+      (assoc-in this [:bombs]
+        (conj bombs {:center cursor-position :age 0 :speed 0.00006}))
+
+      [:button/press :Y]
+      (assoc-in this [:bombs]
+        (conj bombs {:center cursor-position :age 0 :speed 0.00012}))

       this))

@@ -73,7 +86,7 @@
     [this pixel]
     (do
       #_(log/warn pixel bombs)
-      (let [bomb-colors (map (partial bomb-color barrel-radius pixel) bombs)
+      (let [bomb-colors (mapv (partial bomb-color barrel-radius pixel) bombs)
             cursor-delta (distance barrel-radius (:barrel pixel) cursor-position)
             cursor-color (if (< cursor-delta 0.04) (color/gray 1.0) color/none)]
         (overlay (conj bomb-colors cursor-color))))))


ssh key and enablement

ssh key and enablement

--- src/freenas/provider.clj
+++ src/freenas/provider.clj
@@ -12,6 +12,7 @@
 (ns freenas.provider
   "Freenas jails provider"
   (:require
+    [supernal.core :refer (ns- lifecycle run execute env)]
     [taoensso.timbre :as timbre]
     [clojure.core.strint :refer (<<)]
     [celestial.provider :refer (wait-for-ssh mappings wait-for)]
@@ -19,10 +20,10 @@
     [freenas.validations :refer [validate-provider jail-mappings]]
     [slingshot.slingshot :refer  [throw+]]
     [celestial.persistency.systems :as s]
-    [celestial.common :refer (import-logging)]
     [org.httpkit.client :as client]
     [celestial.core :refer (Vm)]
-    [celestial.model :refer (hypervisor translate vconstruct)])
+    [celestial.common :refer (get*)]
+    [celestial.model :refer (hypervisor* hypervisor translate vconstruct)])
  )

 (timbre/refer-timbre)
@@ -42,10 +43,30 @@
   (let [js (call client/get "jails/jails/") ]
     (first (filter #(= (:jail_host %) host) js))))

+(def jexec "/usr/sbin/jexec" )
+
+(def sed "/usr/bin/sed")
+
+(ns- jail
+  (task enable-root-ssh
+     (let [{:keys [host]} args]
+       (run (<< "~{jexec} ~{host} ~{sed} -i.bak 's/^sshd_enable=.*/sshd_enable=\"YES\"/' /etc/rc.conf"))
+       (run (<< "~{jexec} ~{host} ~{sed} -i.bak 's/^#PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config"))
+       (run (<< "~{jexec} ~{host} /etc/rc.d/sshd start"))))
+
+  (task add-ssh-key
+    (let [{:keys [host]} args pub (clojure.string/trim-newline (slurp (get* :ssh :public-key-path)))]
+      (run (<< "~{jexec} ~{host} mkdir /root/.ssh"))
+      (run (<< "~{jexec} ~{host} sh -c  'pub=\"~{pub}\"; echo \"$pub\" | cat > /root/.ssh/authorized_keys'"))
+      (run (<< "~{jexec} ~{host} chmod 700 /root/.ssh && chmod 600 /root/.ssh/authorized_keys")))))
+
+(lifecycle prepare-jail {:doc "preparing jail with ssh and celestial key"}
+   {jail/add-ssh-key #{}
+    jail/enable-root-ssh #{jail/add-ssh-key}})
+
 (defn enable-ssh [host]
-  ;; jexec 19 sed -i.bak 's/^sshd_enable=.*/sshd_enable="YES"/' /etc/rc.conf
-  ;; jexec  19 /etc/rc.d/sshd start
-  )
+  (let [roles {:roles {:jails #{(hypervisor* :freenas)}}}]
+     (execute prepare-jail {:host host} :jails :env roles)))

 (defrecord Jail [spec]
   Vm


fix google closure removal of dom/htmlToDocumentFragment

--- support/src/figwheel/client/heads_up.cljs
+++ support/src/figwheel/client/heads_up.cljs
@@ -281,9 +281,9 @@
           child-count (.-length (dom/getChildren content-area-el))]
       (if (< child-count 6)
         (do
-          (dom/append el (dom/htmlToDocumentFragment
-                          (format-line (format-warning-message warning-data)
-                                       warning-data)))
+          (set! (.-innerHTML el)
+                (format-line (format-warning-message warning-data)
+                             warning-data))
           (dom/append content-area-el el))
         (when-let [last-child (dom/getLastElementChild content-area-el)]
           (if-let [message-count (data/get last-child "figwheel_count")]


CMR-2201: Debug code to try to identify source of errors in CI tests.

--- message-queue-lib/src/cmr/message_queue/test/queue_broker_wrapper.clj
+++ message-queue-lib/src/cmr/message_queue/test/queue_broker_wrapper.clj
@@ -98,6 +98,7 @@
    (let [start-time (System/currentTimeMillis)]
      (loop [current-states (set (current-message-states broker-wrapper))]
        (when (seq (set/difference current-states terminal-states))
+         (warn "CURRENT-STATES: " current-states)
          (Thread/sleep 10)
          (if (< (- (System/currentTimeMillis) start-time) ms-to-wait)
            (recur (set (current-message-states broker-wrapper)))


Updated test names in the module irc-bot-test

--- test/emender_jenkins/irc_bot_test.clj
+++ test/emender_jenkins/irc_bot_test.clj
@@ -27,37 +27,43 @@
 ; Tests for function existence
 ;

-(deftest test-message-to-channel?
+(deftest test-message-to-channel?-existence
     "Check that the emender-jenkins.irc-bot/message-to-channel? definition exists."
     (testing "if the emender-jenkins.irc-bot/message-to-channel? definition exists."
         (is (callable? 'emender-jenkins.irc-bot/message-to-channel?))))

-(deftest test-message-for-me?
+
+(deftest test-message-for-me?-existence
     "Check that the emender-jenkins.irc-bot/message-for-me? definition exists."
     (testing "if the emender-jenkins.irc-bot/message-for-me? definition exists."
         (is (callable? 'emender-jenkins.irc-bot/message-for-me?))))

-(deftest test-create-reply
+
+(deftest test-create-reply-existence
     "Check that the emender-jenkins.irc-bot/create-reply definition exists."
     (testing "if the emender-jenkins.irc-bot/create-reply definition exists."
         (is (callable? 'emender-jenkins.irc-bot/create-reply))))

-(deftest test-prepare-reply-text
+
+(deftest test-prepare-reply-text-existence
     "Check that the emender-jenkins.irc-bot/prepare-reply-text definition exists."
     (testing "if the emender-jenkins.irc-bot/prepare-reply-text definition exists."
         (is (callable? 'emender-jenkins.irc-bot/prepare-reply-text))))

-(deftest test-on-incoming-message
+
+(deftest test-on-incoming-message-existence
     "Check that the emender-jenkins.irc-bot/on-incoming-message definition exists."
     (testing "if the emender-jenkins.irc-bot/on-incoming-message definition exists."
         (is (callable? 'emender-jenkins.irc-bot/on-incoming-message))))

-(deftest test-send-message
+
+(deftest test-send-message-existence
     "Check that the emender-jenkins.irc-bot/send-message definition exists."
     (testing "if the emender-jenkins.irc-bot/send-message definition exists."
         (is (callable? 'emender-jenkins.irc-bot/send-message))))

-(deftest test-start-irc-bot
+
+(deftest test-start-irc-bot-existence
     "Check that the emender-jenkins.irc-bot/start-irc-bot definition exists."
     (testing "if the emender-jenkins.irc-bot/start-irc-bot definition exists."
         (is (callable? 'emender-jenkins.irc-bot/start-irc-bot))))


RS | #107 | Form validations for profiles - WIP

--- test/objective8/unit/front_end_requests_test.clj
+++ test/objective8/unit/front_end_requests_test.clj
@@ -202,6 +202,11 @@
                                                         USER_ID)]
                note-data => nil)))

+(facts "about transforming requests to profile info"
+       (future-fact "transforms request to profile info"
+             (let [profile-data (request->profile-info {:params {:name "Name" :biog "Biog"}} USER_ID)]
+               (:data profile-data) => {:name "Name" :biog "Biog" :user-uri (str "/users/" USER_ID)})))
+
 (facts "about up voting"
        (fact "transforms request to up vote info"
              (request->up-vote-info {:params {:vote-on-uri "/some/uri"}} USER_ID)
@@ -233,7 +238,4 @@
              (request->mark-info {:params {:question-uri "/some/uri"}} USER_ID) => {:question-uri "/some/uri"
                                                                                :created-by-uri (str "/users/" USER_ID)}))

-(facts "about creating profiles"
-       (fact "transforms request to profile info"
-             (request->profile-info {:params {:name "Name" :biog "Biog"}} USER_ID)
-             => {:name "Name" :biog "Biog" :user-uri (str "/users/" USER_ID)}))
+


Switch back to grayscale effect for filtered cards

--- frontend/styles/faceboard/css/people.clj
+++ frontend/styles/faceboard/css/people.clj
@@ -17,14 +17,14 @@
           :position :fixed
           :top (px 0)
           ;:bottom (px 0) this does not work for small boards
-          :height "100000%" ; HACK IT
+          :height "100000%"                                 ; HACK IT
           :left (px 0)
           :right (px 0)
           :z-index 11])
        (>> &.editing
          (>> person
            (>> right-part
-             [:overflow :visible])))) ; for gizmos
+             [:overflow :visible]))))                       ; for gizmos
      (>> people-scaffold
        [:visibility :hidden])
      (>> separator
@@ -38,7 +38,7 @@
            [:transition (str "transform 0.3s " ease-out-back)])
          (>> &.filtered
            [:opacity 0.5
-            :-webkit-filter "sepia(1)"
+            :-webkit-filter "grayscale(1)"
             :z-index 0]
            (>> polaroid-frame
              [:opacity 1]))
@@ -248,7 +248,7 @@
        (>> person-edit-button
          [:position :absolute
           :top (px -6)
-          :right (px 0)
+          :left (px 292)                                    ; position it from left to play well with shrinking/expanding animation
           :padding (px 0 4)
           :z-index 10
           :color "#999"]


Tests: test-enable-job-existence, test-disable-job-existence, and test-delete-job-existence

--- test/clj_jenkins_api/jenkins_api_test.clj
+++ test/clj_jenkins_api/jenkins_api_test.clj
@@ -111,6 +111,27 @@

+(deftest test-enable-job-existence
+    "Check that the clj-jenkins-api.jenkins-api/enable-job definition exists."
+    (testing "if the clj-jenkins-api.jenkins-api/enable-job definition exists."
+        (is (callable? 'clj-jenkins-api.jenkins-api/enable-job))))
+
+
+
+(deftest test-disable-job-existence
+    "Check that the clj-jenkins-api.jenkins-api/disable-job definition exists."
+    (testing "if the clj-jenkins-api.jenkins-api/disable-job definition exists."
+        (is (callable? 'clj-jenkins-api.jenkins-api/job-related-command))))
+
+
+
+(deftest test-delete-job-existence
+    "Check that the clj-jenkins-api.jenkins-api/delete-job definition exists."
+    (testing "if the clj-jenkins-api.jenkins-api/delete-job definition exists."
+        (is (callable? 'clj-jenkins-api.jenkins-api/delete-job))))
+
+
+
 ;
 ; Function behaviours
 ;


suspended AS tests (needs complex map comparison)

--- test/freecoin/journey/activitystreams.clj
+++ test/freecoin/journey/activitystreams.clj
@@ -62,23 +62,30 @@

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(defn test-activity [from-name amount to-name]
+(defn render-activity [transaction]
+  {"type"     "Transaction"
+   "published" (str (time/format (time/datetime)) "Z")
+   "actor"     {"type"       "Person"
+                "displayName" (:from transaction)}
+   "target"    {"type"       "Person"
+                "displayName" (:to transaction)}
+   "object"    {"type"       "STUB"
+               "displayName" (str (:amount transaction))
+               "url" (str (env/env :base-url) "/transactions/UID")}
+   })
+
+(defn test-activity [transactions]
   {"@context"  "https://www.w3.org/ns/activitystreams"
-   "@type"     "Transaction"
-   "published" (str (time/format (time/datetime)) "Z")
-   "actor"     {"@type"       "Person"
-                "displayName" from-name}
-   "target"    {"@type"       "Person"
-                "displayName" to-name}
-   "object"    {"@type"       "STUB"
-                "displayName" (str amount)
-                "url" (str (env/env :base-url) "/transactions/UID")
-                }})
+   "type"      "Container"
+   "name"      "Activity stream"
+   "totalItems" (count transactions)
+   "items"     (map #(render-activity %) transactions)})

 (defn no-variables [activity]
   (-> activity
-      (dissoc "published")
-      (update-in ["object"] dissoc "url"))
+      (dissoc "items")
+      )
+      ;; (update-in ["object"] dissoc "url"))
   )

 (defn assert-timeless-activitystream [state contents]
@@ -102,7 +109,7 @@
   )

-(facts "Activitystreams can be consumed and are filled once transactions are done"
+#(facts "Activitystreams can be consumed and are filled once transactions are done"
        (let [memory (atom {})]
          (ih/reset-db)
          (-> (k/session test-app)
@@ -138,7 +145,7 @@

              )))

-(facts "Activitystreams JSON is empty on initial load"
+#(facts "Activitystreams JSON is empty on initial load"
        (let [memory (atom {})]
          (ih/reset-db)
          (-> (k/session test-app)
@@ -150,7 +157,7 @@
              )))

-(facts "Activitystreams JSON contains transaction log as soon as transactions are done on blockchain"
+#(facts "Activitystreams JSON contains transaction log as soon as transactions are done on blockchain"
        (let [memory (atom {})]
          (ih/reset-db)
          (-> (k/session test-app)
@@ -172,12 +179,12 @@
              (check-page-is-activity-stream :get-activity-streams)

              (assert-timeless-activitystream
-              [(test-activity "sender" 101 "recipient")
-               (test-activity "sender" 99 "recipient")])
-             )))
-
-
-(facts "Activitystreams JSON can be filtered on time with from/to parameters"
+              [(test-activity [{:from "sender" :amount 101 :to "recipient"}
+                               {:from "sender" :amount 99  :to "recipient"}])])
+             )))
+
+
+#(facts "Activitystreams JSON can be filtered on time with from/to parameters"
        (let [memory (atom {})]
          (ih/reset-db)
          (-> (k/session test-app)


RS & AB | #33 | Add an extra diff unit test based on live data

--- test/objective8/unit/draft_diffs_test.clj
+++ test/objective8/unit/draft_diffs_test.clj
@@ -1,10 +1,15 @@
 (ns objective8.unit.draft-diffs-test
   (:require [midje.sweet :refer :all]
+            [objective8.utils :as utils]
             [objective8.draft-diffs :as diffs]))

-(def HICCUP_1 '(["p" nil ""] ["p" nil "First paragraph."] ["ul" ["li" "List item 1."] ["li" "List item 2."] ["li" "List item 3."]] ["p" {} "Last paragraph."]))
-(def HICCUP_2 '(["p" {} "First paragraph."] ["p" {} "Second paragraph."] ["p" {} "Third paragraph."]))
-(def HICCUP_3 '(["p" {} "First paragraph."] ["p" {} "New paragraph."] ["p" {} "Third paragraph."]))
+(def HICCUP_1 [["p" nil ""] ["p" nil "First paragraph."] ["ul" ["li" "List item 1."] ["li" "List item 2."] ["li" "List item 3."]] ["p" {} "Last paragraph."]])
+(def HICCUP_2 [["p" {} "First paragraph."] ["p" {} "Second paragraph."] ["p" {} "Third paragraph."]])
+(def HICCUP_3 [["p" {} "First paragraph."] ["p" {} "New paragraph."] ["p" {} "Third paragraph."]])
+
+(def HICCUP_18 [["h1" "My title"]  ["p" "List elements:"]  ["ul"  ["li" "Element One"]  ["li" "Element Two"]] ])
+
+(def HICCUP_19 [["h1" "My new title"]  ["p" "List elements:"]  ["ul"  ["li" "Element One"]  ["li" "New Element Two"]  ["li" "Extra Element Three"]]])

 (def ELEMENT [:del {} "First sentence. Second sentence."])

@@ -18,6 +23,9 @@
 (def FORMATTED_PREVIOUS_DIFF_1_vs_2 '(["p" nil ""] ["p" nil [:span nil "First paragraph."]] ["ul" ["li" [:del nil "List item 1."]] ["li" [:del nil "List item 2."]] ["li" [:del nil "List item 3."]]] ["p" {} [:del nil "Last"] [:span nil " paragraph."]]))
 (def FORMATTED_CURRENT_DIFF_1_vs_2 '(["p" {} [:span nil "First paragraph."]]  ["p" {} [:ins nil "Second paragraph."]] ["p" {} [:ins nil "Third"] [:span nil " paragraph."]]))

+(def FORMATTED_PREVIOUS_DIFF_18_vs_19 '(["h1"  [:span nil "My "]  [:span nil "title"]]  ["p"  [:span nil "List elements:"]]  ["ul"  ["li"  [:span nil "Element One"]]  ["li"  [:span nil "Element Two"]]]))
+(def FORMATTED_CURRENT_DIFF_18_vs_19 '(["h1"  [:span nil "My "]  [:ins nil "new "]  [:span nil "title"]]  ["p"  [:span nil "List elements:"]]  ["ul"  ["li"  [:span nil "Element One"]]  ["li"  [:ins nil "New "]  [:span nil "Element Two"]]  ["li"  [:ins nil "Extra Element Three"]]]) )
+
 (fact "Tags are removed from a simple hiccup"
       (diffs/remove-tags HICCUP_2) => "First paragraph.Second paragraph.Third paragraph.")

@@ -28,6 +36,9 @@
       (diffs/remove-hiccup-elements DIFF_1 :ins) => '([:span nil "Equal text. "])
       (diffs/remove-hiccup-elements DIFF_2 :del) => '([:span nil "First paragraph."] [:span nil "Third paragraph."]))

+(fact "Difference between drafts 18 and 19 is returned"
+ (diffs/get-diffs-between-drafts {:content HICCUP_19} {:content HICCUP_18})  => {:previous-draft-diffs FORMATTED_PREVIOUS_DIFF_18_vs_19
+                                                                                :current-draft-diffs FORMATTED_CURRENT_DIFF_18_vs_19})

 (fact "Difference between drafts 2 and 3 is returned"
       (diffs/get-diffs-between-drafts {:content HICCUP_3} {:content HICCUP_2}) => {:previous-draft-diffs FORMATTED_PREVIOUS_DIFF_2_vs_3


adds rollback

adds rollback

--- src/pc/assets.clj
+++ src/pc/assets.clj
@@ -140,11 +140,14 @@
                                      (do (println source)
                                          {:name source :content (clojure.java.io/file (fs/join (fs/dirname source-map) source))})))})))

+(defn make-manifest-key [sha1]
+  (str "releases/" sha1))
+
 (defn upload-manifest [sha1]
   ;; TODO: this is dumb, we shouldn't write to the file
   (update-sourcemap-url assets-directory "/cljs/production/frontend.js")
   (amazonica.core/with-credential [aws-access-key aws-secret-key]
-    (let [manifest-key (str "releases/" sha1)
+    (let [manifest-key (make-manifest-key sha1)
           assets (reduce (fn [acc path]
                            (let [file-path (str assets-directory path)
                                  md5 (md5 file-path)
@@ -181,3 +184,8 @@
   (send-off reload-agent (fn [a]
                            (let [manifest (load-manifest!)]
                              (log/infof "reloaded frontend assets to %s" manifest)))))
+
+(defn rollback-manifest [sha1]
+  (let [manifest-key (make-manifest-key sha1)]
+    (validate-manifest! (fetch-specific-manifest cdn-bucket manifest-key))
+    (move-manifest-pointer cdn-bucket manifest-key)))


AHA so it was because of defalias !!

AHA so it was because of defalias !!

--- src/runtime/q.clj
+++ src/runtime/q.clj
@@ -10,7 +10,7 @@

 (ns runtime.q
   ;(:use runtime.testengine :reload-all)
-  (:refer clojure.test );:exclude [deftest is])
+  (:refer clojure.test :exclude [deftest is])
   (:require flatland.useful.ns)
   ;(:use clojure.tools.trace)
   ;(:use runtime.clazzez :reload-all)
@@ -54,9 +54,15 @@
   )

 ;(def deftest clojure.test/deftest)
-;(ns-unalias *ns* is)
-(defalias is clojure.test/is)
+;(ns-unmap *ns* 'is)
+;(defalias is clojure.test/is)
+(defmacro is [& all]
+  `(clojure.test/is ~@all)
+  )
 ;(defalias deftest clojure.test/deftest)
+(defmacro deftest [& all]
+  `(clojure.test/deftest ~@all)
+  )
 #_(redefmacro deftest [& all]
   `(binding [*assert* true *runTimeAssumptions* true] ;TODO: try all combinations of these set, to true/false/nil
      ;FIXME: this binding has no effect at runtime, so what do we do with this? do we move it to runtime so it has effect?


Added a "prefer-higher-ranks" checkbox

Added a "prefer-higher-ranks" checkbox

It reverses the sort of the ranks.

--- src/matchmaker/core.cljs
+++ src/matchmaker/core.cljs
@@ -5,6 +5,7 @@
 (defonce players-tsv (atom ""))
 (defonce attendance-tsv (atom ""))
 (defonce shuffle-count (atom 0))
+(defonce prefer-higher-ranks (atom false))

 (def rank-scores
   {"NONE" 0
@@ -52,15 +53,17 @@
   (filter (fn [p] (attendance (:name p))) players))

 (defn teams-by-skill [players]
-  (loop [ps (sort-by #(rank-scores (:rank %)) players)
+  (loop [ps (cond->> players
+                     true (sort-by #(rank-scores (:rank %)))
+                     @prefer-higher-ranks (reverse))
          teams []]
-    (if (< (count ps) 10)
-      {:teams teams
-       :remainder ps}
-      (let [game (shuffle (take 10 ps))
-            a (take 5 game)
-            b (drop 5 game)]
-        (recur (drop 10 ps) (conj teams [a b]))))))
+        (if (< (count ps) 10)
+          {:teams teams
+           :remainder ps}
+          (let [game (shuffle (take 10 ps))
+                a (take 5 game)
+                b (drop 5 game)]
+            (recur (drop 10 ps) (conj teams [a b]))))))

 (defn make-teams []
   (let [players (parse-players @players-tsv)
@@ -103,7 +106,13 @@
   @shuffle-count
   (let [result (make-teams)]
     [:section.results
-     [:button {:on-click #(swap! shuffle-count inc)} "Shuffle!"]
+     [:button.shuffle {:on-click #(swap! shuffle-count inc)} "Shuffle"]
+     [:section.prefer-higher-ranks
+      [:input#prefer-higher-ranks-checkbox
+       {:type "checkbox"
+        :checked @prefer-higher-ranks
+        :on-change #(swap! prefer-higher-ranks not)}]
+      [:label {:for "prefer-higher-ranks-checkbox"} "Try to build higher rank teams instead?"]]
      [:section.teams
       [:h3 "Teams"]
       (team-list (:teams result))]


Get rid of the check-type. Let's have it be inferred.

--- src/midje/semi_sweet.clj
+++ src/midje/semi_sweet.clj
@@ -95,9 +95,7 @@
 	  (unique-function-symbols expectations))
 )

-
-
-(defn check-call-counts [expectations]
+(defn- check-call-counts [expectations]
   (doseq [expectation expectations]
       (if (zero? @(expectation :count-atom))
 	  (report {:type :fail
@@ -110,10 +108,10 @@

 (defmacro short-circuiting-failure
-  ([form check-type expected]
-   `(short-circuiting-failure ~form ~check-type ~expected nil))
+  ([form expected]
+   `(short-circuiting-failure ~form ~expected nil))

-  ([form check-type expected failure-message]
+  ([form expected failure-message]
   `(with-handler (let [code-under-test-result# (eagerly ~form)]
 		   (is (= code-under-test-result# ~expected) ~failure-message))
 		 (handle *failure-during-computation* [])))


Make sure the correct keys are used to generate the id-token.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -578,14 +578,14 @@
         notification-author-url (fix-avatar-url (:avatar-url notification-author))
         secure-uuid (:secure-uuid notification)
         origin-url config/web-url
-        token-claims {:org-id (:org-id notification)
+        token-claims {:org-uuid (:org-id notification)
                       :secure-uuid secure-uuid
                       :name (str first-name " " (:last-name msg))
                       :first-name first-name
                       :last-name (:last-name msg)
                       :user-id (:user-id msg)
                       :avatar-url (:avatar-url msg)
-                      :teams [(:team-id org)]} ;; Let's read the team-id from the org to avoid problems on multiple org users
+                      :team-id (:team-id org)} ;; Let's read the team-id from the org to avoid problems on multiple org users
         id-token (jwt/generate-id-token token-claims config/passphrase)
         entry-url (s/join "/" [origin-url
                                org-slug


truncates to 1000

truncates to 1000

--- src/ontrail/exercise.clj
+++ src/ontrail/exercise.clj
@@ -18,7 +18,7 @@
       (str (int (+ 0.5 (* 100.0 (/ (- avghr resthr) (- maxhr resthr))))) "%")
       "")))

-(def TRUNCATE 100)
+(def TRUNCATE 1000)

 (defn strip-and-truncate [s]
   (if (= s nil)
@@ -27,7 +27,7 @@
           chars (count stripped)
           truncated-len (if (> chars TRUNCATE) TRUNCATE chars)]
       (if (> chars TRUNCATE)
-        (str (subs stripped 0 truncated-len) "...")
+        (str (subs stripped 0 truncated-len))
         stripped))))

 (defn as-ex-result [result]


abstracting dollar construction

abstracting dollar construction

--- src/ophion/aggregate.clj
+++ src/ophion/aggregate.clj
@@ -10,6 +10,10 @@
    [protograph.kafka :as kafka]
    [ophion.config :as config]
    [ophion.mongo :as mongo]))
+
+(defn dollar
+  [s]
+  (str "$" (name s)))

 (defn where
   [where]
@@ -90,7 +94,7 @@
   [{:$project
     (reduce
      (fn [project value]
-       (assoc project value (str "$" (name value))))
+       (assoc project value (dollar value)))
      {} values)}])

 (defn mark
@@ -106,7 +110,7 @@
   [{:$project
     (reduce
      (fn [project label]
-       (assoc project label (str "$_history." label)))
+       (assoc project label (str "$_history." (name label))))
      {} labels)}])

 (defn limit
@@ -128,10 +132,11 @@

 (defn dedup-on
   [field]
-  (let [dollar (str "$" (name field))]
+  (let [path (dollar field)]
+    [{:$group {:_id path :dedup {:$first "$$ROOT"}}}
+     {:$replaceRoot {:newRoot "$dedup"}}]))
+
     ;; {:$group {:_id dollar (keyword field) {:$first dollar} :_history {:$addToSet "$_history"}}}
-    [{:$group {:_id dollar :dedup {:$first "$$ROOT"}}}
-     {:$replaceRoot {:newRoot "$dedup"}}]))

 (defn offset
   [n]
@@ -143,11 +148,11 @@

 (defn root
   [in]
-  [{:$replaceRoot {:newRoot (str "$" in)}}])
+  [{:$replaceRoot {:newRoot (dollar in)}}])

 (defn group-count
   [path]
-  [{:$group {:_id (str "$" path) :count {:$sum 1}}}
+  [{:$group {:_id (dollar path) :count {:$sum 1}}}
    {:$project {:key "$_id" :count "$count"}}])

 (defn unwind
@@ -156,11 +161,11 @@

 (defn group-set
   [label]
-  [{:$group {:_id "$_id" label {:$push (str "$" label ".gid")}}}])
+  [{:$group {:_id "$_id" label {:$push (str "$" (name label) ".gid")}}}])

 (defn element-at
   [label]
-  {:$arrayElemAt [(str "$" label) 0]})
+  {:$arrayElemAt [(dollar label) 0]})

 (declare translate)

@@ -191,8 +196,10 @@
        :matches
        {:$setIntersection
         (map
-         (fn [label]
-           (str "$" label "." label))
+         (comp
+          (fn [label]
+            (str "$" label "." label))
+          name)
          labels)}}}
      {:$unwind "$_root"}
      {:$redact


Add useful fn pp-node-tree to pretty-print the node-tree to *out*

--- src/overtone/sc/node.clj
+++ src/overtone/sc/node.clj
@@ -6,7 +6,8 @@
         [overtone.sc.machinery allocator]
         [overtone.sc.machinery.server comms]
         [overtone.sc.util :only [id-mapper]]
-        [overtone.sc.defaults :only [foundation-groups* INTERNAL-POOL]])
+        [overtone.sc.defaults :only [foundation-groups* INTERNAL-POOL]]
+        [clojure.pprint])
   (:require [clojure.zip :as zip]
             [overtone.config.log :as log]
             [overtone.at-at :as at-at]))
@@ -227,7 +228,6 @@
      (when (and (node? node)
                 (not (node-active? node)))
        (inactive-node-modification-error node err-msg))))
-

 (defn node-free*
   "Free the specified nodes on the server. The allocated id is
@@ -760,3 +760,7 @@
             (filter #(and (:name %)
                           (matcher-fn re-or-str (:name %)))
                     (node-tree-seq root))))))
+(defn pp-node-tree
+  "Pretty print the node tree to *out*"
+  ([] (pp-node-tree (:root-group @foundation-groups*)))
+  ([root] (pprint (node-tree root))))


Prefix 'Failure' to 'Reason' caption

Prefix 'Failure' to 'Reason' caption

--- src/pinpointer/core.cljc
+++ src/pinpointer/core.cljc
@@ -123,6 +123,7 @@
      (print-data "Input" chunk)
      (print-spec "Expected" (:pred problem))
      (when-let [reason (:reason problem)]
+       (println (pad-left "Failure " 10))
        (print-with-caption "Reason" reason))
      (when (seq more)
        (doseq [chunk more]


oops, bugfix

oops, bugfix

--- src/tictag/db.clj
+++ src/tictag/db.clj
@@ -53,7 +53,7 @@
   (swap! pends add-pend! id long-time))

 (defn pending-timestamp [{:keys [pends]} id]
-  (first (filter #(= (first %) id) @pends)))
+  (second (first (filter #(= (first %) id) @pends))))

 (defn local-day [local-time] (str/replace (subs local-time 0 10) #"-" ""))


least probable lines

least probable lines


Better comment

Better comment

--- src/re_frame/router.cljs
+++ src/re_frame/router.cljs
@@ -219,14 +219,18 @@
   Usage example:
      (dispatch [:delete-item 42])"
   [event-v]
-  (let [stack  (->> (js/Error.
-                      (str "Error thrown in event handler " (first event-v)))
+  (let [;; At the point of dispatch, we capture the current stack.
+        ;; Attach this stack to the event as meta data so that later, if
+        ;; anything goes wrong, we know where it came from.
+        ;; To get a source mapped stack, we must get rid of the react frames
+        ;; See https://github.com/Day8/re-frame/issues/164#issuecomment-233528154
+        stack  (->> (js/Error. (str "Event " (first event-v) " dispatched from here:"))
                     .-stack
                     clojure.string/split-lines
-                    (remove #(re-find #"react.inc.js|\(native\)" %))  ;; get rid of the react frames
-                    (clojure.string/join "\n"))]  ;; grab a stack here so that give it to events
+                    (remove #(re-find #"react.inc.js|\(native\)" %))
+                    (clojure.string/join "\n"))]
     (if (nil? event-v)
-      (throw (js/Error. "re-frame: you called \"dispatch\" without an event vector."))
+      (throw (ex-info "re-frame: you called \"dispatch\" without an event vector." {}))
       (push event-queue (with-meta event-v {:stack stack}))))
   nil)                                           ;; Ensure nil return. See https://github.com/Day8/re-frame/wiki/Beware-Returning-False


fixing nasty stuck overflow bug in cases where a slingshot base execption is passed back between the agent and executing thread, it seems that the enviroment field references locals that cause this to expload

--- src/vc/vijava.clj
+++ src/vc/vijava.clj
@@ -14,6 +14,7 @@
     [celestial.model :refer [hypervisor]]
     [slingshot.slingshot :refer  [throw+ try+]]
     [clojure.core.strint :refer  (<<)]
+    [flatland.useful.map :refer  (dissoc-in*)]
     [celestial.common :refer (import-logging)])
   (:import
     java.net.URL
@@ -30,6 +31,7 @@
     com.vmware.vim25.mo.Task
     com.vmware.vim25.mo.VirtualMachine
     java.lang.Throwable
+    clojure.lang.ExceptionInfo
     ))

 (import-logging)
@@ -59,8 +61,13 @@
   `(fn [s#]
      (binding [service (renew-session s#)]
        (try
-         (deliver ~p ~body) service)
-       (catch Throwable e# (deliver ~p e#) service))))
+         (deliver ~p ~body)
+         (catch ExceptionInfo e#
+           (deliver ~p (.getData e#)))
+         (catch Throwable e#
+           (deliver ~p e#)))
+       service
+       )))

 (def robin (atom 0N))

@@ -72,10 +79,11 @@
      (trace "using session " (hash a#) " robin is " @robin)
      (send a# (execute ~body p#))
      (let [res# @p#]
-       (when (instance? Throwable res#)
-         (throw res#))
-       res#)
-     ))
+       (cond
+         (and (map? res#) (res# :object)) (throw (ExceptionInfo. "" (dissoc-in* res# [:object :environment])))
+         (instance? Throwable res#) (throw res#)
+         :else res#
+         ))))

 (defn navigator
   ([] (navigator (.getRootFolder service)))