Imap adaptor to async-serv now in place, redis support nowhere in sight.

--- src/clojure/neveragain/imap.clj
+++ src/clojure/neveragain/imap.clj
@@ -2,35 +2,32 @@
   (:require
     (clojure [string :as string]
              [set :as set-lib])
+    (clojure.core [async :refer [>! <! >!! alts! go go-loop]])
     (swiss [arrows :refer :all])
     (clojure.java [jdbc :as j])
     (neveragain [common :as common]
                 [settings :as settings]
                 [addresses :as addresses]
-                [core :as smtp-core]))
+                [async-serv :as as]))
   (:import
     (org.mindrot.jbcrypt BCrypt)))

 (defn wrap-pure-imap-verb [func]
-  (fn [tag conn args session]
-    (let [{resp :response session :session} (func args session)]
-      (cond
-       (sequential? resp)
-         (loop [[line & remaining] resp]
-           (if (not (empty? remaining))
-             (do
-               (.println (:out conn)
-                         (str "* " line "\r\n"))
-               (recur remaining))
-             (do
-               (.println (:out conn)
-                         (str tag " " line "\r\n"))
-               (.flush (:out conn)))))
-
-       (not (empty? resp))
-         (common/write-out (:out conn)
-                           (str tag " " resp "\r\n")))
-      session)))
+  (fn [session r-chan w-chan [_ tag _ args]]
+    (let [{response :response new-session :session} (func args session)]
+      (if (sequential? response)
+        ; If the wrapped function returned a list or vector send each as a
+        ; seperate line with the last one being prefixed by this req's tag.
+        (loop [[line & remaining] response]
+          (if (empty? remaining)
+            (>!! w-chan (str tag \space line "\r\n"))
+            (do
+              (>!! w-chan (str "* " line "\r\n"))
+              (recur remaining))))
+        ; Otherwise just send it as it is
+        (>!! w-chan (str response "\r\n")))
+      new-session)))
+

 (defmacro require-state
   "Wraps a pure verb handler to prevent the handler from being executed if
@@ -301,3 +298,21 @@
        (re-matches #"" args)
      nil))))

+(def handler-map {"LOGIN" (wrap-pure-imap-verb login)
+                  "SELECT" (wrap-pure-imap-verb select)})
+
+(defn connection-handler
+  [r-chan w-chan]
+  (go-loop [read-val (<! r-chan)
+            session {}]
+    (let [[line tag verb args] (re-matches #"(.+?)\s(\S+)\s(.+)" read-val)
+          handler (get handler-map verb)
+          new-session (handler session r-chan w-chan [line tag verb args])]
+      (recur (<! r-chan) new-session))))
+
+(defn serve-forever
+  [port]
+  (as/serve-forever port connection-handler))
+
+(defn -main [& args]
+  (serve-forever 1337))


Added missing pull

Added missing pull

--- src/clojure/staircase/tasks.clj
+++ src/clojure/staircase/tasks.clj
@@ -37,7 +37,8 @@
       (let [repo         (load-or-clone repo-uri repo-path options)
             fetch-result (git-fetch repo)
             git-ref      (or (:ref tool-settings) "master")]
-        (git-checkout repo git-ref)))))
+        (git-checkout repo git-ref)
+        (git-pull repo)))))

 (defn- rm-r [path]
   (let [f' (fn [f file] ;; y-combinator for non-tail recursion.


Nicer header when logged in

Nicer header when logged in

--- src/clojure/staircase/views.clj
+++ src/clojure/staircase/views.clj
@@ -34,6 +34,7 @@
 (defn logout []
   (-> (pv/sign-in-button {:ng-show "persona" :ng-click "persona.logout()"} button-style)
       (update-in [1 :class] str " navbar-btn")
+      (update-in [1 :title] (constantly "Signed in as {{auth.identity}}"))
       (update-in [2 1] (constantly "Sign out"))))

 (declare search-form nav-list)
@@ -66,9 +67,6 @@
       ]]

     [:div.collapse.navbar-collapse {:ng-class "{in: showHeaderMenu}"};; Only show if enough space.
-
-     [:p.navbar-text.navbar-right {:ng-show "auth.loggedIn"}
-      "Signed in as {{auth.identity}}"]

      (nav-list)


Changed label from the og:type to the category root

See the commend on label-from-id for the reasoning.

--- src/com/numergent/tropeflow.clj
+++ src/com/numergent/tropeflow.clj
@@ -23,6 +23,24 @@
   [res property]
   (-> (e/select res [[:meta (e/attr= :property property)]]) first (get-in [:attrs :content])))

+(defn label-from-id
+  "Returns the node label from a node id. Node id is expected to be of the
+  form Category/SubCategory.
+
+  Previously I used the og-type as the node label, but a lot of them are too
+  generic. For instance, 'article' is used both for the main trope articles as
+  well as for the articles on different genres, whereas the root is more
+  specific to the topic at hand.
+
+  As an example:
+
+  http://tvtropes.org/pmwiki/pmwiki.php/ComicBook/SpiderManLovesMaryJane
+
+  has the og:type 'article', but ComicBook is a lot more descriptive.
+  "
+  [^String id]
+  (-> id (s/split #"/") first (ut/if-empty "Unknown")))
+
 (defn node-from-meta
   "Returns the relevant metadata of a html-resource as a map, including things
   we care about like the node label."
@@ -32,25 +50,28 @@
         og-title (content-from-meta res "og:title")
         og-image (content-from-meta res "og:image")
         og-type (-> (content-from-meta res "og:type") (ut/if-nil ""))
-        main-type (-> og-type (s/split #"\.") first s/capitalize (ut/if-empty "Unknown"))]
+        id (-> (u/path-of og-url) (s/replace base-path ""))
+        label (label-from-id id)]
     {:url   og-url
      :host  og-host
      :title og-title
      :image og-image
      :type  og-type
-     :id    (-> (u/path-of og-url) (s/replace base-path ""))
-     :label main-type}))
+     :id    id
+     :label label}))

 (defn node-from-url
   "Returns a map with the metadata we can infer about a new from its URL.
   Assumes the url string conforms to the defined base-url, or will return nil."
   [^String url]
   (if (.startsWith url base-url)
-    (let [og-host (ut/host-string-of url)]
-      {:url   url
+    (let [og-host (ut/host-string-of url)
+          id (-> (u/path-of url) (s/replace base-path ""))
+          label (label-from-id id)]
+      {:label label
+       :id    id
        :host  og-host
-       :label "Unknown"
-       :id    (-> (u/path-of url) (s/replace base-path ""))})
+       :url   url})
     nil))

 (defn get-wiki-links


Check for map on inner

Check for map on inner

--- src/com/wsscode/pathom/gen.cljc
+++ src/com/wsscode/pathom/gen.cljc
@@ -197,35 +197,37 @@
                                :as      env}
                               outer
                               inner]
-  (as-> inner <>
-       (reduce-kv
-         (fn [m k v]
-           (let [v' (cond (contains? outer k)
-                          (get outer k)
-
-                          :else
-                          v)]
-             (assoc m k v')))
-         inner
-         <>)
-       (reduce-kv
-         (fn [m k v]
-           (let [v' (cond (and (keyword? k) (contains? placeholder-prefixes (namespace k)))
-                          (normalize-placeholders env (merge outer m) v)
-
-                          (map? v)
-                          (normalize-placeholders env (if (vector? k)
-                                                        (into {} [k])
-                                                        {}) v)
-
-                          (vector? v)
-                          (mapv #(normalize-placeholders env {} %) v)
-
-                          :else
-                          v)]
-             (assoc m k v')))
-         <>
-         <>)))
+  (if (map? inner)
+    (as-> inner <>
+      (reduce-kv
+        (fn [m k v]
+          (let [v' (cond (contains? outer k)
+                         (get outer k)
+
+                         :else
+                         v)]
+            (assoc m k v')))
+        inner
+        <>)
+      (reduce-kv
+        (fn [m k v]
+          (let [v' (cond (and (keyword? k) (contains? placeholder-prefixes (namespace k)))
+                         (normalize-placeholders env (merge outer m) v)
+
+                         (map? v)
+                         (normalize-placeholders env (if (vector? k)
+                                                       (into {} [k])
+                                                       {}) v)
+
+                         (vector? v)
+                         (mapv #(normalize-placeholders env {} %) v)
+
+                         :else
+                         v)]
+            (assoc m k v')))
+        <>
+        <>))
+    inner))

 (defn gen-query-join [{:keys [query] :as env}]
   (map->gen (meta query) (p/join env)))


Removed invoke-later-or-now

Removed invoke-later-or-now

since it is already provided by seesaw

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/contrib/gui/util.clj
+++ src/conexp/contrib/gui/util.clj
@@ -28,18 +28,11 @@

 ;;; Swing handmade concurrency

-(defn invoke-later-or-now
-  "Calls fn with SwingUtilities/invokeLater."
-  [fn]
-  (if (SwingUtilities/isEventDispatchThread)
-    (fn)
-    (SwingUtilities/invokeLater fn)))
-
 (defmacro do-swing
   "Executes body within the Swing Dispatch Thread or immediately, if
   execution is already in this thread."
   [& body]
-  `(invoke-later-or-now #(do ~@body)))
+  `(invoke-soon #(do ~@body)))

 (defmacro do-swing-return
   "Executes body in a thread-safe manner for Swing and returns its value."


Removing performance bug when computing proper premises

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/fca/implications.clj
+++ src/conexp/fca/implications.clj
@@ -240,16 +240,17 @@
                     (intersection-set? current set-sqn)
                     (swap! result conj current),
                     :else
-                    (let [next-elements (remove (fn [x]
-                                                  (not (exists [set rest-sets]
-                                                         (contains? set x))))
-                                                rest-elements)]
-                      (doseq [x next-elements]
+                    (when-let [x (first rest-elements)]
+                      (when (exists [set rest-sets]
+                              (contains? set x))
                         (search (remove #(contains? % x) rest-sets)
                                 (conj current x)
-                                (rest next-elements))))))]
+                                (rest rest-elements)))
+                      (search rest-sets
+                              current
+                              (rest rest-elements)))))]
     (search set-sqn #{} elements)
-    (vec (distinct @result))))
+    @result))

 (defn- proper-premises-for-attribute
   "Returns in context ctx for the attribute m and the objects in objs,


defined the counters once

defined the counters once

--- cljs/src/immanent/app.cljs
+++ cljs/src/immanent/app.cljs
@@ -7,11 +7,11 @@
   {1 "#677685", 2 "#FFB492", 3 "#8EE6CA", 4 "#92387E",
    5 "#FFF6C9", 6 "#5C58EB", 7 "#D1052D", 8 "#857A67"})

-(def counter (atom 0))              ; generates unique ids for each cell
-(def gameboard (atom (sorted-map))) ; gameboard is sorted to preserve cell order
-(def matched (atom #{}))            ; numbers that have been matched
-(def selected (atom nil))           ; cell that was last selected
-(def highlighted (atom #{}))        ; cells that are highlighted
+(defonce counter (atom 0))              ; generates unique ids for each cell
+(defonce gameboard (atom (sorted-map))) ; gameboard is sorted to preserve cell order
+(defonce matched (atom #{}))            ; numbers that have been matched
+(defonce selected (atom nil))           ; cell that was last selected
+(defonce highlighted (atom #{}))        ; cells that are highlighted

 ; A gameboard is a grid of cells, each uniquely identified, but two cells will
 ; have the same number and colors.  The game is won when all cells have been


* clojure/arrays.clj: minor clean-ups

* clojure/arrays.clj: minor clean-ups

--- clojure/arrays.clj
+++ clojure/arrays.clj
@@ -45,7 +45,7 @@
         (let [ins (aget zero pc)
               op (bit-and (bit-shift-right ins 28) 15)]
           ; (printf "%3d %d %d %d %d %d\n" pc op (A) (B) (C) (X))
-          (case op
+          (case (int op)
             0 (with-next (if (zero? (C)) r (A (B))))
             1 (with-next (A (aget ^ints (aget arrays (B)) (C))))
             2 (with-next (aset ^ints (aget arrays (A)) (B) (C)))
@@ -56,8 +56,7 @@
             7 (do
                 (binding [*out* *err*] (println "arrays:" @narrays))
                 :halt)
-            8 (let [c (C)
-                    a (int-array c 0)]
+            8 (let [a (int-array (C) 0)]
                 (if-let [ai (peek @free)]
                   (with-next
                     (aset arrays ai a)
@@ -65,9 +64,8 @@
                     (B (int ai)))
                   (let [len (alength arrays)
                         arrays
-                        (if (= @narrays len)
-                          (java.util.Arrays/copyOf arrays (* 2 len))
-                          arrays)]
+                        (if-not (= @narrays len) arrays
+                          (java.util.Arrays/copyOf arrays (* 2 len)))]
                     (with-next
                       (B (int @narrays))
                       (aset arrays @narrays a)


Improve doc search sorting with Levenshtein distance implemented by @carocad

--- lein-light-nrepl/src/lighttable/nrepl/doc.clj
+++ lein-light-nrepl/src/lighttable/nrepl/doc.clj
@@ -9,7 +9,33 @@
             [cljs.analyzer :as ana])
   (:import java.net.URL java.io.File))

-(defn clean-meta [m]
+(defn- next-row
+  "Computes the value of the next row of the distance matrix, based on the
+  values from the previous row."
+  [pre-row char1 str2]
+  (let [init-val [(inc (first pre-row))]
+        row   (fn [crow [diagonal above char2]]
+                       (let [dist (if (= char2 char1) diagonal
+                                    (inc (min diagonal above (peek crow))))]
+                         (conj crow dist)))]
+    (reduce row init-val (map vector pre-row (rest pre-row) str2))))
+
+
+;;   Author: PLIQUE Guillaume (Yomguithereal)
+;;   Source: https://gist.github.com/vishnuvyas/958488
+(defn levenshtein
+  "Compute the levenshtein distance (a.k.a edit distance) between two strings.
+  Informally, the Levenshtein distance between two words is the minimum number
+  of single-character edits (i.e. insertions, deletions or substitutions)
+  required to change one word into the other"
+  [str1 str2]
+  (let [first-row  (range (inc (count str2)))]
+    (peek (reduce #(next-row %1 %2 str2) first-row str1))))
+
+(defn clean-meta
+  "returns a hash-map with only these keys: :ns :name :doc :arglists
+  :file :line :macro and updates :ns to a string"
+  [m]
   (when m
     (-> m
         (select-keys [:ns :name :doc :arglists :file :line :macro])
@@ -19,7 +45,10 @@
 (defn str-contains? [orig search]
   (> (.indexOf orig search) -1))

-(defn format-result [m]
+(defn format-result
+  "Returns a hash-map with `:args` as the original `:arglists` value. `:args` is converted to
+  a string and dissociated from `:arglists`."
+  [m]
   (when m
     (-> m
         (assoc :args (-> m :arglists str))
@@ -34,16 +63,21 @@
         (dissoc :arglists)
         )))

-(defn find-doc [search]
-    (let [ms (concat (mapcat #(sort-by :name (map meta (vals (ns-interns %))))
-                             (all-ns)))]
-      (for [m ms
-              :when (and (:doc m)
-                         (not (:private m))
-                         (or (str-contains? (:doc m) search)
-                             (str-contains? (str (:ns m)) search)
-                             (str-contains? (str (:name m)) search)))]
-               (format-result (clean-meta m)))))
+(defn find-doc
+  "Look for a var with name `search` among all namespaces. Only public
+  vars with docstring are returned.
+
+  Returns a list of metadata (max 30) hash-maps sorted by their levenshtein
+  distance with the `search` input."
+  [search]
+  (let [with-dist  #(hash-map :dist (levenshtein search (str (:name %)))
+                              :meta %)
+        all-vars    (vals (apply merge (map ns-interns (all-ns))))
+        dist-metas  (into [] (comp (map meta) (filter :doc) (remove :private)
+                                   (map clean-meta) (map format-result)
+                                   (map with-dist))
+                            all-vars)]
+      (take 30 (map :meta (sort-by :dist dist-metas)))))

 (def jar-temp-files
   "Maps jar-url paths to temp files"


Using memoize (moderately)

Using memoize (moderately)

--- src/amindblowingworld/civs.clj
+++ src/amindblowingworld/civs.clj
@@ -94,9 +94,11 @@
         blue (int (mix-values (.getBlue a) (.getBlue b) f))]
     (Color. red green blue)))

-(defn adapt-color-to-elevation [color x y]
+(defn- adapt-color-to-elevation-real [color x y]
   (let [elevation (.get (.getElevation (get-world)) x y)]
     (mix-colors (Color. 255 255 255) color (altitude-color-factor elevation))))
+
+(def adapt-color-to-elevation (memoize adapt-color-to-elevation-real))

 (defn calc-biome-map [world]
   (let [ w (-> world .getDimension .getWidth)


NPs are {reflexive=false}

NPs are {reflexive=false}

--- src/babel/english/grammar.cljc
+++ src/babel/english/grammar.cljc
@@ -203,6 +203,7 @@
                            (let [propernoun (atom :top)
                                  head-sem (atom :top)]
                              {:synsem {:modified true
+                                       :reflexive false
                                        :propernoun propernoun}
                               :comp {:synsem {:cat :adjective
                                               :sem head-sem}}
@@ -221,6 +222,7 @@
                              {:rule "noun-phrase1"
                               :aliases (list "np1")
                               :synsem {:agr {:number number-agreement}
+                                       :reflexive false
                                        :cat :noun
                                        :propernoun propernoun
                                        :sem {:number number-agreement
@@ -235,6 +237,7 @@
                               :aliases (list "np2")
                               :synsem {:agr {:number number-agreement}
                                        :cat :noun
+                                       :reflexive false
                                        :propernoun propernoun
                                        :sem {:mod {:pred :top}
                                              :number number-agreement}}


add determiner-phrase: usage requires that determiners of NPs be able to be phrasal: see commit immediately prior

--- src/babel/english/grammar.cljc
+++ src/babel/english/grammar.cljc
@@ -145,6 +145,10 @@
                                               :modified true}] ;; TODO: document what purpose :modified serves (if any: if none, remove).
                              {:rule "intensifier-phrase"
                               :synsem head-synsem}))
+
+                   (unifyc c10
+                           {:rule "determiner-phrase"
+                            :synsem {:cat :det}})

                    (unifyc c11-comp-subcat-1
                            (let [propernoun (atom :top)


~vocab-entry-to-lexeme: if unification fails, log it and throw exception

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -731,6 +731,11 @@
                 (if structure (unify base-unify structure)
                     base-unify)]
             (log/debug (str "creating lexemes for surface: '" surface "' and with-structure: " with-structure))
+            (if (= :fail with-structure)
+              (let [message (str "fail to unify vocab-entry information: base-unify:" (u/strip-refs base-unify)
+                                        "; vocab structure:" structure)]
+                (log/error message)
+                (throw (Exception. message))))
             (cond
               (or (= vocab-cat "nounplurf")
                   (= vocab-cat "nounplurm")


fix possessive pronouns: they are {:sem {:of {:pred X}}}, not {:sem {:pred X}}

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -60,7 +60,8 @@
    {:synsem {:cat :det
              :def :indef
              :mass false
-             :sem {:pred :a-generic-instance-of}
+             :sem {:pred :a-generic-instance-of
+                   :of :none}
              :agr {:number :sing}}}

    "abandon" {:synsem {:cat :verb
@@ -874,15 +875,11 @@
    "her"
    [{:synsem {:cat :det
               :agr {:number :sing}
-              :sem {:pred :lei
-                    :gender :fem
-                    :number :sing}
+              :sem {:of {:pred :lei}}
               :def :possessive}}
     {:synsem {:cat :det
               :agr {:number :plur}
-              :sem {:pred :lei
-                    :gender :fem
-                    :number :sing}
+              :sem {:of {:pred :lei}}
               :def :possessive}}
     {:synsem {:cat :noun
               :pronoun true
@@ -929,17 +926,11 @@

    "his" [{:synsem {:cat :det
                     :agr {:number :sing}
-                    :sem {:pred :lui
-                          :human true
-                          :gender :masc
-                          :number :sing}
+                    :sem {:of {:pred :lui}}
                     :def :possessive}}
           {:synsem {:cat :det
                     :agr {:number :plur}
-                    :sem {:pred :lui
-                          :human true
-                          :gender :masc
-                          :number :sing}
+                    :sem {:of {:pred :lui}}
                     :def :possessive}}]

    "hit" {:english {:past "hit"}
@@ -1122,8 +1113,7 @@
               :agr {:person :3rd
                     :gender :masc
                     :number :sing}
-              :sem {:human false
-                    :pred :lui}
+              :sem {:human false}
               :subcat '()}}
     {:english {:note "♀"}
      :synsem {:cat :noun
@@ -1133,8 +1123,7 @@
               :agr {:person :3rd
                     :gender :fem
                     :number :sing}
-              :sem {:human false
-                    :pred :lei}
+              :sem {:human false}
               :subcat '()}}]

    "keep"
@@ -1319,9 +1308,7 @@
    "my"
    (map #(unify %
                 {:synsem {:cat :det
-                          :sem {:pred :I
-                                :human true
-                                :number :sing}
+                          :sem {:of {:pred :I}}
                           :def :possessive}})
         [{:synsem {:agr {:number :sing}}}
          {:synsem {:agr {:number :plur}}}])
@@ -1375,8 +1362,7 @@
    (map #(unify %
                 {:synsem {:cat :det
                           :agr {:gender :masc}
-                          :sem {:pred :noi
-                                :number :plur}
+                          :sem {:of {:pred :noi}}
                           :def :possessive}})
         [{:synsem {:agr {:number :sing}}}
          {:synsem {:agr {:number :plur}}}])
@@ -1656,11 +1642,13 @@
    "some"
    [{:synsem {:cat :det
               :def :partitivo
-              :sem {:pred :some-of}
+              :sem {:pred :some-of
+                    :of :none}
               :agr {:number :plur}}}
     {:synsem {:cat :det
               :def :indef
-              :sem {:pred :some-one-of}
+              :sem {:pred :some-one-of
+                    :of :none}
               :agr {:number :sing}}}]
    "speak"
    {:english {:past "spoke"
@@ -1778,12 +1766,14 @@
            ;; "that" as in "that woman"
            {:synsem {:cat :det
                      :agr {:number :sing}
-                     :sem {:pred :demonstrative}
+                     :sem {:pred :demonstrative
+                           :of :none}
                      :def :def}}]

    "the" (map #(unify %
                       {:synsem {:cat :det
-                                :sem {:pred :definite}
+                                :sem {:pred :definite
+                                      :of :none}
                                 :def :def}})
               [{:synsem {:agr {:number :sing}}}
                {:synsem {:agr {:number :plur}}}])
@@ -1791,8 +1781,7 @@
    "their"
    (map #(unify %
                 {:synsem {:cat :det
-                          :sem {:pred :loro
-                                :number :plur}
+                          :sem {:of {:pred :loro}}
                           :def :possessive}})
         [{:synsem {:agr {:number :sing}}}
          {:synsem {:agr {:number :plur}}}])
@@ -1883,7 +1872,8 @@
                                         :3 '()}}})])
    "those" {:synsem {:cat :det
                      :agr {:number :plur}
-                     :sem {:pred :demonstrative}
+                     :sem {:pred :demonstrative
+                           :of :none}
                      :def :def}}

    "throw" {:english {:past "threw"}
@@ -2133,7 +2123,7 @@
    "your"
    (map #(unify %
                 {:synsem {:cat :det
-                          :sem {:pred :tu}
+                          :sem {:of {:pred :tu}}
                           :def :possessive}})
         [{:synsem {:agr {:number :sing}}}
          {:synsem {:agr {:number :plur}}}])


added arrabbiarsi

added arrabbiarsi

--- src/babel/italiano/lexicon.clj
+++ src/babel/italiano/lexicon.clj
@@ -250,6 +250,21 @@
    "approvare" {:synsem {:cat :verb
                          :sem {:pred :approve}}}

+   "arrabbiarsi" (let [subject-semantics (ref {:animate true})
+                   subject-agr (ref :top)]
+               {:synsem {:cat :verb
+                         :essere true
+                         :sem {:pred :get-angry
+                               :reflexive true
+                               :subj subject-semantics
+                               :obj subject-semantics}
+                         :subcat {:1 {:agr subject-agr
+                                      :sem subject-semantics}
+                                  :2 {:agr subject-agr
+                                      :pronoun true
+                                      :reflexive true
+                                      :sem subject-semantics}}}})
+
    "ascoltare"  {:synsem {:cat :verb
                           :sem {:pred :listen-to}}}


Change fn name make-attr -> when-v-attr in wpml

--- src/bakyeono/litedocx/wpml.clj
+++ src/bakyeono/litedocx/wpml.clj
@@ -161,7 +161,7 @@
   (if (nil? v) nil
     [k v]))

-(defn make-attrs
+(defn when-v-attrs
   "Returns an XML tag attributes without nil values."
   [& kvs]
   (into {}
@@ -364,15 +364,15 @@
           (node :w:wordWrap {:w:val true}))
         (when (or space-before space-after space-line)
           ;; Spacing Between Lines and Above/Below Paragraph
-          (node :w:spacing (make-attrs :w:before space-before ; Spacing Above Paragraph
-                                       :w:after space-after ; Spacing Below Paragraph
-                                       :w:line space-line ; Spacing Between Lines in Paragraph
-                                       :w:lineRule "auto"))) ; Type of Spacing Between Lines
+          (node :w:spacing (when-v-attrs :w:before space-before ; Spacing Above Paragraph
+                                         :w:after space-after ; Spacing Below Paragraph
+                                         :w:line space-line ; Spacing Between Lines in Paragraph
+                                         :w:lineRule "auto"))) ; Type of Spacing Between Lines
         (when (or indent-left indent-right indent-first-line)
           ;; Paragraph Indentation
-          (node :w:ind (make-attrs :w:left indent-left ; Left Indentation
-                                   :w:right indent-right ; Right Indentation
-                                   :w:firstLine indent-first-line))) ; Additional First Line Indentation
+          (node :w:ind (when-v-attrs :w:left indent-left ; Left Indentation
+                                     :w:right indent-right ; Right Indentation
+                                     :w:firstLine indent-first-line))) ; Additional First Line Indentation
         (when mirror-indents?
           ;; Use Left/Right Indents as Inside/Outside Indents
           (node :w:mirrorIndents))


start adding side bar to accounts pages

start adding side bar to accounts pages

--- src/clj_money/web/accounts.clj
+++ src/clj_money/web/accounts.clj
@@ -13,7 +13,7 @@
             [clj-money.models.accounts :as accounts]
             [clj-money.models.transactions :as transactions]
             [clj-money.schema :as schema]
-            [clj-money.web.money-shared :refer [account-options]])
+            [clj-money.web.money-shared :refer [account-options budget-monitors]])
   (:use [clj-money.web.shared :refer :all]))

 (defn- account-row
@@ -77,9 +77,8 @@
   ([entity-id] (index entity-id {}))
   ([entity-id options]
    (layout
-     "Accounts" options
-     [:div.row
-      [:div.col-md-6
+     "Accounts" (assoc options :side-bar (budget-monitors entity-id))
+     (html
        [:table.table.table-striped
         [:tr
          [:th.col-sm-6 "Name"]
@@ -90,7 +89,7 @@
        [:a.btn.btn-primary
         {:href (format "/entities/%s/accounts/new" entity-id)
          :title "Click here to add a new account."}
-        "Add"]]])))
+        "Add"]))))

 (defn- transaction-item-row
   [{:keys [transaction-id
@@ -130,9 +129,9 @@
   ([id options]
    (let [account (accounts/find-by-id (env :db) id)]
      (layout
-       (format "Account - %s" (:name account)) options
-       [:div.row
-        [:div.col-md-6
+       (format "Account - %s" (:name account))
+       (assoc options :side-bar (budget-monitors (:entity-id account)))
+       (html
          [:table.table.table-striped.table-hover
           [:tr
            [:th.text-right "Date"]
@@ -151,7 +150,7 @@
           "Add"]
          " "
          [:a.btn.btn-default {:href (format "/entities/%s/accounts" (:entity-id account))}
-          "Back"]]]))))
+          "Back"])))))

 (defn- form-fields
   "Renders the form fields for an account"


edit closing works + better comments + bugfix

bugfix: undo 660baf0 basically. We do need to push the gmark text to
component state

--- src/cljs/greffe/doc_comps.cljs
+++ src/cljs/greffe/doc_comps.cljs
@@ -117,26 +117,36 @@
              (dom/div #js {:className "controls"}
                (dom/a #js {:onClick
                            (fn [ev]
-                             (if-not (om/get-state owner :editText)
+                              (om/set-state! owner
+                                  :editContent (gm/to-gmark @elem tei))
+                             (if (om/get-state owner :editText)
+
+                               ;; we are going to close the edit box,
+                               ;; so we quit listening to edit events
+                               (unsub
+                                 (:notif-chan (om/get-shared owner))
+                                 :open-edit
+                                 (om/get-state owner :local-edit-chan))
+
+                               ;; we are going to open the edit box,
+                               ;; so we start listening for other edit
+                               ;; events and we tell the other edit
+                               ;; boxes that we are opening. The uuid
+                               ;; ensures that we don't listen to ourselves.
                                (let [uuid  (om/get-state owner :uuid)
                                      listening (sub
                                                  (:notif-chan (om/get-shared owner))
                                                  :open-edit (om/get-state owner :local-edit-chan))]
                                 (put! (:pub-chan (om/get-shared owner))
                                   {:topic :open-edit
-                                   :message "Opening!"
+                                   :message :open
                                    :uuid uuid})
                                 (go-loop []
                                   (let [msg (<! listening)]
                                     (when-not (= uuid (:uuid msg))
-                                      (.log js/console (:message msg)))
+                                      (om/set-state! owner :editText false))
                                     (recur)))
-                                (om/set-state! owner
-                                  :editContent (gm/to-gmark @elem tei)))
-                               (unsub
-                                 (:notif-chan (om/get-shared owner))
-                                 :open-edit
-                                 (om/get-state owner :local-edit-chan)))
+                               ))
                              (om/set-state!
                                owner
                                :editText


Resolve different attribute setters when binding elements.

--- src/clojure/freactive/dom.cljs
+++ src/clojure/freactive/dom.cljs
@@ -305,6 +305,18 @@
                                    attr-value node-state)
         (set-fn element attr-name attr-value)))

+(defn get-attr-setter [element attr-name]
+  (cond
+   (identical? "data-state" attr-name)
+   set-data-state!
+
+   (and (identical? (. element -type) "checkbox") (identical? attr-name "checked"))
+   (fn [node attr-name attr-value]
+     (set! (. node -checked) (true? attr-value)))
+
+   :default
+   set-attr!))
+
 (defn bind-attr! [element attr-name attr-value node-state]
   (let [attr-name (name attr-name)]
     (cond
@@ -314,14 +326,12 @@
         (doseq [[p v] attr-value]
           (bind-style-prop! element p v node-state)))

-      (identical? "data-state" attr-name)
-      (bind-prop-attr! set-data-state! element attr-name attr-value node-state)
-
       (identical? 0 (.indexOf attr-name "on-"))
       (listen! element (.substring attr-name 3) attr-value)

       :default
-      (bind-prop-attr! set-attr! element attr-name attr-value node-state))))
+      (bind-prop-attr! (get-attr-setter element attr-name)
+                       element attr-name attr-value node-state))))

 (defn- unbind-attr!* [node-state prefix attr-name]
   (let [attr-key (str "-" prefix attr-name)]


Remove accidental require statement

Remove accidental require statement

See clojure-android/lein-droid#115

--- src/clojure/neko/ui/traits.clj
+++ src/clojure/neko/ui/traits.clj
@@ -140,7 +140,7 @@
 (deftrait :text
   "Sets widget's text to a string, integer ID or a keyword
   representing the string resource provided to `:text` attribute."
-  [^TextView wdg, {:keys [text]} _]
+  [^TextView wdg, {:keys [text] :or {text ""}} _]
   (.setText wdg ^CharSequence (res/get-string text)))

 (defn- kw->unit-id [unit-kw]
@@ -159,8 +159,6 @@
    "Returns Android's DisplayMetrics object from application context."
    [^Context context]
    (.. context (getResources) (getDisplayMetrics))))
-
-(require 'neko.activity)

 (defn to-dimension [context value]
   (if (vector? value)


[l.d.compile] Bring back shutdown-agents that were accidentally removed

--- src/leiningen/droid/compile.clj
+++ src/leiningen/droid/compile.clj
@@ -173,11 +173,13 @@
                          ~'clojure.core/*compiler-options* ~opts]
                  (doseq [namespace# '~nses]
                    (println "Compiling" namespace#)
-                   (clojure.core/compile namespace#))))
+                   (clojure.core/compile namespace#))
+                 (shutdown-agents)))
             `(binding [*compiler-options* ~opts]
                (doseq [namespace# '~nses]
                  (println "Compiling" namespace#)
-                 (clojure.core/compile namespace#))))]
+                 (clojure.core/compile namespace#))
+               (shutdown-agents)))]
       (.mkdirs (io/file (:compile-path project)))
       (try (eval-in-project project form)
            (info "Compilation succeeded.")


got rid of unnecessary reduce

got rid of unnecessary reduce

--- pigpen-cascading/src/main/clojure/pigpen/cascading.clj
+++ pigpen-cascading/src/main/clojure/pigpen/cascading.clj
@@ -18,10 +18,10 @@
           identity)

 (defmethod get-tap-fn :string [_]
-           (fn [location] (Hfs. (TextLine.) location)))
+  (fn [location] (Hfs. (TextLine.) location)))

 (defmethod get-tap-fn :default [_]
-           (throw (Exception. (str "Unrecognized tap type: " name))))
+  (throw (Exception. (str "Unrecognized tap type: " name))))

 (defn load-text [location]
   (-> (raw/load$ location '[offset line] :string {})))
@@ -110,21 +110,20 @@

 (defmethod command->flowdef :generate
            [{:keys [id ancestors projections field-projections opts]} flowdef]
-  {:pre [id ancestors (not-empty projections)]}
-  (let [new-flowdef (reduce (fn [def ancestor]
-                              (cond (contains? (:sources def) ancestor) (let [pipe (Pipe. (str id))]
-                                                                          (-> def
-                                                                              (update-in [:pipe-to-source] (partial merge {id ancestor}))
-                                                                              (update-in [:pipes] (partial merge {id pipe}))))
-                                    (contains? (:pipes def) ancestor) (let [pipe ((:pipes def) ancestor)]
-                                                                        (-> def
-                                                                            (update-in [:pipes] (partial merge {id (Pipe. (str id) pipe)}))))
-                                    :else (do
-                                            (println "flowdef" flowdef)
-                                            (println "id" id)
-                                            (println "ancestors" ancestors)
-                                            (throw (Exception. "not implemented")))))
-                            flowdef ancestors)
+  {:pre [id (= 1 (count ancestors)) (not-empty projections)]}
+  (let [ancestor (first ancestors)
+        new-flowdef (cond (contains? (:sources flowdef) ancestor) (let [pipe (Pipe. (str id))]
+                                                                (-> flowdef
+                                                                    (update-in [:pipe-to-source] (partial merge {id ancestor}))
+                                                                    (update-in [:pipes] (partial merge {id pipe}))))
+                          (contains? (:pipes flowdef) ancestor) (let [pipe ((:pipes flowdef) ancestor)]
+                                                              (-> flowdef
+                                                                  (update-in [:pipes] (partial merge {id (Pipe. (str id) pipe)}))))
+                          :else (do
+                                  (println "flowdef" flowdef)
+                                  (println "id" id)
+                                  (println "ancestors" ancestors)
+                                  (throw (Exception. "not implemented"))))
         flat-projections (filter #(= :projection-flat (:type %)) projections)
         new-flowdef (reduce (fn [def cmd] (command->flowdef (assoc cmd :pipe id :field-projections field-projections) def))
                             new-flowdef


change message in manual trigger, don't update it all the time

--- src/lambdacd/manualtrigger.clj
+++ src/lambdacd/manualtrigger.clj
@@ -13,8 +13,8 @@
   (get @ids-posted-to id))

 (defn- wait-for-trigger [id ctx]
+  (execution/send-output ctx :out (str "Waiting for manual trigger... nothing to see here"))
   (loop []
-    (execution/send-output ctx :out (str "Waiting for trigger, timestamp:" (System/currentTimeMillis)))
     (let [trigger-parameters (was-posted? id)]
       (if @(:is-killed ctx)
         (do


Remove unused leiningen build parser task

--- src/leiningen/build_parser.clj
+++ src/leiningen/build_parser.clj
@@ -1,9 +0,0 @@
-;(ns leiningen.build-parser
-;  (:use [clojure.contrib.shell-out]
-;        [clojure.java.io :only [copy file]]
-;        ))
-;
-;(defn build-parser [project]
-;  (prn (sh "java" "-cp" "lib/*" "org.antlr.Tool" "src/riemann/Query.g"
-;      :dir (:root project)))
-;~  (.delete (file (:root project) "Query.tokens")))


Require unit test ns by default

Require unit test ns by default

Because it seems to be where everything I'm actually doing revolves around

--- dev/dev.clj
+++ dev/dev.clj
@@ -16,6 +16,11 @@
             [com.frereth.common.system :as sys]
             [com.frereth.common.util :as util]
             [ribol.core :refer (raise)]))
+
+;; Because this seems to be the only namespace I ever actually
+;; use in here, and I'm tired of typing it out because it's
+;; ridiculously long
+(require '[com.frereth.common.async-zmq-test :as azt])

 (def system nil)


Bump cheshire in boot/worker to 5.6.0

Bump cheshire in boot/worker to 5.6.0

This forces the jackson.databind transitive dependency to be bumped
up to 2.6, in order to fix compatability issues with s3-wagon-private.

--- boot/worker/project.clj
+++ boot/worker/project.clj
@@ -22,7 +22,7 @@
                  [net.cgrand/parsley          "0.9.3" :exclusions [org.clojure/clojure]]
                  [mvxcvi/puget                "1.0.1"]
                  [reply                       "0.3.7"]
-                 [cheshire                    "5.3.1"]
+                 [cheshire                    "5.6.0"]
                  [clj-jgit                    "0.8.0"]
                  [clj-yaml                    "0.4.0"]
                  [javazoom/jlayer             "1.0.1"]


fix pseudo npm resource generator

fix pseudo npm resource generator

--- src/main/shadow/cljs/build.clj
+++ src/main/shadow/cljs/build.clj
@@ -215,7 +215,7 @@
         ))))

 (defn update-rc-from-ns
-  [state rc {:keys [name require-order js-requires] :as ast}]
+  [state rc {:keys [name require-order js-ns-aliases] :as ast}]
   {:pre [(util/compiler-state? state)]}
   (assoc rc
     :ns name
@@ -223,7 +223,7 @@
     :provides #{name}
     :macro-namespaces (macros-from-ns-ast state ast)
     :requires (into #{} require-order)
-    :js-requires js-requires
+    :js-ns-aliases js-ns-aliases
     :require-order require-order))

 (defn js-resolver-for-file [state file]
@@ -1506,8 +1506,8 @@
               (map :js-ns-aliases)
               (reduce merge {}))]
      (generate-npm-resources state js-ns-aliases)))
-  ([state js-requires]
-   (reduce-kv generate-npm-resource state js-requires)))
+  ([state js-ns-requires]
+   (reduce-kv generate-npm-resource state js-ns-requires)))

 (defn make-provide-index [state]
   (let [idx


only page in new results when in steady-state

--- src/chat/client/views/pages/channel.cljs
+++ src/chat/client/views/pages/channel.cljs
@@ -63,7 +63,7 @@
                               :ref "threads-div"
                               :onScroll (fn [e]
                                           (let [div (.. e -target)]
-                                            (when (and (not loading?)
+                                            (when (and (= status :done-results)
                                                     (> (store/pagination-remaining) 0)
                                                     (> 100 (- (.-scrollWidth div)
                                                               (+ (.-scrollLeft div) (.-offsetWidth div)))))


Finish implementation of get-image-data

Finish implementation of get-image-data

--- src/clj/comic_reader/sites/manga_fox.clj
+++ src/clj/comic_reader/sites/manga_fox.clj
@@ -151,9 +151,6 @@
 ;; ## Get Page List functions
 ;; ############################################################

-(defn extract-image-tag [html]
-  (scrape/extract-image-tag html (image-selector)))
-
 (defn gen-extract-pages-list-normalize [base-url]
   (util/html-fn {[name] :content}
     (if-let [page-number (re-find (page-normalize-pattern)
@@ -183,5 +180,10 @@
 ;; ## Get Image Data functions
 ;; ############################################################

-(defn get-image-data [comic-id chapter page]
-  [])
+(defn extract-image-tag [html]
+  (scrape/extract-image-tag html (image-selector)))
+
+(defn get-image-data [{page-url :url}]
+  (-> page-url
+      scrape/fetch-url
+      extract-image-tag))


(TK-27) Modify create-client function

(TK-27) Modify create-client function

Modify create-client function in async.clj to now return a new
client wrapped in the async-client protocol. Make create-client
public. Modify request to make a default client if none is
provided to support these changes.

--- src/clj/puppetlabs/http/client/async.clj
+++ src/clj/puppetlabs/http/client/async.clj
@@ -35,14 +35,15 @@
 ;;; Async Client protocol

 (defprotocol async-client
-  (get [url] [url opts])
-  (head [url] [url opts])
-  (post [url] [url opts])
-  (put [url] [url opts])
-  (delete [url] [url opts])
-  (trace [url] [url opts])
-  (options [url] [url opts])
-  (patch [url] [url opts]))
+  (get [this url] [this url opts])
+  (head [this url] [this url opts])
+  (post [this url] [this url opts])
+  (put [this url] [this url opts])
+  (delete [this url] [this url opts])
+  (trace [this url] [this url opts])
+  (options [this url] [this url opts])
+  (patch [this url] [this url opts])
+  (close [this]))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Private SSL configuration functions
@@ -239,12 +240,18 @@
   [opts :- schemas/UserRequestOptions]
   (select-keys opts [:ssl-context :ssl-ca-cert :ssl-cert :ssl-key]))

-(schema/defn create-client :- schemas/Client
-  [opts :- schemas/ClientOptions]
-  (let [opts    (configure-ssl opts)
-        client  (if (:ssl-context opts)
-                  (.. (HttpAsyncClients/custom) (setSSLContext (:ssl-context opts)) build)
-                  (HttpAsyncClients/createDefault))]
+(schema/defn create-default-client :- schemas/Client
+  [opts :- schemas/RawUserRequestOptions]
+  (let [defaults        {:headers         {}
+                         :body            nil
+                         :decompress-body true
+                         :as              :stream}
+        opts            (merge defaults opts)
+        client-opts     (extract-client-opts opts)
+        configured-opts (configure-ssl client-opts)
+        client          (if (:ssl-context configured-opts)
+                          (.. (HttpAsyncClients/custom) (setSSLContext (:ssl-context configured-opts)) build)
+                          (HttpAsyncClients/createDefault))]
     (.start client)
     client))

@@ -285,13 +292,16 @@
    (request opts nil))
   ([opts :- schemas/RawUserRequestOptions
     callback :- schemas/ResponseCallbackFn]
+   (let [client (create-default-client opts)]
+     (request opts callback client)))
+  ([opts :- schemas/RawUserRequestOptions
+    callback :- schemas/ResponseCallbackFn
+    client :- schemas/Client]
    (let [defaults {:headers         {}
                    :body            nil
                    :decompress-body true
                    :as              :stream}
          opts (merge defaults opts)
-         client-opts (extract-client-opts opts)
-         client (create-client client-opts)
          {:keys [method url body] :as coerced-opts} (coerce-opts opts)
          request (construct-request method url)
          result (promise)]
@@ -302,6 +312,32 @@
                (future-callback client result opts callback))
      result)))

+(schema/defn create-client :- async-client
+  [opts :- schemas/ClientOptions]
+  (let [opts    (configure-ssl opts)
+        client  (if (:ssl-context opts)
+                  (.. (HttpAsyncClients/custom) (setSSLContext (:ssl-context opts)) build)
+                  (HttpAsyncClients/createDefault))]
+    (.start client)
+    (reify async-client
+      (get [_ url] (get url {}))
+      (get [_ url opts] (request (assoc opts :method :get :url url) nil client))
+      (head [_ url] (head url {}))
+      (head [_ url opts] (request (assoc opts :method :head :url url) nil client))
+      (post [_ url] (post url {}))
+      (post [_ url opts] (request (assoc opts :method :post :url url) nil client))
+      (put [_ url] (put url {}))
+      (put [_ url opts] (request (assoc opts :method :put :url url) nil client))
+      (delete [_ url] (delete url {}))
+      (delete [_ url opts] (request (assoc opts :method :delete :url url) nil client))
+      (trace [_ url] (trace url {}))
+      (trace [_ url opts] (request (assoc opts :method :trace :url url) nil client))
+      (options [_ url] (options url {}))
+      (options [_ url opts] (request (assoc opts :method :options :url url) nil client))
+      (patch [_ url] (patch url {}))
+      (patch [_ url opts] (request (assoc opts :method :patch :url url) nil client))
+      (close [_] (.close client)))))
+
 (defn get
   "Issue an asynchronous HTTP GET request. This will raise an exception if an
   error is returned."


Invert :silent for autoconstruction

Invert :silent for autoconstruction

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -770,18 +770,20 @@
                    (some #{instruction}
                          '(a0 a1 a2 d0 d1 d2 d3 d4 d5 d6 d7)))))] ;; from mux problems
     (mapv (fn [instruction-map]
-            (cond
-              (input-instruction? (:instruction instruction-map))
-              (assoc instruction-map :instruction 'code_noop)
-              ;
-              (= (:instruction instruction-map) 'autoconstructive_integer_rand)
-              (assoc instruction-map :instruction 'integer_rand)
-              ;
-              (= (:instruction instruction-map) 'autoconstructive_boolean_rand)
-              (assoc instruction-map :instruction 'boolean_rand)
-              ;
-              :else
-              instruction-map))
+            (assoc (cond
+                     (input-instruction? (:instruction instruction-map))
+                     (assoc instruction-map :instruction 'code_noop)
+                     ;
+                     (= (:instruction instruction-map) 'autoconstructive_integer_rand)
+                     (assoc instruction-map :instruction 'integer_rand)
+                     ;
+                     (= (:instruction instruction-map) 'autoconstructive_boolean_rand)
+                     (assoc instruction-map :instruction 'boolean_rand)
+                     ;
+                     :else
+                     instruction-map)
+              :silent
+              (not (:silent instruction-map))))
          genome)))

 (defn produce-child-genome-by-autoconstruction


Changed process-genome-for-autoconstruction to return genome as vector.

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -250,21 +250,21 @@
                                       (re-seq #"in_dm" (name instruction)) ;; from digital-multiplier
                                       (some #{instruction}
                                             '(a0 a1 a2 d0 d1 d2 d3 d4 d5 d6 d7)))))] ;; from mux problems
-    (map (fn [instruction-map]
-           (if (input-instruction? (:instruction instruction-map))
-             (assoc instruction-map :instruction 'code_noop)
-             (if deterministic?
-               (if (some #{(:instruction instruction-map)}
-                          '(boolean_rand integer_rand float_rand code_rand
-                                         string_rand char_rand
-                                         genome_gene_randomize))
-                 (assoc instruction-map :instruction 'code_noop)
-                 instruction-map)
-               (if (= (:instruction instruction-map) 'autoconstructive_integer_rand)
-                 (assoc instruction-map :instruction 'integer_rand)
-                 (if (= (:instruction instruction-map) 'autoconstructive_boolean_rand)
-                   (assoc instruction-map :instruction 'boolean_rand)
-                   instruction-map)))))
+    (mapv (fn [instruction-map]
+            (if (input-instruction? (:instruction instruction-map))
+              (assoc instruction-map :instruction 'code_noop)
+              (if deterministic?
+                (if (some #{(:instruction instruction-map)}
+                           '(boolean_rand integer_rand float_rand code_rand
+                                          string_rand char_rand
+                                          genome_gene_randomize))
+                  (assoc instruction-map :instruction 'code_noop)
+                  instruction-map)
+                (if (= (:instruction instruction-map) 'autoconstructive_integer_rand)
+                  (assoc instruction-map :instruction 'integer_rand)
+                  (if (= (:instruction instruction-map) 'autoconstructive_boolean_rand)
+                    (assoc instruction-map :instruction 'boolean_rand)
+                    instruction-map)))))
          genome)))

 (defn produce-child-genome-by-autoconstruction


Cope with nils in comparisons

Cope with nils in comparisons

--- src/tick/core.clj
+++ src/tick/core.clj
@@ -233,8 +233,8 @@
   (duration [i1 i2]
     (Duration/between (instant i1) (instant i2))))

-(definline < [x y] `(.isBefore ~x ~y))
-(definline > [x y] `(.isAfter ~x ~y))
+(definline < [x y] `(.isBefore (or ~x (epoch)) (or~y (epoch))))
+(definline > [x y] `(.isAfter (or ~x (epoch)) (or ~y (epoch))))

 (defprotocol ITimeArithmetic
   (+ [_ _] "Add time")


Revert "Add a flip function."

Revert "Add a flip function."

This reverts commit 9b7e49875fb58fe1d744e31f38e75966f348cc71.

--- src/useful/fn.clj
+++ src/useful/fn.clj
@@ -103,8 +103,3 @@
        (condp #(% %2) direction
          #{:desc :descending -} (comp - f)
          #{:asc :ascending +} f))))
-
-(defn flip
-  "Create a function that applies f to its arguments reversed, 'flipping'
-   the argument order."
-  [f] #(apply f (reverse %&)))


Refactor remote playback

Refactor remote playback

--- src/clojure/uk/org/potentialdifference/darknet/main.clj
+++ src/clojure/uk/org/potentialdifference/darknet/main.clj
@@ -190,19 +190,16 @@
     (doto view
       (.setLayoutParams params))))

-(defn set-image-bitmap! [view bytes]
-  (let [bitmap (BitmapFactory/decodeByteArray bytes
-                                              0
-                                              (count bytes))]
-    (on-ui
-        (.setImageBitmap view bitmap))))
-
-(defn image-from-uri [activity uri]
+(defn image-from-url [activity url]
   (let [view (ImageView. activity)]
     (fit-linear-layout! view)
     (let [f (fn [bytes]
-              (set-image-bitmap! view bytes))]
-      (server/get-bytes uri f))
+              (let [bitmap (BitmapFactory/decodeByteArray bytes
+                                                          0
+                                                          (count bytes))]
+                (on-ui
+                    (.setImageBitmap view bitmap))))]
+      (server/get-bytes url f))
     view))

 (defn image-from-path [activity path]
@@ -210,15 +207,6 @@
     (fit-linear-layout!)
     (.setImageBitmap (BitmapFactory/decodeFile path))))

-(defn view-image [activity intruction]
-  (on-ui
-      (replace-view! activity
-                     (make-ui activity
-                              [:linear-layout {:background-color Color/BLACK
-                                               :gravity Gravity/CENTER}
-                               (image-from-uri activity
-                                               "http://whyquit.com/freedom/ImageLibrary/Frogs/frog32.jpg")]))))
-
 (defn default-view [activity]
   (replace-view! activity
                  (make-ui activity
@@ -227,7 +215,7 @@
 (defn setVideoSource [video source]
   (log/i "darknet setting video source" source)
   (if (.startsWith source "http")
-    (.setVideoUri video (Uri/parse source))
+    (.setVideoURI video (Uri/parse source))
     (.setVideoPath video source)))

 (defn setup-video-view [view activity path]
@@ -264,6 +252,12 @@
         "image" (layout activity (image-from-path activity path))
         "video" (layout activity (video-from-path activity path))))))

+(defn view-remote [activity instruction]
+  (when-let [url (:url instruction)]
+    (case (:type instruction)
+      "image" (layout activity (image-from-url activity url))
+      "video" (layout activity (video-from-path activity url)))))
+
 (defn swap-view! [activity view]
   (replace-view! activity view))

@@ -275,13 +269,15 @@
     (.superOnCreate this bundle)
     (let [on-message (fn [str]
                        (let [instruction (->instruction str)]
+                         (log/i "darknet" instruction)
                          (case (:message instruction)
                            "startCameraStream" (do (log/i "startCameraStream " instruction)
                                                    (camera-view this instruction))
                            "streamVideo" (stream-view this instruction)
-                           "displayImage" (view-image this instruction)
+                           ;; "displayImage" (view-image this instruction)
                            ;; "viewVideo" (view-video this instruction)
                            "save" (save-local! this instruction)
+                           "viewRemote" (on-ui (swap-view! this (view-remote this instruction)))
                            "viewLocal" (on-ui (swap-view! this (view-local this instruction)))
                            "stop" (default-view this)
                            :default)))


conciseness

conciseness

--- src/org/spootnik/fleet/http.clj
+++ src/org/spootnik/fleet/http.clj
@@ -93,9 +93,7 @@
   [{:keys [origins] :or {origins []}}]
   (let [patterns (mapv re-pattern origins)]
     (fn [origin]
-      (if (nil? origin)
-        false
-        (some #(re-find % origin) patterns)))))
+      (and origin (some #(re-find % origin) patterns)))))

 (defn start-http
   [scenarios engine opts]


Switch trace panel back to showing ms

Switch trace panel back to showing ms

--- src/day8/re_frame/trace/view/traces.cljs
+++ src/day8/re_frame/trace/view/traces.cljs
@@ -65,8 +65,7 @@
                                         (str/join ", ")
                                         (pp/truncate-string :middle 40)))]]]
                               [:td.trace--meta
-                               id
-                               #_ #_(.toFixed duration 1) " ms"]]
+                               (.toFixed duration 1) " ms"]]
                              (when show-row?
                                [:tr.trace--details {:key       (str id "-details")
                                                     :tab-index 0}


remove trailing newline

remove trailing newline

--- src/open_company/api/common.clj
+++ src/open_company/api/common.clj
@@ -183,4 +183,4 @@

 (def open-company-anonymous-resource (merge open-company-resource anonymous-resource))

-(def open-company-authenticated-resource (merge open-company-resource authenticated-resource))+(def open-company-authenticated-resource (merge open-company-resource authenticated-resource))


Print job validation to stderr, fixes #614

--- src/onyx/static/validation.clj
+++ src/onyx/static/validation.clj
@@ -417,10 +417,11 @@

 (defn validate-job
   [job]
-  (validate-job-schema job)
-  (validate-catalog job)
-  (validate-lifecycles job)
-  (validate-workflow job)
-  (validate-flow-conditions job)
-  (validate-windows job)
-  (validate-triggers job))
+  (binding [*out* *err*]
+    (validate-job-schema job)
+    (validate-catalog job)
+    (validate-lifecycles job)
+    (validate-workflow job)
+    (validate-flow-conditions job)
+    (validate-windows job)
+    (validate-triggers job)))


system playground improved

system playground improved

--- playground/aug.clj
+++ playground/aug.clj
@@ -1,23 +1,8 @@
-(ns aug)
-
-(defprotocol ISystem
-  (start [this]
-    "Starts the system.")
-
-  (stop  [this]
-    "stops the system")
-
-  (restart [this]
-    "Restarts the system")
-
-  (components [this]
-    "Returns a hashmap of all the components defined in the system")
-
-  (get-component [this component-name]
-    "Return the instance of the component with the given name")
-
-  (update! [this key value]
-    "Updates the system with given value under the given key"))
+(ns aug
+  (:require [clojure.spec.alpha :as s])
+  (:import (clojure.lang IPersistentMap
+                         PersistentArrayMap
+                         ISeq)))

@@ -32,13 +17,15 @@
   (started? [component]
     "Returns a `true` if component started and `false` otherwise.")

+  (get-name [component]
+    "Returns the name of the component.")
+
   (dependencies [component]
     "Returns a vector of dependency names."))

-
 (extend-protocol IComponent
-  clojure.lang.PersistentArrayMap
+  PersistentArrayMap
   (start! [this context]
     (let [start-fn (::start-fn this)]
       (start-fn this context)))
@@ -49,6 +36,9 @@

   (started? [this]
     (or (::started? this) false))
+
+  (get-name [this]
+    (::name this))

   (dependencies [this]
     (::depends-on this)))
@@ -63,6 +53,9 @@
 (def example-system
   {:components [example-component]})

+;; Default system atom
+(def system (atom {}))
+

 (s/fdef get-components
@@ -70,17 +63,40 @@
         :ret vector?
         :fn #(= (:ret %) (-> :args :system :components)))

-(defn get-components
+(defn ^ISeq get-components
   "Returns the components catalog of the given `system`."
-  [system]
+  [^IPersistentMap system]
   (:components system))

-;; Default system atom
-(def system (atom {}))
+
+
+(defn conform-component
+  [component]
+  (if (satisfies? IComponent component)
+    [(get-name component) component]
+    ;; Throw if component didn't satisfy the protocol.
+    (ex-info "Provided component does not satisfies `IComponent` protocol."
+             {:cause component})))
+
+(defn ^IPersistentMap components-map
+  [^IPersistentMap system-map]
+  (into {} (map conform-component
+                (get-components system-map))))

 (defn set-system!
-  [system-map]
-  (reset! system system-map))
+  "Sets the system of HellHound."
+  [^IPersistentMap system-map]
+  (reset! system (merge system-map
+                        {:components (components-map system-map)})))
+
+
+
+
+
+
+
+
+

 (defn update-system-components!
   [components]
@@ -98,7 +114,7 @@
   (components [this]
     (get-components this))

-  (get-component [this component-name]
+  (get-component [this component-name]'
     (component-name (components this)))

   clojure.lang.Atom


Can't remember what this is for

Can't remember what this is for

--- dev/user.clj
+++ dev/user.clj
@@ -1,8 +0,0 @@
-(ns user
-  (:require immutant.web
-            immutant.cache
-            immutant.daemons
-            immutant.jobs
-            immutant.messaging
-            immutant.xa))
-


Fix #2

Fix #2

By banning c.c/load!

--- src/oxcart/passes/warnings.clj
+++ src/oxcart/passes/warnings.clj
@@ -29,6 +29,7 @@
   failures should be reported before compilation is aborted."

   #{#'clojure.core/eval
+    #'clojure.core/load
     #'clojure.core/read-string
     #'clojure.core/alter-var-root})


Add warning if ws-host and window.location.hostname are empty

--- src/adzerk/boot_reload/client.cljs
+++ src/adzerk/boot_reload/client.cljs
@@ -21,7 +21,12 @@
 (defn resolve-url [url ws-host]
   (let [passed-uri (Uri. url)
         protocol   (.getScheme passed-uri)
-        host       (or ws-host (.-hostname (.-location js/window)))
+        host       (or ws-host
+                       (.-hostname (.-location js/window))
+                       (do (js/console.log "Both :ws-host and window.location.hostname are empty."
+                                           "This might happen if you are accessing the files directly instead of over http."
+                                           "You should probably set :ws-host manually.")
+                           nil))
         port       (.getPort passed-uri)]
     (str protocol "://" host ":" port)))


Fix key names for DynamoDB vs API schema

--- src/rsvp_backend/db/invitee.clj
+++ src/rsvp_backend/db/invitee.clj
@@ -12,18 +12,18 @@

 (defn create-invitee
   "Add a new invitee to the database"
-  [{:keys [name code date-given given-by pre-entered-company pre-entered-title origination-source relationship]
-    :or {name nil code nil date-given nil given-by nil pre-entered-company nil pre-entered-title nil origination-source nil relationship nil}}]
+  [{:keys [name code date_given given_by pre_entered_company pre_entered_title origination_source relationship]
+    :or {name nil code nil date_given nil given_by nil pre_entered_company nil pre_entered_title nil origination_source nil relationship nil}}]
   (ddb/put-item
    client-opts
    db-name
    {:name name
     :code (Integer/parseInt code)
-    :date_given date-given
-    :given_by given-by
-    :pre_entered_company pre-entered-company
-    :pre_entered_title pre-entered-title
-    :origination_source origination-source
+    :date_given date_given
+    :given_by given_by
+    :pre_entered_company pre_entered_company
+    :pre_entered_title pre_entered_title
+    :origination_source origination_source
     :relationship relationship
     :confirmation "UNVERIFIED"
     :rsvp_state "UNVERIFIED"})
@@ -40,7 +40,7 @@
 (defn update-invitee-metadata
   "Update prefilled invitee details"
   [code {:keys [given_by origination_source]
-         :or {given_by nil origination-source nil}}]
+         :or {given_by nil origination_source nil}}]
   (ddb/update-item client-opts db-name {:code code}
                    {:update-map {:given_by [:put given_by]
                                  :origination_source [:put origination_source]}}))


Simplify pixmap! macro

Simplify pixmap! macro

--- src/play_clj/core_graphics.clj
+++ src/play_clj/core_graphics.clj
@@ -12,8 +12,7 @@
 (defmacro pixmap!
   "Calls a single method on a `pixmap`."
   [object k & options]
-  `(let [^Pixmap object# (u/get-obj ~object :object)]
-     (u/call! object# ~k ~@options)))
+  `(u/call! ^Pixmap ~object ~k ~@options))

 (defn shape
   "Returns a [ShapeRenderer](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/glutils/ShapeRenderer.html).


Doh... ye old forget to use apply fail

Doh... ye old forget to use apply fail

--- src/polismath/conversation.clj
+++ src/polismath/conversation.clj
@@ -204,7 +204,7 @@
       :group-clusters
             (plmb/fnk [group-clusterings group-clusterings-silhouettes]
               (get group-clusterings
-                (max-key group-clusterings-silhouettes (keys group-clusterings))))
+                (apply max-key group-clusterings-silhouettes (keys group-clusterings))))

       :bid-to-pid (plmb/fnk [base-clusters]
                      (time2 "bid-to-pid"


refact

refact

--- Assets/game/core.clj
+++ Assets/game/core.clj
@@ -4,24 +4,27 @@
 ; (log "Hello, from game.core")

 (def card (object-named "Card"))
+(def cards (objects-tagged "Card"))

-(set-state! card :rotate? false)
+; (set-state! card :rotate? false)
 ; (state card)
 ; (update-state! card :rotate? (constantly true))

 (defn rotate-card [go]
-  (if (state card :rotate?)
+  (if (state go :rotate?)
     (.. go transform (Rotate 0 -1 0))))

 (defn set-rotate?-card [go]
-  (update-state! card
+  (update-state! go
                  :rotate?
                  #(not %)))

-(hook+ card
-       :update
-       #'game.core/rotate-card)
+(doseq [card cards]
+  (hook+ card
+         :update
+         #'game.core/rotate-card))

-(hook+ card
-       :on-mouse-down
-       #'game.core/set-rotate?-card)
+(doseq [card cards]
+  (hook+ card
+         :on-mouse-down
+         #'game.core/set-rotate?-card))


make ui friendly to repl development by not joining jetty thread

--- src/clj/backtype/storm/ui/core.clj
+++ src/clj/backtype/storm/ui/core.clj
@@ -728,5 +728,7 @@
   (handler/site main-routes)
  )

-(defn -main []
-  (run-jetty app {:port (Integer. (*STORM-CONF* UI-PORT))}))
+(defn start-server! [] (run-jetty app {:port (Integer. (*STORM-CONF* UI-PORT))
+                                       :join? false}))
+
+(defn -main [] (start-server!))


Catch reader exceptions again

Catch reader exceptions again

--- src/clj/reply/eval_modes/nrepl.clj
+++ src/clj/reply/eval_modes/nrepl.clj
@@ -106,7 +106,9 @@
               [raw-input read-result]
                 (try
                   (binding [*ns* (eval-state/get-ns)]
-                    (repl-parse request-prompt eof read-error)))]
+                    (repl-parse request-prompt eof read-error))
+                  (catch Exception e
+                    [e read-error]))]
           (cond (reply.exit/done? eof read-result)
                   nil
                 (= request-prompt read-result)


added version to docker client

added version to docker client

--- src/clj/swarmpit/docker/client.clj
+++ src/clj/swarmpit/docker/client.clj
@@ -234,6 +234,10 @@
   (-> (str "/nodes/" id)
       (get)))

+(defn version
+  []
+  (get "/version"))
+
 ;; Images

 (defn image


(maint) bundle install into staging-dir

(maint) bundle install into staging-dir

--- src/puppetlabs/ezbake/core.clj
+++ src/puppetlabs/ezbake/core.clj
@@ -854,7 +854,7 @@
 (defmethod action "build"
   [_ lein-project build-target]
   (action "stage" lein-project build-target)
-  (exec/exec "bundle" "install")
+  (exec/exec "bundle" "install" :dir staging-dir)
   (let [downstream-job nil
         rake-call ["bundle" "exec" "rake" "pl:jenkins:trigger_build_local_auth"]]
     (exec/lazy-sh rake-call {:dir staging-dir})))
@@ -862,7 +862,7 @@
 (defmethod action "legacy-build"
   [_ lein-project build-target]
   (action "stage" lein-project build-target)
-  (exec/exec "bundle" "install")
+  (exec/exec "bundle" "install" :dir staging-dir)
   (let [downstream-job nil
         rake-call ["bundle" "exec" "rake" "pl:jenkins:uber_build[5]"]]
     (exec/lazy-sh rake-call {:dir staging-dir})))
@@ -870,7 +870,7 @@
 (defmethod action "local-build"
   [_ lein-project build-target]
   (action "stage" lein-project build-target)
-  (exec/exec "bundle" "install")
+  (exec/exec "bundle" "install" :dir staging-dir)
   (let [downstream-job nil
         rake-call ["bundle" "exec" "rake" "pl:local_build"]]
     (exec/lazy-sh rake-call {:dir staging-dir})))


(maint) Add `bundle exec` to rake calls

(maint) Add `bundle exec` to rake calls

This commit adds `bundle exec` to the calls to packaging rake tasks. This is
required now that we use packaging as a gem.

--- src/puppetlabs/ezbake/core.clj
+++ src/puppetlabs/ezbake/core.clj
@@ -854,22 +854,25 @@
 (defmethod action "build"
   [_ lein-project build-target]
   (action "stage" lein-project build-target)
+  (exec/exec "bundle" "install")
   (let [downstream-job nil
-        rake-call ["rake" "pl:jenkins:trigger_build_local_auth"]]
+        rake-call ["bundle" "exec" "rake" "pl:jenkins:trigger_build_local_auth"]]
     (exec/lazy-sh rake-call {:dir staging-dir})))

 (defmethod action "legacy-build"
   [_ lein-project build-target]
   (action "stage" lein-project build-target)
+  (exec/exec "bundle" "install")
   (let [downstream-job nil
-        rake-call ["rake" "pl:jenkins:uber_build[5]"]]
+        rake-call ["bundle" "exec" "rake" "pl:jenkins:uber_build[5]"]]
     (exec/lazy-sh rake-call {:dir staging-dir})))

 (defmethod action "local-build"
   [_ lein-project build-target]
   (action "stage" lein-project build-target)
+  (exec/exec "bundle" "install")
   (let [downstream-job nil
-        rake-call ["rake" "pl:local_build"]]
+        rake-call ["bundle" "exec" "rake" "pl:local_build"]]
     (exec/lazy-sh rake-call {:dir staging-dir})))

 (defmethod action :default


CMR-756: Updated ECHO10 OnlineResource type STATIC URL to UMM RelatedURL type VIEW RELATED INFORMATION.

--- src/cmr/umm/echo10/related_url.clj
+++ src/cmr/umm/echo10/related_url.clj
@@ -10,7 +10,7 @@
 (def resource-type->related-url-types
   "A mapping of ECHO10 OnlineResource's type to UMM RelatedURL's type and sub-type.
   This came from a list provided by Katie on ECHO10 collections, more may need to be added for granules."
-  {"STATIC URL" ["GET DATA"]
+  {"STATIC URL" ["VIEW RELATED INFORMATION"]
    "GUIDE" ["VIEW RELATED INFORMATION" "USER'S GUIDE"]
    "HOMEPAGE" ["VIEW PROJECT HOME PAGE"]
    "SOFTWARE" ["GET SERVICE" "GET SOFTWARE PACKAGE"]
@@ -55,7 +55,7 @@
 (def related-url-types->resource-types
   "A mapping of UMM RelatedURL's type to ECHO10 OnlineResource's type.
   This list is used for generating ECHO10 OnlineResources from UMM RelatedURLs."
-  {"GET DATA" "STATIC URL"
+  {"GET DATA" "DATA ACCESS"
    "GET RELATED VISUALIZATION" "BROWSE"
    "VIEW RELATED INFORMATION" "USER SUPPORT"})


change spec

change spec

--- src/synthesis_crawlers/core.clj
+++ src/synthesis_crawlers/core.clj
@@ -9,10 +9,12 @@
            (org.jsoup.nodes Element)
            (info.debatty.java.stringsimilarity Jaccard)))

-(s/def ::attributes (s/coll-of keyword?))
+(s/def ::attribute keyword?)
+(s/def ::attributes (s/coll-of ::attribute))
 (s/def ::sites (s/map-of string? #(instance? java.util.regex.Pattern %)))
 (s/def ::knowledge (s/coll-of string?))
-(s/def ::attr-extractor (s/map-of keyword? string?))
+(s/def ::attr-knowledge (s/map-of  ::attribute ::knowledge))
+(s/def ::attr-extractor (s/map-of keyword? (s/or :complete string? :empty nil?)))
 (s/def ::container-extractor string?)
 (s/def ::complete-attr-extractor (s/map-of keyword? string?))
 (s/def ::extractor (s/map-of ::container-extractor ::attr-extractor))
@@ -97,7 +99,8 @@
 (s/fdef extract-knowledge
         :args (s/cat :sites ::sites
                      :site-extractor ::site-extractor
-                     :crawled-extractors ::site-extractor))
+                     :crawled-extractors ::site-extractor)
+        :ret ::attr-knowledge)
 (defn extract-knowledge
   "extracts knwoledge from the specified site"
   [sites site-extractor crawled-extractors]
@@ -154,5 +157,8 @@
   (loop [attr-knowledge {}
          s-extractors site-extractors
          crawled-extractors {}]
-    (uncrawled-extractors s-extractors crawled-extractors)
+    (let [new-knowledge (merge-with into
+                                    attr-knowledge
+                                    (extract-knowledge sites s-extractors crawled-extractors))]
+      nil)
     nil))


Refactoring 1000 switches solution.

Refactoring 1000 switches solution.

--- Clojure/switches.clj
+++ Clojure/switches.clj
@@ -4,16 +4,13 @@
 ; http://programmerpuzzlers.com/which-switch/
 ; (it's cheating to code this, but it's an interesting exercise)

-(println
-    (count (filter
-       identity
-       (map
-           (fn
-               [n]
-               (odd? (count (filter
-                   identity
-                   (map
-                       (fn [val] (zero? (rem n val)))
-                       (range 1 1001))))))
-           (range 1 1001)))))
+(println (count
+    (filter
+        (fn
+            [n]
+            (odd? (count
+                (filter
+                    #(zero? (rem n %))
+                    (range 1 1001)))))
+        (range 1 1001))))


Fix misnamed distributed map.

Fix misnamed distributed map.

--- src/trinity/distributed_map.clj
+++ src/trinity/distributed_map.clj
@@ -1,4 +1,4 @@
-(ns trinity.distributed-value
+(ns trinity.distributed-map
   "Functions for operating on Atomix DistributedMaps."
   (:import (io.atomix.collections DistributedMap)
            (io.atomix Atomix)


Disable loader on colors.

Disable loader on colors.

--- src/uxbox/main/data/colors.cljs
+++ src/uxbox/main/data/colors.cljs
@@ -15,7 +15,6 @@
             [uxbox.main.state :as st]
             [uxbox.main.repo :as rp]))

-
 ;; --- Helpers

 (defn- assoc-collection
@@ -44,10 +43,10 @@
                 :section :dashboard/colors}]
       (assoc state :dashboard data)))

-  rs/EffectEvent
-  (-apply-effect [_ state]
-    (when (nil? (:colors-by-id state))
-      (reset! st/loader true)))
+  ;; rs/EffectEvent
+  ;; (-apply-effect [_ state]
+  ;;   (when (nil? (:colors-by-id state))
+  ;;     (reset! st/loader true)))

   rs/WatchEvent
   (-apply-watch [_ state s]


Print user-friendly explanation of why rules matched for issue #48

--- src/main/clojure/clara/tools/inspect.clj
+++ src/main/clojure/clara/tools/inspect.clj
@@ -7,15 +7,14 @@
             [schema.core :as s]
             [schema.macros :as sm]))

-(defn- get-condition-matches
+(defn- get-condition-matches
   "Returns facts matching each condition"
   [beta-roots memory]
-  ;; TODO: add inspection of query, test, and negation nodes?
   (let [join-nodes (for [beta-root beta-roots
                          beta-node (tree-seq :children :children beta-root)
                          :when (= :join (:node-type beta-node))]
                      beta-node)]
-    (reduce
+    (reduce
      (fn [matches node]
        (update-in matches
                   [(:condition node)]
@@ -23,7 +22,7 @@
      {}
      join-nodes)))

-(defn inspect
+(defn inspect
   "Returns a representation of the given rule session useful to understand the
    state of the underlying rules.

@@ -36,7 +35,7 @@
    Users may inspect the entire structure for troubleshooting or explore it
    for specific cases. For instance, the following code snippet could look
    at all matches for some example rule:
-
+
    (defrule example-rule ... )

    ...
@@ -54,7 +53,7 @@

         ;; Map of queries to their nodes in the network.
         query-to-nodes (into {} (for [[query-name query-node] query-nodes]
-                                  [(:query query-node) query-node]))
+                                  [(:query query-node) query-node]))

         ;; Map of rules to their nodes in the network.
         rule-to-nodes (into {} (for [rule-node production-nodes]
@@ -65,9 +64,36 @@
                             [rule (mem/get-tokens-all memory rule-node)]))

      :query-matches (into {}
-                          (for [[query query-node] query-to-nodes]
+                          (for [[query query-node] query-to-nodes]
                             [query (mem/get-tokens-all memory query-node)]))

      :condition-matches (get-condition-matches beta-tree memory)
      }))

+(defn explain-token
+  "Prints a human-readable explanation of the facts and conditions that created the Rete token."
+  ([token] (explain-token token ""))
+  ([token prefix]
+      (doseq [[fact {:keys [type constraints]}] (:matches token) ]
+        (println prefix fact)
+        (println prefix "  is a" type)
+        (println prefix "  where" constraints))))
+
+(defn explain-activations
+  "Prints a human-friend explanation of why rules and queries matched in the given session."
+  [session]
+  (doseq [[rule tokens] (:rule-matches (inspect session))]
+    (println "rule"  (or (:name rule) (str "<" (:lhs rule) ">")))
+    (println "  executed")
+    (println "   " (:rhs rule))
+    (doseq [token tokens]
+      (println "  because")
+      (explain-token token "    "))
+    (println))
+
+  (doseq [[rule tokens] (:query-matches (inspect session))]
+    (println "query"  (or (:name rule) (str "<" (:lhs rule) ">")))
+    (doseq [token tokens]
+      (println "  qualified because")
+      (explain-token token "    "))
+    (println)))


Single-pass (juxt filter remove)

Single-pass (juxt filter remove)

--- src/main/hbase_region_inspector/core.clj
+++ src/main/hbase_region_inspector/core.clj
@@ -501,7 +501,7 @@
   (System/exit code))

 (defn -main [& args]
-  (let [[opts args] ((juxt filter remove) #(.startsWith % "-") args)
+  (let [{opts true args false} (group-by #(.startsWith % "-") args)
         opts (set (map #(keyword (str/replace % #"^-*" "")) opts))]
     (if-let [unknowns (seq (set/difference opts #{:help :admin :no-system}))]
       (exit (str "unknown options: " unknowns) 1))


Discover: replace carousel with horizontal flat list

--- src/status_im/ui/screens/discover/all_dapps/views.cljs
+++ src/status_im/ui/screens/discover/all_dapps/views.cljs
@@ -5,12 +5,10 @@
             [status-im.components.react :as react]
             [status-im.components.list.views :as list]
             [status-im.components.chat-icon.screen :as chat-icon]
-            [status-im.components.carousel.carousel :as carousel]
             [status-im.ui.screens.discover.components.views :as discover-components]
             [status-im.ui.screens.discover.styles :as styles]
             [status-im.i18n :as i18n]
-            [status-im.components.toolbar-new.view :as toolbar]
-            [taoensso.timbre :as log]))
+            [status-im.components.toolbar-new.view :as toolbar]))

 (defn navigate-to-dapp [dapp]
   (do (re-frame/dispatch [:set :discover-current-dapp dapp])
@@ -40,14 +38,11 @@
     :t/all
     #(re-frame/dispatch [:navigate-to :discover-all-dapps])]
    (if (seq dapps)
-     ;; TODO(oskarth): Make this carousel show more dapps at a time
-     [carousel/carousel {:page-style styles/carousel-page-style
-                         :count      (count dapps)}
-      (for [[_ dapp] dapps]
-        ^{:key (str (:name dapp))}
-        [react/touchable-highlight {:on-press #(navigate-to-dapp dapp)}
-         [react/view styles/dapp-preview-content
-          [dapp-item dapp]]])]
+     ;; TODO(oskarth): Too wide margins bug
+     [list/flat-list {:data                    (vals dapps)
+                      :render-fn               render-dapp
+                      :horizontal              true
+                      :content-container-style styles/all-dapps-flat-list}]
      [react/text (i18n/label :t/none)])])

 (defview main []


Add .shadow-cljs to :clean-targets in todomvc example

--- examples/todomvc/project.clj
+++ examples/todomvc/project.clj
@@ -10,12 +10,15 @@
                  [day8.re-frame/re-frame-10x "0.4.3-SNAPSHOT"]
                  [secretary "1.2.3"]]

-
   :plugins [[lein-shadow "0.1.5"]]

   :profiles {:dev  {:dependencies [[binaryage/devtools "0.9.10"]]}}

   :source-paths ["src" "../../src" "../../gen-src"]
+
+  :clean-targets ^{:protect false} [:target-path
+                                    ".shadow-cljs"
+                                    "resources/public/js"]

   :shadow-cljs {:nrepl  {:port 8777}

@@ -30,6 +33,4 @@
                                   :devtools   {:http-root "resources/public"
                                                :http-port 8280}}}}

-  :aliases {"dev-auto" ["with-profile" "dev" "shadow" "watch" "client"]}
-
-  :clean-targets ^{:protect false} ["resources/public/js" "target"])+  :aliases {"dev-auto" ["with-profile" "dev" "shadow" "watch" "client"]})


todomvc: bump carry-schema dep

todomvc: bump carry-schema dep

--- examples/todomvc/project.clj
+++ examples/todomvc/project.clj
@@ -32,7 +32,7 @@
                                            [carry-logging "0.1.0"]
                                            [carry-persistence "0.3.0"]
                                            [carry-reagent "0.2.0"]
-                                           [carry-schema "0.3.0"]]}}
+                                           [carry-schema "0.4.0"]]}}

   :cljsbuild {:builds [{:id           "clojars-deps"
                         :source-paths ["src"]


verbose output for release script

verbose output for release script

--- src/leiningen/new/mies/release.clj
+++ src/leiningen/new/mies/release.clj
@@ -6,5 +6,6 @@
   (cljsc/build "src"
     {:output-to "out/{{sanitized}}.js"
      :output-dir "release"
-     :optimizations :advanced})
+     :optimizations :advanced
+     :verbose true})
   (println "... done. Elapsed" (/ (- (System/nanoTime) start) 1e9) "seconds"))


Removed unused require.

Removed unused require.

--- src/taoensso/faraday/utils.clj
+++ src/taoensso/faraday/utils.clj
@@ -1,7 +1,6 @@
 (ns taoensso.faraday.utils
   {:author "Peter Taoussanis"}
-  (:require [clojure.string  :as str]
-            [taoensso.encore :as encore]))
+  (:require [clojure.string  :as str]))

 (defn map-kvs [kf vf m]
   (let [m (if (instance? java.util.HashMap m) (into {} m) m)]


(PE-2410) additional docs for 'add-classpath'

--- src/puppetlabs/kitchensink/classpath.clj
+++ src/puppetlabs/kitchensink/classpath.clj
@@ -38,7 +38,20 @@
   "A corollary to the (deprecated) `add-classpath` in clojure.core. This implementation
    requires a java.io.File or String path to a jar file or directory, and will attempt
    to add that path to the right classloader (with the search rooted at the current
-   thread's context classloader)."
+   thread's context classloader).
+
+   Because this function is a replacement for `add-classpath` in clojure.core,
+   if you simply `:require` this namespace and then `:refer` to this function, you
+   will get the following warning:
+
+      WARNING: add-classpath already refers to: #'clojure.core/add-classpath in
+      namespace: [...], being replaced by:
+      #'puppetlabs.kitchensink.classpath/add-classpath
+
+   You can avoid this by referencing this function through its namespace.
+
+   This function is copied out of the 'pomegranate' library
+   (https://github.com/cemerick/pomegranate)."
   ([jar-or-dir classloader]
    (if-not (dp/add-classpath-url classloader (.toURL (file jar-or-dir)))
      (throw (IllegalStateException. (str classloader " is not a modifiable classloader")))))


cljs.source-map encode needs to emit JS values

--- src/main/cljs/cljs/source_map.cljs
+++ src/main/cljs/cljs/source_map.cljs
@@ -232,24 +232,24 @@
         (doseq [[col infos] cols]
           (encode-cols infos source-idx line col))))
     (let [source-map-file-contents
-          (cond-> {"version"   3
-                   "file"      (:file opts)
-                   "sources"   (let [paths (keys m)
-                                     f     (comp
-                                             (if (true? (:source-map-timestamp opts))
-                                               #(str % "?rel=" (.valueOf (js/Date.)))
-                                               identity)
-                                             #(last (string/split % #"/")))]
-                                 (->> paths (map f) (into [])))
-                   "lineCount" (:lines opts)
-                   "mappings"  (->> (lines->segs (concat preamble-lines @lines))
-                                 (map #(string/join "," %))
-                                 (string/join ";"))
-                   "names"     (into []
-                                 (map (set/map-invert @names->idx)
-                                   (range (count @names->idx))))}
+          (cond-> #js {"version"   3
+                       "file"      (:file opts)
+                       "sources"   (let [paths (keys m)
+                                         f     (comp
+                                                 (if (true? (:source-map-timestamp opts))
+                                                   #(str % "?rel=" (.valueOf (js/Date.)))
+                                                   identity)
+                                                 #(last (string/split % #"/")))]
+                                     (->> paths (map f) (into-array)))
+                       "lineCount" (:lines opts)
+                       "mappings"  (->> (lines->segs (concat preamble-lines @lines))
+                                     (map #(string/join "," %))
+                                     (string/join ";"))
+                       "names"     (into-array
+                                     (map (set/map-invert @names->idx)
+                                       (range (count @names->idx))))}
             (:sources-content opts)
-            (assoc "sourcesContent" (:sources-content opts)))]
+            (gobj/set "sourcesContent" (:sources-content opts)))]
       (.stringify js/JSON source-map-file-contents))))

 ;; -----------------------------------------------------------------------------


allow e.g. (collection nil)

allow e.g. (collection nil)

--- src/main/clojure/org/dada/core.clj
+++ src/main/clojure/org/dada/core.clj
@@ -90,9 +90,10 @@
    (map #(Update. % nil) (.deregisterView model view)))
    view)

-(defn collection [& args]
-  (let [array-list (ArrayList. #^Integer (count args))]
-    (.addAll array-list args)
+(defn #^Collection collection [& args]
+  (let [size (count args)
+	array-list (ArrayList. #^Integer size)]
+    (if (> 0 size) (.addAll array-list args))
     array-list))

 (def #^ClassFactory *class-factory* (new ClassFactory))


Tweak variable name to improve docstring

--- src/rdf-common/grafter/rdf/protocols.clj
+++ src/rdf-common/grafter/rdf/protocols.clj
@@ -21,7 +21,7 @@
     [this graph statement])

   (add
-    [this triples]
+    [this quads]
     [this graph triples]
     ;; A more efficient way to add an InputStream/Reader of RDF data to the destination.
     [this graph format triple-stream]


fix customfield query in habit stats

fix customfield query in habit stats

--- src/clj/meins/jvm/graphql/custom_fields.clj
+++ src/clj/meins/jvm/graphql/custom_fields.clj
@@ -118,7 +118,7 @@
    results for the defined custom fields, plus the date string. Performs
    operation specified for field, such as sum, min, max."
   [current-state tag]
-  (let [custom-fields (-> current-state :options :custom_fields)
+  (let [custom-fields (-> current-state :cfg :custom-fields)
         fields-def (into {} (map (fn [[k v]] [k (:fields v)])
                                  (select-keys custom-fields [tag])))]
     (fn [day nodes]


quick fix stack info

quick fix stack info

Revert "redesign of stack info form"

This reverts commit 94e59ca

--- src/cljs/swarmpit/component/stack/info.cljs
+++ src/cljs/swarmpit/component/stack/info.cljs
@@ -247,7 +247,7 @@
       {:className "Swarmpit-table-card-content"
        :key       "fccc"}
       (rum/with-key
-        (list/list
+        (list/responsive
           configs/render-metadata
           (sort-by :configName configs)
           configs/onclick-handler) "fcccrl"))))
@@ -264,7 +264,7 @@
       {:className "Swarmpit-table-card-content"
        :key       "fsecc"}
       (rum/with-key
-        (list/list
+        (list/responsive
           secrets/render-metadata
           (sort-by :secretName secrets)
           secrets/onclick-handler) "fseccrl"))))
@@ -297,80 +297,43 @@
           (comp/grid
             {:item true
              :key  "sgg"
-             :xs   12
-             :md   4}
-            (comp/grid
-              {:container true
-               :spacing   40}
-              (comp/grid
-                {:item true
-                 :key  "ssgg"
-                 :xs   12}
-                (rum/with-key
-                  (form-general stack-name stackfile services) "sggfg"))
-              (comp/grid
-                {:item true
-                 :key  "sseg"
-                 :xs   12}
-                (rum/with-key
-                  (form-secrets stack-name secrets) "ssegfs"))
-              (comp/grid
-                {:item true
-                 :key  "scg"
-                 :xs   12}
-                (rum/with-key
-                  (form-configs stack-name configs) "scgfc"))))
+             :xs   12}
+            (rum/with-key
+              (form-general stack-name stackfile services) "sggfg"))
           (comp/grid
             {:item true
              :key  "ssg"
-             :xs   12
-             :md   8}
+             :xs   12}
+            (rum/with-key
+              (form-services stack-name services) "ssgfs"))
+          (when (not-empty networks)
             (comp/grid
-              {:container true
-               :spacing   40}
-              (comp/grid
-                {:item true
-                 :key  "ssg"
-                 :xs   12}
-                (rum/with-key
-                  (form-services stack-name services) "ssgfs"))
-              (comp/grid
-                {:item true
-                 :key  "sng"
-                 :xs   12}
-                (rum/with-key
-                  (form-networks stack-name networks) "sngfn"))))
-
-          ;(when (not-empty networks)
-          ;  (comp/grid
-          ;    {:item true
-          ;     :key  "sng"
-          ;     :xs   12}
-          ;    (rum/with-key
-          ;      (form-networks stack-name networks) "sngfn")))
-          ;(when (not-empty secrets)
-          ;  (comp/grid
-          ;    {:item true
-          ;     :key  "sseg"
-          ;     :xs   12}
-          ;    (rum/with-key
-          ;      (form-secrets stack-name secrets) "ssegfs")))
-          ;(when (not-empty configs)
-          ;  (comp/grid
-          ;    {:item true
-          ;     :key  "scg"
-          ;     :xs   12}
-          ;    (rum/with-key
-          ;      (form-configs stack-name configs) "scgfc")))
-          ;(when (not-empty volumes)
-          ;  (comp/grid
-          ;    {:item true
-          ;     :key  "svg"
-          ;     :xs   12}
-          ;    (rum/with-key
-          ;      (form-volumes stack-name volumes) "svgfv")))
-
-          )]])))
+              {:item true
+               :key  "sng"
+               :xs   12}
+              (rum/with-key
+                (form-networks stack-name networks) "sngfn")))
+          (when (not-empty secrets)
+            (comp/grid
+              {:item true
+               :key  "sseg"
+               :xs   12}
+              (rum/with-key
+                (form-secrets stack-name secrets) "ssegfs")))
+          (when (not-empty configs)
+            (comp/grid
+              {:item true
+               :key  "scg"
+               :xs   12}
+              (rum/with-key
+                (form-configs stack-name configs) "scgfc")))
+          (when (not-empty volumes)
+            (comp/grid
+              {:item true
+               :key  "svg"
+               :xs   12}
+              (rum/with-key
+                (form-volumes stack-name volumes) "svgfv"))))]])))

 (rum/defc form < rum/reactive
                  mixin-init-form


Cleanup

Cleanup

--- src/clojure/clojurewerkz/cassaforte/cql.clj
+++ src/clojure/clojurewerkz/cassaforte/cql.clj
@@ -263,7 +263,6 @@

    Doesn't work as a prepared query."
   [^Session session & query-params]
-  (assert (not cc/*prepared-statement*) "get-one query can't be executed as a prepared query")
   (first
    (cc/execute session
                (apply new-query-api/select query-params))))


Refactor

Refactor

--- src/obb_api/handlers/create_friendly.clj
+++ src/obb_api/handlers/create_friendly.clj
@@ -1,14 +1,24 @@
 (ns obb-api.handlers.create-friendly
   "Creates a friendly matches bettwen two players"
   (:require [obb-api.response :as response]))
+
+(defn- challenger-name
+  "Gets the challenger's name"
+  [request]
+  (get-in request [:json-params :challenger]))
+
+(defn- opponent-name
+  "Gets the opponent's name"
+  [request]
+  (get-in request [:json-params :opponent]))

 (defn- find-request-error
   "Tries to find errors on the request"
   [request]
   (cond
     (nil? (request :json-params)) "InvalidJSON"
-    (nil? (get-in request [:json-params :opponent])) "EmptyOpponent"
-    (nil? (get-in request [:json-params :challenger])) "EmptyChallenger"))
+    (nil? (opponent-name request)) "EmptyOpponent"
+    (nil? (challenger-name request)) "EmptyChallenger"))

 (defn handler
   "Creates a friendly match"


Fix error.

Fix error.

--- src/org/spootnik/cyanite/store_cache.clj
+++ src/org/spootnik/cyanite/store_cache.clj
@@ -106,7 +106,7 @@
   (info "The store cache has been flushed"))

 (defn in-memory-cache
-  []
+  [config]
   (info "creating in-memory store aggregation cache")
   (let [mkeys (atom {})
         get-data (fn [pkeys] (get (meta pkeys) :data))


react now knows about events on audio elements

* so no need for a `did-mount` method on the audio player any longer

* yay

--- cljs/sledge/core.cljs
+++ cljs/sledge/core.cljs
@@ -204,29 +204,32 @@
         ))))

+(defn update-audio-time [state event]
+  (let [target (.-target event)
+        time (Math/floor (.-currentTime target))]
+    ;; don't update! on timeupdate unless the state has actually changed
+    (if-not (= (:time-offset @state) time)
+      (om/update! state [:time-offset] time))))

 (defn audio-el [state owner]
   (reify
-    om/IDidMount
-    (did-mount [_]
-      (let [el (om/get-node owner)]
-        ;; this is a capturing handler (last arg "true")
-        ;; cos audio events don't bubble
-        (.addEventListener el "ended"
-                           #(om/update! state [:ended] true)
-                           true)
-        (.addEventListener el "timeupdate"
-                           #(om/update! state [:time-offset]
-                                        (.-currentTime (.-target %))))))
-    om/IRender
-    (render [_]
-      (html [:audio {:ref "player"}]))))
+    om/IRender

 (defn swallowing [h]
   (fn [e]
     (let [r (h e)]
       (.stopPropagation e)
       r)))
+    (render [this]
+      (let [command-chan (om/get-shared owner :command-channel)]
+        (html
+         [:audio {:ref "player"
+                  :loop false
+                  :onTimeUpdate (partial update-audio-time state)
+                  :onProgress #(om/update! state [:ready-state]
+                                           (.-readyState (.-target %)))
+                  :onEnded #(put! command-chan [:next-track])
+                  }])))))

 (defn svg [& elements]
   (into


Fire `:create-channel` message on + tab click

--- src/omchaya/components/navbar.cljs
+++ src/omchaya/components/navbar.cljs
@@ -8,6 +8,7 @@
 (defn tab [comm channel]
   (let [id (:id channel)]
     [:li.protected {:key (:id channel)
+                    :on-click #(put! comm [:tab-selected id])
                     :class (str (utils/safe-sel (:id channel)) (when (:selected channel) " active"))}
      [:a.show_channel
       {:on-click (comp (constantly false)
@@ -25,17 +26,22 @@
              settings (:settings data)]
          [:nav.nav {:class (when (get-in settings [:forms :search :focused]) "search-focus")}
           [:form.search
-           {:action "/search",
+           {:action "/search"
             :method "get"
             :on-submit (constantly false)}
-           [:input.query {:name "query",
+           [:input.query {:name "query"
                           :type "text"
-                          :on-focus #(put! comm [:search-form-focused])
-                          :on-blur #(put! comm [:search-form-blurred])
+                          :on-focus  #(put! comm [:search-form-focused])
+                          :on-blur   #(put! comm [:search-form-blurred])
                           :on-key-up #(put! comm [:search-form-updated (.. % -target -value)])}]
-           [:input.submit {:value "Search",
+           [:input.submit {:value "Search"
                            :type "submit"}]]
           [:ul#channel_nav
            (map (partial tab comm) (sort-by :order (vals (:channels data))))
-           [:li {:key "new-tab"} [:a#create_channel {:href "#"
-                                                     :on-click #(put! comm [:create-channel-menu-opened])} [:strong " + "]]]]])))))
+           [:li {:key "new-tab"
+                 :on-click #(put! comm [:create-channel-menu-opened])}
+            [:a#create_channel
+             {:href "#"
+              :on-click (comp (constantly false)
+                              #(put! comm [:create-channel-menu-opened]))}
+             [:strong " + "]]]]])))))