fix missing search filter event

fix missing search filter event

Signed-off-by: yenda <96f164ad4d9b2b0dacf8ebee2bb1eeb3aa69adf1@status.im>

--- src/status_im/events.cljs
+++ src/status_im/events.cljs
@@ -68,6 +68,7 @@
             status-im.ui.screens.group.chat-settings.events
             status-im.ui.screens.group.events
             status-im.utils.universal-links.events
+            status-im.search.core
             status-im.ui.screens.profile.events))

 ;; init module


Another fix.

Another fix.

--- src/onyx/scheduling/percentage_task_scheduler.clj
+++ src/onyx/scheduling/percentage_task_scheduler.clj
@@ -91,7 +91,11 @@
            peers []]
       (if (or (>= k n) (not (seq pool)))
         peers
-        (let [max-task (first (reverse (map first (sort-by (fn [[k v]] (count v)) pool))))
+        (let [max-task (first (reverse (map first (sort-by
+                                                   (juxt
+                                                    (fn [[k v]] (- (count v) (:allocation (get balanced k))))
+                                                    (fn [[k v]] (.indexOf ^clojure.lang.PersistentVector (get-in replica [:tasks job]) k)))
+                                                   pool))))
               target (last (get-in pool [max-task]))]
           (recur (inc k) (update-in pool [max-task] (comp vec butlast)) (conj peers target)))))))


Places import: add a title import function to exercise lookup refs.

--- src/datomish/places/import.cljc
+++ src/datomish/places/import.cljc
@@ -64,6 +64,23 @@
               :page/title title
               :page/visitAt visits)))

+(defn import-titles [conn places-connection]
+  (go-pair
+    (let [rows
+          (<?
+            (s/all-rows
+              places-connection
+              ["SELECT DISTINCT p.title AS title, p.guid
+               FROM moz_places AS p
+               WHERE p.title IS NOT NULL AND p.hidden = 0 LIMIT 10"]))]
+      (<?
+        (transact/<transact!
+          conn
+          (map (fn [row]
+                 {:db/id [:page/guid (:guid row)]
+                  :page/title (:title row)})
+               rows))))))
+
 (defn import-places [conn places-connection]
   (go-pair
     ;; Ensure schema fragment is in place, even though it may cost a (mostly empty) transaction.
@@ -83,6 +100,12 @@
           conn
           (map place->entity (group-by :id rows)))))))

+(defn import-titles-from-path [db places]
+  (go-pair
+    (let [conn (transact/connection-with-db db)
+          pdb (<? (s/<sqlite-connection places))]
+      (import-titles conn pdb))))
+
 (defn import-places-from-path [db places]
   (go-pair
     (let [conn (transact/connection-with-db db)


Fix typo in tests

Fix typo in tests

--- test/beicon/tests/test_core.cljc
+++ test/beicon/tests/test_core.cljc
@@ -630,7 +630,7 @@
   #?(:cljs
      (t/async done
        (let [coll [1 2 3]
-             s (s/subscribe-on :trampoline (s/from-coll coll))]
+             s (s/subscribe-on :queue (s/from-coll coll))]
          (t/is (s/observable? s))
          (drain! s #(t/is (= % coll)))
          (s/on-end s done)))


Comment tests related to unfinished high level api.

--- test/buddy/core/crypto_tests.clj
+++ test/buddy/core/crypto_tests.clj
@@ -85,26 +85,26 @@
           (is (bytes/equals? result2 block6)))))
 ))

-(deftest buddy-high-level-crypto
-  (testing "Split by blocksize"
-    (let [input1 (codecs/str->bytes "aaaabbbb")
-          input2 (codecs/str->bytes "aaaabbb")
-          input3 (codecs/str->bytes "aaaabbbbc")
-          result1 (cr/split-by-blocksize input1 4)
-          result2 (cr/split-by-blocksize input2 4)
-          result3 (cr/split-by-blocksize input3 4)]
-      (is (= (count result1) 2))
-      (is (= (count result2) 2))
-      (is (= (count result3) 3))))
+;; (deftest buddy-high-level-crypto
+;;   (testing "Split by blocksize"
+;;     (let [input1 (codecs/str->bytes "aaaabbbb")
+;;           input2 (codecs/str->bytes "aaaabbb")
+;;           input3 (codecs/str->bytes "aaaabbbbc")
+;;           result1 (cr/split-by-blocksize input1 4)
+;;           result2 (cr/split-by-blocksize input2 4)
+;;           result3 (cr/split-by-blocksize input3 4)]
+;;       (is (= (count result1) 2))
+;;       (is (= (count result2) 2))
+;;       (is (= (count result3) 3))))

-  ;; (testing "Encrypt/Decript using :aes"
-  ;;   (let [key     (nonce/random-bytes 32)
-  ;;         iv16    (hex->bytes "00000000000000000000000000000000")
-  ;;         iv8     (hex->bytes "0011001100110011")
-  ;;         block16 (hex->bytes "000000000000000000000000000000AA")
-  ;;         block3  (hex->bytes "121314")
-  ;;         block6  (hex->bytes "221122112211")]
-  ;;     (println (vec (cr/encrypt block3 :key key :iv iv16)))
-  ;;     (println (vec (cr/encrypt block3 :key key :iv iv16)))))
-)
+;;   ;; (testing "Encrypt/Decript using :aes"
+;;   ;;   (let [key     (nonce/random-bytes 32)
+;;   ;;         iv16    (hex->bytes "00000000000000000000000000000000")
+;;   ;;         iv8     (hex->bytes "0011001100110011")
+;;   ;;         block16 (hex->bytes "000000000000000000000000000000AA")
+;;   ;;         block3  (hex->bytes "121314")
+;;   ;;         block6  (hex->bytes "221122112211")]
+;;   ;;     (println (vec (cr/encrypt block3 :key key :iv iv16)))
+;;   ;;     (println (vec (cr/encrypt block3 :key key :iv iv16)))))
+;; )


[#84] Close the connection after using it with CopyManager

--- backend/src/org/akvo/dash/import/csv.clj
+++ backend/src/org/akvo/dash/import/csv.clj
@@ -7,7 +7,7 @@
             [org.akvo.dash.util :refer [squuid]]
             [org.akvo.dash.import.common :refer (make-dataset-data-table)])
   (:import org.postgresql.copy.CopyManager
-           org.postgresql.core.BaseConnection
+           org.postgresql.PGConnection
            java.util.UUID))

 (hugsql/def-db-fns "org/akvo/dash/import.sql")
@@ -105,11 +105,12 @@
                      (get-headers path \,)
                      (vec (for [i (range 1 (inc n-cols))]
                             (str "Column " i))))
-        temp-table (str table-name "_temp")
-        copy-manager (CopyManager. (cast BaseConnection (.unwrap (.getConnection (:datasource tenant-conn)) BaseConnection)))]
+        temp-table (str table-name "_temp")]
     (jdbc/execute! tenant-conn [(get-create-table-sql temp-table n-cols "text" false)])
     (jdbc/execute! tenant-conn [(get-create-table-sql table-name n-cols "jsonb" false)])
-    (.copyIn copy-manager ^String (get-copy-sql temp-table n-cols headers?) (io/input-stream path))
+    (with-open [conn (-> tenant-conn :datasource .getConnection)]
+      (let [copy-manager (.getCopyAPI (.unwrap conn PGConnection))]
+        (.copyIn copy-manager ^String (get-copy-sql temp-table n-cols headers?) (io/input-stream path))))
     (jdbc/execute! tenant-conn [(get-insert-sql temp-table table-name n-cols)])
     (jdbc/execute! tenant-conn [(get-drop-table-sql temp-table)])
     (jdbc/execute! tenant-conn [(get-vacuum-sql table-name)] :transaction? false)


[#84] Move side-effects to body of let (based on @jonase) feeback

--- backend/src/org/akvo/dash/import/csv.clj
+++ backend/src/org/akvo/dash/import/csv.clj
@@ -94,16 +94,15 @@
         table (gen-table-name)
         temp (str table "_temp")
         dataset-id (str (squuid))
-        copy-manager (CopyManager. (cast BaseConnection (:connection conn)))
-        _ (jdbc/execute! conn [(get-create-table-sql temp n-cols "text" true)])
-        _ (jdbc/execute! conn [(get-create-table-sql table n-cols "jsonb" false)])
-        _ (.copyIn copy-manager (get-copy-sql temp n-cols headers?) (io/input-stream path))
-        _ (jdbc/execute! conn [(get-insert-sql temp table n-cols)])
-        _ (insert-dataset conn {:id dataset-id
-                                :name dataset-name})
-        _ (insert-dataset-version conn {:id (str (squuid))
-                                        :dataset-id dataset-id
-                                        :table-name table})
-        _ (insert-dataset-columns conn {:columns
-                                        (get-column-tuples dataset-id col-names n-cols "text")})]
+        copy-manager (CopyManager. (cast BaseConnection (:connection conn)))]
+    (jdbc/execute! conn [(get-create-table-sql temp n-cols "text" true)])
+    (jdbc/execute! conn [(get-create-table-sql table n-cols "jsonb" false)])
+    (.copyIn copy-manager (get-copy-sql temp n-cols headers?) (io/input-stream path))
+    (jdbc/execute! conn [(get-insert-sql temp table n-cols)])
+    (insert-dataset conn {:id dataset-id
+                          :name dataset-name})
+    (insert-dataset-version conn {:id (str (squuid))
+                                  :dataset-id dataset-id
+                                  :table-name table})
+    (insert-dataset-columns conn {:columns (get-column-tuples dataset-id col-names n-cols "text")})
     dataset-id))


Tests for module build-queue-fetcher

Tests for module build-queue-fetcher

--- test/emender_jenkins/build_queue_fetcher_test.clj
+++ test/emender_jenkins/build_queue_fetcher_test.clj
@@ -13,7 +13,9 @@
 (ns emender-jenkins.build-queue-fetcher-test
   (:require [clojure.test :refer :all]
             [emender-jenkins.build-queue-fetcher :refer :all]
-            [emender-jenkins.results          :as results]))
+            [emender-jenkins.results             :as results]
+            [clj-jenkins-api.jenkins-api         :as jenkins-api]
+            [emender-jenkins.common-fetcher      :as common-fetcher]))

 ;
 ; Common functions used by tests.
@@ -41,3 +43,25 @@
 ; Function behaviours
 ;

+(deftest test-fetch-data
+    "Check the function emender-jenkins.build-queue-fetcher/fetch-data."
+    (testing "the function emender-jenkins.build-queue-fetcher/fetch-data."
+        (let [configuration    {:jenkins {:currently-building-view "Building"
+                                          :jenkins-url "http://10.20.30.40:8080/"}}]
+        (with-redefs [jenkins-api/get-command (fn [url] nil)]
+            (fetch-data configuration)
+            (is (nil? (results/get-currently-building-jobs)))
+            (is (nil? (results/get-jobs-in-queue)))
+            (is (nil? (results/get-running-jobs)))))))
+
+(deftest test-run-fetcher-in-thread
+    "Check the function emender-jenkins.build-queue-fetcher/run-fetcher-in-thread"
+    (testing "the function emender-jenkins.build-queue-fetcher/run-fetcher-in-thread"
+        (let [started (atom nil)]
+        (with-redefs [common-fetcher/run-fetcher (fn [name config sleep-amount func status] (reset! started true))]
+            (run-fetcher-in-thread {:fetcher {:run-build-queue-fetcher false}})
+            (is (nil? @started))
+            (run-fetcher-in-thread {:fetcher {:run-build-queue-fetcher true}})
+            (Thread/sleep 1)
+            (is (not (nil? @started)))))))
+


Fix error view jumps

Fix error view jumps

--- src/status_im/ui/screens/desktop/main/chat/views.cljs
+++ src/status_im/ui/screens/desktop/main/chat/views.cljs
@@ -58,7 +58,6 @@
         [react/text {:style (styles/profile-actions-text colors/black)
                      :on-press #(re-frame/dispatch [:show-profile-desktop whisper-identity])}
          (i18n/label :t/view-profile)])
-
       [react/text {:style (styles/profile-actions-text colors/black)
                    :on-press #(re-frame/dispatch [:chat.ui/clear-history-pressed])}
        (i18n/label :t/clear-history)]
@@ -159,6 +158,7 @@
               (reset! chat-id* chat-id)
               (js/setTimeout #(when @scroll-ref (.scrollToEnd @scroll-ref)) 400))]
       [react/view {:style styles/messages-view}
+       [connectivity/error-view]
        [react/scroll-view {:scrollEventThrottle    16
                            :headerHeight styles/messages-list-vertical-padding
                            :footerWidth styles/messages-list-vertical-padding


Rm unnecessary (html ...)

Rm unnecessary (html ...)

--- src-cljs/frontend/components/pieces/empty_state.cljs
+++ src-cljs/frontend/components/pieces/empty_state.cljs
@@ -48,13 +48,12 @@

 (dc/do
   (defcard empty-state
-    (html
-     (empty-state {:icon (html [:i.material-icons "cake"])
-                   :heading (html
-                             [:span
-                              "The "
-                              (important "cake")
-                              " is a lie"])
-                   :subheading "Let's add some."
-                   :action (button/button {:primary? true}
-                                          "Add Cake")}))))
+    (empty-state {:icon (html [:i.material-icons "cake"])
+                  :heading (html
+                            [:span
+                             "The "
+                             (important "cake")
+                             " is a lie"])
+                  :subheading "Let's add some."
+                  :action (button/button {:primary? true}
+                                         "Add Cake")})))


Remove duplicated key.

Remove duplicated key.

--- src-cljs/kixi/hecuba/multiple_properties_charts.cljs
+++ src-cljs/kixi/hecuba/multiple_properties_charts.cljs
@@ -230,7 +230,6 @@
                                     (dom/input #js {:type "checkbox"
                                                     :checked (get the-item :checked)
                                                     :value code
-                                                    :checked (get the-item :checked)
                                                     :onChange (fn [e]
                                                                 (let [checked (= (.. e -target -checked) true)]
                                                                   (put! selection {:checked checked


Wire doctopus routes in to main routes

Wire doctopus routes in to main routes

--- src/doctopus/web.clj
+++ src/doctopus/web.clj
@@ -2,6 +2,7 @@
   (:require [bidi.ring :as bidi]
             [clojure.java.io :as io]
             [doctopus.configuration :refer [server-config]]
+            [doctopus.doctopus :refer [load-routes bootstrap-heads]]
             [doctopus.template :as templates]
             [org.httpkit.server :as server]
             [ring.middleware.defaults :refer [wrap-defaults site-defaults]]
@@ -10,7 +11,8 @@
             [ring.middleware.stacktrace :as trace]
             [ring.util.response :as ring-response]
             [taoensso.timbre :as log]
-            [clojure.walk :refer [keywordize-keys]]))
+            [clojure.walk :refer [keywordize-keys]])
+  (:import [doctopus.doctopus Doctopus]))

 (defn wrap-error-page [handler]
   "Utility ring handler for when Stuff goes Sideways; returns a 500 and an error
@@ -66,11 +68,15 @@
      (serve-html
       (str "ADD A TENTACLE: " (:name params) " BELONGING TO: " (:head params)))))

+;; Let's start bootstrapping!
+(def doctopus (bootstrap-heads (Doctopus. (server-config))))
+
 ;; Bidi routes are defined as nested sets of ""
 (def routes ["/" {""             {:get serve-index}
                   "index.html"   {:get serve-index}
                   "add-head"     {:get serve-add-head-form :post add-head}
-                  "add-tentacle" {:get serve-add-tentacle-form :post add-tentacle}}])
+                  "add-tentacle" {:get serve-add-tentacle-form :post add-tentacle}}
+             "/docs" (load-routes doctopus)])

 (def application-handlers
   (bidi/make-handler routes))


Simplify safety-first, now that client does not provide :request-id key

--- src/io/aviso/rook/internals.clj
+++ src/io/aviso/rook/internals.clj
@@ -46,16 +46,14 @@
   "Provides a safe environment for the implementation of a thread or go block; any uncaught exception
   is converted to a 500 response.

-  The request is used when reporting the exception (it contains a :request-id
-  key set by [[io.aviso.rook.client/send]])."
+  The request is used when reporting the exception; it is passed the incoming request
+  so that it can report the method and URI."
   [request & body]
   `(try
      ~@body
      (catch Throwable t#
        (let [r# ~request]
-         (l/errorf t# "Exception processing request %s (%s)"
-                   (:request-id r# (or "<INCOMING>"))
-                   (utils/summarize-request r#)))
+         (l/error t# "Exception processing request" (utils/summarize-request r#)))
        (utils/response HttpServletResponse/SC_INTERNAL_SERVER_ERROR
                        {:exception (to-message t#)}))))

@@ -103,3 +101,33 @@
     (get-in request [:io.aviso.rook/injections injection-key])
     (throw (ex-info (format "Unable to retrieve injected value for key `%s'." injection-key)
                     {:request request}))))
+
+(defn- convert-middleware-form
+  [handler-sym metadata-sym form]
+  `(or
+     ~(if (list? form)
+        (list* (first form) handler-sym metadata-sym (rest form))
+        (list form handler-sym metadata-sym))
+     ~handler-sym))
+
+(defmacro compose-middleware
+  "Assembles multiple endpoint middleware forms into a single endpoint middleware. Each middleware form
+  is either a list or a single form, that will be wrapped as a list.
+
+  The list is modified so that the first two values passed in are the previous handler and the metadata (associated
+  with the endpoint function).
+
+  The form should evaluate to a new handler, or the old handler. As a convienience, the form may
+  evaluate to nil, which will keep the original handler passed in.
+
+  Returns a function that accepts a handler and middleware and invokes each middleware form in turn, returning
+  a final handler function.
+
+  This is patterned on Clojure's -> threading macro, with some significant differences."
+  [& middlewares]
+  (let [handler-sym (gensym "handler")
+        metadata-sym (gensym "metadata")]
+    `(fn [~handler-sym ~metadata-sym]
+       (let [~@(interleave (repeat handler-sym)
+                           (map (partial convert-middleware-form handler-sym metadata-sym) middlewares))]
+         ~handler-sym))))


Add path validator.

Add path validator.

--- src/uxbox/schema.clj
+++ src/uxbox/schema.clj
@@ -64,6 +64,11 @@
    :optional true
    :validate #(instance? ratpack.form.UploadedFile %)})

+(def path
+  {:message "errors.form.path"
+   :optional true
+   :validate #(instance? java.nio.file.Path %)})
+
 ;; --- Public Api

 (def validate st/validate)


makes the syncer output terser by reducing number of lines output (#1361)

--- token-syncer/src/token_syncer/commands/syncer.clj
+++ token-syncer/src/token_syncer/commands/syncer.clj
@@ -282,11 +282,12 @@
                            :message (str "at least two different cluster urls required, provided: " (vec arguments))}

                           :else
-                          (let [sync-result (sync-tokens waiter-api cluster-urls-set limit)
+                          (let [{:keys [details summary] :as sync-result} (sync-tokens waiter-api cluster-urls-set limit)
                                 exit-code (-> (get-in sync-result [:summary :sync :failed])
                                               empty?
                                               (if 0 1))]
-                            (log/info (-> sync-result pp/pprint with-out-str str/trim))
+                            (log/info "sync details:" (into (sorted-map) details))
+                            (log/info "sync summary:" (into (sorted-map) summary))
                             {:exit-code exit-code
                              :message (str "exiting with code " exit-code)}))))
    :option-specs [["-l" "--limit LIMIT" "The maximum number of tokens to attempt to sync, must be between 1 and 10000"


bring tags up-to-date with fileset-invictus

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -687,7 +687,8 @@

 (def ^:private +tags-defaults+
   {:out-dir "public"
-   :filterer :has-content
+   :filterer identity
+   :extensions [".html"]
    :sortby (fn [file] (:date-published file))
    :comparator (fn [i1 i2] (compare i2 i1))})

@@ -703,12 +704,13 @@
    to the `filterer` option.

    The `sortby` function can be used for ordering entries before rendering."
-  [o out-dir    OUTDIR     str  "the output directory"
-   r renderer   RENDERER   sym  "page renderer (fully qualified symbol resolving to a function)"
-   _ filterer   FILTER     code "predicate to use for selecting entries (default: `:has-content`)"
-   s sortby     SORTBY     code "sort entries by function"
-   c comparator COMPARATOR code "sort by comparator function"
-   m meta       META       edn  "metadata to set on each collection entry"]
+  [o out-dir    OUTDIR     str   "the output directory"
+   r renderer   RENDERER   sym   "page renderer (fully qualified symbol resolving to a function)"
+   _ filterer   FILTER     code  "predicate to use for selecting entries (default: `identity`)"
+   e extensions EXTENSIONS [str] "extensions of files to include"
+   s sortby     SORTBY     code  "sort entries by function"
+   c comparator COMPARATOR code  "sort by comparator function"
+   m meta       META       edn   "metadata to set on each collection entry"]
   (let [options (merge +tags-defaults+ *opts*)
         grouper (fn [entries]
                   (->> entries


formatting

formatting

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -417,7 +417,7 @@
         options (merge +render-defaults+ *opts*)]
     (boot/with-pre-wrap fileset
       (pod/with-call-in @render-pod
-          (io.perun.render/update!))
+        (io.perun.render/update!))
       (let [files (filter (:filterer options) (perun/get-meta fileset))
             updated-files (doall
                            (for [{:keys [path] :as file} files]


cleanup output

cleanup output

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -372,7 +372,6 @@

 (defn- render-in-pod [pod sym render-data]
   {:pre [(symbol? sym) (namespace sym)]}
-  (u/info "size %s" (count (prn-str render-data)))
   (pod/with-eval-in pod
     (require '~(symbol (namespace sym)))
     ((resolve '~sym) ~(pod/send! render-data))))


Add page number to paginate metadata

Add page number to paginate metadata

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -848,7 +848,8 @@
                        (sort-by sortby comparator)
                        (partition-all page-size)
                        (map-indexed #(-> [(str prefix (inc %1) ".html")
-                                          {:entries %2}]))
+                                          {:entry {:page (inc %1)}
+                                           :entries %2}]))
                        (into {})))]
     (assortment-pre-wrap {:task-name "paginate"
                           :tracer :io.perun/paginate


Fix record writer.

Fix record writer.

--- src/incognito/fressian.cljs
+++ src/incognito/fressian.cljs
@@ -4,6 +4,8 @@
             [fress.reader :as r :refer [IFressianReader readInt]]
             [fress.writer :as w :refer [IFressianWriter writeInt beginClosedList endList class-sym]]
             [fress.impl.codes :as codes]
+            [cljs.reader :refer [read-string
+                                 *tag-table* *default-data-reader-fn*]]
             [fress.impl.buffer :as buf]
             [fress.impl.raw-input :as rawIn]))

@@ -11,9 +13,13 @@
 (defn- record-writer
   [write-handlers]
   (fn [w rec]
-    (let [{:keys [tag] :as r} (if (isa? (type rec) incognito.base.IncognitoTaggedLiteral)
-                                (into {} rec)
-                                (incognito-writer @write-handlers rec))]
+    (let [{:keys [tag value] :as r} (if (isa? (type rec) incognito.base.IncognitoTaggedLiteral)
+                                      (into {} rec)
+                                      (incognito-writer @write-handlers rec))
+          tag                       (-> tag
+                                        str
+                                        (clojure.string/replace-first  #"/" ".")
+                                        symbol)]
       (write-tag w "record" 2)
       (write-object w tag)
       (write-tag w "map" 1)
@@ -22,6 +28,7 @@
         (write-object w field true)
         (write-object w value))
       (endList w))))
+

 ;;add incognito read-handler
 (defn- record-reader
@@ -92,5 +99,5 @@
    (def writer (fress.api/create-writer buf :handlers (incognito-write-handlers (atom {'incognito.fressian.SomeRecord (fn [foo] (println "foos") (assoc foo :c "donkey"))}))))
    (fress.api/write-object writer rec)
    (fress.api/read buf :handlers (incognito-read-handlers (atom {}))))
-(fress.api/create-reader)
-  )
+
+)


Docstring improvements

Docstring improvements

--- src/io/aviso/rook/utils.clj
+++ src/io/aviso/rook/utils.clj
@@ -8,7 +8,7 @@
     [clojure.pprint :as pprint]))

 (defn new-uuid
-  "Generates a new UUID string, via UUIDrandomUUID."
+  "Generates a new UUID string, via UUID/randomUUID."
   []
   (-> (UUID/randomUUID) .toString))

@@ -38,7 +38,7 @@
                 :pretty true))

 (defn pretty-print-brief
-  "Prints the object more briefly, with limits on level and length."
+  "Like pretty-print, but prints the object more briefly, with limits on level and length."
   [object]
   (binding [*print-level* 4
             *print-length* 5] (pretty-print object)))


Added decorator function generation; Removed some specialized tag functions

--- src/hyjinks.clj
+++ src/hyjinks.clj
@@ -20,7 +20,7 @@

 ;; Core types

-(defn str-attrs [attrs] (str-join (map (fn [[k v]] [" " k "=\"" v "\""]) attrs)))
+(defn- str-attrs [attrs] (str-join (map (fn [[k v]] [" " k "=\"" v "\""]) attrs)))

 (defrecord Tag [tag-name attrs css items]
 	java.lang.Object
@@ -68,12 +68,12 @@
 (dorun (map declare-tag [
 	'h1 'h2 'h3 'h4 'h5 'h6
 	'b 'i 'u 's 'del 'ins 'small 'sup 'sub 'pre 'q 'cite 'mark 'dbo
-	'a 'img 'embed 'object 'param
+	'a 'img 'embed 'object 'param 'iframe
 	'ul 'ol 'li 'dl 'dt 'dd
 	'p 'span 'div 'nav 'br 'canvas 'textarea 'blockquote
 	'table 'thead 'tbody 'tfoot 'th 'tr 'td 'caption 'colgroup 'col
 	'address 'article 'header 'footer 'main 'section 'aside 'figure 'figcaption
-	'form 'legend 'fieldset 'select 'input 'button
+	'form 'legend 'fieldset 'select 'label 'input 'button 'progress
 	'html 'head 'title 'style 'base 'body 'noscript]))

 ;; Tags with specific features
@@ -99,16 +99,6 @@
 	([label value] (new-tag "option" {:value value} label)))

 (defn optgroup [label & opts] (new-tag "optgroup" {:label label} opts))
-
-(defn iframe [url] (new-tag "iframe" {:src url}))
-
-(defn progress [value maximum] (new-tag "progress" {:value value :max maximum}))
-
-(defn label [target-id text] (new-tag "label" {:for target-id} text))
-
-(defn radio [id value param] (new-tag "input" {:id id :value value :name param :type "radio"}))
-
-(defn hidden-value [id value] (new-tag "input" {:id id :value value :type "hidden"}))

 (defn page-meta [prop value] (new-tag "meta" {:name prop :content value}))

@@ -136,45 +126,19 @@
 	(dl (mapcat (fn [[t d]] [(dt t) (dd d)]) (sort-by key term-map))))

 (defn radio-list [param & opts]
-	(mapcat (fn [[t v]] [(label v t) (radio v v param)]) opts))
-
-;; Common shortcut "tags"
-
-(defn submit-button [] (new-tag "button" {:type "submit"} "Submit"))
-
-(defn reset-button [] (new-tag "button" {:type "reset"} "Reset"))
-
-(defn stylesheet [url] (new-tag "link" {:href url :rel "stylesheet" :media "all" :type "text/css"}))
-
-(defn import-jquery
-	([] (import-jquery "1"))
-	([version] (import-script "javascript"
-		(str "http://ajax.googleapis.com/ajax/libs/jquery/" version "/jquery.min.js"))))
+	(mapcat (fn [[t v]] [(label v {:for t}) (input {:id v :value v :name param :type "radio"})]) opts))

 ;; Attribute/CSS Decorators
-;; Each function has a version that can be inserted in a tag's children:
-;;     (div (center) "Contents")
-;;     (p (color :red) "Contents")
-;; And another version that takes an additional argument and decorates it:
-;;     (center some-tag)
-;;     (color :red some-tag)

 (defn declare-decorator [dec-name & props]
 	(let [params (filter symbol? props)
-	      fixedValues (apply merge {} (filter map? props))
-	      args (apply hash-map (apply concat (map (fn [x] [(keyword x) (symbol x)]) params)))]
+	      args (apply concat (map (fn [x] [(keyword x) (symbol x)]) params))
+	      fixed (apply concat (apply merge {} (filter map? props)))]
 		(eval `(defn ~dec-name
-			([~@params] (new-css ~@args))
-			([~@params tag#] (assoc-css tag# ~@args))))))
+			([~@params] (new-css ~@args ~@fixed))
+			([~@params ~'tag] (assoc-css ~'tag ~@args ~@fixed))))))

-(defn hide
-	([] (new-css :display "none"))
-	([tag] (assoc-css tag :display "none")))
-
-(defn center
-	([] (new-css :margin "0 auto" :text-align "center"))
-	([tag] (assoc-css tag :margin "0 auto" :text-align "center")))
-
-(defn color
-	([color-code] (new-css :color color-code))
-	([color-code tag] (assoc-css tag :color color-code)))+(dorun (map (partial apply declare-decorator) [
+	['hide {:display "none"}]
+	['center {:margin "0 auto" :text-align "center"}]
+	['color 'color]]))


Fix source repl special so it handles source with ns-aliased keywords

--- ClojureScript/replete/src/replete/repl.cljs
+++ ClojureScript/replete/src/replete/repl.cljs
@@ -444,8 +444,9 @@
         (when-let [file-source (get-file-source filepath)]
           (let [rdr (rt/source-logging-push-back-reader file-source)]
             (dotimes [_ (dec (:line var))] (rt/read-line rdr))
-            (-> (r/read {:read-cond :allow :features #{:cljs}} rdr)
-              meta :source))))))
+            (binding [r/*alias-map* (reify ILookup (-lookup [_ k] k))]
+              (-> (r/read {:read-cond :allow :features #{:cljs}} rdr)
+                meta :source)))))))

 (defn- make-base-eval-opts
   []


Add TODO note in core.clj; pick up at &ne in test nl

--- src/nml/core.clj
+++ src/nml/core.clj
@@ -172,6 +172,8 @@
 (defn nml-get [m nml key]
   (get (get m (string/lower-case nml) {}) (string/lower-case key) ""))

+;; TODO remove trailing ','s from value lists
+
 (defn nml-map [s src]
   (let [tree (nml-parse s :s src)
         blank (fn [& _] "")


hide private functions

hide private functions

--- src/nml/core.clj
+++ src/nml/core.clj
@@ -4,7 +4,7 @@
   (:require [clojure.tools.cli :as cli   ])
   (:gen-class))

-(declare nml-name nml-str nml-uniq)
+(declare nml-get nml-name nml-set nml-str)

 ; defs

@@ -21,23 +21,33 @@

 (def version "0.1")

-
 ;; utility defns

-(defn fail [& lines]
+(defn- fail [& lines]
   (binding [*out* *err*]
     (doseq [line lines]
       (println line))
     (System/exit 1)))

-(defn warn [& lines]
+(defn- warn [& lines]
   (binding [*out* *err*]
     (doseq [line lines]
       (println (str "WARNING: " line)))))

-;; nml defns
-
-(defn nml-add [tree parent child match proxy]
+(defn- usage [summary]
+  (doseq [x [""
+             "Usage: nml [options] file"
+             ""
+             "Options:"
+             ""
+             summary
+             ""]]
+    (println x))
+  (System/exit 0))
+
+;; nml private defns
+
+(defn- nml-add [tree parent child match proxy]
   (let [missing  (fn [children] (not-any? #(= (nml-name %) match) children))
         vnew    #(parse proxy :start child)
         f        (fn [& children] (if (missing children)
@@ -45,39 +55,22 @@
                                     (into [parent       ] children)))]
     (if (nil? tree) [parent (vnew)] (insta/transform {parent f} tree))))

-(defn nml-get [tree nml key]
-  (let [stmt     (last (filter #(= (nml-name %) (string/lower-case nml)) (rest tree)))
-        nvsubseq (last (filter #(= (nml-name %) (string/lower-case key)) (rest (last stmt))))
-        values   (last nvsubseq)]
-    (if (nil? values) "" (nml-str values))))
-
-(defn nml-gets [tree gets no-prefix]
+(defn- nml-gets [tree gets no-prefix]
   (doseq [[nml key] gets]
     (let [val (nml-get tree nml key)]
       (println (if no-prefix val (str nml ":" key "=" val))))))

-(defn nml-name [x]
+(defn- nml-name [x]
   (nml-str (second x)))

-(defn nml-set [tree nml key val & sub]
-  (let [child  (if sub :nvsubseq :stmt)
-        match  (if sub (string/lower-case key) (string/lower-case nml))
-        parent (if sub :nvseq :s)
-        proxy  (if sub (str match "=0") (str "&" match " /"))
-        vnew   (if sub (fn [tree] (parse val :start :values)) #(nml-set % nml key val true))
-        f      (fn
-                 ([k v] (if (= (nml-str k) match) [child k (vnew v  )] [child k v]))
-                 ([k  ] (if (= (nml-str k) match) [child k (vnew nil)] [child k  ])))]
-    (insta/transform {child f} (nml-add tree parent child match proxy))))
-
-(defn nml-sets [tree sets]
+(defn- nml-sets [tree sets]
   (loop [t tree s sets]
     (if (empty? s)
       t
       (let [[nml key val] (first s)]
         (recur (nml-set t nml key val) (rest s))))))

-(defn nml-str [x]
+(defn- nml-str [x]
   (let [k         (first x)
         v         (rest  x)
         cjoin    #(string/join "," %)
@@ -124,6 +117,59 @@
                  :ws       ""
                  :wsopt    ""))))

+(defn- nml-uniq [values]
+  (loop [head (first values) tail (rest values) tree []]
+    (if (nil? head)
+      tree
+      (let [name #(nml-name (second %))
+            copy  (some #(= (name head) (name %)) tail)]
+        (recur (first tail) (rest tail) (into tree (if copy [] [head])))))))
+
+;; cli
+
+(defn- assoc-get [m k v]
+  (let [gets (:get m [])]
+    (assoc m :get (into gets [v]))))
+
+(defn- assoc-set [m k v]
+  (let [sets (:set m [])]
+    (assoc m :set (into sets [v]))))
+
+(defn- parse-get [x]
+  (string/split x #":" 2))
+
+(defn- parse-set [x]
+  (let [[nml+key val] (string/split x #"=" 2)
+        [nml key] (parse-get nml+key)]
+    [nml key val]))
+
+(def cliopts
+  [["-g" "--get n:k"   "Get value of key 'k' in namelist 'n'"         :assoc-fn assoc-get :parse-fn parse-get]
+   ["-h" "--help"      "Show usage information"                                                              ]
+   ["-i" "--in-place"  "Edit namelist file in place"                                                         ]
+   ["-n" "--no-prefix" "Report values without 'namelist:key=' prefix"                                        ]
+   ["-s" "--set n:k=v" "Set value of key 'k' in namelist 'n' to 'v'"  :assoc-fn assoc-set :parse-fn parse-set]
+   ["-v" "--version"   "Show version information"                                                            ]])
+
+;; nml public defns
+
+(defn nml-get [tree nml key]
+  (let [stmt     (last (filter #(= (nml-name %) (string/lower-case nml)) (rest tree)))
+        nvsubseq (last (filter #(= (nml-name %) (string/lower-case key)) (rest (last stmt))))
+        values   (last nvsubseq)]
+    (if (nil? values) "" (nml-str values))))
+
+(defn nml-set [tree nml key val & sub]
+  (let [child  (if sub :nvsubseq :stmt)
+        match  (if sub (string/lower-case key) (string/lower-case nml))
+        parent (if sub :nvseq :s)
+        proxy  (if sub (str match "=0") (str "&" match " /"))
+        vnew   (if sub (fn [tree] (parse val :start :values)) #(nml-set % nml key val true))
+        f      (fn
+                 ([k v] (if (= (nml-str k) match) [child k (vnew v  )] [child k v]))
+                 ([k  ] (if (= (nml-str k) match) [child k (vnew nil)] [child k  ])))]
+    (insta/transform {child f} (nml-add tree parent child match proxy))))
+
 (defn nml-tree [s]
   (let [result (parse s)
         child  :nvseq
@@ -135,52 +181,7 @@
               (str (apply str (repeat (- c 1) " ")) "^")))
       (insta/transform {child f} result))))

-(defn nml-uniq [values]
-  (loop [head (first values) tail (rest values) tree []]
-    (if (nil? head)
-      tree
-      (let [name #(nml-name (second %))
-            copy  (some #(= (name head) (name %)) tail)]
-        (recur (first tail) (rest tail) (into tree (if copy [] [head])))))))
-
-;; cli
-
-(defn assoc-get [m k v]
-  (let [gets (:get m [])]
-    (assoc m :get (into gets [v]))))
-
-(defn assoc-set [m k v]
-  (let [sets (:set m [])]
-    (assoc m :set (into sets [v]))))
-
-(defn parse-get [x]
-  (string/split x #":" 2))
-
-(defn parse-set [x]
-  (let [[nml+key val] (string/split x #"=" 2)
-        [nml key] (parse-get nml+key)]
-    [nml key val]))
-
-(def cliopts
-  [["-g" "--get n:k"   "Get value of key 'k' in namelist 'n'"         :assoc-fn assoc-get :parse-fn parse-get]
-   ["-h" "--help"      "Show usage information"                                                              ]
-   ["-i" "--in-place"  "Edit namelist file in place"                                                         ]
-   ["-n" "--no-prefix" "Report values without 'namelist:key=' prefix"                                        ]
-   ["-s" "--set n:k=v" "Set value of key 'k' in namelist 'n' to 'v'"  :assoc-fn assoc-set :parse-fn parse-set]
-   ["-v" "--version"   "Show version information"                                                            ]])
-
 ;; main
-
-(defn usage [summary]
-  (doseq [x [""
-             "Usage: nml [options] file"
-             ""
-             "Options:"
-             ""
-             summary
-             ""]]
-    (println x))
-  (System/exit 0))

 (defn -main [& args]
   (alter-var-root #'*read-eval* (constantly false))


Remove router

Remove router

--- src/nube/app.clj
+++ src/nube/app.clj
@@ -21,11 +21,6 @@
 (defmacro redis! [& body] `(car/wcar (redis-conf) ~@body))

 (def port-range (set (range 8000 8999)))
-(def router (atom {:instances {} :envs {} :unhealthy #{}}))
-
-(defn mark-host-health [host healthy]
-  (swap! router update-in [:unhealthy] #((if healthy disj conj) % host))
-  healthy)

 (defn docker!
   ([method host uri] (docker! method host uri {}))
@@ -53,9 +48,9 @@
 (defn remove-app-env [app env] (redis! (car/hdel (str app ":envs") env)))
 (defn load-app-envs [app] (apply hash-map (redis! (car/hgetall (str app ":envs")))))

-(defn load-app-instances [app] (redis! (car/smembers (str app ":instances"))))
-(defn add-app-instance [app instance] (redis! (car/sadd (str app ":instances") instance) (notify-routers)))
-(defn remove-app-instance [app instance] (redis! (car/srem (str app ":instances") instance) (notify-routers)))
+(defn load-app-instances [app] (redis! (car/lrange (str "frontend:" app) 0 -1)))
+(defn add-app-instance [app instance] (redis! (car/rpush (str "frontend:" app) instance)))
+(defn remove-app-instance [app instance] (redis! (car/lrem (str "frontend:" app) 0 instance)))

 (defn load-pending-app-instances [app] (redis! (car/smembers (str app ":pending-instances"))))
 (defn add-pending-app-instance [app instance] (redis! (car/sadd (str app ":pending-instances") instance)))
@@ -92,10 +87,6 @@
               :body (json/write-str start-options)})
     id))

-(defn init-routing-table []
-  (doseq [app (load-apps)]
-    (swap! router assoc-in [:instances app] (load-app-instances app))))
-
 (defn load-ports-in-use [host]
   (set (mapv #(:PublicPort (first (:Ports %))) (get-containers host))))

@@ -112,21 +103,14 @@
   (when-let [id (:Id (load-container-by-host-and-port host port))]
     (stop-container host id)))

-(defn health-check-host [host port]
-  (mark-host-health (str host ":" port)
-   (loop [n 15]
-     (when (pos? n)
-       (if (= 200 (:status @(http/get (str "http://" host ":" port "/") {:timeout 5000})))
-         true
-         (do
-           (Thread/sleep (* (- 15 n) 500))
-           (recur (dec n))))))))
-
-(defn health-check-instances []
-  (doseq [l (vals (:instances @router))]
-    (doseq [i l]
-      (let [[host port] (ssplit i)]
-        (health-check-host host port)))))
+(defn health-check-host [host port]
+  (loop [n 15]
+    (when (pos? n)
+      (if (= 200 (:status @(http/get (str "http://" host ":" port "/") {:timeout 5000})))
+        true
+        (do
+          (Thread/sleep (* (- 15 n) 500))
+          (recur (dec n)))))))

 (defn pull-docker-image [host image]
   (let [[image tag] (ssplit image)]
@@ -135,8 +119,7 @@
 (defn kill-app-instance [app host port]
   (println "Killing instance at" (str host ":" port))
   (stop-container-by-port host port)
-  (remove-app-instance app (str host ":" port))
-  (mark-host-health (str host ":" port) true))
+  (remove-app-instance app (str host ":" port)))

 (defn deploy-app-instance [app host port internal-port image]
   (println "Pulling new tags for" image)
@@ -261,50 +244,7 @@

 (defn extract-app [req] (first (ssplit ((:headers req) "host"))))

-(defn pipe-instance [req app]
-  (if-let [instances (get-in @router [:instances app])]
-    (if (seq instances)
-      (if-let [instance (rand-nth (vec (clojure.set/difference (set instances) (:unhealthy @router))))]
-        (with-channel req channel
-          (http/request
-           {:url (str (name (:scheme req)) "://" instance (:uri req)
-                      (let [q (:query-string req)] (if (clojure.string/blank? q) "" (str "?" q))))
-            :method (:request-method req)
-            :headers (:headers req)
-                                        ;:form-params (:form-params req)
-            :body (:body req)
-            :user-agent ((:headers req) "user-agent")}
-           #(send! channel {:status (:status %)
-                            :body (:body %)
-                            :headers (into {} (map (fn [[k v]] (vector (name k) v)) (:headers %)))})))
-        {:status 503 :body (str "No backend available for " app)})
-      {:status 503 :body (str "No backend available for " app)})
-    {:status 404 :body (str "No backend found for " app)}))
-
-(defn pipe [req]
-  (if-let [app (extract-app req)]
-    (let [envs (load-app-envs app)]
-      (if (envs "auth-user")
-        (let [auth-req (basic-authentication-request req #(and (= % (envs "auth-user")) (= %2 (envs "auth-password"))))]
-          (if (:basic-authentication auth-req)
-            (pipe-instance auth-req app)
-            (authentication-failure nil nil)))
-        (pipe-instance req app)))
-    {:status 404 :body "Invalid hostname"}))
-
-(defn app [req]
-  (if (= (:controller @env) (extract-app req))
-    (controller-app req)
-    (pipe req)))
-
-(defn init []
-  (get-token)
-  (init-routing-table)
-  (car/with-new-pubsub-listener (:spec (redis-conf)) {"updates" (fn [_] (init-routing-table))}
-    (car/subscribe "updates"))
-  (future
-    (loop []
-      (health-check-instances)
-      (Thread/sleep 5000)
-      (recur))))
-
+(defn app [req] (controller-app req))
+
+(defn init [] (get-token))
+


Key task data returned by submit-job by name

--- src/onyx/api.clj
+++ src/onyx/api.clj
@@ -167,7 +167,7 @@
        (extensions/write-log-entry (:log client) entry)
        (component/stop client)
        {:job-id id
-        :task-ids tasks})))
+        :task-ids (zipmap (map :name tasks) tasks)})))

 (defn ^{:added "0.6.0"} kill-job
   "Kills a currently executing job, given it's job ID. All peers executing


--- src/cljs/org/broadinstitute/firecloud_ui/common.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/common.cljs
@@ -104,7 +104,7 @@
   (str (config/api-url-root) "/cookie-authed/download/b/" bucket "/o/" object))

 (defn gcs-object->google-url [bucket object]
-  (str "https://www.googleapis.com/storage/v1/b/" bucket "/o/" object "?alt=media"))
+  (str "https://www.googleapis.com/storage/v1/b/" bucket "/o/" (js/encodeURIComponent object) "?alt=media"))

 (defn parse-gcs-uri [gcs-uri]
   (when (string? gcs-uri)


[cljs tests]: splicing :clj imports

[cljs tests]: splicing :clj imports


update load-temperatures & calc-stats

update load-temperatures & calc-stats

--- day3/src/day3/csv.clj
+++ day3/src/day3/csv.clj
@@ -71,9 +71,18 @@
    :max (transduce (map id) max (- Double/MAX_VALUE) rows)
    :avg (/ (transduce (map id) + 0 rows) (count rows))})

+(defn calc-stats
+  [rows cols]
+  (reduce
+     (fn [acc id] (assoc acc id (column-value-range rows id)))
+     {} cols))
+
 (defn load-temperatures
   []
-  (load-data
-    (io/resource "data/global-temp-annual.csv")
-    #{"Year" "Land"}
-    #{:year :land}))+  (let [rows (load-data
+               (io/resource "data/global-temp-annual.csv")
+               #{"Year" "Land" "Land and Ocean"}
+               #{:year :land :land-and-ocean})
+        stats (calc-stats rows #{:year :land :land-and-ocean})]
+    {:rows rows
+     :stats stats}))


Fix error message in usb-hid.

Fix error message in usb-hid.

--- src/org/playasophy/wonderdome/input/usb_hid.clj
+++ src/org/playasophy/wonderdome/input/usb_hid.clj
@@ -44,13 +44,13 @@
   (try
     (clojure.lang.RT/loadLibrary library-name)
     ; TODO: release the manager?
-    (-> (HIDManager/getInstance)
-        (.openById vendor-id product-id nil))
+    (when-let [manager (HIDManager/getInstance)]
+      (.openById manager vendor-id product-id nil))
     (catch UnsatisfiedLinkError e
       (println "Failed to load USB library:" e)
       nil)
     (catch RuntimeException e
-      (println "Error loading gamepad input device:" e)
+      (println "Error loading USB input device:" e)
       nil)))


keep same tense throughout sentence

keep same tense throughout sentence

--- src/pc/views/blog/private_docs_early_access.clj
+++ src/pc/views/blog/private_docs_early_access.clj
@@ -21,7 +21,7 @@
    :body
    (list
      [:article
-      [:p "These are a few questions we thought users may ask while participating in early access to private docs features.
+      [:p "These are a few questions we think users may ask while participating in early access to our private doc features.
           If you can think of any other questions that you think might be useful, "
           [:a {:href "mailto:hi@prcrsr.com"} "let us know"]
           " and we'll throw it in."]]


Also make dev start pass new AWS credentials format

--- dev-src/braid/dev/core.clj
+++ dev-src/braid/dev/core.clj
@@ -39,7 +39,10 @@
   ;; modules must run first
   (modules/init! modules/default)
   (-> (mount/except #{#'braid.core.server.email-digest/email-jobs})
-      (mount/with-args (assoc env :port port))
+      (mount/with-args (cond-> (assoc env :port port)
+                         (env :aws-access-key)
+                         (assoc :aws/credentials-provider
+                                (constantly ((juxt :aws-access-key :aws-secret-key) env)))))
       (mount/start))
   (when (zero? port)
     (mount/stop #'braid.base.conf/config)


RS & DM | #107 | Add question to mock question so no translation errors are thrown by validations tests

--- test/objective8/integration/front_end/validations.clj
+++ test/objective8/integration/front_end/validations.clj
@@ -19,7 +19,7 @@

 (def objective {:_id OBJECTIVE_ID :status "open"})
 (def objective-in-drafting {:_id OBJECTIVE_ID :status "drafting"})
-(def question {:_id QUESTION_ID :objective-id OBJECTIVE_ID})
+(def question {:_id QUESTION_ID :objective-id OBJECTIVE_ID :question "Why?"})
 (def draft {:_id DRAFT_ID
             :objective-id OBJECTIVE_ID
             :_created_at "2015-02-12T16:46:18.838Z"})


process section lms and status

process section lms and status

--- src/oarlock.clj
+++ src/oarlock.clj
@@ -62,6 +62,8 @@

 (defn section-in [db-conn section]
   (tx-entity! db-conn :section (-> section
+                                   (update-in [:status] #(slam :section.status (keyword %)))
+                                   (update-in [:lms] keyword)
                                    (hatch/attr-as-lookup-refs :instructors :user/id-sk)
                                    (hatch/attr-as-lookup-refs :perf-asmts :perf-asmt/id-sk-with-origin)
                                    (hatch/slam-all :section))))


reduce stack overflows by using (flatten) rather than (reduce concat)

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -1404,8 +1404,7 @@

 ;; TODO: move this to babel.italiano.lexicon, since it is part of lexicon compilation
 (defn exception-generator [lexicon]
-  (reduce
-   concat
+  (flatten
    (->>
     (sort (keys lexicon))
     (map (fn [k]


ENS details

ENS details

--- src/name_bazaar/ui/pages/ens_record_detail_page.cljs
+++ src/name_bazaar/ui/pages/ens_record_detail_page.cljs
@@ -76,8 +76,8 @@
                                                          (< (count (name-label name)) 7))
                                                   :registrar.entry.state/not-yet-available
                                                   state))]
-        [app-layout {:meta {:title (str name "name details")
-                            :description (str "See details about " name " status: " state-text)}}
+        [app-layout {:meta {:title (str name " name details")
+                            :description (str "See details about " name ". Status: " state-text)}}
          [ui/Segment
           [:h1.ui.header.padded name]
           [ens-name-details


Line ends ?

Line ends ?

--- src/ombs/db.clj
+++ src/ombs/db.clj
@@ -24,9 +24,9 @@
 (sql/defentity groupedParticipants)

 (defn add-user [uname password birthdate rate]
-  (sql/insert users (sql/values {:name uname
-                                 :password password
-                                 :bdate birthdate
+  (sql/insert users (sql/values {:name uname
+                                 :password password
+                                 :bdate birthdate
                                  :rate rate } )))

 (defn add-event [ename price & [date]]
@@ -45,9 +45,9 @@
                      (sql/limit 1)
                      )))

-(defn get-event [ename]
+(defn get-event [ename]
   "Return fields of event"
-  (sql/select events
+  (sql/select events
               (sql/fields :name :price :remain)
               (sql/where (= :name ename))))

@@ -56,22 +56,22 @@
   (sql/fields :name :bdate :balance :rate :password)
   (sql/select users))

-(defn get-events-list []
+(defn get-events-list []
   "Return map of events"
   (sql/select events))

-(defn get-uid [uname]
-  (:id (first (sql/select users (sql/fields :id)
+(defn get-uid [uname]
+  (:id (first (sql/select users (sql/fields :id)
               (sql/where (= :name uname))))))

-(defn get-eid [ename]
-  (:id (first (sql/select events (sql/fields :id)
+(defn get-eid [ename]
+  (:id (first (sql/select events (sql/fields :id)
               (sql/where (= :name ename))))))

 (defn participapated? [uid eid]
-  (do (println (str "TRACE:::::::: " uid " E: " eid))
-    (not (empty? (sql/select participants (sql/where
+  (do (println (str "TRACE:::::::: " uid " E: " eid))
+    (not (empty? (sql/select participants (sql/where
                                             (and (= :uid uid)
                                                  (= :eid eid))))))))


realize debt calculations.

realize debt calculations.

--- src/ombs/db.clj
+++ src/ombs/db.clj
@@ -64,9 +64,9 @@
   (:id (first (sql/select users (sql/fields :id)
               (sql/where (= :name uname))))))

-(defn get-eid [ename]
+(defn get-eid [ename date]
   (:id (first (sql/select events (sql/fields :id)
-                          (sql/where (= :name ename))))))
+                          (sql/where (and (= :name ename) (= :date date)))))))

 (defn participapated? [uid eid]
@@ -111,11 +111,11 @@
               ))

 (defn credit-payment [uid eid money]
-  (println (str "add credit : "username" event: "ename " price: "money) )
+  (println (str "add credit : "uid" event: "eid " price: "money) )
   (sql/insert pays (sql/values { :uid uid :eid eid :credit money }))
   )
 (defn debit-payment [uid eid money]
-  (println (str "add debit: "username" event: "ename " price: "money) )
+  (println (str "add debit: "uid" event: "eid " price: "money) )
   (sql/insert pays (sql/values { :uid uid :eid eid :credit money }))
   )


Correct benchmark PersistentHashMap to use lean map

--- src/bench/cljs/lean_map/bench.cljs
+++ src/bench/cljs/lean_map/bench.cljs
@@ -101,7 +101,7 @@
   (doseq [benchmark benchmarks]
     (map-bench benchmark empty-map data)))

-(def lem (.-EMPTY PersistentHashMap))
+(def lem (.-EMPTY lean/PersistentHashMap))
 (def cem (.-EMPTY cljs.core/PersistentHashMap))

 (def test-keys (mapv (fn [i]


Add a spy logger macro to facilitate debugging.

--- metlog-vault/src-client/metlog_client/logger.clj
+++ metlog-vault/src-client/metlog_client/logger.clj
@@ -18,3 +18,13 @@

   ([ level expr ]
    `(log ~level "WATCH" (pr-str '~expr) "=>" ~expr)))
+
+(defmacro spy
+  ([ expr ]
+   `(spy :debug ~expr))
+
+  ([ level expr ]
+   `(let [value# ~expr]
+      (log ~level "SPY" (pr-str '~expr) "=>" value#)
+      value#)))
+


add link to issues in help page

add link to issues in help page

--- src/braid/ui/views/pages/help.cljs
+++ src/braid/ui/views/pages/help.cljs
@@ -7,4 +7,7 @@

    [:div.content
     [:div.description
-     [:p "One day, a help page will be here."]]]])
+     [:p "One day, a help page will be here."]
+     [:p "If something is broken or confusing, please let us know by "
+      [:a {:href "https://github.com/braidchat/meta/issues" :target "_blank" :rel "noopener noreferrer"}
+       "Opening an issue"]]]]])


another fix for advanced compilation

another fix for advanced compilation

--- src/chat/client/views/message.cljs
+++ src/chat/client/views/message.cljs
@@ -161,8 +161,8 @@
   (reify
     om/IDidMount
     (did-mount [_]
-      (when-let [PR (.-PR js/window)]
-        (.prettyPrint PR)))
+      (when-let [PR (aget js/window "PR")]
+        ((aget PR "prettyPrint"))))
     om/IRender
     (render [_]
       (let [sender (om/observe owner (helpers/user-cursor (message :user-id)))]


Send to the correct downstream tasks.

Send to the correct downstream tasks.

--- src/onyx/messaging/http_kit.clj
+++ src/onyx/messaging/http_kit.clj
@@ -42,10 +42,9 @@

 (defmethod extensions/send-messages HttpKit
   [messenger {:keys [onyx.core/job-id onyx.core/task onyx.core/workflow] :as event}]
-  (let [replica @(:onyx.core/replica event)
-        tasks nil
-        task-id nil]
-    (doseq [task tasks]
+  (let [replica @(:onyx.core/replica event)]
+    (doseq [task-id (vals (:onyx.core/serialized-task event))]
+      (prn "Sending to: " task-id)
       (let [peers (get-in [replica :allocations job-id task-id])
             url (get-in replica [:peer-site (rand-nth peers)])]
         (doseq [c (map :compressed (:onyx.core/compressed event))]


readability

readability

--- src/clj/clojexcms/content_page.clj
+++ src/clj/clojexcms/content_page.clj
@@ -10,4 +10,8 @@

 (deftemplate content-page
   (io/resource "frontend.html") [id]
-  [:div#content] (html-content (md-to-html-string (:body (first (content-by-id db id))))))
+  [:div#content] (->> (content-by-id db id)
+                      first
+                      :body
+                      md-to-html-string
+                      html-content))


use->require in macros.clj for bootstrap cljs compatibility

--- src/clj/com/rpl/specter/macros.clj
+++ src/clj/com/rpl/specter/macros.clj
@@ -1,5 +1,5 @@
 (ns com.rpl.specter.macros
-  (:use [com.rpl.specter impl])
+  (:require [com.rpl.specter [impl :as i]])
   )

 (defn gensyms [amt]
@@ -7,7 +7,7 @@

 (defn determine-params-impls [[name1 & impl1] [name2 & impl2]]
   (if-not (= #{name1 name2} #{'select* 'transform*})
-    (throw-illegal "defpath must implement select* and transform*, instead got "
+    (i/throw-illegal "defpath must implement select* and transform*, instead got "
       name1 " and " name2))
   (if (= name1 'select*)
     [impl1 impl2]
@@ -22,17 +22,17 @@
          [[_ t-structure-sym t-next-fn-sym] & transform-body]]
          (determine-params-impls impl1 impl2)]
     (if (= 0 num-params)
-      `(no-params-compiled-path
-         (->TransformFunctions
-           StructurePathExecutor
+      `(i/no-params-compiled-path
+         (i/->TransformFunctions
+           i/StructurePathExecutor
            (fn [~s-structure-sym ~s-next-fn-sym]
              ~@select-body)
            (fn [~t-structure-sym ~t-next-fn-sym]
              ~@transform-body)
            ))
-      `(->ParamsNeededPath
-         (->TransformFunctions
-           RichPathExecutor
+      `(i/->ParamsNeededPath
+         (i/->TransformFunctions
+           i/RichPathExecutor
            (fn [~PARAMS-SYM ~PARAMS-IDX-SYM vals# ~s-structure-sym next-fn#]
              (let [~s-next-fn-sym (fn [structure#]
                                     (next-fn#
@@ -66,9 +66,9 @@
                           (conj vals# c#)
                           ~structure-sym)
                         ))]
-     (->ParamsNeededPath
-       (->TransformFunctions
-         RichPathExecutor
+     (i/->ParamsNeededPath
+       (i/->TransformFunctions
+         i/RichPathExecutor
          collector#
          collector# )
        ~num-params
@@ -76,21 +76,21 @@

 (defn pathed-path* [builder paths-seq latefns-sym pre-bindings post-bindings impls]
   (let [num-params-sym (gensym "num-params")]
-    `(let [paths# (map comp-paths* ~paths-seq)
-           needed-params# (map num-needed-params paths#)
+    `(let [paths# (map i/comp-paths* ~paths-seq)
+           needed-params# (map i/num-needed-params paths#)
            offsets# (cons 0 (reductions + needed-params#))
            any-params-needed?# (->> paths#
-                                    (filter params-needed-path?)
+                                    (filter i/params-needed-path?)
                                     empty?
                                     not)
            ~num-params-sym (last offsets#)
            ~latefns-sym (map
                           (fn [o# p#]
-                            (if (compiled-path? p#)
+                            (if (i/compiled-path? p#)
                               (fn [params# params-idx#]
                                 p# )
                               (fn [params# params-idx#]
-                                (bind-params* p# params# (+ params-idx# o#))
+                                (i/bind-params* p# params# (+ params-idx# o#))
                                 )))
                           offsets#
                           paths#)
@@ -98,7 +98,7 @@
            ret# ~(builder post-bindings num-params-sym impls)
            ]
     (if (not any-params-needed?#)
-      (bind-params* ret# nil 0)
+      (i/bind-params* ret# nil 0)
       ret#
       ))))

@@ -127,11 +127,11 @@
   `(path ~params
      (~'select* [this# structure# next-fn#]
        (let [afn# (fn [~structure-sym] ~@impl)]
-         (filter-select afn# structure# next-fn#)
+         (i/filter-select afn# structure# next-fn#)
          ))
      (~'transform* [this# structure# next-fn#]
        (let [afn# (fn [~structure-sym] ~@impl)]
-         (filter-transform afn# structure# next-fn#)
+         (i/filter-transform afn# structure# next-fn#)
          ))))

 (defmacro paramscollector
@@ -224,30 +224,30 @@
           (defprotocol ~prot-name (~m [structure#]))
           (def ~name
             (if (= ~num-params 0)
-              (no-params-compiled-path
-                (->TransformFunctions
-                  RichPathExecutor
+              (i/no-params-compiled-path
+                (i/->TransformFunctions
+                  i/RichPathExecutor
                   (fn ~rargs
                     (let [path# ~retrieve
-                          selector# (compiled-selector path#)]
+                          selector# (i/compiled-selector path#)]
                       (selector# ~@rargs)
                       ))
                   (fn ~rargs
                     (let [path# ~retrieve
-                          transformer# (compiled-transformer path#)]
+                          transformer# (i/compiled-transformer path#)]
                       (transformer# ~@rargs)
                       ))))
-              (->ParamsNeededPath
-                (->TransformFunctions
-                  RichPathExecutor
+              (i/->ParamsNeededPath
+                (i/->TransformFunctions
+                  i/RichPathExecutor
                   (fn ~rargs
                     (let [path# ~retrieve
-                          selector# (params-needed-selector path#)]
+                          selector# (i/params-needed-selector path#)]
                       (selector# ~@rargs)
                       ))
                   (fn ~rargs
                     (let [path# ~retrieve
-                          transformer# (params-needed-transformer path#)]
+                          transformer# (i/params-needed-transformer path#)]
                       (transformer# ~@rargs)
                       )))
                 ~num-params
@@ -270,26 +270,26 @@
          (declare ~declared)
          (def ~name
            (if (= ~num-params 0)
-             (no-params-compiled-path
-               (->TransformFunctions
-                RichPathExecutor
+             (i/no-params-compiled-path
+               (i/->TransformFunctions
+                i/RichPathExecutor
                 (fn ~rargs
-                  (let [selector# (compiled-selector ~declared)]
+                  (let [selector# (i/compiled-selector ~declared)]
                     (selector# ~@rargs)
                     ))
                 (fn ~rargs
-                  (let [transformer# (compiled-transformer ~declared)]
+                  (let [transformer# (i/compiled-transformer ~declared)]
                     (transformer# ~@rargs)
                     ))))
-             (->ParamsNeededPath
-               (->TransformFunctions
-                 RichPathExecutor
+             (i/->ParamsNeededPath
+               (i/->TransformFunctions
+                 i/RichPathExecutor
                  (fn ~rargs
-                   (let [selector# (params-needed-selector ~declared)]
+                   (let [selector# (i/params-needed-selector ~declared)]
                      (selector# ~@rargs)
                      ))
                  (fn ~rargs
-                   (let [transformer# (params-needed-transformer ~declared)]
+                   (let [transformer# (i/params-needed-transformer ~declared)]
                      (transformer# ~@rargs)
                      )))
                ~num-params
@@ -297,17 +297,17 @@
            ))))))

 (defmacro providepath [name apath]
-  `(let [comped# (comp-paths* ~apath)
-         expected-params# (num-needed-params ~name)
-         needed-params# (num-needed-params comped#)]
+  `(let [comped# (i/comp-paths* ~apath)
+         expected-params# (i/num-needed-params ~name)
+         needed-params# (i/num-needed-params comped#)]
      (if-not (= needed-params# expected-params#)
-       (throw-illegal "Invalid number of params in provided path, expected "
+       (i/throw-illegal "Invalid number of params in provided path, expected "
            expected-params# " but got " needed-params#))
      (def ~(declared-name name)
        (update-in comped#
                   [:transform-fns]
-                  coerce-tfns-rich)
+                  i/coerce-tfns-rich)
        )))

 (defmacro extend-protocolpath [protpath & extensions]
-  `(extend-protocolpath* ~protpath ~(protpath-sym protpath) ~(vec extensions)))
+  `(i/extend-protocolpath* ~protpath ~(protpath-sym protpath) ~(vec extensions)))


Hold onto REPL connection for dynamic bindings

--- src/clj/reply/evaluation/nrepl.clj
+++ src/clj/reply/evaluation/nrepl.clj
@@ -2,13 +2,13 @@
   (:require [clojure.tools.nrepl.cmdline :as nrepl.cmdline]
             [clojure.tools.nrepl :as nrepl]
             [reply.concurrency]
+            [reply.eval-state]
             [reply.initialization]))

 (def current-command (atom (fn ([]) ([x]))))

-(defn execute-with-connection [port form]
-  (let [connection (nrepl/connect "localhost" port)
-        response-fn ((:send connection) form)]
+(defn execute-with-connection [connection form]
+  (let [response-fn ((:send connection) form)]
     (reset! current-command response-fn)
     (for [{:keys [ns] :as res} (nrepl/response-seq response-fn)]
       (do
@@ -29,14 +29,15 @@
       (loop [ns "user"]
         (prompt ns)
         (flush)
-        (recur (last (execute-with-connection port (pr-str (read)))))))))
+        (recur (last (execute-with-connection connection (pr-str (read)))))))))

 (defn main
   "Ripped directly from nREPL. The only changes are in namespacing, running of
 initial code, and options."
   [options]
   (let [[ssocket _] (nrepl/start-server (Integer/parseInt (or (options "--port") "0")))
-        local-port (.getLocalPort ssocket)]
+        local-port (.getLocalPort ssocket)
+        connection (nrepl/connect "localhost" local-port)]
     (reply.concurrency/set-signal-handler! "INT" (fn [sig] (println "^C") (@current-command :interrupt)))
     (when-let [ack-port (options "--ack")]
       (binding [*out* *err*]
@@ -44,7 +45,7 @@
                    local-port ack-port)
           (:status (#'clojure.tools.nrepl/send-ack local-port (Integer/parseInt ack-port))))))
     (doall (execute-with-connection
-             local-port
+             connection
              (pr-str (reply.initialization/construct-init-code options))))
     (if (options "--interactive")
       (run-repl local-port


run server in own thread

run server in own thread

--- src/clj/shadow/devtools/server.clj
+++ src/clj/shadow/devtools/server.clj
@@ -10,7 +10,7 @@
             [org.httpkit.server :as hk]
             [cljs.compiler :as comp]
             [clojure.edn :as edn]
-            [clojure.core.async :as async :refer (go <! >! <!! >!! alt! timeout)]
+            [clojure.core.async :as async :refer (go <! >! <!! >!! alt! timeout thread alt!!)]
             [shadow.cljs.repl :as repl]
             [clojure.string :as str]
             [cljs.stacktrace :as st]
@@ -367,7 +367,7 @@
     (start state config default-compile-callback))
   ([state config callback]
    (let [repl-input (async/chan)
-         repl-output (async/chan)
+         repl-output (async/chan (async/sliding-buffer 10))

          state (-> {:compiler-state state
                     :clients {}
@@ -382,9 +382,10 @@

          state (assoc state :compiler-state (callback (:compiler-state state) []))
          server-control (get-in state [:server :server-control])
-         server-loop
-         (go (loop [state state]
-               (alt!
+         server-thread
+         (thread
+           (loop [state state]
+               (alt!!
                  server-control
                  ([v]
                    (when-not (nil? v)
@@ -422,7 +423,7 @@
              ;; return value of this channel is its last state
              (update state :server dissoc :instance))]

-     (assoc state :server-loop server-loop))))
+     (assoc state :server-thread server-thread))))

 (def current-instance (atom {}))


Default input yo

Default input yo

--- src/cljs/learn_specter/editor.cljs
+++ src/cljs/learn_specter/editor.cljs
@@ -25,7 +25,7 @@
     (.setValue editor value)))

 (defn editor
-  []
+  [input]
   (reagent/create-class
     {:component-did-mount
      (fn [this]


Add loading message in badge info view

Add loading message in badge info view

--- src/cljs/salava/badge/ui/info.cljs
+++ src/cljs/salava/badge/ui/info.cljs
@@ -45,129 +45,134 @@
 (defn content [state]
   (let [{:keys [id badge_content_id name owner? visibility show_recipient_name show_evidence image_file rating issued_on expires_on revoked issuer_content_name issuer_content_url issuer_contact issuer_image first_name last_name description criteria_url html_content user-logged-in? congratulated? congratulations view_count evidence_url issued_by_obf verified_by_obf obf_url recipient_count assertion]} @state
         expired? (bh/badge-expired? expires_on)]
-    [:div {:id "badge-info"}
-     [m/modal-window]
-     [:div.panel
-      [:div.panel-body
-       (if (and owner? (not expired?) (not revoked))
-         [:div.row {:id "badge-share-inputs"}
-          [:div.col-sm-3
-           [:div.checkbox
-            [:label
-             [:input {:type "checkbox"
-                      :on-change #(toggle-visibility state)
-                      :checked (= visibility "public")}]
-             (t :core/Publishandshare)]]]
-          [:div.col-sm-3
-           [:div.checkbox
-            [:label
-             [:input {:type "checkbox"
-                      :on-change #(toggle-recipient-name state)
-                      :checked show_recipient_name}]
-             (t :badge/Showyourname)]]]
-          (if evidence_url
-            [:div.col-sm-3
-             [:div.checkbox
-              [:label
-               [:input {:type "checkbox"
-                        :on-change #(toggle-evidence state)
-                        :checked show_evidence}]
-               (t :badge/Showevidence)]]])
-          [:div {:class "col-sm-3 text-right"}
-           [:button {:class "btn btn-primary"
-                     :on-click #(.print js/window)}
-            (t :core/Print)]]
-          [:div.col-sm-12
-           [s/share-buttons (str (session/get :site-url) "/badge/info/" id) name (= "public" visibility) true (cursor state [:show-link-or-embed])]]])
-       (if (or verified_by_obf issued_by_obf)
-         (bh/issued-by-obf obf_url verified_by_obf issued_by_obf))
-       [:div.row
-        [:div {:class "col-md-3 badge-image"}
-         [:div.row
-          [:div.col-xs-12
-           [:img {:src (str "/" image_file)}]]]
-         (if owner?
-           [:div.row {:id "badge-rating"}
-            [:div.col-xs-12
-             [:div.rating
-              [r/rate-it rating]]
-             [:div.view-count
-              (cond
-                (= view_count 1) (t :badge/Viewedonce)
-                (> view_count 1) (str (t :badge/Viewed) " " view_count " " (t :badge/times))
-                :else (t :badge/Badgeisnotviewedyet))]]])
-         (if (> recipient_count 1)
-           [:div.row {:id "badge-views"}
-            [:div.col-xs-12
-             [:a {:href (str "/gallery/badgeview/" badge_content_id)} (t :badge/Otherrecipients)]]])
-         [:div.row
-          [:div.col-xs-12 {:id "badge-congratulated"}
-           (if (and user-logged-in? (not owner?))
-             (if congratulated?
-               [:div.congratulated
-                [:i {:class "fa fa-heart"}]
-                (str " " (t :badge/Congratulated))]
-               [:button {:class "btn btn-primary"
-                         :on-click #(congratulate state)}
-                [:i {:class "fa fa-heart"}]
-                (str " " (t :badge/Congratulations) "!")])
-             )]]]
-        [:div {:class "col-md-9 badge-info"}
-         [:div.row
-          [:div {:class "col-md-12"}
-           (if revoked
-             [:div.revoked (t :badge/Revoked)])
-           (if expired?
-             [:div.expired (t :badge/Expiredon) ": " (date-from-unix-time (* 1000 expires_on))])
-           [:h1.uppercase-header name]
-           (if (and issued_on (> issued_on 0))
-             [:div [:label (t :badge/Issuedon)] ": " (date-from-unix-time (* 1000 issued_on))])
-           (if (and expires_on (not expired?))
-             [:div [:label (t :badge/Expireson)] ": " (date-from-unix-time (* 1000 expires_on))])
-           (bh/issuer-label-and-link issuer_content_name issuer_content_url issuer_contact issuer_image)
-           (if assertion
-             [:div {:id "assertion-link"}
-              [:label (t :badge/Metadata)] ": "
-              [:a {:href "#"
-                   :on-click #(do (.preventDefault %)
-                                  (m/modal! [a/assertion-modal assertion] {:size :lg}))}
-               (t :badge/Openassertion) "..."]])
-           (if show_recipient_name
-             [:div [:label (t :badge/Recipient)] ": " first_name " " last_name])
-           [:div.description description]
-           [:h2.uppercase-header (t :badge/Criteria)]
-           [:a {:href criteria_url :target "_blank"} (t :badge/Opencriteriapage) "..."]]]
-         [:div {:class "row criteria-html"}
-          [:div.col-md-12
-           {:dangerouslySetInnerHTML {:__html html_content}}]]
-         (if (and show_evidence evidence_url)
-           [:div.row
-            [:div.col-md-12
-             [:h2.uppercase-header (t :badge/Evidence)]
-             [:div [:a {:target "_blank" :href evidence_url} (t :badge/Openevidencepage) "..."]]]])
-         (if (and owner? (not-empty congratulations))
-           [:div.row
-            [:div.col-md-12 {:id "badge-congratulations"}
-             [:h3.congratulated-header
-              [:i {:class "fa fa-heart"}]
-              " " (t :badge/Congratulatedby) ":"]
-             (into [:div ]
-                   (for [congratulation congratulations
-                         :let [{:keys [id first_name last_name profile_picture]} congratulation]]
-                     (uh/profile-link-inline id first_name last_name profile_picture)))]])]]]]]))
+    (if (:initializing @state)
+      [:div.ajax-message
+       [:i {:class "fa fa-cog fa-spin fa-2x "}]
+       [:span (str (t :core/Loading) "...")]]
+      [:div {:id "badge-info"}
+      [m/modal-window]
+      [:div.panel
+       [:div.panel-body
+        (if (and owner? (not expired?) (not revoked))
+          [:div.row {:id "badge-share-inputs"}
+           [:div.col-sm-3
+            [:div.checkbox
+             [:label
+              [:input {:type      "checkbox"
+                       :on-change #(toggle-visibility state)
+                       :checked   (= visibility "public")}]
+              (t :core/Publishandshare)]]]
+           [:div.col-sm-3
+            [:div.checkbox
+             [:label
+              [:input {:type      "checkbox"
+                       :on-change #(toggle-recipient-name state)
+                       :checked   show_recipient_name}]
+              (t :badge/Showyourname)]]]
+           (if evidence_url
+             [:div.col-sm-3
+              [:div.checkbox
+               [:label
+                [:input {:type      "checkbox"
+                         :on-change #(toggle-evidence state)
+                         :checked   show_evidence}]
+                (t :badge/Showevidence)]]])
+           [:div {:class "col-sm-3 text-right"}
+            [:button {:class    "btn btn-primary"
+                      :on-click #(.print js/window)}
+             (t :core/Print)]]
+           [:div.col-sm-12
+            [s/share-buttons (str (session/get :site-url) "/badge/info/" id) name (= "public" visibility) true (cursor state [:show-link-or-embed])]]])
+        (if (or verified_by_obf issued_by_obf)
+          (bh/issued-by-obf obf_url verified_by_obf issued_by_obf))
+        [:div.row
+         [:div {:class "col-md-3 badge-image"}
+          [:div.row
+           [:div.col-xs-12
+            [:img {:src (str "/" image_file)}]]]
+          (if owner?
+            [:div.row {:id "badge-rating"}
+             [:div.col-xs-12
+              [:div.rating
+               [r/rate-it rating]]
+              [:div.view-count
+               (cond
+                 (= view_count 1) (t :badge/Viewedonce)
+                 (> view_count 1) (str (t :badge/Viewed) " " view_count " " (t :badge/times))
+                 :else (t :badge/Badgeisnotviewedyet))]]])
+          (if (> recipient_count 1)
+            [:div.row {:id "badge-views"}
+             [:div.col-xs-12
+              [:a {:href (str "/gallery/badgeview/" badge_content_id)} (t :badge/Otherrecipients)]]])
+          [:div.row
+           [:div.col-xs-12 {:id "badge-congratulated"}
+            (if (and user-logged-in? (not owner?))
+              (if congratulated?
+                [:div.congratulated
+                 [:i {:class "fa fa-heart"}]
+                 (str " " (t :badge/Congratulated))]
+                [:button {:class    "btn btn-primary"
+                          :on-click #(congratulate state)}
+                 [:i {:class "fa fa-heart"}]
+                 (str " " (t :badge/Congratulations) "!")])
+              )]]]
+         [:div {:class "col-md-9 badge-info"}
+          [:div.row
+           [:div {:class "col-md-12"}
+            (if revoked
+              [:div.revoked (t :badge/Revoked)])
+            (if expired?
+              [:div.expired (t :badge/Expiredon) ": " (date-from-unix-time (* 1000 expires_on))])
+            [:h1.uppercase-header name]
+            (if (and issued_on (> issued_on 0))
+              [:div [:label (t :badge/Issuedon)] ": " (date-from-unix-time (* 1000 issued_on))])
+            (if (and expires_on (not expired?))
+              [:div [:label (t :badge/Expireson)] ": " (date-from-unix-time (* 1000 expires_on))])
+            (bh/issuer-label-and-link issuer_content_name issuer_content_url issuer_contact issuer_image)
+            (if assertion
+              [:div {:id "assertion-link"}
+               [:label (t :badge/Metadata)] ": "
+               [:a {:href     "#"
+                    :on-click #(do (.preventDefault %)
+                                   (m/modal! [a/assertion-modal assertion] {:size :lg}))}
+                (t :badge/Openassertion) "..."]])
+            (if show_recipient_name
+              [:div [:label (t :badge/Recipient)] ": " first_name " " last_name])
+            [:div.description description]
+            [:h2.uppercase-header (t :badge/Criteria)]
+            [:a {:href criteria_url :target "_blank"} (t :badge/Opencriteriapage) "..."]]]
+          [:div {:class "row criteria-html"}
+           [:div.col-md-12
+            {:dangerouslySetInnerHTML {:__html html_content}}]]
+          (if (and show_evidence evidence_url)
+            [:div.row
+             [:div.col-md-12
+              [:h2.uppercase-header (t :badge/Evidence)]
+              [:div [:a {:target "_blank" :href evidence_url} (t :badge/Openevidencepage) "..."]]]])
+          (if (and owner? (not-empty congratulations))
+            [:div.row
+             [:div.col-md-12 {:id "badge-congratulations"}
+              [:h3.congratulated-header
+               [:i {:class "fa fa-heart"}]
+               " " (t :badge/Congratulatedby) ":"]
+              (into [:div]
+                    (for [congratulation congratulations
+                          :let [{:keys [id first_name last_name profile_picture]} congratulation]]
+                      (uh/profile-link-inline id first_name last_name profile_picture)))]])]]]]])))

 (defn init-data [state id]
   (ajax/GET
     (str "/obpv1/badge/info/" id)
     {:handler (fn [data]
                 (reset! state (assoc data :id id
-                                          :show-link-or-embed-code nil))
+                                          :show-link-or-embed-code nil
+                                          :initializing false))
                 (ch/set-meta-tags (:name data) (:description data) (str (session/get :site-url) "/" (:image_file data))))}))

 (defn handler [site-navi params]
   (let [id (:badge-id params)
-        state (atom {})
+        state (atom {:initializing true})
         user (session/get :user)]
     (init-data state id)
     (fn []


Typo in comment.

Typo in comment.

--- src/coming_soon/models/contact.clj
+++ src/coming_soon/models/contact.clj
@@ -131,7 +131,7 @@
   (with-car
     ;; start a transaction
     (car/multi)
-    ;; remove the hashs and counter
+    ;; remove the hashes and counter
     (car/del coming-soon-id)
     (car/del coming-soon-contacts)
     (car/del coming-soon-emails)
@@ -142,4 +142,4 @@
 (defn sane?
   "Is the contact store in a sane state?"
   []
-  (= (with-car (car/hlen coming-soon-contacts)) (with-car (car/hlen coming-soon-emails))))+  (= (with-car (car/hlen coming-soon-contacts)) (with-car (car/hlen coming-soon-emails))))


Fix tests by using url that points to an actual existing image.

--- test/cljc/snippets/image/loading_and_displaying.cljc
+++ test/cljc/snippets/image/loading_and_displaying.cljc
@@ -38,12 +38,12 @@

 #?(:clj
    (defsnippet load-image {}
-     (let [im (q/load-image "https://cloud.github.com/downloads/quil/quil/quil.png")]
+     (let [im (q/load-image "https://github.com/quil/quil/raw/master/dev-resources/quil.png")]
        (q/image im 0 0))))

 #?(:clj
    (defsnippet resize-image {}
-     (let [im (q/load-image "https://cloud.github.com/downloads/quil/quil/quil.png")]
+     (let [im (q/load-image "https://github.com/quil/quil/raw/master/dev-resources/quil.png")]
        (q/image im 0 0)
        (q/resize im 50 50)
        (q/image im 0 0))))
@@ -109,7 +109,7 @@
     (q/image gr 200 0)))

 (defsnippet request-image
-  {:setup (q/set-state! :image (q/request-image "https://cloud.github.com/downloads/quil/quil/quil.png"))}
+  {:setup (q/set-state! :image (q/request-image "https://github.com/quil/quil/raw/master/dev-resources/quil.png"))}
   (if (zero? (.-width (q/state :image)))
     (q/text "Loading" 10 10)
     (q/image (q/state :image) 0 0)))


Use prefixed requestAnimationFrames if available

--- src/reagent/impl/component.cljs
+++ src/reagent/impl/component.cljs
@@ -46,10 +46,18 @@

 ;;; Rendering

-(defn next-tick [f]
-  (if (.-requestAnimationFrame js/window)
-    (js/requestAnimationFrame f)
-    (js/setTimeout f 16)))
+(defn fake-raf [f]
+  (js/setTimeout f 16))
+
+(def next-tick
+  (if-not tmpl/isClient
+    fake-raf
+    (let [w js/window]
+      (or (.-requestAnimationFrame w)
+          (.-webkitRequestAnimationFrame w)
+          (.-mozRequestAnimationFrame w)
+          (.-msRequestAnimationFrame w)
+          fake-raf))))

 (defn compare-levels [c1 c2]
   (- (-> c1 js-props (aget cljs-level))


Refactor choose-tablets and record-seq a bit.

--- src/merkle_db/partition.clj
+++ src/merkle_db/partition.clj
@@ -45,24 +45,19 @@
 (defn- choose-tablets
   "Selects a list of tablet names to query over, given a mapping of tablet
   names to sets of the contained fields and the desired set of field data. If
-  selected-fields is nil, returns all tablets."
-  [tablet-fields selected-fields]
-  (if (empty? selected-fields)
-    (if (nil? selected-fields)
-      ; No selection provided, return all field data.
-      (-> tablet-fields keys set (conj :base))
-      ; Deliberately provided an empty collection; return no data.
-      nil)
+  selected-fields is empty, returns all tablets."
+  [tablet-fields selected]
+  (if (seq selected)
     ; Use field selection to filter tablets to load.
     (-> (dissoc tablet-fields :base)
-        (->> (keep #(when (some selected-fields (val %)) (key %))))
+        (->> (keep #(when (some selected (val %)) (key %))))
         (set)
         (as-> chosen
-          (if (seq (apply set/difference
-                          selected-fields
-                          (map tablet-fields chosen)))
+          (if (seq (apply disj selected (mapcat tablet-fields chosen)))
             (conj chosen :base)
-            chosen)))))
+            chosen)))
+    ; No selection provided, return all field data.
+    (-> tablet-fields keys set (conj :base))))

 (defn- record-seq
@@ -72,14 +67,14 @@
   (lazy-seq
     (when-let [next-key (some->> (seq (keep ffirst field-seqs))
                                  (apply key/min))]
-      (cons [next-key
-             (->> field-seqs
-                  (keep #(when (= next-key (ffirst %))
-                           (second (first %))))
-                  (apply merge))]
-            (record-seq
-              (keep #(if (= next-key (ffirst %)) (next %) (seq %))
-                    field-seqs))))))
+      (let [has-next? #(= next-key (ffirst %))
+            next-data (->> field-seqs
+                           (filter has-next?)
+                           (map (comp second first))
+                           (apply merge))
+            next-seqs (keep #(if (has-next? %) (next %) (seq %))
+                            field-seqs)]
+        (cons [next-key next-data] (record-seq next-seqs))))))

 (defn- tablet-fields


Drop comment.

Drop comment.

--- src/cavm/db.clj
+++ src/cavm/db.clj
@@ -7,5 +7,5 @@
   (write-probemap [this pname files metadata data-fn always]
                   "Write a probemap to storage")
   (run-query [this query] "Execute a metadata sql query")
-  (fetch [this reqs] "Retrieve data") ; data reqs. data card??
+  (fetch [this reqs] "Retrieve data")
   (close [this] "Close the database"))


Re-enable short circuiting.

Re-enable short circuiting.

--- src/onyx_benchmark/peer.clj
+++ src/onyx_benchmark/peer.clj
@@ -94,7 +94,7 @@
                      :onyx.messaging.aeron/poll-idle-strategy :high-restart-latency
                      :onyx.messaging.aeron/embedded-driver? false
                      :onyx.messaging.aeron/subscriber-count 2
-                     :onyx.messaging/allow-short-circuit? false
+                     :onyx.messaging/allow-short-circuit? true
                      :onyx.peer/join-failure-back-off 500
                      :onyx.peer/job-scheduler :onyx.job-scheduler/greedy
                      :onyx.messaging/impl (keyword messaging)}


Multiple checker improvements

Multiple checker improvements

Check pulses in ZK to see if they match the peers that are up in the
replica. Feedback exception in case of killed job. Log final jepsen
output in case of non-serializability by fressian

--- src/onyx_jepsen/checker.clj
+++ src/onyx_jepsen/checker.clj
@@ -24,6 +24,15 @@
          {:job-scheduler (:onyx.peer/job-scheduler peer-config)
           :messaging (select-keys peer-config [:onyx.messaging/impl])}))

+(defn playback-log [peer-config peer-log-reads]
+  (reduce #(onyx.extensions/apply-log-entry %2 %1)
+          (base-replica peer-config)
+          peer-log-reads))
+
+(defn pulses [conn peer-config]
+  (onyx.log.curator/children conn (onyx.log.zookeeper/pulse-path (:onyx/id peer-config))))
+
+;;; TODO, check whether the jobs were even submitted, if not, nothing should be read back
 (defrecord Checker [peer-config n-peers]
   checker/Checker
   (check [checker test model history]
@@ -35,25 +44,30 @@
                                                   (and (= (:f action) :read-peer-log)
                                                        (= (:type action) :ok)))
                                                 history)))
-          final-replica (reduce #(onyx.extensions/apply-log-entry %2 %1)
-                                (base-replica peer-config)
-                                peer-log-reads)
-
+          final-replica (playback-log peer-config peer-log-reads)
+          log-conn (:log (component/start (system/onyx-client peer-config)))
+          exception (if-let [killed-job (first (:killed-jobs final-replica))]
+                      (onyx.extensions/read-chunk log-conn :exception killed-job))
           all-peers-up? (= (count (:peers final-replica))
                            (* 5 n-peers))
+          pulse-peers (pulses (:conn log-conn) peer-config)

+          peers-match-pulses? (= (sort (map str (:peers final-replica)))
+                                 (sort pulse-peers))
           results (map (fn [lr]
                          (map :value (:results lr)))
                        (:value ledger-reads))
-
           successfully-added (filter (fn [action]
                                        (and (= (:f action) :add)
                                             (= (:type action) :ok)))
                                      history)
           added-values (set (map :value successfully-added))
-          read-values (set (reduce into [] results))
+          read-values (reduce into #{} results)
           diff-written-read (clojure.set/difference added-values read-values)
           all-written-read? (empty? diff-written-read)
+
+          accepting-empty? (empty? (:accepted final-replica))
+          prepared-empty? (empty? (:prepared final-replica))

           ;; Check that all values at the output went through the second task first
           all-stage-2 (set (mapcat (fn [lr]
@@ -61,12 +75,19 @@
                                    (:value ledger-reads)))
           all-through-intermediate? (= all-stage-2 #{2})
           unacked-writes-read (clojure.set/difference read-values added-values)]
-      {:valid? (and all-written-read? all-peers-up?)
-       :peer-log peer-log-reads
-       :final-replica final-replica
-       :added added-values
-       :read-values read-values
-       :diff-written-read diff-written-read
-       :unacknowledged-writes-read unacked-writes-read
-       :all-peers-up? all-peers-up?
-       :all-written-read? all-written-read?})))
+      (doto {:valid? (and all-written-read? all-peers-up? accepting-empty? prepared-empty? peers-match-pulses?)
+             :peers-match-pulses? peers-match-pulses?
+             :pulse-peers pulse-peers
+             :peer-log peer-log-reads
+             :accepted-empty? accepting-empty?
+             :prepared-empty? prepared-empty?
+             :final-replica final-replica
+             :added added-values
+             :job-exception-cause (some-> exception (.getCause))
+             :job-exception-trace (some-> exception (.getStackTrace))
+             :read-values read-values
+             :diff-written-read diff-written-read
+             :unacknowledged-writes-read unacked-writes-read
+             :all-peers-up? all-peers-up?
+             :all-written-read? all-written-read?}
+        info))))


Use contains-not-null for optional keys

Use contains-not-null for optional keys

--- src/dxf.clj
+++ src/dxf.clj
@@ -227,15 +227,18 @@
     "40" "0.0"
   ]))

+(defn contains-not-null [m k]
+  (and (contains? m k) (not= nil (k m))))
+
 (defn common [c]
   (let [parent (:parent c c)]
     (str "8" (nextline) (:layer parent)
-        (if (contains? parent :color) (str (nextline) "62" (nextline) (:color parent)) "")
-        (if (contains? parent :extrusion) (str (nextline) (point (:extrusion parent) 200)))
-        (if (contains? parent :lineType) (str (nextline) "6" (nextline) (:lineType parent)))
-        (if (contains? parent :lineWeight) (str (nextline) "370" (nextline) (:lineWeight parent)))
-        (if (contains? parent :lineTypeScale) (str (nextline) "48" (nextline) (:lineTypeScale parent)))
-        (if (contains? parent :thickness) (str (nextline) "39" (nextline) (:thickness parent)))
+        (if (contains-not-null parent :color) (str (nextline) "62" (nextline) (:color parent)) "")
+        (if (contains-not-null parent :extrusion) (str (nextline) (point (:extrusion parent) 200)))
+        (if (contains-not-null parent :lineType) (str (nextline) "6" (nextline) (:lineType parent)))
+        (if (contains-not-null parent :lineWeight) (str (nextline) "370" (nextline) (:lineWeight parent)))
+        (if (contains-not-null parent :lineTypeScale) (str (nextline) "48" (nextline) (:lineTypeScale parent)))
+        (if (contains-not-null parent :thickness) (str (nextline) "39" (nextline) (:thickness parent)))
     )))

 (defmethod generate :face [f]
@@ -269,14 +272,14 @@
       "40" (:height t)
       "1" (:text t)
       ])
-    (if (contains? t :rotation) (str (nextline) "50" (:rotation t)) "")
-    (if (contains? t :xscale) (str (nextline) "41" (:xscale t)) "")
-    (if (contains? t :obliqueAngle) (str (nextline) "51" (:obliqueAngle t)) "")
-    (if (contains? t :style) (str (nextline) "7" (nextline) (upper-case (:name (:style t)))) "")
-    (if (contains? t :flag) (str (nextline) "71" (nextline) (:flag t)) "")
-    (if (contains? t :justifyhor) (str (nextline) "72" (nextline) (:justifyhor t)) "")
-    (if (contains? t :alignment) (str (nextline) (point (:alignment t) 1)) "")
-    (if (contains? t :justifyver) (str (nextline) "73" (nextline) (:justifyver t)) "")
+    (if (contains-not-null t :rotation) (str (nextline) "50" (nextline) (:rotation t)) "")
+    (if (contains-not-null t :xscale) (str (nextline) "41" (nextline) (:xscale t)) "")
+    (if (contains-not-null t :obliqueAngle) (str (nextline) "51" (nextline) (:obliqueAngle t)) "")
+    (if (contains-not-null t :style) (str (nextline) "7" (nextline) (upper-case (:name (:style t)))) "")
+    (if (contains-not-null t :flag) (str (nextline) "71" (nextline) (:flag t)) "")
+    (if (contains-not-null t :justifyhor) (str (nextline) "72" (nextline) (:justifyhor t)) "")
+    (if (contains-not-null t :alignment) (str (nextline) (point (:alignment t) 1)) "")
+    (if (contains-not-null t :justifyver) (str (nextline) "73" (nextline) (:justifyver t)) "")
   ))

 (defmethod generate :solid [s]
@@ -299,7 +302,7 @@
               p]
         ]
     (subs (str
-         (if (contains? r :solid)
+         (if (contains-not-null r :solid)
            (str (nextline)
                (generate
                  (merge
@@ -314,7 +317,7 @@
             ""
         )

-        (if (contains? r :line)
+        (if (contains-not-null r :line)
             (join "" (map #(str (nextline) (generate (merge (Line) {:points [(nth points %) (nth points (+ % 1))] :parent r}))) (range 4)))
         )
       ) 1)
@@ -328,14 +331,14 @@
         (common i)
         (point (:point i))
     ])
-      (if (contains? i :xscale) (str (nextline) "41" (nextline) (:xscale i)) "")
-      (if (contains? i :yscale) (str (nextline) "42" (nextline) (:yscale i)) "")
-      (if (contains? i :zscale) (str (nextline) "43" (nextline) (:zscale i)) "")
-      (if (contains? i :rotation) (str (nextline) "50" (nextline) (:rotation i)) "")
-      (if (contains? i :cols) (str (nextline) "70" (nextline) (:cols i)) "")
-      (if (contains? i :colspacing) (str (nextline) "44" (nextline) (:colspacing i)) "")
-      (if (contains? i :rows) (str (nextline) "71" (nextline) (:rows i)) "")
-      (if (contains? i :rowspacing) (str (nextline) "45" (nextline) (:rowspacing i)) "")
+      (if (contains-not-null i :xscale) (str (nextline) "41" (nextline) (:xscale i)) "")
+      (if (contains-not-null i :yscale) (str (nextline) "42" (nextline) (:yscale i)) "")
+      (if (contains-not-null i :zscale) (str (nextline) "43" (nextline) (:zscale i)) "")
+      (if (contains-not-null i :rotation) (str (nextline) "50" (nextline) (:rotation i)) "")
+      (if (contains-not-null i :cols) (str (nextline) "70" (nextline) (:cols i)) "")
+      (if (contains-not-null i :colspacing) (str (nextline) "44" (nextline) (:colspacing i)) "")
+      (if (contains-not-null i :rows) (str (nextline) "71" (nextline) (:rows i)) "")
+      (if (contains-not-null i :rowspacing) (str (nextline) "45" (nextline) (:rowspacing i)) "")
     )
   )


Keep next-frames and prev-changes together as they're related

--- src/cljs/asciinema_player/core.cljs
+++ src/cljs/asciinema_player/core.cljs
@@ -35,6 +35,15 @@
       (print "finished sending data")
       (close! ch))
     ch))
+
+(defn prev-changes [frames seconds]
+  (loop [frames frames
+        seconds seconds
+        candidate nil]
+    (let [[delay changes :as frame] (first frames)]
+      (if (or (nil? frame) (< seconds delay))
+        candidate
+        (recur (rest frames) (- seconds delay) (merge-with merge candidate changes))))))

 (defn next-frames [frames seconds]
   (if (seq frames)
@@ -85,15 +94,6 @@
       :handler #(dispatch [:frames-response %])
       :error-handler #(dispatch [:bad-response %])})
     (assoc state :loading true)))
-
-(defn prev-changes [frames seconds]
-  (loop [frames frames
-        seconds seconds
-        candidate nil]
-    (let [[delay changes :as frame] (first frames)]
-      (if (or (nil? frame) (< seconds delay))
-        candidate
-        (recur (rest frames) (- seconds delay) (merge-with merge candidate changes))))))

 (defn new-position [current-time total-time offset]
   (/ (util/adjust-to-range (+ current-time offset) 0 total-time) total-time))