Add optiosn to create statement

Add optiosn to create statement

--- src/clojure/clojurewerkz/cassaforte/new_query_api.clj
+++ src/clojure/clojurewerkz/cassaforte/new_query_api.clj
@@ -8,8 +8,7 @@
            [com.datastax.driver.core RegularStatement]
            [com.datastax.driver.core.schemabuilder SchemaBuilder SchemaBuilder$Direction

-            SchemaBuilder$Caching SchemaBuilder$KeyCaching]
-           )
+            SchemaBuilder$Caching SchemaBuilder$KeyCaching])
   (:require [clojurewerkz.cassaforte.aliases :as alias]
             clojurewerkz.cassaforte.query.query-builder
             clojurewerkz.cassaforte.query.types))
@@ -469,13 +468,37 @@
       (get primitive-types column-type)
       column-type)))

+(def directions
+  {:asc  SchemaBuilder$Direction/ASC
+   :desc SchemaBuilder$Direction/DESC})
+
+(def ^:private create-options
+  {:clustering-order      (fn [opts [column-name direction]] (.clusteringOrder opts column-name (get directions direction)))
+   :compact-storage       (fn [opts _] (.compactStorage opts))
+   :clustering-keys-order (fn [opts [column-name direction]] (.addSpecificOptions opts))})
+
+(defn resolve-create-option
+  [option-name]
+  (if-let [res (get create-options option-name)]
+    res
+    (throw (IllegalArgumentException. (str "Create option "
+                                           " was not found, pick one of ("
+                                           (clojure.string/join "," (keys create-options))
+                                           ")")))))
+
 (let [order
-      {:column-definitions 1
+      {:with-options       3
+       :column-definitions 1
        :if-not-exists      2}
       renderers
-      {:column-definitions (fn [query-builder column-defs]
-                             (let [[primary-key & clustering-keys] (get column-defs :primary-key)
-                                   ]
+      {:with-options       (fn with-options-statement [query-builder options]
+                             (reduce
+                              (fn [opts [option-name option-vals]]
+                                ((resolve-create-option option-name) opts option-vals))
+                              (.withOptions query-builder)
+                              options))
+       :column-definitions (fn [query-builder column-defs]
+                             (let [[primary-key & clustering-keys] (get column-defs :primary-key)]

                                (reduce
                                 (fn [builder [column-name column-type]]


actually include om dependency in "+next" case

--- src/leiningen/new/aemette/project.clj
+++ src/leiningen/new/aemette/project.clj
@@ -3,8 +3,7 @@
   :url "http://example.com/FIXME"
   :dependencies [[org.clojure/clojure "1.7.0"]
                  [org.clojure/clojurescript "1.7.170"]
-                 {{#om-legacy}}[org.omcljs/om "0.9.0"]{{/om-legacy}}
-                 {{#om-next}}[org.omcljs/om "1.0.0-alpha28"]{{/om-next}}
+                 [org.omcljs/om {{#om-legacy}}"0.9.0"{{/om-legacy}}{{^om-legacy}}"1.0.0-alpha28"{{/om-legacy}}]
                  [org.clojure/core.async "0.2.374"]
                  [secretary "1.2.3"]]


Changed doseq to doall to retain head.

Changed doseq to doall to retain head.

I'm uncertain if it will be needed for future work.

--- src/tutorial/notepad/core.cljs
+++ src/tutorial/notepad/core.cljs
@@ -35,8 +35,7 @@
               ;; (fn [t c p] #js {:title t :content c :parent p})
               #(clj->js {:title %1 :content %2 :parent %3})
                   note-titles note-contents (cycle [notes-container])))
-    (doseq [note notes]
-      (make-note-dom note))))
+    (doall (map make-note-dom notes))))

 ;; Invoke the main function.
 (main)


Added helper function to allow easy starting of a NGServer

This allows to fire up easily a nailgun server if the system is owned
by a different application. Use cases are external Repls, servers
(during development), etc.

Refers #23

--- src/main/clojure/vimclojure/nails.clj
+++ src/main/clojure/vimclojure/nails.clj
@@ -27,7 +27,18 @@
                  [backend :as backend]))
   (:import
      java.io.BufferedReader
-     com.martiansoftware.nailgun.NGContext))
+     com.martiansoftware.nailgun.NGContext
+     com.martiansoftware.nailgun.NGServer))
+
+(defn start-server-thread
+  "Start a nailgun server in a dedicated daemon thread. host defaults
+  to 127.0.0.1, port to 2113."
+  ([]     (start-server-thread "127.0.0.1" 2113))
+  ([host] (start-server-thread host 2113))
+  ([host port]
+   (doto (Thread. #(NGServer/main (into-array [(str host ":" port)])))
+     (.setDaemon true)
+     (.start))))

 (defmacro defnail
   "Define a new Nail of the given name. The arguments is a command line


After creating event, redirect to event page

--- src/cljs/elevent_client/pages/events/id/edit.cljs
+++ src/cljs/elevent_client/pages/events/id/edit.cljs
@@ -121,19 +121,20 @@
                     (if event-id :update :create)
                     (assoc form :OrganizationId @organization-id)
                     ; if creating a new event, read permissions after creating
-                    (fn []
+                    (fn [json]
                       (if event-id
                         (do
                           (callback)
                           (js/location.replace
-                            (routes/events-owned)))
-                        (api/permissions-endpoint
-                          :read
-                          nil
-                          #(do
-                             (callback)
-                             (js/location.replace
-                               (routes/events-owned))))))
+                            (routes/event (:EventId event-id))))
+                        (let [new-event-id (get json "EventId")]
+                          (api/permissions-endpoint
+                            :read
+                            nil
+                            #(do
+                               (callback)
+                               (js/location.replace
+                                 (routes/event {:EventId new-event-id})))))))
                     callback))))]
         [:div.sixteen.wide.column
          [events/tabs (if event-id :edit :add)]


added some extra info to game-play

added some extra info to game-play

--- src/cljs/wombats_web_client/panels/game-play.cljs
+++ src/cljs/wombats_web_client/panels/game-play.cljs
@@ -39,27 +39,27 @@
   (re-frame/dispatch [:set-modal nil]))

 (defn- game-play-title [info]
-  (let [{:keys [status
-                start-time]} @info]
-    [:h1.game-play-title
+  (let [{:keys [round-number
+                round-start-time
+                status]} @info]
+    [:h1.game-play-title
      (case status
        :closed
        "GAME OVER"
-
-       ;; TODO: #21 Pull down round number from API and display it
+
        (:pending-open
-        :pending-closed)
-       "ROUND 1 STARTS IN: 2:06"
+        :pending-closed
+        :active-intermission)
+       (str "ROUND " round-number " STARTS IN: 2:06")

-       ;; TODO: Pull down round number from API and display it
        :active
-       "ROUND 1"
+       (str "ROUND " round-number)

        nil)]))

 (defn- game-play-subtitle [info]
   (let [{:keys [name]} @info]
-    [:h2.game-play-subtitle
+    [:h2.game-play-subtitle
      (when name
        (str name " - High Score"))]))

@@ -70,7 +70,7 @@
                          (str "Wombats: " player-count "/" max-players))]))

 (defn chat-title []
-  [:div.chat-title
+  [:div.chat-title
    [:span "CHAT"]])

 (defn right-game-play-panel []


add global dimensions to decision-maker-state

--- src/wombats/game/processor.clj
+++ src/wombats/game/processor.clj
@@ -26,6 +26,12 @@
          :local-coords
          (gu/get-item-coords arena uuid)))

+(defn- add-global-dimensions
+  [decision-maker-state game-state]
+  (assoc decision-maker-state
+         :global-dimensions
+         (au/get-arena-dimensions (get-in game-state [:frame :frame/arena]))))
+
 (defn- add-partial-view
   "Creates a partial view for a decision maker"
   [{:keys [global-coords] :as player-state}
@@ -71,6 +77,7 @@
       (-> {:global-coords global-coords}
           (add-partial-view game-state type)
           (add-local-coords uuid)
+          (add-global-dimensions game-state)
           (add-occlusion-view game-state type)
           (add-custom-state game-state uuid type))
       game-state)))


Fixed a bug that caused auto-run simulations to use L-lambda-max for the S cones.

--- src/main/clojure/brainardlab/nben/retina/util.clj
+++ src/main/clojure/brainardlab/nben/retina/util.clj
@@ -49,7 +49,7 @@
         L-to-M (get plan :L-to-Ms [[1 1]])
         M-lambda-max (get plan :M-lambda-maxs [530.3])
         L-lambda-max (get plan :L-lambda-maxs [558.9])
-        S-lambda-max (get plan :L-lambda-maxs [420.7])
+        S-lambda-max (get plan :S-lambda-maxs [420.7])
         S-cone-flags (get plan :S-cone-flags [:human])
         retina-size (get plan :sizes [20])]
     (retina :surround surround


Docstrings in 'move'

Docstrings in 'move'

--- src/main/clojure/clojure/tools/namespace/move.clj
+++ src/main/clojure/clojure/tools/namespace/move.clj
@@ -12,8 +12,8 @@
   (:import (java.io File)))

 (defn- update-file
-  "Read file as a string, call f on file plus any args, then write out
-  return value of f as the new contents of file."
+  "Reads file as a string, calls f on the string plus any args, then
+  writes out return value of f as the new contents of file."
   [file f & args]
   (spit file (str (apply f (slurp file) args))))

@@ -68,9 +68,9 @@

 (defn move-ns
   "ALPHA: subject to change. Moves the .clj source file (found relative
-  to source-path) for the namespace named old-sym to new-sym
-  and replace all occurances of the old name with the new
-  name in all Clojure source files found in dirs."
+  to source-path) for the namespace named old-sym to new-sym and
+  replace all occurances of the old name with the new name in all
+  Clojure source files found in dirs."
   [old-sym new-sym source-path dirs]
   (move-ns-file old-sym new-sym source-path)
   (doseq [file (clojure-source-files dirs)]


add back nashorn flag with version check

--- src/main/shadow/cljs/devtools/server/npm_deps.clj
+++ src/main/shadow/cljs/devtools/server/npm_deps.clj
@@ -9,7 +9,9 @@
   (:import (javax.script ScriptEngineManager ScriptEngine Invocable)))

 (defn make-engine []
-  ;; (System/setProperty "nashorn.args" "--no-deprecation-warning")
+  (let [java-version (System/getProperty "java.version")]
+    (when (= "11" java-version)
+      (System/setProperty "nashorn.args" "--no-deprecation-warning")))
   (let [engine
         (-> (ScriptEngineManager.)
             (.getEngineByName "nashorn"))


Remove dependency on test code from places importer.

--- src/datomish/places/import.cljc
+++ src/datomish/places/import.cljc
@@ -8,67 +8,83 @@
       [datomish.pair-chan :refer [go-pair <?]]
       [cljs.core.async.macros :refer [go]]))
   (:require
+     [datomish.db :as db]
+     [datomish.transact :as transact]
    [datomish.util :as util #?(:cljs :refer-macros :clj :refer) [raise raise-str cond-let]]
    [datomish.sqlite :as s]
-   [datomish.api :as d]
    #?@(:clj [[datomish.pair-chan :refer [go-pair <?]]
              [clojure.core.async :as a :refer [chan go <! >!]]])
    #?@(:cljs [[datomish.pair-chan]
               [cljs.core.async :as a :refer [chan <! >!]]])))

 (def places-schema-fragment
-  [{:db/id        (d/id-literal :db.part/user)
+  [{:db/id        (db/id-literal :db.part/user)
     :db/ident     :page/url
     :db/unique    :db.unique/identity
     :db/valueType :db.type/string ;; TODO: uri
     :db.install/_attribute :db.part/db}
-   {:db/id        (d/id-literal :db.part/user)
+   {:db/id        (db/id-literal :db.part/user)
     :db/ident     :page/guid
     :db/unique    :db.unique/identity
     :db/valueType :db.type/string ;; TODO: uuid or guid?
     :db.install/_attribute :db.part/db}
-   {:db/id          (d/id-literal :db.part/user)
+   {:db/id          (db/id-literal :db.part/user)
     :db/ident       :page/title
     :db/cardinality :db.cardinality/one
     :db/valueType   :db.type/string
     :db.install/_attribute :db.part/db}
-   {:db/id        (d/id-literal :db.part/user)
+   {:db/id        (db/id-literal :db.part/user)
     :db/ident     :page/visitAt
     :db/cardinality :db.cardinality/many
     :db/valueType :db.type/long ;; TODO: instant
     :db.install/_attribute :db.part/db}
    ])

+(defn assoc-if
+  ([m k v]
+   (if v
+     (assoc m k v)
+     m))
+  ([m k v & kvs]
+   (if kvs
+     (let [[kk vv & remainder] kvs]
+       (apply assoc-if
+              (assoc-if m k v)
+              kk vv remainder))
+     (assoc-if m k v))))
+
+
 (defn- place->entity [[id rows]]
-  (let [title (:title (first (filter :page/title rows)))]
-    (cond-> {:db/id (d/id-literal :db.part/user)
-             :page/url (:url (first rows))
-             :page/guid (:guid (first rows))
-             :page/visitAt (map :visit_date rows)}
-      title (assoc :page/title title))))
+  (let [title (:title (first (filter :page/title rows)))
+        required {:db/id (db/id-literal :db.part/user)
+                  :page/url (:url (first rows))
+                  :page/guid (:guid (first rows))}
+        visits (map :visit_date rows)]
+    (assoc-if required
+              :page/title title
+              :page/visitAt visits)))

 (defn import-places [conn places-connection]
   (go-pair
     ;; Ensure schema fragment is in place, even though it may cost a (mostly empty) transaction.
-    (<? (d/<transact! conn places-schema-fragment))
+    (<? (transact/<transact! conn places-schema-fragment))

-    (->>
-      ["SELECT DISTINCT p.id, p.url, p.title, p.visit_count, p.last_visit_date, p.guid,"
-       "hv.visit_date"
-       "FROM moz_places AS p LEFT JOIN moz_historyvisits AS hv"
-       "WHERE p.hidden = 0 AND p.id = hv.place_id"
-       "ORDER BY p.id, hv.visit_date"
-       "LIMIT 20000"] ;; TODO: remove limit.
-      (interpose " ")
-      (apply str)
-      (vector)
+    (let [rows
+          (<?
+            (s/all-rows
+              places-connection
+              ["SELECT DISTINCT p.id AS id, p.url AS url, p.title AS title, p.visit_count, p.last_visit_date, p.guid,
+               hv.visit_date
+               FROM moz_places AS p LEFT JOIN moz_historyvisits AS hv
+               WHERE p.hidden = 0 AND p.id = hv.place_id
+               ORDER BY p.id, hv.visit_date"]))]
+      (<?
+        (transact/<transact!
+          conn
+          (map place->entity (group-by :id rows)))))))

-      (s/all-rows places-connection)
-      (<?)
-
-      (group-by :id)
-
-      (map place->entity)
-
-      (d/<transact! conn)
-      (<?))))
+(defn import-places-from-path [db places]
+  (go-pair
+    (let [conn (transact/connection-with-db db)
+          pdb (<? (s/<sqlite-connection places))]
+      (import-places conn pdb))))


Process Function instances in clause handling. r=nalexander

--- src/datomish/query/clauses.cljc
+++ src/datomish/query/clauses.cljc
@@ -13,14 +13,35 @@
      [datascript.parser :as dp
       #?@(:cljs
             [:refer
-             [PlainSymbol Predicate Not Or Pattern DefaultSrc Variable Constant Placeholder]])]
+             [
+              Constant
+              DefaultSrc
+              Function
+              Not
+              Or
+              Pattern
+              Placeholder
+              PlainSymbol
+              Predicate
+              Variable
+              ]])]
      [honeysql.core :as sql]
      [clojure.string :as str]
      )
   #?(:clj
        (:import
           [datascript.parser
-           PlainSymbol Predicate Not Or Pattern DefaultSrc Variable Constant Placeholder])))
+           Constant
+           DefaultSrc
+           Function
+           Not
+           Or
+           Pattern
+           Placeholder
+           PlainSymbol
+           Predicate
+           Variable
+           ])))

 ;; A ConjoiningClauses (CC) is a collection of clauses that are combined with JOIN.
 ;; The topmost form in a query is a ConjoiningClauses.
@@ -258,6 +279,9 @@
     ;; TODO: handle And within the Or patterns.
     (raise "Non-simple `or` clauses not yet supported." {:clause orc})))

+(apply-function-clause [cc function]
+  cc)
+
 ;; We're keeping this simple for now: a straightforward type switch.
 (defn apply-clause [cc it]
   (condp instance? it
@@ -272,6 +296,9 @@

     Pattern
     (apply-pattern-clause cc it)
+
+    Function
+    (apply-function-clause cc it)

     (raise "Unknown clause." {:clause it})))


Start fixing tests for the config/db rewrite

--- test/circle/backend/build/test_config.clj
+++ test/circle/backend/build/test_config.clj
@@ -39,15 +39,20 @@
 (fact "template/find works with strings"
   (circle.backend.build.template/find "build") => truthy)

-(fact "build-from-config works"
+(fact "build-from-url works for inferred"
   (let [project test/test-project
-        config (get-config-for-url (-> test/test-project :vcs_url))
         vcs_revision "78f58846a049bb6772dcb298163b52c4657c7d45"
-        b (build-from-config config test/test-project
+        b (build-from-url (-> project :vcs_url)
                              :vcs-revision vcs_revision
                              :job-name :build)]
     (ref? b) => true
-    (-> @b :vcs_revision) => "78f58846a049bb6772dcb298163b52c4657c7d45"
+    (-> @b) => (contains {:vcs_url string?
+                          :vcs_revision "78f58846a049bb6772dcb298163b52c4657c7d45"
+                          :node anything
+                          :parents seq?
+                          :build_num number?
+
+                          })
     (validate @b) => nil))

 (fact "build-from-json works"
@@ -55,8 +60,8 @@
     (ref? build) => true
     (-> @build :vcs_revision) => "78f58846a049bb6772dcb298163b52c4657c7d45"))

-(fact "get-config-from-yml works"
-  (get-config-from-yml "https://github.com/arohner/CircleCI") => map?)
+(fact "build-from-url works for yaml configs"
+  (build-from-url "https://github.com/arohner/CircleCI") => map?)

 (fact "parse-spec-actions support different kinds of newline"
   (-> :setup ((parse-spec-actions {:setup "1\n2"}))) => (maps-containing {:name "1"} {:name "2"})


Removed debug print.

Removed debug print.

--- test/com/lemondronor/turboshrimp_test.clj
+++ test/com/lemondronor/turboshrimp_test.clj
@@ -8,8 +8,6 @@
 (deftest turboshrimp-tests
   (testing "default initialize gets default host and port"
     (let [drone (ar-drone/make-drone)]
-      (println "WOO")
-      (println (:host drone))
       (is (= (:hostname drone) ar-drone/default-hostname))
       (is (= (:at-port drone) ar-drone/default-at-port))
       (is (= @(:counter drone) 0))))


Correct assets for recent stickers panel

Signed-off-by: Gheorghe Pinzaru <742a0a3885ab52ea1795e48e261ec4223e194612@gmail.com>

--- src/status_im/ui/screens/chat/stickers/views.cljs
+++ src/status_im/ui/screens/chat/stickers/views.cljs
@@ -30,8 +30,8 @@

 (defn- no-stickers-yet-panel []
   [react/view {:style {:flex 1 :align-items :center :justify-content :center}}
-   [vector-icons/icon :stickers-icons/stickers-big {:color colors/gray
-                                                    :width 64
+   [vector-icons/icon :stickers-icons/stickers-big {:color  colors/gray
+                                                    :width  64
                                                     :height 64}]
    [react/text {:style {:margin-top 8 :font-size 17}} (i18n/label :t/you-dont-have-stickers)]
    [react/touchable-opacity {:on-press #(do
@@ -57,9 +57,16 @@
   (letsubs [stickers [:stickers/recent]]
     (if (seq stickers)
       [stickers-panel stickers window-width]
-      [react/view {:style {:flex 1 :align-items :center :justify-content :center :width window-width}}
-       [vector-icons/icon :stickers-icons/stickers-big {:color colors/gray}]
-       [react/text {:style {:margin-top 8 :font-size 17}} (i18n/label :t/recently-used-stickers)]])))
+      [react/view {:style {:flex            1
+                           :align-items     :center
+                           :justify-content :center
+                           :width           window-width}}
+       [vector-icons/icon :stickers-icons/sticker-history {:width  64
+                                                           :height 64
+                                                           :color  colors/gray}]
+       [react/text {:style {:margin-top 12
+                            :font-size  17}}
+        (i18n/label :t/recently-used-stickers)]])))

 (defn update-scroll-position [ref installed-packs selected-pack window-width]
   (when ref


fixed comment

fixed comment

--- src/tutorial/untangled_tutorial/A_Quick_Tour.cljs
+++ src/tutorial/untangled_tutorial/A_Quick_Tour.cljs
@@ -34,7 +34,7 @@
 (def ui-counter (om/factory Counter {:keyfn :counter/id}))

 (defmethod m/mutate 'counter/inc [{:keys [state] :as env} k {:keys [id] :as params}]
-  {;:remote true
+  {:remote true
    :action (fn [] (swap! state update-in [:counter/by-id id] increment-counter))})

 (defmethod m/mutate 'add-counters-to-panel [{:keys [state] :as env} k {:keys [id] :as params}]
@@ -475,7 +475,9 @@
 (defcard FinalResult
          "Below is the final result of the above application, complete with faked server interactions (we use
          setTimeout to fake network latency). If you reload this page and jump to the bottom, you'll see the initial
-         server loading."
+         server loading. (If you see an error related to mounting a DOM node, try reloading the page). You can
+         see the mocked server processing take place in a delayed fashion in the Javascript Console of your
+         browser."
          (untangled-app Root
                         :started-callback (fn [{:keys [reconciler] :as app}]
                                             (log/info "Application (re)started")


queue: remove dead code

queue: remove dead code

--- src/io/cyanite/engine/queue.clj
+++ src/io/cyanite/engine/queue.clj
@@ -68,11 +68,6 @@
     (translateTo [this event sequence arg0]
       (f event arg0))))

-(defn linked-queue
-  [sz]
-  (java.util.concurrent.ArrayBlockingQueue.
-   (int sz)))
-
 (defrecord BlockingMemoryQueue [state defaults]
   component/Lifecycle
   (start [this]


Fix tests.

Fix tests.

--- test/clj_spotify/core_test.clj
+++ test/clj_spotify/core_test.clj
@@ -64,9 +64,10 @@

 (def malformed-json-response {:body "{\"test-key\": \"test-value\", \"test-map\" : {\"a\": \"a\"}, \"test-vector\" : [1 2 3], \"test-null\" : }"})

-(def nullpointer-error-map {:error {:status "NullPointerException", :message nil}})
-
-(def json-missing-key-error-map {:error {:status "Exception", :message "JSON error (key missing value in object)"}})
+(defn nullpointer-error-map [response] {:error {:status "NullPointerException", :message nil, :response response}})
+
+(defn json-missing-key-error-map [response]
+  {:error {:status "Exception", :message "JSON error (key missing value in object)", :response response}})

 (def test-url (str sptfy/spotify-api-url "users/user_id/playlists/playlist_id/tracks"))
 (def correct-test-url (str sptfy/spotify-api-url "users/elkalel/playlists/6IIjEBw2BrRXbrSLerA7A6/tracks"))
@@ -78,9 +79,9 @@
   (testing "Conversion from string to clojure map"
     (is (= correct-map (sptfy/response-to-map correctly-formatted-response))))
   (testing "Missing body tag in response."
-    (is (= nullpointer-error-map (sptfy/response-to-map missing-body-tag-response))))
+    (is (= (nullpointer-error-map missing-body-tag-response) (sptfy/response-to-map missing-body-tag-response))))
   (testing "Malformed json syntax in string."
-    (is (= json-missing-key-error-map (sptfy/response-to-map malformed-json-response)))))
+    (is (= (json-missing-key-error-map malformed-json-response) (sptfy/response-to-map malformed-json-response)))))

 (deftest test-replace-url-values
   (testing "Replace template values in spotify url and compare to correct url."


Test that :field-key works

Test that :field-key works

Signed-off-by: Njagi Mwaniki <b6a4ba60ad861b9c9afb6daea7294be4be68f44c@urbanslug.com>

--- test/hatti/ona/forms_test.cljs
+++ test/hatti/ona/forms_test.cljs
@@ -120,11 +120,9 @@
       (let [rand-option (rand-nth (:children q-sel1))]
         (is (= (forms/format-answer q-sel1 (:name rand-option))
                (:label rand-option)))
-        (is (= (forms/format-answer q-sel1 nil) forms/no-answer))))
-    (testing "text and integer answers are left alone"
-      (is (= (forms/format-answer q-text "foo") "foo"))
-      (is (= (forms/format-answer q-text 1) 1))
-      (is (= (forms/format-answer q-text "1") "1")))
+        (is (= (forms/format-answer q-sel1 nil) forms/no-answer))
+        (is (= (forms/format-answer q-sel1 (:label rand-option) :field-key :label)
+               (:label rand-option)))))
     (testing "select all answers are formatted properly"
       (let [first-option (first (:children q-selm))
             two-options (take 2 (:children q-selm))
@@ -133,10 +131,16 @@
         (is (= (forms/format-answer q-selm "") forms/no-answer))
         (is (has-label? first-option
                         (forms/format-answer q-selm (:name first-option))))
+        (is (has-label? first-option
+                        (forms/format-answer q-selm (:label first-option))))
         (is (has-label? (first two-options)
                         (forms/format-answer q-selm two-answers)))
         (is (has-label? (second two-options)
                         (forms/format-answer q-selm two-answers)))))
+    (testing "text and integer answers are left alone"
+      (is (= (forms/format-answer q-text "foo") "foo"))
+      (is (= (forms/format-answer q-text 1) 1))
+      (is (= (forms/format-answer q-text "1") "1")))
     (testing "image answers are rendered as they should be"
       (let [image1 "bar.jpg"
             image2 {:filename "foo/bar.jpg"


Adding index refresh to send-schema

Adding index refresh to send-schema

--- test/kixi/integration/base.clj
+++ test/kixi/integration/base.clj
@@ -43,12 +43,7 @@
   []
   (let [conn (esr/connect (str "http://" es-host ":" es-port)
                           {:connection-manager (clj-http.conn-mgr/make-reusable-conn-manager {:timeout 10})})]
-    (esi/refresh
-     conn
-     kixi.datastore.metadatastore.elasticsearch/index-name)
-    (esi/refresh
-     conn
-     kixi.datastore.schemastore.elasticsearch/index-name)))
+    (esi/refresh conn)))

 (defmacro is-submap
   [expected actual & [msg]]
@@ -369,8 +364,10 @@
   (let [event (wait-for-events uid :kixi.datastore.schema/rejected :kixi.datastore.schema/created)]
     (if (= :kixi.datastore.schema/created
            (:kixi.comms.event/key  event))
-      (wait-for-url uid (schema-url
-                         (get-in event [:kixi.comms.event/payload ::ss/id])))
+      (do
+        (wait-for-url uid (schema-url
+                             (get-in event [:kixi.comms.event/payload ::ss/id])))
+        (refresh-indexes))
       event)))

 (defn metadata->user-id


Remove unused test namespace

Remove unused test namespace

--- test/lambda_demo/core_test.clj
+++ test/lambda_demo/core_test.clj
@@ -1,7 +0,0 @@
-(ns lambda-demo.core-test
-  (:require [clojure.test :refer :all]
-            [lambda-demo.core :refer :all]))
-
-(deftest a-test
-  (testing "FIXME, I fail."
-    (is (= 0 1))))


CMR-1280 Removes println debugging and aligns some code

--- umm-lib/src/cmr/umm/iso_mends/spatial.clj
+++ umm-lib/src/cmr/umm/iso_mends/spatial.clj
@@ -49,8 +49,7 @@

 (defmethod parse-gml :Polygon
   [element]
-  (println "parsing polgyon element" element)
-  (let [exterior  (cx/element-at-path element [:exterior :LinearRing])
+  (let [exterior  (cx/element-at-path  element [:exterior :LinearRing])
         interiors (cx/elements-at-path element [:interior :LinearRing])
         rings     (cons (parse-points exterior) (map parse-points interiors))]
     (poly/polygon :geodetic rings)))
@@ -61,8 +60,8 @@

 (defmethod parse-geo-element :EX_GeographicBoundingBox
   [element]
-  (let [west (cx/double-at-path element [:westBoundLongitude :Decimal])
-        east (cx/double-at-path element [:eastBoundLongitude :Decimal])
+  (let [west  (cx/double-at-path element [:westBoundLongitude :Decimal])
+        east  (cx/double-at-path element [:eastBoundLongitude :Decimal])
         north (cx/double-at-path element [:northBoundLatitude :Decimal])
         south (cx/double-at-path element [:southBoundLatitude :Decimal])]
     (mbr/mbr west north east south)))


fix nrepl changing output stream problem for Vim Fireplace

--- sidecar/src/figwheel_sidecar/repl.clj
+++ sidecar/src/figwheel_sidecar/repl.clj
@@ -89,25 +89,30 @@
     ;; we need to print in the same thread as
     ;; the that the repl process was created in
     ;; thank goodness for the go loop!!
+    (reset! (::repl-writers figwheel-server) {:out *out* ::err *err*})
     (go-loop []
       (when-let [{:keys [stream args]}
                  (<! (:repl-print-chan figwheel-server))]
-        (if (= stream :err)
-          (binding [*out* *err*]
-            (apply println args)
-            (flush))
-          (do
-            (apply println args)
-            (flush)))
+        (binding [*out* (:out @(::repl-writers figwheel-server))
+                  *err* (:err @(::repl-writers figwheel-server))]
+          (if (= stream :err)
+            (binding [*out* *err*]
+              (apply println args)
+              (flush))
+            (do
+              (apply println args)
+              (flush))))
         (recur)))
     (add-repl-print-callback! figwheel-server)
     (wait-for-connection figwheel-server)
     (Thread/sleep 500)) ;; just to help with setup latencies
   (-evaluate [_ _ _ js]
+    (reset! (::repl-writers figwheel-server) {:out *out* ::err *err*})
     (wait-for-connection figwheel-server)
     (eval-js figwheel-server js))
       ;; this is not used for figwheel
   (-load [this ns url]
+    (reset! (::repl-writers figwheel-server) {:out *out* ::err *err*})
     (wait-for-connection figwheel-server)
     (eval-js figwheel-server (slurp url)))
   (-tear-down [_]
@@ -133,6 +138,8 @@
   ([figwheel-server {:keys [id build-options] :as build}]
    (assoc (FigwheelEnv. (merge figwheel-server
                                (if id {:build-id id} {})
+                               {::repl-writers (atom {:out *out*
+                                                      :err *err*})}
                                (select-keys build-options [:output-dir :output-to])))
           :cljs.env/compiler (:compiler-env build)))
   ([figwheel-server]


Perf: improve segment reading and writing for aeron

--- src/onyx/messaging/protocol_aeron.clj
+++ src/onyx/messaging/protocol_aeron.clj
@@ -78,41 +78,62 @@
   (write-uuid buf (+ offset 32) completion-id)
   (.putLong buf (+ offset 48) ack-val))

-(defn read-message-meta [^UnsafeBuffer buf offset]
+(defn read-message [^UnsafeBuffer buf offset message]
   (let [id (get-uuid buf offset)
         acker-id (get-uuid buf (+ offset 16))
         completion-id (get-uuid buf (+ offset 32))
         ack-val (.getLong buf (+ offset 48))]
-    (->Leaf nil id acker-id completion-id ack-val nil nil nil nil)))
+    (->Leaf message id acker-id completion-id ack-val nil nil nil nil)))

-(def message-count-size 4)
+(def ^:const message-count-size 4)
+(def ^:const payload-size-size 4)

 (defn meta-message-offsets [start-pos cnt]
   (reductions + start-pos (repeat cnt message-base-length)))

-;; TODO: optimize, currently pretty slow relative to everything else
 (defn build-messages-msg-buf [compress-f messages]
-  (let [meta-offsets (meta-message-offsets message-count-size (count messages))
-        message-payloads (compress-f (map :message messages))
-        buf-size (+ (last meta-offsets)
-                    (count message-payloads))
+  ;; Performance consideration:
+  ;; We would rather write to one contiguous byte array or a byteoutputstream
+  ;; that returns a byte array. This would require changes to nippy
+  (let [message-count (count messages)
+        message-payloads ^bytes (compress-f (map :message messages))
+        payload-size (alength message-payloads)
+        buf-size (+ message-count-size
+                    payload-size-size
+                    payload-size
+                    (* message-count message-base-length))
         buf (UnsafeBuffer. (byte-array buf-size))]
     (.putInt buf 0 (int (count messages))) ; number of messages
-    (doseq [[msg offset] (map vector messages meta-offsets)]
-      (write-message-meta buf offset msg))
-    (.putBytes buf (last meta-offsets) message-payloads)
-    [buf-size buf]))
+    (.putInt buf message-count-size payload-size)
+    (.putBytes buf
+               (+ message-count-size
+                  payload-size-size)
+               message-payloads)
+    (let [offset (+ message-count-size payload-size-size payload-size)
+          buf-size (reduce (fn [offset msg]
+                             (write-message-meta buf offset msg)
+                             (+ message-base-length offset))
+                           offset
+                           messages)]
+      [buf-size buf])))

 (defn read-messages-buf [decompress-f ^UnsafeBuffer buf offset length]
   (let [message-count (.getInt buf offset)
-        meta-offsets (meta-message-offsets (+ message-count-size offset) message-count)
-        metas (doall (map (partial read-message-meta buf)
-                          (butlast meta-offsets)))
-        segments-size  (- (+ offset length) (last meta-offsets))
-        message-payload-bytes (byte-array segments-size)
-        _ (.getBytes buf (last meta-offsets) message-payload-bytes)
-        message-payloads (decompress-f message-payload-bytes)]
-    (map (fn [m message]
-           (assoc m :message message))
-         metas
-         message-payloads)))
+        offset (+ offset message-count-size)
+        payload-size (.getInt buf offset)
+        offset (+ offset payload-size-size)
+        ;; Performance consideration:
+        ;; We would rather that we didn't need to allocate an additional
+        ;; byte array here and have nippy directly read from the buf bytes
+        message-payload-bytes (byte-array payload-size)
+        _ (.getBytes buf offset message-payload-bytes)
+        message-payloads (decompress-f message-payload-bytes)
+        offset (+ offset payload-size)]
+    (loop [messages (transient [])
+           payloads (seq message-payloads)
+           offset offset]
+      (if-let [v (first payloads)]
+        (recur (conj! messages (read-message buf offset v))
+               (next payloads)
+               (+ offset message-base-length))
+        (persistent! messages)))))


Declares symbols ahead of definition for bootstrapped compilation

--- src/the_little_clojurian/chapter1.clj
+++ src/the_little_clojurian/chapter1.clj
@@ -1,5 +1,7 @@
 (ns the-little-clojurian.chapter1
   (:require [clojure.test :refer :all]))
+
+(declare listp? atom? s-expression? car cdr conss null? eq?)

 (with-test
   (def atom? (fn [a] (not (listp? a))))


fix to log-cmd

fix to log-cmd

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@7227 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- acqEngine/src/org/micromanager/mm.clj
+++ acqEngine/src/org/micromanager/mm.clj
@@ -54,15 +54,14 @@

 (defmacro log-cmd
   ([cmd-count expr]
-    (let [cmd# (take cmd-count expr)
-          args# (map eval (drop cmd-count expr))]
-      `(do
-      (log (.trim (prn-str (concat '~cmd# '~args#))))
-      (let [result# ~(concat cmd# args#)]
-        (if (nil? result#)
-          (log "  --> nil")
-          (log "  --> " result#))
-        result#))))
+    (let [[cmd# args#] (split-at cmd-count expr)]
+      `(let [result# ~expr]
+        (log
+          (.trim (prn-str (concat '~cmd# (list ~@args#))))
+          (if (nil? result#)
+            "  --> nil"
+            (str "  --> " result#)))
+          result#)))
   ([expr] (log-cmd 1 expr)))

 (defmacro core [& args]


Assoc is nicer

Assoc is nicer

--- src/org/spootnik/fleet/http.clj
+++ src/org/spootnik/fleet/http.clj
@@ -80,7 +80,7 @@
                   (history/update script_name msg)
                   (when stream
                     (put! resp (format "data: %s\n\n" (generate-string msg))))
-                  (put! publisher (merge {:topic :events} msg)))
+                  (put! publisher (assoc msg :topic :events)))
                 (catch Exception e
                   (error e "cannot handle incoming message"))
                 (finally


Remove the LD flag and show the sidenav when the LD top nav flag is on

--- src-cljs/frontend/components/app.cljs
+++ src-cljs/frontend/components/app.cljs
@@ -143,7 +143,6 @@
                      current-route (if (= :route/legacy-page compassus-route)
                                      (:navigation-point app)
                                      compassus-route)]
-                 (when (not (ld/feature-on? "top-bar-ui-v-1"))
-                   (build-legacy aside/aside-nav {:user user :current-route current-route}))))
+                 (build-legacy aside/aside-nav {:user user :current-route current-route})))

              (factory props)]]))))))


Set :static-fns true

Set :static-fns true

One step closer to cljs-bootstrap, and potentially faster

--- ClojureScript/replete/script/build.clj
+++ ClojureScript/replete/script/build.clj
@@ -30,6 +30,7 @@
                 :output-dir output-dir
                 :cache-analysis true
                 :source-map true
+                :static-fns true
                 :def-emits-var true)]
     (env/with-compiler-env (env/default-compiler-env opts)
       (let [;; Generate core$macros


Comment edit

Comment edit

--- clojure/cljs/kuroi/backend.cljs
+++ clojure/cljs/kuroi/backend.cljs
@@ -17,7 +17,7 @@

 ;; Since the original application was client-server, this one
 ;; is also separated to the frontend and backend. Backend tries
-;; to use as less javascript-specific code as possible, while
+;; to use as little javascript-specific code as possible, while
 ;; frontend tires to utilize no direct io code.

 (defn file-base [file]


Fix Tests

Fix Tests

--- src/twentyfortyeight/logic.cljs
+++ src/twentyfortyeight/logic.cljs
@@ -46,7 +46,7 @@

 (defn- join-group
   [group]
-  (map (fn [[f s]] (join-tiles f s)) (partition-all 2 group)))
+  (map (fn [[f s]] (join-tiles f s)) (map reverse (partition-all 2 group))))

 (s/fdef join-first
   :args (s/cat :tiles (s/coll-of ::d/tile :into []))


After registering the staging app with github, add the API keys.

--- backend/src/circle/workers/github.clj
+++ backend/src/circle/workers/github.clj
@@ -26,13 +26,15 @@
   [url after ref json-string]
   (-> json-string json/decode process-json))

-
+;;; https://github.com/account/applications/4808
 (def production-github {:client_id "78a2ba87f071c28e65bb"
                         :client_secret "98cb9262b67ad26bed9191762a23445eeb2054e4"})

-(def staging-github {:client_id "TODO"
-                     :client_secret "TODO"})
+;;; https://github.com/account/applications/5042
+(def staging-github {:client_id "593c08e3973f3e534013"
+                     :client_secret "4f193c232eb94a9ae7bcf1c495a8a3e805dc3493"})

+;;; https://github.com/account/applications/4814
 (def local-github {:client_id "586bf699b48f69a09d8c"
                    :client_secret "1e93bdce2246fd69d9040875338b4137d525e400"})


Code fixes

Code fixes

--- frontend/components/add_projects.cljs
+++ frontend/components/add_projects.cljs
@@ -143,7 +143,7 @@
                    [:span.forked (str " (" (vcs-url/org-name (:vcs_url repo)) ")")])]
                 [:button {:on-click #(utils/open-modal "#inviteForm-addprojects")}
                  [:i.fa.fa-lock]
-                 "Contact organization admin"]]))))))
+                 "Contact repo admin"]]))))))

 (def invite-modal
   [:div#inviteForm-addprojects.fade.hide.modal
@@ -231,21 +231,22 @@
        [:div.head-user
         [:h1 "Add Projects"]]]
       [:div#follow-contents
-       (when (seq (user-model/missing-scopes user))
-         (missing-scopes-notice (:github_oauth_scopes user) (user-model/missing-scopes user)))
-       [:h2 "Welcome!"]
-       [:h3 "You're about to set up a new project in CircleCI."]
-       [:p "CircleCI helps you ship better code, faster. To kick things off, you'll need to pick some projects to build:"]
-       [:hr]
-       [:div.org-listing
-        (om/build organization-listing {:user user
-                                        :settings settings})]
-       [:hr]
-       [:div.project-listing
-        [:div.overview
-         [:span.big-number "2"]
-         [:div.instruction "Choose a repo, and we'll watch the repository for activity in GitHub such as pushes and pull requests. We'll kick off the first build immediately, and a new build will be initiated each time someone pushes commits."]]
-        (om/build main {:user user
-                        :repos repos
-                        :selected-org selected-org
-                        :settings settings})]]])))
+       [:div.follow-wrapper
+        (when (seq (user-model/missing-scopes user))
+          (missing-scopes-notice (:github_oauth_scopes user) (user-model/missing-scopes user)))
+        [:h2 "Welcome!"]
+        [:h3 "You're about to set up a new project in CircleCI."]
+        [:p "CircleCI helps you ship better code, faster. To kick things off, you'll need to pick some projects to build:"]
+        [:hr]
+        [:div.org-listing
+         (om/build organization-listing {:user user
+                                         :settings settings})]
+        [:hr]
+        [:div.project-listing
+         [:div.overview
+          [:span.big-number "2"]
+          [:div.instruction "Choose a repo, and we'll watch the repository for activity in GitHub such as pushes and pull requests. We'll kick off the first build immediately, and a new build will be initiated each time someone pushes commits."]]
+         (om/build main {:user user
+                         :repos repos
+                         :selected-org selected-org
+                         :settings settings})]]]])))


FORMA's working!

FORMA's working!

--- src/clj/forma/hadoop/jobs/scatter.clj
+++ src/clj/forma/hadoop/jobs/scatter.clj
@@ -56,24 +56,24 @@
 ;; ## Forma

 (def forma-run-parameters
-  {:1000-32 {:est-start "2005-12-01"
-             :est-end "2011-05-01"
-             :s-res "1000"
-             :t-res "32"
-             :neighbors 1
-             :window-dims [600 600]
-             :vcf-limit 25
-             :long-block 15
-             :window 5}
-   :1000-16 {:est-start "2005-12-01"
-             :est-end "2011-05-01"
-             :s-res "1000"
-             :t-res "16"
-             :neighbors 1
-             :window-dims [600 600]
-             :vcf-limit 25
-             :long-block 30
-             :window 10}})
+  {"1000-32" {:est-start "2005-12-01"
+              :est-end "2011-05-01"
+              :s-res "1000"
+              :t-res "32"
+              :neighbors 1
+              :window-dims [600 600]
+              :vcf-limit 25
+              :long-block 15
+              :window 5}
+   "1000-16" {:est-start "2005-12-01"
+              :est-end "2011-05-01"
+              :s-res "1000"
+              :t-res "16"
+              :neighbors 1
+              :window-dims [600 600]
+              :vcf-limit 25
+              :long-block 30
+              :window 10}})

 (defn paths-for-dataset
   [dataset s-res t-res tile-seq]
@@ -106,21 +106,22 @@
           (io/set-temporal-res ?swapped-chunk t-res :> ?final-chunk)))))

 (defn process-forma
-  "TODO: Make sure run-key works right."
   [pail-path ts-pail-path out-path run-key country-seq]
   (let [{:keys [s-res t-res] :as forma-map} (forma-run-parameters run-key)]
-    (?- (hfs-seqfile out-path :sinkmode :replace)
-        (forma/forma-query forma-map
-                           (constrained-tap ts-pail-path "ndvi" s-res t-res country-seq)
-                           (adjusted-precl-tap ts-pail-path s-res "32" t-res country-seq)
-                           (constrained-tap pail-path "vcf" s-res "00" country-seq)
-                           (country-tap (constrained-tap pail-path "gadm" s-res "00" country-seq)
-                                        convert-line-src)
-                           (tseries/fire-query pail-path
-                                               t-res
-                                               "2000-11-01"
-                                               "2011-06-01"
-                                               country-seq)))))
+    (if (nil? forma-map)
+      (throw (IllegalArgumentException. (str run-key " is not a valid run key!")))
+      (?- (hfs-seqfile out-path :sinkmode :replace)
+          (forma/forma-query forma-map
+                             (constrained-tap ts-pail-path "ndvi" s-res t-res country-seq)
+                             (adjusted-precl-tap ts-pail-path s-res "32" t-res country-seq)
+                             (constrained-tap pail-path "vcf" s-res "00" country-seq)
+                             (country-tap (constrained-tap pail-path "gadm" s-res "00" country-seq)
+                                          convert-line-src)
+                             (tseries/fire-query pail-path
+                                                 t-res
+                                                 "2000-11-01"
+                                                 "2011-06-01"
+                                                 country-seq))))))

 (defn bucket-forma
   "TODO: Get these country numbers turned into codes!"
@@ -139,9 +140,11 @@
          (src :>> forma-fields)
          (keep-countries ?country :> true))))

+;; TODO: call read-string on countries.
 (defmain RunForma
   [pail-path ts-pail-path results-path run-key & countries]
-  (let [countries (or countries [:IDN :MYS])
+  (let [countries (->> (or countries [":IDN" ":MYS"])
+                       (map read-string))
         temp-path "s3n://formares/unbucketed"]
     (process-forma pail-path ts-pail-path temp-path run-key countries)
     (bucket-forma temp-path results-path)))


Fixed column alignment in routing.clj.

Fixed column alignment in routing.clj.

--- src/clj/org/openforis/ceo/routing.clj
+++ src/clj/org/openforis/ceo/routing.clj
@@ -9,11 +9,11 @@
             [org.openforis.ceo.db.users        :as users]
             [org.openforis.ceo.proxy           :as proxy]))

-;; TODO flatten url structure, conform name and fn
+;; TODO flatten url structure, conform name and fn, and rename geo-dash to geodash everywhere
 (def routes
   {;; Page Routes
-   [:get  "/"]                               {:handler (render-page "/home")}
-   [:get  "/about"]                          {:handler (render-page "/about")}
+   [:get  "/"]                               {:handler     (render-page "/home")}
+   [:get  "/about"]                          {:handler     (render-page "/about")}
    [:get  "/account"]                        {:handler     (render-page "/account")
                                               :auth-type   :user
                                               :auth-action :redirect}
@@ -29,32 +29,32 @@
    [:get  "/geo-dash"]                       {:handler     (render-page "/geo-dash")
                                               :auth-type   :collect
                                               :auth-action :redirect}
-   [:get  "/geo-dash/geo-dash-help"]         {:handler (render-page "/geo-dash/geo-dash-help")}
-   [:get  "/home"]                           {:handler (render-page "/home")}
+   [:get  "/geo-dash/geo-dash-help"]         {:handler     (render-page "/geo-dash/geo-dash-help")}
+   [:get  "/home"]                           {:handler     (render-page "/home")}
    [:get  "/institution-dashboard"]          {:handler     (render-page "/institution-dashboard")
                                               :auth-type   :inst-admin
                                               :auth-action :redirect}
-   [:get  "/login"]                          {:handler (render-page "/login")}
-   [:get  "/password-request"]               {:handler (render-page "/password-request")}
-   [:get  "/password-reset"]                 {:handler (render-page "/password-reset")}
+   [:get  "/login"]                          {:handler     (render-page "/login")}
+   [:get  "/password-request"]               {:handler     (render-page "/password-request")}
+   [:get  "/password-reset"]                 {:handler     (render-page "/password-reset")}
    [:get  "/project-dashboard"]              {:handler     (render-page "/project-dashboard")
                                               :auth-type   :proj-admin
                                               :auth-action :redirect}
-   [:get  "/register"]                       {:handler (render-page "/register")}
-   [:get  "/review-institution"]             {:handler (render-page "/review-institution")}
+   [:get  "/register"]                       {:handler     (render-page "/register")}
+   [:get  "/review-institution"]             {:handler     (render-page "/review-institution")}
    [:get  "/review-project"]                 {:handler     (render-page "/review-project")
                                               :auth-type   :proj-admin
                                               :auth-action :redirect}
-   [:get  "/support"]                        {:handler (render-page "/support")}
+   [:get  "/support"]                        {:handler     (render-page "/support")}
    [:get  "/widget-layout-editor"]           {:handler     (render-page "/widget-layout-editor")
                                               :auth-type   :proj-admin
                                               :auth-action :redirect}
    [:get  "/mailing-list"]                   {:handler     (render-page "/mailing-list")
                                               :auth-type   :super
                                               :auth-action :redirect}
-   [:get  "/unsubscribe-mailing-list"]       {:handler (render-page "/unsubscribe-mailing-list")}
+   [:get  "/unsubscribe-mailing-list"]       {:handler     (render-page "/unsubscribe-mailing-list")}
    ;; Users API
-   [:get  "/get-all-users"]                  {:handler (api-handler users/get-all-users)}
+   [:get  "/get-all-users"]                  {:handler     (api-handler users/get-all-users)}
    [:get  "/get-institution-users"]          {:handler     (api-handler users/get-institution-users)
                                               :auth-type   :user
                                               :auth-action :block}
@@ -67,8 +67,8 @@
    [:post "/account"]                        {:handler     (api-handler users/update-account)
                                               :auth-type   :user
                                               :auth-action :block}
-   [:post "/login"]                          {:handler (api-handler users/login)}
-   [:post "/logout"]                         {:handler (api-handler users/logout)}
+   [:post "/login"]                          {:handler     (api-handler users/login)}
+   [:post "/logout"]                         {:handler     (api-handler users/logout)}
    [:post "/update-user-institution-role"]   {:handler     (api-handler users/update-institution-role)
                                               :auth-type   :inst-admin
                                               :auth-action :block}
@@ -78,10 +78,10 @@
    [:post "/send-to-mailing-list"]           {:handler     (api-handler users/submit-email-for-mailing-list)
                                               :auth-type   :super
                                               :auth-action :block}
-   [:post "/password-request"]               {:handler (api-handler users/reset-password)}
-   [:post "/password-reset"]                 {:handler (api-handler users/get-password-reset-key)}
-   [:post "/register"]                       {:handler (api-handler users/register)}
-   [:post "/unsubscribe-mailing-list"]       {:handler (api-handler users/unsubscribe-from-mailing-list)}
+   [:post "/password-request"]               {:handler     (api-handler users/reset-password)}
+   [:post "/password-reset"]                 {:handler     (api-handler users/get-password-reset-key)}
+   [:post "/register"]                       {:handler     (api-handler users/register)}
+   [:post "/unsubscribe-mailing-list"]       {:handler     (api-handler users/unsubscribe-from-mailing-list)}
    ;; Projects API
    [:get  "/dump-project-aggregate-data"]    {:handler     (api-handler projects/dump-project-aggregate-data)
                                               :auth-type   :proj-admin
@@ -89,7 +89,7 @@
    [:get  "/dump-project-raw-data"]          {:handler     (api-handler projects/dump-project-raw-data)
                                               :auth-type   :proj-admin
                                               :auth-action :block}
-   [:get  "/get-all-projects"]               {:handler (api-handler projects/get-all-projects)}
+   [:get  "/get-all-projects"]               {:handler     (api-handler projects/get-all-projects)}
    [:get  "/get-project-by-id"]              {:handler     (api-handler projects/get-project-by-id)
                                               :auth-type   :collect
                                               :auth-action :block}
@@ -140,8 +140,8 @@
                                               :auth-type   :collect
                                               :auth-action :block}
    ;; Institutions API
-   [:get  "/get-all-institutions"]           {:handler (api-handler institutions/get-all-institutions)}
-   [:get  "/get-institution-details"]        {:handler (api-handler institutions/get-institution-details)}
+   [:get  "/get-all-institutions"]           {:handler     (api-handler institutions/get-all-institutions)}
+   [:get  "/get-institution-details"]        {:handler     (api-handler institutions/get-institution-details)}
    [:post "/archive-institution"]            {:handler     (api-handler institutions/archive-institution)
                                               :auth-type   :inst-admin
                                               :auth-action :block}
@@ -152,12 +152,12 @@
                                               :auth-type   :inst-admin
                                               :auth-action :block}
    ;; Imagery API
-   [:get  "/get-institution-imagery"]        {:handler (api-handler imagery/get-institution-imagery)}
+   [:get  "/get-institution-imagery"]        {:handler     (api-handler imagery/get-institution-imagery)}
    [:get  "/get-project-imagery"]            {:handler     (api-handler imagery/get-project-imagery)
                                               :auth-type   :collect
                                               :auth-action :block}
-   [:get  "/get-public-imagery"]             {:handler (api-handler imagery/get-public-imagery)}
-   [:post "/add-geodash-imagery"]            {:handler (api-handler imagery/add-geodash-imagery)}
+   [:get  "/get-public-imagery"]             {:handler     (api-handler imagery/get-public-imagery)}
+   [:post "/add-geodash-imagery"]            {:handler     (api-handler imagery/add-geodash-imagery)}
    [:post "/add-institution-imagery"]        {:handler     (api-handler imagery/add-institution-imagery)
                                               :auth-type   :inst-admin
                                               :auth-action :block}
@@ -168,11 +168,11 @@
                                               :auth-type   :inst-admin
                                               :auth-action :block}
    ;; GeoDash API
-   [:get  "/geo-dash/get-by-projid"]         {:handler (api-handler geodash/geodash-id)}
-   [:post "/geo-dash/create-widget"]         {:handler (api-handler geodash/create-dashboard-widget-by-id)}
-   [:post "/geo-dash/delete-widget"]         {:handler (api-handler geodash/delete-dashboard-widget-by-id)}
-   [:post "/geo-dash/gateway-request"]       {:handler (api-handler geodash/gateway-request)}
-   [:post "/geo-dash/update-widget"]         {:handler (api-handler geodash/update-dashboard-widget-by-id)}
+   [:get  "/geo-dash/get-by-projid"]         {:handler     (api-handler geodash/geodash-id)}
+   [:post "/geo-dash/create-widget"]         {:handler     (api-handler geodash/create-dashboard-widget-by-id)}
+   [:post "/geo-dash/delete-widget"]         {:handler     (api-handler geodash/delete-dashboard-widget-by-id)}
+   [:post "/geo-dash/gateway-request"]       {:handler     (api-handler geodash/gateway-request)}
+   [:post "/geo-dash/update-widget"]         {:handler     (api-handler geodash/update-dashboard-widget-by-id)}
    ;; Proxy Routes
    [:get  "/get-tile"]                       {:handler     (api-handler proxy/proxy-imagery)
                                               :auth-type   :no-cross


add test for hiccup mime

add test for hiccup mime

--- test/clojupyter/misc/display_test.clj
+++ test/clojupyter/misc/display_test.clj
@@ -17,3 +17,6 @@
 (facts "Should be able to produce markdown"
        ((pretty-maker display/make-markdown) "# hello world") => {:text/markdown "# hello world"})

+(facts "Should be able to produce from hiccup html"
+       (mc/to-mime (display/hiccup-html [:p "some text"])) =>
+       "{\"text/html\":\"
some text
\"}")


Add a DAG of the function/data dependencies

--- test/comic_reader/sites/test_util.clj
+++ test/comic_reader/sites/test_util.clj
@@ -1,7 +1,8 @@
 (ns comic-reader.sites.test-util
   (:require [clojure.test :refer :all]
             [comic-reader.sites :refer :all]
-            [clj-http.client :as client]))
+            [clj-http.client :as client]
+            [loom.graph :as graph]))

 (defmacro test-data-functions-not-nil []
   `(are [selector] (is (not= (selector)
@@ -34,3 +35,56 @@
      root-url
      manga-url
      manga-list-url))
+
+(def dependecy-dag
+  (graph/digraph
+   [:get-image-data :extract-image-tag]
+
+   [:get-page-list :extract-pages-list]
+
+   [:get-chapter-list :comic->url]
+   [:get-chapter-list :extract-chapters-list]
+
+   [:get-comic-list :manga-list-url]
+   [:get-comic-list :extract-comics-list]
+
+   [:extract-image-tag :image-selector]
+
+   [:extract-pages-list :chapter-number-pattern]
+   [:extract-pages-list :page-list-selector]
+   [:extract-pages-list :gen-extract-pages-list-normalize]
+
+   [:gen-extract-pages-list-normalize :page-normalize-pattern]
+   [:gen-extract-pages-list-normalize :page-normalize-format]
+
+   [:comic->url :comic->url-format]
+   [:comic->url :manga-url]
+
+   [:extract-chapters-list :chapter-list-selector]
+   [:extract-chapters-list :chapter-link-normalize]
+
+   [:chapter-link-normalize :link->map]
+   [:chapter-link-normalize :chapter-link-add-ch-num]
+
+   [:chapter-link-add-ch-num :chapter-number-match-pattern]
+
+   [:extract-comics-list :comic-list-selector]
+   [:extract-comics-list :comic-link-normalize]
+
+   [:comic-link-normalize :link->map]
+   [:comic-link-normalize :comic-link-add-id]
+
+   [:comic-link-add-id :manga-pattern]
+
+   [:link->map :link-name-normalize]
+   [:link->map :link-url-normalize]
+
+   [:manga-pattern :manga-url]
+   [:manga-pattern :manga-pattern-match-portion]
+
+   [:manga-list-url :root-url]
+   [:manga-list-url :manga-list-format]
+
+   [:manga-url :root-url]
+   [:manga-url :manga-url-format]
+   ))


Test for prerequisites using `deref` was wrong

--- test/midje/internal_ideas/t_fakes.clj
+++ test/midje/internal_ideas/t_fakes.clj
@@ -159,13 +159,19 @@
 ;; deref is a known special case that has to be detected differently
 ;; than the one above.

+(def throwable-received nil)
+
 (try
   (macroexpand '(fake (deref anything) => 5))
   (catch Throwable ex
-    (fact
-      (let [text (.getMessage ex)]
-        text => #"deref"
-        text => #"interferes with.*Midje"))))
+    ;; Weird things happen with atoms within a catch.
+    (alter-var-root #'throwable-received (constantly ex))))
+
+(fact
+  throwable-received =not=> nil?
+  (let [text (.getMessage throwable-received)]
+    text => #"deref"
+    text => #"interferes with.*Midje"))

 ;; And inlined functions can't be faked


add tests

add tests

--- test/sparkling/serialization_test.clj
+++ test/sparkling/serialization_test.clj
@@ -24,4 +24,12 @@
       "we can serialize and deserialize maps"
       (is (= 42
              (ks/round-trip kryo testthing))))
-    ))+    (testing
+      "we can serialize and deserialize vectors"
+      (is (= [1 2 3 4 5]
+             (ks/round-trip kryo [1 2 3 4 5]))))
+    (testing
+      "we can serialize and deserialize sub-vectors"
+      (is (= [2 3 4]
+             (ks/round-trip kryo (subvec [1 2 3 4 5] 1 4)))))
+    ))


The new content-type parser handles the keyword conversion now.

--- src/dragon/blog/post/impl/default.clj
+++ src/dragon/blog/post/impl/default.clj
@@ -111,7 +111,6 @@
     (event/publish system tag/parse-content-pre {:body (:body data)})
     (->> data
          :content-type
-         keyword
          (post-util/convert-body! system data)
          (event/publish->> system
                            tag/parse-content-post


cosets.clj: fixed orderly generation (apparently)

--- clojure/org/gavrog/clojure/cosets.clj
+++ clojure/org/gavrog/clojure/cosets.clj
@@ -119,8 +119,9 @@
       reps)))

 (defn- compare-renumbered-from [table gens start]
-  (loop [o2n {start 1}, n2o {1 start}, row 0, col 0]
-    (assert (< row (count o2n)) "the current action is not transitive")
+  (loop [o2n {start 0}, n2o {0 start}, row 0, col 0]
+    (assert (or (< row (count o2n)) (>= row (count table)))
+            (str table " is not transitive."))
     (cond (>= row (count table)) 0
           (>= col (count gens)) (recur o2n n2o (inc row) 0)
           :else
@@ -139,7 +140,7 @@

 (defn- canonical [table gens]
   (every? (fn [start] (not (neg? (compare-renumbered-from table gens start))))
-          (range 2 (count table))))
+          (range 1 (count table))))

 (defn tables-generator [nr-gens relators max-cosets]
   (let [with-inverses (fn [ws] (vec (into #{} (concat ws (map inverse ws)))))


Remove rogue repl line.

Remove rogue repl line.

--- src/kolmogorov_music/champernowne.clj
+++ src/kolmogorov_music/champernowne.clj
@@ -37,5 +37,3 @@
   (->> (word base)
        windows
        (some (fn [[i super]] (when (prefix? sub super) i)))))
-
-(index [1 1 2 3 5 8] 10)


Update docstring for event-seq to show default option values

--- src/main/clojure/clojure/data/xml.clj
+++ src/main/clojure/clojure/data/xml.clj
@@ -55,21 +55,22 @@

 Options:

-  :include-node? can be a subset of #{:element :characters :comment} default #{:element :characters}
-  :location-info pass false to skip generating location meta data
+  :include-node? subset of #{:element :characters :comment}, default #{:element :characters}
+  :location-info pass false to skip generating location meta data, default true

-See http://docs.oracle.com/javase/6/docs/api/javax/xml/stream/XMLInputFactory.html
-for documentation on options:
+See https://docs.oracle.com/javase/8/docs/api/javax/xml/stream/XMLInputFactory.html
+for documentation on xml options. These are the defaults:

-  {:allocator                      XMLInputFactory/ALLOCATOR
-   :coalescing                     XMLInputFactory/IS_COALESCING
-   :namespace-aware                XMLInputFactory/IS_NAMESPACE_AWARE
-   :replacing-entity-references    XMLInputFactory/IS_REPLACING_ENTITY_REFERENCES
-   :supporting-external-entities   XMLInputFactory/IS_SUPPORTING_EXTERNAL_ENTITIES
-   :validating                     XMLInputFactory/IS_VALIDATING
-   :reporter                       XMLInputFactory/REPORTER
-   :resolver                       XMLInputFactory/RESOLVER
-   :support-dtd                    XMLInputFactory/SUPPORT_DTD}"
+  {:allocator                    nil      ; XMLInputFactory/ALLOCATOR
+   :coalescing                   true     ; XMLInputFactory/IS_COALESCING
+   :namespace-aware              true     ; XMLInputFactory/IS_NAMESPACE_AWARE
+   :replacing-entity-references  true     ; XMLInputFactory/IS_REPLACING_ENTITY_REFERENCES
+   :supporting-external-entities false    ; XMLInputFactory/IS_SUPPORTING_EXTERNAL_ENTITIES
+   :validating                   false    ; XMLInputFactory/IS_VALIDATING
+   :reporter                     nil      ; XMLInputFactory/REPORTER
+   :resolver                     nil      ; XMLInputFactory/RESOLVER
+   :support-dtd                  true     ; XMLInputFactory/SUPPORT_DTD
+   }"
   {:arglists (list ['source parser-opts-arg])}
   [source opts]
   (let [props* (merge {:include-node? #{:element :characters}


Remove cleanup namespace (replaced by wrap)

--- src/main/clojure/lazytest/cleanup.clj
+++ src/main/clojure/lazytest/cleanup.clj
@@ -1,13 +0,0 @@
-(ns lazytest.cleanup)
-
-(defn with-cleanup
-  "Set f as a cleanup function in x's metadata."
-  [x f]
-  {:pre [(fn? f)]}
-  (vary-meta x assoc ::cleanup f))
-
-(defn do-cleanup
-  "Execute all cleanup functions associated with x."
-  [x]
-  (when-let [f (::cleanup (meta x))]
-    (f)))


Change very-near? to a function (#6)

Change very-near? to a function (#6)

Following the first rule of Macro-club (Don't use macros !) I turned very-near? to a partial function application.
No need for a macro to capture the global epsilon definition.

--- datasets/src/cortex_datasets/math.clj
+++ datasets/src/cortex_datasets/math.clj
@@ -3,9 +3,11 @@

 (def epsilon 1e-6)

-(defmacro very-near?
-  [x y]
-  `(< (Math/abs (- ~x ~y)) epsilon))
+(defn very-near-epsilon?
+  [epsilon x y]
+  (< (Math/abs (- x y)) epsilon))
+
+(def very-near? (partial very-near-epsilon? epsilon))

 (defn matrix-col-totals
   [data]


CMR-7028: Refactored search app imports to solve excess warning messages (#1149)

* CMR-7028: Explicity imported higher version geotools subdependency

* CMR-7028: Updated exclusions to resolve build warnings - nice.

* CMR-7028: Reimported excluded packages

* CMR-7028: Alphabetized inclusions/exclusions

--- search-app/project.clj
+++ search-app/project.clj
@@ -1,18 +1,23 @@
 (defproject nasa-cmr/cmr-search-app "0.1.0-SNAPSHOT"
   :description "Provides a public search API for concepts in the CMR."
   :url "https://github.com/nasa/Common-Metadata-Repository/tree/master/search-app"
-  :exclusions [[cheshire]
-               [clj-time]
-               [com.fasterxml.jackson.core/jackson-core]
-               [commons-codec/commons-codec]
-               [org.apache.httpcomponents/httpclient]
-               [org.clojure/clojure]
-               [org.clojure/tools.reader]
-               [ring/ring-codec]]
+  :exclusions [cheshire
+               clj-time
+               com.fasterxml.jackson.core/jackson-core
+               commons-codec
+               org.apache.httpcomponents/httpclient
+               org.clojure/clojure
+               org.clojure/tools.reader
+               org.eclipse.emf/org.eclipse.emf.common
+               org.eclipse.emf/org.eclipse.emf.ecore
+               ring/ring-codec]
   :dependencies [[cheshire "5.8.1"]
                  [clj-time "0.15.1"]
+                 [com.fasterxml.jackson.core/jackson-annotations "2.12.0"]
                  [com.fasterxml.jackson.core/jackson-core "2.12.0"]
+                 [com.fasterxml.jackson.core/jackson-databind "2.12.0"]
                  [commons-codec/commons-codec "1.11"]
+                 [commons-io/commons-io "2.6"]
                  [gov.nasa.earthdata/cmr-site-templates "0.1.1-SNAPSHOT"]
                  [nasa-cmr/cmr-collection-renderer-lib "0.1.0-SNAPSHOT"]
                  [nasa-cmr/cmr-common-app-lib "0.1.0-SNAPSHOT"]
@@ -25,19 +30,20 @@
                  [nasa-cmr/cmr-umm-lib "0.1.0-SNAPSHOT"]
                  [nasa-cmr/cmr-umm-spec-lib "0.1.0-SNAPSHOT"]
                  [net.sf.saxon/Saxon-HE "9.9.0-2"]
-                 [commons-io/commons-io "2.6"]
                  [org.apache.httpcomponents/httpclient "4.5.13"]
                  [org.clojure/clojure "1.10.0"]
                  [org.clojure/data.csv "0.1.4"]
                  [org.clojure/math.numeric-tower "0.0.4"]
                  [org.clojure/tools.reader "1.3.2"]
+                 [org.eclipse.emf/org.eclipse.emf.ecore "2.23.0"]
+                 [org.eclipse.emf/org.eclipse.emf.common "2.21.0"]
+                 [org.geotools/gt-shapefile "23-RC"]
+                 [org.geotools/gt-geojsondatastore "23-RC"]
+                 [org.geotools.xsd/gt-xsd-kml "23-RC"]
                  [ring/ring-codec "1.1.1"]
                  [ring/ring-core "1.7.1"]
                  [ring/ring-json "0.4.0"]
                  [selmer "1.12.5"]
-                 [org.geotools/gt-shapefile "23-RC"]
-                 [org.geotools/gt-geojsondatastore "23-RC"]
-                 [org.geotools.xsd/gt-xsd-kml "23-RC"]
                  ;; Temporary inclusion of libraries needed for swagger UI until the dev portal is
                  ;; done.
                  [metosin/ring-swagger-ui "2.1.4-0"]


Adding a toolbar

Adding a toolbar

--- src/mambobox_mobile/android/core.cljs
+++ src/mambobox_mobile/android/core.cljs
@@ -13,6 +13,8 @@
 (def view (r/adapt-react-class (.-View ReactNative)))
 (def scroll-view (r/adapt-react-class (.-ScrollView ReactNative)))
 (def list-view (r/adapt-react-class (.-ListView ReactNative)))
+(def tool-bar (r/adapt-react-class (.-ToolbarAndroid ReactNative)))
+(def text-input (r/adapt-react-class (.-TextInput ReactNative)))
 (def DataSource (-> ReactNative .-ListView .-DataSource))
 (def view-pager (r/adapt-react-class (.-ViewPagerAndroid ReactNative)))
 (def image (r/adapt-react-class (.-Image ReactNative)))
@@ -119,18 +121,27 @@
    (for [[t1 t2] (partition-all 2 tags)]
      ^{:key (first t1)} [tags-line t1 t2])])

+(defn header []
+  [view
+   [tool-bar {:title "MamboBox"
+              :style {:height 40}
+              :actions [{:title "Upload psd"} {:title "Settings"}]}]
+   [text-input {:placeholder "Search music..."}]])
+
 (defn app-root []
   (let [selected-tab (subscribe [:selected-tab])]
-   (fn []
-     [scrollable-tab-view {:initial-page @selected-tab
-                           :on-change-tab #(dispatch [:change-tab (.-i %)])}
-      [view {:tab-label "Favorites"
-             :style {:flex 1}}
-       [my-favorites-tab]]
-      [view {:tab-label "Hot"
-             :style {:flex 1}} [hot-tab]]
-      [view {:tab-label "Explore"
-             :style {:flex 1}} [tags-tab]]])))
+    (fn []
+      [view {:style {:flex 1}}
+       [header]
+       [scrollable-tab-view {:initial-page @selected-tab
+                             :on-change-tab #(dispatch [:change-tab (.-i %)])}
+        [view {:tab-label "Favorites"
+               :style {:flex 1}}
+         [my-favorites-tab]]
+        [view {:tab-label "Hot"
+               :style {:flex 1}} [hot-tab]]
+        [view {:tab-label "Explore"
+               :style {:flex 1}} [tags-tab]]]])))

 #_(defn pager []
   [view-pager {:init-page 0 :style {:height 300}}


Fix shortcuts on Linux

Fix shortcuts on Linux

--- src/net/sekao/nightcode/shortcuts.clj
+++ src/net/sekao/nightcode/shortcuts.clj
@@ -123,7 +123,7 @@
   (hide-tooltip! (.lookup node "#tabs")))

 (defn run-shortcut! [^Scene scene actions ^String text shift?]
-  (when-let [id (key-char->id (if shift? (.toUpperCase text) text))]
+  (when-let [id (key-char->id (if shift? text (.toLowerCase text)))]
     (when-let [action (get actions id)]
       (when (->> (.lookupAll (.getRoot scene) (name id))
                  (filter #(and (not (.isDisabled %))
@@ -168,7 +168,7 @@
                   (show-tooltips! stage (.getRoot scene))
                   (show-tabs! stage (.getRoot scene))))
               ; run the action for the given key
-              (run-shortcut! scene actions (.getText e) (.isShiftDown e)))))))
+              (run-shortcut! scene actions (-> e .getCode .getName) (.isShiftDown e)))))))
     ; hide tooltips on window focus
     (.addListener (.focusedProperty stage)
       (reify ChangeListener


Dump rest of units on back row

Dump rest of units on back row

--- src/obb_rules/actions/auto_deploy.clj
+++ src/obb_rules/actions/auto_deploy.clj
@@ -50,8 +50,8 @@

 (defn- build-deploy-actions
   "Builds deploy actions based on the given data"
-  [lineup]
-  (map-indexed (fn [idx [u q]] [(int q) (unit/unit-name u) [(+ idx 1) 7]]) lineup))
+  [lineup row]
+  (map-indexed (fn [idx [u q]] [(int q) (unit/unit-name u) [(+ idx 1) row]]) lineup))

 (defn- do-actions
   "Performs the deploy actions"
@@ -65,10 +65,17 @@
   [board player stash]
   (let [lineup (build-lineup board stash)
         lineup-quantities (build-lineup-quantities lineup stash)
-        raw-actions (build-deploy-actions lineup-quantities)
+        raw-actions (build-deploy-actions lineup-quantities 7)
         actions (map deploy/build-deploy raw-actions)
         start-result (result/action-success board 0)]
     (reduce (partial do-actions player) start-result actions)))
+
+(defn- deploy-back-row
+  "Deploys a back row with all the given units"
+  [result player stash]
+  (let [raw-actions (build-deploy-actions stash 8)
+        actions (map deploy/build-deploy raw-actions)]
+    (reduce (partial do-actions player) result actions)))

 (defn- deploy-firingsquad
   "Deploys the given stash in a way that will be advantajous for firingsquad
@@ -76,8 +83,11 @@
   [board player]
   (let [stash (map map-stash-to-units (board/get-stash board player))
         ordered-stash (sort-by firing-squad-value stash)
-        front-row-units (front-row-units-to-use stash)]
-    (deploy-front-row board player (take front-row-units ordered-stash))))
+        front-row-units (front-row-units-to-use stash)
+        back-row-units (- (count ordered-stash) front-row-units)]
+    (-> board
+        (deploy-front-row player (take front-row-units ordered-stash))
+        (deploy-back-row player (take-last back-row-units ordered-stash)))))

 (def templates
   "The supported auto-deploy templates"


refactor chat actions view

refactor chat actions view

--- src/status_im/chat/views/actions.cljs
+++ src/status_im/chat/views/actions.cljs
@@ -1,16 +1,12 @@
 (ns status-im.chat.views.actions
-  (:require-macros [status-im.utils.views :refer [defview letsubs]])
-  (:require [re-frame.core :refer [subscribe dispatch]]
-            [clojure.string :as s]
-            [status-im.components.react :refer [view
-                                                animated-view
-                                                text
-                                                icon
-                                                touchable-highlight]]
-            [status-im.components.chat-icon.screen :refer [chat-icon-view-menu-item]]
-            [status-im.chat.styles.screen :as st]
-            [status-im.i18n :refer [label label-pluralize]]
-            [status-im.utils.platform :refer [platform-specific]]))
+  (:require [clojure.string :as string]
+            [re-frame.core :as re-frame]
+            [status-im.chat.styles.screen :as styles]
+            [status-im.components.chat-icon.screen :as chat-icon.screen]
+            [status-im.components.react :as react]
+            [status-im.i18n :as i18n]
+            [status-im.utils.platform :as platform])
+  (:require-macros [status-im.utils.views :refer [defview letsubs]]))

 (defview menu-item-icon-profile []
   [chat-id [:chat :chat-id]
@@ -18,15 +14,15 @@
    name [:chat :name]
    color [:chat :color]]
   ;; TODO stub data ('online' property)
-  [chat-icon-view-menu-item chat-id group-chat name color true])
+  [chat-icon.screen/chat-icon-view-menu-item chat-id group-chat name color true])

 (defn- members-text [members]
-  (str (s/join ", " (map :name members))
+  (str (string/join ", " (map :name members))
        " "
-       (label :t/and-you)))
+       (i18n/label :t/and-you)))

 (defn item-members [members]
-  {:title      (label :t/members-title)
+  {:title      (i18n/label :t/members-title)
    :subtitle   (members-text members)
    :icon       :menu_group
    :icon-opts {:width  25
@@ -35,16 +31,16 @@
    :handler    nil})

 (defn item-user [chat-id]
-  {:title       (label :t/profile)
+  {:title       (i18n/label :t/profile)
    :custom-icon [menu-item-icon-profile]
    :icon        :menu_group
    :icon-style  {:width  25
                  :height 19}
-   :handler     #(dispatch [:show-profile chat-id])})
+   :handler     #(re-frame/dispatch [:show-profile chat-id])})

 (def item-search
-  {:title      (label :t/search-chat)
-   :subtitle   (label :t/not-implemented)
+  {:title      (i18n/label :t/search-chat)
+   :subtitle   (i18n/label :t/not-implemented)
    :icon       :search_gray_copy
    :icon-style {:width  17
                 :height 17}
@@ -52,8 +48,8 @@
    :handler    nil})

 (def item-notifications
-  {:title      (label :t/notifications-title)
-   :subtitle   (label :t/not-implemented)
+  {:title      (i18n/label :t/notifications-title)
+   :subtitle   (i18n/label :t/not-implemented)
    ;;:subtitle   "Chat muted"
    :icon       :muted
    :icon-style {:width  18
@@ -62,11 +58,12 @@
    :handler    nil})

 (def item-settings
-  {:title      (label :t/settings)
-   :icon       :settings
-   :icon-style {:width  20
-                :height 13}
-   :handler    #(dispatch [:show-group-chat-settings])})
+  {:title               (i18n/label :t/settings)
+   :icon                :settings
+   :icon-style          {:width  20
+                         :height 13}
+   :accessibility-label :settings
+   :handler             #(re-frame/dispatch [:show-group-chat-settings])})

 (defn group-chat-items [members public?]
   (into (if public? [] [(item-members members)])
@@ -80,58 +77,58 @@
    item-notifications])

 (defn overlay [{:keys [on-click-outside]} items]
-  [view st/actions-overlay
-   [touchable-highlight {:on-press on-click-outside
-                         :style    st/overlay-highlight}
-    [view nil]]
+  [react/view styles/actions-overlay
+   [react/touchable-highlight {:on-press on-click-outside
+                               :style    styles/overlay-highlight}
+    [react/view nil]]
    items])

-(defn action-view [{:keys     [icon-style
+(defn action-view [{:keys     [react/icon-style
+                               icon
                                custom-icon
                                handler
                                title
                                subtitle
                                accessibility-label]
-                    :or       {accessibility-label :action}
-                    icon-name :icon}]
-  [touchable-highlight {:on-press (fn []
-                                    (dispatch [:set-chat-ui-props {:show-actions? false}])
-                                    (when handler
-                                      (handler)))}
-   [view {:accessibility-label accessibility-label
-          :style st/action-icon-row}
-    [view st/action-icon-view
+                    :or       {accessibility-label :action}}]
+  [react/touchable-highlight {:on-press (fn []
+                                          (re-frame/dispatch [:set-chat-ui-props {:show-actions? false}])
+                                          (when handler
+                                            (handler)))}
+   [react/view {:accessibility-label accessibility-label
+                :style styles/action-icon-row}
+    [react/view styles/action-icon-view
      (or custom-icon
-         [icon icon-name icon-style])
-     [view st/action-view
-      [text {:style           st/action-title
-             :number-of-lines 1
-             :font            :medium}
-       title]
-      (when-let [subtitle subtitle]
-        [text {:style           st/action-subtitle
-               :number-of-lines 1
-               :font            :default}
-         subtitle])]]]])
+         [react/icon icon icon-style])]
+    [react/view styles/action-view
+     [react/text {:style           styles/action-title
+                  :number-of-lines 1
+                  :font            :medium}
+      title]
+     (when-let [subtitle subtitle]
+       [react/text {:style           styles/action-subtitle
+                    :number-of-lines 1
+                    :font            :default}
+        subtitle])]]])

 (defview actions-list-view []
   (letsubs [group-chat        [:chat :group-chat]
             chat-id           [:chat :chat-id]
             public?           [:chat :public?]
             members           [:current-chat-contacts]
-            status-bar-height (get-in platform-specific [:component-styles :status-bar :default :height])]
+            status-bar-height (get-in platform/platform-specific [:component-styles :status-bar :default :height])]
     (when-let [actions (if group-chat
                          (group-chat-items members public?)
                          (user-chat-items chat-id))]
-      [view (merge
-             (st/actions-wrapper status-bar-height)
-             (get-in platform-specific [:component-styles :actions-list-view]))
-       [view st/actions-separator]
-       [view st/actions-view
+      [react/view (merge
+                   (styles/actions-wrapper status-bar-height)
+                   (get-in platform/platform-specific [:component-styles :actions-list-view]))
+       [react/view styles/actions-separator]
+       [react/view styles/actions-view
         (for [action actions]
           (if action
             ^{:key action} [action-view action]))]])))

 (defn actions-view []
-  [overlay {:on-click-outside #(dispatch [:set-chat-ui-props {:show-actions? false}])}
+  [overlay {:on-click-outside #(re-frame/dispatch [:set-chat-ui-props {:show-actions? false}])}
    [actions-list-view]])


transform-test

transform-test

--- test/cljc/reitit/http_test.cljc
+++ test/cljc/reitit/http_test.cljc
@@ -234,36 +234,37 @@
                 (is (= 406 (:status (respond))))
                 (is (= ::nil (raise))))))))))

-#_(deftest middleware-transform-test
-    (let [middleware (fn [name] {:name name
-                                 :wrap (fn [handler]
-                                         (fn [request]
-                                           (handler (update request ::mw (fnil conj []) name))))})
-          handler (fn [{:keys [::mw]}] {:status 200 :body (conj mw :ok)})
-          request {:uri "/api/avaruus" :request-method :get}
-          create (fn [options]
-                   (http/ring-handler
-                     (http/router
-                       ["/api" {:interceptors [(middleware :olipa)]}
-                        ["/avaruus" {:interceptors [(middleware :kerran)]
-                                     :get {:handler handler
-                                           :interceptors [(middleware :avaruus)]}}]]
-                       options)))]
-
-      (testing "by default, all middleware are applied in order"
-        (let [app (create nil)]
-          (is (= {:status 200, :body [:olipa :kerran :avaruus :ok]}
-                 (app request)))))
-
-      (testing "middleware can be re-ordered"
-        (let [app (create {::interceptor/transform (partial sort-by :name)})]
-          (is (= {:status 200, :body [:avaruus :kerran :olipa :ok]}
-                 (app request)))))
-
-      (testing "adding debug middleware between middleware"
-        (let [app (create {::interceptor/transform #(interleave % (repeat (middleware "debug")))})]
-          (is (= {:status 200, :body [:olipa "debug" :kerran "debug" :avaruus "debug" :ok]}
-                 (app request)))))))
+(deftest interceptor-transform-test
+  (let [interceptor (fn [name] {:name name
+                                :enter (fn [ctx]
+                                         (update-in ctx [:request ::i] (fnil conj []) name))})
+        handler (fn [{:keys [::i]}] {:status 200 :body (conj i :ok)})
+        request {:uri "/api/avaruus" :request-method :get}
+        create (fn [options]
+                 (http/ring-handler
+                   (http/router
+                     ["/api" {:interceptors [(interceptor :olipa)]}
+                      ["/avaruus" {:interceptors [(interceptor :kerran)]
+                                   :get {:handler handler
+                                         :interceptors [(interceptor :avaruus)]}}]]
+                     options)
+                   nil
+                   {:executor sieppari/executor}))]
+
+    (testing "by default, all middleware are applied in order"
+      (let [app (create nil)]
+        (is (= {:status 200, :body [:olipa :kerran :avaruus :ok]}
+               (app request)))))
+
+    (testing "middleware can be re-ordered"
+      (let [app (create {::interceptor/transform (partial sort-by :name)})]
+        (is (= {:status 200, :body [:avaruus :kerran :olipa :ok]}
+               (app request)))))
+
+    (testing "adding debug middleware between middleware"
+      (let [app (create {::interceptor/transform #(interleave % (repeat (interceptor "debug")))})]
+        (is (= {:status 200, :body [:olipa "debug" :kerran "debug" :avaruus "debug" :ok]}
+               (app request)))))))

 #?(:clj
    (deftest resource-handler-test


Fix `pattern-test`.

Fix `pattern-test`.

--- test/active/clojure/pattern_test.cljc
+++ test/active/clojure/pattern_test.cljc
@@ -1,41 +1,41 @@
-(ns active.clojure.match-test
+(ns active.clojure.pattern-test
   (:require [active.clojure.pattern :as p]
             #?(:clj  [clojure.test :as t :refer :all]
                :cljs [cljs.test :as t :include-macros true])))

 ;; Tests from `active.clojure.match-test`

-(def one-data {:kind "one"
-               :x    "x"
-               :y    "y"
-               :z    "z"
-               :w    "w"})
+(def one-data (quote {:kind "one"
+                      :x    "x"
+                      :y    "y"
+                      :z    "z"
+                      :w    "w"}))

 (def two-data
-  {:kind "two"
-   :a    "a"
-   :b    "b"
-   :c    "c"
-   :d    {"Z" 42
-          "Y" 23
-          "X" 65
-          "W" {"foo"
-               "bar"}}})
+  (quote {:kind "two"
+          :a    "a"
+          :b    "b"
+          :c    "c"
+          :d    {"Z" 42
+                 "Y" 23
+                 "X" 65
+                 "W" {"foo"
+                      "bar"}}}))

 (def three-data
-  {:different-kind
-   "one"
-   :x "x"
-   :y "y"
-   :z "z"
-   :w "w"})
+  (quote {:different-kind
+          "one"
+          :x "x"
+          :y "y"
+          :z "z"
+          :w "w"}))

 (def one
-  [(:kind #"one")
-   (:x "x" :as x)
-   (:y "y")
-   (:z :as z)
-   :w])
+  (quote [(:kind #"one")
+          (:x "x" :as x)
+          (:y "y")
+          (:z :as z)
+          :w]))

 (def one-pattern
   (p/pattern 'one


Improve ensure-dependencies-defined

Improve ensure-dependencies-defined

Make it actually compile and also improve the readability of it's error message.

--- test/comic_reader/sites/test_util.clj
+++ test/comic_reader/sites/test_util.clj
@@ -1,6 +1,7 @@
 (ns comic-reader.sites.test-util
   (:require [clojure.test :refer :all]
             [comic-reader.sites :refer :all]
+            [clojure.template :refer [do-template]]
             [clj-http.client :as client]
             [loom.graph :as graph]
             [loom.alg :as alg]))
@@ -97,10 +98,24 @@
     manga-url
     manga-list-url))

+(defmacro are-with-msg [argv expr & args]
+  (if (or
+       ;; (are [] true) is meaningless but ok
+       (and (empty? argv) (empty? args))
+       ;; Catch wrong number of args
+       (and (pos? (count argv))
+            (pos? (count args))
+            (zero? (mod (count args) (count argv)))))
+    `(do-template ~argv ~expr ~@args)
+    (throw (IllegalArgumentException. "The number of args doesn't match are's argv."))))
+
 (defmacro ensure-dependencies-defined [fn-name]
-  `(are [selector] (is (not= (selector)
-                             nil))
-     ~@(->> (keyword fn-name)
-            (alg/topsort dependecy-dag)
-            (filter data-function?)
-            (map key->sym))))
+  `(are-with-msg [selector#]
+                 (is (not= (selector#)
+                           nil)
+                     (str "Data function " 'selector#
+                          " cannot be undefined"))
+                 ~@(->> (keyword fn-name)
+                        (alg/topsort dependecy-dag)
+                        (filter data-function?)
+                        (map key->sym))))


removing debugging lines

removing debugging lines

--- 02-Medium/War/Clojure/cardus-belli.clj
+++ 02-Medium/War/Clojure/cardus-belli.clj
@@ -40,8 +40,8 @@
                                         (concat (rest p2-d) (list p2-card p1-card))])
             :else (recur (war (rest p1-d) (rest p2-d) (list p1-card p2-card)))))
         (if (seq p1-d)
-          ["PLAYER 1" p1-d]
-          ["PLAYER 2" p2-d])))))
+          "PLAYER 1"
+          "PLAYER 2")))))

 (defn main
   []


Add error handling for missing moves, support Ditto, see #91

--- frontend/src/cruncher/moves/main.cljs
+++ frontend/src/cruncher/moves/main.cljs
@@ -11,7 +11,9 @@
 (defn get-move
   "Return complete move by its id."
   [id]
-  (get data/all id))
+  (if-let [move (get data/all id)]
+    move
+    {:id -1, :vfx-name "not_found", :name (str "Not found: " id), :type "dummy", :unique-id "V0000_DUMMY", :energy-delta -1, :accuracy-change -1, :duration-ms -1, :power -1, :animation-id -1,:damage-window-end-ms -1, :trainer-level-min 1, :critical-chance 0}))

 (defn get-move-dps
   "Return the Damage per Second value for the quick move of the Pokmeon."


replaced @en with "en"

replaced @en with "en"

--- kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/temp/irefweb/irefweb.clj
+++ kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/temp/irefweb/irefweb.clj
@@ -21,7 +21,7 @@
   :body
   ;; get binary interaction records
   ((?/edge_field kiao/hasTemplate iaoirefweb/IRefWebInteraction_edgeTypeDataField1)
-   (?/edge_field obo/IAO_0000219 "X"@en)   ;; "X" signifies binary interaction
+   (?/edge_field obo/IAO_0000219 ["X" "en"])   ;; "X" signifies binary interaction
    (?/interaction_record obo/BFO_0000051 ?/edge_field)  ;; bfo/has_part

    ;; get the unique interaction identifier
@@ -105,7 +105,7 @@
   :body
   ;; get binary interaction records
   ((?/edge_field kiao/hasTemplate iaoirefweb/IRefWebInteraction_edgeTypeDataField1)
-   (?/edge_field obo/IAO_0000219 "Y"@en)   ;; "Y" signifies intra-molecular interaction
+   (?/edge_field obo/IAO_0000219 ["Y" "en"])   ;; "Y" signifies intra-molecular interaction
    (?/interaction_record obo/BFO_0000051 ?/edge_field)  ;; bfo/has_part

    ;; get the unique interaction identifier
@@ -177,7 +177,7 @@
   :body
   ;; get binary interaction records
   ((?/edge_field kiao/hasTemplate iaoirefweb/IRefWebInteraction_edgeTypeDataField1)
-   (?/edge_field obo/IAO_0000219 "C"@en)   ;; "C" signifies "complex" in IRefWeb, but really mean n-ary interaction where n>2
+   (?/edge_field obo/IAO_0000219 ["C" "en"])   ;; "C" signifies "complex" in IRefWeb, but really mean n-ary interaction where n>2
    (?/interaction_record obo/BFO_0000051 ?/edge_field)  ;; bfo/has_part

    ;; get the unique interaction identifier


comments and cleanup

comments and cleanup

--- src/babel/espanol/morphology/verbs.clj
+++ src/babel/espanol/morphology/verbs.clj
@@ -36,7 +36,7 @@
         ustedes (if ustedes ustedes false)
         person (get-in word '(:agr :person))
         number (get-in word '(:agr :number))]
-
+
     (cond
      (and (= person :1st) (= number :sing) ar-type)
      (str stem "aría")
@@ -229,7 +229,7 @@
 (defn imperfect [word & [ {usted :usted
                            vosotros :vosotros
                            ustedes :ustedes}]]
-  (let [infinitive (reflexive-to-infinitive (get-in word '(:espanol)))
+  (let [infinitive (reflexive-to-infinitive (get-in word [:espanol]))
         ar-type (try (re-find #"ar$" infinitive)
                      (catch Exception e
                        (throw (Exception. (str "Can't regex-find on non-string: " infinitive " from word: " word)))))


Reset tracking / deployment atoms on component start

Eventually will just manage the atoms in the component itself.

--- src/clj/onyx_dashboard/http/server.clj
+++ src/clj/onyx_dashboard/http/server.clj
@@ -198,6 +198,11 @@
 (defrecord HttpServer [peer-config]
   component/Lifecycle
   (start [{:keys [sente] :as component}]
+
+    ; Just reset atoms for now. Atoms should be created and reset in here
+    (reset! tracking {})
+    (reset! deployments {})
+
     (println "Starting HTTP Server")

     (defroutes my-routes


small fix

small fix

--- src/cljs/salava/profile/ui/helper.cljs
+++ src/cljs/salava/profile/ui/helper.cljs
@@ -321,7 +321,7 @@
  (let [index (.indexOf (map :id @(cursor state [:tabs])) page-id)]
   [:div#profile
    [:div {:style {:text-align "center" :margin "15px 0"}}
-    (when @(cursor state [:edit-mode])
+    (when (and @(cursor state [:edit-mode]) (= :content @(cursor state [:edit :active-tab])))
      [:div
       (when-not (= page-id (some->> @(cursor state [:tabs])  first :id)) [:span.move-tab {:href "#" :on-click #(f/move-field :up (cursor state [:tabs])  index)} [:i.fa.fa-chevron-left.fa-fw.fa-lg] (t :profile/Movetableft)])
       (when-not (= page-id (some->> @(cursor state [:tabs])  last :id))[:span.move-tab {:href "#" :on-click #(f/move-field :down (cursor state [:tabs]) index)} (t :profile/Movetabright)[:i.fa.fa-chevron-right.fa-fw.fa-lg]])])]


Start crash reporter using it's new api (fix warnings)

--- electron_src/electron/core.cljs
+++ electron_src/electron/core.cljs
@@ -14,7 +14,13 @@
   (.loadURL @main-window (str "file://" js/__dirname "/public/index.html"))
   (.on @main-window "closed" #(reset! main-window nil)))

-(.start crash-reporter)
+(.start crash-reporter
+        (clj->js
+          {:companyName "MyAwesomeCompany"
+           :productName "MyAwesomeApp"
+           :submitURL "https://example.com/submit-url"
+           :autoSubmit false}))
+
 (.on app "window-all-closed" #(when-not (= js/process.platform "darwin")
                                 (.quit app)))
 (.on app "ready" init-browser)


Add get-jobinfo, add branch to flow-program that returns cfg map

--- src/aerobio/server.clj
+++ src/aerobio/server.clj
@@ -597,9 +597,10 @@
   (assert (not (and run prn)) "FLOW-PROGRAM, run and prn mutually exclusive")
   (let [cfg (-> cfg (pg/config-pgm-graph-nodes get-toolinfo nil nil)
                 pg/config-pgm-graph)]
-    (if run
-      (->> cfg pg/make-flow-graph pg/run-flow-program)
-      (->> cfg clojure.pprint/pprint))))
+    (cond
+      run (->> cfg pg/make-flow-graph pg/run-flow-program)
+      prn (->> cfg clojure.pprint/pprint)
+      :else cfg)))

 (defn config-stream-pipe-inputs [services]


Fix typo in API doc.

Fix typo in API doc.

--- src/afterglow/show.clj
+++ src/afterglow/show.clj
@@ -774,7 +774,7 @@
                                       #(rhythm/metro-phrase-start % (rhythm/metro-phrase %))))

 (defn find-effect
-  "Looks up the specified effect keyword in list of active effects
+  "Looks up the specified effect keyword in the list of active effects
   for [[*show*]]. Returns a map of the effect metadata, with the
   effect itself under the key `:effect`. If the effect is in the
   process of ending, the keyword `:ending` will have a `true` value."


Reindent html.clj

Reindent html.clj

--- src/build_mon/html.clj
+++ src/build_mon/html.clj
@@ -15,28 +15,28 @@
                                             release-number
                                             release-environments]}]
   (map (fn [release-env]
-    (let [env-name (:env-name release-env)
-          env-state (:state release-env)]
-          [:div {:id (str "release-definition-id-" release-definition-id "-" env-name) :class (str "panel " (name env-state))}
-           [:span.tag.release "RELEASE"]
-           [:h1.release-definition-name release-definition-name]
-           [:hr]
-           [:h1.release-number release-number]
-           [:hr]
-           [:h1.release-env-name env-name]]))
-    release-environments))
+         (let [env-name (:env-name release-env)
+               env-state (:state release-env)]
+           [:div {:id (str "release-definition-id-" release-definition-id "-" env-name) :class (str "panel " (name env-state))}
+            [:span.tag.release "RELEASE"]
+            [:h1.release-definition-name release-definition-name]
+            [:hr]
+            [:h1.release-number release-number]
+            [:hr]
+            [:h1.release-env-name env-name]]))
+       release-environments))

 ;BUILD
 (defn- generate-build-panel [{:keys [build-definition-name build-definition-id build-number
-                                    status-text state commit-message]}]
- [:div {:id (str "build-definition-id-" build-definition-id) :class (str "panel " (name state))}
-  [:span.tag.build "BUILD"]
-  [:h1.build-definition-name build-definition-name]
-  [:hr]
-  [:h1.build-number build-number]
-  [:hr]
-  [:br]
-  [:div.commit-message commit-message]])
+                                     status-text state commit-message]}]
+  [:div {:id (str "build-definition-id-" build-definition-id) :class (str "panel " (name state))}
+   [:span.tag.build "BUILD"]
+   [:h1.build-definition-name build-definition-name]
+   [:hr]
+   [:h1.build-number build-number]
+   [:hr]
+   [:br]
+   [:div.commit-message commit-message]])

 ; ==================================================
@@ -53,18 +53,18 @@
         panel-rows (Math/ceil (/ (+ total-builds total-releases) max-panels-per-row))
         panel-width 25
         panel-height (/ 100 panel-rows)]
-  (hiccup/html
-    [:head
-     [:title "Build Monitor"]
-     [:link#favicon {:rel "shortcut icon" :href favicon-path}]
-     [:link {:rel "stylesheet" :href "https://fonts.googleapis.com/css?family=Open+Sans|Roboto"}]
-     [:link {:rel "stylesheet" :href
-                   "https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"}]
-     [:link {:rel "stylesheet ":href "/style.css" :type "text/css"}]]
-     [:style (str ".panel { width:" panel-width "%; height:" panel-height "%; }")]
-    [:body
-     refresh-icon
-     error-modal
-     (map generate-build-panel build-info-maps)
-     (map generate-release-env-panels release-info-maps)
-     [:script {:src "/refresh.js" :defer "defer"}]])))
+    (hiccup/html
+      [:head
+       [:title "Build Monitor"]
+       [:link#favicon {:rel "shortcut icon" :href favicon-path}]
+       [:link {:rel "stylesheet" :href "https://fonts.googleapis.com/css?family=Open+Sans|Roboto"}]
+       [:link {:rel "stylesheet" :href
+               "https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"}]
+       [:link {:rel "stylesheet ":href "/style.css" :type "text/css"}]]
+      [:style (str ".panel { width:" panel-width "%; height:" panel-height "%; }")]
+      [:body
+       refresh-icon
+       error-modal
+       (map generate-build-panel build-info-maps)
+       (map generate-release-env-panels release-info-maps)
+       [:script {:src "/refresh.js" :defer "defer"}]])))