Getting there

Getting there

--- src/clj/xn/graph/scale/core.clj
+++ src/clj/xn/graph/scale/core.clj
@@ -8,15 +8,15 @@
 (def distances (into [] (take 10) (iterate #(* 10 %) 1)))
 (def max-step (apply max distances))

-(defmacro inspect [n]
-  `(let [n# ~n]
-     (prn '~n '~'=> n#)
-     n#))
-
-(defmacro inspect [s n]
-  `(let [n# ~n]
-     (prn ~s '~'=> n#)
-     n#))
+(defmacro inspect
+  ([n]
+   `(let [n# ~n]
+      (prn '~n '~'=> n#)
+      n#))
+  ([s n]
+   `(let [n# ~n]
+      (prn ~s '~'=> n#)
+      n#)))

 (defn- within [scale n]
   (when (and n (<= (:min scale) n (:max scale)))
@@ -134,46 +134,60 @@
     (defmethod traversal-step (- dist) [^Vertex point n]
       (*traversal-step point Direction/IN label Direction/OUT))))

+(defn- long-steps [^long n]
+  {:pre [(pos? n)]}
+  (loop [steps [] n n within 10 step -1]
+    (inspect [steps n within step])
+    (cond (zero? n)
+          steps
+          (zero? (mod n within))
+          (recur steps n (* 10 within) (* 10 step))
+          :else
+          (recur (conj steps step) (+ n step) within step))))
+
 (defn remove-oversized-steps [scale current orig-steps]
   (let [scale-end (long (scale-index scale (:max scale)))
         current (long current)]
-    (loop [result (transient [])
+    (loop [result []
            current current
            smaller-step 0
            smaller-steps 0
            [step* & steps :as rem-steps] orig-steps]
       (let [step (if step* (long step*) 0)]
+        (inspect [current scale-end result rem-steps])
+        (when (not= 0 smaller-step) (inspect [smaller-step smaller-steps]))
         (cond
           (not= 0 smaller-step)
-          (cond
-            (neg? step)
-            (let [cancel (* smaller-step smaller-steps)
-                  needed (+ cancel step)]
-              (recur result current 0 0 (cons needed rem-steps)))
-            (or (nil? step*) (not= step (- smaller-step)))
+          (if (or (nil? step*) (not= step (- smaller-step)))
             (if (< scale-end current)
               (recur result (- current smaller-step)
                      smaller-step
                      (dec smaller-steps)
                      (cons smaller-step rem-steps))
               (recur (reduce (fn [result _]
-                               (conj! result smaller-step))
+                               (conj result smaller-step))
                              result
                              (range smaller-steps))
                      current 0 0 rem-steps))
-            :else
             (recur result (+ current step) smaller-step (dec smaller-steps) steps))
-          (nil? step*) (persistent! result)
+          (nil? step*) result
           (or (< scale-end (+ current step))
               (< (+ current step) 0))
-          (recur result (+ current step) (/ step 10) 10 steps)
+          (if (neg? (apply + rem-steps))
+            (let [[backtrack steps] (loop [bt [step] prev step [step & steps :as rem-steps] steps]
+                                      (if (and step (>= prev step))
+                                        (recur (conj bt step) step steps)
+                                        [bt rem-steps]))
+                  back-dist (apply + backtrack)]
+              (recur (inspect (reduce conj result (long-steps (- back-dist)))) (+ current back-dist) 0 0 steps))
+            (recur result (+ current step) (/ step 10) 10 steps))
           :else
-          (recur (conj! result step*) (+ current step) 0 0 steps))))))
+          (recur (conj result step*) (+ current step) 0 0 steps))))))

 (set-test remove-oversized-steps
   (is (= [10 10 10 10 10 10 10 10 10 1 1 1 1 1 1 1 1 1]
          (remove-oversized-steps {:min 0 :max 99 :step 1M} 0 [100 -1])))
-  (is (= [-1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10]
+  (is (= [-1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -10 -10 -10 -10 -10 -10 -10 -10]
          (remove-oversized-steps {:min 0 :max 99 :step 1M} 99 [1 -100]))))


clean up authorization namespace

clean up authorization namespace

--- src/clj_money/authorization.clj
+++ src/clj_money/authorization.clj
@@ -6,7 +6,7 @@
             [clj-money.util :refer [pprint-and-return]])
   (:import clj_money.NotAuthorizedException))

-(defn- resource-key
+(defn- get-resource-tag
   "Returns a keyword identifying the type of the resource"
   [resource]
   (let [result (if (keyword? resource)
@@ -18,12 +18,14 @@

 (defn tag-resource
   "Adds meta data to identity the type of the specified resource"
-  [resource type-key]
-  (vary-meta resource #(assoc % ::resource-type type-key)))
+  [resource tag]
+  (vary-meta resource #(assoc % ::resource-type tag)))

 (def ^:private auth-context (atom {}))

 (defn ->context
+  "Add a key-value pair to the context that will be
+  passed to authorization functions"
   [key value]
   (swap! auth-context #(assoc % key value)))

@@ -40,15 +42,15 @@
                    3 args
                    2 (concat [(current-authentication)] args)
                    :else (throw (ex-info "Wrong number of arguments. Expected 2 or 3." {:args args})))
-        rkey (resource-key resource)
-        auth-fn (@auth-fns [action rkey])]
+        tag (get-resource-tag resource)
+        auth-fn (@auth-fns [action tag])]
     (if auth-fn
       (auth-fn
         user
         resource
         @auth-context)
-      (throw (ex-info (format "No authorization rule registered for %s %s." action rkey)
-                      {:action action :resource resource-key})))))
+      (throw (ex-info (format "No authorization rule registered for %s %s." action tag)
+                      {:action action :resource tag})))))

 (defn authorize
   "Raises an error if the current user does not have


include transaction-ref tuple instead of id

--- src/clj_money/serialization.clj
+++ src/clj_money/serialization.clj
@@ -287,7 +287,7 @@
                (mapcat :items)
                (filter #(and (= account-id (:account-id %))
                              (= amount (:amount %))))
-               (map :id)
+               (map (juxt :id :transaction-date))
                first)
               (throw (Exception. (format "Unable to find a transaction with date=%s, amount=%s"
                                          transaction-date


Cleanup a bit

Cleanup a bit

--- src/cljs/cljs_webrepl/core.cljs
+++ src/cljs/cljs_webrepl/core.cljs
@@ -12,11 +12,13 @@
     :refer-macros (tracef debugf infof warnf errorf)]))

 (defonce state
-  (atom {:repl    (repl/new-repl)
-         :input   "(+ 1 2)"
-         :next    1
-         :cursor  0
-         :history []}))
+  (let [repl (repl/new-repl)]
+    (atom {:repl    repl
+           :ns      (repl/get-ns repl)
+           :input   "(+ 1 2)"
+           :next    1
+           :cursor  0
+           :history []})))

 (defn clipboard [child]
   (let [clipboard-atom (atom nil)]
@@ -31,11 +33,6 @@
          (reset! clipboard-atom nil))
       :reagent-render
       (fn [child] child)})))
-
-(defn clear-input [props]
-  (swap! (:state props) assoc
-         :cursor 0
-         :input ""))

 (defn eval-str [state s]
   (let [repl       (:repl @state)
@@ -57,11 +54,7 @@
                                :ns         ns
                                :expression expression}))))))

-(defn eval-input [props]
-  (let [state (:state props)]
-    (eval-str state (:input @state))))
-
-(defn history-prev* [{:keys [cursor history] :as state}]
+(defn history-prev [{:keys [cursor history] :as state}]
   (let [c          (count history)
         new-cursor (inc cursor)]
     (if (<= new-cursor c)
@@ -70,11 +63,7 @@
              :input (:expression (nth history (- c new-cursor))))
       state)))

-(defn history-prev [props]
-  (let [state (:state props)]
-    (swap! state history-prev*)))
-
-(defn history-next* [{:keys [cursor history] :as state}]
+(defn history-next [{:keys [cursor history] :as state}]
   (let [c          (count history)
         new-cursor (dec cursor)]
     (if (> new-cursor 0)
@@ -83,35 +72,40 @@
              :input (:expression (nth history (- c new-cursor))))
       state)))

-(defn history-next [props]
-  (debugf "History next")
-  (let [state (:state props)]
-    (swap! state history-next*)))
-
-(defn input-key-down [props event]
+(defn clear-input [state]
+  (assoc state
+         :cursor 0
+         :input ""))
+
+(defn eval-input [state]
+  (let [input (trim (:input @state))]
+    (when-not (= "" input)
+      (eval-str state input))))
+
+(defn input-key-down [state event]
   (case (.-which event)
     ;; Enter
-    13 (do (eval-input props)
+    13 (do (eval-input state)
            (. event preventDefault))

     ;; Escape
-    27 (do (clear-input props)
+    27 (do (swap! state clear-input)
            (. event preventDefault))

     ;; Tab
     9  (. event preventDefault)

     ;; Up
-    38 (do (history-prev props)
+    38 (do (swap! state history-prev)
            (. event preventDefault))

     ;;Down
-    40 (do (history-next props)
+    40 (do (swap! state history-next)
            (. event preventDefault))
     nil))

-(defn input-on-change [props event]
-  (swap! (:state props) assoc
+(defn input-on-change [state event]
+  (assoc state
          :cursor 0
          :input (-> event .-target .-value)))

@@ -141,7 +135,7 @@
   [:pre [:code (syntaxify (with-out-str (pprint value)))]])

 (defn history-card
-  [props {:keys [ns output exception num expression result] :as history-item}]
+  [{:keys [state] :as props} {:keys [ns output exception num expression result] :as history-item}]
   [:div.mdl-cell.mdl-cell--12-col
    [:div.mdl-card.mdl-shadow--2dp
     [mdl/upgrade
@@ -151,18 +145,17 @@
       [:ul.mdl-menu.mdl-menu--bottom-right.mdl-js-menu.mdl-js-ripple-effect
        {:for (str "menu-" num)}
        [:li.mdl-menu__item
-        {:on-click #(eval-str (:state props) expression)}
+        {:on-click #(eval-str state expression)}
         "Evaluate Again"]
        [clipboard
         [:li.mdl-menu__item
          {:data-clipboard-text expression}
          "Copy Expression"]]
        (if (and (some? output) (not= "" output))
-         (do (debugf "Have output")
-             [clipboard
-              [:li.mdl-menu__item
-               {:data-clipboard-text output}
-               "Copy Output"]])
+         [clipboard
+          [:li.mdl-menu__item
+           {:data-clipboard-text output}
+           "Copy Output"]]
          [:li.mdl-menu__item
           {:disabled true}
           "Copy Output"])
@@ -210,8 +203,8 @@
           :id           "input"
           :autocomplete "off"
           :value        (:input @state)
-          :on-change    #(input-on-change props %)
-          :on-key-down  #(input-key-down props %)}]
+          :on-change    #(swap! state input-on-change %)
+          :on-key-down  #(input-key-down state %)}]
         [:label.mdl-textfield__label {:for "input"}
          (str (repl/get-ns (:repl @state)) "=>")]]]]]))

@@ -223,7 +216,7 @@
      [mdl/upgrade
       [:button.mdl-button.mdl-js-button.mdl-button--fab.mdl-js-ripple-effect.mdl-button--colored
        (merge (when is-blank? {:disabled true})
-              {:on-click #(eval-input props)})
+              {:on-click #(eval-input state)})
        [:i.material-icons "send"]]]]))

@@ -261,5 +254,3 @@

 (defn init! []
   (mount-root))
-
-(init!)


Add filtering UI into comics-list component

Fixes #11.

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -122,24 +122,26 @@
     (fn []
       (let [site       @site
             comic-list @comic-list
-            cl-filter @comic-list-filter]
-        [:div
-         [:h1 "Comics from " (titlize site
-                                      :to-spaces #"-")]
-         (when cl-filter
-           [:h3 "Filtered by " cl-filter])
+            cl-filter  @comic-list-filter]
+        [:div.row
+         [:div.small-12.large-5.large-push-7.columns
+          [filter-nav-bar site cl-filter]]
          (when (and site comic-list)
-           [:ul.no-bullet
-            (->> comic-list
-                 (filter-comics cl-filter)
-                 (comic-buttons site))])]))))
+           [:div.small-12.large-7.large-pull-5.columns
+            [:h1 "Comics from " (titlize site
+                                         :to-spaces #"-")]
+            [:ul.no-bullet
+             (->> comic-list
+                  (filter-comics cl-filter)
+                  (comic-buttons site))]])]))))

 (defn img-component [site
                      {:keys [comic]}
                      {:keys [chapter page tag]}]
   (let [waypoints (clojure.core/atom nil)]
     (reagent/create-class
-     {:component-did-mount
+     {:display-name "image-component"
+      :component-did-mount
       (fn [this]
         (let [node (reagent/dom-node this)
               go-to-comic #(r/go-to


Improve comment item

Improve comment item

--- src/cljs/hacker_agent/core.cljs
+++ src/cljs/hacker_agent/core.cljs
@@ -32,21 +32,24 @@
   (let [local (atom {:collapse-comments? false})]
     (fn [data]
       (let [{:keys [id by kids parent text type time score deleted]} data]
-        (when (and id (not deleted))
-          [:ul {:on-click #(do
-                             (swap! local update-in [:collapse-comments?] not)
-                             (.stopPropagation %))
-                :style {:cursor "pointer"}}
-           [:li
-            [:p
-             (str by " " time " | ")
-             [:a {:href (str "/#/items/" id)} "link"]
-             [:p {:dangerouslySetInnerHTML {:__html text}}]]]
-           (when kids
-             (if (:collapse-comments? @local)
-               [:p [:b "..."]]
-               (for [[id sub-data] (vec kids)]
-                 ^{:key id} [comment sub-data])))])))))
+        (when-not deleted
+          (if (and data (not id))
+            [:p "Loading..."]
+            [:ul
+             {:on-click #(do
+                           (swap! local update-in [:collapse-comments?] not)
+                           (.stopPropagation %))
+              :style {:cursor "pointer"}}
+             [:li
+              [:p
+               (str by " " time " | ")
+               [:a {:href (str "/#/items/" id)} "link"]
+               [:p {:dangerouslySetInnerHTML {:__html text}}]]]
+             (when kids
+               (if (:collapse-comments? @local)
+                 [:p [:b (count kids) " comments"]]
+                 (for [[id sub-data] (vec kids)]
+                   ^{:key id} [comment sub-data])))]))))))

 (defn story [data]
   (let [local (atom {:collapse? false


Add button to cancel card edition

Add button to cancel card edition

--- src/cljs/memoria/edit_card.cljs
+++ src/cljs/memoria/edit_card.cljs
@@ -28,6 +28,11 @@
                (modal/close-edit-modal))
              params)))

+(defn- cancel-edition [event]
+  (.preventDefault event)
+  (modal/close-edit-modal)
+  (modal/open-modal))
+
 (defn edit-card-modal-component []
   [:div {:key "add-card-modal" :class "container memoria-modal"}
    [:h2 {:class "ui aligned header"} (str "Editing card " @title-atom)]
@@ -48,6 +53,7 @@
               :value @tags-atom
               :on-change (bind-input tags-atom)
               :placeholder "tags are separated by spaces or commas"}]]
+    [:button {:class "ui center aligned button" :on-click cancel-edition} "Cancel"]
     [:button {:class "ui center aligned button blue" :type "submit"} "Submit"]]])

 (defn show-edit-modal [card]


Support pixie files

Support pixie files

--- src/clojure/nightcode/utils.clj
+++ src/clojure/nightcode/utils.clj
@@ -71,7 +71,7 @@

 ; paths and encodings

-(def ^:const clojure-exts #{"boot" "clj" "cljc" "cljs" "cljx" "edn"})
+(def ^:const clojure-exts #{"boot" "clj" "cljc" "cljs" "cljx" "edn" "pxi"})
 (def ^:const wrap-exts #{"md" "txt"})
 (def styles {"as"         SyntaxConstants/SYNTAX_STYLE_ACTIONSCRIPT
              "asm"        SyntaxConstants/SYNTAX_STYLE_ASSEMBLER_X86
@@ -110,6 +110,7 @@
              "php"        SyntaxConstants/SYNTAX_STYLE_PHP
              "pl"         SyntaxConstants/SYNTAX_STYLE_PERL
              "pm"         SyntaxConstants/SYNTAX_STYLE_PERL
+             "pxi"        SyntaxConstants/SYNTAX_STYLE_CLOJURE
              "py"         SyntaxConstants/SYNTAX_STYLE_PYTHON
              "rb"         SyntaxConstants/SYNTAX_STYLE_RUBY
              "s"          SyntaxConstants/SYNTAX_STYLE_ASSEMBLER_X86


Updated comments that didn't follow the style guide conventions

https://github.com/bbatsov/clojure-style-guide

--- src/common/relevance/order.cljs
+++ src/common/relevance/order.cljs
@@ -26,13 +26,13 @@
         is-penalized? (and (not (is-http? url))
                            (not is-priority?))
         tab-time      (cond
-                        ; Add an extra score if it's a priority URL
+                        ;; Add an extra score if it's a priority URL
                         is-priority? (+ sound-extra-score idx)
-                        ; If a URL is penalized, we want it to at least have a
-                        ; value of 1, otherwise the tab time gets ignored and
-                        ; we'd default to using the raw site time
+                        ;; If a URL is penalized, we want it to at least have a
+                        ;; value of 1, otherwise the tab time gets ignored and
+                        ;; we'd default to using the raw site time
                         is-penalized? (max url-time 1)
-                        ; ... otherwise we just go with the raw URL time
+                        ;; ... otherwise we just go with the raw URL time
                         :else url-time)
         site-time     (or (:time (get site-times (host-key (hostname url)))) 0)
         total         (+ tab-time site-time)


more babel.ug references

more babel.ug references

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -6,7 +6,12 @@
    [babel.italiano.lexicon :refer [lexicon]]
    [babel.italiano.morphology :refer [analyze fo]]
    [babel.parse :as parse]
-   [babel.ug :refer [head-principle subcat-1-principle]]
+   [babel.ug :refer [comp-modifies-head head-principle subcat-1-principle subcat-1-1-principle subcat-2-principle
+                     comp-specs-head root-is-head-root
+     subcat-1-1-principle-comp-subcat-1 root-is-comp
+                     subcat-2-2-principle root-is-head
+                     subcat-5-principle
+                     ]]
    #?(:clj [clojure.tools.logging :as log])
    #?(:cljs [babel.logjs :as log])
    [dag_unify.core :refer (fail? get-in merge unifyc)]))


allow small grammar to generate sentences with chiamarsi

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -580,6 +580,7 @@
                        (= (:rule %) "s-imperfect-phrasal")
                        (= (:rule %) "s-imperfect-nonphrasal")
                        (= (:rule %) "s-aux")
+                       (= (:rule %) "vp-32")
                        (= (:rule %) "vp-aux")
                        (= (:rule %) "vp-aux-22")
                        (= (:rule %) "vp-pronoun-nonphrasal")
@@ -599,13 +600,7 @@
                                        (= (get-in % [:synsem :cat]) :verb)

                                        (or (= (get-in % [:synsem :sem :obj] :unspec) :unspec) ;; exclude transitive verbs..
-
-                                           (and
-                                            (= (get-in % [:synsem :sem :reflexive] false) true)  ;; ..but allow reflexive verbs,
-                                            (= '() (get-in % [:synsem :subcat :3] '())) ;; but not reflexive verbs with
-                                            ;; 3 args (e.g. "chiamarsi", because the small grammar can't generate for it.
-                                            ))
-                                       )
+                                           (= (get-in % [:synsem :sem :reflexive] false) true)))  ;; ..but allow reflexive verbs.

                                       (and (= (get-in % [:synsem :propernoun]) true)
                                            (= (get-in % [:synsem :sem :city] false) false)) ;; exclude cities from the small grammar.


fix brackets

fix brackets

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -56,8 +56,8 @@
    "abbandonare" {:synsem {:cat :verb
                            :sem {:pred :abandon}}}

-   "abbassare"  {:synsem {:cat :verb
-                          :sem {:pred :lower}}}
+   "abbassare" {:synsem {:cat :verb
+                         :sem {:pred :lower}}}
    "abbracciare"
     {:synsem {:cat :verb
               :essere false
@@ -353,9 +353,8 @@
                                 :subcat {:1 {:agr agr-of-subj-of-main-verb}
                                          :2 '()}}}}}))])

-   "ballare" [ {:synsem {:cat :verb
-                            :sem {:pred :dance}}}
-
+   "ballare" {:synsem {:cat :verb
+                       :sem {:pred :dance}}}
    "bello"
    [;; non-comparative
     (unify adjective
@@ -1161,15 +1160,12 @@

       "guidare"  {:synsem {:cat :verb
                            :sem {:pred :guidare}}}
-
       "i"
       (unify determiner
              {:synsem {:cat :det
                        :def :def
                        :agr {:gender :masc
                              :number :plur}}})
-
-
       "il"
       (unify determiner
               {:synsem {:cat :det
@@ -1194,7 +1190,7 @@

       "interrompere" {:italiano {:passato "interrotto"}
                       :synsem {:cat :verb
-                               :sem {:pred :interrupt}}}
+                               :sem {:pred :interrupt}}}

 ;; commenting out until discussed with Franco
 ;;      "" ;; empty pronominal subject e.g. "mangio" = "io mangio".
@@ -1263,8 +1259,7 @@
        {:synsem {:cat :det
                  :def :def
                  :agr {:gender :fem
-                       :number :sing}}}
-
+                       :number :sing}}}]
       "la loro"
       {:synsem {:cat :det
                 :def :possessive


cleanup

cleanup

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -1633,9 +1633,8 @@
       (unify common2 intransitive intransitive-unspecified-obj)))

     "partire" {:synsem {:essere true
-                            :cat :verb
-                            :sem {:pred :leave}}}
-
+                        :cat :verb
+                        :sem {:pred :leave}}}
     "pensare"
     {:synsem {:cat :verb
               :essere false


Fix indentation + improve Marginalia formatting

--- src/clj/zetawar/db.cljs
+++ src/clj/zetawar/db.cljs
@@ -1,10 +1,10 @@
 (ns zetawar.db
   (:require
-    [zetawar.util :refer [ssolo]]
-    [datascript.core :as d]))
+   [zetawar.util :refer [ssolo]]
+   [datascript.core :as d]))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Schema
+;;; ## Schema

 ;; TODO: add unit/terrain
 (def schema
@@ -43,7 +43,7 @@
                                   :db/index       true}})

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Util
+;;; ## Utility Functions

 (defn qe
   "Returns the single entity returned by a query."
@@ -55,8 +55,8 @@
   "Returns the unique entity identified by attr and val."
   [db attr val]
   (qe '[:find ?e
-	:in $ ?attr ?val
-	:where  [?e ?attr ?val]]
+        :in $ ?attr ?val
+        :where  [?e ?attr ?val]]
       db attr val))

 (defn qes
@@ -65,14 +65,14 @@
   [query db & args]
   (->> (apply d/q query db args)
        (mapv (fn [items]
-	       (mapv (partial d/entity db) items)))))
+               (mapv (partial d/entity db) items)))))

 (defn find-all-by
   "Returns all entities possessing attr."
   [db attr]
   (qes '[:find ?e
-	 :in $ ?attr
-	 :where [?e ?attr]]
+         :in $ ?attr
+         :where [?e ?attr]]
        db attr))

 (defprotocol Eid


CLJS-296: seq should return nil on empty PersistentQueue

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -3451,8 +3451,7 @@
   (-seq [coll]
     (let [rear (seq rear)]
       (if (or front rear)
-        (PersistentQueueSeq. nil front (seq rear) nil)
-        cljs.core.List/EMPTY)))
+        (PersistentQueueSeq. nil front (seq rear) nil))))

   ICounted
   (-count [coll] count))


workaround until CLJS-40 is resolved (Variadic fns fail to convey this)


Remove extraneous component

Remove extraneous component

--- src/cljs/virt/core.cljs
+++ src/cljs/virt/core.cljs
@@ -78,10 +78,4 @@
           (apply dom/ul #js {:className "virt-list"}
             (om/build-all list-item (find-all-in-vec [:id] list-items (:channels app)))))))))

-(defn virt-app [app owner]
-  (reify
-    om/IRender
-    (render [_]
-      (om/build main app))))
-
-(om/root app-state virt-app (.getElementById js/document "content"))
+(om/root app-state main (.getElementById js/document "content"))


Now make private agail a suported sockets map.

--- src/clojure/nanomsg.clj
+++ src/clojure/nanomsg.clj
@@ -4,11 +4,18 @@
            (nanomsg.reqrep ReqSocket RepSocket)
            (nanomsg.pair PairSocket)
            (nanomsg.bus BusSocket)
+           (nanomsg.pipeline PushSocket PullSocket)
            (nanomsg RWSocket Constants)))

-(def ^:static supported-sockets {:pub PubSocket :sub SubSocket
-                                 :req ReqSocket :rep RepSocket
-                                 :bus BusSocket :pair PairSocket})
+(def ^:static ^:private supported-sockets
+  {:pub PubSocket
+   :sub SubSocket
+   :req ReqSocket
+   :rep RepSocket
+   :bus BusSocket
+   :pair PairSocket
+   :push PushSocket
+   :pull PullSocket})

 (defn bind!
   "Given a socket and connection string,


fix message view not taking args for render fn

--- src/braid/ui/views/message.cljs
+++ src/braid/ui/views/message.cljs
@@ -183,7 +183,8 @@
          (interleave (repeat " "))
          rest)))

-(defn message-view [message opts]
+(defn message-view [message]
+  ; TODO: closing over value!
   (let [sender (subscribe [:user (message :user-id)])]
     (r/create-class
       {:component-did-mount
@@ -194,10 +195,10 @@
          (when-let [PR (aget js/window "PR")]
            ((aget PR "prettyPrint"))))
        :reagent-render
-       (fn []
+       (fn [message]
          (let [sender-path (routes/user-page-path {:group-id (routes/current-group)
                                                    :user-id (@sender :id)})]
-           [:div.message {:class (str " " (when (:collapse? opts) "collapse")
+           [:div.message {:class (str " " (when (:collapse? message) "collapse")
                                       " " (if (:unseen? message) "unseen" "seen")
                                       " " (when (:first-unseen? message) "first-unseen")
                                       " " (when (:failed? message) "failed-to-send"))}


extract native libs from subproject deps too

--- src/cake/tasks/dependencies.clj
+++ src/cake/tasks/dependencies.clj
@@ -91,17 +91,17 @@
          (add-zipfileset {:src jar :includes (format "native/%s/%s/*" (os-name) (os-arch))}))))

 (defn fetch-deps [deps dest]
-  (let [ref-id (str "cake.deps.fileset." (.getName dest))]
-    (fetch-subprojects deps dest)
-    (when-let [deps (seq (remove subproject? deps))]
+  (fetch-subprojects deps dest)
+  (when-let [deps (seq (remove subproject? deps))]
+    (let [ref-id (str "cake.deps.fileset." (.getName dest))]
       (ant DependenciesTask {:fileset-id ref-id :path-id (:name project)}
            (add-repositories (into repositories (:repositories project)))
            (add-dependencies deps))
       (ant Copy {:todir dest :flatten true}
-           (.addFileset (get-reference ref-id)))
-      (extract-native
-       (fileset-seq (get-reference ref-id))
-       (str dest "/native")))))
+           (.addFileset (get-reference ref-id)))))
+  (extract-native
+   (fileset-seq {:dir dest :includes "*.jar"})
+   (str dest "/native")))

 (defn pom [project]
   (let [refid "cake.pom"


fix ns

fix ns

--- src/chat/client/dispatcher.cljs
+++ src/chat/client/dispatcher.cljs
@@ -7,7 +7,7 @@
             [chat.shared.util :as util]
             [chat.client.router :as router]
             [chat.client.xhr :refer [edn-xhr]]
-            [braid.common.notify :as notify]))
+            [braid.desktop.notify :as notify]))

 (defn- extract-tag-ids [text]
   (let [mentioned-names (->> (re-seq util/sigiled-tag-name-re text)


Fixes Brain Chip.

Fixes Brain Chip.

--- src/clj/game/cards-hardware.clj
+++ src/clj/game/cards-hardware.clj
@@ -66,8 +66,8 @@
     :leave-play (effect (lose :max-hand-size 3))}

    "Brain Chip"
-   (let [runner-points (fn [s] (or (get-in s [:runner :agenda-point]) 0))]
-     {:effect (req (gain state :runner :memory (:agenda-point runner) :max-hand-size (:agenda-point runner))
+   (let [runner-points (fn [s] (max (or (get-in s [:runner :agenda-point]) 0) 0))]
+     {:effect (req (gain state :runner :memory (runner-points @state) :max-hand-size (runner-points @state))
                    (add-watch state (keyword (str "brainchip" (:cid card)))
                           (fn [k ref old new]
                             (let [bonus (- (runner-points new) (runner-points old))]


move Keegan Lane into cards-upgrades.clj

--- src/clj/game/cards-upgrades.clj
+++ src/clj/game/cards-upgrades.clj
@@ -97,6 +97,16 @@
    {:events {:successful-run {:req (req this-server) :msg "do 1 net damage"
                               :effect (req (damage state side :net 1 {:card card}))}}}

+   "Keegan Lane"
+   {:abilities [{:label "[Trash], remove a tag: Trash a program"
+                 :req (req (and this-server
+                                (> (get-in @state [:runner :tag]) 0)
+                                (not (empty? (filter #(has? % :type "Program") (all-installed state :runner))))))
+                 :msg (msg "remove 1 tag")
+                 :effect (req (resolve-ability state side trash-program card nil)
+                              (trash state side card {:cause :ability-cost})
+                              (lose state :runner :tag 1))}]}
+
    "Marcus Batty"
    {:abilities [{:msg "start a Psi game"
                  :psi {:not-equal {:req (req this-server)


Fix lancelot description

Fix lancelot description

--- src/cljs/avalon/pages/play.cljs
+++ src/cljs/avalon/pages/play.cljs
@@ -40,7 +40,7 @@
     (twins role) [:h6 "You are one of the twins. You two know yourselves to be good. Do you share your knowledge with the world?"]
     (= role "evil-lancelot1") [:h6 "You know the identity of good Lancelot, but he and Merlin know how evil you really are. How do you use this knowledge to win?"]
     (= role "good-lancelot1") [:h6 "You know the identity of evil Lancelot. How do you use this knowledge to win?"]
-    (#{"evil-lancelot2" "good-lancelot2"} role) [:h6 "Your allegiance may change at the beginning of rounds 3, 4, and 5. Pray that fate leads you to victory."]
+    (#{"evil-lancelot2" "good-lancelot2"} role) [:h6 "Your allegiance may change at the beginning of a round. Pray that fate leads you to victory."]
     :else [:h6 "You have been cast out of Avalon, unwanted by either Merlin or Mordred."]))

 (defn goodbad [total]


Put NS and expression on same line to reduce size

--- src/cljs/cljs_webrepl/core.cljs
+++ src/cljs/cljs_webrepl/core.cljs
@@ -154,8 +154,9 @@
          {:data-clipboard-text result}
          "Copy Result"]]]]]
     [:div.card-data.expression
-     [:code (str num " " ns)]
-     [:code (syntaxify expression)]]
+     [:code
+      (str num " " ns "=> ")
+      (syntaxify expression)]]
     [:hr.border]
     (when (and (some? output) (not= "" output))
       [:div.output


Columns and reset dialog

Columns and reset dialog

--- src/cljs/cljs_webrepl/core.cljs
+++ src/cljs/cljs_webrepl/core.cljs
@@ -18,11 +18,35 @@
 (def default-state
   {:repl    nil
    :ns      nil
+   :columns 1
    :input   ""
    :cursor  0
    :history (sorted-map)})

 (defonce state (atom default-state))
+
+(def max-columns 4)
+
+(defn card-columns-class [columns]
+  (when (< 0 columns (inc max-columns))
+    (let [desktop (js/Math.floor (/ 12 columns))
+          tablet  (js/Math.floor (/ 8 columns))
+          phone   (js/Math.floor (/ 6 columns))]
+      (str "mdl-cell--" desktop "-col "
+           "mdl-cell--" tablet "-col-tablet "
+           "mdl-cell--" phone "-col-phone "))))
+
+(defn more-columns [state]
+  (let [columns (inc (:columns state))]
+    (if (< columns (inc max-columns))
+      (assoc state :columns columns)
+      state)))
+
+(defn less-columns [state]
+  (let [columns (dec (:columns state))]
+    (if (< 0 columns)
+      (assoc state :columns columns)
+      state)))

 (defn pprint-str [data]
   (with-out-str (fipp/pprint data)))
@@ -242,8 +266,9 @@
       [:pre "..."]])])

 (defn history-card
-  [{:keys [state] :as props} num {:keys [ns expression result output] :as history-item}]
-  [:div.mdl-cell.mdl-cell--12-col
+  [{:keys [state columns] :as props} num {:keys [ns expression result output] :as history-item}]
+  [:div
+   {:class (str "mdl-cell " (card-columns-class columns))}
    [:div.mdl-card.mdl-shadow--2dp
     [history-card-menu props num history-item]
     [:div.card-data.expression
@@ -328,16 +353,35 @@
      (when (input-ok? @state)
        [input-card props])]]])

-(defn close-about-dialog []
-  (when-let [dialog (.querySelector js/document "#about-dialog")]
-    (.close dialog)))
+(defn close-dialog [id]
+  (some-> (.querySelector js/document id)
+          (.close)))
+
+(defn show-dialog [id]
+  (when-let [dialog (.querySelector js/document id)]
+    (when-not (.-showModal dialog)
+      (.registerDialog js/dialogPolyfill dialog))
+    (.showModal dialog)))
+
+(defn reset-dialog [state]
+  [:dialog.mdl-dialog {:id "reset-dialog"}
+   [:div.mdl-dialog__content
+    [:p "Reset REPL? All data will be lost."]]
+   [:div.mdl-dialog__actions
+    [:button.mdl-button
+     {:on-click (fn []
+                  (close-dialog "#reset-dialog")
+                  (reset-repl! state))}
+     "Reset"]
+    [:button.mdl-button
+     {:on-click #(close-dialog "#reset-dialog")}
+     "Cancel"]]])

 (defn about-dialog []
-  [:dialog.mdl-dialog {:id "about-dialog"}
+  [:dialog.mdl-dialog.mdl-dialog__wide {:id "about-dialog"}
    [:h4.mdl-dialog__title "CLJS-WebREPL"]
    [:div.mdl-dialog__content
-    [:p
-     (str "A ClojureScript browser based REPL")]
+    [:p "A ClojureScript browser based REPL"]
     [:p (str "Using ClojureScript version " *clojurescript-version*)]
     [:h5 "License"]
     [:p
@@ -346,47 +390,56 @@
      "Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version."]]
    [:div.mdl-dialog__actions
     [:button.mdl-button
-     {:on-click close-about-dialog}
+     {:on-click #(close-dialog "#about-dialog")}
      "Ok"]]])

-(defn show-about-dialog []
-  (when-let [dialog (.querySelector js/document "#about-dialog")]
-    (when-not (.-showModal dialog)
-      (.registerDialog js/dialogPolyfill dialog))
-    (.showModal dialog)))
+
+(defn home-page-header [{:keys [columns state] :as props}]
+  [:header.mdl-layout__header
+   [:div.mdl-layout__header-row
+    [:span.mdl-layout-title
+     [:img.svg-size {:src "images/cljs-white.svg"}]
+     " CLJS-WebREPL"]
+    [:div.mdl-layout-spacer]
+    [:button.mdl-button.mdl-js-button.mdl-js-ripple-effect
+     {:on-click #(show-dialog "#reset-dialog")
+      :style    {:color "#fff"}}
+     [:i.material-icons "report"]
+     [:span "RESET"]]
+    [:button.mdl-button.mdl-js-button.mdl-js-ripple-effect
+     {:on-click #(swap! state more-columns)
+      :style    {:color "#fff"}}
+     [:i.material-icons "view_column"]]
+    [:button.mdl-button.mdl-js-button.mdl-js-ripple-effect
+     {:on-click #(swap! state less-columns)
+      :style    {:color "#fff"}}
+     [:i.material-icons "view_stream"]]
+    [:button.mdl-button.mdl-js-button.mdl-button--icon.mdl-js-ripple-effect {:id "main-menu"}
+     [:i.material-icons "more_vert"]]
+    [:ul.mdl-menu.mdl-menu--bottom-right.mdl-js-menu.mdl-js-ripple-effect
+     {:for "main-menu"}
+     [:li.mdl-menu__item
+      {:on-click #(show-dialog "#reset-dialog")}
+      "Reset REPL"]
+     [:li.mdl-menu__item
+      {:on-click #(set! (.-location js/window) "https://github.com/theasp/cljs-webrepl")}
+      "GitHub"]
+     [:li.mdl-menu__item
+      {:on-click #(show-dialog "#about-dialog")}
+      "About"]]]])

 (defn home-page []
-  (let [props {:state state
-               :title "Cljs-WebREPL"}]
+  (let [columns (:columns @state)
+        props   {:state   state
+                 :columns columns
+                 :title   "Cljs-WebREPL"}]
     [:div
      [about-dialog]
+     [reset-dialog state]
      [:div.tall
       [mdl/upgrade
        [:div.flex-v.tall.mdl-layout.mdl-js-layout.mdl-layout--fixed-header.mdl-layout--no-drawer-button
-        [:header.mdl-layout__header
-         [:div.mdl-layout__header-row
-          [:span.mdl-layout-title
-           [:img.svg-size {:src "images/cljs-white.svg"}]
-           " CLJS-WebREPL"]
-          [:div.mdl-layout-spacer]
-          [:button.mdl-button.mdl-js-button.mdl-js-ripple-effect
-           {:on-click #(reset-repl! state)
-            :style    {:color "#fff"}}
-           [:i.material-icons "report"]
-           [:span "RESET"]]
-          [:button.mdl-button.mdl-js-button.mdl-button--icon.mdl-js-ripple-effect {:id "main-menu"}
-           [:i.material-icons "more_vert"]]
-          [:ul.mdl-menu.mdl-menu--bottom-right.mdl-js-menu.mdl-js-ripple-effect
-           {:for "main-menu"}
-           [:li.mdl-menu__item
-            {:on-click #(reset-repl! state)}
-            "Reset REPL"]
-           [:li.mdl-menu__item
-            {:on-click #(set! (.-location js/window) "https://github.com/theasp/cljs-webrepl")}
-            "GitHub"]
-           [:li.mdl-menu__item
-            {:on-click show-about-dialog}
-            "About"]]]]
+        [home-page-header props]
         (if (:ns @state)
           [history props]
           [please-wait props])]]]]))


Clear out 'About' page.

Clear out 'About' page.

--- src/cljs/leipzig_live/core.cljs
+++ src/cljs/leipzig_live/core.cljs
@@ -8,12 +8,7 @@
 ;; Views

 (defn home-page []
-  [:div [:h2 "Welcome to leipzig-live"]
-   [:div [:a {:href "/about"} "go to about page"]]])
-
-(defn about-page []
-  [:div [:h2 "About leipzig-live"]
-   [:div [:a {:href "/"} "go to the home page"]]])
+  [:div [:h1 "Welcome to Leipzig Live!"]])

 (defn current-page []
   [:div [(session/get :current-page)]])
@@ -23,9 +18,6 @@

 (secretary/defroute "/" []
   (session/put! :current-page #'home-page))
-
-(secretary/defroute "/about" []
-  (session/put! :current-page #'about-page))

 ;; -------------------------
 ;; Initialize app


update entity code to function in CLJ; primary change is that both CLJ and CLJS use `volatile!`s instead of deftype `:mutable`-ish things to manage `touched` and `cache` fields. other changes accommodate common code tactics, with varying degrees of grace.

--- src/datascript/impl/entity.cljc
+++ src/datascript/impl/entity.cljc
@@ -1,8 +1,9 @@
 (ns datascript.impl.entity
-  (:require
-    [datascript.core :as dc]))
-
-(declare Entity touch)
+  (:refer-clojure :exclude [keys get])
+  (:require [#?(:cljs cljs.core :clj clojure.core) :as c]
+            [datascript.core :as dc]))
+
+(declare entity ->Entity equiv-entity lookup-entity touch)

 (defn- entid [db eid]
   (when (or (number? eid)
@@ -14,7 +15,7 @@
          (satisfies? dc/ISearch db)
          (satisfies? dc/IIndexAccess db)]}
   (when-let [e (entid db eid)]
-    (Entity. db e false {})))
+    (->Entity db e (volatile! false) (volatile! {}))))

 (defn- entity-attr [db a datoms]
   (if (dc/multival? db a)
@@ -25,11 +26,147 @@
       (entity db (.-v (first datoms)))
       (.-v (first datoms)))))

-(defn- datoms->cache [db datoms]
-  (reduce (fn [acc part]
-    (let [a (.-a (first part))]
-      (assoc acc a (entity-attr db a part))))
-    {} (partition-by :a datoms)))
+(defn- -lookup-backwards [db eid attr not-found]
+  (if-let [datoms (not-empty (dc/-search db [nil attr eid]))]
+    (if (dc/component? db attr)
+      (entity db (.-e (first datoms)))
+      (reduce #(conj %1 (entity db (.-e %2))) #{} datoms))
+    not-found))
+
+#?(:cljs
+   (defn- multival->js [val]
+     (when val (to-array val))))
+
+#?(:cljs
+   (defn- js-seq [e]
+     (touch e)
+     (for [[a v] @(.-cache e)]
+       (if (dc/multival? (.-db e) a)
+         [a (multival->js v)]
+         [a v]))))
+
+(deftype Entity [db eid touched cache]
+  #?@(:cljs
+      [Object
+       (toString [this]
+                 (pr-str* this))
+       (equiv [this other]
+              (equiv-entity this other))
+
+       ;; js/map interface
+       (keys [this]
+             (es6-iterator (c/keys this)))
+       (entries [this]
+                (es6-entries-iterator (js-seq this)))
+       (values [this]
+               (es6-iterator (map second (js-seq this))))
+       (has [this attr]
+            (not (nil? (.get this attr))))
+       (get [this attr]
+            (if (= attr ":db/id")
+              eid
+              (if (dc/reverse-ref? attr)
+                (-> (-lookup-backwards db eid (dc/reverse-ref attr) nil)
+                    multival->js)
+                (cond-> (-lookup this attr)
+                  (dc/multival? db attr) multival->js))))
+       (forEach [this f]
+                (doseq [[a v] (js-seq this)]
+                  (f v a this)))
+       (forEach [this f use-as-this]
+                (doseq [[a v] (js-seq this)]
+                  (.call f use-as-this v a this)))
+
+       ;; js fallbacks
+       (key_set   [this] (to-array (c/keys this)))
+       (entry_set [this] (to-array (map to-array (js-seq this))))
+       (value_set [this] (to-array (map second (js-seq this))))
+
+       IEquiv
+       (-equiv [this o] (equiv-entity this o))
+
+       IHash
+       (-hash [_]
+              (hash eid)) ;; db?
+
+       ISeqable
+       (-seq [this]
+             (touch this)
+             (seq @cache))
+
+       ICounted
+       (-count [this]
+               (touch this)
+               (count @cache))
+
+       ILookup
+       (-lookup [this attr]           (lookup-entity this attr nil))
+       (-lookup [this attr not-found] (lookup-entity this attr not-found))
+
+       IAssociative
+       (-contains-key? [this k]
+                       (not= ::nf (-lookup this k ::nf)))
+
+       IFn
+       (-invoke [this k]
+                (-lookup this k))
+       (-invoke [this k not-found]
+                (-lookup this k not-found))
+
+       IPrintWithWriter
+       (-pr-writer [_ writer opts]
+                   (-pr-writer (assoc @cache :db/id eid) writer opts))]
+
+      :clj
+      [Object
+       (toString [e]      (pr-str (assoc @cache :db/id eid)))
+       (hashCode [e]      (hash eid)) ; db?
+
+       clojure.lang.Seqable
+       (seq [e]           (touch e) (seq @cache))
+
+       clojure.lang.Associative
+       (equiv [e o]       (equiv-entity e o))
+       (containsKey [e k] (lookup-entity e k))
+       (entryAt [e k]     (some->> (lookup-entity e k) (clojure.lang.MapEntry. k)))
+
+       (empty [e]         (entity (.-db e) (.-eid e)))
+       (assoc [e k v]     (throw (UnsupportedOperationException.)))
+       (cons  [e [k v]]   (throw (UnsupportedOperationException.)))
+       (count [e]         (touch e) (count @(.-cache e)))
+
+       clojure.lang.ILookup
+       (valAt [e k]       (lookup-entity e k))
+       (valAt [e k not-found] (lookup-entity e k not-found))
+       ]))
+
+(defn entity? [x] (instance? Entity x))
+
+#?(:clj
+   (defmethod print-method Entity [e, ^java.io.Writer w]
+     (.write w (str e))))
+
+(defn- equiv-entity [^Entity this that]
+  (and
+   (instance? Entity that)
+   ;; (= db  (.-db ^Entity that))
+   (= (.-eid this) (.-eid ^Entity that))))
+
+(defn- lookup-entity
+  ([this attr] (lookup-entity this attr nil))
+  ([^Entity this attr not-found]
+   (if (= attr :db/id)
+     (.-eid this)
+     (if (dc/reverse-ref? attr)
+       (-lookup-backwards (.-db this) (.-eid this) (dc/reverse-ref attr) not-found)
+       (or (@(.-cache this) attr)
+           (if @(.-touched this)
+             not-found
+             (if-let [datoms (not-empty (dc/-search (.-db this) [(.-eid this) attr]))]
+               (let [value (entity-attr (.-db this) attr datoms)]
+                 (vreset! (.-cache this) (assoc @(.-cache this) attr value))
+                 value)
+               not-found)))))))

 (defn touch-components [db a->v]
   (reduce-kv (fn [acc a v]
@@ -41,130 +178,32 @@
                    v)))
              {} a->v))

+(defn- datoms->cache [db datoms]
+  (reduce (fn [acc part]
+    (let [a (:a (first part))]
+      (assoc acc a (entity-attr db a part))))
+    {} (partition-by :a datoms)))
+
 (defn touch [e]
-  (when-not (.-touched e)
+  (when-not @(.-touched e)
     (when-let [datoms (not-empty (dc/-search (.-db e) [(.-eid e)]))]
-      (set! (.-touched e) true)
-      (set! (.-cache e) (->> datoms
-                          (datoms->cache (.-db e))
-                          (touch-components (.-db e))))))
+      (vreset! (.-cache e) (->> datoms
+                                (datoms->cache (.-db e))
+                                (touch-components (.-db e))))
+      (vreset! (.-touched e) true)))
   e)

-(defn- -lookup-backwards [db eid attr not-found]
-  (if-let [datoms (not-empty (dc/-search db [nil attr eid]))]
-    (if (dc/component? db attr)
-      (entity db (.-e (first datoms)))
-      (reduce #(conj %1 (entity db (.-e %2))) #{} datoms)-)
-    not-found))
-
-(defn- multival->js [val]
-  (when val (to-array val)))
-
-(defn- js-seq [e]
-  (touch e)
-  (for [[a v] (.-cache e)]
-    (if (dc/multival? (.-db e) a)
-      [a (multival->js v)]
-      [a v])))
-
-(deftype Entity [db eid ^:mutable touched ^:mutable cache]
-  Object
-  (toString [this]
-    (pr-str* this))
-  (equiv [this other]
-    (-equiv this other))
-
-  ;; js/map interface
-  (keys [this]
-    (es6-iterator (keys this)))
-  (entries [this]
-    (es6-entries-iterator (js-seq this)))
-  (values [this]
-    (es6-iterator (map second (js-seq this))))
-  (has [this attr]
-    (not (nil? (.get this attr))))
-  (get [this attr]
-    (if (= attr ":db/id")
-      eid
-      (if (dc/reverse-ref? attr)
-        (-> (-lookup-backwards db eid (dc/reverse-ref attr) nil)
-            multival->js)
-        (cond-> (-lookup this attr)
-          (dc/multival? db attr) multival->js))))
-  (forEach [this f]
-    (doseq [[a v] (js-seq this)]
-      (f v a this)))
-  (forEach [this f use-as-this]
-    (doseq [[a v] (js-seq this)]
-      (.call f use-as-this v a this)))
-
-  ;; js fallbacks
-  (key_set   [this] (to-array (keys this)))
-  (entry_set [this] (to-array (map to-array (js-seq this))))
-  (value_set [this] (to-array (map second (js-seq this))))
-
-  IEquiv
-  (-equiv [_ o]
-    (and
-      (instance? Entity o)
-      ;; (= db  (.-db o))
-      (= eid (.-eid o))))
-
-  IHash
-  (-hash [_]
-    (hash eid)) ;; db?
-
-  ISeqable
-  (-seq [this]
-    (touch this)
-    (seq cache))
-
-  ICounted
-  (-count [this]
-    (touch this)
-    (count cache))
-
-  ILookup
-  (-lookup [this attr]
-    (-lookup this attr nil))
-  (-lookup [_ attr not-found]
-    (if (= attr :db/id)
-      eid
-      (if (dc/reverse-ref? attr)
-        (-lookup-backwards db eid (dc/reverse-ref attr) not-found)
-        (or (cache attr)
-            (if touched
-              not-found
-              (if-let [datoms (not-empty (dc/-search db [eid attr]))]
-                (do
-                  (set! cache (assoc cache attr (entity-attr db attr datoms)))
-                  (cache attr))
-                not-found))))))
-
-  IAssociative
-  (-contains-key? [this k]
-    (not= ::nf (-lookup this k ::nf)))
-
-  IFn
-  (-invoke [this k]
-    (-lookup this k))
-  (-invoke [this k not-found]
-    (-lookup this k not-found))
-
-  IPrintWithWriter
-  (-pr-writer [_ writer opts]
-    (-pr-writer (assoc cache :db/id eid) writer opts)))
-
-
-(goog/exportSymbol "datascript.impl.entity.Entity.prototype.get"       (.-get       (.-prototype Entity)))
-(goog/exportSymbol "datascript.impl.entity.Entity.prototype.has"       (.-has       (.-prototype Entity)))
-(goog/exportSymbol "datascript.impl.entity.Entity.prototype.forEach"   (.-forEach   (.-prototype Entity)))
-(goog/exportSymbol "datascript.impl.entity.Entity.prototype.key_set"   (.-key_set   (.-prototype Entity)))
-(goog/exportSymbol "datascript.impl.entity.Entity.prototype.value_set" (.-value_set (.-prototype Entity)))
-(goog/exportSymbol "datascript.impl.entity.Entity.prototype.entry_set" (.-entry_set (.-prototype Entity)))
-(goog/exportSymbol "datascript.impl.entity.Entity.prototype.keys"      (.-keys      (.-prototype Entity)))
-(goog/exportSymbol "datascript.impl.entity.Entity.prototype.values"    (.-values    (.-prototype Entity)))
-(goog/exportSymbol "datascript.impl.entity.Entity.prototype.entries"   (.-entries   (.-prototype Entity)))
-
-(goog/exportSymbol "cljs.core.ES6Iterator.prototype.next"        (.-next (.-prototype cljs.core/ES6Iterator)))
-(goog/exportSymbol "cljs.core.ES6EntriesIterator.prototype.next" (.-next (.-prototype cljs.core/ES6EntriesIterator)))
+#?(:cljs (do
+           (goog/exportSymbol "datascript.impl.entity.Entity.prototype.get"       (.-get       (.-prototype Entity)))
+           (goog/exportSymbol "datascript.impl.entity.Entity.prototype.has"       (.-has       (.-prototype Entity)))
+           (goog/exportSymbol "datascript.impl.entity.Entity.prototype.forEach"   (.-forEach   (.-prototype Entity)))
+           (goog/exportSymbol "datascript.impl.entity.Entity.prototype.key_set"   (.-key_set   (.-prototype Entity)))
+           (goog/exportSymbol "datascript.impl.entity.Entity.prototype.value_set" (.-value_set (.-prototype Entity)))
+           (goog/exportSymbol "datascript.impl.entity.Entity.prototype.entry_set" (.-entry_set (.-prototype Entity)))
+           (goog/exportSymbol "datascript.impl.entity.Entity.prototype.keys"      (.-keys      (.-prototype Entity)))
+           (goog/exportSymbol "datascript.impl.entity.Entity.prototype.values"    (.-values    (.-prototype Entity)))
+           (goog/exportSymbol "datascript.impl.entity.Entity.prototype.entries"   (.-entries   (.-prototype Entity)))
+
+           (goog/exportSymbol "cljs.core.ES6Iterator.prototype.next"        (.-next (.-prototype cljs.core/ES6Iterator)))
+           (goog/exportSymbol "cljs.core.ES6EntriesIterator.prototype.next" (.-next (.-prototype cljs.core/ES6EntriesIterator)))
+           ))


:onyx.peer/retry-start-interval is deprecated.

--- src/onyx/information_model.cljc
+++ src/onyx/information_model.cljc
@@ -1344,6 +1344,7 @@
              :unit :milliseconds
              :default 2000
              :optional? true
+             :deprecated-version "0.10.0"
              :added "0.8.0"}

             :onyx.peer/join-failure-back-off


Fixes graceful stopping.

Fixes graceful stopping.

--- src/onyx/peer/task_pipeline.clj
+++ src/onyx/peer/task_pipeline.clj
@@ -333,7 +333,7 @@
         :read-batch-loop (thread (read-batch-loop read-batch-ch decompress-batch-ch read-batch-dead-ch))
         :decompress-batch-loop (thread (decompress-batch-loop decompress-batch-ch strip-sentinel-ch decompress-batch-dead-ch))
         :strip-sentinel-loop (thread (strip-sentinel-loop strip-sentinel-ch requeue-sentinel-ch strip-sentinel-dead-ch))
-        :requeue-sentinel-ch (thread (requeue-sentinel-loop requeue-sentinel-ch apply-fn-ch requeue-sentinel-dead-ch))
+        :requeue-sentinel-loop (thread (requeue-sentinel-loop requeue-sentinel-ch apply-fn-ch requeue-sentinel-dead-ch))
         :apply-fn-loop (thread (apply-fn-loop apply-fn-ch compress-batch-ch apply-fn-dead-ch))
         :compress-batch-loop (thread (compress-batch-loop compress-batch-ch write-batch-ch compress-batch-dead-ch))
         :write-batch-loop (thread (write-batch-loop write-batch-ch status-check-ch write-batch-dead-ch))


Test.

Test.

--- src/forces_assemble/handler.clj
+++ src/forces_assemble/handler.clj
@@ -101,6 +101,8 @@

 (defn send-push-notification
   [client event]
+  (println (str "Pushing: " client))
+  (println (str "Message: " (pr-str event)))
   (http/post firebase-send-uri
              {:content-type :json
               :headers {"Authorization" (str "key=" (or (env :firebase-api-key) ""))}


+{:pred :correspond}

+{:pred :correspond}

--- src/babel/encyclopedia.cljc
+++ src/babel/encyclopedia.cljc
@@ -285,6 +285,10 @@
         {:pred :comprare
          :subj {:human true}
          :obj {:buyable true}}
+
+        {:pred :correspond
+         :subj {:human true}
+         :obj {:human true}}

         {:pred :deludere
          :obj {:human true}}


Fixed issue #2

Fixed issue #2

--- src/branch_handler/core.clj
+++ src/branch_handler/core.clj
@@ -201,7 +201,7 @@
         repository-name  (-> gitlab-info :repository :name)
         repository-group (-> gitlab-info :project :namespace)
         branch           (get-branch (:ref gitlab-info))
-        before           (-> gitlab-info :before)
+        before           (:before gitlab-info)
         after            (-> gitlab-info :after)
         operation        (get-operation before after)]
     (if verbose


Optimized checksum function

Optimized checksum function

--- src/ais/util.clj
+++ src/ais/util.clj
@@ -14,10 +14,11 @@
     (timestamp->iso ts (f/formatter "yyyyMMddHHmmss"))))

 (defn checksum [msg]
-  (let [sum (Integer/toString (reduce bit-xor 0 (map int (seq msg))) 16)]
-    (if (== (count sum) 1)
-      (string/upper-case (str "0" sum))
-      (string/upper-case sum))))
+  (loop [mseq (seq msg)
+         sum 0]
+    (if-let [c (first mseq)]
+      (recur (rest mseq) (bit-xor sum (int c)))
+      (format "%02X" sum))))

 (defn pad [payload n-bits]
   (str payload (apply str (repeat n-bits "0"))))
@@ -25,15 +26,11 @@
 (defn bitmask [len]
   (Integer/parseInt (apply str (repeat len "1")) 2))

-(defn twos-comp [bit-str]
-  (->> (bit-not (Integer/parseInt bit-str 2))
-       (bit-and (bitmask (count bit-str)))
+(defn twos-comp [bits]
+  (->> (bit-not (Integer/parseInt bits 2))
+       (bit-and (bitmask (count bits)))
        (+ 1)
        (* -1)))
-
-(defn char->decimal [c]
- (let [tmp (- (int c) 48)]
-    (if (> tmp 40) (- tmp 8) tmp)))

 (defn payload->binary [payload]
   "Convert ais sentence payload to binary string"


another WIP for get-changes and associated helpers

--- src/lcmap/clownfish/changes.clj
+++ src/lcmap/clownfish/changes.clj
@@ -63,13 +63,34 @@
   [{:keys [algorithm]}]
   true)

-(defn x-y-in-scope?
+(defn source-data-available?
   [{:keys [x y]}]
   true)

 (defn change-results-exist?
   [{:keys [x y algorithm]}]
   true)
+
+(defn query-data
+  [{:keys [x y algorithm]}]
+  {:algorithm algorithm
+   :start  12343
+   :end    45673
+   :days   [443 441 322]
+   :reds   [1 2 3]
+   :blues  [1 2 3]
+   :greens [1 2 3]
+   :nirs   [1 2 3]
+   :swir1s [1 2 3]
+   :swir2s [1 2 3]
+   :whatever ["the" "results" "are"]})
+
+(defn run-tile
+  [{:keys [x y algorithm] :as data}]
+  (let [existing-ticket (snap-x-y-and-check-iwds data)]
+    (if (some? existing-ticket)
+      existing-ticket
+      (enter-new-ticket-and-return))))

 ;;; request handlers
 (defn get-changes
@@ -80,9 +101,7 @@
      :or {r false}} :params}]
   (let [data   {:x x :y y :algorithm a :refresh (boolean r)}
         alg?   (future (algorithm-available? data))
-        valid? {:x-y-in-scope (x-y-in-scope? data)
-                :algorithm-available @alg?}])
-
+        valid? {:algorithm-available @alg?}])
   (if (not-every? true? (vals valid?))
     {:status 202 :body (merge data valid?)}
     (let [src?      (future (source-data-available? data))
@@ -95,10 +114,10 @@
           body      (merge data valid? results? source? {:doquery doquery?
                                                          :runtile runtile?})]
       (cond
-        doquery? {:status 202
-                  :body (merge body {:changes (run-the-query-and-return)})}
+        doquery? {:status 202
+                  :body (merge body {:changes (query-data data)})}
         runtile? {:status 202
-                  :body (merge body {:ticket (run-the-tile-and-return)})}
+                  :body (merge body {:ticket (run-tile data)})}
         :else    {:status 202
                   :body body}))))


fixed safe-exec and moved it to pardo level

--- src/datasplash/core.clj
+++ src/datasplash/core.clj
@@ -50,7 +50,8 @@
            (if missing#
              (do
                (require missing#)
-               (swap! required-ns conj missing#))
+               (swap! required-ns conj missing#)
+               ~@body)
              (throw (ex-info (format "Dynamic reloading of namespace %s seems not to work" (name missing#))
                              {:last-namespace missing#}
                              e#))))
@@ -62,15 +63,15 @@
                    finish-bundle (fn [_] nil)}
               :as opts}]
   (proxy [DoFn] []
-    (processElement [^DoFn$ProcessContext context] (f context))
-    (startBundle [^DoFn$Context context] (start-bundle context))
-    (finishBundle [^DoFn$Context context] (finish-bundle context))))
+    (processElement [^DoFn$ProcessContext context] (safe-exec (f context)))
+    (startBundle [^DoFn$Context context] (safe-exec (start-bundle context)))
+    (finishBundle [^DoFn$Context context] (safe-exec (finish-bundle context)))))

 (defn map-fn
   [f]
   (fn [^DoFn$ProcessContext c]
     (let [elt (.element c)
-          result (safe-exec (f elt))]
+          result (f elt)]
       (.output c result))))

 (defn mapcat-fn


Renamed channels to be clearer.

Renamed channels to be clearer.

--- src-cljs/client/websocket_handler.cljs
+++ src-cljs/client/websocket_handler.cljs
@@ -8,7 +8,7 @@

 ;; Address to host
 (def address "ws://localhost:5000")
-(def address "ws://tree-mind-tone.herokuapp.com")
+;(def address "ws://tree-mind-tone.herokuapp.com")

 (defn open-connection
   "Establishes a loop that maintains a connection to a server.
@@ -19,8 +19,8 @@
   The second is a meta channel that receives a messages each
   time the channel is either disconnected or connected."
   []
-  (let [read-channel  (chan)
-        write-channel (chan)
+  (let [write-to-client  (chan)
+        read-from-client (chan)
         meta-channel  (chan (sliding-buffer 1))]
     (go
       (>! meta-channel (h/attempting-connect-message address))
@@ -40,7 +40,7 @@
               ;; Let loop die if ws-channel dies
               (go-loop
                 []
-                (when-let [message (<! write-channel)]
+                (when-let [message (<! read-from-client)]
                   (when (not (h/has-type message (:type h/socket-closed-message)))
                     (do
                       (>! formated-channel message)
@@ -53,12 +53,12 @@
               (loop []
                 (when-let [message (<! formated-channel)]
                   (do
-                    (>! read-channel message)
+                    (>! write-to-client message)
                     (recur))))

               ;; Send termination message to write loop and notify on meta channel
-              (>! write-channel h/socket-closed-message)
+              (>! read-from-client h/socket-closed-message)
               (>! meta-channel  (h/attempting-connect-message address)))))
         (recur)))
-    [(h/combine-channels read-channel write-channel)
+    [(h/combine-channels write-to-client read-from-client)
      meta-channel]))


Remove session counter example for now.

Remove session counter example for now.

--- src/demo/web.clj
+++ src/demo/web.clj
@@ -1,8 +1,6 @@
 (ns demo.web
   (:require [clojure.pprint           :refer [pprint]]
             [immutant.web             :as web]
-            [immutant.web.javax       :as javax]
-            [ring.middleware.resource :as ring-resource]
             [ring.util.response       :as ring-util]))

 (defn echo-request
@@ -10,25 +8,6 @@
   [request]
   (ring-util/response (with-out-str (pprint request))))

-(def assets
-  "Serve static assets from resources/public/"
-  (ring-resource/wrap-resource #'echo-request "public"))
-
-;;; The Ring Session example: https://github.com/ring-clojure/ring/wiki/Sessions
-(defn counter [{session :session}]
-  (let [count (:count session 0)
-        session (assoc session :count (inc count))]
-    (-> (ring-util/response (str "You accessed this page " count " times\n"))
-        (assoc :session session))))
-
 (defn -main
   [& {:as args}]
-
-  ;; this uses an Undertow handler by default, which is faster than a servlet
-  (web/run echo-request args)
-
-  ;; using a servlet allows the session to be shared in a WildFly
-  ;; cluster and allow access to the session from websockets
-  (web/run
-    (javax/create-servlet #'counter)
-    :path "/counter"))
+  (web/run echo-request args))


Code cleanup.

Code cleanup.

--- src/posthere/cljs/posthere.cljs
+++ src/posthere/cljs/posthere.cljs
@@ -20,11 +20,12 @@

 ;; ----- Unique UUID generation -----

-(defn- short-uuid []
+(defn- short-uuid
   "Take the middle 3 sections of a UUID to make a shorter UUID.

   Ex: f6f7-499f-b805
   "
+  []
   (s/join "-" (take 3 (rest (s/split (uuid/make-random) #"-")))))

 (defn- update-post-url


removed rnd text

removed rnd text

--- src/cai/core.clj
+++ src/cai/core.clj
@@ -119,10 +119,6 @@
         result
         {:status 403}))))

-<<<<<<< HEAD
-
-=======
->>>>>>> c495d8d1ac0f6141bb0e4d5ae5234d7829659615
 (def app
   (-> (wrap-defaults fb-routes api-defaults)
       (wrap-keyword-params)


Event for aclose and achan/achan-buf share code.

--- src/cbfg/ago.clj
+++ src/cbfg/ago.clj
@@ -15,19 +15,18 @@
   `(ago ~child-actx-binding-name ~actx (loop ~bindings ~@body)))

 (defmacro achan [actx]
+  `(achan-buf ~actx 0))
+
+(defmacro achan-buf [actx buf-or-size]
   `(let [ch# (cljs.core.async/chan)
          w# (actx-top ~actx)]
-     (println "achan" ~actx ch#)
+     (println "achan-buf" ~actx ~buf-or-size ch#)
      (swap! (:tot-chs w#) inc)
      (swap! (:chs w#) assoc ch# [])
      ch#))

-(defmacro achan-buf [actx buf-or-size]
-  `(do (println "achan-buf" ~actx ~buf-or-size)
-       (cljs.core.async/chan ~buf-or-size)))
-
 (defmacro aclose [actx ch]
-  `(do (println "aclose" ~actx)
+  `(do (cljs.core.async/>! (:event-ch (actx-top ~actx)) ["aclose" ~actx ~ch])
        (cljs.core.async/close! ~ch)))

 (defmacro atake [actx ch]


remove inadvertently added characters

remove inadvertently added characters

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -981,4 +981,4 @@
   (doto (LinkedBlockingQueue.)
     drain-queue))

-fu+


Fix markdown docstring indentation :information_desk_person:

--- src/metabase/driver.clj
+++ src/metabase/driver.clj
@@ -85,31 +85,31 @@
      a `Database` `details` map, and for validating it on the Backend. It should include things like `host`,
      `port`, and other driver-specific parameters. Each field information map should have the following properties:

-       *  `:name`
-
-           The key that should be used to store this property in the `details` map.
-
-       *  `:display-name`
-
-           Human-readable name that should be displayed to the User in UI for editing this field.
-
-       *  `:type` *(OPTIONAL)*
-
-          `:string`, `:integer`, `:boolean`, or `:password`. Defaults to `:string`.
-
-       *  `:default` *(OPTIONAL)*
-
-           A default value for this field if the user hasn't set an explicit value. This is shown in the UI as a placeholder.
-
-       *  `:placeholder` *(OPTIONAL)*
-
-          Placeholder value to show in the UI if user hasn't set an explicit value. Similar to `:default`, but this value is
-          *not* saved to `:details` if no explicit value is set. Since `:default` values are also shown as placeholders, you
-          cannot specify both `:default` and `:placeholder`.
-
-       *  `:required` *(OPTIONAL)*
-
-          Is this property required? Defaults to `false`.")
+   *  `:name`
+
+      The key that should be used to store this property in the `details` map.
+
+   *  `:display-name`
+
+      Human-readable name that should be displayed to the User in UI for editing this field.
+
+   *  `:type` *(OPTIONAL)*
+
+      `:string`, `:integer`, `:boolean`, or `:password`. Defaults to `:string`.
+
+   *  `:default` *(OPTIONAL)*
+
+       A default value for this field if the user hasn't set an explicit value. This is shown in the UI as a placeholder.
+
+   *  `:placeholder` *(OPTIONAL)*
+
+      Placeholder value to show in the UI if user hasn't set an explicit value. Similar to `:default`, but this value is
+      *not* saved to `:details` if no explicit value is set. Since `:default` values are also shown as placeholders, you
+      cannot specify both `:default` and `:placeholder`.
+
+   *  `:required` *(OPTIONAL)*
+
+      Is this property required? Defaults to `false`.")

   (execute-query ^java.util.Map [this, ^java.util.Map query]
     "Execute a query against the database and return the results.


Add missing config on dist.clj script.

Add missing config on dist.clj script.

--- scripts/dist.clj
+++ scripts/dist.clj
@@ -14,6 +14,8 @@
     :warnings {:ns-var-clash false}
     :output-to "resources/public/js/main.js"
     :output-dir "resources/public/js"
+    :closure-defines {"uxbox.repo.core.url"
+                      "https://test.uxbox.io/api"}
     :optimizations :simple
     :static-fns true
     :language-in  :ecmascript5


CMR-5771: Add test collections to virtual product.

--- virtual-product-app/src/cmr/virtual_product/data/source_to_virtual_mapping.clj
+++ virtual-product-app/src/cmr/virtual_product/data/source_to_virtual_mapping.clj
@@ -176,7 +176,19 @@
     :virtual-collections [
                           {:entry-title "GLDAS Noah Land Surface Model L4 Monthly 1.0 x 1.0 degree Rain Rate, Avg. Surface Skin Temp., Soil Moisture V2.0 (GLDAS_NOAH10_Monthly) at GES DISC"
                            :short-name "GLDAS_NOAH10_Monthly"
-                           :version-id "2.0"}]}})
+                           :version-id "2.0"}]}
+   ["DEMO_PROV" "DEMO_PROV VP Test"]
+   {:short-name "VP_TEST"
+    :virtual-collections [
+                          {:entry-title "A Virtual Product test collection."
+                           :short-name "VP_TEST_DEST"
+                           :version-id "001"}]}
+   ["EEDTEST" "EEDTEST VP Test"]
+   {:short-name "VP_TEST"
+    :virtual-collections [
+                          {:entry-title "A Virtual Product test collection."
+                           :short-name "VP_TEST_DEST"
+                           :version-id "001"}]}})

 (def virtual-product-to-source-mapping
   "A map derived from the map source-to-virtual-product-mapping. This map consists of keys which are


fixes

fixes

--- src/node/game/core.cljs
+++ src/node/game/core.cljs
@@ -172,7 +172,8 @@
     (draw state :corp))
   (swap! state assoc-in [side :click] (get-in @state [side :click-per-turn]))
   (swap! state assoc :active-player side :once-per-turn nil :end-turn false)
-  (swap! state assoc-in [side :register] nil))
+  (swap! state assoc-in [side :register] nil)
+  (system-msg state side (str "started his or her turn")))

 (defn end-turn [state side]
   (swap! state assoc :end-turn true)
@@ -186,7 +187,7 @@
 (defn play-ability [state side {:keys [card ability :as args]}]
   (let [ab (get-in game.cards/cards [(:title card) :abilities ability])
         counter-cost (:counter-cost ab)]
-    (when (and (not (get-in @state [side :register (:cid card)]))
+    (when (and (not (get-in @state [:once-per-turn (:cid card)]))
                (<= counter-cost (:counter card))
                (apply pay (concat [state side] (:cost ab))))
       (let [c (update-in card [:counter] #(- % counter-cost))]


minor ui improvement

minor ui improvement

--- src/notehub/handler.clj
+++ src/notehub/handler.clj
@@ -126,7 +126,8 @@
          (let [stats (:statistics resp)
                statistics (get-message :statistics)]
            (layout statistics
-                   [:h2.central-element statistics ": " (api/derive-title (:note resp))]
+                   [:h2.central-element (api/derive-title (:note resp))]
+                   [:h3.central-element.helvetica statistics]
                    [:table#stats.helvetica.central-element
                     (map
                      #(when (% stats)


make parse function flexible, provide options

--- src/rapscallion/xml.clj
+++ src/rapscallion/xml.clj
@@ -275,9 +275,9 @@

 (defn events->nodes
-  "Returns a 2-element vector containing:
-   1) A seq of sibling nodes extracted from the event stream, and
-   2) A seq of the unconsumed events.
+  "Takes a seq of SAX events, and returns a 2-element vector of:
+   1 - A seq of nodes extracted from the event seq, and
+   2 - A seq of the unconsumed events.
   "
   [events]
   (loop [nodes []
@@ -286,6 +286,14 @@

     (case type

+      :start-prefix-mapping
+      (let [[_ prefix uri] evt
+            ns-map (assoc (peek ns-stack) uri prefix)]
+        (recur nodes events (conj ns-stack ns-map)))
+
+      :end-prefix-mapping
+      (recur nodes events (pop ns-stack))
+
       :start-element
       (let [[_ tag attrs]     evt
             [children events] (events->nodes events)
@@ -318,20 +326,14 @@
                events
                ns-stack))

-      :start-prefix-mapping
-      (let [[_ prefix uri] evt
-            ns-map (assoc (peek ns-stack) uri prefix)]
-        (recur nodes events (conj ns-stack ns-map)))
-
-      :end-prefix-mapping
-      (recur nodes events (pop ns-stack))
-
       (:end-element nil)
       [nodes events]

       )))

-(defn make-tree [events]
+(defn make-tree
+  "Takes a seq of SAX events and returns a vector of the top-level nodes."
+  [events]
   (let [[nodes events] (events->nodes events)]
     (when (seq events)
       ;; This shouldn't be possible if the source of the events is an
@@ -340,22 +342,100 @@
       (parse-error "Unconsumed SAX events: " events))
     nodes))

+;; New default parse options.
+(def default-parse-options
+  {:namespaces      true
+   :keep-whitespace false
+   :comments        true
+   :cdata           true
+   :processing-instructions true
+   })
+
+;; For backward-compatibility. Options for parsing clojure.xml-style.
+(def old-parse-options
+  {:namespaces      false
+   :keep-whitespace false
+   :comments        false
+   :cdata           false
+   :processing-instructions false
+   })
+
+(def ^{:dynamic true} *parse-options* default-parse-options)
+
 (defn parse
-  "Returns a seq of top-level XML nodes."
+  "Takes something convertable to a InputSource, and returns a vector
+   of top-level XML nodes.
+
+   The opts parameter is an optional map of options. The defaults for
+   all options are in the map *parse-options*, which is rebindable.
+
+     :keep-whitespace
+       If true, whitespace-only text nodes are kept, othewise they
+       are discarded.
+
+     :comments
+     :cdata
+     :processing-instructions
+       If false, nodes of the corresponding type are discarded.
+
+     :namespaces
+       Sets namespace-awareness in the SAX parser.
+   "
+
   [source & [opts]]
-  (-> source
-      (sax-seq opts)
-      throw-on-error
-      merge-adjacent-text
-      skip-whitespace
-      (ignore
-        ;:processing-instruction
-        ;:start-cdata :end-cdata
-        ;:start-prefix-mapping :end-prefix-mapping
-        ;:comment
-        )
-      make-tree
-      ))
+
+  ;; This works by producing a seq of SAX-events, and then running it
+  ;; through a series of transformations. This should allow quite a
+  ;; bit flexibility in deciding exactly which transformations to
+  ;; apply, at the cost of being slightly less efficient - for
+  ;; example, events for comments, processing-instructions, etc. may
+  ;; be produced by the parser and added to the seq, but then
+  ;; ignored. This inefficiency should be ameliorated somewhat by the
+  ;; fact that those types of nodes relatively rare in XML.
+
+  (let [;; Use defaults for options unless overridden.
+        {:keys [namespaces
+                comments cdata processing-instructions
+                keep-whitespace]} (merge *parse-options* opts)
+
+        ;; First, run the SAX parser to produce the full sequence of
+        ;; events. Give it the nice short name "e", since it will be
+        ;; repeated a lot.
+        e (sax-seq source opts)
+
+        ;; Since the SAX parser runs in another thread, parsing errors
+        ;; are caught and put into the event-seq as [:error
+        ;; <exception>].  This transformation will re-throw them.
+        e (throw-on-error e)
+
+        ;; SAX parsers can emit multiple "characters" events for one
+        ;; piece of text (for example, when it contains entities, such
+        ;; as &). It's generally more convenient to work with
+        ;; adjacent text nodes merged into one.
+        e (merge-adjacent-text e)
+
+        ;; Optionally discard whitespace-only nodes
+        e (if keep-whitespace e (skip-whitespace e))
+
+        ;; Figure out which types of node to ignore.
+        ignores (reduce into nil
+                        [(when-not comments [:comment])
+                         (when-not cdata [:start-cdata :end-cdata])
+                         (when-not processing-instructions [:processing-instruction])
+                         ;; Maybe don't need this line (the parser
+                         ;; won't emit these anyway, right?):
+                         (when-not namespaces [:start-prefix-mapping :end-prefix-mapping])
+                         ])
+
+        ;; Skip ignorable events
+        e (if ignores (apply ignore e ignores) e)
+        ]
+
+    ;; Finally, turn the resulting event-seq into a tree (almost) of
+    ;; nodes. This actually returns all the top-level nodes, which
+    ;; should consist of exactly one Element, as well as any number of
+    ;; Comments and PIs preceeding and/or following the Element.
+    (make-tree e)))


remove to-remove option

remove to-remove option

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

 (deftask dump-meta
   "Utility task to dump perun metadata via boot.util/info"
-  [r to-remove REMOVE [kw] "Keys to remove from metadata map values"
-   m map-fn    MAPFN  code "function to map over metadata items before printing"]
+  [m map-fn    MAPFN  code "function to map over metadata items before printing"]
   (boot/with-pre-wrap fileset
     (let [map-fn (or map-fn identity)]
       (prn (pr-str (map map-fn (perun/get-meta fileset)))))


sreduce: fix docstring.

sreduce: fix docstring.

Docstring said maximum, but computed sum. Now it computes sum.

--- src/riemann/streams.clj
+++ src/riemann/streams.clj
@@ -183,7 +183,7 @@

   Passes on events, but with the *maximum* of all received metrics:
   (sreduce (fn [acc event] (assoc event :metric
-                                  (+ (:metric event) (:metric acc)))) ...)
+                                  (max (:metric event) (:metric acc)))) ...)

   Or, using riemann.folds, a simple moving average:
   (sreduce (fn [acc event] (folds/mean [acc event])) ...)"


streams/where-test: Expand to fully qualified tagged-any/tagged-all.

Fixes #414, where using `where` without streams/tagged in the local
namespace would fail to compile, or cause silent incorrect behavior.

--- src/riemann/streams.clj
+++ src/riemann/streams.clj
@@ -1549,9 +1549,9 @@
   (condp some [k]
     ; Tagged checks that v is a member of tags.
     #{'tagged 'tagged-all} (list 'when (list :tags 'event)
-                             (list 'tagged-all? (list 'flatten [v]) 'event))
+                             (list `tagged-all? (list 'flatten [v]) 'event))
     #{'tagged-any} (list 'when (list :tags 'event)
-                     (list 'tagged-any? (list 'flatten [v]) 'event))
+                     (list `tagged-any? (list 'flatten [v]) 'event))
     ; Otherwise, match.
     (list 'riemann.common/match v (list (keyword k) 'event))))


Add print-to-pdf utility in automation

Add print-to-pdf utility in automation

--- src/clj_chrome_devtools/automation.clj
+++ src/clj_chrome_devtools/automation.clj
@@ -354,18 +354,34 @@
   ;; when file-download can actually read the file contents, refactor this
   (file-download url-pattern interaction-fn))

+(defn- decode-base64 [^String s]
+  (.decode (java.util.Base64/getDecoder) s))
+
+(defn- export-to-file [cmd-output filename]
+  (-> cmd-output :data decode-base64
+      (java.io.ByteArrayInputStream.)
+      (io/copy (io/file filename))))
+
 (defn screenshot
   ([]
    (screenshot @current-automation))
   ([automation]
    (screenshot automation "screenshot.png"))
   ([{c :connection} filename]
-   (let [decode (fn [^String s]
-                  (.decode (java.util.Base64/getDecoder) s))]
-     (-> (page/capture-screenshot c {})
-         :data decode
-         (java.io.ByteArrayInputStream.)
-         (io/copy (io/file filename))))))
+   (-> (page/capture-screenshot c {})
+       (export-to-file filename))))
+
+(defn print-pdf
+  "Print current page to PDF."
+  ([]
+   (print-pdf @current-automation))
+  ([automation]
+   (print-pdf automation "print.pdf"))
+  ([automation filename]
+   (print-pdf automation filename {}))
+  ([{c :connection} filename options]
+   (-> (page/print-to-pdf c options)
+       (export-to-file filename))))

 (defn set-attribute
   ([node attribute-name attribute-value]


tone down logging

tone down logging

--- src/clojure/zensols/actioncli/util.clj
+++ src/clojure/zensols/actioncli/util.clj
@@ -66,17 +66,17 @@
          (letfn [(create-fn# ~args
                    (do ~@forms))]
            (let [res# (volatile! nil)]
-             (log/debugf "access resource: %s" ~name)
+             (log/tracef "access resource: %s" ~name)
              (locking monitor#
                (when-not (deref init-inst#)
-                 (log/debugf "start priming: %s" ~name)
+                 (log/tracef "start priming: %s" ~name)
                  (vreset! res# (apply create-fn# ~args))
                  (reset! init-inst# true)
-                 (log/debug "end prime")))
+                 (log/trace "end prime")))
              (if-let [res2# (deref res#)]
-               (do (log/debug "reusing prime result")
+               (do (log/trace "reusing prime result")
                    res2#)
-               (do (log/debug "no prime result, calling now")
+               (do (log/trace "no prime result, calling now")
                    (apply create-fn# ~args))))))
        (alter-meta! (var ~name) assoc :init-resource init-inst#)
        (var ~name))))
@@ -97,12 +97,12 @@
            monitor# (Object.)]
        (defn ~(vary-meta name assoc :doc doc) ~args
          (let [res-name# ~name]
-           (log/debugf "fetching resource: %s" res-name#)
+           (log/tracef "fetching resource: %s" res-name#)
            (locking monitor#
              (when-not (deref init-inst#)
-               (log/debugf "creating resource: %s" res-name#)
+               (log/tracef "creating resource: %s" res-name#)
                (swap! init-inst# #(or % (do ~@forms)))
-               (log/debug "created resource"))
+               (log/trace "created resource"))
              (deref init-inst#))))
        (alter-meta! (var ~name) assoc :init-resource init-inst#)
        (var ~name))))
@@ -147,15 +147,15 @@
                            (.setMaxTotal (:max-total conf#))
                            (.setMaxIdle (:max-idle conf#))
                            (.setMinIdle (:min-idle conf#)))))]
-       (log/debugf "using config: %s, fn factory: %s"
+       (log/tracef "using config: %s, fn factory: %s"
                    (pr-str conf#) ~factory-fn)
        (defn ~(vary-meta name assoc :doc doc) ~args
-         (log/debugf "borrow: %s" (trunc pool-inst#))
+         (log/tracef "borrow: %s" (trunc pool-inst#))
          (let [~item-symbol (p/borrow pool-inst#)]
            (try
              ~@forms
              (finally
-               (log/debugf "return %s" (trunc pool-inst#))
+               (log/tracef "return %s" (trunc pool-inst#))
                (p/return pool-inst# ~item-symbol)))))
        (alter-meta! (var ~name) assoc :pool-inst pool-inst#)
        (var ~name))))


fix: avoid ubuntu duplication

fix: avoid ubuntu duplication

--- src/terraboot/elasticsearch.clj
+++ src/terraboot/elasticsearch.clj
@@ -25,8 +25,6 @@
                                        :write_files [{:path "/etc/logstash/conf.d/out-es.conf"
                                                       :permissions "644"
                                                       :content (snippet "system-files/out-es.conf")}]}))
-
-(def ubuntu "ami-9b9c86f7")

 (defn elasticsearch-cluster [name {:keys [vpc-name] :as spec}]
   ;; http://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html#es-createdomain-configure-ebs


Исправления - тумбинация изображений для аватара

--- src/ixinfestor/core_handler.clj
+++ src/ixinfestor/core_handler.clj
@@ -203,11 +203,9 @@
                    (cw/error-response-json
                     (let [{:keys [row user-roles-keys-set]} (request :params)
                           row (-> row
-                                  ix/print-debug->>>
                                   (as-> row
                                       (if (empty? (:password row)) (dissoc row :password)
                                           (update-in row [:password] creds/hash-bcrypt)))
-                                  ix/print-debug->>>
                                   ((partial ix/com-save-for-id ix/webuser))
                                   (dissoc :password))]

@@ -466,7 +464,7 @@
                               (let [id (parseLong id)
                                     [{path :path} _]
                                     (web-file-upload
-                                     (partial ix/file-upload-rel-on webdoc-entity :webdoc_id {:id id})
+                                     (partial ix/file-upload-rel-on-o webdoc-entity :webdoc_id {:id id} save-file-fn-options)
                                      (-> request :params :file-uploader))]
                                 (ix/webdoc-save {:id id :web_title_image path})
                                 "OK")))))


Pass :nrepl-middleware list to Neko when compiling

--- src/leiningen/droid/compile.clj
+++ src/leiningen/droid/compile.clj
@@ -95,7 +95,9 @@
   debug-specific code when building the release."
   [{{:keys [enable-dynamic-compilation start-nrepl-server
             manifest-path repl-device-port ignore-log-priority]}
-    :android :as project}]
+    :android
+    {:keys [nrepl-middleware]} :repl-options
+    :as project}]
   (info "Compiling Clojure files...")
   (ensure-paths manifest-path)
   (debug "Project classpath:" (get-classpath project))
@@ -107,6 +109,7 @@
                       :neko.init/enable-dynamic-compilation
                       enable-dynamic-compilation
                       :neko.init/ignore-log-priority ignore-log-priority
+                      :neko.init/nrepl-middleware (list 'quote nrepl-middleware)
                       :neko.init/package-name (get-package-name manifest-path)}
                      (not dev-build) (assoc :elide-meta
                                        [:doc :file :line :added :arglists]))]


Pretty-print the returned date header

Pretty-print the returned date header

--- src/net/dishevelled/mailindex.clj
+++ src/net/dishevelled/mailindex.clj
@@ -27,6 +27,11 @@
    :main true))

+(def *date-output-format*
+     (doto (SimpleDateFormat. "EEE, dd MMM yyyy HH:mm:ss Z")
+       (.setTimeZone (SimpleTimeZone. 0 "UTF"))))
+
+
 (def *date-formatters*
      (map #(doto (SimpleDateFormat. %)
 	     (.setTimeZone (SimpleTimeZone. 0 "UTF")))
@@ -264,9 +269,12 @@
           [(get-field doc "group")
            (get-field doc "num")
            (int (* (.score hits %) 100000))
-	   (mapcat (fn [f] [(keyword f)
-			 (get-field doc f)])
-		["date" "subject" "to" "from" "msgid" "lines" "chars"])])
+	   (concat [:date
+		    (.format *date-output-format*
+			     (DateTools/stringToDate (get-field doc "date")))]
+		   (mapcat (fn [f] [(keyword f)
+				    (get-field doc f)])
+			   ["subject" "to" "from" "msgid" "lines" "chars"]))])
        (range (.length hits))))


Make admin config optional

Make admin config optional

--- src/yetibot/core/models/admin.clj
+++ src/yetibot/core/models/admin.clj
@@ -3,7 +3,10 @@
     [schema.core :as s]
     [yetibot.core.config :refer [get-config]]))

-(defn config [] (get-config {:users [s/Str] :commands [s/Str]} [:admin]))
+(defn config [] (get-config
+                  {(s/optional-key :users ) [s/Str]
+                   (s/optional-key :commands) [s/Str]}
+                  [:admin]))

 (defn admin-only-command? [cmd]
   (boolean ((-> (config) :value :commands set) cmd)))


Add yada examples -- Add 404 test

Add yada examples -- Add 404 test

--- test/com/nomistech/clojure_the_language/c_800_libraries/s_800_web/ss_600_bidi_yada/sss_200_yada.clj
+++ test/com/nomistech/clojure_the_language/c_800_libraries/s_800_web/ss_600_bidi_yada/sss_200_yada.clj
@@ -129,3 +129,10 @@
   => {:headers {"Content-Type" "application/json"}
       :body {:this-will-be "a-json"
              :map          {:hello "World!"}}})
+
+(fact
+  (get-and-filter-using-path-and-temp-server "/no-such-thing"
+                                             {:as :json})
+  => (throws (fn [e]
+               (= (-> e ex-data :status)
+                  404))))


Remove debug output

Remove debug output

--- src/layzee/adapters/twitter/search.clj
+++ src/layzee/adapters/twitter/search.clj
@@ -30,7 +30,6 @@

    <https://dev.twitter.com/rest/public/timelines> Note that since the max_id parameter is inclusive, the Tweet with the matching ID will actually be returned again."
   (log opts)
-  (println opts)
   (let [max-id (or (:max-id opts) 0) tweet-filter (or (:filter opts) (fn[what] what))]
     (let [url (earl what opts)]
       (log url)


Skip shim when compiling for nodejs (fixes #34)

--- src/adzerk/boot_cljs/middleware.clj
+++ src/adzerk/boot_cljs/middleware.clj
@@ -134,21 +134,28 @@
   level this middleware adds external JS files to the compiler preamble and
   doesn't create a shim."
   [{:keys [tmp-src tmp-out main files opts docroot] :as ctx}]
-  (if-not (= :none (:optimizations opts))
+  (cond
+    (= :nodejs (:target opts))
+    ctx
+
+    (not= :none (:optimizations opts))
     (let [incs (->> (:incs files)
                     (map core/tmppath)
                     (remove #(contains? (set (:preamble opts)) %)))]
       (update-in ctx [:opts :preamble] (comp vec distinct into) incs))
-    (let [shim-path  (:output-to opts)
-          shim-name  (util/get-name shim-path)
-          output-to  (output-path-for shim-path)
-          output-dir (util/get-name (:output-dir opts))
-          cljs-paths (map core/tmppath (:cljs files))
-          main*      (-> main core/tmppath deps/strip-extension)
-          scripts    (-> (:incs files)
-                         (->> (mapv #(.getPath (util/rooted-file docroot (core/tmppath %)))))
-                         (conj (io/file output-dir "goog" "base.js"))
-                         (conj (util/get-name output-to)))]
+
+    :else
+    (let [shim-path   (:output-to opts)
+          shim-name   (util/get-name shim-path)
+          output-to   (output-path-for shim-path)
+          output-dir  (util/get-name (:output-dir opts))
+          cljs-paths  (map core/tmppath (:cljs files))
+          main*       (-> main core/tmppath deps/strip-extension)
+          rooted-path #(.getPath (util/rooted-file docroot (core/tmppath %)))
+          scripts     (-> (:incs files)
+                          (->> (mapv rooted-path))
+                          (conj (io/file output-dir "goog" "base.js"))
+                          (conj (util/get-name output-to)))]
       (->> (write-body (file->goog main*))
            (format shim-js shim-name (apply str (map write-src scripts)))
            (spit shim-path))


modifications in the estimation

modifications in the estimation

--- sre/src/sre/plan/estimation.clj
+++ sre/src/sre/plan/estimation.clj
@@ -27,13 +27,19 @@
   [op args & body]
   (if (contains? (ns-interns *ns*) '-costs)
     `(defmethod ~'-costs ~op ~args
-       (let [res# (do ~@body)] (->SimpleCostCalculator res# res#)))))
+       (let [res# (do ~@body)] {:c res# :p res#}))))
+
+(defmacro defweight2
+  "Adds a weight estimator for the operation in the current config."
+  [op args & body]
+  (if (contains? (ns-interns *ns*) '-costs)
+    `(defmethod ~'-costs ~op ~args ~@body)))

 (defrecord SimpleCostCalculator [c p]
   Cost
   (calculate [this config op-binding constr-lkp]
-    ((core/costs config) (:type op-binding) (:bindings op-binding) constr-lkp))
+    (map->SimpleCostCalculator ((core/costs config) (:type op-binding) (:bindings op-binding) constr-lkp)))
   (append [this subcost]
     (-> this
       (update-in [:p] #(* %1 (:p subcost)))
@@ -45,10 +51,10 @@
 ;; from the underlying platform. It should not do side effects, like just like runtime-ctx.
 ;; IRL we use the same indexer for both purposes, but might make sense splitting up later.

-(defrecord VarStatsCostCalculator [c p estimation-ctx est-var-cardinality]
+(defrecord VarStatsCostCalculator [c p estimation-ctx var-stats]
   Cost
   (calculate [this config op-binding constr-lkp]
-    ((core/costs config) (:type op-binding) (:bindings op-binding) estimation-ctx est-var-cardinality constr-lkp))
+    ((core/costs config) (:type op-binding) (:bindings op-binding) estimation-ctx var-stats constr-lkp))
   (append [this subcost]
     (-> this
         (update-in [:p] #(* % (:p subcost)))


Optimize the protobuf.generate/built-toplevel-entries logic

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

--- src/chaintool/protobuf/generate.clj
+++ src/chaintool/protobuf/generate.clj
@@ -118,8 +118,7 @@
        (mapv build-toplevel-entry)
        (interleave (range))
        (partition 2)
-       (map vec)
-       vec
+       (mapv vec)
        (into {})))

 (defn- buildfunction [name {:keys [rettype functionName param index type] :as ast}]


hide missing card image

hide missing card image

--- src/cljs/netrunner/cardbrowser.cljs
+++ src/cljs/netrunner/cardbrowser.cljs
@@ -24,7 +24,8 @@
        [:div.text
         [:p [:span.type (str (:type card))] (if (empty? (:subtype card)) "" (str ": " (:subtype card)))]
         [:pre {:dangerouslySetInnerHTML #js {:__html (:text card)}}]]
-       [:img {:src (str base-url (:code card) ".png") :alt (:text card)}]]))))
+       [:img {:src (str base-url (:code card) ".png")
+              :onError #(-> % .-target js/$ .hide)}]]))))

 (defn set-view [{:keys [set set-filter]} owner]
   (reify


fix fetch issue in cardbrowser

fix fetch issue in cardbrowser

--- src/cljs/netrunner/cardbrowser.cljs
+++ src/cljs/netrunner/cardbrowser.cljs
@@ -180,5 +180,5 @@

 (om/root card-browser app-state {:target (. js/document (getElementById "cardbrowser"))})

-(go (swap! app-state assoc :sets (<! (GET "data/sets"))))
-(go (swap! app-state assoc :cards (<! (GET "data/cards"))))
+(go (swap! app-state assoc :sets (:json (<! (GET "data/sets")))))
+(go (swap! app-state assoc :cards (:json (<! (GET "data/cards")))))


small fix

small fix

--- src/cljs/salava/badge/ui/modal.cljs
+++ src/cljs/salava/badge/ui/modal.cljs
@@ -224,7 +224,7 @@
           [:h2.uppercase-header (t :badge/Evidence)]
           [:div [:a {:target "_blank" :href evidence_url} (t :badge/Openevidencepage) "..."]]]])

-      (if (and owner? (session/get :user)) "" [reporttool1 id name "badge"])]]
+      #_(if (and owner? (session/get :user)) "" [reporttool1 id name "badge"])]]
     ))

 (defn modal-navi [state]
@@ -265,11 +265,14 @@

 (defn content [state]
-  (let [{:keys [owner? tab user-logged-in?]} @state]
+  (let [{:keys [id owner? tab user-logged-in?]} @state
+        selected-language (cursor state [:content-language])
+        data (content-setter @selected-language (:content @state))]
     [:div
      (when (and (not owner?) user-logged-in?) [follow-verified-bar @state nil nil])
      [modal-top-bar state]
-     (if tab tab [badge-content state])]))
+     (if tab tab [badge-content state])
+     (if (and owner? (session/get :user)) "" [reporttool1 id  (:name data) "badge"])]))

 (defn handler [params]


Fix backspace/delete paredit commands

Fix backspace/delete paredit commands

--- src/clojure/paredit_widget/core.clj
+++ src/clojure/paredit_widget/core.clj
@@ -59,8 +59,8 @@
    [nil "]"] :paredit-close-square
    [nil "{"] :paredit-open-curly
    [nil "}"] :paredit-close-curly
-   [nil "\b"] :paredit-backward-delete
-   [nil "DEL"] :paredit-forward-delete
+   [nil "Backspace"] :paredit-backward-delete
+   [nil "Delete"] :paredit-forward-delete
    [nil "\""] :paredit-doublequote ;; \"
    ["C" "9"] :paredit-backward-slurp-sexp
    ["C" "0"] :paredit-forward-slurp-sexp


Add private key import

Add private key import

--- src/clojure_fabric/crypto_suite.clj
+++ src/clojure_fabric/crypto_suite.clj
@@ -123,7 +123,7 @@
         opts (Object)
   Returns
         (Key) An instance of the Key class wrapping the raw key bytes"
-  [#^bytes k-byte-array {:keys [algorithm curve ephemeral]}]
+  [#^bytes k-byte-array {:keys [algorithm curve ephemeral type]}]
   (let [curve-name (name curve)
         parameter-spec (ECNamedCurveTable/getParameterSpec curve-name)
         curve (.getCurve parameter-spec)
@@ -131,13 +131,19 @@
         key-size (count k-byte-array)
         middle (int (/ key-size 2))]
     (if (= curve-size key-size)
-      (.generatePublic (KeyFactory/getInstance (name algorithm) BouncyCastleProvider/PROVIDER_NAME)
-                       (ECPublicKeySpec. (ECPoint. (java.math.BigInteger. 1 (Arrays/copyOfRange k-byte-array (int 0) middle))
-                                                   (java.math.BigInteger. 1 (Arrays/copyOfRange k-byte-array middle key-size)))
-                                         (ECNamedCurveSpec. curve-name curve (.getG parameter-spec) (.getN parameter-spec)
-                                                            (.getH parameter-spec) (.getSeed parameter-spec))))
+      (let [kf (KeyFactory/getInstance (name algorithm) BouncyCastleProvider/PROVIDER_NAME)
+            spec (ECPublicKeySpec. (ECPoint. (java.math.BigInteger. 1 (Arrays/copyOfRange k-byte-array (int 0) middle))
+                                             (java.math.BigInteger. 1 (Arrays/copyOfRange k-byte-array middle key-size)))
+                                   (ECNamedCurveSpec. curve-name curve (.getG parameter-spec) (.getN parameter-spec)
+                                                      (.getH parameter-spec) (.getSeed parameter-spec)))]
+        (case type
+          :public (.generatePublic kf spec)
+          :private (.generatePublic kf spec)))
       (throw (Exception. (format "Key size(%d) does not match with the given curve(%d)" key-size curve-size))))))
-
+;; (b64/decode (.getBytes "BOg4fylDlzNxMFFTvtQBRsakfxaBJBPJf25sx8Iaim8v3h0ml9mnNCrUVJjBAeXyeGAX69NbAxbaAkNHT+6gJtU="))
+;; (def x (Arrays/copyOfRange *1 1 65))
+;; (import-key x {:algorithm :ECDSA :curve :secp256r1 :type :public})
+

 ;;;getKey


Profile outputs in flame-graph format

Profile outputs in flame-graph format

--- src/com/wsscode/pathom/profile.cljc
+++ src/com/wsscode/pathom/profile.cljc
@@ -4,6 +4,8 @@
     #?(:cljs [cljs.core.async :refer [<! chan put!]])
                     [com.wsscode.pathom.core :as p]
                     [com.wsscode.pathom.async :as pa]))
+
+(declare profile->flame-graph)

 (defn- append-at [cur v]
   (cond
@@ -27,7 +29,7 @@
    (fn [reader]
      (fn [{::keys [profile*] ::p/keys [path] :as env}]
        (if (= ::profile (p/key-dispatch env))
-         @profile*
+         (profile->flame-graph @profile*)
          (let [start-time (current-time-ms)
                res        (reader env)]
            (swap! profile* update-in path append-at


[#2181] Fix derived column type

[#2181] Fix derived column type

--- backend/src/akvo/lumen/lib/transformation/derive_category.clj
+++ backend/src/akvo/lumen/lib/transformation/derive_category.clj
@@ -77,7 +77,7 @@
       {:success?      true
        :execution-log [execution-log-message]
        :columns       (conj columns {"title"      column-title
-                                     "type"       derivation-type
+                                     "type"       "text"
                                      "sort"       nil
                                      "hidden"     false
                                      "direction"  nil


specify more scope openers

specify more scope openers

--- cljs/src/main/plastic/cogs/editor/layout/analysis/scopes.cljs
+++ cljs/src/main/plastic/cogs/editor/layout/analysis/scopes.cljs
@@ -17,7 +17,11 @@
    'defn-     :params
    'fn        :params
    'defmethod :params
-   'let       :pairs})
+   'let       :pairs
+   'if-let    :pairs
+   'when-let  :pairs
+   'for       :pairs
+   'loop      :pairs})

 (defn scope-related? [loc]
   (let [node (z/node loc)]


fixing freenas test

fixing freenas test

--- test/celestial/test/freenas.clj
+++ test/celestial/test/freenas.clj
@@ -8,4 +8,4 @@
 (with-conf
   (let [{:keys [machine freenas]} redis-freenas]
     (fact "legal freenas system"
-       (:spec (vconstruct redis-freenas)) => (contains {:jail_type :standard}))))
+       (:spec (vconstruct redis-freenas)) => (contains {:jail_host "red1"}))))


Test elapsed/remaining time formating, not the helper function

--- test/cljs/player/view_test.cljs
+++ test/cljs/player/view_test.cljs
@@ -34,10 +34,15 @@
   (is (= (v/part-class-name {:fg 1 :bg 2 :inverse true}) "fg-2 bg-1"))
   (is (= (v/part-class-name {:fg 1 :bg 2 :bold true :blink true :inverse true}) "fg-10 bg-9 bright")))

-(deftest format-time-test
-  (is (= (v/format-time 0.88) "00:00"))
-  (is (= (v/format-time 1.00) "00:01"))
-  (is (= (v/format-time 133.95) "02:13")))
+(deftest elapsed-time-test
+  (is (= (v/elapsed-time 0.88) "00:00"))
+  (is (= (v/elapsed-time 1.00) "00:01"))
+  (is (= (v/elapsed-time 133.95) "02:13")))
+
+(deftest remaining-time-test
+  (is (= (v/remaining-time 0.88 3) "-00:02"))
+  (is (= (v/remaining-time 1.00 3) "-00:02"))
+  (is (= (v/remaining-time 133.95 134) "-00:00")))

 (deftest adjust-to-range-test
   (is (= (v/adjust-to-range 1 -5 5) 1))


Give CircleCI more time.

Give CircleCI more time.

--- test/replikativ/stress_test.clj
+++ test/replikativ/stress_test.clj
@@ -99,7 +99,7 @@
                             ["mail:b@mail.com" #uuid "790f85e2-b48a-47be-b2df-6ad9ccbc73d6"]
                             [['+ i]])))
       (println "Time taken: " (- (.getTime (java.util.Date.)) st) " ms"))
-    (<?? S (timeout 8000))
+    (<?? S (timeout 10000))
     (is (= (->
             (<?? S (get-crdt S store-a (<?? S (new-mem-store))
                              ["mail:b@mail.com" #uuid "790f85e2-b48a-47be-b2df-6ad9ccbc73d6"]))
@@ -133,7 +133,7 @@
     (s/transact! stage-b
                  ["mail:b@mail.com" #uuid "790f85e2-b48a-47be-b2df-6ad9ccbc73d6"]
                  [['+ i]]))
-  (<?? S (timeout 8000))
+  (<?? S (timeout 10000))
   (is (=
        (->
         (<?? S (get-crdt S store-a (<?? S (new-mem-store))
@@ -160,12 +160,7 @@
                            ["mail:b@mail.com" #uuid "790f85e2-b48a-47be-b2df-6ad9ccbc73d6"]))
           (get-in [:state :commit-graph])
           count)
-         101))
-
- ;(count @(:state store-a)) => 206
- ;(count @(:state store-b)) => 206
- ;(count @(:state store-c)) => 206
- )
+         101)))

 (defn each-fixture [f]