better way to handle saving points-to

better way to handle saving points-to

--- src/pc/http/datomic2.clj
+++ src/pc/http/datomic2.clj
@@ -37,13 +37,6 @@
   (if (= :session/uuid a)
     [type e a session-uuid]
     transaction))
-
-(defn coerce-points-to [document-id [type e a v :as transaction]]
-  (if (= :layer/points-to a)
-    [type e a [:frontend/id (UUID. document-id v)]]
-    transaction))
-
-

 (def incoming-whitelist
   #{:layer/name
@@ -94,15 +87,18 @@
                 {} txes)))

 (defn add-frontend-ids [document-id txes]
-  (:txes (reduce (fn [{:keys [txes eid-map]} [type e a v]]
-                   (if-let [temp-id (get eid-map e)]
-                     {:txes (conj txes [type temp-id a v])
-                      :eid-map eid-map}
-                     (let [temp-id (d/tempid :db.part/user)]
-                       {:txes (concat txes [[type temp-id a v]
-                                            [:db/add temp-id :frontend/id (UUID. document-id e)]])
-                        :eid-map (assoc eid-map e temp-id)})))
-                 {:txes [] :eid-map {}} txes)))
+  (let [eid-map (zipmap (set (map second txes)) (repeatedly #(d/tempid :db.part/user)))
+        frontend-id-txes (map (fn [[e tempid]] [:db/add tempid :frontend/id (UUID. document-id e)]) eid-map)]
+    (concat (map (fn [tx]
+                   (-> tx
+                     (update-in [1] eid-map)
+                     (#(if (= :layer/points-to (nth tx 2))
+                         (update-in % [3] (fn [e]
+                                            (or (get eid-map e)
+                                                [:frontend/id (UUID. document-id e)])))
+                         %))))
+                 txes)
+            frontend-id-txes)))

 ;; TODO: only let creators mark things as private
 ;; TODO: only let people on the white list make things as private
@@ -131,7 +127,6 @@
                             (map (partial coerce-uuids uuid-attrs))
                             (map (partial coerce-server-timestamp server-timestamp))
                             (map (partial coerce-session-uuid session-uuid))
-                            (map (partial coerce-points-to document-id))
                             (filter whitelisted?)
                             (remove-float-conflicts)
                             (add-frontend-ids (or document-id team-id))


Simplify spec form shown in error reports

--- src/pinpointer/core.cljc
+++ src/pinpointer/core.cljc
@@ -2,6 +2,7 @@
   (:require #?@(:clj ([clansi]))
             [clojure.spec.alpha :as s]
             [clojure.string :as str]
+            [clojure.walk :as walk]
             [fipp.clojure :as fipp]
             [pinpointer.printer :as printer]
             [pinpointer.trace :as trace]))
@@ -70,6 +71,14 @@
             (fn [problems] (map #(update % :path subvec 1) problems)))
     ed))

+(defn- simplify-spec [spec]
+  (walk/postwalk (fn [x]
+                   (if (and (symbol? x)
+                            (= (namespace x) "clojure.core"))
+                     (symbol (name x))
+                     x))
+                 spec))
+
 (defn pinpoint-out
   ([ed] (pinpoint-out ed {}))
   ([ed {:keys [colorize]}]
@@ -89,9 +98,10 @@
            (println "     Input:" line)
            (doseq [line lines]
              (println "          :" line))
-           (let [[line & lines] (-> (with-out-str
-                                      (fipp/pprint (:pred problem)))
-                                    (str/split #"\n"))]
+           (let [[line & lines] (as-> (:pred problem) it
+                                  (simplify-spec it)
+                                  (with-out-str (fipp/pprint it))
+                                  (str/split it #"\n"))]
              (println "  Expected:" line)
              (doseq [line lines]
                (println "           " line)))


Make server start automatically

Make server start automatically

--- src/poetshelper/core.clj
+++ src/poetshelper/core.clj
@@ -108,4 +108,6 @@
                       (respond-to-request request))})]

     (println "Starting server on port " port)
-    (httpkit/run-server poetshelper-server {:port port})))+    (httpkit/run-server poetshelper-server {:port port})))
+
+(start-server 8008)


Added liberator tracing to dev environment

--- src/qu/app/webserver.clj
+++ src/qu/app/webserver.clj
@@ -17,7 +17,8 @@
     [stacktrace :as dev-stacktrace]]
    [ring.util.response :as response]
    [taoensso.timbre :as log]
-   [org.httpkit.server :refer [run-server]]
+   [org.httpkit.server :refer [run-server]]
+   [liberator.dev :refer [wrap-trace]]
    [com.stuartsierra.component :as component]))

 (defn- wrap-cors
@@ -43,6 +44,7 @@
     (if (:dev webserver)
       (-> handler
           reload/wrap-reload
+          (wrap-trace :header :ui)
           dev-stacktrace/wrap-stacktrace-web)
       (-> handler
           prod-stacktrace/wrap-stacktrace-web))))


Working now with Element record instead of struct.

This is fine in isolation, but not as good for interoperability. I would be much happier if Element was defined in clojure.xml. I'm also not a fan of defining types for data unless you have to, but in this case I feed like I had to - consider the substitution ${x} in a template. I need to know whether x should be stringified, or treated as a chunk of XML. Previously I was doing that with (and (map? x) (:tag x)). Checking for Element is much cleaner, but means than non-Element XML (eg: returned from clojure.xml/parse) will not be treated as XML. Need to think about this some more, but for now it works as-is.

--- src/rapscallion/core.clj
+++ src/rapscallion/core.clj
@@ -112,7 +112,7 @@
 ;; compiles to
 ;;   (Element. :foo nil ["Hello " (xml-value name)])

-(defmulti xml-value (fn [x] (or (::type (meta x)) (type x))))
+(defmulti xml-value type)

 ;; The default is just to stringify the object.
 (defmethod xml-value :default [x]
@@ -121,6 +121,9 @@
 ;; Elements are inserted as-is.
 (defmethod xml-value xml/element-type [x]
   x)
+
+(defmethod xml-value clojure.lang.Sequential [x]
+  (map xml-value x))

 ;; This is a special case that handles "call-with-content".
 ;; Example:
@@ -140,7 +143,7 @@
 ;;   $(foo 23)
 ;;   <rap:call fn='foo'>...etc...</rap:call>
 ;;
-(defmethod xml-value :call-body [f]
+(defmethod xml-value ::call-body [f]
   (f))

@@ -240,7 +243,7 @@
   ([elt fn-and-args body]
     (compile-directive elt fn-and-args body nil))
   ([_ [f & args] body body-args]
-    `(~f ~@args (with-meta (fn [~@body-args] ~body) {::type :call-body}))))
+    `(~f ~@args (with-meta (fn [~@body-args] ~body) {:type ::call-body}))))

 (defn compile-element [elt]


notes that compile but dont run!

notes that compile but dont run!

--- src/doctopus/core.clj
+++ src/doctopus/core.clj
@@ -5,3 +5,25 @@
   "I don't do a whole lot ... yet."
   [& args]
   (println "Hello, World!"))
+
+
+(defn parse-a-doc
+  [some-local-path some-function some-output-path]
+  (some-function some-local-path some-output-path))
+
+(defn parse-markdown
+  [args]
+  (some-clojure-markdown-lib args))
+
+(defn parse-rst
+  [args]
+  (sh/exec-command "make html" args))
+
+(def a-configuration {:uri "/home/gastove/foo/my-hella-sweet-repo"
+                      :output-path "/who/knows"
+                      :documentation-type :markdown})
+
+(defmulti parse-documentation :documentation-type)
+
+(defmethod parse-documentation :markdown
+  [type & args])


Forgot to update process.versions when updating to newer electron

--- src/lt/objs/deploy.cljs
+++ src/lt/objs/deploy.cljs
@@ -157,8 +157,7 @@
   "Binary/electron version. The two versions are in sync since binaries updates
   only occur with electron updates."
   []
-  ;; Still identifies as old electron name until we use a recent electron version
-  (aget js/process.versions "atom-shell"))
+  (aget js/process.versions "electron"))

 (defui button [label & [cb]]
        [:div.button.right label]


Get database name optionally from environment variables

--- src/rmfu/persistance.clj
+++ src/rmfu/persistance.clj
@@ -9,7 +9,7 @@
             [environ.core :refer [env]])
   (:import org.bson.types.ObjectId))

-(defonce db-config {:name "rmfu"})
+(defonce db-config {:name (or (System/getenv "RMFU_DB") "rmfu")})

 (def conn (atom nil))


Really wanted chebyshev distance not manhattan distance

--- src/dungeon_crusade/common.clj
+++ src/dungeon_crusade/common.clj
@@ -7,11 +7,11 @@
 (timbre/refer-timbre)

-(defn manhattan-distance
+(defn chebyshev-distance
   "Manhattan distance between 2 points"
   [p1 p2]
-  (+ (Math/abs (- (:x p1) (:x p2)))
-     (Math/abs (- (:y p1) (:y p2)))))
+  (max (Math/abs (- (:x p1) (:x p2)))
+       (Math/abs (- (:y p1) (:y p2)))))

 (defn distance
   "Euclidean distance between 2 points"
@@ -23,7 +23,7 @@
 (defn farther-than?
   "Are the two points farther in distance than l?"
   [p1 p2 l]
-  (if (or (> (manhattan-distance p1 p2) l)
+  (if (or (> (chebyshev-distance p1 p2) l)
           (> (distance p1 p2) l))
     false
     true))


Example how to get actual configuration

Example how to get actual configuration

--- src/emender_jenkins/server.clj
+++ src/emender_jenkins/server.clj
@@ -8,5 +8,6 @@
     ;(config/load-all-configuration-options-if-necessary)
     ;(product-list/read-product-list-if-necessary config/load-product-list-from-database)
     ;(job-data-fetcher/load-books-if-necessary)
-    (println "request URI: " (request :uri)))
+    (println "Config: " (:configuration request))
+    (println "request URI: " (:uri request)))


Apparently 0 isn't falsey

Apparently 0 isn't falsey

--- src/exploud/redis.clj
+++ src/exploud/redis.clj
@@ -89,7 +89,7 @@

 (defn pause-registered?
   [application environment region]
-  (using-redis (car/sismember awaiting-pause-key (field-for application environment region))))
+  (pos? (using-redis (car/sismember awaiting-pause-key (field-for application environment region)))))

 (defn awaiting-pause
   []


Pass the production to path/all

Pass the production to path/all

--- src/mdr2/production.clj
+++ src/mdr2/production.clj
@@ -62,7 +62,7 @@
   (as-> production p
         (add-default-meta-data p)
         (db/insert! p)
-        (doseq [dir (path/all)] (fs/mkdirs dir))))
+        (doseq [dir (path/all p)] (fs/mkdirs dir))))

 (defn update-or-create!
   [production]
@@ -79,7 +79,7 @@
         ;; FIXME: shouldn't we update the DTBook XML when the meta
         ;; data is updated?
         (db/update-or-insert! p)
-        (doseq [dir (path/all)] (fs/mkdirs dir))))
+        (doseq [dir (path/all p)] (fs/mkdirs dir))))

 (defn update! [production]
   (db/update! production))
@@ -107,7 +107,7 @@
 (defn delete-all-dirs
   "Delete all artifacts on the file system for a production"
   [production]
-  (doseq [dir (path/all)] (fs/delete-dir dir)))
+  (doseq [dir (path/all production)] (fs/delete-dir dir)))

 (defn delete
   "Delete a production with the given `id`"


delete old stuff

delete old stuff

--- src/metabase/driver.clj
+++ src/metabase/driver.clj
@@ -53,19 +53,6 @@
 (defmulti connection
   "Return a korma connection to DATABASE."
   (db-dispatch-fn "connection"))
-
-(defn- field-dispatch-fn
-  "Dispatch function that keys of of `(:engine @(:db field))`."
-  [{:keys [db]}]
-  ((db-dispatch-fn "metadata") @db))
-
-(defmulti field-count
-  "Return number of rows for FIELD."
-  field-dispatch-fn)
-
-(defmulti field-distinct-count
-  "Return number of distinct rows for FIELD."
-  field-dispatch-fn)

 (defmulti sync-database
   "Update the metadata for ALL `Tables` within a given DATABASE, creating new `Tables` if they don't already exist.


Make Markdown rendering replace -- with em-dash

--- src/sinusoides/util.cljs
+++ src/sinusoides/util.cljs
@@ -60,7 +60,7 @@
 (defn md->html [str]
   (let [Converter (.-converter js/Showdown)
         converter (Converter.)]
-    (.makeHtml converter str)))
+    (.makeHtml converter (str/replace str "--" "—"))))

 (defn trace [obj & more]
   (apply prn (if more more ["TRACE:"]))


update ph fallback

update ph fallback

--- src/pc/product_hunt.clj
+++ src/pc/product_hunt.clj
@@ -35,9 +35,9 @@
           "makers" [{"image_url" {"30px" "http://avatars-cdn.producthunt.com/106624/30?1430244521"}}]
           "votes" [{"user"
                     {"image_url" {"30px" "http://avatars-cdn.producthunt.com/7824/30?1430236722"}}}]}
-   19567 {"name" "Precursor",
-          "votes_count" 3,
-          "comments_count" 1,
+   19567 {"name" "Precursor for Teams",
+          "votes_count" 86,
+          "comments_count" 7,
           "tagline" "We make prototyping and team collaboration simple and easy"
           "discussion_url" "http://www.producthunt.com/posts/precursor-for-teams"
           "makers" [{"image_url" {"30px" "http://avatars-cdn.producthunt.com/106624/30?1430244521"}}


Forward explain if pred is a spec

Forward explain if pred is a spec

--- src/spec_tools/core.cljc
+++ src/spec_tools/core.cljc
@@ -120,19 +120,25 @@
         (if (s/spec? pred)
           (s/conform pred x)
           ;; invalid
-          '::s/invalid))))
+          invalid))))
   (unform* [_ x]
     x)
   (explain* [this path via in x]
-    (when (= ::s/invalid (if (pred x) x ::s/invalid))
-      [(merge
-         {:path path
+    (let [problems (if (s/spec? pred)
+                     (s/explain* pred path via in x)
+                     (when (= invalid (if (and (fn? pred) (pred x)) x invalid))
+                       [{:path path
           :pred (s/abbrev (:spec/form this))
           :val x
           :via via
-          :in in}
-         (if-let [reason (:spec/reason this)]
-           {:reason reason}))]))
+                         :in in}]))
+          spec-reason (:spec/reason this)
+          with-reason (fn [{:keys [reason] :as problem}]
+                        (cond-> problem
+                                (and spec-reason (not reason))
+                                (assoc :reason spec-reason)))]
+      (if problems
+        (map with-reason problems))))
   (gen* [this _ _ _]
     (if-let [gen (:spec/gen this)]
       (gen)


Add added metadata to new functions

Add added metadata to new functions

--- src/superstring/core.clj
+++ src/superstring/core.clj
@@ -659,11 +659,15 @@
   "Get the character in s at index i."
   [^String s i]
   {:pre [(string? s) (integer? i) (< i (length s))]
-   :post (instance? Character %)}
+   :post (instance? Character %)
+   :added "1.1"}
   (.charAt s i))

 (defn re-quote
   "Create a string matching s exactly, and nothing else, for use in
   regular expressions."
   [s]
+  {:pre [(string? s)]
+   :post (string? %)
+   :added "1.1"}
   (java.util.regex.Pattern/quote s))


Fixing test borken during refactoring

Fixing test borken during refactoring

--- test/cmr/system_int_test/ingest/collection_ingest_test.clj
+++ test/cmr/system_int_test/ingest/collection_ingest_test.clj
@@ -61,7 +61,7 @@
 (deftest old-delete-time-collection-ingest-test
   (let [coll (dc/collection {:delete-time "2000-01-01T12:00:00Z"})
         {:keys [status errors]} (ingest/ingest-concept
-                                  (d/item->concept (assoc coll :provider-id "PROV1")))]
+                                  (d/item->concept (assoc coll :provider-id "PROV1") :echo10))]
     (is (= status 400))
     (is (re-find #"DeleteTime 2000-01-01T12:00:00.000Z is before the current time." (first errors)))))

@@ -101,7 +101,7 @@
     (index/refresh-elastic-index)

     ;; delete collection
-    (is (= 200 (:status (ingest/delete-concept (d/item->concept coll1)))))
+    (is (= 200 (:status (ingest/delete-concept (d/item->concept coll1 :echo10)))))
     (index/refresh-elastic-index)

     (is (:deleted (ingest/get-concept (:concept-id coll1))) "The collection should be deleted")


fix upload to use auth threading macro

fix upload to use auth threading macro

--- s3/src/s3/core.clj
+++ s3/src/s3/core.clj
@@ -29,7 +29,7 @@
 (defroutes main-routes
   (mp/wrap-multipart-params
     (POST "/file-upload/put" {params :params cookies :cookies}
-          (as-authenticated? cookies
+          (auth-> cookies
             (fn [user]
               (let [cdn-url (put-file user (:file params))]
                 {:status 200


rename s to string

rename s to string

--- src/tile_game/board.cljc
+++ src/tile_game/board.cljc
@@ -1,7 +1,7 @@
 (ns tile-game.board
   (:require [tile-game.coordinates :as coords]
             [clojure.set :as set]
-            [clojure.string :as s]))
+            [clojure.string :as string]))

 (defn create-board [dim & opt]
   (let [board (vec (concat (range 1 (* dim dim)) '(0)))]
@@ -19,7 +19,7 @@

 ;; (defn print-board [board]
 ;;   (let [dim (dimension board)
-;;         fmt (s/join " " (repeat dim "%3d"))]
+;;         fmt (string/join " " (repeat dim "%3d"))]
 ;;     (doseq [row (partition dim board)]
 ;;       (apply printf (cons (str fmt "\n") row)))))


CMR-2293: Address review comments

CMR-2293: Address review comments

--- umm-spec-lib/src/cmr/umm_spec/util.clj
+++ umm-spec-lib/src/cmr/umm_spec/util.clj
@@ -79,9 +79,13 @@
           :LongName (p/value-of elem "Long_Name")})))

 (def ^:private data-size-re
+  "Regular expression used to parse file sizes from a string. Supports extracting a single value
+  with units as well as a range with units."
   #"(-?[0-9][0-9,]*\.?[0-9]*|-?\.[0-9]+) ?((k|kb|ko|kilo|mb|mega|mbyte|mo|g|gb|go|giga|tb|tera|p|pb|peta)?(byte)?s?)\b")

 (defn parse-data-sizes
+  "Parses the data size and units from the provided string. Returns a sequence of maps with the Size
+  and the Unit. Returns nil if the string cannot be parsed into file sizes with units."
   [s]
   (seq
    (for [[_ num-str unit-str :as results] (re-seq data-size-re
@@ -91,6 +95,8 @@
       :Unit (-> unit-str str .trim .toUpperCase first (str "B"))})))

 (defn data-size-str
+  "Takes a collection of FileSizeType records which have a Size and a Unit and converts them to a
+  string representation."
   [sizes]
   (when (seq sizes)
     (str/join ", "


Correct docs

Correct docs

--- src/re_com/buttons.cljs
+++ src/re_com/buttons.cljs
@@ -13,11 +13,11 @@
 (def button-args-desc
   [{:name :label            :required true                           :type "string | hiccup" :description "Label for the button."}
    {:name :on-click         :required false                          :type "( ) -> nil"      :description "function to call when the button is clicked."}
-   {:name :tooltip          :required false :default "no tooltop"    :type "string"          :description "show a popover-tooltip using this text."}
+   {:name :tooltip          :required false :default "no tooltop"    :type "string | hiccup" :description "what to show in the tooltip."}
    {:name :tooltip-position :required false :default :below-center   :type "keyword"         :description "position of the popover-tooltip. e.g. :right-below."}
    {:name :disabled?        :required false :default false           :type "boolean | atom"  :description "if true, the user can't click the button."}
-   {:name :class            :required false                          :type "string"          :description "Class string. e.g. \"btn-info\" (see: http://getbootstrap.com/css/#buttons)."}
-   {:name :style            :required false                          :type "map"             :description "CSS class names, space seperated."}
+   {:name :class            :required false                          :type "string"          :description "CSS classes (whitespace specerated). Perhaps bootstrap like \"btn-info\" \"btn-small\""}
+   {:name :style            :required false                          :type "map"             :description "CSS styles."}
    {:name :attr             :required false                          :type "map"             :description "html attributes to add or override (:class/:style not allowed)."}])

 (def button-args
@@ -69,7 +69,7 @@
   [{:name :md-icon-name     :required true  :default "md-add"        :type "string"     :description "the name of the icon. "}
    {:name :on-click         :required false                          :type "( ) -> nil" :description "function to call when the button is clicked"}
    {:name :size             :required false :default ":regular"      :type "keyword"    :description "One of :regular, :smaller or :larger."}
-   {:name :tooltip          :required false                          :type "string"     :description "show a popover-tooltip containing this text."}
+   {:name :tooltip          :required false                          :type "string | hiccup" :description "what to show in the tooltip."}
    {:name :tooltip-position :required false :default ":below-center" :type "keyword"    :description "position of the popover-tooltip. e.g. :right-below."}
    {:name :emphasise?       :required false :default false           :type "boolean"    :description "if true, use emphasised styling so the button really stands out."}
    {:name :disabled?        :required false :default false           :type "boolean"    :description "if true, the user can't click the button."}
@@ -130,7 +130,7 @@
   [{:name :md-icon-name     :required true  :default "md-add"        :type "string"     :description [:span "the name of the icon."]}
    {:name :on-click         :required false                          :type "( ) -> nil" :description "function to call when button is clicked"}
    {:name :size             :required false :default ":regular"      :type "keyword"    :description "One of :regular, :smaller or :larger."}
-   {:name :tooltip          :required false                          :type "string"     :description "show a popover-tooltip using this text."}
+   {:name :tooltip          :required false                          :type "string | hiccup" :description "what to show in the tooltip."}
    {:name :tooltip-position :required false :default ":below-center" :type "keyword"    :description "position of the popover-tooltip. e.g. :right-below."}
    {:name :emphasise?       :required false :default false           :type "boolean"    :description "if true, use emphasised styling so the button really stands out."}
    {:name :disabled?        :required false :default false           :type "boolean"    :description "if true, the user can't click the button."}
@@ -235,7 +235,7 @@
   [{:name :md-icon-name     :required true  :default "md-add"        :type "string"     :description "the name of the icon."}
    {:name :on-click         :required false                          :type "( ) -> nil" :description "function to call when the button is clicked."}
    {:name :mouse-over-row?  :required false :default false           :type "boolean"    :description "true if the mouse is hovering over the row."}
-   {:name :tooltip          :required false                          :type "string"     :description "show a popover-tooltip using this text."}
+   {:name :tooltip          :required false                          :type "string | hiccup" :description "what to show in the tooltip."}
    {:name :tooltip-position :required false :default ":below-center" :type "keyword"    :description "position of the popover-tooltip. e.g. :right-below."}
    {:name :disabled?        :required false :default false           :type "boolean"    :description "if true, the user can't click the button."}
    {:name :class            :required false                          :type "string"     :description "CSS class names, space seperated."}
@@ -286,7 +286,7 @@
 (def hyperlink-args-desc
   [{:name :label            :required false                          :type "string"     :description "Label for the button (can be artitrary markup)."}
    {:name :on-click         :required false                          :type "( ) -> nil" :description "function to call when the hyperlink is clicked."}
-   {:name :tooltip          :required false                          :type "string"     :description "show a popover-tooltip using this text."}
+   {:name :tooltip          :required false                          :type "string | hiccup" :description "what to show in the tooltip."}
    {:name :tooltip-position :required false :default ":below-center" :type "keyword"    :description "position of the popover-tooltip. e.g. :right-below."}
    {:name :disabled?        :required false :default false           :type "string"     :description "if true, the user can't click the button."}
    {:name :class            :required false                          :type "string"     :description "CSS class names, space seperated."}
@@ -343,7 +343,7 @@
   [{:name :label            :required false                          :type "string"     :description "Label for the button (can be artitrary markup)."}
    {:name :href             :required false                          :type "string"     :description "If specified, the link target URL."}
    {:name :target           :required false :default "_self"         :type "string"     :description "One of \"_self\" or \"_blank\""}
-   {:name :tooltip          :required false                          :type "string"     :description "show a popover-tooltip using this text."}
+   {:name :tooltip          :required false                          :type "string | hiccup"     :description "show a popover-tooltip using this text."}
    {:name :tooltip-position :required false :default ":below-center" :type "keyword"    :description "position of the popover-tooltip. e.g. :right-below."}
    {:name :class            :required false                          :type "string"     :description "CSS class names, space seperated."}
    {:name :style            :required false                          :type "map"        :description "CSS styles to add or override."}


Have puts/alts have same impl from ioc-helper for future birth checking.

--- src/rewindable/ago.cljs
+++ src/rewindable/ago.cljs
@@ -196,10 +196,27 @@
     nil))

 (defn ago-put [state blk ^not-native c val]
-  (cljs.core.async.impl.ioc-helpers/put! state blk c val))
-
-(defn ago-alts [state cont-block ports & rest]
-  (apply cljs.core.async.impl.ioc-helpers/ioc-alts! state cont-block ports rest))
+  (if-let [cb (protocols/put!
+               c val (fn-handler
+                      (fn [ret-val]
+                        (ioc-macros/aset-all! state ioc-helpers/VALUE-IDX
+                                              ret-val ioc-helpers/STATE-IDX blk)
+                        (ioc-helpers/run-state-machine-wrapped state))))]
+    (do (ioc-macros/aset-all! state ioc-helpers/VALUE-IDX
+                              @cb ioc-helpers/STATE-IDX blk)
+        :recur)
+    nil))
+
+(defn ago-alts [state cont-block ports & {:as opts}]
+  (ioc-macros/aset-all! state ioc-helpers/STATE-IDX cont-block)
+  (when-let [cb (cljs.core.async/do-alts
+                 (fn [val]
+                   (ioc-macros/aset-all! state ioc-helpers/VALUE-IDX val)
+                   (ioc-helpers/run-state-machine-wrapped state))
+                 ports
+                 opts)]
+    (ioc-macros/aset-all! state ioc-helpers/VALUE-IDX @cb)
+    :recur))

 (defn ago-return-chan [state value]
   (let [^not-native c (aget state ioc-helpers/USER-START-IDX)]


logging: fallback to "riemann" when an unknown layout is provided

Additionally, log an error to stderr to make the user notice the
problem, even when logging is not configured correctly at all.

--- src/riemann/logging.clj
+++ src/riemann/logging.clj
@@ -50,7 +50,10 @@
 (defn get-layout
   "Fetch a logging layout by name"
   [layout-name]
-  (get layouts (or layout-name :riemann)))
+  (let [layout (get layouts (or layout-name :riemann))]
+    (when (nil? layout)
+      (binding [*out* *err*] (println "invalid logging layout specified: " layout-name)))
+    (or layout (:riemann layouts))))

 (defn init
   "Initialize log4j. You will probably call this from the config file. You can


Change streams/moving-event-window to use take-last instead of subvec.

subvec maintains a reference to the head of the parent vector, which of
course causes memory leakage after a while. This version may be somewhat
less efficient (I've not profiled it) but memory usage will be stable.

--- src/riemann/streams.clj
+++ src/riemann/streams.clj
@@ -108,11 +108,7 @@
   (let [window (atom (vec []))]
     (fn [event]
       (let [w (swap! window (fn [w]
-                              (let [w (conj w event)
-                                    size (count w)]
-                                (if (< n size)
-                                  (subvec w (- size n))
-                                  w))))]
+                              (vec (take-last n (conj w event)))))]
         (call-rescue w children)))))

 (defn fixed-event-window


CMR-3428 UMM lib test

CMR-3428 UMM lib test

--- umm-lib/test/cmr/umm/test/iso_mends/iso_mends_collection_tests.clj
+++ umm-lib/test/cmr/umm/test/iso_mends/iso_mends_collection_tests.clj
@@ -1,25 +1,26 @@
 (ns cmr.umm.test.iso-mends.iso-mends-collection-tests
   "Tests parsing and generating ISO Collection XML."
-  (:require [clojure.test :refer :all]
-            [cmr.common.test.test-check-ext :refer [defspec]]
-            [clojure.test.check.properties :refer [for-all]]
-            [clojure.test.check.generators :as gen]
-            [clojure.string :as s]
-            [clojure.java.io :as io]
-            [cmr.common.joda-time]
-            [cmr.common.date-time-parser :as p]
-            ;; this is not needed until the ECHO to ISO XSLT is fixed
-            ;; [cmr.common.xml.xslt :as xslt]
-            [cmr.umm.test.generators.collection :as coll-gen]
-            [cmr.umm.iso-mends.iso-mends-collection :as c]
-            [cmr.umm.echo10.echo10-collection :as echo10-c]
-            [cmr.umm.echo10.collection.personnel :as echo-pe]
-            [cmr.umm.echo10.echo10-core :as echo10]
-            [cmr.umm.umm-collection :as umm-c]
-            [cmr.umm.iso-mends.iso-mends-core :as iso]
-            [cmr.umm.umm-spatial :as umm-s]
-            [cmr.umm.test.echo10.echo10-collection-tests :as test-echo10]
-            [cmr.spatial.derived :as d]))
+  (:require
+   [clojure.java.io :as io]
+   [clojure.string :as s]
+   [clojure.test :refer :all]
+   [clojure.test.check.generators :as gen]
+   [clojure.test.check.properties :refer [for-all]]
+   [cmr.common.date-time-parser :as p]
+   [cmr.common.joda-time]
+   [cmr.common.test.test-check-ext :refer [defspec]]
+   ;; this is not needed until the ECHO to ISO XSLT is fixed
+   ;; [cmr.common.xml.xslt :as xslt]
+   [cmr.spatial.derived :as d]
+   [cmr.umm.echo10.collection.personnel :as echo-pe]
+   [cmr.umm.echo10.echo10-collection :as echo10-c]
+   [cmr.umm.echo10.echo10-core :as echo10]
+   [cmr.umm.iso-mends.iso-mends-collection :as c]
+   [cmr.umm.iso-mends.iso-mends-core :as iso]
+   [cmr.umm.test.echo10.echo10-collection-tests :as test-echo10]
+   [cmr.umm.test.generators.collection :as coll-gen]
+   [cmr.umm.umm-collection :as umm-c]
+   [cmr.umm.umm-spatial :as umm-s]))

 (defn- spatial-coverage->expected-parsed
   "Returns the expected parsed ISO MENDS SpatialCoverage from a UMM collection."
@@ -191,6 +192,9 @@

 (def valid-collection-xml
   (slurp (io/file (io/resource "data/iso_mends/sample_iso_collection.xml"))))
+
+(def real-data-collection-xml
+  (slurp (io/file (io/resource "data/iso_mends/C1216109961-NSIDCV0TST.xml"))))

 (def expected-temporal
   (umm-c/map->Temporal
@@ -348,3 +352,11 @@
                  "\"http://www.isotc211.org/2005/gmd\":hierarchyLevelName, "
                  "\"http://www.isotc211.org/2005/gmd\":contact}' is expected.")]
            (c/validate-xml (s/replace valid-collection-xml "fileIdentifier" "XXXX"))))))
+
+(deftest parse-collection-defaults-test
+  "Check that defaults are being added correctly to create valid umm"
+  (let [umm (c/parse-collection real-data-collection-xml)]
+    (testing "default granule spatial represetation"
+      (is (= "NO_SPATIAL" (get-in umm [:spatial-coverage :granule-spatial-representation]))))
+    (testing "default ScienceKeywords Term"
+      (is (= umm-c/not-provided (->> umm :science-keywords first :term))))))


Bugfix for bezier-vertex arity 6

Bugfix for bezier-vertex arity 6

This bug was previously fixed by commit d0312f0f and was re-introduced by 2e0af0e7.

--- src/quil/core.clj
+++ src/quil/core.clj
@@ -555,7 +555,7 @@
   begin-shape."
   ([cx1 cy1 cx2 cy2 x y]
      (.bezierVertex (current-surface)
-                    (float cx1) (float cx1)
+                    (float cx1) (float cy1)
                     (float cx2) (float cy2)
                     (float x) (float y)))
   ([cx1 cy1 cz1 cx2 cy2 cz2 x y z]


Fix copyright year on token backend ns.

Fix copyright year on token backend ns.

--- src/clojure/buddy/auth/backends/token.clj
+++ src/clojure/buddy/auth/backends/token.clj
@@ -1,4 +1,4 @@
-;; Copyright 2014 Andrey Antukh <niwi@niwi.be>
+;; Copyright 2013-2015 Andrey Antukh <niwi@niwi.be>
 ;;
 ;; Licensed under the Apache License, Version 2.0 (the "License")
 ;; you may not use this file except in compliance with the License.


Improve wording

Improve wording

--- src/icecap/schema.clj
+++ src/icecap/schema.clj
@@ -10,8 +10,8 @@
 (def Step
   "The schema for the description of a single step.

-  An step is a small, atomic part of a capability. It includes things
-  like HTTP requests or delays."
+  An step is a small, atomic part of a capability. Examples include
+  HTTP requests or delays."
   (let [all-methods (methods get-schema)
         all-types (keys all-methods)
         preds-and-schemas (for [[type schema-fn] all-methods]


adding ops fixing facts

adding ops fixing facts

--- test/celestial/test/api.clj
+++ test/celestial/test/api.clj
@@ -2,6 +2,7 @@
   "These scenarios describe how the API works and mainly validates routing"
   (:refer-clojure :exclude [type])
   (:require
+    [celestial.model :as m]
     [celestial.fixtures.data :as d]
     [celestial.api.users :refer (into-persisted)]
     [celestial.jobs :as jobs]
@@ -61,6 +62,6 @@
 (let [user (merge d/admin {:roles ["admin"] :envs ["dev" "qa"]})]
   (fact "user conversion"
      (dissoc (into-persisted user) :password) =>
-       {:envs [:dev :qa], :roles #{:celestial.roles/admin}, :username "admin"}
+       {:envs [:dev :qa] :roles #{:celestial.roles/admin} :username "admin" :operations m/operations}
      (into-persisted (dissoc user :password)) =>
-       {:envs [:dev :qa], :roles #{:celestial.roles/admin}, :username "admin"}))
+       {:envs [:dev :qa] :roles #{:celestial.roles/admin} :username "admin" :operations m/operations}))


fixing api tests

fixing api tests

--- test/celestial/test/api.clj
+++ test/celestial/test/api.clj
@@ -24,13 +24,13 @@
 (def non-sec-app (app false))

 (fact "system get"
-      (non-sec-app (request :get (<< "/host/system/1"))) => (contains {:status 200})
+      (non-sec-app (request :get (<< "/systems/1"))) => (contains {:status 200})
       (provided (p/get-system "1") => "foo"))

 (fact "getting host type"
       (non-sec-app
         (header
-          (request :get (<< "/host/type/1")) "accept" "application/json")) => (contains {:status 200})
+          (request :get (<< "/systems/1/type")) "accept" "application/json")) => (contains {:status 200})
       (provided
         (p/get-system "1") => {:type "redis"}
         (p/get-type "redis") => {:classes {:redis {:append true}}}))


Add test for bogus parameters

Add test for bogus parameters

--- test/desdemona/cli_test.clj
+++ test/desdemona/cli_test.clj
@@ -36,10 +36,18 @@
    "  -d, --delete-dirs  Delete the media drivers directory on startup"
    "  -h, --help         Display a help message\n"])

+(def ^:private error-lines
+  ["Unknown option: \"--xyzzy\""])
+
 (deftest aeron-main-tests
   "Tests for the aeron-media-driver main."
   (testing "--help displays usage"
     (let [[result stdout] (with-fake-launcher-side-effects
                             (aeron/-main "--help"))]
       (is (= result [::exited 0]))
-      (is (= stdout (s/join \newline usage-lines))))))
+      (is (= stdout (s/join \newline usage-lines)))))
+  (testing "bogus parameters display errors + usage"
+    (let [[result stdout] (with-fake-launcher-side-effects
+                            (aeron/-main "--xyzzy"))]
+      (is (= result [::exited 1]))
+      (is (= stdout (s/join \newline (concat error-lines usage-lines)))))))


Fix the server tests

Fix the server tests

--- test/picard/test/server.clj
+++ test/picard/test/server.clj
@@ -45,7 +45,7 @@
                   :script-name    ""
                   :path-info      "/"
                   :request-method "GET"
-                  :http-version   [1 0]}])))
+                  :http-version   [1 0]} nil])))

 (defcoretest simple-request-with-body
   ;; Simple request with a body
@@ -208,6 +208,7 @@
                   :script-name     ""
                   :path-info       "/"
                   :request-method  "POST"
+                  :http-version    [1 1]
                   "connection"     "close"
                   "content-length" "10000"} :chunked]))
   (is (not-receiving-messages))


Add swedish as supported language

Add swedish as supported language

--- src/status_im/i18n.cljs
+++ src/status_im/i18n.cljs
@@ -283,7 +283,8 @@
                                                 :de
                                                 :lt
                                                 :sr-RS_#Latn
-                                                :sr}))
+                                                :sr
+                                                :sv}))

 (spec/def ::supported-locale supported-locales)
 (spec/def ::supported-locales (spec/coll-of ::supported-locale :kind set? :into #{}))


small changes in subscriptions

small changes in subscriptions

Signed-off-by: Andrey Shovkoplyas <b713972e59b8e606e23253c4a13e948139fea4d1@gmail.com>

--- src/status_im/subs.cljs
+++ src/status_im/subs.cljs
@@ -1,5 +1,5 @@
 (ns status-im.subs
-  (:require [re-frame.core :refer [reg-sub subscribe] :as re-frame]
+  (:require [re-frame.core :as re-frame]
             status-im.tribute-to-talk.subs
             status-im.ui.screens.hardwallet.connect.subs
             status-im.ui.screens.hardwallet.settings.subs
@@ -47,153 +47,144 @@

 ;; TOP LEVEL ===========================================================================================================

-(def subs-keys (atom {}))
-
-(defn reg-root-key-sub [sub-name db-key keys-key]
-  (swap! subs-keys update keys-key conj db-key)
-  (reg-sub sub-name :<- [keys-key] (fn [db] (get db db-key))))
+(defn reg-root-key-sub [sub-name db-key]
+  (re-frame/reg-sub sub-name (fn [db] (get db db-key))))

 ;;view
-(reg-root-key-sub :view-id :view-id :subs/view-keys)
-(reg-root-key-sub :navigation-stack :navigation-stack :subs/view-keys)
-(reg-root-key-sub :screen-params :navigation/screen-params :subs/view-keys)
+(reg-root-key-sub :view-id :view-id)
+(reg-root-key-sub :navigation-stack :navigation-stack)
+(reg-root-key-sub :screen-params :navigation/screen-params)

 ;;bottom sheet
-(reg-root-key-sub :bottom-sheet/show? :bottom-sheet/show? :subs/bottom-keys)
-(reg-root-key-sub :bottom-sheet/view :bottom-sheet/view :subs/bottom-keys)
+(reg-root-key-sub :bottom-sheet/show? :bottom-sheet/show?)
+(reg-root-key-sub :bottom-sheet/view :bottom-sheet/view)

 ;;general
-(reg-root-key-sub :network-name :chain :subs/general-keys)
-(reg-root-key-sub :sync-state :sync-state :subs/general-keys)
-(reg-root-key-sub :network-status :network-status :subs/general-keys)
-(reg-root-key-sub :peers-count :peers-count :subs/general-keys)
-(reg-root-key-sub :about-app/node-info :node-info :subs/general-keys)
-(reg-root-key-sub :peers-summary :peers-summary :subs/general-keys)
-(reg-root-key-sub :node-status :node/status :subs/general-keys)
-(reg-root-key-sub :tab-bar-visible? :tab-bar-visible? :subs/general-keys)
-(reg-root-key-sub :dimensions/window :dimensions/window :subs/general-keys)
-(reg-root-key-sub :initial-props :initial-props :subs/general-keys)
-(reg-root-key-sub :get-manage-extension :extensions/manage :subs/general-keys)
-(reg-root-key-sub :get-staged-extension :extensions/staged-extension :subs/general-keys)
-(reg-root-key-sub :get-device-UUID :device-UUID :subs/general-keys)
-(reg-root-key-sub :fleets/custom-fleets :custom-fleets :subs/general-keys)
-(reg-root-key-sub :chain-sync-state :node/chain-sync-state :subs/general-keys)
-(reg-root-key-sub :desktop/desktop :desktop/desktop :subs/general-keys)
-(reg-root-key-sub :desktop :desktop :subs/general-keys)
-(reg-root-key-sub :animations :animations :subs/general-keys)
-(reg-root-key-sub :get-network :network :subs/general-keys)
-(reg-root-key-sub :ui/search :ui/search :subs/general-keys)
-(reg-root-key-sub :web3-node-version :web3-node-version :subs/general-keys)
-(reg-root-key-sub :keyboard-height :keyboard-height :subs/general-keys)
-(reg-root-key-sub :sync-data :sync-data :subs/general-keys)
-(reg-root-key-sub :layout-height :layout-height :subs/general-keys)
-(reg-root-key-sub :mobile-network/remember-choice? :mobile-network/remember-choice? :subs/general-keys)
-(reg-root-key-sub :qr-modal :qr-modal :subs/general-keys)
-(reg-root-key-sub :content-layout-height :content-layout-height :subs/general-keys)
-(reg-root-key-sub :bootnodes/manage :bootnodes/manage :subs/general-keys)
-(reg-root-key-sub :networks/networks :networks/networks :subs/general-keys)
-(reg-root-key-sub :networks/manage :networks/manage :subs/general-keys)
-(reg-root-key-sub :get-pairing-installations :pairing/installations :subs/general-keys)
-(reg-root-key-sub :network/type :network/type :subs/general-keys)
-(reg-root-key-sub :tooltips :tooltips :subs/general-keys)
+(reg-root-key-sub :network-name :chain)
+(reg-root-key-sub :sync-state :sync-state)
+(reg-root-key-sub :network-status :network-status)
+(reg-root-key-sub :peers-count :peers-count)
+(reg-root-key-sub :about-app/node-info :node-info)
+(reg-root-key-sub :peers-summary :peers-summary)
+(reg-root-key-sub :node-status :node/status)
+(reg-root-key-sub :tab-bar-visible? :tab-bar-visible?)
+(reg-root-key-sub :dimensions/window :dimensions/window)
+(reg-root-key-sub :initial-props :initial-props)
+(reg-root-key-sub :get-manage-extension :extensions/manage)
+(reg-root-key-sub :get-staged-extension :extensions/staged-extension)
+(reg-root-key-sub :get-device-UUID :device-UUID)
+(reg-root-key-sub :fleets/custom-fleets :custom-fleets)
+(reg-root-key-sub :chain-sync-state :node/chain-sync-state)
+(reg-root-key-sub :desktop/desktop :desktop/desktop)
+(reg-root-key-sub :desktop :desktop)
+(reg-root-key-sub :animations :animations)
+(reg-root-key-sub :get-network :network)
+(reg-root-key-sub :ui/search :ui/search)
+(reg-root-key-sub :web3-node-version :web3-node-version)
+(reg-root-key-sub :keyboard-height :keyboard-height)
+(reg-root-key-sub :sync-data :sync-data)
+(reg-root-key-sub :layout-height :layout-height)
+(reg-root-key-sub :mobile-network/remember-choice? :mobile-network/remember-choice?)
+(reg-root-key-sub :qr-modal :qr-modal)
+(reg-root-key-sub :content-layout-height :content-layout-height)
+(reg-root-key-sub :bootnodes/manage :bootnodes/manage)
+(reg-root-key-sub :networks/networks :networks/networks)
+(reg-root-key-sub :networks/manage :networks/manage)
+(reg-root-key-sub :get-pairing-installations :pairing/installations)
+(reg-root-key-sub :network/type :network/type)
+(reg-root-key-sub :tooltips :tooltips)

 ;;profile
-(reg-root-key-sub :my-profile/seed :my-profile/seed :subs/profile-keys)
-(reg-root-key-sub :my-profile/advanced? :my-profile/advanced? :subs/profile-keys)
-(reg-root-key-sub :my-profile/editing? :my-profile/editing? :subs/profile-keys)
-(reg-root-key-sub :extensions/profile :extensions/profile :subs/profile-keys)
-(reg-root-key-sub :my-profile/profile :my-profile/profile :subs/profile-keys)
+(reg-root-key-sub :my-profile/seed :my-profile/seed)
+(reg-root-key-sub :my-profile/advanced? :my-profile/advanced?)
+(reg-root-key-sub :my-profile/editing? :my-profile/editing?)
+(reg-root-key-sub :extensions/profile :extensions/profile)
+(reg-root-key-sub :my-profile/profile :my-profile/profile)
 ;;account
-(reg-root-key-sub :accounts/accounts :accounts/accounts :subs/account-keys)
-(reg-root-key-sub :accounts/login :accounts/login :subs/account-keys)
-(reg-root-key-sub :account/account :account/account :subs/account-keys)
-(reg-root-key-sub :accounts/create :accounts/create :subs/account-keys)
-(reg-root-key-sub :get-recover-account :accounts/recover :subs/account-keys)
+(reg-root-key-sub :accounts/accounts :accounts/accounts)
+(reg-root-key-sub :accounts/login :accounts/login)
+(reg-root-key-sub :account/account :account/account)
+(reg-root-key-sub :accounts/create :accounts/create)
+(reg-root-key-sub :get-recover-account :accounts/recover)
 ;;chat
-(reg-root-key-sub ::cooldown-enabled? :chat/cooldown-enabled? :subs/chat-keys)
-(reg-root-key-sub ::chats :chats :subs/chat-keys)
-(reg-root-key-sub ::access-scope->command-id :access-scope->command-id :subs/chat-keys)
-(reg-root-key-sub ::chat-ui-props :chat-ui-props :subs/chat-keys)
-(reg-root-key-sub :chats/id->command :id->command :subs/chat-keys)
-(reg-root-key-sub :chats/current-chat-id :current-chat-id :subs/chat-keys)
-(reg-root-key-sub :public-group-topic :public-group-topic :subs/chat-keys)
-(reg-root-key-sub :chats/loading? :chats/loading? :subs/chat-keys)
-(reg-root-key-sub :new-chat-name :new-chat-name :subs/chat-keys)
-(reg-root-key-sub :group-chat-profile/editing? :group-chat-profile/editing? :subs/chat-keys)
-(reg-root-key-sub :group-chat-profile/profile :group-chat-profile/profile :subs/chat-keys)
-(reg-root-key-sub :selected-participants :selected-participants :subs/chat-keys)
+(reg-root-key-sub ::cooldown-enabled? :chat/cooldown-enabled?)
+(reg-root-key-sub ::chats :chats)
+(reg-root-key-sub ::access-scope->command-id :access-scope->command-id)
+(reg-root-key-sub ::chat-ui-props :chat-ui-props)
+(reg-root-key-sub :chats/id->command :id->command)
+(reg-root-key-sub :chats/current-chat-id :current-chat-id)
+(reg-root-key-sub :public-group-topic :public-group-topic)
+(reg-root-key-sub :chats/loading? :chats/loading?)
+(reg-root-key-sub :new-chat-name :new-chat-name)
+(reg-root-key-sub :group-chat-profile/editing? :group-chat-profile/editing?)
+(reg-root-key-sub :group-chat-profile/profile :group-chat-profile/profile)
+(reg-root-key-sub :selected-participants :selected-participants)

 ;;browser
-(reg-root-key-sub :browsers :browser/browsers :subs/browser-keys)
-(reg-root-key-sub :browser/options :browser/options :subs/browser-keys)
-(reg-root-key-sub :dapps/permissions :dapps/permissions :subs/browser-keys)
+(reg-root-key-sub :browsers :browser/browsers)
+(reg-root-key-sub :browser/options :browser/options)
+(reg-root-key-sub :dapps/permissions :dapps/permissions)

 ;;stickers
-(reg-root-key-sub :stickers/selected-pack :stickers/selected-pack :subs/stickers-keys)
-(reg-root-key-sub :stickers/packs :stickers/packs :subs/stickers-keys)
-(reg-root-key-sub :stickers/installed-packs :stickers/packs-installed :subs/stickers-keys)
-(reg-root-key-sub :stickers/packs-owned :stickers/packs-owned :subs/stickers-keys)
-(reg-root-key-sub :stickers/packs-pendning :stickers/packs-pendning :subs/stickers-keys)
+(reg-root-key-sub :stickers/selected-pack :stickers/selected-pack)
+(reg-root-key-sub :stickers/packs :stickers/packs)
+(reg-root-key-sub :stickers/installed-packs :stickers/packs-installed)
+(reg-root-key-sub :stickers/packs-owned :stickers/packs-owned)
+(reg-root-key-sub :stickers/packs-pendning :stickers/packs-pendning)

 ;;mailserver
-(reg-root-key-sub :mailserver/current-id :mailserver/current-id :subs/mailserver-keys)
-(reg-root-key-sub :mailserver/mailservers :mailserver/mailservers :subs/mailserver-keys)
-(reg-root-key-sub :mailserver.edit/mailserver :mailserver.edit/mailserver :subs/mailserver-keys)
-(reg-root-key-sub :mailserver/state :mailserver/state :subs/mailserver-keys)
-(reg-root-key-sub :mailserver/pending-requests :mailserver/pending-requests :subs/mailserver-keys)
-(reg-root-key-sub :mailserver/request-error? :mailserver/request-error :subs/mailserver-keys)
-(reg-root-key-sub :mailserver/fetching-gaps-in-progress :mailserver/fetching-gaps-in-progress :subs/mailserver-keys)
-(reg-root-key-sub :mailserver/gaps :mailserver/gaps :subs/mailserver-keys)
-(reg-root-key-sub :mailserver/ranges :mailserver/ranges :subs/mailserver-keys)
+(reg-root-key-sub :mailserver/current-id :mailserver/current-id)
+(reg-root-key-sub :mailserver/mailservers :mailserver/mailservers)
+(reg-root-key-sub :mailserver.edit/mailserver :mailserver.edit/mailserver)
+(reg-root-key-sub :mailserver/state :mailserver/state)
+(reg-root-key-sub :mailserver/pending-requests :mailserver/pending-requests)
+(reg-root-key-sub :mailserver/request-error? :mailserver/request-error)
+(reg-root-key-sub :mailserver/fetching-gaps-in-progress :mailserver/fetching-gaps-in-progress)
+(reg-root-key-sub :mailserver/gaps :mailserver/gaps)
+(reg-root-key-sub :mailserver/ranges :mailserver/ranges)

 ;;contacts
-(reg-root-key-sub ::contacts :contacts/contacts :subs/contacts-keys)
-(reg-root-key-sub :contacts/current-contact-identity :contacts/identity :subs/contacts-keys)
-(reg-root-key-sub :new-identity-error :contacts/new-identity-error :subs/general-keys)
-(reg-root-key-sub :contacts/new-identity :contacts/new-identity :subs/general-keys)
-(reg-root-key-sub :group/selected-contacts :group/selected-contacts :subs/general-keys)
+(reg-root-key-sub ::contacts :contacts/contacts)
+(reg-root-key-sub :contacts/current-contact-identity :contacts/identity)
+(reg-root-key-sub :new-identity-error :contacts/new-identity-error)
+(reg-root-key-sub :contacts/new-identity :contacts/new-identity)
+(reg-root-key-sub :group/selected-contacts :group/selected-contacts)
 ;;wallet
-(reg-root-key-sub :wallet :wallet :subs/wallet-keys)
-(reg-root-key-sub :prices :prices :subs/wallet-keys)
-(reg-root-key-sub :collectibles :collectibles :subs/wallet-keys)
-(reg-root-key-sub :wallet/all-tokens :wallet/all-tokens :subs/wallet-keys)
-(reg-root-key-sub :prices-loading? :prices-loading? :subs/wallet-keys)
-(reg-root-key-sub :wallet.transactions :wallet.transactions :subs/wallet-keys)
-
-(doseq [[subs-key db-keys] @subs-keys]
-  (reg-sub
-   subs-key
-   (fn [db]
-     (select-keys db db-keys))))
+(reg-root-key-sub :wallet :wallet)
+(reg-root-key-sub :prices :prices)
+(reg-root-key-sub :collectibles :collectibles)
+(reg-root-key-sub :wallet/all-tokens :wallet/all-tokens)
+(reg-root-key-sub :prices-loading? :prices-loading?)
+(reg-root-key-sub :wallet.transactions :wallet.transactions)

 ;;GENERAL ==============================================================================================================

-(reg-sub
+(re-frame/reg-sub
  :connection-stats
  :<- [:desktop/desktop]
  (fn [desktop _]
    (get desktop :debug-metrics)))

-(reg-sub
+(re-frame/reg-sub
  :settings/logging-enabled
  :<- [:desktop/desktop]
  (fn [desktop _]
    (get desktop :logging-enabled false)))

 ;;TODO we have network in two different places see :account/network, what's the difference?
-(reg-sub
+(re-frame/reg-sub
  :network
  :<- [:account/account]
  (fn [current-account]
    (get (:networks current-account) (:network current-account))))

-(reg-sub
+(re-frame/reg-sub
  :disconnected?
  :<- [:peers-count]
  (fn [peers-count]
    (zero? peers-count)))

-(reg-sub
+(re-frame/reg-sub
  :offline?
  :<- [:network-status]
  :<- [:sync-state]
@@ -203,37 +194,37 @@
        (= network-status :offline)
        (= sync-state :offline))))

-(reg-sub
+(re-frame/reg-sub
  :syncing?
  :<- [:sync-state]
  (fn [sync-state]
    (#{:pending :in-progress} sync-state)))

-(reg-sub
+(re-frame/reg-sub
  :dimensions/window-width
  :<- [:dimensions/window]
  :width)

-(reg-sub
+(re-frame/reg-sub
  :get-screen-params
  :<- [:screen-params]
  :<- [:view-id]
  (fn [[params view-id-db] [_ view-id]]
    (get params (or view-id view-id-db))))

-(reg-sub
+(re-frame/reg-sub
  :can-navigate-back?
  :<- [:navigation-stack]
  (fn [stack]
    (> (count stack) 1)))

-(reg-sub
+(re-frame/reg-sub
  :delete-swipe-position
  :<- [:animations]
  (fn [animations [_ type item-id]]
    (get-in animations [type item-id :delete-swiped])))

-(reg-sub
+(re-frame/reg-sub
  :search/filter
  :<- [:ui/search]
  (fn [search]
@@ -246,28 +237,28 @@
   (let [version (if platform/desktop? build/version build/build-no)]
     (str build/version " (" version ")")))

-(reg-sub
+(re-frame/reg-sub
  :get-app-version
  :<- [:web3-node-version]
  (fn [web3-node-version]
    (str app-short-version "; " (node-version web3-node-version))))

-(reg-sub
+(re-frame/reg-sub
  :get-app-short-version
  (fn [db] app-short-version))

-(reg-sub
+(re-frame/reg-sub
  :get-app-node-version
  :<- [:web3-node-version]
  node-version)

-(reg-sub
+(re-frame/reg-sub
  :my-profile/recovery
  :<- [:my-profile/seed]
  (fn [seed]
    (or seed {:step :intro})))

-(reg-sub
+(re-frame/reg-sub
  :bottom-sheet
  :<- [:bottom-sheet/show?]
  :<- [:bottom-sheet/view]
@@ -275,14 +266,14 @@
    {:show? show?
     :view  view}))

-(reg-sub
+(re-frame/reg-sub
  :is-contact-selected?
  :<- [:group/selected-contacts]
  (fn [selected-contacts [_ element]]
    (-> selected-contacts
        (contains? element))))

-(reg-sub
+(re-frame/reg-sub
  :is-participant-selected?
  :<- [:selected-participants]
  (fn [selected-participants [_ element]]
@@ -291,19 +282,19 @@

 ;;ACCOUNT ==============================================================================================================

-(reg-sub
+(re-frame/reg-sub
  :account/public-key
  :<- [:account/account]
  (fn [{:keys [public-key]}]
    public-key))

-(reg-sub
+(re-frame/reg-sub
  :account/hex-address
  :<- [:account/account]
  (fn [{:keys [address]}]
    (ethereum/normalized-address address)))

-(reg-sub
+(re-frame/reg-sub
  :sign-in-enabled?
  :<- [:accounts/login]
  :<- [:node-status]
@@ -312,50 +303,50 @@
         (spec/valid? ::accounts.db/password
                      (security/safe-unmask-data password)))))

-(reg-sub
+(re-frame/reg-sub
  :settings/current-fleet
  :<- [:account-settings]
  (fn [sett]
    (fleet/current-fleet-sub sett)))

-(reg-sub
+(re-frame/reg-sub
  :get-account-creation-next-enabled?
  :<- [:accounts/create]
  (fn [create]
    (accounts.db/account-creation-next-enabled? create)))

-(reg-sub
+(re-frame/reg-sub
  :account-settings
  :<- [:account/account]
  (fn [acc]
    (get acc :settings)))

 ;;TODO we have network in two different places see :network, what's the difference?
-(reg-sub
+(re-frame/reg-sub
  :account/network
  :<- [:account/account]
  :<- [:get-network]
  (fn [[account network]]
    (get-in account [:networks network])))

-(reg-sub
+(re-frame/reg-sub
  :current-network-initialized?
  :<- [:account/network]
  (fn [network]
    (boolean network)))

-(reg-sub
+(re-frame/reg-sub
  :current-network-uses-rpc?
  :<- [:account/network]
  (fn [network]
    (get-in network [:config :UpstreamConfig :Enabled])))

-(reg-sub
+(re-frame/reg-sub
  :latest-block-number
  (fn [{:node/keys [latest-block-number]} _]
    (if latest-block-number latest-block-number 0)))

-(reg-sub
+(re-frame/reg-sub
  :settings/current-log-level
  :<- [:account-settings]
  (fn [sett]
@@ -364,13 +355,13 @@

 ;;CHAT ==============================================================================================================

-(reg-sub
+(re-frame/reg-sub
  :get-collectible-token
  :<- [:collectibles]
  (fn [collectibles [_ {:keys [symbol token]}]]
    (get-in collectibles [(keyword symbol) (js/parseInt token)])))

-(reg-sub
+(re-frame/reg-sub
  ::show-suggestions-view?
  :<- [:chats/current-chat-ui-prop :show-suggestions?]
  :<- [:chats/current-chat]
@@ -380,14 +371,14 @@
             (commands.input/starts-as-command? (string/trim (or input-text ""))))
         (seq commands))))

-(reg-sub
+(re-frame/reg-sub
  ::show-suggestions?
  :<- [::show-suggestions-view?]
  :<- [:chats/selected-chat-command]
  (fn [[show-suggestions-box? selected-command]]
    (and show-suggestions-box? (not selected-command))))

-(reg-sub
+(re-frame/reg-sub
  ::get-commands-for-chat
  :<- [:chats/id->command]
  :<- [::access-scope->command-id]
@@ -395,13 +386,13 @@
  (fn [[id->command access-scope->command-id chat]]
    (commands/chat-commands id->command access-scope->command-id chat)))

-(reg-sub
+(re-frame/reg-sub
  :chats/chat
  :<- [:chats/active-chats]
  (fn [chats [_ chat-id]]
    (get chats chat-id)))

-(reg-sub
+(re-frame/reg-sub
  :chats/content-layout-height
  :<- [:content-layout-height]
  :<- [:chats/current-chat-ui-prop :input-height]
@@ -427,26 +418,26 @@
           platform/ios? tabs.styles/tabs-height
           :else tabs.styles/minimized-tabs-height)))))

-(reg-sub
+(re-frame/reg-sub
  :chats/current-chat-ui-props
  :<- [::chat-ui-props]
  :<- [:chats/current-chat-id]
  (fn [[chat-ui-props id]]
    (get chat-ui-props id)))

-(reg-sub
+(re-frame/reg-sub
  :chats/current-chat-ui-prop
  :<- [:chats/current-chat-ui-props]
  (fn [ui-props [_ prop]]
    (get ui-props prop)))

-(reg-sub
+(re-frame/reg-sub
  :chats/validation-messages
  :<- [:chats/current-chat-ui-props]
  (fn [ui-props]
    (some-> ui-props :validation-messages)))

-(reg-sub
+(re-frame/reg-sub
  :chats/input-margin
  :<- [:keyboard-height]
  (fn [kb-height]
@@ -461,7 +452,7 @@

      :default 0)))

-(reg-sub
+(re-frame/reg-sub
  :chats/active-chats
  :<- [:contacts/contacts]
  :<- [::chats]
@@ -469,7 +460,7 @@
  (fn [[contacts chats account]]
    (chat.db/active-chats contacts chats account)))

-(reg-sub
+(re-frame/reg-sub
  :chats/current-chat
  :<- [:chats/active-chats]
  :<- [:chats/current-chat-id]
@@ -480,31 +471,31 @@
        (assoc current-chat :universal-link (links/generate-link :public-chat :external current-chat-id))
        current-chat))))

-(reg-sub
+(re-frame/reg-sub
  :chats/current-chat-message
  :<- [:chats/current-chat]
  (fn [{:keys [messages]} [_ message-id]]
    (get messages message-id)))

-(reg-sub
+(re-frame/reg-sub
  :chats/current-chat-messages
  :<- [:chats/current-chat]
  (fn [{:keys [messages]}]
    (or messages {})))

-(reg-sub
+(re-frame/reg-sub
  :chats/current-chat-message-groups
  :<- [:chats/current-chat]
  (fn [{:keys [message-groups]}]
    (or message-groups {})))

-(reg-sub
+(re-frame/reg-sub
  :chats/current-chat-message-statuses
  :<- [:chats/current-chat]
  (fn [{:keys [message-statuses]}]
    (or message-statuses {})))

-(reg-sub
+(re-frame/reg-sub
  :chats/current-chat-referenced-messages
  :<- [:chats/current-chat]
  (fn [{:keys [referenced-messages]}]
@@ -554,7 +545,7 @@
         messages-gaps range all-loaded? public?)
        chat.db/messages-stream)))

-(reg-sub
+(re-frame/reg-sub
  :chats/current-chat-intro-status
  :<- [:chats/current-chat]
  :<- [:chats/current-chat-messages]
@@ -565,20 +556,20 @@
        :empty
        :messages))))

-(reg-sub
+(re-frame/reg-sub
  :chats/available-commands
  :<- [::get-commands-for-chat]
  :<- [:chats/current-chat]
  (fn [[commands chat]]
    (chat.db/available-commands commands chat)))

-(reg-sub
+(re-frame/reg-sub
  :chats/all-available-commands
  :<- [::get-commands-for-chat]
  (fn [commands]
    (chat.db/map->sorted-seq commands)))

-(reg-sub
+(re-frame/reg-sub
  :chats/selected-chat-command
  :<- [:chats/current-chat]
  :<- [:chats/current-chat-ui-prop :selection]
@@ -586,7 +577,7 @@
  (fn [[{:keys [input-text]} selection commands]]
    (commands.input/selected-chat-command input-text selection commands)))

-(reg-sub
+(re-frame/reg-sub
  :chats/input-placeholder
  :<- [:chats/current-chat]
  :<- [:chats/selected-chat-command]
@@ -594,7 +585,7 @@
    (when (and cursor-in-the-end? (string/ends-with? (or input-text "") chat.constants/spacing-char))
      (get-in params [current-param-position :placeholder]))))

-(reg-sub
+(re-frame/reg-sub
  :chats/parameter-box
  :<- [:chats/current-chat]
  :<- [:chats/selected-chat-command]
@@ -602,7 +593,7 @@
    (when (and params current-param-position)
      (get-in params [current-param-position :suggestions]))))

-(reg-sub
+(re-frame/reg-sub
  :chats/show-parameter-box?
  :<- [:chats/parameter-box]
  :<- [::show-suggestions?]
@@ -614,14 +605,14 @@
         (not show-suggestions?)
         (not (= :complete command-completion)))))

-(reg-sub
+(re-frame/reg-sub
  :chats/unviewed-messages-count
  (fn [[_ chat-id]]
-   (subscribe [:chats/chat chat-id]))
+   (re-frame/subscribe [:chats/chat chat-id]))
  (fn [{:keys [unviewed-messages-count]}]
    unviewed-messages-count))

-(reg-sub
+(re-frame/reg-sub
  :chats/photo-path
  :<- [:contacts/contacts]
  :<- [:account/account]
@@ -630,13 +621,13 @@
        (when (= id (:public-key account))
          (:photo-path account)))))

-(reg-sub
+(re-frame/reg-sub
  :chats/unread-messages-number
  :<- [:chats/active-chats]
  (fn [chats _]
    (apply + (map :unviewed-messages-count (vals chats)))))

-(reg-sub
+(re-frame/reg-sub
  :chats/cooldown-enabled?
  :<- [:chats/current-chat]
  :<- [::cooldown-enabled?]
@@ -644,13 +635,13 @@
    (and public?
         cooldown-enabled?)))

-(reg-sub
+(re-frame/reg-sub
  :chats/reply-message
  :<- [:chats/current-chat]
  (fn [{:keys [metadata messages]}]
    (get messages (get-in metadata [:responding-to-message :message-id]))))

-(reg-sub
+(re-frame/reg-sub
  :public-chat.new/topic-error-message
  :<- [:public-group-topic]
  (fn [topic]
@@ -662,14 +653,14 @@
   [selected-contacts contacts]
   (filter #(contact.db/added? (contacts %)) selected-contacts))

-(reg-sub
+(re-frame/reg-sub
  :selected-contacts-count
  :<- [:group/selected-contacts]
  :<- [:contacts/contacts]
  (fn [[selected-contacts contacts]]
    (count (filter-selected-contacts selected-contacts contacts))))

-(reg-sub
+(re-frame/reg-sub
  :selected-participants-count
  :<- [:selected-participants]
  (fn [selected-participants]
@@ -678,14 +669,14 @@
 (defn filter-contacts [selected-contacts active-contacts]
   (filter #(selected-contacts (:public-key %)) active-contacts))

-(reg-sub
+(re-frame/reg-sub
  :selected-group-contacts
  :<- [:group/selected-contacts]
  :<- [:contacts/active]
  (fn [[selected-contacts active-contacts]]
    (filter-contacts selected-contacts active-contacts)))

-(reg-sub
+(re-frame/reg-sub
  :chats/transaction-confirmed?
  :<- [:wallet-transactions]
  (fn [txs [_ tx-hash]]
@@ -693,7 +684,7 @@
        (js/parseInt)
        (>= transactions/confirmations-count-threshold))))

-(reg-sub
+(re-frame/reg-sub
  :chats/wallet-transaction-exists?
  :<- [:wallet-transactions]
  (fn [txs [_ tx-hash]]
@@ -701,26 +692,26 @@

 ;;BOOTNODES ============================================================================================================

-(reg-sub
+(re-frame/reg-sub
  :settings/bootnodes-enabled
  :<- [:account/account]
  (fn [account]
    (let [{:keys [network settings]} account]
      (get-in settings [:bootnodes network]))))

-(reg-sub
+(re-frame/reg-sub
  :settings/network-bootnodes
  :<- [:account/account]
  (fn [account]
    (get-in account [:bootnodes (:network account)])))

-(reg-sub
+(re-frame/reg-sub
  :get-manage-bootnode
  :<- [:bootnodes/manage]
  (fn [manage]
    manage))

-(reg-sub
+(re-frame/reg-sub
  :manage-bootnode-validation-errors
  :<- [:get-manage-bootnode]
  (fn [manage]
@@ -731,7 +722,7 @@

 ;;BROWSER ==============================================================================================================

-(reg-sub
+(re-frame/reg-sub
  :browser/browsers
  :<- [:browsers]
  (fn [browsers]
@@ -740,13 +731,13 @@
            browsers
            browsers)))

-(reg-sub
+(re-frame/reg-sub
  :browser/browsers-vals
  :<- [:browser/browsers]
  (fn [browsers]
    (sort-by :timestamp > (vals browsers))))

-(reg-sub
+(re-frame/reg-sub
  :get-current-browser
  :<- [:browser/options]
  :<- [:browser/browsers]
@@ -756,13 +747,13 @@

 ;;STICKERS =============================================================================================================

-(reg-sub
+(re-frame/reg-sub
  :stickers/installed-packs-vals
  :<- [:stickers/installed-packs]
  (fn [packs]
    (vals packs)))

-(reg-sub
+(re-frame/reg-sub
  :stickers/all-packs
  :<- [:stickers/packs]
  :<- [:stickers/installed-packs]
@@ -776,7 +767,7 @@
             (get pending id) (assoc :pending true)))
         (vals packs))))

-(reg-sub
+(re-frame/reg-sub
  :stickers/get-current-pack
  :<- [:get-screen-params]
  :<- [:stickers/all-packs]
@@ -789,7 +780,7 @@
             id))
         packs))

-(reg-sub
+(re-frame/reg-sub
  :stickers/recent
  :<- [:account/account]
  :<- [:stickers/installed-packs-vals]
@@ -798,7 +789,7 @@

 ;;EXTENSIONS ===========================================================================================================

-(reg-sub
+(re-frame/reg-sub
  :extensions/all-extensions
  :<- [:account/account]
  (fn [account]
@@ -806,7 +797,7 @@

 ;;HOME =================================================================================================================

-(reg-sub
+(re-frame/reg-sub
  :home-items
  :<- [:chats/active-chats]
  :<- [:search/filter]
@@ -821,7 +812,7 @@

 ;;NETWORK SETTINGS =====================================================================================================

-(reg-sub
+(re-frame/reg-sub
  :get-network-id
  :<- [:network]
  (fn [network]
@@ -842,7 +833,7 @@
     (let [custom? (not (contains? default-networks (:id network)))]
       (assoc network :custom? custom?))))

-(reg-sub
+(re-frame/reg-sub
  :get-networks
  :<- [:account/account]
  :<- [:networks/networks]
@@ -853,13 +844,13 @@
       types
       (map #(filter (filter-networks %) networks) types)))))

-(reg-sub
+(re-frame/reg-sub
  :get-manage-network
  :<- [:networks/manage]
  (fn [manage]
    manage))

-(reg-sub
+(re-frame/reg-sub
  :manage-network-valid?
  :<- [:get-manage-network]
  (fn [manage]
@@ -867,7 +858,7 @@

 ;;PAIRING ==============================================================================================================

-(reg-sub
+(re-frame/reg-sub
  :pairing/installations
  :<- [:get-pairing-installations]
  (fn [installations]
@@ -875,19 +866,19 @@
         vals
         (sort-by (comp unchecked-negate :last-paired)))))

-(reg-sub
+(re-frame/reg-sub
  :pairing/installation-id
  :<- [:account/account]
  :installation-id)

-(reg-sub
+(re-frame/reg-sub
  :pairing/installation-name
  :<- [:account/account]
  (fn [account] (:installation-name account)))

 ;;PROFILE ==============================================================================================================

-(reg-sub
+(re-frame/reg-sub
  :get-profile-unread-messages-number
  :<- [:account/account]
  (fn [{:keys [seed-backed-up? mnemonic]}]
@@ -895,48 +886,48 @@

 ;;WALLET ==============================================================================================================

-(reg-sub
+(re-frame/reg-sub
  :balance
  :<- [:wallet]
  (fn [wallet]
    (:balance wallet)))

-(reg-sub
+(re-frame/reg-sub
  :price
  :<- [:prices]
  (fn [prices [_ fsym tsym]]
    (get-in prices [fsym tsym :price])))

-(reg-sub
+(re-frame/reg-sub
  :last-day
  :<- [:prices]
  (fn [prices [_ fsym tsym]]
    (get-in prices [fsym tsym :last-day])))

-(reg-sub
+(re-frame/reg-sub
  :wallet-transactions
  :<- [:wallet]
  (fn [wallet]
    (get wallet :transactions)))

-(reg-sub
+(re-frame/reg-sub
  :wallet.settings/currency
  :<- [:account-settings]
  (fn [sett]
    (or (get-in sett [:wallet :currency]) :usd)))

-(reg-sub
+(re-frame/reg-sub
  :wallet.transactions/filters
  :<- [:wallet.transactions]
  (fn [txs]
    (get txs :filters)))

-(reg-sub
+(re-frame/reg-sub
  :asset-value
  (fn [[_ fsym decimals tsym]]
-   [(subscribe [:balance])
-    (subscribe [:price fsym tsym])
-    (subscribe [:wallet/currency])])
+   [(re-frame/subscribe [:balance])
+    (re-frame/subscribe [:price fsym tsym])
+    (re-frame/subscribe [:wallet/currency])])
  (fn [[balance price currency] [_ fsym decimals tsym]]
    (when (and balance price)
      (-> (money/internal->formatted (get balance fsym) fsym decimals)
@@ -953,7 +944,7 @@
                             .toNumber))
                  acc)) 0 balance))

-(reg-sub
+(re-frame/reg-sub
  :portfolio-value
  :<- [:balance]
  :<- [:prices]
@@ -978,25 +969,25 @@
          "0"))
      "...")))

-(reg-sub
+(re-frame/reg-sub
  :wallet/balance-loading?
  :<- [:wallet]
  (fn [wallet]
    (:balance-loading? wallet)))

-(reg-sub
+(re-frame/reg-sub
  :wallet/error-message
  :<- [:wallet]
  (fn [wallet]
    (or (get-in wallet [:errors :balance-update])
        (get-in wallet [:errors :prices-update]))))

-(reg-sub
+(re-frame/reg-sub
  :get-wallet-unread-messages-number
  (fn [db]
    0))

-(reg-sub
+(re-frame/reg-sub
  :wallet/visible-tokens-symbols
  :<- [:network]
  :<- [:account/account]
@@ -1004,7 +995,7 @@
    (let [chain (ethereum/network->chain-keyword network)]
      (get-in current-account [:settings :wallet :visible-tokens chain]))))

-(reg-sub
+(re-frame/reg-sub
  :wallet/visible-assets
  :<- [:network]
  :<- [:wallet/visible-tokens-symbols]
@@ -1015,20 +1006,20 @@
                    (tokens/sorted-tokens-for all-tokens (ethereum/network->chain-keyword network)))
            (tokens/native-currency chain)))))

-(reg-sub
+(re-frame/reg-sub
  :wallet/visible-assets-with-amount
  :<- [:balance]
  :<- [:wallet/visible-assets]
  (fn [[balance visible-assets]]
    (map #(assoc % :amount (get balance (:symbol %))) visible-assets)))

-(reg-sub
+(re-frame/reg-sub
  :wallet/transferrable-assets-with-amount
  :<- [:wallet/visible-assets-with-amount]
  (fn [all-assets]
    (filter #(not (:nft? %)) all-assets)))

-(reg-sub
+(re-frame/reg-sub
  :wallet/currency
  :<- [:wallet.settings/currency]
  (fn [currency-id]
@@ -1036,7 +1027,7 @@

 ;;WALLET TRANSACTIONS ==================================================================================================

-(reg-sub
+(re-frame/reg-sub
  :wallet.transactions/current-tab
  :<- [:wallet]
  (fn [wallet]
@@ -1053,7 +1044,7 @@
       :always (assoc key-wallet wallet
                      :time-formatted (datetime/timestamp->time timestamp)))))

-(reg-sub
+(re-frame/reg-sub
  :wallet.transactions/transactions
  :<- [:wallet]
  :<- [:contacts/contacts-by-address]
@@ -1063,13 +1054,13 @@
            {}
            (:transactions wallet))))

-(reg-sub
+(re-frame/reg-sub
  :wallet.transactions/grouped-transactions
  :<- [:wallet.transactions/transactions]
  (fn [transactions]
    (group-by :type (vals transactions))))

-(reg-sub
+(re-frame/reg-sub
  :wallet.transactions/pending-transactions-list
  :<- [:wallet.transactions/grouped-transactions]
  (fn [{:keys [pending]}]
@@ -1078,7 +1069,7 @@
       :key   :pending
       :data  pending})))

-(reg-sub
+(re-frame/reg-sub
  :wallet.transactions/failed-transactions-list
  :<- [:wallet.transactions/grouped-transactions]
  (fn [{:keys [failed]}]
@@ -1097,13 +1088,13 @@
                :key   date-key
                :data  (sort-by :timestamp > transactions)}))))

-(reg-sub
+(re-frame/reg-sub
  :wallet.transactions/completed-transactions-list
  :<- [:wallet.transactions/grouped-transactions]
  (fn [{:keys [inbound outbound failed]}]
    (group-transactions-by-date (concat inbound outbound failed))))

-(reg-sub
+(re-frame/reg-sub
  :wallet.transactions/transactions-history-list
  :<- [:wallet.transactions/pending-transactions-list]
  :<- [:wallet.transactions/completed-transactions-list]
@@ -1112,13 +1103,13 @@
      pending (into pending)
      completed (into completed))))

-(reg-sub
+(re-frame/reg-sub
  :wallet.transactions/current-transaction
  :<- [:wallet]
  (fn [wallet]
    (:current-transaction wallet)))

-(reg-sub
+(re-frame/reg-sub
  :wallet.transactions/transaction-details
  :<- [:wallet.transactions/transactions]
  :<- [:wallet.transactions/current-transaction]
@@ -1144,14 +1135,14 @@
                          (money/wei->str :eth (money/fee-value gas-used gas-price) display-unit))
                  :url  (transactions/get-transaction-details-url chain hash)}))))))

-(reg-sub
+(re-frame/reg-sub
  :wallet.transactions.details/confirmations
  :<- [:wallet.transactions/transaction-details]
  (fn [transaction-details]
    ;;TODO (yenda) this field should be calculated based on the current-block and the block of the transaction
    (:confirmations transaction-details)))

-(reg-sub
+(re-frame/reg-sub
  :wallet.transactions.details/confirmations-progress
  :<- [:wallet.transactions.details/confirmations]
  (fn [confirmations]
@@ -1162,37 +1153,37 @@

 ;;WALLET SEND ==========================================================================================================

-(reg-sub
+(re-frame/reg-sub
  ::send-transaction
  :<- [:wallet]
  (fn [wallet]
    (:send-transaction wallet)))

-(reg-sub
+(re-frame/reg-sub
  :wallet.send/symbol
  :<- [::send-transaction]
  (fn [send-transaction]
    (:symbol send-transaction)))

-(reg-sub
+(re-frame/reg-sub
  :wallet.send/advanced?
  :<- [::send-transaction]
  (fn [send-transaction]
    (:advanced? send-transaction)))

-(reg-sub
+(re-frame/reg-sub
  :wallet.send/camera-flashlight
  :<- [::send-transaction]
  (fn [send-transaction]
    (:camera-flashlight send-transaction)))

-(reg-sub
+(re-frame/reg-sub
  :wallet.send/wrong-password?
  :<- [::send-transaction]
  (fn [send-transaction]
    (:wrong-password? send-transaction)))

-(reg-sub
+(re-frame/reg-sub
  :wallet.send/sign-password-enabled?
  :<- [::send-transaction]
  (fn [{:keys [password]}]
@@ -1212,7 +1203,7 @@
      :gas
      (money/to-fixed (:gas transaction)))))

-(reg-sub
+(re-frame/reg-sub
  :wallet/edit
  :<- [::send-transaction]
  :<- [:wallet]
@@ -1239,7 +1230,7 @@
                                             (money/formatted->internal :ETH 18))
                                         (money/bignumber available-for-gas))))))

-(reg-sub
+(re-frame/reg-sub
  :wallet.send/transaction
  :<- [::send-transaction]
  :<- [:balance]
@@ -1249,25 +1240,25 @@
        (check-sufficient-funds balance symbol amount)
        (check-sufficient-gas balance symbol amount))))

-(reg-sub
+(re-frame/reg-sub
  :wallet.send/signing-phrase-with-padding
  :<- [:account/account]
  (fn [{:keys [signing-phrase]}]
    (when signing-phrase
      (clojure.string/replace-all signing-phrase #" " "     "))))

-(reg-sub
+(re-frame/reg-sub
  :wallet/settings
  :<- [:wallet]
  (fn [{:keys [settings]}]
    (reduce-kv #(conj %1 %3) [] settings)))

-(reg-sub
+(re-frame/reg-sub
  :wallet.request/transaction
  :<- [:wallet]
  :request-transaction)

-(reg-sub
+(re-frame/reg-sub
  :screen-collectibles
  :<- [:collectibles]
  :<- [:get-screen-params]
@@ -1278,7 +1269,7 @@
 ;;UI ==============================================================================================================

 ;;TODO this subscription looks super weird huge and with dispatches?
-(reg-sub
+(re-frame/reg-sub
  :connectivity/status-properties
  :<- [:offline?]
  :<- [:disconnected?]
@@ -1333,32 +1324,32 @@

 ;;CONTACT ==============================================================================================================

-(reg-sub
+(re-frame/reg-sub
  ::query-current-chat-contacts
  :<- [:chats/current-chat]
  :<- [:contacts/contacts]
  (fn [[chat contacts] [_ query-fn]]
    (contact.db/query-chat-contacts chat contacts query-fn)))

-(reg-sub
+(re-frame/reg-sub
  :contacts/contacts
  :<- [::contacts]
  (fn [contacts]
    (contact.db/enrich-contacts contacts)))

-(reg-sub
+(re-frame/reg-sub
  :contacts/active
  :<- [:contacts/contacts]
  (fn [contacts]
    (contact.db/get-active-contacts contacts)))

-(reg-sub
+(re-frame/reg-sub
  :contacts/active-count
  :<- [:contacts/active]
  (fn [active-contacts]
    (count active-contacts)))

-(reg-sub
+(re-frame/reg-sub
  :contacts/blocked
  :<- [:contacts/contacts]
  (fn [contacts]
@@ -1367,13 +1358,13 @@
                   (contact.db/blocked? contact)))
         (contact.db/sort-contacts))))

-(reg-sub
+(re-frame/reg-sub
  :contacts/blocked-count
  :<- [:contacts/blocked]
  (fn [blocked-contacts]
    (count blocked-contacts)))

-(reg-sub
+(re-frame/reg-sub
  :contacts/current-contact
  :<- [:contacts/contacts]
  :<- [:contacts/current-contact-identity]
@@ -1383,7 +1374,7 @@
            contact.db/public-key->new-contact
            contact.db/enrich-contact))))

-(reg-sub
+(re-frame/reg-sub
  :contacts/contact-name-by-identity
  :<- [:contacts/contacts]
  :<- [:account/account]
@@ -1393,13 +1384,13 @@
        (:name current-account)
        (:name (contacts identity))))))

-(reg-sub
+(re-frame/reg-sub
  :contacts/all-contacts-not-in-current-chat
  :<- [::query-current-chat-contacts remove]
  (fn [contacts]
    (sort-by (comp clojure.string/lower-case :name) contacts)))

-(reg-sub
+(re-frame/reg-sub
  :contacts/current-chat-contacts
  :<- [:chats/current-chat]
  :<- [:contacts/contacts]
@@ -1407,19 +1398,19 @@
  (fn [[{:keys [contacts admins]} all-contacts current-account]]
    (contact.db/get-all-contacts-in-group-chat contacts admins all-contacts current-account)))

-(reg-sub
+(re-frame/reg-sub
  :contacts/contacts-by-chat
  (fn [[_ _ chat-id] _]
-   [(subscribe [:chats/chat chat-id])
-    (subscribe [:contacts/contacts])])
+   [(re-frame/subscribe [:chats/chat chat-id])
+    (re-frame/subscribe [:contacts/contacts])])
  (fn [[chat all-contacts] [_ query-fn]]
    (contact.db/query-chat-contacts chat all-contacts query-fn)))

-(reg-sub
+(re-frame/reg-sub
  :contacts/chat-photo
  (fn [[_ chat-id] _]
-   [(subscribe [:chats/chat chat-id])
-    (subscribe [:contacts/contacts-by-chat filter chat-id])])
+   [(re-frame/subscribe [:chats/chat chat-id])
+    (re-frame/subscribe [:contacts/contacts-by-chat filter chat-id])])
  (fn [[chat contacts] [_ chat-id]]
    (when (and chat (not (:group-chat chat)))
      (cond
@@ -1432,13 +1423,13 @@
        :else
        (identicon/identicon chat-id)))))

-(reg-sub
+(re-frame/reg-sub
  :contacts/contact-by-address
  :<- [:contacts/contacts]
  (fn [contacts [_ address]]
    (contact.db/find-contact-by-address contacts address)))

-(reg-sub
+(re-frame/reg-sub
  :contacts/contacts-by-address
  :<- [:contacts/contacts]
  (fn [contacts]
@@ -1452,7 +1443,7 @@
 ;;EXTENSIONS ============================================================================================================
 ;;TODO not optimized yet

-(reg-sub
+(re-frame/reg-sub
  :extensions/identity
  (fn [_ [_ _ {:keys [value]}]]
    value))
@@ -1463,7 +1454,7 @@
      :address  "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"}
     (tokens/token-for (ethereum/network->chain-keyword network) all-tokens token)))

-(reg-sub
+(re-frame/reg-sub
  :extensions.wallet/balance
  :<- [:wallet/all-tokens]
  :<- [:network]
@@ -1474,7 +1465,7 @@
      {:value        (money/token->unit value decimals)
       :value-in-wei value})))

-(reg-sub
+(re-frame/reg-sub
  :extensions.wallet/token
  :<- [:wallet/all-tokens]
  :<- [:network]
@@ -1487,7 +1478,7 @@
 (defn normalize-token [m]
   (update m :symbol name))

-(reg-sub
+(re-frame/reg-sub
  :extensions.wallet/tokens
  :<- [:wallet/all-tokens]
  :<- [:wallet/visible-tokens-symbols]
@@ -1499,7 +1490,7 @@
        (filter #((set filter-vector) (:symbol %)) tokens)
        tokens))))

-(reg-sub
+(re-frame/reg-sub
  :store/get
  (fn [db [_ {id :id} {:keys [key] :as params}]]
    (let [result (get-in db [:extensions/store id key])]
@@ -1507,7 +1498,7 @@
        (reverse result)
        result))))

-(reg-sub
+(re-frame/reg-sub
  :store/get-in
  (fn [db [_ {id :id} {:keys [keys]}]]
    (get-in db (into [] (concat [:extensions/store id] keys)))))
@@ -1518,44 +1509,44 @@
    :address    (str "0x" address)
    :public-key public-key})

-(reg-sub
+(re-frame/reg-sub
  :extensions.contacts/all
  :<- [:contacts/active]
  (fn [[contacts] _]
    (map #(update % :address ->contact))))

-(reg-sub
+(re-frame/reg-sub
  :store/get-vals
  (fn [db [_ {id :id} {:keys [key]}]]
    (vals (get-in db [:extensions/store id key]))))

-(reg-sub
+(re-frame/reg-sub
  :extensions.time/now
  (fn [_ _]
    (.toLocaleString (js/Date.))))

 ;;MAILSERVER ===========================================================================================================

-(reg-sub
+(re-frame/reg-sub
  :mailserver/connecting?
  :<- [:mailserver/state]
  (fn [state]
    (#{:connecting :added} state)))

-(reg-sub
+(re-frame/reg-sub
  :mailserver/connection-error?
  :<- [:mailserver/state]
  (fn [state]
    (#{:error :disconnected} state)))

-(reg-sub
+(re-frame/reg-sub
  :chats/fetching-gap-in-progress?
  :<- [:chats/current-chat-id]
  :<- [:mailserver/fetching-gaps-in-progress]
  (fn [[chat-id gaps] [_ ids]]
    (seq (select-keys (get gaps chat-id) ids))))

-(reg-sub
+(re-frame/reg-sub
  :mailserver/fetching?
  :<- [:mailserver/state]
  :<- [:mailserver/pending-requests]
@@ -1568,14 +1559,14 @@
         (pos-int? pending-requests)
         (not (or connecting? connection-error? request-error?)))))

-(reg-sub
+(re-frame/reg-sub
  :mailserver/fleet-mailservers
  :<- [:settings/current-fleet]
  :<- [:mailserver/mailservers]
  (fn [[current-fleet mailservers]]
    (current-fleet mailservers)))

-(reg-sub
+(re-frame/reg-sub
  :mailserver.edit/connected?
  :<- [:mailserver.edit/mailserver]
  :<- [:mailserver/current-id]
@@ -1583,7 +1574,7 @@
    (= (get-in mailserver [:id :value])
       current-mailserver-id)))

-(reg-sub
+(re-frame/reg-sub
  :mailserver.edit/validation-errors
  :<- [:mailserver.edit/mailserver]
  (fn [mailserver]
@@ -1592,7 +1583,7 @@
            (when error k))
          mailserver))))

-(reg-sub
+(re-frame/reg-sub
  :mailserver/connected?
  :<- [:mailserver/state]
  :<- [:network-status]
@@ -1601,7 +1592,7 @@
          online?    (= :online network-status)]
      (and connected? online?))))

-(reg-sub
+(re-frame/reg-sub
  :mailserver/preferred-id
  :<- [:account-settings]
  (fn [settings]
@@ -1634,7 +1625,7 @@
         (sort-by #(-> % second :timestamp) >
                  (into {} results))))))

-(reg-sub
+(re-frame/reg-sub
  :search/filtered-chats
  :<- [:chats/active-chats]
  :<- [:search/filter]


Removed cursor

Removed cursor

--- src/stratus/cursor.cljs
+++ src/stratus/cursor.cljs
@@ -1,32 +0,0 @@
-(ns stratus.cursor
-  (:require [om.core :as  om :include-macros true]
-            [om-tools.dom  :as dom :include-macros true]
-            [om-tools.core :refer-macros [defcomponent]]))
-
-(def cusor-state (atom {:postion  {:x 0 :y 0}
-                        :moving   false
-                        :relative {:x 0 :y 0}}))
-
-(defn -move-start [owner e]
-  (let [node (om/get-node owner)
-        relative-x (- (. -pageX event) (. -offsetX node))
-        relative-y (- (. -pageY event) (. -offsetY node))]
-    (om/set-state! owner :moving true)
-    (om/set-state! owner :relative {:x relative-x :y relative-y})
-    (.preventDefault e)))
-
-(defn -move-end [owner e]
-  (let [node (om/get-node owner)]
-    ))
-
-(defmixin cursorable
-  (init_state [_]
-              {position: {:x 0 :y 0}
-               relative: nil})
-  (will_mount [this]
-              (set! (. this -xPos) 0))
-  (render [this]
-          (dom/div {:on-mouse-down #(mouse-down owner)
-                    :on-mouse-up   #(mouse-up   owner)
-                    :on-mouse-move #(mouse-move owner)}
-                   "|")))


debug info

debug info

--- src/syncserver/core.clj
+++ src/syncserver/core.clj
@@ -31,6 +31,7 @@
 (defn delta [old-state]
   (if old-state
    (let [os (.getIfPresent cache! old-state)]
+      (println "exists!")
       (ddiff [] os (:state @current-state) #{}))
    (ddiff [] nil (:state @current-state) #{})))

@@ -58,7 +59,7 @@

 (defn vector-diff-same-length [path a b diffs]
-  #_(println "vector-diff-same-length" a b "@" path " : " diffs)
+  (println "vector-diff-same-length" a b "@" path " : " diffs)
   (reduce (fn [d index]
             (let [itm (get b index)
                   oitem (get a index)]
@@ -66,7 +67,7 @@
               (ddiff (conj path index) oitem itm d))) diffs (range 0 (count b))))

 (defn vector-diff [path a b diff]
-  #_(println "vector-diff" a b "@" path " : " diff)
+  (println "vector-diff" a b "@" path " : " diff)
   (if (= a b)
     diff
     (let [[diffing rest] (split-at (count a) b)
@@ -79,7 +80,7 @@
             (ddiff (conj path ky) (get a ky) (get b ky) d)) diffs (keys b)))

 (defn map-diff [path a b diffs]
-  #_(println "map-diff" a b "@" path " : " diffs)
+  (println "map-diff" a b "@" path " : " diffs)
   (let [a-keys (into #{} (keys a))
         b-keys (into #{} (keys b))
         del-keys (s/difference a-keys b-keys)
@@ -92,7 +93,7 @@
     d3))

 (defn ddiff [path a b diffs]
-  #_(println "ddiff" a b "@" path " : " diffs)
+  (println "ddiff" a b "@" path " : " diffs)
   (cond
    (= a b) diffs
    (every? vector? [a b]) (vector-diff path a b diffs)


refactored out ranked-moves from move-tile-to and path-to

--- src/tile_game/board.clj
+++ src/tile_game/board.clj
@@ -53,9 +53,6 @@
 (defn- adjacent? [board p1 p2]
   (= 1 (distance (tile->coords board p1) (tile->coords board p2))))

-(defn- legal-moves [board]
-  (set (filter #(adjacent? board 0 %) board)))
-
 (defn coord-add [board [x y] [dx dy]]
   (let [coords [(+ x dx) (+ y dy)]]
     (if (bounded-coords? board coords)
@@ -101,6 +98,10 @@
 (defn tile-at-coord? [board tile coord]
   (= (tile->coords board tile) coord))

+(defn ranked-moves [board dist-map tile avoid]
+  (let [moves (clojure.set/difference (set (adjacent-tiles board tile)) avoid)]
+    (sort-by #(nth dist-map (tile->index board %)) moves)))
+
 (defn path-to [board goal & [avoid]]
   (let [dist-map (distance-map board goal avoid)]
     (if (impassable? board dist-map 0)
@@ -108,12 +109,10 @@
       (loop [path '() board board]
         (if (tile-at-coord? board 0 goal)
           (reverse path)
-          (let [moves (sort-by #(nth dist-map (tile->index board %))
-                               (clojure.set/difference (legal-moves board)
-                                                       avoid))]
-            (if (empty? moves) '()
-                (recur (cons (first moves) path)
-                       (slide board (first moves))))))))))
+          (let [best-move (first (ranked-moves board dist-map 0 avoid))]
+            (if (nil? best-move) '()
+                (recur (cons best-move path)
+                       (slide board best-move)))))))))

 (defn move-tile [board tile goal & [avoid]]
   (if (tile-at-coord? board tile goal)
@@ -130,10 +129,7 @@
       (loop [path '() board board]
         (if (tile-at-coord? board tile goal)
           path
-          (let [best-move (first (sort-by #(nth dist-map (tile->index board %))
-                                          (clojure.set/difference
-                                           (set (adjacent-tiles board tile))
-                                           avoid)))
+          (let [best-move (first (ranked-moves board dist-map tile avoid))
                 moves (move-tile board tile (tile->coords board best-move) avoid)]
             (if (empty? moves)
               '()


Fix require expression in markdown-spec.

--- spec/incise/parsers/impl/markdown_spec.clj
+++ spec/incise/parsers/impl/markdown_spec.clj
@@ -2,8 +2,8 @@
   (:require [speclj.core :refer :all]
             [clojure.java.io :refer [file resource]]
             [incise.core] ; Ensure that layouts have been loaded
-            (incise.parsers [core :as pc]
-                            [markdown :refer :all]))
+            [incise.parsers.core :as pc]
+            [incise.parsers.impl.markdown :refer :all])
   (:import [java.io File]))

 (describe "parsing"


Support multiple jobs per stage in Go

Support multiple jobs per stage in Go

--- scripts/gosync.clj
+++ scripts/gosync.clj
@@ -23,30 +23,37 @@
      :end buildEndTime
      :outcome outcome}))

-(defn build-info [jobs]
-  (let [job (first jobs)] ; TODO multi job stages?
-    {:name (get job "name")
-     :id (get job "id")}))
+(defn build-info [job]
+  {:name (get job "name")
+   :id (get job "id")})

-(defn build-for-stage [pipelineName pipelineNo stage]
-  (let [build (build-info (get stage "jobs"))
-        stageName (get stage "name")
-        buildName (format "%s %s" pipelineName stageName)]
-    [buildName pipelineNo build]))
+(defn builds-for-stage [pipelineName pipelineNo stage]
+  (let [jobs (get stage "jobs")
+        stageName (get stage "name")]
+    (for
+        [job jobs
+         :let [jobName (get job "name")
+               build (build-info job)
+               buildName (format "%s %s %s" pipelineName stageName jobName)]]
+      [buildName pipelineNo build])))

-(defn stages-for-pipeline [pipelineRun]
+(defn builds-for-pipeline [pipelineRun]
   (let [stages (get pipelineRun "stages")
         stagesWithJobs (filter #(not (empty? (get % "jobs"))) stages)
         pipelineName (get pipelineRun "name")
         pipelineNo (get pipelineRun "label")]
-    (map (partial build-for-stage pipelineName pipelineNo) stagesWithJobs)))
+    (apply concat
+           (map (partial builds-for-stage
+                         pipelineName
+                         pipelineNo)
+                stagesWithJobs))))

 (defn history-for [pipeline]
   (let [historyUrl (format "%s/api/pipelines/%s/history" server-url pipeline)
         historyResp (client/get historyUrl)
         history (j/parse-string (:body historyResp))
         pipelineInfos (get history "pipelines")]
-    (apply concat (map stages-for-pipeline pipelineInfos))))
+    (apply concat (map builds-for-pipeline pipelineInfos))))

 (defn full-history-for [pipeline]
   (map (fn [[buildName buildNo build]] [buildName buildNo (build-for pipeline build)])


Added save on meta + s

Added save on meta + s

--- src/wordsmith/core.cljs
+++ src/wordsmith/core.cljs
@@ -6,7 +6,9 @@
             [wordsmith.editor :as e]
             [cljs.core.async :refer [put! chan <!]]
             [goog.string :as gstring]
-            [goog.string.format]))
+            [goog.string.format]
+            [goog.events :as events])
+  (:import [goog.events EventType]))

 (enable-console-print!)

@@ -91,6 +93,14 @@
   (p/set-document (:title @app) (:input @app))
   (om/update! app :titles (p/get-all-titles)))

+(defn listen [el type app]
+  (events/listen el type
+    #(when
+       (and (.-metaKey %)
+            (= 83 (.-keyCode %)))
+       (.preventDefault %)
+       (save-document app))))
+
 (defn wordsmith-app [app owner]
   (reify
     om/IWillMount
@@ -100,7 +110,8 @@
         (go-loop []
           (let [[action params] (<! channel)]
             (save-document app)
-            (recur)))))
+            (recur))))
+      (listen js/document EventType/KEYDOWN app))
     om/IRender
     (render [_]
       (dom/div #js {:className "container"}


Revert "render line chart without data correctly"

This reverts commit a5ce8bfe6a3ce04605ffd02202d40a935f7ea5bc.

--- src-cljs/frontend/components/insights/project.cljs
+++ src-cljs/frontend/components/insights/project.cljs
@@ -41,13 +41,8 @@

 (defn build-time-line-chart [timing-data owner]
-  (let [columns (if (empty? timing-data)
-                  [(cons "date" (if (empty? timing-data)
-                                  [nil]
-                                  (map (comp time-format/parse :date) timing-data)))
-                   (cons "Median Build Time" (if (empty? timing-data)
-                                               [nil]
-                                               (map :median_build_time_millis timing-data)))])]
+  (let [columns [(cons "date" (map (comp time-format/parse :date) timing-data))
+                 (cons "Median Build Time" (map :median_build_time_millis timing-data))]]
    (reify
      om/IDidUpdate
      (did-update [_ _ _]


fix hovercard's position dependent on whether it will fall out of the screen

--- src-cljs/frontend/components/insights/project.cljs
+++ src-cljs/frontend/components/insights/project.cljs
@@ -14,6 +14,7 @@
             [frontend.async :refer [raise!]]
             [frontend.utils :refer-macros [html defrender component]]
             [goog.string :as gstring]
+            [goog.dom :as gdom]
             [om.core :as om :include-macros true]
             [schema.core :as s :include-macros true]
             [cljs-time.format :as time-format]
@@ -189,16 +190,22 @@
     om/IRenderState
     (render-state [_ {focused-build :focused-build
                       [x y] :mouse-location}]
-      (html
-       [:div {:data-component (str `build-status-bar-chart)
-              :style {:position "relative"}}
-        (om/build insights/build-status-bar-chart {:plot-info plot-info
-                                                   :builds builds
-                                                   :on-focus-build #(om/set-state! owner :focused-build %)
-                                                   :on-mouse-move #(om/set-state! owner :mouse-location %)})
-        [:div.hovercard {:style {:position "absolute" :left x :top y}}
-         (when focused-build
-           (build-status-bar-chart-hovercard (js->clj focused-build :keywordize-keys true)))]]))))
+      (let [window-size-height (.-height (gdom/getViewportSize))
+            window-size-width  (.-width (gdom/getViewportSize))
+            hover-card-width 200 ;; hovercard width is 180px (project.less), and a cushion of 20px was added.
+            x-position (if (>= (+ x hover-card-width) window-size-width)
+                         (- x hover-card-width)
+                         x)]
+        (html
+         [:div {:data-component (str `build-status-bar-chart)
+                :style {:position "relative"}}
+          (om/build insights/build-status-bar-chart {:plot-info plot-info
+                                                     :builds builds
+                                                     :on-focus-build #(om/set-state! owner :focused-build %)
+                                                     :on-mouse-move #(om/set-state! owner :mouse-location %)})
+          [:div.hovercard {:style {:position "absolute" :left x-position :top y}}
+           (when focused-build
+             (build-status-bar-chart-hovercard (js->clj focused-build :keywordize-keys true)))]])))))

 (defn branch-builds
   [project branch]


Fix headers on one of the project setting pages.

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -549,14 +549,15 @@
 (defn webhooks [project-data owner]
   (om/component
    (html
-    [:div
-     [:h2 "Webhooks"]
-     [:div.doc
-      [:p
-       "Circle also support webhooks, which run at the end of a build. They can be configured in your "
-       [:a {:href "https://circleci.com/docs/configuration#notify" :target "_blank"}
-        "circle.yml file"]
-       "."]]])))
+    [:section
+     [:article
+      [:h2 "Webhooks"]
+      [:div.doc
+       [:p
+        "Circle also support webhooks, which run at the end of a build. They can be configured in your "
+        [:a {:href "https://circleci.com/docs/configuration#notify" :target "_blank"}
+         "circle.yml file"]
+        "."]]]])))

 (defn notifications [project-data owner]
   (reify