Use expandable blocks in user connections page

--- src/cljs/salava/extra/socialuser/ui/connections.cljs
+++ src/cljs/salava/extra/socialuser/ui/connections.cljs
@@ -30,17 +30,23 @@
                                                   (do
                                                     (init-data state)))
                                :error-handler   (fn [{:keys [status status-text]}]
-                                                  (.log js/console (str status " " status-text))
-                                                  )})} (t :social/Unfollow) ])
+                                                  (.log js/console (str status " " status-text)
+                                                   (t :social/Unfollow)))})}])

+(defn toggle-panel [key atom]
+  (if (= key @atom)
+    (reset! atom nil)
+    (reset! atom key)))

 (defn accepted-user-connections [state users visible-area-atom]
-  (let [panel-identity :accepted]
-    [:div.panel
+  (let [panel-identity :accepted
+        icon-class (if (= @visible-area-atom panel-identity) "fa-chevron-circle-down" "fa-chevron-circle-right")]
+    [:div.panel.expandable-block
      [:div.panel-heading
-      [:a {:href "#" :on-click #(do (.preventDefault %) (reset! visible-area-atom panel-identity))}
+      [:a {:href "#" :on-click #(do (.preventDefault %) (toggle-panel panel-identity visible-area-atom))}
        [:h3
-        (str (t :social/Followedusers) " (" (count users) ")")]]]
+        (str (t :social/Followedusers) " (" (count users) ")")]
+       [:i.fa.fa-lg.panel-status-icon {:class icon-class}]]]
      (when (= panel-identity @visible-area-atom)
        [:div.panel-body
         [:table {:class "table" :summary (t :social/Followedusers)}
@@ -60,8 +66,8 @@
                                               (mo/open-modal [:profile :view] {:user-id user_id})
                                               ;(b/open-modal id false init-data state)
                                               (.preventDefault %)) } (str first_name " " last_name)]]
-                  [:td.action  (if (= "accepted" status) (deleteconnect user_id state)  (str (t :social/Pending) "..."))]]))]]
-       )]))
+                  [:td.action  (if (= "accepted" status) (deleteconnect user_id state)  (str (t :social/Pending) "..."))]]))]])]))
+

 (defn accept [owner-id state]
@@ -75,8 +81,8 @@
                                         (do
                                           (init-data state)))
                      :error-handler   (fn [{:keys [status status-text]}]
-                                        (.log js/console (str status " " status-text))
-                                        )})} (t :social/Accept)])
+                                        (.log js/console (str status " " status-text)
+                                         (t :social/Accept)))})}])

 (defn decline [owner-id state]
   [:a {:class  "btn btn-warning btn-xs"
@@ -89,19 +95,21 @@
                                         (do
                                           (init-data state)))
                      :error-handler   (fn [{:keys [status status-text]}]
-                                        (.log js/console (str status " " status-text))
-                                        )})} (t :social/Decline)])
+                                        (.log js/console (str status " " status-text)
+                                         (t :social/Decline)))})}])

 (defn pending-user-connections [state users visible-area-atom]
-  (let [panel-identity :pending]
-    [:div.panel
+  (let [panel-identity :pending
+        icon-class (if (= @visible-area-atom panel-identity) "fa-chevron-circle-down" "fa-chevron-circle-right")]
+    [:div.panel.expandable-block
      [:div.panel-heading
-      [:a {:href "#" :on-click #(do (.preventDefault %) (reset! visible-area-atom panel-identity))}
+      [:a {:href "#" :on-click #(do (.preventDefault %) (toggle-panel panel-identity visible-area-atom))}
        [:h3
-        (str (t :social/Followersusers) " (" (count users) ")")]]]
+        (str (t :social/Followersusers) " (" (count users) ")")]
+       [:i.fa.fa-lg.panel-status-icon {:class icon-class}]]]
      (when (= panel-identity @visible-area-atom)
        [:div.panel-body
         [:table {:class "table" :summary (t :badge/Badgeviews)}
@@ -124,7 +132,7 @@
                                               (.preventDefault %)) } (str first_name " " last_name)]]
                   (if (= "pending" status)
                     [:td.action (accept owner_id state) " " (decline owner_id state)]
-                    [:td.action  (str(t :social/Follows)  " ") ])]))]])]))
+                    [:td.action  (str(t :social/Follows)  " ")])]))]])]))

@@ -133,18 +141,16 @@
   (let [visible-area-atom (cursor state [:visible-area])
         followers-users     (cursor state [:followers-users])
         following-users    (cursor state [:following-users])]
-    [:div
+    [:div {:id "badge-stats"}
      [m/modal-window]
      [:h1.uppercase-header (t :connections/UserConnections)]

      [:div {:style {:margin-bottom "10px"}} (t :connections/Userconnectionsinfo)]

-     (if-not (empty? @followers-users)
-       [:div {:id "badge-stats"}
-        (pending-user-connections state @followers-users visible-area-atom)])
-     (if-not (empty? @following-users)
-       [:div {:id "badge-stats"}
-        (accepted-user-connections state @following-users visible-area-atom)])]))
+     (when (seq @followers-users)
+        (pending-user-connections state @followers-users visible-area-atom))
+     (when (seq @following-users)
+        (accepted-user-connections state @following-users visible-area-atom))]))

 (defn init-stats [state]
   (init-data state)
@@ -161,29 +167,24 @@
        [:div.info-block
         [:a {:href (path-for "/connections/user") :on-click #(do
                                                                (.preventDefault %)
-                                                               (session/put! :visible-area :accepted) )}
+                                                               (session/put! :visible-area :accepted))}
          [:div.info
-          ;[:i.fa.fa-user.icon]
           [:div.text
            [:p.num (->> (:following-users @state) count)]
-           [:p.desc (t :social/Followedusers)]
-           ]]
-         ]
-        ]
+           [:p.desc (t :social/Followedusers)]]]]]

        [:div.info-block
         [:a {:href (path-for "/connections/user")  :on-click #(do
                                                                 (.preventDefault %)
-                                                                (session/put! :visible-area :pending) )}
+                                                                (session/put! :visible-area :pending))}
          [:div.info
           (when (pos? (count (:pending @state))) [:span.badge (count (:pending @state))])
-          ;[:i.fa.fa-user.icon]
           [:div.text
            [:p.num (->> (:followers-users @state) count)]
-           [:p.desc (t :social/Followersusers)]
-           ]
-          ]
-         ]]])))
+           [:p.desc (t :social/Followersusers)]]]]]])))
+
+
+

 (defn handler [site-navi]
   (let [state (atom {:visible-area  nil


zip_rand update: NOOP and print to stderr if there are no global-atom-generators.

--- src/clojush/experimental/zipper_autoconstruction.clj
+++ src/clojush/experimental/zipper_autoconstruction.clj
@@ -240,18 +240,21 @@

 (define-registered zip_rand
   (fn [state]
-					;    (if (n-on-stack? 1 :zip state)
-    (if-not (empty? (:zip state))
+    (if (n-on-stack? 1 :zip state)
       (if (or (not (seq? (zip/node (top-item :zip state))))
               (empty? (zip/node (top-item :zip state))))
         state
-        (let [top-zip (top-item :zip state)
-              zip-points (count-points (zip/root top-zip))
-              max-subtree-points (- @global-max-points-in-program zip-points)]
-          (push-item (zip/replace top-zip
-                                  (random-code max-subtree-points
-                                               @global-atom-generators))
-                     :zip (pop-item :zip state))))
+	(if (empty? @clojush.globals/global-atom-generators)
+	  (binding [*out* *err*]
+	    (println "code_rand: global-atom-generators is empty.")
+	    state)
+	  (let [top-zip (top-item :zip state)
+		zip-points (count-points (zip/root top-zip))
+		max-subtree-points (- @global-max-points-in-program zip-points)]
+	    (push-item (zip/replace top-zip
+				    (random-code max-subtree-points
+						 @global-atom-generators))
+		       :zip (pop-item :zip state)))))
       state)))

 (def global-ace-atom-generators
@@ -319,3 +322,4 @@
 				      (cons (:program parent1) (:ancestors parent1)))
 				    (:ancestors parent1))))))

+


Don't load the images so aggresively

Don't load the images so aggresively

--- src/cljs/comic_reader/handlers.cljs
+++ src/cljs/comic_reader/handlers.cljs
@@ -57,7 +57,6 @@
   (rf/register-handler
    :next-image
    (fn [db [_ img-tag]]
-     (api/get-img-tag (:site db) (first (:url-list db)))
      (-> db
          (update-in [:url-list] rest)
          (update-in [:comic-imgs] conj img-tag)))))


Card release check based on set date instead of manual update of a hardcoded value

--- src/cljs/netrunner/deckbuilder.cljs
+++ src/cljs/netrunner/deckbuilder.cljs
@@ -271,10 +271,11 @@

 (defn released?
   "Returns false if the card comes from a spoiled set or is out of competitive rotation."
-  [card]
-  (let [cid (js/parseInt (:code card))]
-    ;; Cards up to Business First are currently released
-    (and cid (<= cid 10038))))
+  [{:keys [setname]} card]
+  (when-let [date (some #(when (= (:name %) set)
+                           (:available %))
+                        (:sets @app-state))]
+    (< date (.toJSON (js/Date.)))))

 (defn mwl-legal?
   "Returns true if the deck's influence fits within NAPD MWL restrictions."


Fix arguments for a2png

Fix arguments for a2png

--- src/asciinema/component/a2png.clj
+++ src/asciinema/component/a2png.clj
@@ -7,11 +7,11 @@

 (defn- exec-a2png [bin-path in-url out-path {:keys [snapshot-at theme scale]}]
   (let [{:keys [exit] :as result} (shell/sh bin-path
-                                            "-t" theme
-                                            "-s" (str scale)
                                             in-url
                                             out-path
-                                            (str snapshot-at))]
+                                            (str snapshot-at)
+                                            theme
+                                            (str scale))]
     (when-not (zero? exit)
       (throw (ex-info "a2png error" result)))))


Initial thread-last extension.

Initial thread-last extension.

There are some issues with thread-last, however. The first and most
pressing is that I'm not quite sure what I want the expected behavior to
be! For example, given (* (- 4 (- 2 3)) (* 9 (+ 4 (- 2 4)))), what
suggestions should be returned?

The current method is controlled by the factors - a list of functions for
which it will *not* attempt to thread (for example, it would make no sense
to try and thread an if statement), and a level of nesting to which it
should thread.

--- formatter/src/formatter/extensions/thread_last.clj
+++ formatter/src/formatter/extensions/thread_last.clj
@@ -2,11 +2,53 @@
   (:require [instaparse.core :as insta]
             [formatter.parser :as par]))

-(defn process-code [params]
-  params)
+(def ^:dynamic min-depth 3)
+(def ^:dynamic do-not-nest
+  #{"defn" "loop" "let" "if" "and" "or" "fn"})
+
+(defn count-nesting
+  "Counts the nesting levels of the tree, excluding functions listed in the
+  do-not-nest var."
+  [node]
+  (loop [node node n 0]
+    (let [node-vecs (filter #(or (vector? %) (= :Eval %)) node)]
+      (cond
+        (contains? do-not-nest (second (second node-vecs)))
+          n
+        (and (= :Eval (first node-vecs)) (vector? (last node-vecs)))
+          (recur (last node-vecs) (inc n))
+        :else
+          n))))
+
+(defn find-nested-nodes
+  "Finds nodes with a thread-last nesting level greater than or equal to n.
+  For example, for n=1 and a tree parsed from (+ 3 (* 9 2)) it would return a
+  vector of two elements containing trees representing (+3 (* 9 2)) and
+  (* 9 2)."
+  [tree]
+  (if (sequential? tree)
+      (if (>= (count-nesting tree) min-depth)
+          (cons tree (mapcat #(find-nested-nodes %) (next tree)))
+          (mapcat #(find-nested-nodes %) (next tree)))
+      nil))
+
+(defn nodes-to-strings
+  "Takes a vector or nodes and returns a vector of strings."
+  [nodes]
+  (map #(->> %
+             (flatten)
+             (filter string?)
+             (apply str))
+        nodes))
+
+(defn process-code [{:keys [tree suggestions] :as params}]
+  (->> (find-nested-nodes tree)
+       (nodes-to-strings)
+       (reduce conj suggestions)
+       (assoc params :suggestions)))

 (def extension
-  {:description "thread-last is not yet implemented."
+  {:description "thread-last adds to suggestions possible locations to use ->>"
    :url ""
    :is-active true
    :process-code process-code})


Revert "Fix source mapping of exceptions"

This reverts commit b59324f1a8682c3d15d8ad5c4284fcdd59de4096.

--- planck-cljs/src/planck/repl.cljs
+++ planck-cljs/src/planck/repl.cljs
@@ -503,15 +503,6 @@
   [path]
   (str "file:///" path))

-(defn- split-source
-  "Splits a JavaScript source file into
-  the goog directives and the remainder."
-  [source]
-  (->> (s/split source "\n")
-    rest
-    (split-with #(s/starts-with? % "goog."))
-    (mapv #(s/join "\n" %))))
-
 (defn- caching-js-eval
   [{:keys [path name source cache]}]
   (let [source (str (form-compiled-by-string (form-build-affecting-options)) "\n" source)]
@@ -522,11 +513,9 @@
         (cljs->transit-json (get-in @planck.repl/st [:source-maps name]))))
     (if (and (not (empty? path))
           (not= "Expression" path))
-      (let [[pre post] (split-source source)]
-        (js/eval pre)
-        (let [exception (js/PLANCK_EVAL post (file-url (js-path-for-name name)))]
-          (when exception
-            (throw exception))))
+      (let [exception (js/PLANCK_EVAL (str "\n" source) (file-url (js-path-for-name name)))]
+        (when exception
+          (throw exception)))
       (js/eval source))))

 (defn- extension->lang
@@ -591,9 +580,7 @@
       (when (and sourcemap-json name)
         (swap! st assoc-in [:source-maps name] (transit-json->cljs sourcemap-json)))
       (when-not (skip-load-js? name)
-        (let [[pre post] (split-source js-source)]
-          (js/eval pre)
-          (js/PLANCK_EVAL post (file-url (add-suffix path ".js")))))
+        (js/PLANCK_EVAL (str "\n" js-source) (file-url (add-suffix path ".js"))))
       (merge {:lang   :js
               :source ""}
         (when cache-json


added missing declaration for union, in tilesets.

--- src/clj/forma/source/tilesets.clj
+++ src/clj/forma/source/tilesets.clj
@@ -1,5 +1,6 @@
 (ns forma.source.tilesets
-  (:use forma.source.modis))
+  (:use forma.source.modis
+        [clojure.set :only (union)]))

 (def
   ^{:doc "MODIS tiles for the selected countries, identified by their


Removed prn from production code in The All-Seeing I

--- src/clj/game/cards-operations.clj
+++ src/clj/game/cards-operations.clj
@@ -392,19 +392,18 @@
                                              (trash state side resource)))
                               :msg (msg "trash all resources")}]
        {:req (req tagged)
-        :effect (req (prn (not (zero? (:bad-publicity corp))))
-                 (resolve-ability
-                      state side
-                      (if (not (zero? (:bad-publicity corp))) ;; If corp's bad-pub is 0
-                        {:optional {:player :runner
-                                    :prompt "Remove 1 bad publicity from the corp to prevent all resources from being trashed?"
-                                    :yes-ability {:effect (effect (lose :corp :bad-publicity 1))
-                                                  :player :corp
-                                                  :msg (msg "lose 1 bad publicity, preventing all resources from being trashed")}
-                                    :no-ability trash-all-resources}}
-                        trash-all-resources)
-                      card targets))})
-
+        :effect (effect
+                 (resolve-ability
+                  (if (not (zero? (:bad-publicity corp))) ;; If corp's bad-pub is 0
+                    {:optional {:player :runner
+                                :prompt "Remove 1 bad publicity from the corp to prevent all resources from being trashed?"
+                                :yes-ability {:effect (effect (lose :corp :bad-publicity 1))
+                                              :player :corp
+                                              :msg (msg "lose 1 bad publicity, preventing all resources from being trashed")}
+                                :no-ability trash-all-resources}}
+                    trash-all-resources)
+                  card targets))})
+
    "Traffic Accident"
    {:req (req (>= (:tag runner) 2)) :effect (effect (damage :meat 2 {:card card}))}


Helpful error message when env vars missing

--- src/clj/onyx_dashboard/system.clj
+++ src/clj/onyx_dashboard/system.clj
@@ -12,14 +12,21 @@
             [net.cgrand.enlive-html :refer [deftemplate]]
             [ring.middleware.reload :as reload]
             [environ.core :refer [env]]
+            [clojure.string :refer [upper-case]]
             [ring.adapter.jetty :refer [run-jetty]])
   (:gen-class))

+(defn env-throw [v]
+  (or (env v)
+      (throw (Exception. (format "Please set %s environment variable via shell, or via env map %s"
+                                 (clojure.string/replace (upper-case (name v)) "-" "_")
+                                 v)))))
+
 (def env-config
   {:hornetq/mode :standalone
-   :hornetq.standalone/host (env :hornetq-host)
-   :hornetq.standalone/port (env :hornetq-port)
-   :zookeeper/address (env :zookeeper-addr)
+   :hornetq.standalone/host (env-throw :hornetq-host)
+   :hornetq.standalone/port (env-throw :hornetq-port)
+   :zookeeper/address (env-throw :zookeeper-addr)
    :onyx.peer/job-scheduler :onyx.job-scheduler/round-robin})


all ideas

all ideas

--- src/cljs/triboard/logic/move.cljs
+++ src/cljs/triboard/logic/move.cljs
@@ -99,6 +99,12 @@
 ;; Public API
 ;; -----------------------------------------

+;; TODO - Create a tree of reachable board (with their associated transition)
+;; TODO - Tree of board can be mapped to tree of trun
+;; TODO - Tree of turn can be mapped to tree of game
+;; TODO - Tree of game allows to move between games (play-move)
+;; TODO - Tree of game allows to move between ai fake games
+
 #_(s/fdef all-available-moves
     :args (s/tuple ::board/board)
     :ret ::available-moves)


Always return a list

Always return a list

--- src/clojure/nightcode/editors.clj
+++ src/clojure/nightcode/editors.clj
@@ -368,7 +368,7 @@
                             (compliment/documentation symbol-str)
                             "
")
                        (BasicCompletion. this symbol-str nil)))))
-          (catch Exception _)))
+          (catch Exception _ '())))
       (isValidChar [ch]
         (or (Character/isLetterOrDigit ch)
             (contains? #{\* \+ \! \- \_ \? \/ \. \: \< \>} ch)))


inventory stuff to term

inventory stuff to term

--- clojure/src/dnd/showScreen.cljs
+++ clojure/src/dnd/showScreen.cljs
@@ -147,14 +147,16 @@
     ;(.moveTo 0 (inc height) "got some text down below\n\n")
     (.moveTo 0 (+ 10 height))))

-(defn inventory-selected [error response]
-  (if error
-    (println "oh crap")
-    (println "you stare at" (.-selectedText response))
-    ))
+(defn inventory-selected [term error response]
+  (.moveTo term 0 (inc height)
+           (if error
+             "oh crap!"
+             (str "you stare at " (.-selectedText response)))))

 (defn show-inventory [term character]
-  (let [descriptions (->> character :inventory (map :colorful-description))]
+  (let [descriptions (->> character :inventory (map :colorful-description))
+        inventory-selected (partial inventory-selected term)
+        ]
     (when-not (empty? descriptions)
       (.gridMenu term (clj->js descriptions) inventory-selected))
     ))


explicit import

explicit import

--- src/main/clojure/com/narkisr/couchfs/file_update.clj
+++ src/main/clojure/com/narkisr/couchfs/file_update.clj
@@ -1,13 +1,16 @@
 (ns com.narkisr.couchfs.file-update
-  (:use (com.narkisr.couchfs couch-access)
-     (com.narkisr fs-logic)))
+  (:use
+     (com.narkisr.couchfs
+          (couch-access :only [couch-attachment-content add-attachment update-document get-document]))
+     (com.narkisr (fs-logic :only [update update-atime]))))

 (defn update-rev-and-time [path rev-map]
   (update path :_rev (rev-map :_rev))
   (update-atime path (System/currentTimeMillis)))

 (defn use-lastest-rev [path id contents]
-  (update-rev-and-time path (update-document id (assoc contents :_rev ((get-document id) :_rev)))))
+  (update-rev-and-time path
+    (update-document id (assoc contents :_rev ((get-document id) :_rev)))))

 (defn update-attachment [path couch-id file-name contents ]
   (add-attachment couch-id file-name contents "text/plain")


scheduler: Describe that backfilled tasks don't make a job running

--- scheduler/src/cook/mesos/schema.clj
+++ scheduler/src/cook/mesos/schema.clj
@@ -443,7 +443,9 @@
              - task failed, no other tasks, retries remaining => job waiting
              - task failed, other tasks running => job running

-             Note that backfilled running instances are treated as if they don't exist."
+             Note that backfilled running instances are treated as if they don't exist.
+             In other words, if a job has running tasks that are all backfilled, the
+             state of the task itself will still be :waiting ."
     :db/fn #db/fn {:lang "clojure"
                    :params [db j]
                    :requires [[metatransaction.core :as mt]]


Let styles flow on trace

Let styles flow on trace

--- src/com/wsscode/pathom/trace.cljc
+++ src/com/wsscode/pathom/trace.cljc
@@ -119,20 +119,20 @@

             (:com.wsscode.pathom.parser/async-return :com.wsscode.pathom.parser/skip-wait-key :com.wsscode.pathom.parser/call-read
               :com.wsscode.pathom.parser/skip-resolved-key :com.wsscode.pathom.parser/external-wait-key)
-            (update-in x [:response ::children key ::details] (fnil conj []) (select-keys row [::event ::label ::relative-timestamp :key]))
+            (update-in x [:response ::children key ::details] (fnil conj []) (select-keys row [::event ::label ::style ::relative-timestamp :key]))

             :com.wsscode.pathom.parser/max-iterations-reached
-            (update-in x [:response ::children key ::details] (fnil conj []) (select-keys row [::event ::label ::relative-timestamp :com.wsscode.pathom.parser/max-key-iterations]))
+            (update-in x [:response ::children key ::details] (fnil conj []) (select-keys row [::event ::label ::style ::relative-timestamp :com.wsscode.pathom.parser/max-key-iterations]))

             (:com.wsscode.pathom.parser/process-pending :com.wsscode.pathom.parser/reset-loop
               :com.wsscode.pathom.parser/flush-watchers-loop ::trace-done)
-            (update-in x [:response ::details] (fnil conj []) (select-keys row [::event ::label ::relative-timestamp :com.wsscode.pathom.parser/provides :com.wsscode.pathom.parser/merge-result?
+            (update-in x [:response ::details] (fnil conj []) (select-keys row [::event ::label ::style ::relative-timestamp :com.wsscode.pathom.parser/provides :com.wsscode.pathom.parser/merge-result?
                                                                                :com.wsscode.pathom.parser/loop-keys]))

             :com.wsscode.pathom.parser/merge-result
             (reduce
               (fn [x key]
-                (update-in x [:response ::children key ::details] (fnil conj []) (select-keys row [::event ::label ::relative-timestamp])))
+                (update-in x [:response ::children key ::details] (fnil conj []) (select-keys row [::event ::label ::style ::relative-timestamp])))
               x
               (keys (:com.wsscode.pathom.parser/response-value row)))

@@ -141,12 +141,12 @@
               :com.wsscode.pathom.connect/call-resolver-batch :com.wsscode.pathom.connect/batch-items-ready :com.wsscode.pathom.connect/batch-result-error :com.wsscode.pathom.connect/batch-result-ready
               :com.wsscode.pathom.connect/merge-resolver-response :com.wsscode.pathom.connect/resolver-error :com.wsscode.pathom.connect/invalid-resolve-response)
             (update-in x [:response ::details] (fnil conj [])
-              (select-keys row [::event ::label ::relative-timestamp ::duration :com.wsscode.pathom.connect/waiting-key :com.wsscode.pathom.connect/input-data
+              (select-keys row [::event ::label ::style ::relative-timestamp ::duration :com.wsscode.pathom.connect/waiting-key :com.wsscode.pathom.connect/input-data
                                 :com.wsscode.pathom.parser/provides :com.wsscode.pathom.connect/sym :com.wsscode.pathom.core/error :com.wsscode.pathom.connect/items-count :com.wsscode.pathom.connect/plan :key]))

             :com.wsscode.pathom.parser/value-return
             (-> x
-                (update-in [:response ::children key ::details] (fnil conj []) (select-keys row [::event ::label ::relative-timestamp]))
+                (update-in [:response ::children key ::details] (fnil conj []) (select-keys row [::event ::label ::style ::relative-timestamp]))
                 (update-in [:response ::children key] assoc ::duration (- relative-timestamp (get-in x [:response ::children key ::relative-timestamp]))))

             (trace-tree-collect x row)))


Pre: Don't insert nil tx where it should not be.

--- src/common/datomish/transact.cljc
+++ src/common/datomish/transact.cljc
@@ -61,7 +61,7 @@
                      db-after  ;; The DB after the transaction.
                      tx        ;; The tx ID represented by the transaction in this report; refer :db/tx.
                      txInstant ;; The timestamp instant when the the transaction was processed/committed in this report; refer :db/txInstant.
-                     entities  ;; The set of entities (like [:db/add e a v tx]) processed.
+                     entities  ;; The set of entities (like [:db/add e a v]) processed.
                      tx-data   ;; The set of datoms applied to the database, like (Datom. e a v tx added).
                      tempids   ;; The map from id-literal -> numeric entid.
                      part-map  ;; Map {:db.part/user {:start 0x10000 :idx 0x10000}, ...}.
@@ -118,7 +118,7 @@
     true
     entity))

-(defn maybe-ident->entid [db [op e a v tx :as orig]]
+(defn maybe-ident->entid [db [op e a v :as orig]]
   ;; We have to handle all ops, including those when a or v are not defined.
   (let [e (db/entid db e)
         a (db/entid db a)
@@ -128,7 +128,7 @@
     (when (and a (not (integer? a)))
       (raise "Unknown attribute " a
              {:form orig :attribute a}))
-    [op e a v tx]))
+    [op e a v]))

 (defrecord Transaction [db tempids entities])


Move fn to nav

Move fn to nav

--- src/discuss/components/options.cljs
+++ src/discuss/components/options.cljs
@@ -5,18 +5,6 @@
             [discuss.translations :as translations :refer [translate]]
             [discuss.utils.common :as lib]
             [discuss.utils.views :as vlib]))
-
-(defn entry
-  "Entrypoint to show options. Should be something like a onclick handler."
-  []
-  (dom/div #js {:className "text-muted pull-right"}
-           (dom/div #js {:className "pointer"
-                         :onClick   (fn []
-                                      (lib/next-view! (lib/current-view))
-                                      (lib/change-view! :options))}
-                    (vlib/fa-icon "fa-cog")
-                    " "
-                    (translate :options :heading))))

 (defn- option-row
   "Generic row for multiple settings."


Add many improvements to geom ns.

Add many improvements to geom ns.

--- frontend/src/uxbox/main/geom.cljs
+++ frontend/src/uxbox/main/geom.cljs
@@ -5,14 +5,14 @@
 ;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>

 (ns uxbox.main.geom
-  (:require [uxbox.util.geom.matrix :as gmt]
+  (:require [cljs.pprint :refer [pprint]]
+            [uxbox.util.geom.matrix :as gmt]
             [uxbox.util.geom.point :as gpt]
             [uxbox.util.math :as mth]
             [uxbox.store :as st]))

 ;; --- Relative Movement

-;; TODO: revisit, maybe dead code
 (declare move-rect)
 (declare move-path)
 (declare move-circle)
@@ -87,16 +87,16 @@
   "A specialized function for absolute moviment
   for rect-like shapes."
   [shape {:keys [x y] :as pos}]
-  (let [dx (if x (- (:x1 shape) x) 0)
-        dy (if y (- (:y1 shape) y) 0)]
+  (let [dx (if x (- x (:x1 shape)) 0)
+        dy (if y (- y (:y1 shape)) 0)]
     (move shape (gpt/point dx dy))))

 (defn- absolute-move-circle
   "A specialized function for absolute moviment
   for rect-like shapes."
   [shape {:keys [x y] :as pos}]
-  (let [dx (if x (- (:cx shape) x) 0)
-        dy (if y (- (:cy shape) y) 0)]
+  (let [dx (if x (- x(:cx shape)) 0)
+        dy (if y (- y (:cy shape)) 0)]
     (move shape (gpt/point dx dy))))

 (defn- absolute-move-group
@@ -160,117 +160,6 @@
   [{:keys [rx ry] :as shape}]
   (merge shape {:width (* rx 2)
                 :height (* ry 2)}))
-
-;; --- Vertex Access
-
-(declare get-rect-vertext-point)
-(declare get-circle-vertext-point)
-
-(defn get-vertex-point
-  [shape id]
-  (case (:type shape)
-    :icon (get-rect-vertext-point shape id)
-    :image (get-rect-vertext-point shape id)
-    :rect (get-rect-vertext-point shape id)
-    :circle (get-circle-vertext-point shape id)
-    :text (get-rect-vertext-point shape id)))
-
-(defn- get-rect-vertext-point
-  [{:keys [x1 y1 x2 y2]} id]
-  (case id
-    :top-left (gpt/point x1 y1)
-    :top-right (gpt/point x2 y1)
-    :bottom-left (gpt/point x1 y2)
-    :bottom-right (gpt/point x2 y2)
-    :top (gpt/point (/ (+ x1 x2) 2) y1)
-    :right (gpt/point x2 (/ (+ y1 y2) 2))
-    :left (gpt/point x1 (/ (+ y1 y2) 2))
-    :bottom (gpt/point (/ (+ x1 x2) 2)
-                       (/ (+ y1 y2) 2))))
-
-(defn- get-circle-vertext-point
-  [{:keys [rx ry]} id]
-  (gpt/point rx ry))
-
-;; --- Vertex Movement (Relative)
-
-(declare move-rect-vertex)
-(declare move-circle-vertex)
-
-(defn move-vertex
-  "Resize the shape moving one of its vertex using
-  relative delta."
-  [shape vid dpoint]
-  (case (:type shape)
-    :rect (move-rect-vertex shape vid dpoint)
-    :text (move-rect-vertex shape vid dpoint)
-    :icon (move-rect-vertex shape vid dpoint)
-    :image (move-rect-vertex shape vid dpoint)
-    :path (move-rect-vertex shape vid dpoint)
-    :circle (move-circle-vertex shape vid dpoint)))
-
-(defn- move-rect-vertex
-  "A specialized function for vertex movement
-  for rect-like shapes."
-  [shape vid {dx :x dy :y lock? :lock}]
-  (letfn [(handle-positioning [{:keys [x1 x2 y1 y2] :as shape}]
-            (case vid
-              :top-left (assoc shape
-                               :x1 (min x2 (+ x1 dx))
-                               :y1 (min y2 (+ y1 dy)))
-              :top-right (assoc shape
-                                :x2 (max x1 (+ x2 dx))
-                                :y1 (min y2 (+ y1 dy)))
-              :bottom-left (assoc shape
-                                  :x1 (min x2 (+ x1 dx))
-                                  :y2 (max y1 (+ y2 dy)))
-              :bottom-right (assoc shape
-                                   :x2 (max x1 (+ x2 dx))
-                                   :y2 (max y1 (+ y2 dy)))
-              :top (assoc shape :y1 (min y2 (+ y1 dy)))
-              :right (assoc shape :x2 (max x1 (+ x2 dx)))
-              :bottom (assoc shape :y2 (max y1 (+ y2 dy)))
-              :left (assoc shape :x1 (min x2 (+ x1 dx)))))
-
-          (handle-proportion [{:keys [y1 proportion proportion-lock] :as shape}]
-            (let [{:keys [width height]} (size shape)]
-              (if (or lock? proportion-lock)
-                (assoc shape :y2 (+ y1 (/ width proportion)))
-                shape)))]
-    (-> shape
-        (handle-positioning)
-        (handle-proportion))))
-
-(defn- move-circle-vertex
-  "A specialized function for vertex movement
-  for circle shapes."
-  [shape vid {dx :x dy :y lock? :lock}]
-  (letfn [(handle-positioning [shape]
-            (case vid
-              :top-left (assoc shape
-                               :rx (max 0 (- (:rx shape) dx))
-                               :ry (max 0 (- (:ry shape) dy)))
-              :top-right (assoc shape
-                                :rx (max 0 (+ (:rx shape) dx))
-                                :ry (max 0 (- (:ry shape) dy)))
-              :bottom-left (assoc shape
-                                  :rx (max 0 (- (:rx shape) dx))
-                                  :ry (max 0 (+ (:ry shape) dy)))
-              :bottom-right (assoc shape
-                                   :rx (max 0 (+ (:rx shape) dx))
-                                   :ry (max 0 (+ (:ry shape) dy)))
-              :top (assoc shape :ry (max 0 (- (:ry shape) dy)))
-              :right (assoc shape :rx (max 0 (+ (:rx shape) dx)))
-              :bottom (assoc shape :ry (max 0 (+ (:ry shape) dy)))
-              :left (assoc shape :rx (max 0 (+ (:rx shape) dx)))))
-          (handle-proportion [{:keys [rx proportion proportion-lock] :as shape}]
-            (let [{:keys [width height]} (size shape)]
-              (if (or lock? proportion-lock)
-                (assoc shape :ry (/ rx proportion))
-                shape)))]
-    (-> shape
-        (handle-positioning)
-        (handle-proportion))))

 ;; --- Paths

@@ -500,7 +389,7 @@

 (defn shapes->rect-shape
   ([shapes] (shapes->rect-shape @st/state shapes))
-  ([state shapes]
+  ([state [shape :as shapes]]
    {:pre [(seq shapes)]}
    (let [shapes (map shape->rect-shape shapes)
          minx (apply min (map :x1 shapes))
@@ -511,12 +400,14 @@
       :y1 miny
       :x2 maxx
       :y2 maxy
-      ::shapes shapes})))
+      :type :rect})))

 (defn- group->rect-shape
-  [state {:keys [items] :as group}]
+  [state {:keys [id items rotation] :as group}]
   (let [shapes (map #(get-in state [:shapes %]) items)]
-    (shapes->rect-shape state shapes)))
+    (-> (shapes->rect-shape state shapes)
+        (assoc :rotation rotation)
+        (assoc :id id))))

 (defn- path->rect-shape
   [state {:keys [points] :as shape}]
@@ -604,161 +495,65 @@

 ;; --- Outer Rect

-(declare outer-rect-generic)
-(declare outer-rect-circle)
-(declare outer-rect-path)
-(declare outer-rect-group)
-(declare apply-rotation-transformation)
-(declare apply-parent-deltas)
-
-(defn outer-rect
+(declare selection-rect-generic)
+(declare selection-rect-group)
+
+(defn rotation-matrix
+  "Generate a rotation matrix from shape."
+  [{:keys [x1 y1 rotation] :as shape}]
+  (let [{:keys [width height]} (size shape)
+        x-center (+ x1 (/ width 2))
+        y-center (+ y1 (/ height 2))]
+    (-> (gmt/matrix)
+        ;; (gmt/rotate* rotation (gpt/point x-center y-center)))))
+        (gmt/translate  x-center y-center)
+        (gmt/rotate rotation)
+        (gmt/translate (- x-center) (- y-center)))))
+
+(defn rotate-shape
+  "Apply the transformation matrix to the shape."
+  [shape]
+  (let [mtx (rotation-matrix (size shape))]
+    (transform shape mtx)))
+
+(defn selection-rect
+  "Return the selection rect for the shape."
   ([shape]
-   (outer-rect @st/state shape))
+   (selection-rect @st/state shape))
   ([state shape]
-   (let [shape (case (:type shape)
-                 :path (outer-rect-path state shape)
-                 :circle (outer-rect-circle state shape)
-                 :group (outer-rect-group state shape)
-                 (outer-rect-generic state shape))]
-     (if (:group shape)
-       (let [group (get-in state [:shapes (:group shape)])]
-         (apply-parent-deltas state shape (:group group)))
-       shape))))
-
-(defn- apply-parent-deltas
-  [state {:keys [x y] :as shape} id]
-  (if-let [group (get-in state [:shapes id])]
-    (let [props {:x (+ x (:dx group 0))
-                 :y (+ y (:dy group 0))}]
-      (apply-parent-deltas state (merge shape props) (:group group)))
-    shape))
-
-(defn- outer-rect-generic
-  [state {:keys [x1 y1 x2 y2 group] :as shape}]
-  (let [group (get-in state [:shapes group])
-        props {:x (+ x1 (:dx group 0))
-               :y (+ y1 (:dy group 0))
-               :width (- x2 x1)
-               :height (- y2 y1)}]
-    (-> (merge shape props)
-        (apply-rotation-transformation))))
-
-(defn- outer-rect-circle
-  [state {:keys [cx cy rx ry group] :as shape}]
-  (let [group (get-in state [:shapes group])
-        props {:x (+ (- cx rx) (:dx group 0))
-               :y (+ (- cy ry) (:dy group 0))
-               :width (* rx 2)
-               :height (* ry 2)}]
-    (-> (merge shape props)
-        (apply-rotation-transformation))))
-
-(defn- outer-rect-path
-  [state {:keys [points group] :as shape}]
-  (let [group (get-in state [:shapes group])
-        minx (apply min (map :x points))
-        miny (apply min (map :y points))
-        maxx (apply max (map :x points))
-        maxy (apply max (map :y points))
-
-        props {:x (+ minx (:dx group 0))
-               :y (+ miny (:dy group 0))
-               :width (- maxx minx)
-               :height (- maxy miny)}]
-    (-> (merge shape props)
-        (apply-rotation-transformation))))
-
-
-(defn- outer-rect-group
-  [state {:keys [id group rotation dx dy] :as shape}]
-  (let [shapes (->> (:items shape)
+   (case (:type shape)
+     :group (selection-rect-group state shape)
+     (selection-rect-generic state shape))))
+
+(defn- selection-rect-generic
+  [state {:keys [id x1 y1 x2 y2] :as shape}]
+  (let [resize-xf (:tmp-resize-xform shape (gmt/matrix))
+        displc-xf (-> (:tmp-displacement shape (gpt/point 0 0))
+                      (gmt/translate-matrix))]
+    (-> (shape->rect-shape shape)
+        (assoc :type :rect :id id)
+        (transform resize-xf)
+        (transform displc-xf)
+        (rotate-shape)
+        (size))))
+
+(defn- selection-rect-group
+  [state {:keys [id group items] :as shape}]
+  (let [resize-xf (:tmp-resize-xform shape (gmt/matrix))
+        displc-xf (-> (:tmp-displacement shape (gpt/point 0 0))
+                      (gmt/translate-matrix))
+        shapes (->> items
                     (map #(get-in state [:shapes %]))
-                    (map #(outer-rect state %)))
-        x (apply min (map :x shapes))
-        y (apply min (map :y shapes))
-        x' (apply max (map (fn [{:keys [x width]}] (+ x width)) shapes))
-        y' (apply max (map (fn [{:keys [y height]}] (+ y height)) shapes))
-        width (- x' x)
-        height (- y' y)]
-    (-> (merge shape {:width width :height height :x x :y y})
-        (apply-rotation-transformation))))
-
-(declare apply-rotation)
-
-(defn- apply-rotation-transformation
-  [{:keys [x y width height rotation] :as shape}]
-  (let [center-x (+ x (/ width 2))
-        center-y (+ y (/ height 2))
-
-        angle (mth/radians (or rotation 0))
-        x1 (- x center-x)
-        y1 (- y center-y)
-
-        x2 (- (+ x width) center-x)
-        y2 (- y center-y)
-
-        [rx1 ry1] (apply-rotation [x1 y1] rotation)
-        [rx2 ry2] (apply-rotation [x2 y2] rotation)
-
-        [d1 d2] (cond
-                  (and (>= rotation 0)
-                       (< rotation 90))
-                  [(mth/abs ry1)
-                   (mth/abs rx2)]
-
-                  (and (>= rotation 90)
-                       (< rotation 180))
-                  [(mth/abs ry2)
-                   (mth/abs rx1)]
-
-                  (and (>= rotation 180)
-                       (< rotation 270))
-                  [(mth/abs ry1)
-                   (mth/abs rx2)]
-
-                  (and (>= rotation 270)
-                       (<= rotation 360))
-                  [(mth/abs ry2)
-                   (mth/abs rx1)])
-        final-x (- center-x d2)
-        final-y (- center-y d1)
-        final-width (* d2 2)
-        final-height (* d1 2)]
-    (merge shape
-           {:x final-x
-            :y final-y
-            :width final-width
-            :height final-height})))
-
-;; --- Outer Rect Coll
-
-(defn outer-rect-coll
-  [shapes]
-  {:pre [(seq shapes)]}
-  (let [shapes (map outer-rect shapes)
-        x (apply min (map :x shapes))
-        y (apply min (map :y shapes))
-        x' (apply max (map (fn [{:keys [x width]}] (+ x width)) shapes))
-        y' (apply max (map (fn [{:keys [y height]}] (+ y height)) shapes))
-        width (- x' x)
-        height (- y' y)]
-    {:width width
-     :height height
-     :x x
-     :y y}))
+                    (map #(selection-rect state %)))]
+
+    (-> (shapes->rect-shape shapes)
+        (assoc :id id)
+        (transform resize-xf)
+        (transform displc-xf)
+        (rotate-shape)
+        (size))))

 ;; --- Helpers
-
-(defn apply-rotation
-  [[x y :as v] rotation]
-  (let [angle (mth/radians rotation)
-        rx (- (* x (mth/cos angle))
-              (* y (mth/sin angle)))
-        ry (+ (* x (mth/sin angle))
-              (* y (mth/cos angle)))]
-    (let [r [(mth/precision rx 6)
-             (mth/precision ry 6)]]
-      r)))

 (defn resolve-parent
   "Recursively resolve the real shape parent."
@@ -773,47 +568,9 @@
   "Check if a shape is contained in the
   provided selection rect."
   [shape selrect]
-  (let [sx1 (:x selrect)
-        sx2 (+ sx1 (:width selrect))
-        sy1 (:y selrect)
-        sy2 (+ sy1 (:height selrect))
-        rx1 (:x shape)
-        rx2 (+ rx1 (:width shape))
-        ry1 (:y shape)
-        ry2 (+ ry1 (:height shape))]
-    (and (neg? (- (:y selrect) (:y shape)))
-         (neg? (- (:x selrect) (:x shape)))
-         (pos? (- (+ (:y selrect)
-                     (:height selrect))
-                  (+ (:y shape)
-                     (:height shape))))
-         (pos? (- (+ (:x selrect)
-                     (:width selrect))
-                  (+ (:x shape)
-                     (:width shape)))))))
-
-;; TODO: maybe remove, seems it not used anymore.
-
-(defn translate-coords
-  "Given a shape and initial coords, transform
-  it mapping its coords to new provided initial coords."
-  ([shape x y]
-   (translate-coords shape x y -))
-  ([shape x y op]
-   (let [x' (:x shape)
-         y' (:y shape)]
-     (assoc shape :x (op x' x) :y (op y' y)))))
-
-;; This function will be deleted when selrect is implemented properly
-
-(defn parent-satisfies?
-  "Resolve the first parent that satisfies a condition."
-  [{:keys [group] :as shape} pred]
-  (let [shapes-by-id (:shapes @st/state)]
-    (if group
-      (loop [parent (get shapes-by-id group)]
-        (cond
-          (pred parent) true
-          (:group parent) (recur (get shapes-by-id (:group parent)))
-          :else false))
-      false)))
+  (let [{sx1 :x1 sx2 :x2 sy1 :y1 sy2 :y2} selrect
+        {rx1 :x1 rx2 :x2 ry1 :y1 ry2 :y2} shape]
+    (and (neg? (- sy1 ry1))
+         (neg? (- sx1 rx1))
+         (pos? (- sy2 ry2))
+         (pos? (- sx2 rx2)))))


feat(ccw.e4.dsl): added a new sugar to defcommand for common usecases

--- ccw.core.e4/src/clj/ccw/e4/dsl.clj
+++ ccw.core.e4/src/clj/ccw/e4/dsl.clj
@@ -11,12 +11,12 @@
 (defn handler-factory [context nsname name]
   (GenericHandler. (str nsname "/" name)))

-(defmacro defcommand [command command-name & {:as opts}]
+(defmacro defcommand' [command opts]
   `(def ~command
      (let [spec# (-> (merge
                        {:id ~(str *ns* "/" command)
-                        :name ~command-name}
-                       ~opts)
+                        :name ~(opts :name (str command))}
+                       ~(dissoc opts :name))
                    (update-in [:transient-data]
                               assoc
                               "ccw/load-key" *load-key*)
@@ -25,6 +25,21 @@
                               "ccw"))]
        ;(println "spec#:" spec#)
        (m/merge-command! @m/app spec#))))
+
+(defmacro defcommand
+   "(defcommand reset-components \"Reset Components\" \"Cmd+U R\"
+      [context] (repl/send '(user/reset)))
+    is similar to
+    (defcommand reset-components \"Reset Components\")
+    (defkeybinding reset-components \"Cmd+U R\")
+    (defhandler reset-components (fn [context] (repl/send '(user/reset))))"
+  [command name & [keybinding arg-vec & body :as rest]]
+  (if (keyword? keybinding)
+    `(defcommand' ~command ~(into {:name name} (apply hash-map rest)))
+    `(do
+       (defcommand' ~command ~{:name name})
+       (defhandler ~command (fn ~arg-vec ~@body))
+       (defkeybinding ~command ~keybinding))))

 ;;; TODO register for deletion in  m/*elements* (a set)
 (defmacro defhandler


create connection with a custom thread pool

the default thread pool has 5 threads which is a bit low...

--- src/fscrawler_tika_convert/core.clj
+++ src/fscrawler_tika_convert/core.clj
@@ -18,7 +18,8 @@
   (:require [com.brainbot.iniconfig :as ini])
   (:require [tika])
   (:import java.io.File)
-  (:import [java.util.concurrent TimeUnit ScheduledThreadPoolExecutor Callable]))
+  (:import [com.rabbitmq.client Address ConnectionFactory Connection Channel ShutdownListener])
+  (:import [java.util.concurrent Executors]))

 (defn map-from-routing-key-string
@@ -143,7 +144,10 @@
                    (String. payload "UTF-8")
                    delivery-tag
                    content-type
-                   type)))
+                   type))
+  (Thread/sleep 1000)
+  (println "done")
+  (lb/ack ch delivery-tag))

 (defn connect-loop
@@ -151,10 +155,10 @@
   handle-connection with the connection object. if the connection
   fails, wait for 5 seconds and try again"

-  [rmq-settings handle-connection]
+  [connect handle-connection]
   (while true
     (try
-      (let [conn (rmq/connect rmq-settings)
+      (let [conn (connect)
             restart-promise (promise)
             sl   (rmq/shutdown-listener
                   (partial deliver restart-promise))]
@@ -170,15 +174,38 @@

+(defn publish-some-message
+  [conn]
+  (let [ch (lch/open conn)
+        queue-name (initialize-rabbitmq-structures ch "extract_content" "nextbot" "fscrawler:test")]
+    (doseq [i (range 100)]
+      (println "[main] Publishing...")
+      (lb/publish ch "nextbot" queue-name "Hello!" :content-type "text/plain" :type "greetings.hi"))
+    (lch/close ch)
+    queue-name))
+
+
+
+(defn connect-with-thread-pool
+  [rmq-settings thread-pool]
+  (let [cf (#'rmq/create-connection-factory rmq-settings)]
+    (.newConnection ^ConnectionFactory cf thread-pool)))
+
+
 (defn doit
   []
-  (connect-loop
-   {}
-   (fn [conn]
-     (let [ch (lch/open conn)
-           queue-name (initialize-rabbitmq-structures ch "extract_content" "nextbot" "fscrawler:test")
-           tag (lcons/subscribe ch queue-name new-handle-msg)]
-       (println "tag is" tag)))))
+  (let [thread-pool (Executors/newFixedThreadPool 500)
+        connect (partial connect-with-thread-pool {} thread-pool)]
+    (connect-loop
+     connect
+     (fn [conn]
+       (let [queue-name (publish-some-message conn)]
+         (doseq [i (range 200)]
+           (let [ch (lch/open conn)]
+             (lb/qos ch 1)
+             (lcons/subscribe ch queue-name new-handle-msg))))
+       (println "fn-done")))))
+

 (defn -main [& args]
   (log-config/set-logger!)


rename new

rename new

--- src/gamma_driver/drivers/basic.cljs
+++ src/gamma_driver/drivers/basic.cljs
@@ -9,9 +9,9 @@
   (let [{:keys [resource-state mapping-fn produce-fn]} driver
         k (mapping-fn resource-spec)
         existing-resource (@resource-state k)
-        new (produce-fn driver constructor-fn existing-resource resource-spec)]
-    (swap! resource-state assoc k new)
-    new))
+        new-spec (produce-fn driver constructor-fn existing-resource resource-spec)]
+    (swap! resource-state assoc k new-spec)
+    new-spec))

 (defn default-produce-fn [driver constructor-fn old-spec new-spec]
   (if (and (:immutable? old-spec) (:immutable? new-spec))
@@ -22,15 +22,15 @@
 (defn input [driver program binder-fn variable new-spec]
   (let [{:keys [input-fn input-state]} driver
         old-spec (get-in @input-state [program variable] {})
-        new (input-fn driver program binder-fn variable old-spec new-spec)]
-    (swap! input-state assoc-in [program variable] new)))
+        new-spec (input-fn driver program binder-fn variable old-spec new-spec)]
+    (swap! input-state assoc-in [program variable] new-spec)))

-(defn default-input-fn [driver program binder-fn variable old new]
-  (let [t (:tag new)]
-    (if (and old new (= (old t) (new t)))
-      new
-      (binder-fn (gd/gl driver) program variable new))))
+(defn default-input-fn [driver program binder-fn variable old-spec new-spec]
+  (let [t (:tag new-spec)]
+    (if (and old-spec new-spec (= (old-spec t) (new-spec t)))
+      new-spec
+      (binder-fn (gd/gl driver) program variable new-spec))))


CMR-2354 Removes extraneous println

CMR-2354 Removes extraneous println

--- search-app/src/cmr/search/services/transformer.clj
+++ search-app/src/cmr/search/services/transformer.clj
@@ -47,7 +47,6 @@
   "Transforms the metadata of the concept to the given format"
   [context concept target-format]
   (let [concept-format (:format concept)]
-    (println "concept-format =" concept-format)
     (if-let [xsl (types->xsl [(mt/mime-type->format concept-format) target-format])]
       ; xsl is defined for the transformation, so use xslt
       (xslt/transform (:metadata concept) (get-template context xsl))


Support Term-Seq. Shows even more why should be refactored to multimethods!

--- services/split-filter-fastqs.clj
+++ services/split-filter-fastqs.clj
@@ -11,6 +11,7 @@
              (case exp
                :tnseq (htts/split-filter-fastqs eid)
                :rnaseq (htrs/split-filter-fastqs eid)
+               :termseq (httm/split-filter-fastqs eid)
                :wgseq (htws/split-filter-fastqs eid))
              eid)))


Print divider line before each lazytest.watch report

--- src/main/clojure/lazytest/watch.clj
+++ src/main/clojure/lazytest/watch.clj
@@ -33,6 +33,7 @@
       (when (seq names)
 	(reset! timestamp-atom (System/currentTimeMillis))
 	(println)
+	(println "======================================================================")
 	(println "Reloading" (join ", " names))
 	(doseq [n names] (remove-ns n))
 	(doseq [n names] (require n :reload))


add a custom serializer for charsets

add a custom serializer for charsets

--- src/main/clojure/powderkeg/kryo.clj
+++ src/main/clojure/powderkeg/kryo.clj
@@ -8,6 +8,13 @@
 (defn- serializer-factory [f]
  (reify com.esotericsoftware.kryo.factories.SerializerFactory
    (makeSerializer [factory kryo class] (f kryo class))))
+
+(def charset-serializer
+  (serializer
+    (fn read-charset [_ ^com.esotericsoftware.kryo.Kryo kryo ^com.esotericsoftware.kryo.io.Input input class]
+      (java.nio.charset.Charset/forName (.readString input)))
+    (fn write-charset [_ ^com.esotericsoftware.kryo.Kryo kryo ^com.esotericsoftware.kryo.io.Output output ^java.nio.charset.Charset cs]
+       (.writeString output (.name cs)))))

 (def default-serializers
   {clojure.lang.ITransientCollection
@@ -41,11 +48,13 @@
        (.writeClass kryo output class)
        (.writeByte output (if (some-> class .isPrimitive) 1 0))))
    java.util.Collection
-    (serializer-factory
-      (fn [kryo ^Class class]
-        (if (try (.getDeclaredConstructor class (into-array Class nil)) (catch NoSuchMethodException _ nil))
-          (com.esotericsoftware.kryo.serializers.CollectionSerializer.)
-          (com.esotericsoftware.kryo.serializers.FieldSerializer. kryo class))))})
+   (serializer-factory
+     (fn [kryo ^Class class]
+       (if (try (.getDeclaredConstructor class (into-array Class nil)) (catch NoSuchMethodException _ nil))
+         (com.esotericsoftware.kryo.serializers.CollectionSerializer.)
+         (com.esotericsoftware.kryo.serializers.FieldSerializer. kryo class))))
+   java.nio.charset.Charset
+   (serializer-factory (constantly charset-serializer))})

 (def void-serializer (serializer (fn [_ _ _ _]) (fn [_ _ _ _])))


add some test about clojure function

add some test about clojure function

--- src/learnclojure/chapt1/core5.clj
+++ src/learnclojure/chapt1/core5.clj
@@ -3,4 +3,67 @@
 ;;一个简单函数的定义
 (fn [x]
   (+ x 10))
-
+;;函数定义的参数和调用函数实际传递的参数之间的定义是通过参数位置定义的
+((fn [x]
+   (+ x 10)) 8)
+;;上面的代码相当于
+(let [x 8]
+  (+ x 10))
+;;多个参数的函数
+((fn [x y z]
+   (+ x y z))
+  3 4 12)
+;;等价于
+(let [x 3 y 4 z 12]
+  (+ x y z))
+;;函数可以有多个参数列表
+(def strange-adder (fn adder-self-reference
+                     ([x] (adder-self-reference x 1))
+                     ([x y] (+ x y))))
+;;等价于下面的代码，defn是一个封装了def和fn功能的宏，比较常用
+(defn strange-adder
+  ([x] (strange-adder x 1))
+  ([x y] (+ x y)))
+(strange-adder 1)
+(strange-adder 1 2)
+;;letfn可以定义同时定义多个具名函数，并且这些函数可以互相引用
+(letfn [(odd? [n]
+              (even? (- n 2)))
+        (even? [n]
+               (or (zero? n)
+                   (odd? (- n 2))))]
+  (even? 4))
+;;可变参函数，下面函数中的rest被称为剩余参数
+(defn concat-rest
+  [_ & rest]
+  (apply str (butlast rest)))
+(concat-rest 1 2 3 4)
+;;剩余参数可以像其他序列那样解构
+(defn make-user1
+  [& [user-id user-name]]
+  {:user-id   (or user-id
+                  (str (UUID/randomUUID)))
+   :user-name (or user-name
+                  (str (rand-int 10)))})
+;;(make-user)
+(make-user1 "ef2f2a")
+;;关键字参数。可以让函数使用者不必按某个特定的顺序传参
+(defn make-user2
+  [username & {:keys [email join-date]
+               :or   {join-date (Date.)}}]
+  {:user-name username
+   :join-date join-date
+   :email     email
+   ;;2.592e9 -> one month in ms
+   :exp-date  (Date. (long (+ 2.592e9 (.getTime join-date))))
+   })
+(make-user2 "Zijunjie")
+(make-user2 "Zijunjie"
+            :join-date (Date. 111 0 1)
+            :email "zjjblue@126.com")
+;;关键字参数是利用let的map解构的特性实现的，所以关键字的参数名字理论上可以是任何类型的值
+;;比如字符串 数字 甚至集合 但最好是用关键字来作为map的key的名字。
+(defn foo
+  [& {k ["z" 1]}]
+  (inc k))
+(foo ["z" 1] 5)


fixing dependency

fixing dependency

--- resources/leiningen/new/ow_app/project.clj
+++ resources/leiningen/new/ow_app/project.clj
@@ -13,7 +13,7 @@

                  ;;; program flow / lifecycle:
                  [integrant    "0.4.1"]           ;; component lifecycle management
-                 [clj-starbuck "0.2.0-SNAPSHOT"]  ;; message based component communications
+                 [clj-starbuck "2.0.0-SNAPSHOT"]  ;; message based component communications
                  [re-frame     "0.9.1"]           ;; browser program flow

                  ;;; http:


bugfix for empty jobs list

bugfix for empty jobs list

--- qmon.clj
+++ qmon.clj
@@ -15,9 +15,11 @@
 (declare split tree xprocs xres xtime)

 (defn colwidths [jobs]
-  (let [headwidth (map #(count ((zipmap headkeys headvals) %)) headkeys)
-        datawidth (map #(reduce max (map count (map % jobs))) headkeys)]
-    (map max headwidth datawidth)))
+  (let [headwidth (map #(count ((zipmap headkeys headvals) %)) headkeys)]
+    (if (empty? jobs)
+      headwidth
+      (let [datawidth (map #(reduce max (map count (map % jobs))) headkeys)]
+        (map max headwidth datawidth)))))

 (defn jobinfo [job]
   (let [fns (map #(ns-resolve *ns* (symbol (str "x" (name %)))) headkeys)


Add fn for getting the committer's email from a git commit

--- backend/src/circle/backend/git.clj
+++ backend/src/circle/backend/git.clj
@@ -1,6 +1,7 @@
 (ns circle.backend.git
   "fns for interacting with git."
   (:import java.io.File)
+  (:require [clojure.string :as str])
   (:use [clojure.tools.logging :only (infof)])
   (:use [arohner.utils :only (inspect)])
   (:require [circle.sh :as sh]))
@@ -89,4 +90,12 @@
   [repo]
   (->
    (git-fn* (sh/quasiquote (git log -1 "--pretty=format:%H" "origin/master")))
-   :out))+   :out))
+
+(defn committer-email
+  "Returns the email address of the committer"
+  [repo commit-id]
+  (->
+   (git-fn* (sh/quasiquote (git log ~commit-id -1 "--format=%ae")))
+   :out
+   (str/trim)))


core: not

core: not

--- core.clj
+++ core.clj
@@ -365,3 +365,9 @@
   {:tag Bool
    :added "1.0"}
   [x] (=* x true))
+
+(defn not
+  "Returns true if x is logical false, false otherwise."
+  {:tag Bool
+   :added "1.0"}
+  [x] (if x false true))


improve group docstring

improve group docstring

--- src/overtone/sc/node.clj
+++ src/overtone/sc/node.clj
@@ -204,7 +204,17 @@

 (defn group
   "Create a new synth group as a child of the target group. By default
-  creates a new group at the tail of the root group."
+  creates a new group at the tail of the root group.
+
+  The position can be one of :head, :tail :before, :after, or :replace.
+
+  (group)                  ;=> Creates a new group at the tail of the
+                               root-group
+  (group \"foo\")            ;=> Creates a group named foo
+  (group :tail my-g)       ;=> Creates a group at the tail of group
+                               my-g
+  (group \"bar\" :head my-g) ;=> Creates a named group at the head of
+                               group my-g"
   ([] (group :tail (root-group)))
   ([name] (group name :tail (root-group)))
   ([position target]
@@ -571,4 +581,3 @@
             (filter #(and (:name %)
                           (matcher-fn re-or-str (:name %)))
                     (node-tree-seq root))))))
-


timeline return fn returns coroutine or false

--- core.clj
+++ core.clj
@@ -138,7 +138,8 @@
     (let [current (volatile! (first fns))
           fns (volatile! (rest fns))
           ^UnityEngine.MonoBehaviour coro-root (mono-obj)
-          ^tween.core.TimeLineCursor cursor (*TimeLineCursor 0 false)]
+          ^tween.core.TimeLineCursor cursor (*TimeLineCursor 0 false)
+          routine
       (.StartCoroutine coro-root
         (reify IEnumerator
           (MoveNext [this]
@@ -152,8 +153,8 @@
                     (!TimeLineCursor cursor)
                     ))
                 (catch Exception e false))))
-          (get_Current [this] (.v cursor))))
-      (fn [] (if @current true false)))))
+          (get_Current [this] (.v cursor))))]
+      (fn [] (if @current routine false)))))

 (defn timeline-1 [fns] (timeline (map #(%) fns)))

@@ -163,7 +164,8 @@
     (let [cnt (int (dec (.Length fns)))
           current (volatile! ((aget fns 0)))
           ^UnityEngine.MonoBehaviour coro-root (mono-obj)
-          ^tween.core.TimeLineCursor cursor (*TimeLineCursor 0 false)]
+          ^tween.core.TimeLineCursor cursor (*TimeLineCursor 0 false)
+          routine
       (.StartCoroutine coro-root
         (reify IEnumerator
           (MoveNext [this]
@@ -179,8 +181,8 @@
                         (vreset! current ((aget fns (.i cursor))))
                         @current)))
               (catch Exception e false)))
-          (get_Current [this] (.v cursor))))
-      (fn [] (.v cursor)))))
+          (get_Current [this] (.v cursor))))]
+      (fn [] (if (.v cursor) routine false)))))

 (defmacro timeline* [& fns]
   (let [[opts fns] ((juxt (comp set filter) remove) keyword? fns)


Exclude svg-icon type from options.

Exclude svg-icon type from options.

--- src/uxbox/ui/workspace/options.cljs
+++ src/uxbox/ui/workspace/options.cljs
@@ -14,9 +14,8 @@
             [uxbox.util.data :refer (parse-int parse-float)]))

 (def +menus-map+
-  {:builtin/icon [:menu/measures :menu/fill]
-   :builtin/group [:menu/measures]
-   :builtin/icon-svg [:menu/measures]})
+  {:builtin/icon [:menu/measures :menu/fill :menu/stroke]
+   :builtin/group [:menu/measures]})

 (def +menus-by-id+
   {:menu/measures


Align map indentation

Align map indentation

Change-Id: Ife6b22838735bc084f74cbfd2088a46330887bd5

--- src/qcast/infoq/site.clj
+++ src/qcast/infoq/site.clj
@@ -22,9 +22,9 @@
        "Safari/9537.53"))

 (def ^:private http-options
-  {:headers {"User-Agent" ios-user-agent}
+  {:headers   {"User-Agent" ios-user-agent}
    :insecure? true
-   :as      :stream})
+   :as        :stream})

 ;;; Internals


Support bitbucket user keys

Support bitbucket user keys

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -908,14 +908,111 @@
           "github" (str (gh-utils/http-endpoint) "/" (vcs-url/project-name (:vcs_url project)) "/settings/keys"))
         (and (= "github-user-key" (:type key)) (= (:login key) (:login user)))
         (str (gh-utils/http-endpoint) "/settings/ssh")
-
+        (and (= "bitbucket-user-key" (:type key))
+             (= (:login key) (-> user :bitbucket :login)))
+        (str (bb-utils/http-endpoint) "/account/user/" (:login key)
+             "/ssh-keys/")
         :else nil))

 (defn checkout-key-description [key project]
   (condp = (:type key)
     "deploy-key" (str (vcs-url/project-name (:vcs_url project)) " deploy key")
     "github-user-key" (str (:login key) " user key")
+    "bitbucket-user-key" (str (:login key) " user key")
     nil))
+
+(defmulti add-user-key-section (fn [data owner] (-> data :project-data :project :vcs-type keyword)))
+
+(defmethod add-user-key-section :github [data owner]
+  (reify
+    om/IRender
+    (render [_]
+      (let [user (:user data)
+            project-data (:project-data data)
+            project (:project project-data)
+            checkout-keys (:checkout-keys project-data)
+            project-id (project-model/id project)
+            project-name (vcs-url/project-name (:vcs_url project))]
+        (html
+         [:div.add-key
+          [:h4 "Add user key"]
+          [:p
+           "If a deploy key can't access all of your project's private dependencies, we can configure it to use an SSH key with the same level of access to GitHub repositories that you have."]
+          [:div.authorization
+           (if-not (user-model/public-key-scope? user)
+             (list
+              [:p "In order to do so, you'll need to grant authorization from GitHub to the \"admin:public_key\" scope. This will allow us to add a new authorized public key to your GitHub account."]
+              [:a.btn.ghu-authorize
+               {:href (gh-utils/auth-url :scope ["admin:public_key" "user:email" "repo"])
+                :title "Grant admin:public_key authorization so that we can add a new SSH key to your GitHub account"}
+               "Authorize w/ GitHub " [:i.fa.fa-github]])
+
+             [:div.request-user
+              (forms/managed-button
+               [:input.btn
+                {:tooltip "{ title: 'Create a new user key for this project, with access to all of the projects of your GitHub account.', animation: false }"
+                 :type "submit"
+                 :on-click #(do (raise! owner [:new-checkout-key-clicked {:project-id project-id
+                                                                          :project-name project-name
+                                                                          :key-type "github-user-key"}])
+                                false)
+                 :value (str "Create and add " (:login user) " user key" )
+                 :data-loading-text "Saving..."
+                 :data-success-text "Saved"}])])]])))))
+
+(defmethod add-user-key-section :bitbucket [data owner]
+  (reify
+    om/IRender
+    (render [_]
+      (let [user (:user data)
+            project-data (:project-data data)
+            project (:project project-data)
+            checkout-keys (:checkout-keys project-data)
+            project-id (project-model/id project)
+            project-name (vcs-url/project-name (:vcs_url project))]
+        (html
+         [:div.add-key
+          [:h4 "Create user key"]
+          [:p
+           "If a deploy key can't access all of your project's private dependencies, we can help you setup an SSH key with the same level of access to Bitbucket repositories that you have."]
+          [:div.authorization
+           [:div.request-user
+            (forms/managed-button
+             [:input.btn
+              {:tooltip "{ title: 'Create a new user key for this project, with access to all of the projects of your Bitbucket account.', animation: false }"
+               :type "submit"
+               :on-click #(do (raise! owner [:new-checkout-key-clicked {:project-id project-id
+                                                                        :project-name project-name
+                                                                        :key-type "bitbucket-user-key"}])
+                              false)
+               :value (str "Create " (:login user) " user key" )
+               :data-loading-text "Creating..."
+               :data-success-text "Created"}])]]])))))
+
+(defn bitbucket-add-user-key-instructions [data owner]
+  (reify
+    om/IRender
+    (render [_]
+      (let [{:keys [user key]} data]
+        (html
+         [:div.add-key
+          [:h4 "Add user key to Bitbucket"]
+          [:p "You now need to add this key to your "
+           [:a {:href
+                (str "https://bitbucket.org/account/user/"
+                     (-> user :bitbucket :login)
+                     "/ssh-keys/")}
+            "Bitbucket account SSH keys"]]
+          [:p
+           [:ol
+            [:li "Navigate to your " [:a {:href (checkout-key-link key nil user)}
+                                      "Bitbucket account SSH keys"]]
+            [:li "Click \"Add key\""]
+            [:li
+             "Copy this public key and paste it into the new key on Bitbucket"
+             [:pre.wrap-words
+              (:public_key key)]]
+            [:li "Save the new key"]]]])))))

 (defn checkout-ssh-keys [data owner]
   (reify
@@ -926,6 +1023,7 @@
             project (:project project-data)
             project-id (project-model/id project)
             project-name (vcs-url/project-name (:vcs_url project))
+            vcs-name (-> project :vcs-type utils/prettify-vcs_type)
             checkout-keys (:checkout-keys project-data)]
         (html
          [:section.checkout-page
@@ -941,7 +1039,7 @@
                  [:div
                   [:p
                    "Here are the keys we can currently use to check out your project, submodules, "
-                   "and private GitHub dependencies. The currently preferred key is highlighted, but "
+                   "and private " vcs-name " dependencies. The currently preferred key is highlighted, but "
                    "we will automatically fall back to the other keys if the preferred key is revoked."]
                   [:table.table
                    [:thead [:th "Description"] [:th "Fingerprint"] [:th]]
@@ -970,7 +1068,7 @@
                  [:div.add-key
                   [:h4 "Add deploy key"]
                   [:p
-                   "Deploy keys are the best option for most projects: they only have access to a single GitHub repository."]
+                   "Deploy keys are the best option for most projects: they only have access to a single " vcs-name " repository."]
                   [:div.request-user
                    (forms/managed-button
                     [:input.btn
@@ -984,57 +1082,43 @@
                       :value (str "Create and add " project-name " deploy key")
                       :data-loading-text "Saving..."
                       :data-success-text "Saved"}])]])
-               (when-not (some #{"github-user-key"} (map :type checkout-keys))
-                 [:div.add-key
-                  [:h4 "Add user key"]
-                  [:p
-                   "If a deploy key can't access all of your project's private dependencies, we can configure it to use an SSH key with the same level of access to GitHub repositories that you have."]
-                  [:div.authorization
-                   (if-not (user-model/public-key-scope? user)
-                     (list
-                      [:p "In order to do so, you'll need to grant authorization from GitHub to the \"admin:public_key\" scope. This will allow us to add a new authorized public key to your GitHub account."]
-                      [:a.btn.ghu-authorize
-                       {:href (gh-utils/auth-url :scope ["admin:public_key" "user:email" "repo"])
-                        :title "Grant admin:public_key authorization so that we can add a new SSH key to your GitHub account"}
-                       "Authorize w/ GitHub " [:i.fa.fa-github]])
-
-                     [:div.request-user
-                      (forms/managed-button
-                       [:input.btn
-                        {:tooltip "{ title: 'Create a new user key for this project, with access to all of the projects of your GitHub account.', animation: false }"
-                         :type "submit"
-                         :on-click #(do (raise! owner [:new-checkout-key-clicked {:project-id project-id
-                                                                                :project-name project-name
-                                                                                :key-type "github-user-key"}])
-                                        false)
-                         :value (str "Create and add " (:login user) " user key" )
-                         :data-loading-text "Saving..."
-                         :data-success-text "Saved"}])])]])
+               (when-not (some #{"github-user-key" "bitbucket-user-key"} (map :type checkout-keys))
+                 (om/build add-user-key-section data))
+               (when-let [bb-user-key (first (filter (fn [key] (and
+                                                                (= (:type key)
+                                                                   "bitbucket-user-key")
+                                                                (= (:login key)
+                                                                   (-> user :bitbucket :login))))
+                                                     checkout-keys))]
+                 (om/build bitbucket-add-user-key-instructions {:user user :key bb-user-key}))
+

                [:div.help-block
                 [:h2 "About checkout keys"]
                 [:h4 "What is a deploy key?"]
-                [:p "A deploy key is a repo-specific SSH key. GitHub has the public key, and we store the private key. The deployment key gives CircleCI access to a single repository."]
+                [:p "A deploy key is a repo-specific SSH key. " vcs-name " has the public key, and we store the private key. The deployment key gives CircleCI access to a single repository."]
                 [:p "If you want to push to your repository from builds, please add a user key as described below or manually add " [:a (open-ext {:href "/docs/adding-read-write-deployment-key"}) "read-write deployment key"]"."]
                 [:h4 "What is a user key?"]
-                [:p "A user key is a user-specific SSH key. GitHub has the public key, and we store the private key. Possession of the private key gives the ability to act as that user, for purposes of 'git' access to repositories."]
+                [:p "A user key is a user-specific SSH key. " vcs-name " has the public key, and we store the private key. Possession of the private key gives the ability to act as that user, for purposes of 'git' access to repositories."]
                 [:h4 "How are these keys used?"]
-                [:p "When we build your project, we install the private key into the .ssh directory, and configure ssh to use it when communicating with 'github.com'. Therefore, it gets used for:"]
+                [:p "When we build your project, we install the private key into the .ssh directory, and configure ssh to use it when communicating with your version control provider. Therefore, it gets used for:"]
                 [:ul
                  [:li "checking out the main project"]
-                 [:li "checking out any GitHub-hosted submodules"]
-                 [:li "checking out any GitHub-hosted private dependencies"]
+                 [:li "checking out any " vcs-name "-hosted submodules"]
+                 [:li "checking out any " vcs-name "-hosted private dependencies"]
                  [:li "automatic git merging/tagging/etc."]]
                 [:p]
                 [:p "That's why a deploy key isn't sufficiently powerful for projects with additional private dependencies!"]
                 [:h4 "What about security?"]
-                [:p "The private keys of the checkout keypairs we generate never leave our systems (only the public key is transmitted to GitHub), and are safely encrypted in storage. However, since they are installed into your build containers, any code that you run in CircleCI can read them. You shouldn't push untrusted code to CircleCI!"]
+                [:p "The private keys of the checkout keypairs we generate never leave our systems (only the public key is transmitted to" vcs-name "), and are safely encrypted in storage. However, since they are installed into your build containers, any code that you run in CircleCI can read them. You shouldn't push untrusted code to CircleCI!"]
                 [:h4 "Isn't there a middle ground between deploy keys and user keys?"]
                 [:p "Not really :("]
-                [:p "Deploy keys and user keys are the only key types that GitHub supports. Deploy keys are globally unique (i.e. there's no way to make a deploy key with access to multiple repositories) and user keys have no notion of \\scope\\ separate from the user they're associated with."]
+                [:p "Deploy keys and user keys are the only key types that " vcs-name " supports. Deploy keys are globally unique (i.e. there's no way to make a deploy key with access to multiple repositories) and user keys have no notion of \\scope\\ separate from the user they're associated with."]
                 [:p "Your best bet, for fine-grained access to more than one repo, is to create what GitHub calls a "
                  [:a {:href "https://help.github.com/articles/managing-deploy-keys#machine-users"} "machine user"]
-                 ". Give this user exactly the permissions your build requires, and then associate its user key with your project on CircleCI."]]])]]])))))
+                 ". Give this user exactly the permissions your build requires, and then associate its user key with your project on CircleCI."
+                 (when (= "bitbucket" (:vcs-type project))
+                   "The same technique can be applied for Bitbucket projects.")]]])]]])))))

 (defn scope-popover-html []
   ;; nb that this is a bad idea in general, but should be ok for rarely used popovers


fix spacing

fix spacing

--- src/babel/pos.cljc
+++ src/babel/pos.cljc
@@ -19,9 +19,9 @@
               person (atom :top)
               pronoun (atom :top)
               agr (atom {:number number
-                        :pronoun pronoun
-                        :gender gender
-                        :person person})
+                         :pronoun pronoun
+                         :gender gender
+                         :person person})
               cat (atom :top)]
           {:synsem {:cat cat
                     :pronoun pronoun


21, 22

21, 22

--- src/sandbox/4clojure.clj
+++ src/sandbox/4clojure.clj
@@ -60,3 +60,16 @@

 ;;20 Penultimate Element
 #(if (empty? (rest(rest %))) (first %) (recur (rest %)))
+
+
+;;21 Nth Element
+#(cond
+   (= %2 0) (first %1)
+   (or (< %2 0) (empty? (rest %1))) nil
+   :else (recur (rest %1) (dec %2)))
+
+;;22 Count a Sequence
+#(loop [col % nbr 1]
+   (if (empty? (rest col))
+     nbr
+     (recur (rest col) (inc nbr))))


Two tests for function get-calendar

Two tests for function get-calendar

--- test/clj_calendar/calendar_test.clj
+++ test/clj_calendar/calendar_test.clj
@@ -1,5 +1,5 @@
 ;
-;  (C) Copyright 2015, 2016  Pavel Tisnovsky
+;  (C) Copyright 2015, 2016, 2017  Pavel Tisnovsky
 ;
 ;  All rights reserved. This program and the accompanying materials
 ;  are made available under the terms of the Eclipse Public License v1.0
@@ -11,7 +11,7 @@
 ;

 (ns clj-calendar.calendar-test
-    (:require [clojure.test :refer :all]
+    (:require [clojure.test          :refer :all]
               [clj-calendar.calendar :refer :all]))

@@ -180,6 +180,25 @@
             (is (<=  (.get calendar (java.util.Calendar/MILLISECOND)) 1000)))
 ))

+(deftest test-get-calendar-6
+    "Check the function clj-calendar.calendar/get-calendar."
+    (testing "the function clj-calendar.calendar/get-calendar."
+        (let [calendar (get-calendar)]
+            (.set calendar 0 01 01 10 20 30)
+            (is (=  (.get calendar (java.util.Calendar/HOUR)) 10))
+            (is (=  (.get calendar (java.util.Calendar/MINUTE)) 20))
+            (is (=  (.get calendar (java.util.Calendar/SECOND)) 30)))
+))
+
+(deftest test-get-calendar-7
+    "Check the function clj-calendar.calendar/get-calendar."
+    (testing "the function clj-calendar.calendar/get-calendar."
+        (let [calendar (get-calendar)]
+            (.set calendar 0 01 01 10 20 30)
+            (is (>=  (.get calendar (java.util.Calendar/MILLISECOND)) 0))
+            (is (<=  (.get calendar (java.util.Calendar/MILLISECOND)) 1000)))
+))
+
 (deftest test-format-date-using-desired-format
     "Check the function clj-calendar.calendar/format-date-using-desired-format"
     (testing "the function clj-calendar.calendar/format-date-using-desired-format."


Remove dbg msg.

Remove dbg msg.

--- src/uxbox/data/auth.cljs
+++ src/uxbox/data/auth.cljs
@@ -47,7 +47,6 @@
       (let [params {:username username
                     :password password
                     :scope "webapp"}]
-        (println "login:params:" params)
         (->> (rp/do :login params)
              (rx/map :payload)
              (rx/map logged-in)


Make naming conform to convention

Make naming conform to convention

--- src/datemo/arb.clj
+++ src/datemo/arb.clj
@@ -3,7 +3,7 @@
   (:use hickory.core
         hiccup.core))

-(defn is-arb [coll]
+(defn arb? [coll]
   (and
     (instance? clojure.lang.PersistentArrayMap coll)
     (contains? coll :arb/value)))
@@ -72,7 +72,7 @@
             [:arb {:original-tag (:metadata/html-tag (first metadata))}]
             arbs)
           (recur
-            (conj arbs (if-not (is-arb (first items))
+            (conj arbs (if-not (arb? (first items))
                          (:content/text (first items)) ;; If it's not an arb it must be a :content/text
                          (tx->arb (first items)))) (next items)))))))


Optionaly compile cnftocudf (useful for debugging)

--- src_ext/depends.ocp.boot
+++ src_ext/depends.ocp.boot
@@ -169,3 +169,27 @@
    ]

 end
+
+(*
+
+begin program "cnftocudf"
+  pp = "camlp4o Camlp4MacroParser.cmo"
+  files    = [
+    pack Eclipse [
+      "dose/eclipse/version.ml"
+      "dose/eclipse/packages.ml"
+      "dose/eclipse/eclipsecudf.ml"
+    ]
+    pack Csw [
+      "dose/opencsw/version.ml"
+      "dose/opencsw/packages.ml"
+      "dose/opencsw/cswcudf.ml"
+    ]
+    "dose/common/versionInfo.ml" (ml = true)
+    "dose/doseparse/boilerplateNoRpm.ml"
+    "dose/experimental/cnftocudf.ml"
+  ]
+  requires = [ "dose" ]
+end
+
+*)


O(log(n)) seek for iterators

O(log(n)) seek for iterators

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -1,53 +1,99 @@
 (ns aurora.btree
   (:require-macros [aurora.macros :refer [apush]]))

-(deftype Tree [min-child-nodes max-child-nodes child-node])
+(deftype Tree [min-children max-children root])

-(deftype Branch [parent-node parent-ix keys vals child-nodes])
+(deftype Node [parent parent-ix keys vals children])

-(deftype Leaf [parent-node parent-ix keys vals])
-
-(deftype Iterator [^:mutable child-node ^:mutable ix]
+(deftype Iterator [^:mutable node ^:mutable ix]
   Object
   (next [this]
-        (if (< ix (alength (.-keys child-node)))
-          (let [result #js [(aget (.-keys child-node) ix) (aget (.-vals child-node) ix)]]
-            (if-let [new-child-node (and (.-child-nodes child-node) (aget (.-child-nodes child-node) ix))]
+        (if (< ix (alength (.-keys node)))
+          (let [result #js [(aget (.-keys node) ix) (aget (.-vals node) ix)]]
+            ;; check for a child
+            (if-let [child (and (.-children node) (aget (.-children node) ix))]
               ;; jump into child
               (do
-                (set! child-node new-child-node)
+                (set! node child)
                 (set! ix 0))
               ;; move along
               (set! ix (+ ix 1)))
             result)
-          (if-let [parent-node (.-parent-node child-node)]
+          (if-let [parent (.-parent node)]
             ;; jump into parent and start again
             (do
-              (set! ix (+ (.-parent-ix child-node) 1))
-              (set! child-node parent-node)
+              (set! ix (+ (.-parent-ix node) 1))
+              (set! node parent)
               (recur))
             ;; end of tree
-            nil))))
+            nil)))
+  (seek [this key] ;; move the iterator forwards until it reaches a key greater than this one
+        ;; head across and upwards until we reach a greater key
+        (loop []
+          (if (< ix (alength (.-keys node)))
+            (if (<= key (aget (.-keys node) ix))
+              ;; done
+              nil
+              ;; move along
+              (do
+                (set! ix (+ ix 1))
+                (recur)))
+            (if-let [parent (.-parent node)]
+              ;; jump into parent and start again
+              (do
+                (set! ix (+ (.-parent-ix node) 1))
+                (set! node parent)
+                (recur))
+              ;; end of tree
+              nil)))
+        ;; head downwards and across until we reach the least greater key
+        (loop []
+          (if (< ix (alength (.-keys node)))
+            (if (<= key (aget (.-keys node) ix))
+              ;; check for a child
+              (if-let [child (and (.-children node) (> ix 0) (aget (.-children node) (- ix 1)))]
+                ;; jump in child and start again (assumes child cannot be empty)
+                (do
+                  (set! node child)
+                  (set! ix 0)
+                  (recur))
+                ;; done
+                nil)
+              ;; move along
+              (do
+                (set! ix (+ ix 1))
+                (recur)))
+            ;; end of tree
+            nil))
+        (if (< ix (alength (.-keys node)))
+          #js [(aget (.-keys node) ix) (aget (.-vals node) ix)]
+          nil)))

 (defn iterator [tree]
-  (Iterator. (.-child-node tree) 0))
+  (Iterator. (.-root tree) 0))

-(defn tree [min-child-node max-child-nodes]
-  (Tree. min-child-nodes max-child-nodes (Branch. nil nil #js [] #js [] #js[])))
+(defn tree [min-child max-children]
+  (Tree. min-children max-children (Node. nil nil #js [] #js [] #js[])))

 (comment
-  (let [tree (Tree. min-child-nodes max-child-nodes (Branch. nil nil #js [] #js [] #js[]))
+  (let [tree (Tree. min-children max-children (Node. nil nil #js [] #js [] #js[]))
         iterator (iterator tree)]
     (take-while identity (repeatedly #(.next iterator))))

-  (let [tree (Tree. min-child-nodes max-child-nodes (Branch. nil nil #js [:a :b :c] #js [0 1 2] #js[]))
+  (let [tree (Tree. min-children max-children (Node. nil nil #js [:a :b :c] #js [0 1 2] #js[]))
         iterator (iterator tree)]
     (take-while identity (repeatedly #(.next iterator))))

-  (let [branch (Branch. nil nil #js [:a :d :e] #js [0 3 4] #js[])
-        _ (apush (.-child-nodes branch) (Leaf. branch 0 #js [:b :c] #js [1 2]))
-        tree (Tree. min-child-nodes max-child-nodes branch)
+  (let [branch (Node. nil nil #js [:a :d :e] #js [0 3 4] #js[])
+        _ (apush (.-children branch) (Node. branch 0 #js [:b :c] #js [1 2]))
+        tree (Tree. min-children max-children branch)
         iterator (iterator tree)]
     (take-while identity (repeatedly #(.next iterator))))

+  (let [branch (Node. nil nil #js [:a :d :f] #js [0 3 4] #js[])
+        _ (apush (.-children branch) (Node. branch 0 #js [:b :c] #js [1 2]))
+        tree (Tree. min-children max-children branch)
+        iterator (iterator tree)]
+    [(.seek iterator :c) (.seek iterator :a) (.seek iterator :e) (.seek iterator :e) (.seek iterator :p)])
+
   )


Fix iterator-prop

Fix iterator-prop

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -934,8 +934,8 @@
                     (first (first @cur-elems)))))))

 (defn run-iterator-prop [min-keys key-len updates movements]
-  (let [tree (apply-to-tree (tree min-keys key-len) updates)
-        sorted-map (apply-to-sorted-map (sorted-map-by key-compare) updates)
+  (let [[tree _] (apply-to-tree (tree min-keys key-len) updates)
+        [sorted-map _] (apply-to-sorted-map (sorted-map-by key-compare) updates)
         iterator-results (apply-to-iterator (iterator tree) movements)
         elems-results (apply-to-elems (seq sorted-map) movements)]
     #_(.pretty-print tree)


if no index entry, use entire lexicon

if no index entry, use entire lexicon

--- src/babel/forest.cljc
+++ src/babel/forest.cljc
@@ -229,8 +229,8 @@
                                                            #"\.(..).*"
                                                            (fn [[_ two-digits]] (str "." two-digits))))))
                          result))
-                     (do (log/debug (str "no cache: will go through entire lexicon."))
-                         nil))
+                     (do (log/warn (str "no cache: will go through entire lexicon to find candidate complements."))
+                         (reduce concat (vals lexicon))))
             complement-candidate-lexemes (if (not (= true
                                                      (get-in bolt (concat path [:phrasal]))))
                                            (if cached cached (flatten (vals lexicon))))]


Chris - points the functional test at the correct url

--- test/functional/functional_test.clj
+++ test/functional/functional_test.clj
@@ -36,7 +36,7 @@
         tray-url (tray-url-to-fetch)
         tray-username (tray-username-to-use)
         tray-password (tray-password-to-use)]
-    (to (str base-url "/#/tracking"))
+    (to (str base-url "/tracking"))

     (input "#cctray-url" tray-url)
     (input "#username" tray-username)


Added random and random-seed

Added random and random-seed

--- rosado/processing/processing.clj
+++ rosado/processing/processing.clj
@@ -521,8 +521,12 @@

 (defn radians [deg] (PApplet/radians (float deg)))

-;; $$random
-;; $$randomSeed
+(defn random
+  ([max] (.random *applet* (float max)))
+  ([min max] (.random *applet* (float min) (float max))))
+
+
+(defn random-seed [w] (.randomSeed *applet* (float w)))

 (defn rect [x1 y1 x2 y2]
   (.rect *applet* (float x1) (float y1) (float x2) (float y2)))


--- src/catalog/vubis.clj
+++ src/catalog/vubis.clj
@@ -333,7 +333,8 @@
   (->>
    items
    collate-all-duplicate-items
-   (sort-by (juxt :creator :title))
+   ;; sort by creator, title. If there is no creator then sort just by title
+   (sort-by (juxt #(or (:creator %) (:title %)) :title))
    (reduce
     (fn [m {:keys [format genre sub-genre] :as item}]
       (let [update-keys


Fixed test

Fixed test

--- test/rpi_challenger/routes_test.clj
+++ test/rpi_challenger/routes_test.clj
@@ -25,7 +25,7 @@
       (testing "Shows index page"
         (let [response (GET "/" webapp)]
           (is (= 200 (:status response)))
-          (is (re-find #"Raspberry Pi Challenger" (:body response)))))
+          (is (re-find #"Tournament Overview" (:body response)))))

       (testing "Serves static resources"
         (let [response (GET "/layout.html" webapp)]


Removed on-close handler

Removed on-close handler

--- src/cfpb/qu/views.clj
+++ src/cfpb/qu/views.clj
@@ -352,7 +352,6 @@
   (let [buf (char-array len)]
     (with-open [is (io/reader is)]
       (with-channel request channel
-        (on-close channel #(log/info "Channel closed:" %))
         (loop [n (.read is buf)]
           (let [string (apply str (take n buf))]
             (send! channel (assoc response :body string) false)
@@ -364,7 +363,6 @@
   [request response columns rows]
   (let [size 100]
     (with-channel request channel
-      (on-close channel #(log/info "Channel closed:" %))
       (send! channel (assoc response :body (write-csv (vector columns))) false)
       (loop [rows rows]
         (if (empty? rows)


More buflen

More buflen

--- src/caesium/crypto/secretbox.clj
+++ src/caesium/crypto/secretbox.clj
@@ -1,7 +1,8 @@
 (ns caesium.crypto.secretbox
   "Bindings to the secretbox secret-key authenticated encryption scheme."
   (:require [caesium.binding :refer [sodium defconsts]]
-            [caesium.util :as u])
+            [caesium.util :as u]
+            [caesium.byte-bufs :refer [buflen]])
   (:import [java.nio ByteBuffer]))

 (defconsts [keybytes noncebytes macbytes primitive])
@@ -46,7 +47,7 @@
   You only want this to manage the output byte array yourself. Otherwise,
   you want [[secretbox-open-easy]]."
   [^bytes out ^bytes ctext ^bytes nonce ^bytes key]
-  (let [clen (alength ctext)
+  (let [clen (buflen ctext)
         res (.crypto_secretbox_open_easy sodium out ctext clen nonce key)]
     (if (= res 0)
       out


Implement int->nonce as n->bytes

Implement int->nonce as n->bytes

--- src/caesium/crypto/secretbox.clj
+++ src/caesium/crypto/secretbox.clj
@@ -1,6 +1,7 @@
 (ns caesium.crypto.secretbox
   "Bindings to the secretbox secret-key authenticated encryption scheme."
-  (:require [caesium.binding :refer [sodium defconsts]]))
+  (:require [caesium.binding :refer [sodium defconsts]]
+            [caesium.utils :as u]))

 (defconsts [keybytes noncebytes macbytes primitive])

@@ -66,7 +67,7 @@
   [key nonce ciphertext]
   (secretbox-open-easy ciphertext nonce key))

-(defn int->nonce
+(def int->nonce
   "Turns an integer into a byte array, suitable as a nonce.

   The resulting byte-array is in big-endian order: it starts with the most
@@ -75,9 +76,4 @@
   bytes at the front.

   The return value is a mutable byte array."
-  [n]
-  (let [unpadded (.toByteArray (biginteger n))
-        bytelen (alength unpadded)
-        output (byte-array noncebytes)]
-    (System/arraycopy unpadded 0 output (- noncebytes bytelen) bytelen)
-    output))
+  (partial u/n->bytes noncebytes))


add INamed to the fast path list

add INamed to the fast path list

--- src/clj/cljs/core.clj
+++ src/clj/cljs/core.clj
@@ -169,7 +169,7 @@
                  ISeqable ISequential IList IRecord IReversible ISorted IPrintWithWriter IWriter
                  IPrintWithWriter IPending IWatchable IEditableCollection ITransientCollection
                  ITransientAssociative ITransientMap ITransientVector ITransientSet
-                 IMultiFn IChunkedSeq IChunkedNext IComparable])
+                 IMultiFn IChunkedSeq IChunkedNext IComparable INamed])
           (iterate (fn [[p b]]
                      (if (core/== 2147483648 b)
                        [(core/inc p) 1]


Remove the "email address" hint onfocus.

--- src/circleci/web/views/index.clj
+++ src/circleci/web/views/index.clj
@@ -24,6 +24,7 @@
      [:div#ciright
       [:div#cirightinner

+
       [:h3#takepart "Take part in the beta"]
       [:p
        [:span "We'll email you when we're ready."]]
@@ -31,7 +32,8 @@
        [:fieldset
         (unordered-list
          [(list (text-field {:id "email"
-                             :type "text"} "email" "Email address"))
+                             :type "text"
+                             :onfocus "if (this.value == 'Email address') { this.value=''};"} "email" "Email address"))
           (list (check-box {:id "contact"
                              :name "contact"
                              :checked true} "contact")


clean up special-fns handling in cljs.repl

--- src/clj/cljs/repl.clj
+++ src/clj/cljs/repl.clj
@@ -18,7 +18,8 @@
             [cljs.closure :as cljsc]
             [cljs.source-map :as sm]
             [clojure.tools.reader :as reader]
-            [clojure.tools.reader.reader-types :as readers]))
+            [clojure.tools.reader.reader-types :as readers]
+            [cljs.util :as util]))

 (def ^:dynamic *cljs-verbose* false)

@@ -173,25 +174,25 @@
 (def default-special-fns
   (let [load-file-fn
         (fn self
-          ([repl-env file]
-            (self repl-env file nil))
-          ([repl-env file opts]
+          ([repl-env form]
+            (self repl-env form nil))
+          ([repl-env [_ file :as form] opts]
             (load-file repl-env file opts)))]
     {'in-ns
      (fn self
-       ([_ quoted-ns]
-         (self _ quoted-ns nil))
-       ([_ quoted-ns opts]
-         (let [ns-name (second quoted-ns)]
-           (when-not (ana/get-namespace ns-name)
-             (swap! env/*compiler* update-in [::ana/namespaces ns-name] {:name ns-name}))
-           (set! ana/*cljs-ns* ns-name))))
+       ([_ form]
+         (self _ form nil))
+       ([_ [_ [quote ns-name] :as form] _]
+         (util/debug-prn "in-ns " ns-name)
+         (when-not (ana/get-namespace ns-name)
+           (swap! env/*compiler* update-in [::ana/namespaces ns-name] {:name ns-name}))
+         (set! ana/*cljs-ns* ns-name)))
      'load-file load-file-fn
      'clojure.core/load-file load-file-fn
      'load-namespace
      (fn self
-       ([repl-env ns] (self repl-env ns nil))
-       ([repl-env ns opts]
+       ([repl-env form] (self repl-env form nil))
+       ([repl-env [_ ns :as form] opts]
          (load-namespace repl-env ns opts)))}))

 (defn analyze-source
@@ -247,15 +248,17 @@
                        (catch Exception e
                          (println (.getMessage e))
                          read-error))]
+            ;; TODO: need to catch errors here too - David
             (cond
               (identical? form read-error) (recur)
               (= form :cljs/quit) :quit

               (and (seq? form) (is-special-fn? (first form)))
-              (do (apply (get special-fns (first form)) repl-env (rest form)
-                    opts)
-                  (newline)
-                  (recur))
+              (do
+                ((get special-fns (first form))
+                  repl-env form opts)
+                (newline)
+                (recur))

               :else
               (do (eval-and-print repl-env env form)


Formatting.

Formatting.

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -641,7 +641,6 @@
                p (assoc p :current-strength nil))))
     (system-msg state side "continues the run")))

-
 (defn play-ability [state side {:keys [card ability targets] :as args}]
   (let [cdef (card-def card)
         abilities (:abilities cdef)


remove Chatterjee install ability prerequisite

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -77,8 +77,7 @@
    {:abilities [{:cost [:click 1] :label "Place 1 power counter"
                  :msg "place 1 power counter on it"
                  :effect (effect (add-prop card :counter 1))}
-                {:req (req (>= (get card :counter 0) 0))
-                 :cost [:click 1] :label "Install a program from your Grip"
+                {:cost [:click 1] :label "Install a program from your Grip"
                  :prompt "Choose a program to install from your Grip"
                  :choices {:req #(and (is-type? % "Program") (in-hand? %))}
                  :msg (msg "install " (:title target))


Small phrasing change

Small phrasing change

--- src/cljs/avalon/play/quests.cljs
+++ src/cljs/avalon/play/quests.cljs
@@ -69,7 +69,7 @@
            :keywords?       true
            :handler         (fn [_]
                               (games/refresh-game))
-           :error-handler   (handle-error "Vote")})))
+           :error-handler   (handle-error "Send Quest Card")})))

 (defn clear-vote! []
   (let [id (session/get-in [:game :id])]
@@ -79,7 +79,7 @@
              :handler         (fn [_]
                                 (games/refresh-game)
                                 (close-dialog))
-             :error-handler (handle-error "Clear Vote")})))
+             :error-handler (handle-error "Cancel Quest")})))

 (defn clear-quest! [n]
   (let [id (session/get-in [:game :id])]


Sort the entries

Sort the entries

--- src/cljs/hyphen_keeper/core.cljs
+++ src/cljs/hyphen_keeper/core.cljs
@@ -101,7 +101,7 @@
    [:table#hyphenations.table.table-striped
     [:thead [:tr [:th "Word"] [:th "Hyphenation"]]]
     [:tbody
-     (for [h (:hyphenations @app-state)]
+     (for [h (sort-by :word (:hyphenations @app-state))]
        ^{:key (:word h)} [hyphenation-pattern h])]]
    [new-hyphenation]])


adding ability for frontend to translate identities in ssh-users

--- src-cljs/frontend/models/build.cljs
+++ src-cljs/frontend/models/build.cljs
@@ -198,12 +198,23 @@
 (defn current-user-ssh?
   "Whether the given user has SSH access to the build"
   [build user]
-  (->> build :ssh_users (map :github_id) (some #{(:github_id user)})))
+  (let [cmp (fn [m] (select-keys m [:type :external-id]))
+        identities (->> user
+                        :identities
+                        vals
+                        (map cmp)
+                        (into #{}))
+        build-identities (->> build
+                              :ssh_users
+                              (map cmp))]
+    (or (some identities build-identities)
+        (->> build :ssh_users (map :github_id) (some #{(:github_id user)})))))

 (defn someone-else-ssh?
   "Whether a user other than the given one has SSH access to the build"
   [build user]
-  (->> build :ssh_users (map :github_id) (not-any? #{(:github_id user)})))
+  (not (or (empty? (:ssh_users build))
+           (current-user-ssh? build user))))

 (defn ssh-enabled-now?
   "Whether anyone can currently SSH into the build"


Use the initialised system for reloading and shutting down.

--- src/io/cyanite.clj
+++ src/io/cyanite.clj
@@ -87,20 +87,22 @@
       (println banner)
       (System/exit 0))

-    (let [system  (config->system path quiet)]
+    (let [system (atom (config->system path quiet))]
       (info "installing signal handlers")
       (sig/with-handler :term
         (info "caught SIGTERM, quitting")
-        (component/stop-system system)
+        (component/stop-system @system)
         (info "all components shut down")
         (System/exit 0))

       (sig/with-handler :hup
         (info "caught SIGHUP, reloading")
-        (component/stop-system system))
-      (info "ready to start system")
+        (swap! system #(-> %
+                           component/stop-system
+                           component/start-system)))

-      (component/start-system system)))
+      (info "ready to start the system")
+      (swap! system component/start-system)))
   nil)

 ;; Install our uncaught exception handler.