Add secure-site defaults.

Add secure-site defaults.

--- src/clj/clj_templates/handler.clj
+++ src/clj/clj_templates/handler.clj
@@ -3,7 +3,7 @@
             [compojure.route :refer [resources]]
             [ring.util.response :refer [resource-response response]]
             [ring.logger.timbre :refer [wrap-with-logger]]
-            [ring.middleware.defaults :refer [site-defaults wrap-defaults]]
+            [ring.middleware.defaults :refer [site-defaults secure-site-defaults wrap-defaults]]
             [ring.util.http-response :refer [content-type ok bad-request!]]
             [ring.middleware.http-response :refer [wrap-http-response]]
             [clj-templates.util.transit :as t]
@@ -13,6 +13,7 @@
             [clj-templates.search :as search]
             [clojure.string :as str]
             [medley.core :refer [map-keys]]
+            [environ.core :refer [env]]
             [clj-templates.specs.api :as api-spec]))

 (defn params-problems-string [problems]
@@ -50,9 +51,11 @@
     (GET "/" [] (home-page))
     (resources "/")))

+(def secure-site-proxy-defaults (assoc secure-site-defaults :proxy true))
+
 (defmethod ig/init-key :handler/main [_ {:keys [es-client]}]
   (-> (app-routes es-client)
-      (wrap-defaults site-defaults)
+      (wrap-defaults (if (= "prod" (env :deployment-env)) secure-site-proxy-defaults site-defaults))
       (wrap-http-response)
       wrap-with-logger))


fix grid tag buttons

fix grid tag buttons

--- src/cljs/salava/core/ui/grid.cljs
+++ src/cljs/salava/core/ui/grid.cljs
@@ -14,7 +14,8 @@
        [:div.buttons
         [:button {:class (str "btn btn-default " (if all-checked? "btn-active"))
                   :id "btn-all"
-                  :on-click (fn []
+                  :on-click (fn [e]
+                              (.preventDefault e)
                               (swap! state assoc (keyword key) [])
                               (swap! state assoc (keyword all-key) true)
                               (if func (func state))
@@ -26,7 +27,8 @@
                   checked? (boolean (some #(= value %) buttons-checked))]
               [:button {:class    (str "btn btn-default " (if checked? "btn-active"))
                         :key      value
-                        :on-click (fn []
+                        :on-click (fn [e]
+                                    (.preventDefault e)
                                     (swap! state assoc (keyword all-key) false)
                                     (if func (func state))
                                     (if checked?


Italian: add new ordinal number (#96)

Italian: add new ordinal number (#96)

--- resources/languages/it/corpus/numbers.clj
+++ resources/languages/it/corpus/numbers.clj
@@ -68,7 +68,12 @@
   "-1200K"
   "-,0012G"
   (number -1200000)
-
+
+  "primo"
+  "1°"
+  "1ª"
+  (ordinal 1)
+
   "4°"
   "4ª"
   (ordinal 4)


lein-release plugin: preparing 0.3.33 release

--- re_view/project.clj
+++ re_view/project.clj
@@ -1,12 +1,12 @@
-(defproject re-view "0.3.32-SNAPSHOT"
+(defproject re-view "0.3.33"
   :description "Tiny React wrapper"
   :url "https://www.github.com/braintripping/re-view/tree/master/re_view"
   :license {:name "Eclipse Public License"
             :url  "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.9.0-alpha17"]
-                 [org.clojure/clojurescript "1.9.854"]
+                 [org.clojure/clojurescript "1.9.946" :scope "provided"]
                  [re-db "0.1.12"]
-                 [re-view-hiccup "0.1.12"]]
+                 [re-view-hiccup "0.1.14"]]

   :plugins [[lein-cljsbuild "1.1.2"]
             #_[lein-figwheel "0.5.0-2"]
@@ -38,14 +38,4 @@
                                        :asset-path    "/base/resources/public/js/test"
                                        :main          tests.runner
                                        :infer-externs true
-                                       :optimizations :none}}]}
-  :profiles {:provided {:dependencies [[cljsjs/react-dom "16.0.0-beta.2-0"]
-                                       [cljsjs/react "16.0.0-beta.2-0"]
-                                       [cljsjs/react-dom-server "16.0.0-beta.2-0"]]}
-             :dev      {:dependencies [[cljsjs/react-dom "16.0.0-beta.2-0"]
-                                       [cljsjs/react-dom-server "16.0.0-beta.2-0"]
-                                       [org.clojure/test.check "0.9.0"]]}
-             :test     {:dependencies [[cljsjs/react-dom "16.0.0-beta.2-0"]
-                                       [cljsjs/react "16.0.0-beta.2-0"]
-                                       [cljsjs/react-dom-server "16.0.0-beta.2-0"]
-                                       [org.clojure/test.check "0.9.0"]]}})
+                                       :optimizations :none}}]})


Remove errant comment

Remove errant comment

--- src/useful/java.clj
+++ src/useful/java.clj
@@ -1,7 +1,7 @@
 (ns useful.java
   (:import (java.lang.reflect Method)))

-(defn ^{:dont-test "Can't test killing the JVM"} abort ;;
+(defn ^{:dont-test "Can't test killing the JVM"} abort
   "Print message then exit."
   [& message]
   (apply println message)


Fix old-recordings? to return nil instead of empty list.

--- src/beebster_clj/core.clj
+++ src/beebster_clj/core.clj
@@ -46,7 +46,10 @@
 (defn old-recordings?
   "Does get-iplayer complain about recorded programmes > 30 days?"
   [str]
-  (remove nil? (map #(re-find #"These programmes should be deleted:" %) str)))
+  (seq (remove nil?
+               (map #(re-find #"These programmes should be deleted:" %) str))))
+
+

 (defn iplayer-download-command
   "concatenate index and mode to download command"
@@ -70,7 +73,7 @@
   "run external command with given args list."
   [search-title]
   (let [result (iplayer-search-resultstring search-title)]
-    (if (not= '() (old-recordings? (split-lines result)))
+    (if (old-recordings? (split-lines result))
       (split-lines (subs result (.indexOf result delete-string)))
       (split-lines result))))


Fix seed

Fix seed

--- src/braid/server/seed.clj
+++ src/braid/server/seed.clj
@@ -34,8 +34,8 @@

         _ (println "Set Passwords")
         _ (db/run-txns! (concat
-                          (user/set-user-password-txn user-1 "foofoofoo")
-                          (user/set-user-password-txn user-2 "barbarbar")))
+                          (user/set-user-password-txn (user-1 :id) "foofoofoo")
+                          (user/set-user-password-txn (user-2 :id) "barbarbar")))

         _ (println "Add Users to Groups and Make Users Admins")
         _ (db/run-txns!


fix: basic model

fix: basic model

--- src/bulk_trader/core.cljs
+++ src/bulk_trader/core.cljs
@@ -1,26 +1,14 @@
 (ns ^:figwheel-always bulk-trader.core
     (:require[om.core :as om :include-macros true]
-              [om.dom :as dom :include-macros true]))
+             [om.dom :as dom :include-macros true]))

 (enable-console-print!)

-(println "Edits to this text should show up in your developer console.")
+;; define your app data so that it doesn't get over-written on reload
+(defonce app-state (atom {:trader nil
+                          :logged-in? false
+                          :data nil}))

-;; define your app data so that it doesn't get over-written on reload
+(defonce traders ["geojit"])

-(defonce app-state (atom {:text "Hello world!"}))
-
-(om/root
-  (fn [data owner]
-    (reify om/IRender
-      (render [_]
-        (dom/h1 nil (:text data)))))
-  app-state
-  {:target (. js/document (getElementById "app"))})
-
-
-(defn on-js-reload []
-  ;; optionally touch your app-state to force rerendering depending on
-  ;; your application
-  ;; (swap! app-state update-in [:__figwheel_counter] inc)
-)
+(defn on-js-reload [])


Minor performance optimizations

Minor performance optimizations

--- src/flatgui/widgets/componentbase.clj
+++ src/flatgui/widgets/componentbase.clj
@@ -206,6 +206,7 @@
                                 :target-id-path-index (dec (count target-id-path))
                                 :evolve-reason-provider evolve-reason-provider
                                 :_initialization initialization)
+            target-evolvers (:evolvers target-component)
              ps-count (count properties-to-evolve)]
         (loop [ pi 0
                 tgt target-component
@@ -213,7 +214,7 @@
                 aux aux-container]
           (if (< pi ps-count)
                   (let [p (nth properties-to-evolve pi)
-                        evolver (p (:evolvers tgt))]
+                        evolver (p target-evolvers)]
                     (if (or initialization evolver)
                       (let [;; Remember: cannot use get in :evolved-properties check because of http://dev.clojure.org/jira/browse/CLJ-700
                             ;; We don track :children change during initialization. Current implementation of initialization
@@ -238,11 +239,11 @@
                              has-changes-raw (not (= old-value new-value))
                              has-changes has-changes-raw ;(or initialization has-changes-raw)

-                             new-aux-with-consume (if (evolve-reason-provider nil)
+                             new-aux-with-consume (if (and (evolve-reason-provider nil) ((:consumes? tgt) tgt))
                                                     (assoc!
                                                       aux-with-evolved-dependencies
                                                       :consumed
-                                                      (or (:consumed aux-with-evolved-dependencies) ((:consumes? tgt) tgt)))
+                                                      true)
                                                     aux-with-evolved-dependencies)

                              new-aux (if has-changes
@@ -279,49 +280,53 @@
                                              flex-target-id-paths-added (if flex-structure-changes (:_flex-target-id-paths-added new-value))
                                              new-value (if flex-structure-changes (dissoc new-value :_flexible-childset-added :_flex-target-id-paths-added) new-value)

-
-                                             fin-ret1 (assoc (assoc-in root-p (fgc/conjv k p) new-value)
-                                                         :has-structure-changes (or (:has-structure-changes root-p) has-structure-changes)
-                                                         :flex-structure-changes (merge (:flex-structure-changes root-p) flex-structure-changes)
-
-                                                         ; For some reason that is still not clear enough, removing vec from here causes
-                                                         ; stack overflow related to lazy seq
-                                                         :flex-target-id-paths-added (vec (concat (:flex-target-id-paths-added root-p) flex-target-id-paths-added))
-
-
-                                                         :has-changes (or (:has-changes root-p) has-changes)
-                                                         :aux-container new-aux)
-                                             fin-ret2 (if (and (:popup tgt) (= p :visible))
+                                             root-with-new-value (assoc (assoc-in root-p (fgc/conjv k p) new-value)
+                                                                   :has-changes true
+                                                                   :aux-container new-aux)
+                                             fin-ret1 (if children-changed
+                                                        (assoc root-with-new-value
+                                                          :has-structure-changes (or (:has-structure-changes root-p) has-structure-changes)
+                                                          :flex-structure-changes (merge (:flex-structure-changes root-p) flex-structure-changes)
+                                                          ; For some reason that is still not clear enough, removing vec from here causes
+                                                          ; stack overflow related to lazy seq
+                                                          :flex-target-id-paths-added (vec (concat (:flex-target-id-paths-added root-p) flex-target-id-paths-added)))
+                                                        root-with-new-value)
+
+                                             fin-ret2 (if (and (= p :visible) (:popup tgt))
                                                         (update-in fin-ret1 [:paths-having-visible-popups] (if new-value conj disj) (fgc/drop-lastv target-id-path))
                                                         fin-ret1)
                                              fin-ret (if (and (= p :->clipboard) new-value)
                                                         (update-in fin-ret2 [:data-for-clipboard] conj new-value)
                                                         fin-ret2)]
-                                         (condp = p
-                                           ;TODO 1. take into account viewport-matrix when combining?
-
-                                           :abs-position-matrix (assoc fin-ret :dirty-rect
-                                                                  (let [ cs (:clip-size tgt)
-                                                                         r (:dirty-rect fin-ret)]
-                                                                    (combine-dirty-rect
-                                                                      (combine-dirty-rect r old-value cs)
-                                                                      new-value
-                                                                      cs)))
-                                           :clip-size (assoc fin-ret :dirty-rect
-                                                        (let [ pm (:abs-position-matrix tgt)
-                                                               r (:dirty-rect fin-ret)]
-                                                          (combine-dirty-rect
-                                                            (combine-dirty-rect r pm old-value)
-                                                            pm
-                                                            new-value)))
-                                            (assoc fin-ret :dirty-rect
-                                                 (let [ pm (:abs-position-matrix tgt)
-                                                        cs (:clip-size tgt)
-                                                        r (:dirty-rect fin-ret)]
-                                                   (combine-dirty-rect
-                                                     r
-                                                     pm
-                                                     cs)))))
+
+                                         fin-ret
+                                         ;(condp = p
+                                         ;  ;TODO 1. take into account viewport-matrix when combining?
+                                         ;
+                                         ;  :abs-position-matrix (assoc fin-ret :dirty-rect
+                                         ;                         (let [ cs (:clip-size tgt)
+                                         ;                                r (:dirty-rect fin-ret)]
+                                         ;                           (combine-dirty-rect
+                                         ;                             (combine-dirty-rect r old-value cs)
+                                         ;                             new-value
+                                         ;                             cs)))
+                                         ;  :clip-size (assoc fin-ret :dirty-rect
+                                         ;               (let [ pm (:abs-position-matrix tgt)
+                                         ;                      r (:dirty-rect fin-ret)]
+                                         ;                 (combine-dirty-rect
+                                         ;                   (combine-dirty-rect r pm old-value)
+                                         ;                   pm
+                                         ;                   new-value)))
+                                         ;   (assoc fin-ret :dirty-rect
+                                         ;        (let [ pm (:abs-position-matrix tgt)
+                                         ;               cs (:clip-size tgt)
+                                         ;               r (:dirty-rect fin-ret)]
+                                         ;          (combine-dirty-rect
+                                         ;            r
+                                         ;            pm
+                                         ;            cs))))
+
+                                         )
                                        (assoc root-p
                                          :aux-container new-aux))]
                           (recur


Helper func for less-wide code.

Helper func for less-wide code.

--- src/cbfg/world-store.cljs
+++ src/cbfg/world-store.cljs
@@ -52,38 +52,39 @@

 (def store-max-inflight (atom 10))

+(defn world-vis-init-cb [world]
+  (let [store (store/make-store world)
+        store-cmd-handlers (make-store-cmd-handlers store)
+        cmd-ch (map< (fn [ev] {:op (.-id (.-target ev))})
+                     (cljs.core.async/merge (map #(listen-el (gdom/getElement %) "click")
+                                                 (keys store-cmd-handlers))))
+        client-cmds (atom {}) ; Keyed by opaque -> [request, replies]
+        in-ch (achan-buf world 100)
+        out-ch (achan-buf world 0)]
+    (ago-loop client world [num-ins 0 num-outs 0]
+              (let [[v ch] (aalts client [cmd-ch out-ch])]
+                (cond
+                 (= ch cmd-ch) (let [op (:op v)
+                                     op-fence (= (get-el-value (str op "-fence")) "1")
+                                     [params handler] (get store-cmd-handlers op)
+                                     cmd2 (-> v
+                                              (assoc :opaque num-ins)
+                                              (assoc :fence op-fence))
+                                     cmd3 (reduce #(assoc %1 (keyword %2)
+                                                          (get-el-value (str op "-" %2)))
+                                                  cmd2 params)]
+                                 (render-client-cmds (swap! client-cmds
+                                                            #(assoc % num-ins [cmd3 nil])))
+                                 (aput client in-ch (merge cmd3 (handler cmd3)))
+                                 (recur (inc num-ins) num-outs))
+                 (= ch out-ch) (do (render-client-cmds (swap! client-cmds
+                                                              #(update-in % [(:opaque v) 1]
+                                                                          conj [num-outs v])))
+                                   (recur num-ins (inc num-outs))))))
+    (make-fenced-pump world in-ch out-ch @store-max-inflight)))
+
 (defn world-vis-init [el-prefix]
-  (vis-init (fn [world]
-              (let [store (store/make-store world)
-                    store-cmd-handlers (make-store-cmd-handlers store)
-                    cmd-ch (map< (fn [ev] {:op (.-id (.-target ev))})
-                                 (cljs.core.async/merge (map #(listen-el (gdom/getElement %) "click")
-                                                             (keys store-cmd-handlers))))
-                    client-cmds (atom {}) ; Keyed by opaque -> [request, replies]
-                    in-ch (achan-buf world 100)
-                    out-ch (achan-buf world 0)]
-                (ago-loop client world [num-ins 0 num-outs 0]
-                          (let [[v ch] (aalts client [cmd-ch out-ch])]
-                            (cond
-                             (= ch cmd-ch) (let [op (:op v)
-                                                 op-fence (= (get-el-value (str op "-fence")) "1")
-                                                 [params handler] (get store-cmd-handlers op)
-                                                 cmd2 (-> v
-                                                          (assoc :opaque num-ins)
-                                                          (assoc :fence op-fence))
-                                                 cmd3 (reduce #(assoc %1 (keyword %2)
-                                                                      (get-el-value (str op "-" %2)))
-                                                              cmd2 params)]
-                                             (render-client-cmds (swap! client-cmds
-                                                                        #(assoc % num-ins [cmd3 nil])))
-                                             (aput client in-ch (merge cmd3 (handler cmd3)))
-                                             (recur (inc num-ins) num-outs))
-                             (= ch out-ch) (do (render-client-cmds (swap! client-cmds
-                                                                          #(update-in % [(:opaque v) 1]
-                                                                                conj [num-outs v])))
-                                               (recur num-ins (inc num-outs))))))
-                (make-fenced-pump world in-ch out-ch @store-max-inflight)))
-            el-prefix nil))
+  (vis-init world-vis-init-cb el-prefix nil))

 (let [last-id (atom 0)
       gen-id #(swap! last-id inc)]


fix some of the typehinting surrounding big numbers

--- src/cheshire/generate.clj
+++ src/cheshire/generate.clj
@@ -31,25 +31,26 @@
        Long (.writeNumber ~jg (long ~obj))
        Double (.writeNumber ~jg (double ~obj))
        Float (.writeNumber ~jg (double ~obj))
-       BigInteger (.writeNumber ~jg ^BigInteger ~obj)
-       BigDecimal (.writeNumber ~jg ^BigDecimal ~obj)
+       BigInteger (.writeNumber ~jg ~(with-meta obj {:tag "BigInteger"}))
+       BigDecimal (.writeNumber ~jg ~(with-meta obj {:tag "BigDecimal"}))
        Ratio (.writeNumber ~jg (double ~obj))
        Short (.writeNumber ~jg (int ~obj))
        Byte (.writeNumber ~jg (int ~obj))
-       clojure.lang.BigInt (.writeNumber ~jg ^clojure.lang.BigInt
-                                         (.toBigInteger (bigint ~obj)))
+       clojure.lang.BigInt (.writeNumber ~jg ^BigInteger
+                             (.toBigInteger ^clojure.lang.BigInt (bigint ~obj)))
        (fail ~obj ~jg ~e))
-    `(condp instance? ~obj
-       Integer (.writeNumber ~jg (int ~obj))
-       Long (.writeNumber ~jg (long ~obj))
-       Double (.writeNumber ~jg (double ~obj))
-       Float (.writeNumber ~jg (float ~obj))
-       BigInteger (.writeNumber ~jg ^BigInteger ~obj)
-       BigDecimal (.writeNumber ~jg ^BigDecimal ~obj)
-       Ratio (.writeNumber ~jg (double ~obj))
-       Short (.writeNumber ~jg (int ~obj))
-       Byte (.writeNumber ~jg (int ~obj))
-       (fail ~obj ~jg ~e))))
+    `(let [^JsonGenerator jg# ~jg]
+       (condp instance? ~obj
+         Integer (.writeNumber jg# (int ~obj))
+         Long (.writeNumber jg# (long ~obj))
+         Double (.writeNumber jg# (double ~obj))
+         Float (.writeNumber jg# (float ~obj))
+         BigInteger (.writeNumber jg# ^BigInteger ~obj)
+         BigDecimal (.writeNumber jg# ^BigDecimal ~obj)
+         Ratio (.writeNumber jg# (double ~obj))
+         Short (.writeNumber jg# (int ~obj))
+         Byte (.writeNumber jg# (int ~obj))
+         (fail ~obj jg# ~e)))))

 (declare generate)

@@ -117,7 +118,8 @@
                         (write-string ^JsonGenerator jg (.format sdf obj)))
    :else (try
            (.writeNumber ^JsonGenerator jg obj)
-           (catch Exception e (fail obj jg ex)))))
+           (catch Exception e
+             (fail obj jg ex)))))

 ;; Generic encoders, these can be used by someone writing a custom
 ;; encoder if so desired, after transforming an arbitrary data


adds pause toggling during solo mode

adds pause toggling during solo mode

--- src/client/game/core.cljs
+++ src/client/game/core.cljs
@@ -70,6 +70,14 @@
   "The state of the game."
   (atom nil))

+(def paused?
+  "Boolean flag signaling if game is paused or not"
+  (atom false))
+
+(def paused-board
+  "Temp state of the board when paused"
+  (atom nil))
+
 (defn- update-theme [_ _ _ new-state]
   (let [theme-num (:theme new-state)
         theme (get themes theme-num)]
@@ -381,6 +389,7 @@
   40 :down
   32 :space
   16 :shift
+  80 :p

   49 :one
   50 :two
@@ -392,6 +401,31 @@
   56 :eight
   57 :nine
   48 :zero})
+
+(defn resume-game!
+  "Restores the state of the board pre-pausing, and resumes gravity"
+  []
+  (reset! state @paused-board)
+  (put! resume-grav 0)
+  (reset! paused? false))
+
+(defn pause-game!
+  "Saves the current state of the board, loads the game-over animation and pauses gravity"
+  []
+  (reset! paused-board @state)
+  (go-go-game-over!)
+  (swap! state assoc :piece nil)
+  (put! pause-grav 0)
+  (reset! paused? true))
+
+(defn toggle-pause-game!
+  "Toggles pause on the game board"
+  []
+  (if (not @battle)
+    (if @paused?
+      (resume-game!)
+      (pause-game!))
+    (js/console.log "Cant pause in battle mode")))

 (defn add-key-events
   "Add all the key inputs."
@@ -411,8 +445,9 @@
                      :eight (change-theme! 7 "2000" "TI-83" e)
                      :nine  (change-theme! 8 "2002" "Flash" e)
                      :zero  (change-theme! 9 "2012" "Facebook" e)
+                     :p     (do (toggle-pause-game!) (.preventDefault e))
                      nil)
-                   (if (:piece @state)
+                   (if (and (:piece @state) (not @paused?))
                      (case (key-name e)
                        :down  (do (put! down-chan true) (.preventDefault e))
                        :left  (do (try-move! -1  0)     (.preventDefault e))


CLJS-921: cljs.repl/doc output includes namespace twice

:name var metadata exposed fully qualified symbol

--- src/clj/cljs/analyzer.clj
+++ src/clj/cljs/analyzer.clj
@@ -510,8 +510,9 @@
     {:env env :op :var-special :form form
      :var (analyze env sym)
      :sym (analyze env `(quote ~(symbol (name (:ns var)) (name (:name var)))))
-     :meta (let [ks [:ns :name :doc :file :line :column]
+     :meta (let [ks [:ns :doc :file :line :column]
                  m (assoc (zipmap ks (map #(list 'quote (get var %)) ks))
+                     :name `(quote ~(symbol (name (:name var))))
                      :test `(when ~sym (.-cljs$lang$test ~sym))
                      :arglists (:arglists var))]
             (analyze env m))}))


bug noticed by Kovas Boguta, cljs.analyzer/parse-ns needs to bind *cljs-file*

--- src/clj/cljs/analyzer.clj
+++ src/clj/cljs/analyzer.clj
@@ -2054,6 +2054,7 @@
             [ijs compiler-env']
             (binding [env/*compiler* (atom compiler-env)
                       *cljs-ns* 'cljs.user
+                      *cljs-file* src
                       *macro-infer*
                       (or (when (contains? opts :macro-infer)
                             (:macro-infer opts))


switch condp -> multimethod for warning string generation

--- src/clj/cljs/analyzer.clj
+++ src/clj/cljs/analyzer.clj
@@ -44,26 +44,65 @@

 (declare message namespaces)

-(defn ^:private default-warning-handler [warning-type env & [extra]]
+(defmulti default-warning-handler* (fn [warning-type & _] warning-type))
+
+(defmethod default-warning-handler* :undeclared-var
+  [warning-type extra]
+  (str "Use of undeclared Var " (:prefix extra) "/" (:suffix extra)))
+
+(defmethod default-warning-handler* :undeclared-ns
+  [warning-type extra]
+  (str "No such namespace: " (:ns-sym extra)))
+
+(defmethod default-warning-handler* :dynamic
+  [warning-type extra]
+  (str (:name extra) " not declared ^:dynamic"))
+
+(defmethod default-warning-handler* :redef
+  [warning-type extra]
+  (str (:sym extra) " already refers to: " (symbol (str (:ns extra)) (str (:sym extra)))
+    " being replaced by: " (symbol (str (:ns-name extra)) (str (:sym extra)))))
+
+(defmethod default-warning-handler* :fn-var
+  [warning-type extra]
+  (str (symbol (str (:ns-name extra)) (str (:sym extra)))
+    " no longer fn, references are stale"))
+
+(defmethod default-warning-handler* :fn-arity
+  [warning-type extra]
+  (str "Wrong number of args (" (:argc extra) ") passed to "
+    (or (:ctor extra)
+      (:name extra))))
+
+(defmethod default-warning-handler* :fn-deprecated
+  [warning-type extra]
+  (str (-> extra :fexpr :info :name) " is deprecated."))
+
+(defmethod default-warning-handler* :undeclared-ns-form
+  [warning-type extra]
+  (str "Referred " (:type extra) " " (:lib extra) "/" (:sym extra) " does not exist"))
+
+(defmethod default-warning-handler* :protocol-deprecated
+  [warning-type extra]
+  (str "Protocol " (:protocol extra) " is deprecated"))
+
+(defmethod default-warning-handler* :undeclared-protocol-symbol
+  [warning-type extra]
+  (str "Can't resolve protocol symbol " (:protocol extra)))
+
+(defmethod default-warning-handler* :undeclared-protocol-symbol
+  [warning-type extra]
+  (str "Can't resolve protocol symbol " (:protocol extra)))
+
+(defmethod default-warning-handler* :invalid-protocol-symbol
+  [warning-type extra]
+  (str "Symbol " (:protocol extra) " is not a protocol"))
+
+(defn ^:private default-warning-handler [warning-type env extra]
   (when (warning-type *cljs-warnings*)
-      (let [s (condp = warning-type
-                :undeclared-var (str "WARNING: Use of undeclared Var " (:prefix extra) "/" (:suffix extra))
-                :undeclared-ns (str "WARNING: No such namespace: " (:ns-sym extra))
-                :dynamic (str "WARNING: " (:name extra) " not declared ^:dynamic")
-                :redef   (str "WARNING: " (:sym extra) " already refers to: " (symbol (str (:ns extra)) (str (:sym extra)))
-                              " being replaced by: " (symbol (str (:ns-name extra)) (str (:sym extra))))
-                :fn-var (str "WARNING: " (symbol (str (:ns-name extra)) (str (:sym extra)))
-                             " no longer fn, references are stale")
-                :fn-arity (str "WARNING: Wrong number of args (" (:argc extra) ") passed to " (or (:ctor extra)
-                                                                                (:name extra)))
-                :fn-deprecated (str "WARNING: " (-> extra :fexpr :info :name) " is deprecated.")
-                :undeclared-ns-form (str "WARNING: Referred " (:type extra) " " (:lib extra) "/" (:sym extra) " does not exist")
-                :protocol-deprecated (str "WARNING: Protocol " (:protocol extra) " is deprecated")
-                :undeclared-protocol-symbol (str "WARNING: Can't resolve protocol symbol " (:protocol extra))
-                :invalid-protocol-symbol (str "WARNING: Symbol " (:protocol extra) " is not a protocol"))]
-        (when s
-          (binding [*out* *err*]
-            (println (message env s)))))))
+    (when-let [s (default-warning-handler* warning-type extra)]
+      (binding [*out* *err*]
+        (println (message env (str "WARNING: " s)))))))

 (def ^:dynamic *cljs-warning-handlers*
   [default-warning-handler])


correct bug when randomize name in form inputs

--- src/clj/closerve/util.clj
+++ src/clj/closerve/util.clj
@@ -41,10 +41,14 @@
 (defn randomize-node-names [node]
   "change all the name attributes under form node to random uuid and return also a mapping"
   (let [uuid->name (atom {})
+        name->uuid (atom {})
         walk-fun (fn [nodex] (if-let [orig-name (get-in nodex [:attrs :name])]
-                               (let [new-name (make-random-uuid)]
-                                 (swap! uuid->name assoc new-name orig-name)
-                                 (assoc-in nodex [:attrs :name] new-name))
+                               (if (@name->uuid orig-name)
+                                 (assoc-in nodex [:attrs :name] (@name->uuid orig-name))
+                                 (let [new-name (make-random-uuid)]
+                                   (swap! uuid->name assoc new-name orig-name)
+                                   (swap! name->uuid assoc orig-name new-name)
+                                   (assoc-in nodex [:attrs :name] new-name)))
                                nodex))
         form-id (make-random-uuid)
         new-node (assoc-in node [:attrs :id] form-id)]


better authentication fns

better authentication fns

--- src/clj/tictag/server.clj
+++ src/clj/tictag/server.clj
@@ -77,14 +77,6 @@
       :tag-ping-by-long-time (tag-ping-by-long-time db args)
       :tag-last-ping         (tag-last-ping db args))))

-(def sms (POST "/sms" [Body :as {:keys [twilio beeminder db] :as req}]
-           (if (twilio/valid-sig? twilio req)
-             (do (handle-sms db Body)
-                 (beeminder/sync! beeminder (db/get-pings (:db db))))
-             (do
-               (timbre/warnf "INVALID SIGNATURE FOR TWILIO MESSAGE: %s" Body)
-               {:status 401 :body "unauthorized"}))))
-
 (defn handle-timestamp [db beeminder timestamp tags local-time]
   (timbre/debugf "Received client: %s %s %s" timestamp tags local-time)
   (let [long-time (Long. timestamp)]
@@ -92,30 +84,6 @@
     (db/add-tags db long-time tags local-time)
     (beeminder/sync! beeminder (db/get-pings (:db db)))
     {:status 200 :body ""}))
-
-(def timestamp
-  (PUT "/time/:timestamp" [secret timestamp tags local-time :as {db :db shared-secret :shared-secret beeminder :beeminder}]
-    (if (= secret shared-secret)
-      (handle-timestamp db beeminder timestamp tags local-time)
-      (do
-        (timbre/warn "UNAUTHORIZED TIMESTAMP RECEIVED")
-        {:status 401 :body "unauthorized"}))))
-
-(defn wrap-db [handler db]
-  (fn [req]
-    (handler (assoc req :db db))))
-
-(defn wrap-twilio [handler twilio]
-  (fn [req]
-    (handler (assoc req :twilio twilio))))
-
-(defn wrap-beeminder [handler beeminder]
-  (fn [req]
-    (handler (assoc req :beeminder beeminder))))
-
-(defn wrap-shared-secret [handler secret]
-  (fn [req]
-    (handler (assoc req :shared-secret secret))))

 (defn index []
   (html5
@@ -131,35 +99,53 @@
      [:script {:src "/js/compiled/app.js"}]
      [:script {:src "https://use.fontawesome.com/efa7507d6f.js"}]]]))

-(defn pings [{db :db}]
+(defn pings [db]
   (timbre/debugf "Received request!")
   (response (db/get-pings (:db db))))

-(defn routes [tagtime]
+(defn wrap-authenticate [handler f]
+  (fn [req]
+    (timbre/debugf "Authenticating! (f req) is : %s" (f req))
+    (if (f req)
+      (handler req)
+      {:status 401 :body "unauthorized"})))
+
+(defn sms [db beeminder req]
+  (handle-sms db (get-in req [:params :Body]))
+  (beeminder/sync! beeminder (db/get-pings (:db db))))
+
+(defn timestamp [db beeminder {:keys [params]}]
+  (handle-timestamp db beeminder (:timestamp params) (:tags params) (:local-time params)))
+
+(defn valid-shared-secret? [shared-secret {:keys [params]}]
+  (= shared-secret (:secret params)))
+
+(defn routes [db beeminder twilio tagtime shared-secret]
   (compojure.core/routes
-   sms
-   timestamp
-   (GET "/pings" [] pings)
-   (GET "/" [] (index))
-   (GET "/config" [] {:headers {"Content-Type" "application/edn"}
-                      :status 200
-                      :body (pr-str {:tagtime-seed (:seed tagtime)
-                                     :tagtime-gap  (:gap tagtime)})})
-   (GET "/healthcheck" [] {:status  200
-                           :headers {"Content-Type" "text/plain"}
-                           :body    "healthy!"})))
+   (POST "/sms" _ (wrap-authenticate
+                   (partial sms db beeminder)
+                   (partial twilio/valid-sig? twilio)))
+   (PUT "/time/:timestamp" _
+     (wrap-authenticate
+      (partial handle-timestamp db beeminder)
+      (partial valid-shared-secret? shared-secret)))
+   (GET "/pings" _ (pings db))
+   (GET "/" _ (index))
+   (GET "/config" _ {:headers {"Content-Type" "application/edn"}
+                     :status 200
+                     :body (pr-str {:tagtime-seed (:seed tagtime)
+                                    :tagtime-gap  (:gap tagtime)})})
+   (GET "/healthcheck" _ {:status  200
+                          :headers {"Content-Type" "text/plain"}
+                          :body    "healthy!"})))

 (defrecord Server [db config tagtime beeminder twilio]
   component/Lifecycle
   (start [component]
     (timbre/debug "Starting server")
     (let [stop (http/run-server
-                (-> (routes tagtime)
+                (-> (routes db beeminder twilio tagtime (:shared-secret config))
                     (wrap-transit-response {:encoding :json})
-                    (wrap-shared-secret (:shared-secret config))
-                    (wrap-db db)
-                    (wrap-beeminder beeminder)
-                    (wrap-twilio twilio)
                     (wrap-defaults (assoc-in api-defaults [:static :resources] "/public"))
                     (wrap-edn-params)
                     (wrap-transit-params))


Added deregister

Added deregister

--- src/cljs/cljs/reader.cljs
+++ src/cljs/cljs/reader.cljs
@@ -421,11 +421,20 @@
         pfn  (get @*tag-table* (name tag))]
     (if pfn
       (pfn form)
-      (reader-error rdr "Could not find tag parser for " (name tag) (pr-str @*tag-table*)))))
+      (reader-error rdr
+                    "Could not find tag parser for " (name tag)
+                    " in " (pr-str (keys @*tag-table*))))))

 (defn register-tag-parser!
   [tag f]
   (let [tag (name tag)
         old-parser (get @*tag-table* tag)]
     (swap! *tag-table* assoc tag f)
+    old-parser))
+
+(defn deregister-tag-parser!
+  [tag]
+  (let [tag (name tag)
+        old-parser (get @*tag-table* tag)]
+    (swap! *tag-table* dissoc tag)
     old-parser))


Add Undo Title

Add Undo Title

--- src/cljs/lens/navbar.cljs
+++ src/cljs/lens/navbar.cljs
@@ -21,7 +21,8 @@
     (bus/unlisten-all owner))
   (render-state [_ {:keys [enabled]}]
     (d/li (when-not enabled {:class "disabled"})
-      (d/a {:href "#" :on-click (h (bus/publish! owner :undo {}))} (fa/span :undo)))))
+      (d/a {:href "#" :title "Undo"
+            :on-click (h (bus/publish! owner :undo {}))} (fa/span :undo)))))

 (defcomponent nav [nav]
   (render [_]


moved back btn over to far left side

moved back btn over to far left side

--- src/cljs/lokate/core.cljs
+++ src/cljs/lokate/core.cljs
@@ -139,9 +139,9 @@
           (dom/span #js {:className "banner-title"}
             "lokate"))
         (dom/div #js {:className "control-panel"}
+          (om/build back-btn data)
           (dom/div #js {:id "nav-control"
                         :style (display-fade-in (open? (:drawer data)))})
-          (om/build back-btn data)
           (om/build navicon data))))))

 (defn drawer [data owner]


resources sorted in unit now

resources sorted in unit now

--- src/cljs/lokate/unit.cljs
+++ src/cljs/lokate/unit.cljs
@@ -151,8 +151,10 @@

     om/IRender
     (render [_]
-      (let [resources (map #(assoc % :active (contains? (:resources unit) (:id %)))
-                        (vals rsc-types))]
+      (let [resources (->> rsc-types
+                           vals
+                           (sort-by :timestamp)
+                           (map #(assoc % :active (contains? (:resources unit) (:id %)))))]
         (html [:div.flex-col.frame
                (c/select-list
                  {:id "unit-edit-rscs"


tighter handler

tighter handler

--- src/cljs/server/core.cljs
+++ src/cljs/server/core.cljs
@@ -10,14 +10,10 @@
 (def express (nodejs/require "express"))

 (defn handler [req res]
-  (let [jokes-chan (fetch-some-jokes 5)]
-    (go-loop [content nil]
-      (let [joke (<! jokes-chan)]
-        (if (not (nil? joke))
-          (recur (cons joke content))
-          (do
-            (.set res "Content-Type" "text/plain")
-            (.send res (string/join "\n\n" content))))))))
+  (let [jokes-chan (async/into [] (fetch-some-jokes 5))]
+    (go
+      (.set res "Content-Type" "text/plain")
+      (.send res (string/join "\n\n" (<! jokes-chan))))))

 (defn server [handler port cb]
   (let [app (express)]


Fix work in browser without webscoket support

--- src/cljs/subman/push.cljs
+++ src/cljs/subman/push.cljs
@@ -1,10 +1,11 @@
 (ns subman.push
   (:require [cljs.reader :refer [read-string]]
             [goog.net.WebSocket]
-            [goog.events :as gevents]))
+            [goog.events :as gevents]
+            [jayq.util :refer [log]]))

-(defn init-push
-  "Init push connection"
+(defn create-push-connection
+  "Create push connection"
   [total-count]
   (let [ws (goog.net.WebSocket.)]
     (gevents/listen ws goog.net.WebSocket.EventType.MESSAGE
@@ -17,3 +18,10 @@
                    ":" (.-port js/location)
                    "/notifications/"))
     ws))
+
+
+(defn init-push
+  "Initiale push connection"
+  [total-count]
+  (try (create-push-connection total-count)
+    (catch js/Error e (log e))))


Added option that defines transparent color to make gif

--- src/clojure/gift/core.clj
+++ src/clojure/gift/core.clj
@@ -14,11 +14,12 @@
 Usage: (make-gif \"move.gif\" [\"person1.jpg\" \"person2.jpg\"])

 Additional properties:\n
-  :delay      - time in milliseconds between frames (default 200)
-  :iterations - number of iterations (0 is for infinity)
-  :quality    - quality of color quantization (should be > 0)
-  :width      - width of resulting gif (if not provided the size of first frame is used)
-  :height     - height of resulting gif (if not provided the size of first frame is used)
+  :delay              - time in milliseconds between frames (default 200)
+  :iterations         - number of iterations (0 is for infinity)
+  :quality            - quality of color quantization (should be > 0)
+  :width              - width of resulting gif (if not provided the size of first frame is used)
+  :height             - height of resulting gif (if not provided the size of first frame is used)
+  :transparent-color  - vector [r g b a] which defines color that will be transparent in resulting gif (default is [0 0 0 255])

 "
   [output-path images
@@ -26,16 +27,19 @@
              iterations
              quality
              width
-             height]
+             height
+             transparent-color]
       :or {delay 200
            iterations 0
-           quality 10}}]
+           quality 10
+           transparent-color [0 0 0 255]}}]
   (let [encoder (doto (gift.AnimatedGifEncoder.)
                   (.start output-path)
                   (.setRepeat iterations)
                   (.setQuality quality) ;; less is better
                   (.setDelay delay) ;; milliseconds
-                  )]
+                  (.setTransparent (when transparent-color
+                                     (apply #(java.awt.Color. %1 %2 %3 %4) transparent-color))))]
     (when (and width height)
       (.setSize encoder width height))
     (doseq [i images]


Updating for metadata db system changes.

--- src/cmr/search/system.clj
+++ src/cmr/search/system.clj
@@ -33,8 +33,7 @@
   "Returns a new instance of the whole application."
   []
   (let [metadata-db (-> (mdb-system/create-system "metadata-db-in-search-app-pool")
-                        (dissoc :log :web)
-                        (assoc :skip-background-jobs true))
+                        (dissoc :log :web :scheduler))
         sys {:log (log/create-logger)

              ;; An embedded version of the metadata db app to allow quick retrieval of data


drain-into-vec! should use async consumer API

This change gives us parity between our test functions and our real code (which
was already ported to use async consumers). It also runs much faster, and cuts
our overall test execution time by several seconds.

Signed-off-by: Deepak Giridharagopal <d11186354d1ef01ca06ae37d7e23e827da13e85f@puppetlabs.com>

--- src/com/puppetlabs/mq.clj
+++ src/com/puppetlabs/mq.clj
@@ -74,7 +74,16 @@
           (integer? timeout)
           (pos? timeout)]
    :post [(vector? %)]}
-  (with-open [consumer (mq-conn/seqable connection {:endpoint endpoint :timeout timeout})]
-    (reduce into []
-            (map #(do (mq-seq/ack consumer) [%1])
-                 (mq-seq/mseq consumer)))))
+  (let [contents (atom [])
+        mq-error (promise)
+        consumer (mq-conn/consumer connection
+                                   {:endpoint   endpoint
+                                    :transacted true
+                                    :on-message #(swap! contents conj %)
+                                    :on-failure #(deliver mq-error (:exception %))})]
+    (mq-consumer/start consumer)
+    (deref mq-error timeout nil)
+    (mq-consumer/close consumer)
+    (if (realized? mq-error)
+      (throw @mq-error)
+      @contents)))


Fixed bad image/album linking.

Fixed bad image/album linking.

--- src/dragon/selmer/tags/flickr.clj
+++ src/dragon/selmer/tags/flickr.clj
@@ -20,6 +20,7 @@
    ":album-id" :album-id
    ":height" :height
    ":width" :width})
+(def url-template "https://www.flickr.com/photos/%s/%s/in/album-%s")

 (defn ->int
   [arg]
@@ -88,7 +89,9 @@
     (log/debug "best available width:" (get-best-width (:width args) sizes-data))
     (log/debug "best-size:" best-size)
     (format (str escaped-skip-marker
-                 ""
+                 ""
                  ""
                  ""
                  escaped-skip-marker)


adjust main

adjust main

--- uberjar/src/dda/pallet/dda_serverspec_crate/main.clj
+++ uberjar/src/dda/pallet/dda_serverspec_crate/main.clj
@@ -19,25 +19,8 @@
     [clojure.string :as str]
     [clojure.tools.cli :as cli]
     [dda.config.commons.styled-output :as styled]
-    [dda.pallet.commons.existing :as existing]
-    [dda.pallet.commons.operation :as operation]
+    [dda.pallet.core.app :as core-app]
     [dda.pallet.dda-serverspec-crate.app :as app]))
-
-(defn execute-serverspec
-  [domain-config target-config verbosity]
-  (let [session (operation/do-test
-                  (app/existing-provider target-config)
-                  (app/existing-provisioning-spec domain-config target-config)
-                  :summarize-session false)]
-    (app/summarize-test-session session :verbose verbosity)
-    (app/session-passed? session)))
-
-(defn execute-install
-  [domain-config target-config]
-  (operation/do-apply-install
-    (app/existing-provider target-config)
-    (app/existing-provisioning-spec domain-config target-config)
-    :summarize-session true))

 (def cli-options
   [["-h" "--help"]
@@ -76,12 +59,14 @@
       help (exit 0 (usage summary))
       errors (exit 1 (error-msg errors))
       (not= (count arguments) 1) (exit 1 (usage summary))
-      (:install-dependencies options) (execute-install
-                                       (app/load-domain (first arguments))
-                                       (app/load-targets (:targets options)))
-      :default (if (execute-serverspec
-                     (app/load-domain (first arguments))
-                     (app/load-targets (:targets options))
-                     verbose)
+      (:install-dependencies options) (core-app/existing-install
+                                        app/crate-app
+                                        {:domain (first arguments)
+                                         :targets (:targets options)})
+      :default (if (core-app/existing-serverspec
+                     app/crate-app
+                     {:domain (first arguments)
+                      :targets (:targets options)
+                      :verbosity verbose})
                    (exit 0 (styled/styled "ALL TESTS PASSED" :green))
                    (exit 2 (styled/styled "SOME TESTS FAILED" :red))))))


filter-key-error-log-entries

filter-key-error-log-entries

--- src/er_cassandra/model/error.cljc
+++ src/er_cassandra/model/error.cljc
@@ -87,6 +87,17 @@
      :key key
      :key-value key-value})])

+(defnk filter-key-error-log-entries
+  [error-tag primary-table key log]
+  (->> log
+       (filter
+        (fn [[_ {t :tag
+                 pt :primary-table
+                 k :key}]]
+          (and (= t error-tag)
+               (= pt primary-table)
+               (= k key))))))
+
 (defnk field-error-log-entry
   "helper fn to create a :field-error log entry"
   [error-tag


Some minor renaming in the new event generation code for emitting elements

--- src/main/clojure/clojure/data/xml.clj
+++ src/main/clojure/clojure/data/xml.clj
@@ -49,53 +49,64 @@
     :cdata (.writeCData writer (:str event))
     :comment (.writeComment writer (:str event))))

-(defprotocol Flatten
-  (gen-event [e])
-  (next-events [e next]))
-
-(extend-protocol Flatten
+(defprotocol EventGeneration
+  "Protocol for generating new events based on element type"
+  (gen-event [item]
+    "Function to generate an event for e.")
+  (next-events [item next-items]
+    "Returns the next set of events that should occur after e.  next-events are the
+     events that should be generated after this one is complete."))
+
+(extend-protocol EventGeneration
   Element
-  (gen-event [e]
-    (Event. :start-element (:tag e) (:attrs e) nil))
-  (next-events [e next]
-    (cons (:content e)
-          (cons (Event. :end-element (:tag e) nil nil) next)))
+  (gen-event [element]
+    (Event. :start-element (:tag element) (:attrs element) nil))
+  (next-events [element next-items]
+    (cons (:content element)
+          (cons (Event. :end-element (:tag element) nil nil) next-items)))
   Event
-  (gen-event [e] e)
-  (next-events [e next] next)
+  (gen-event [event] event)
+  (next-events [_ next-items]
+    next-items)

   clojure.lang.Sequential
-  (gen-event [e]
-    (gen-event (first e)))
-  (next-events [e next]
-    (if-let [r (seq (rest e))]
-      (cons (next-events (first e) r) next)
-      (next-events (first e) next)))
+  (gen-event [coll]
+    (gen-event (first coll)))
+  (next-events [coll next-items]
+    (if-let [r (seq (rest coll))]
+      (cons (next-events (first coll) r) next-items)
+      (next-events (first coll) next-items)))
+
   String
-  (gen-event [e]
-    (Event. :chars nil nil e))
-  (next-events [e next] next)
+  (gen-event [s]
+    (Event. :chars nil nil s))
+  (next-events [_ next-items]
+    next-items)

   CData
-  (gen-event [e]
-    (Event. :cdata nil nil (:content e)))
-  (next-events [e next] next)
+  (gen-event [cdata]
+    (Event. :cdata nil nil (:content cdata)))
+  (next-events [_ next-items]
+    next-items)

   Comment
-  (gen-event [e]
-    (Event. :comment nil nil (:content e)))
-  (next-events [e next] next)
+  (gen-event [comment]
+    (Event. :comment nil nil (:content comment)))
+  (next-events [_ next-items]
+    next-items)

   nil
-  (gen-event [e] (Event. :chars nil nil ""))
-  (next-events [e next] next))
-
-(defn flatten-tree [elements]
+  (gen-event [_]
+    (Event. :chars nil nil ""))
+  (next-events [_ next-items]
+    next-items))
+
+(defn flatten-elements [elements]
   (when (seq elements)
     (lazy-seq
      (let [e (first elements)]
        (cons (gen-event e)
-             (flatten-tree (next-events e (rest elements))))))))
+             (flatten-elements (next-events e (rest elements))))))))

 (defn element [tag & [attrs & content]]
   (Element. tag (or attrs {}) (remove nil? content)))
@@ -321,7 +332,7 @@
       (check-stream-encoding stream (or (:encoding opts) "UTF-8")))

     (.writeStartDocument writer (or (:encoding opts) "UTF-8") "1.0")
-    (doseq [event (flatten-tree [e])]
+    (doseq [event (flatten-elements [e])]
       (emit-event event writer))
     (.writeEndDocument writer)
     stream))


Fix repl namespace checking

Fix repl namespace checking

--- src/main/clojure/vimclojure/nails.clj
+++ src/main/clojure/vimclojure/nails.clj
@@ -225,7 +225,7 @@
   "Usage: ng vimclojure.nails.Repl [options]"
   [[id i "The id of the repl to act on."]]
   (let [id (Integer/parseInt id)]
-    (get (get @repl/*repls* :id {:ns "user"}) :ns)))
+    (get (get @repl/*repls* id {:ns "user"}) :ns)))

 (defnail CheckSyntax
   "Usage: ng vimclojure.nails.CheckSyntax"


add default option for per-org email preferences

Fix small bug

--- src-cljs/frontend/components/account.cljs
+++ src-cljs/frontend/components/account.cljs
@@ -386,13 +386,17 @@
             [:h3 "Notified email"]
             [:select.form-control
              {:on-change #(let [val (-> % .-target .-value)
-                                args {:email val}]
+                                args {:email (if (= "Default" val)
+                                               nil
+                                               val)}]
                             (raise! owner [:org-preferences-updated {:org selected-org
                                                                      :prefs args}]))
-              :value (get-in user (-> [:organizations]
-                                      (into selected-org)
-                                      (conj :email)))}
-             (for [email (:all_emails user)]
+              :value (if-let [selected-email (get-in user (-> [:organizations]
+                                                              (into selected-org)
+                                                              (conj :email)))]
+                       selected-email
+                       "Default")}
+             (for [email (cons "Default" (:all_emails user))]
                [:option
                 {:value email}
                 email])]]


make overlay menu work for whats this info

--- src-cljs/frontend/components/overlay.cljs
+++ src-cljs/frontend/components/overlay.cljs
@@ -20,44 +20,36 @@
     (render [_]
       (let [cast! (om/get-shared owner :cast!)]
         (html
-          [:figure.overlay-info {:on-click #(cast! :overlay-info-toggled)}
-           [:div.overlay-background]
-           [:a.overlay-close {:role "button"}
-            (common/icon :times)]
-           [:article {:on-click #(.stopPropagation %)}
-            [:h1 "What's this?"]
+          [:div.menu-prompt {:class (str "menu-prompt-" "info")}
+           [:div.menu-header
+            [:a.menu-close {:on-click #(cast! :overlay-closed)
+                            :role "button"}
+             (common/icon :times)]]
+           [:div.menu-prompt-body
+            [:h2 "What is Precursor?"]
             [:p
-             "Precursor is a no-nonsense prototyping tool—"
-             "use it for sketching, rapid prototyping, and team brainstorming. "
+             "No-nonsense prototyping—"
+             "Perfect for wireframing, sketching, and brainstorming. "
              [:a {:on-click #(cast! :invite-link-clicked)
                   :role "button"
                   :title "In chat, type \"/invite their@email.com\""}
-              "Invite your team"]
-             " and everyone can collaborate in the same document, instantly. "
-             " We're still pretty new, so if you have feedback or a great idea sketch it up and ping "
-             [:a {:on-click #(cast! :chat-link-clicked)
-                  :role "button"
-                  :title "Start any chat with \"@prcrsr\" and we'll see it."}
-              "@prcrsr"]
-             " in the chat, or say "
+              "Invite"]
+             " a teammate and collaborate instantly. "
+             " We just got started, so if you have feedback say "
              [:a {:href "mailto:hi@prcrsr.com?Subject=I%20have%20feedback"
                   :title "We love feedback, good or bad."}
               "hi@prcrsr.com"]]
-            [:div.info-buttons
-             [:button.info-okay {:on-click #(cast! :overlay-info-toggled)}
-              "Okay, sounds good."]
-             ;; TODO ab test this ".info-twitter" link with the the current one below -dk
-             ;; [:a.info-twitter {:href "https://twitter.com/prcrsr_app"
-             ;;                   :on-click #(analytics/track "Twitter link clicked" {:location "info overlay"})
-             ;;                   :data-top "Tell us what to add next."
-             ;;                   :target "_blank"}
-             ;;   (common/icon :twitter)]
-             [:p [:a.info-twitter {:href "https://twitter.com/prcrsr_app"
+            [:a.prompt-button {:on-click #(cast! :overlay-info-toggled)
+                               :role "button"}
+             "Okay"]]
+           [:div.menu-footer
+            [:p
+             [:a.menu-footer-link {:href "https://twitter.com/prcrsr_app"
                                    :on-click #(analytics/track "Twitter link clicked" {:location "info overlay"})
                                    :title "On Twitter"
                                    :target "_blank"}
-               "Tell us what to add next."]]]]
-           (common/mixpanel-badge)])))))
+              "Tell us what to add next."]]
+            (common/mixpanel-badge)]])))))

 (defn shortcuts [app owner]
   (reify


keyboard shortcuts for windows

keyboard shortcuts for windows

--- src-cljs/frontend/components/overlay.cljs
+++ src-cljs/frontend/components/overlay.cljs
@@ -25,6 +25,7 @@
             [goog.dom.Range]
             [goog.dom.selection]
             [goog.labs.userAgent.browser :as ua]
+            [goog.userAgent]
             [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true])
   (:require-macros [sablono.core :refer (html)])
@@ -577,8 +578,9 @@
 (defn shortcuts [app owner]
   (reify
     om/IDisplayName (display-name [_] "Overlay Shortcuts")
-    om/IRender
-    (render [_]
+    om/IInitState (init-state [_] {:mac? goog.userAgent/MAC})
+    om/IRenderState
+    (render-state [_ {:keys [mac?]}]
       (let [cast! (om/get-shared owner :cast!)]
         (html
          [:section.menu-view
@@ -629,19 +631,25 @@
              [:tr.make
               [:td
                [:div.shortcuts-keys
-                [:div.shortcuts-key {:title "Command Key"} (common/icon :command)]
+                (if mac?
+                  [:div.shortcuts-key {:title "Command Key"} (common/icon :command)]
+                  [:div.shortcuts-key {:title "Control Key"} "Ctrl"])
                 [:div.shortcuts-key {:title "C Key"} "C"]]]
               [:td [:div.shortcuts-result {:title "Hold command, press \"C\"."} "Copy"]]]
              [:tr.make
               [:td
                [:div.shortcuts-keys
-                [:div.shortcuts-key {:title "Command Key"} (common/icon :command)]
+                (if mac?
+                  [:div.shortcuts-key {:title "Command Key"} (common/icon :command)]
+                  [:div.shortcuts-key {:title "Control Key"} "Ctrl"])
                 [:div.shortcuts-key {:title "V Key"} "V"]]]
               [:td [:div.shortcuts-result {:title "Hold command, press \"V\"."} "Paste"]]]
              [:tr.make
               [:td
                [:div.shortcuts-keys
-                [:div.shortcuts-key {:title "Command Key"} (common/icon :command)]
+                (if mac?
+                  [:div.shortcuts-key {:title "Command Key"} (common/icon :command)]
+                  [:div.shortcuts-key {:title "Control Key"} "Ctrl"])
                 [:div.shortcuts-key {:title "Z Key"} "Z"]]]
               [:td [:div.shortcuts-result {:title "Hold command, press \"Z\"."} "Undo"]]]
              ;;
@@ -652,7 +660,9 @@
              [:tr.make
               [:td
                [:div.shortcuts-keys
-                [:div.shortcuts-key  {:title "Option Key"} (common/icon :option)]
+                (if mac?
+                  [:div.shortcuts-key  {:title "Option Key"} (common/icon :option)]
+                  [:div.shortcuts-key  {:title "Alt Key"} "Alt"])
                 [:div.shortcuts-misc {:title "Scroll Wheel"} (common/icon :scroll)]]]
               [:td [:div.shortcuts-result {:title "Hold option, scroll."} "Zoom"]]]
              [:tr.make
@@ -681,16 +691,17 @@
              [:tr.make
               [:td
                [:div.shortcuts-keys
-                [:div.shortcuts-key  {:title "Option Key"} (common/icon :option)]
+                (if mac?
+                  [:div.shortcuts-key  {:title "Option Key"} (common/icon :option)]
+                  [:div.shortcuts-key  {:title "Alt Key"} "Alt"])
                 [:div.shortcuts-misc {:title "Left Click + Drag"} (common/icon :click)]]]
               [:td [:div.shortcuts-result {:title "Hold option, drag shape(s)."} "Duplicate"]]]
              [:tr.make
               [:td
                [:div.shortcuts-keys
-                [:div.shortcuts-key {:title "Control Key"} (common/icon :control)]
-                [:div.shortcuts-key {:title "Shift Key"} (common/icon :shift)]
+                [:div.shortcuts-key {:title "A key"} "A"]
                 [:div.shortcuts-misc {:title "Left Click + Drag"} (common/icon :click)]]]
-              [:td [:div.shortcuts-result {:title "Hold control & shift, drag shape."} "Connect"]]]
+              [:td [:div.shortcuts-result {:title "Hold A, click shape borders."} "Connect"]]]
              ]]]])))))

 (defn username [app owner]


simpler get component fn

simpler get component fn

--- src-cljs/frontend/components/overlay.cljs
+++ src-cljs/frontend/components/overlay.cljs
@@ -733,6 +733,9 @@
     (keyword (namespace overlay-key))
     overlay-key))

+(defn get-component [overlay-key]
+  (get overlay-components (overlay-component-key overlay-key)))
+
 (defn overlay [app owner]
   (reify
     om/IDisplayName (display-name [_] "Overlay")
@@ -743,7 +746,7 @@
          [:div.menu
           [:div.menu-header
            (for [overlay-key (get-in app state/overlays-path)
-                 :let [component (get overlay-components (overlay-component-key overlay-key))]]
+                 :let [component (get-component overlay-key)]]
              (html
               [:h4.menu-heading {:title (:title component) :react-key (:title component)}
                (if (namespaced? overlay-key)
@@ -751,7 +754,7 @@
                  (:title component))]))]
           [:div.menu-body
            (for [overlay-key (get-in app state/overlays-path)
-                 :let [component (get overlay-components (overlay-component-key overlay-key))]]
+                 :let [component (get-component overlay-key)]]
              (om/build (:component component) app {:react-key overlay-key
                                                    :opts {:submenu (when (namespaced? overlay-key)
                                                                      (keyword (name overlay-key)))}}))]])))))


Browser opens localhost if host 0.0.0.0

Browser opens localhost if host 0.0.0.0

--- src/leiningen/ring/run_server.clj
+++ src/leiningen/ring/run_server.clj
@@ -49,7 +49,7 @@
   (let [connector (first (.getConnectors server))
         host      (or (.getHost connector) "0.0.0.0")
         port      (.getPort connector)
-        url-host  (if (= host "0.0.0.0") "127.0.0.1" host)]
+        url-host  (if (= host "0.0.0.0") "localhost" host)]
     (println "Started server on port" port)
     (when-not (or headless? (= environment "production"))
       (browse-url (str "http://" url-host ":" port)))))


Fixed a bad comment

Fixed a bad comment

--- src/engulf/url_worker.clj
+++ src/engulf/url_worker.clj
@@ -9,7 +9,7 @@
   (:import java.util.concurrent.Executors
            java.util.concurrent.ExecutorService))

-; Run callbacks in a cached thread pool for maximum throughput
+; Run callbacks in a thread pool for maximum throughput
 (def ^ExecutorService callback-pool (Executors/newFixedThreadPool 2))

 (defprotocol BenchmarkWorkable


CLJS-1263: :libs regression, can no longer specify specific files

fix lib-rel-path so it handles specific file references correctly

--- src/main/clojure/cljs/closure.clj
+++ src/main/clojure/cljs/closure.clj
@@ -1133,9 +1133,9 @@
                  0)})))))))

 (defn lib-rel-path [{:keys [lib-path url] :as ijs}]
-  (let [path (util/path url)]
-    (if (.endsWith path ".js")
-      (util/get-name url)
+  (if (.endsWith lib-path ".js")
+    (util/get-name url)
+    (let [path (util/path url)]
       (string/replace
         path
         (str (io/file (System/getProperty "user.dir") lib-path) File/separator)


added some docs

added some docs

--- src/cards/untangled/components/forms.cljs
+++ src/cards/untangled/components/forms.cljs
@@ -1,7 +1,7 @@
 (ns untangled.components.forms
   (:require-macros
     [untangled.client.cards :refer [untangled-app]]
-    [devcards.core :as dc :refer [defcard]])
+    [devcards.core :as dc :refer [defcard defcard-doc]])
   (:require [clojure.string :as str]
             [om.dom :as dom]
             [om.next :as om :refer [defui]]
@@ -94,7 +94,7 @@
         (when person
           (ui-person-form person))))))

-(defmethod m/mutate 'sample/add-phone [{:keys [state]} k {:keys [id person]}]
+(defn add-phone-mutation [{:keys [state]} k {:keys [id person]}]
   {:action (fn []
              (let [new-phone (uc/initial-state PhoneForm {:db/id id :phone/type :home :phone/number ""})
                    person-ident [:people/by-id person]
@@ -102,6 +102,98 @@
                (swap! state assoc-in phone-ident new-phone)
                (uc/integrate-ident! state phone-ident :append (conj person-ident :person/phone-numbers))))})

+(defmethod m/mutate 'sample/add-phone [e k p] (add-phone-mutation e k p))
+
+(defcard-doc
+  "# Forms
+
+   Generic form support is a primary rapid appliation development feature. Fortunately, the overall structure of Om Next
+   and Untangled makes it relatively simple to write form support in a general-purpose, composeable manner. In fact,
+   just a few simple functions make it possible to support:
+
+   - An extensible form field set
+   - Extensible validation
+   - Declarative forms
+   - Separation of form UI from form logic
+   - Remote integration with form <-> entity
+   - Local integration with entities in the browser database
+
+   In the following examples, the following requires are needed:
+
+   ```
+   (ns your-ns
+     (:require
+       [om.dom :as dom]
+       [om.next :as om :refer [defui]]
+       [untangled.i18n :refer [tr]]
+       [untangled.components.ui.forms :as f]
+       [untangled.client.core :as uc]
+       [untangled.client.mutations :as m]))
+   ```
+
+  # Form Fields
+
+  Form fields are most conveniently declared on the ui component that will render the form. For example, say we
+  want to be able to render a form to edit a phone number:
+
+  "
+  (dc/mkdn-pprint-source PhoneForm)
+  "
+
+  The `f/id-field` form field is a special form field that you normally do not render, but it marks the field on the
+  entity that represents the unique (server) identity of the object. The other form-field types represent abstract
+  form elements that can be rendered.
+
+  Also take special note of the query. It **must** include `:ui/form`, which will pull in the special data needed
+  by the form logic. Also note the call in `InitialAppState` to `f/build-form`. This build function is responsible
+  for creating the initial state of any component that wishes to act as a form.
+
+  Field rendering itself is done by the `f/form-field` multimethod. However, this method renders *only* the input. It
+  does not render a lable, set classes, etc. Therefore, you will usually want to write your own wrapper function that
+  can be used to lay out exactly how you want a form field to look. For example:
+
+  "
+  (dc/mkdn-pprint-source field-with-label)
+  "
+  You see here that there are a number of helper functions that can be used to check things like if the value of the
+  field is currently invalid.
+
+  ## Validation
+
+  - Runs on blur
+  - Can be triggered for the whole form
+
+  ## State Evolution
+
+  A form will initially have the field values set to the entity state (passed to `build-form`). As you interact with
+  the form, the form fields change, but the entity itself does not update in the database table. This allows you to:
+
+  - Reset the form from the entity (optionally triggering a (re)read from the server)
+  - Commit the form changes to the entity (local and optionally remote)
+
+  ## Composition
+
+  Forms can be easily composed. They are UI components, and have nothing special about them other than the `:ui/form`
+  state that is added to the entity (though your call of `build-form`). You can convert any entity in your database
+  to a form using the `build-form` function, meaning that you can load entities as normal, and as you want to edit them
+  in a form, simple mutate them into form-compatible entities with `build-form` (which will not touch the original
+  properties of the entity, just add `:ui/form`). Then render them with a UI component that shares your entity Ident,
+  but has a render method that renders the form fields with `form-field`.
+
+  Here is the source for an application that renders a Person form, where the person can have any nubmer of phone numbers,
+  each represented by a nested phone number entity/form. Note the use of `InitialAppState` in Root to build out sample
+  data.
+  "
+  (dc/mkdn-pprint-source PhoneForm)
+  (dc/mkdn-pprint-source PersonForm)
+  (dc/mkdn-pprint-source Root)
+  "
+
+  Adding a phone number is done via the add phone mutation, which looks like this:
+  "
+  (dc/mkdn-pprint-source add-phone-mutation)
+  )
+
 (defcard sample-form-1
   "This card shows a very simple form in action."
   (untangled-app Root)


adjust socket sleep time

adjust socket sleep time

--- src/clj/battlebots/controllers/socket.clj
+++ src/clj/battlebots/controllers/socket.clj
@@ -87,7 +87,7 @@
          ;; Pass the next round and sleep the thread in between each
          :else
          (do
-           (Thread/sleep 40) ;; TODO Once client side rendering has improved, adjust this value
+           (Thread/sleep 200) ;; TODO Once client side rendering has improved, adjust this value
            (chsk-send! uid [:game/display-round (nth (:rounds current-segment) current-round)])
            (recur current-segment next-segement (inc current-round))))))))


Pull chart sizing into constants

Pull chart sizing into constants

--- src/cljs/load_test_om/hit_rate_chart.cljs
+++ src/cljs/load_test_om/hit_rate_chart.cljs
@@ -2,6 +2,13 @@
   (:require [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]
             [load-test-om.utils :as utils]))
+
+(def width 446)
+(def height 150)
+(def top 20)
+(def right 10)
+(def bottom 30)
+(def left 30)

 (defn draw-points [el scales axes data]
   (let [svg (.select (.select js/d3 el) "svg")
@@ -24,7 +31,7 @@
         (.datum (apply array datum))
         (.attr "d" line))))

-(defn get-scales [domain width height]
+(defn get-scales [domain]
   {:x (-> (.. js/d3 -time scale)
           (.domain (apply array (:x domain)))
           (.range #js [0 width]))
@@ -47,9 +54,7 @@
    :y (min-max (map :y data))})

 (defn update-chart [el data]
-  (let [width 446
-        height 150
-        scales (get-scales (domain data) width height)
+  (let [scales (get-scales (domain data))
         axes   (get-axes scales)]
     (draw-points el scales axes data)))

@@ -71,19 +76,13 @@

     om/IRender
     (render [_]
-      (let [width 446
-            height 150
-            top 20
-            right 10
-            bottom 30
-            left 30]
-        (dom/div #js {:className "chart hit-rate-chart"}
-                 (dom/svg #js {:className "d3"
-                               :width (+ width left right)
-                               :height (+ height top bottom)}
-                          (dom/g #js {:transform (str "translate(" left "," top ")")}
-                                 (dom/g #js {:className "x axis"
-                                             :transform (str "translate(0, " height ")")})
-                                 (dom/g #js {:className "y axis"}
-                                        (dom/text #js {:transform "rotate(-90)"}))
-                                 (dom/path #js {:className "line"}))))))))
+      (dom/div #js {:className "chart hit-rate-chart"}
+               (dom/svg #js {:className "d3"
+                             :width (+ width left right)
+                             :height (+ height top bottom)}
+                        (dom/g #js {:transform (str "translate(" left "," top ")")}
+                               (dom/g #js {:className "x axis"
+                                           :transform (str "translate(0, " height ")")})
+                               (dom/g #js {:className "y axis"}
+                                      (dom/text #js {:transform "rotate(-90)"}))
+                               (dom/path #js {:className "line"})))))))


Set uploaded file to profile picture in edit profile view

--- src/cljs/salava/user/ui/edit_profile.cljs
+++ src/cljs/salava/user/ui/edit_profile.cljs
@@ -24,7 +24,7 @@
                  :fields             profile-fields}
        :handler (fn [] (navigate-to (str "/user/profile/" (:user_id @state))))})))

-(defn send-file [files-atom]
+(defn send-file [files-atom profile-picture-atom]
   (let [file (-> (.querySelector js/document "#profile-picture-upload")
                  .-files
                  (.item 0))
@@ -36,8 +36,9 @@
       "/obpv1/file/upload"
       {:body    form-data
        :handler (fn [{:keys [status message reason data]} response]
-                  (if (= status "success")
-                    (reset! files-atom (conj @files-atom data)))
+                  (when (= status "success")
+                    (reset! files-atom (conj @files-atom data))
+                    (reset! profile-picture-atom (:path data)))
                   (m/modal! (file/upload-modal status message reason)))})))

 (defn gallery-element [picture-data profile-picture-atom]
@@ -62,7 +63,7 @@
     [:input {:id "profile-picture-upload"
              :type "file"
              :name "file"
-             :on-change #(send-file pictures-atom)
+             :on-change #(send-file pictures-atom profile-picture-atom)
              :accept "image/*"}]]])

 (def empty-field {:field "" :value ""})


Revert "CMR-183: Updated funciton name"

Revert "CMR-183: Updated funciton name"

This reverts commit c005f8145f2e2a33e4c321b90e532e6b944eba38.

--- src/cmr/indexer/data/concepts/granule.clj
+++ src/cmr/indexer/data/concepts/granule.clj
@@ -30,7 +30,7 @@
 (defn- fetch-parent-collection
   "Retrieve the parent collection umm from the db"
   [context parent-collection-id]
-  (let [parent-collection-cache (cache/cache->context context parent-collection-cache-key)
+  (let [parent-collection-cache (cache/cache-from-context context parent-collection-cache-key)
         concept (mdb/get-latest-concept context parent-collection-id)]
     (assoc (umm/parse-concept concept) :concept-id parent-collection-id)))


[#1656] Fix entities dissapeared after changing filter value

--- backend/src/akvo/lumen/lib/dashboard.clj
+++ backend/src/akvo/lumen/lib/dashboard.clj
@@ -118,7 +118,7 @@
       (db.dashboard/update-dashboard tx {:id id
                             :title (:title spec)
                             :spec (assoc texts :filter (or (:filter spec) empty-filter))})
-      (db.dashboard/delete-dashboard_visualisation tenant-conn {:dashboard-id id})
+      (db.dashboard/delete-dashboard_visualisation tx {:dashboard-id id})
       (doseq [visualisation-entity (:entities visualisations)]
         (let [visualisation-id (:id visualisation-entity)
               visualisations-layout (first (filter #(= visualisation-id
@@ -127,8 +127,8 @@
           (db.dashboard/insert-dashboard_visualisation
            tx {:dashboard-id id
                :visualisation-id visualisation-id
-               :layout visualisations-layout}))))
-    (lib/ok (handle-dashboard-by-id tenant-conn id))))
+               :layout visualisations-layout})))
+      (lib/ok (handle-dashboard-by-id tx id)))))

 (defn delete [tenant-conn id]
   (db.dashboard/delete-dashboard_visualisation tenant-conn {:dashboard-id id})


Fix`donut` visualisation dispatching value

--- backend/src/akvo/lumen/lib/public_impl.clj
+++ backend/src/akvo/lumen/lib/public_impl.clj
@@ -76,7 +76,7 @@
         [dataset-tag dataset] (dataset/fetch tenant-conn dataset-id)
         [tag query-result] (aggregation/query tenant-conn
                                               dataset-id
-                                              "pie"
+                                              "donut"
                                               (:spec visualisation))]
     (when (and (= tag ::lib/ok)
                (= dataset-tag ::lib/ok))


Make our forked version of re-com use our forked version of reagent

--- src/day8/re_frame/trace/utils/re_com.cljs
+++ src/day8/re_frame/trace/utils/re_com.cljs
@@ -1,7 +1,7 @@
 (ns day8.re-frame.trace.utils.re-com
   "Shameless pilfered from re-com."
   (:require-macros [day8.re-frame.trace.utils.re-com :refer [handler-fn]])
-  (:require [reagent.ratom :as reagent :refer [RAtom Reaction RCursor Track Wrapper]]
+  (:require [mranderson047.reagent.v0v6v0.reagent.ratom :as reagent :refer [RAtom Reaction RCursor Track Wrapper]]
             [clojure.string :as string]))

 (defn px


Add tx-dialect

Add tx-dialect

--- src/fhofherr/clj_db_util/transactions.clj
+++ src/fhofherr/clj_db_util/transactions.clj
@@ -96,6 +96,11 @@
                         {::db db* ::value nil}))
                     {::db db ::value nil}))))

+(deftx tx-dialect
+  "Obtain the dialect currently in use."
+  [db]
+  (db-con/dialect db))
+
 (defn tx-exec
   "Execute the transaction `tx` in the database represented by `db-spec`. "
   [db tx]


Correct keyword used to expose the HttpServletResponse

Fixes #9

--- src/io/aviso/rook/jetty_async_adapter.clj
+++ src/io/aviso/rook/jetty_async_adapter.clj
@@ -16,7 +16,7 @@
       (let [request-map (-> (servlet/build-request-map request)
                             ;; The change:
                             (assoc ::http-servlet-request request
-                                                          :http-servlet-response response))
+                                                          ::http-servlet-response response))
             response-map (handler request-map)]
         (when response-map
           (servlet/update-servlet-response response response-map)


Change startdate/enddate to start/end.

Change startdate/enddate to start/end.

--- src/kixi/hecuba/weather/metoffice_api.clj
+++ src/kixi/hecuba/weather/metoffice_api.clj
@@ -26,10 +26,10 @@
 (defn run-data-pull [startdate-str enddate-str]
   (let [fmt (f/formatter "dd/MM/YYYY")
         timefmt (f/formatter "HH00")
-        startdate (f/parse fmt startdate-str)
-        stopdate (f/parse fmt enddate-str)]
-    (->> (tp/periodic-seq startdate (t/hours 1))
-         (take-while #(t/before? % (t/minus stopdate (t/days 1))))
+        start (f/parse fmt startdate-str)
+        end (f/parse fmt enddate-str)]
+    (->> (tp/periodic-seq start (t/hours 1))
+         (take-while #(t/before? % (t/minus end (t/days 1))))
          (map #(pull-data (f/unparse fmt %) (f/unparse timefmt %)))
          doall)))


make the request-access button slide in

make the request-access button slide in

--- src-cljs/frontend/components/document_access.cljs
+++ src-cljs/frontend/components/document_access.cljs
@@ -58,10 +58,11 @@
                   You can try to request access or even "
                   [:a {:href "/new"} "create your own"]
                   " document."]
-                 [:a.menu-cta
-                  {:on-click #(cast! :permission-requested {:doc-id doc-id})
-                   :role "button"}
-                  "Request Access"]))
+                 [:div.make
+                  [:a.menu-cta
+                   {:on-click #(cast! :permission-requested {:doc-id doc-id})
+                    :role "button"}
+                   "Request Access"]]))

              (list
                [:p.make


more readable now

more readable now

--- src/midje/ideas/metaconstants.clj
+++ src/midje/ideas/metaconstants.clj
@@ -102,12 +102,11 @@

 (defn metaconstant-for-form [[function-symbol & _ :as inner-form]]
   (let [swap-fn (fn [current-value function-symbol]
-                  (if (current-value function-symbol)
-                    (assoc current-value function-symbol
-                           (inc (current-value function-symbol)))
+                  (if-let [cur-val (current-value function-symbol)]
+                    (assoc current-value function-symbol (inc cur-val))
                     (assoc current-value function-symbol 1)))
         number ((swap! *metaconstant-counts* swap-fn function-symbol)
-                function-symbol)]
+                  function-symbol)]
     (symbol (format "...%s-value-%s..." (name function-symbol) number))))


send datoms in batches

send datoms in batches

--- src-cljs/frontend/core.cljs
+++ src-cljs/frontend/core.cljs
@@ -219,8 +219,10 @@
     (d/listen! (:db @state)
                (fn [tx-report]
                  (when (not-any? #(= (:a %) :server/update) (-> tx-report :tx-data)) ;; hack to prevent loops
-                   (sente/send-msg (:sente @state) [:frontend/transaction {:datoms (->> tx-report :tx-data (mapv ds/datom-read-api))
-                                                                           :document/id (:document/id @state)}]))))
+                   (let [datoms (->> tx-report :tx-data (mapv ds/datom-read-api))]
+                     (doseq [datom-group (partition-all 500 datoms)]
+                       (sente/send-msg (:sente @state) [:frontend/transaction {:datoms datom-group
+                                                                               :document/id (:document/id @state)}]))))))

     (js/document.addEventListener "keydown" handle-key-down false)
     (js/document.addEventListener "keyup" handle-key-up false)


BIGFIX: Fixed the resource directory extration from downloaded jar.

--- storm-core/src/clj/backtype/storm/daemon/supervisor.clj
+++ storm-core/src/clj/backtype/storm/daemon/supervisor.clj
@@ -470,7 +470,7 @@
       (Utils/downloadFromMaster conf master-meta-file-path supervisor-meta-file-path)
       (if (:bt-tracker supervisor)
         (.download (:bt-tracker supervisor) storm-id (File. supervisor-meta-file-path)))
-      (extract-dir-from-jar (supervisor-stormjar-path stormroot) RESOURCES-SUBDIR stormroot)
+      (extract-dir-from-jar (supervisor-stormjar-path tmproot) RESOURCES-SUBDIR tmproot)
       (if (.exists (File. stormroot)) (FileUtils/forceDelete (File. stormroot)))
       (FileUtils/moveDirectory (File. tmproot) (File. stormroot))
       ))


fix typo

fix typo

--- src/sybil_graph/models/poweriteration.clj
+++ src/sybil_graph/models/poweriteration.clj
@@ -1,4 +1,4 @@
-(ns sybil_graph.models.powerit
+(ns sybil_graph.models.poweriteration
   (:require [clojurewerkz.neocons.rest        :as nr]
             [clojurewerkz.neocons.rest.cypher :as cy]
             [sybil_graph.models.neo4j         :as neo4j]))


Remove unused :description from snapshot schema.

--- src/open_company/resources/common.clj
+++ src/open_company/resources/common.clj
@@ -131,7 +131,6 @@
   (merge {:company-slug Slug
           :slug schema/Str ; slug of the update, made from the slugified title and a short UUID
           :name schema/Str
-          :description schema/Str
           (schema/optional-key :logo) schema/Str
           (schema/optional-key :logo-width) schema/Int
           (schema/optional-key :logo-height) schema/Int


Work on defcgen...

Work on defcgen...

 * Properly handle cgens with no parameters.
 * Don't use #'make-expanding if there are no expandable parameters.

--- src/overtone/sc/machinery/defcgen.clj
+++ src/overtone/sc/machinery/defcgen.clj
@@ -87,7 +87,7 @@
 (defn- mk-cgen-fn
   "Make the function which gets executed when a cgen is called."
   [params body]
-  (let [expand-flags (map #(:expands? %) params)
+  (let [expand-flags (map #(or (:expands? %) false) params)
         param-names  (vec (map :name params))
         defaults     (reduce (fn [s el] (assoc s (:name el) (:default el)))
                              {}
@@ -98,13 +98,16 @@
                                (conj final (get sym-gensyms (symbol (name param))) `(get (arg-mapper ~arg-sym ~param-names ~defaults) ~param)))
                              []
                              param-names)
-        body         (walk/prewalk-replace sym-gensyms body )]
-    `(make-expanding
-      (fn [& ~arg-sym]
-        (let [~@bindings]
-          (with-overloaded-ugens
-            ~body)))
-      (quote ~expand-flags))))
+        body         (walk/prewalk-replace sym-gensyms body )
+        cgen-fn      `(fn [& ~arg-sym]
+                        (let [~@bindings]
+                          (with-overloaded-ugens
+                            ~body)))]
+
+    (if (or (empty? params)
+            (not-any? true? expand-flags))
+      cgen-fn
+      `(make-expanding ~cgen-fn (quote ~expand-flags)))))

 (defn generate-full-cgen-doc
   "Generate a full docstring from a the specified cgen information"


Some listing.

Some listing.

--- src/cljs/wombats_web_client/panels/game_play.cljs
+++ src/cljs/wombats_web_client/panels/game_play.cljs
@@ -64,20 +64,18 @@
                                     :show-overlay true}])))

 (defn- get-transition-text
-  [{:keys [:game/frame
-           :game/round-intermission
+  [{:keys [:game/round-intermission
            :game/start-time
-           :game/status]} cmpnt-state]
-  (let [{:keys [:frame/round-start-time
-                :frame/round-number]} frame
-        millis-left (* (time/seconds-until (if round-start-time
-                                             round-start-time
-                                             start-time))
+           :game/status]
+    {:keys [:frame/round-number
+            :frame/round-start-time]} :game/frame}
+   cmpnt-state]
+  (let [millis-left (* (time/seconds-until (or round-start-time
+                                               start-time))
                        1000)
-        timeout-fn (fn [timeout]
-                     (js/console.log "TRANSITION FN")
+        timeout-fn (fn [ms]
                      (js/setTimeout #(swap! cmpnt-state update-in [:update] not)
-                                    timeout))]
+                                    ms))]

     ;; Force a rerender when the transition-text should change
     (when (or (= status :active-intermission)
@@ -104,13 +102,13 @@
                                       millis-left)
               transition-time-left (- 3000 time-since-round-end)]
           (if (and (> round-number 1)
-                   (> transition-time-left 0))
+                   (pos? transition-time-left))
             (do
               (timeout-fn transition-time-left)
-              (str "ROUND " (- round-number 1) " OVER"))
+              (str "ROUND " (dec round-number) " OVER"))
             (do
               ;; This is when we need to transition to showing "READY"
-              (when (> (- millis-left 3000) 0)
+              (when (pos? (- millis-left 3000))
                 (timeout-fn (- millis-left 3000)))
               nil)))))))


Put benchmarking code in a (comment)

Put benchmarking code in a (comment)

--- dev/cljs/asciinema/player/dev.cljs
+++ dev/cljs/asciinema/player/dev.cljs
@@ -135,14 +135,18 @@

 ;; (compare "21195.json" 1)

-;; (go
-;;   (let [asciicast-filename "20055.json"
-;;         v1-url (str "/asciicasts/" asciicast-filename)]
-;;     (def v1-json (<! (fetch-json v1-url)))))
+(comment

-;; (go
-;;   (let [v1-frames (v1/build-v1-frames v1-json)]
-;;     (time (last (take 500 v1-frames)))))
+  (go
+    (let [asciicast-filename "20055.json"
+          v1-url (str "/asciicasts/" asciicast-filename)]
+      (def v1-json (<! (fetch-json v1-url)))))
+
+  (go
+    (let [v1-frames (v1/build-v1-frames v1-json)]
+      (time (last v1-frames))))
+
+)

 ;; (let [v1-frames (p/build-v1-frames v1-json)]
 ;;   (-> v1-frames (nth 45) last p/vt->frame :lines vec (nth 13) ffirst))


откатил версию либы d3 до 3.5.16-0

откатил версию либы d3 до 3.5.16-0

--- radiolamp-6P3S/project.clj
+++ radiolamp-6P3S/project.clj
@@ -7,5 +7,5 @@
                  [com.cognitect/transit-cljs "0.8.239"]
                  [org.omcljs/om "0.9.0"]
                  [secretary "1.2.3"]
-                 [cljsjs/d3 "4.2.2-0"]
+                 [cljsjs/d3 "3.5.16-0"]
                  [markdown-clj "0.9.89"]])


add async test

add async test

--- src/leiningen/new/reagent_liveedit/core_test.cljs
+++ src/leiningen/new/reagent_liveedit/core_test.cljs
@@ -1,6 +1,6 @@
 (ns {{ns-name}}.core-test
   (:require-macros [{{ns-name}}.test-macros :refer [defdomtest defdom]])
-  (:require [cemerick.cljs.test :as t :refer-macros [is deftest]]
+  (:require [cemerick.cljs.test :as t :refer-macros [is deftest done]]
             [dommy.core         :as dommy :refer-macros [sel sel1]]
             [reagent.core       :as r]
             [{{ns-name}}.core        :as {{ns-name}}]
@@ -15,6 +15,14 @@
 (deftest trivial-error
   #_(is (1 = 1) "Don't do this!!!"))

+(deftest ^:async trivial-async-test
+  (let [now #(.getTime (js/Date.))
+        t (now)]
+    (js/setTimeout
+      (fn []
+        (is (>= (now) (+ t 10)))
+        (done))
+      10)))

 (defdomtest page1 {[:current-page] :page1}
   (is (= (some-> [:#main :h2] sel1 dommy/text)


Checkpoint

Checkpoint

Signed-off-by: Gregory Haskins <640d9fe47775e6723f0355b7315e38f7d98d3539@gmail.com>

--- src/obcc/build/golang.clj
+++ src/obcc/build/golang.clj
@@ -116,9 +116,11 @@
     ;; ensure the path exists
     (io/make-parents shimpath)

-    ;; and then emit our output
+    ;; emit our output
     (with-open [output (io/writer shimpath :truncate true)]
       (.write output shim))

     ;; generate protobuf output
-    (protoc protofile)))
+    (protoc protofile)
+
+    (println "Compilation complete")))


Story ID: RPC-236 Summary: Stacktraces are now only open/close -able by clicking on the error, not the stacktrace as well

--- src/untangled_spec/reporters/browser.cljs
+++ src/untangled_spec/reporters/browser.cljs
@@ -17,12 +17,15 @@
                      {:keys [folded?]} (om/get-state this)]
                  (dom/tr nil
                          (dom/td #js {:className "test-result-title"} title)
-                         (dom/td #js {:className "test-result"
-                                      :onClick #(om/update-state! this update :folded? not)}
+                         (dom/td #js {:className "test-result"}
                                  (dom/code nil
-                                           (when stack
-                                             (if folded? \u25BA \u25BC))
-                                           (str value)
+                                           (if stack
+                                             (dom/a #js {:href "#"
+                                                         :className "error"
+                                                         :onClick #(om/update-state! this update :folded? not)}
+                                                    (if folded? \u25BA \u25BC)
+                                                    (str value))
+                                             (str value))
                                            (when stack
                                              (dom/div #js {:className (if folded? "hidden" "stack-trace")}
                                                       stack))))))))
@@ -181,7 +184,7 @@
                                    #(om/transact! this `[(~'set-filter {:new-filter ~new-filter})]))]
                  (dom/section #js {:className "test-report"}
                               (ui-filters {:report/filter current-filter
-                                          :set-filter! set-filter!})
+                                           :set-filter! set-filter!})
                               (dom/ul #js {:className "test-list"}
                                       (mapv (comp ui-test-namespace
                                                   #(assoc % :report/filter current-filter))


Remove unused functions and annotate uses of deprecated functions

--- src/braid/client/store.cljs
+++ src/braid/client/store.cljs
@@ -60,9 +60,6 @@

 (def check-app-state! (s/validator AppState))

-(defn- key-by-id [coll]
-  (into {} (map (juxt :id identity)) coll))
-
 (defn transact! [v]
   (let [old-state @app-state]
     (reset! app-state v)
@@ -71,6 +68,7 @@
       (catch ExceptionInfo e
         (errorf "State consistency error: %s"
                 (:error (ex-data e)))
+        (println (ex-data e))
         (reset! app-state old-state)
         ; Not just calling display-error! to avoid possibility of infinite loop
         (swap! app-state update-in [:errors] conj
@@ -78,17 +76,15 @@

 ; GETTERS

+; used in handlers/extract-user-ids
+
 (defn all-users []
   (vals (get-in @app-state [:users])))

-(defn users-in-group [group-id]
-  (filter (fn [u] (contains? (set (u :group-ids)) group-id)) (vals (@app-state :users))))
-
-(defn users-in-open-group []
-  (users-in-group (@app-state :open-group-id)))
-
 (defn user-in-open-group? [user-id]
   (contains? (set (get-in @app-state [:users user-id :group-ids])) (@app-state :open-group-id)))
+
+; use in handlers/identify-mentions

 (defn nickname->user [nickname]
   (->> (get-in @app-state [:users])
@@ -97,29 +93,7 @@
        ; nicknames are unique, so take the first
        first))

-(defn valid-user-id? [user-id]
-  (some? (get-in @app-state [:users user-id])))
-
-(defn id->thread [thread-id]
-  (get-in @app-state [:threads thread-id]))
-
-(defn open-thread? [thread-id]
-  (contains? (set (get-in @app-state [:user :open-thread-ids])) thread-id))
-
-(defn pagination-remaining []
-  (get @app-state :pagination-remaining 0))
-
-(defn all-tags []
-  (vals (get-in @app-state [:tags])))
-
-(defn tags-in-group [group-id]
-  (filter #(= group-id (% :group-id)) (vals (@app-state :tags))))
-
-(defn tags-in-open-group []
-  (tags-in-group (@app-state :open-group-id)))
-
-(defn tag-in-open-group? [tag-id]
-  (= (get-in @app-state [:tags tag-id :group-id]) (@app-state :open-group-id)))
+; used in handlers/extract-tag-ids

 (defn name->open-tag-id
   "Lookup tag by name in the open group"
@@ -131,21 +105,40 @@
          first
          :id)))

-(defn get-tag [tag-id]
-  (get-in @app-state [:tags tag-id]))
+; used in autocomplete:
+
+(defn users-in-group [group-id]
+  (filter (fn [u] (contains? (set (u :group-ids)) group-id)) (vals (@app-state :users))))
+
+(defn users-in-open-group []
+  (users-in-group (@app-state :open-group-id)))
+
+(defn tags-in-group [group-id]
+  (filter #(= group-id (% :group-id)) (vals (@app-state :tags))))
+
+(defn tags-in-open-group []
+  (tags-in-group (@app-state :open-group-id)))
+
+(defn bots-in-open-group []
+  (get-in @app-state [:groups (get @app-state :open-group-id) :bots]))

 (defn is-subscribed-to-tag? [tag-id]
   (contains? (get-in @app-state [:user :subscribed-tag-ids]) tag-id))

-(defn open-group-name []
-  (let [st @app-state]
-    (get-in st [:groups (st :open-group-id) :name])))
+; used in views.message
+
+(defn valid-user-id? [user-id]
+  (some? (get-in @app-state [:users user-id])))
+
+(defn get-tag [tag-id]
+  (get-in @app-state [:tags tag-id]))
+
+; used in autocomplete and group_settings

 (defn id->group [group-id]
   (get-in @app-state [:groups group-id]))

-(defn bots-in-open-group []
-  (get-in @app-state [:groups (get @app-state :open-group-id) :bots]))
+; used in autocomplete and routes

 (defn open-group-id []
   (get @app-state :open-group-id))


Remove unnecessary nickname generation code

db/create-user! already generates the nickname based on email

--- src/braid/server/events.clj
+++ src/braid/server/events.clj
@@ -1,6 +1,5 @@
 (ns braid.server.events
   (:require
-    [clojure.string :as string]
     [clavatar.core :refer [gravatar]]
     [braid.server.crypto :refer [random-nonce]]
     [braid.server.db :as db]
@@ -9,18 +8,13 @@
 (defn register-user!
   [email group-id]
   (let [id (db/uuid)
-        ; XXX: copied from braid.common.util/nickname-rd
-        disallowed-chars #"[ \t\n\]\[!\"#$%&'()*+,.:;<=>?@\^`{|}~/]"
-        nick (-> (first (string/split email #"@"))
-                 (string/replace disallowed-chars ""))
         ; TODO: guard against duplicate nickname?
         u (db/create-user! {:id id
                             :email email
                             :password (random-nonce 50)
                             :avatar (gravatar email
                                       :rating :g
-                                      :default :identicon)
-                            :nickname nick})]
+                                      :default :identicon)})]
     (sync/user-join-group! id group-id)
     id))


Fix namespace invocations

Fix namespace invocations

--- src/braid/uploads/core.cljc
+++ src/braid/uploads/core.cljc
@@ -121,7 +121,7 @@
                       (let [thread-group-id (thread/thread-group-id (upload :thread-id))]
                         (or (nil? thread-group-id) (= thread-group-id (upload :group-id))))
                       (group/user-in-group? user-id (upload :group-id)))
-                (db/run-txns! (upload/create-upload-txn upload)))))
+                (db/run-txns! (db.uploads/create-upload-txn upload)))))

           :braid.server/delete-upload
           (fn [{:as ev-msg :keys [?data user-id ?reply-fn]}]
@@ -131,13 +131,13 @@
                 (when-let [path (s3/upload-url-path (:url upload))]
                   (s3/delete-upload path))
                 (db/run-txns!
-                  (upload/retract-upload-txn (:id upload))))))
+                  (db.uploads/retract-upload-txn (:id upload))))))

           :braid.server/uploads-in-group
           (fn [{:as ev-msg :keys [?data user-id ?reply-fn]}]
             (when ?reply-fn
               (if (group/user-in-group? user-id ?data)
-                (?reply-fn {:braid/ok (upload/uploads-in-group ?data)})
+                (?reply-fn {:braid/ok (db.uploads/uploads-in-group ?data)})
                 (?reply-fn {:braid/error "Not allowed"}))))})

        (core/register-private-http-route!