Fix whitespace

Fix whitespace

--- src/desdemona/launcher/aeron_media_driver.clj
+++ src/desdemona/launcher/aeron_media_driver.clj
@@ -19,7 +19,7 @@
                             (throw (Exception. "Error starting media driver. This may be due to a media driver data incompatibility between versions. Check that no other media driver has been started and then use -d to delete the directory on startup" ise))))]
     (when help
       (run! (fn [opt]
-              (println (clojure.string/join " " (take 3 opt))))
+              (println (clojure.string/join " " (take 3 opt))))
             cli-options)
       (System/exit 0))
     (println "Launched the Media Driver. Blocking forever...")


Fix missing conversion to int on concurrency validation

--- src/engulf/formulas/http_benchmark_runner.clj
+++ src/engulf/formulas/http_benchmark_runner.clj
@@ -55,7 +55,7 @@
       (when (not (empty? diff))
         (throw (Exception. (str "Invalid parameters! Missing keys: " diff ". Got: " str-params)))))

-    (when (> node-count (:concurrency params))
+    (when (> node-count (int-val (:concurrency params)))
       (throw (Exception. "Concurrency cannot be < node-count! Use a higher concurrency setting!")))

     (assoc job :params


Fix microtypo

Fix microtypo

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

--- src/conexp/fca/exploration.clj
+++ src/conexp/fca/exploration.clj
@@ -157,7 +157,7 @@
   - incomplete-counterexamples?: If true, allows for incomplete counterexamples.  In
     contrast to the case of complete counterexamples, the function returned takes four
     arguments (instead of 3), namely the context of the possible incidence, the context of
-    the certain incidence, the known implications aas well as the current implication to
+    the certain incidence, the known implications as well as the current implication to
     be asked to the expert."
   [:automorphisms #{}, :incomplete-counterexamples? false]
   (assert (or (set? automorphisms) (seq? automorphisms)))


Upgrade lein-shadow to 0.2.2

Upgrade lein-shadow to 0.2.2

--- src/leiningen/new/re_frame/project.clj
+++ src/leiningen/new/re_frame/project.clj
@@ -18,7 +18,7 @@
                  [re-pressed "0.3.1"]{{/re-pressed?}}{{#breaking-point?}}
                  [breaking-point "0.1.2"]{{/breaking-point?}}]

-  :plugins [[lein-shadow "0.2.0"]
+  :plugins [[lein-shadow "0.2.2"]
             {{#garden?}}[lein-garden "0.3.0"]{{/garden?}}{{#less?}}
             [lein-less "1.7.5"]{{/less?}}
             [lein-shell "0.5.0"]]


Add .shadow-cljs cache to :clean-targets

--- src/leiningen/new/re_frame/project.clj
+++ src/leiningen/new/re_frame/project.clj
@@ -27,7 +27,9 @@

   :test-paths   ["test/cljs"]{{/test?}}

-  :clean-targets ^{:protect false} ["resources/public/js/compiled" "target"{{#test?}}
+  :clean-targets ^{:protect false} [:target-path
+                                    ".shadow-cljs"
+                                    "resources/public/js/compiled"{{#test?}}
                                     "test/js"{{/test?}}{{#garden?}}
                                     "resources/public/css"{{/garden?}}]


browser REPL needs to set *print-err-fn*

--- src/main/clojure/cljs/repl/browser.clj
+++ src/main/clojure/cljs/repl/browser.clj
@@ -142,6 +142,7 @@
   (send-for-eval conn
     (cljsc/-compile
       '[(set! *print-fn* clojure.browser.repl/repl-print)
+        (set! *print-err-fn* clojure.browser.repl/repl-print)
         (set! *print-newline* true)] {})
     identity))


Include all SQL exceptions in error string, not only the first

--- src/main/clojure/pdok/featured/api.clj
+++ src/main/clojure/pdok/featured/api.clj
@@ -157,7 +157,10 @@
                     (shutdown processor)
                     (catch Exception e
                       (log/warn e "failed to shutdown processor in exception handler")))
-                error-stats (assoc request :error (str e))]
+                error-str (if (instance? Iterable e)
+                            (clojure.string/join " Next: " (map str (seq e)))
+                            (str e))
+                error-stats (assoc request :error error-str)]
             (log/warn e error-stats)
             (swap! stats assoc-in [:processing worker-id] nil)
             (stats-on-callback callback-chan request error-stats)))


Add a docs config prefix

Add a docs config prefix

--- src/doctopus/configuration.clj
+++ src/doctopus/configuration.clj
@@ -3,3 +3,4 @@
             [clojure.java.io :as io]))

 (defconfig server-config (io/resource "configuration.edn"))
+(def docs-uri-prefix "/docs")


Add player name to status bar

Add player name to status bar

--- src/dungeon_crusade/render.clj
+++ src/dungeon_crusade/render.clj
@@ -372,7 +372,7 @@
     (render-quests state)
     ;; draw status bar
     (s/put-string (state :screen) 0  23
-      (format "Dgnlvl %s $%d HP:%d(%d) Pw:%d(%d) Amr:%d XP:%d/%d T%d %s                             "
+      (format "Dgnlvl %s $%d HP:%d(%d) Pw:%d(%d) Amr:%d XP:%d/%d T%d %s %s                            "
         (name (-> state :world :current-place))
         (-> state :world :player :$)
         (int (-> state :world :player :hp))
@@ -381,7 +381,8 @@
         (-> state :world :player :xp)
         100
         (-> state :world :time)
-        (apply str (interpose " " (-> state :world :player :status))))
+        (apply str (interpose " " (-> state :world :player :status)))
+        (-> state :world :player :name))
         {:fg :black :bg :white})
     (doall (map #(s/put-string (state :screen) (+ 73 %1) 23 " " {:bg (rgb-color %2)})
                 (range)


Finish composite font example

Finish composite font example

--- src/examples/compositefont.clj
+++ src/examples/compositefont.clj
@@ -48,12 +48,9 @@
                                      (map->tile->col-row one-bit-map)
                                      (map->tile->transparent one-bit-map))]))

-#_(def font (CP437Font. "http://dwarffortresswiki.org/images/b/be/Pastiche_8x8.png" :green 2))
-
-
 (defn -main [& _]
   ;; render in background thread
-   (let [terminal   (zgl/make-terminal [:text :rainbow]
+   (let [terminal   (zgl/make-terminal [:text :overlay]
                                        {:title "Zaffre demo"
                                         :columns 16 :rows 16
                                         :default-fg-color [250 250 250]
@@ -63,22 +60,8 @@
                                         :icon-paths ["images/icon-16x16.png"
                                                      "images/icon-32x32.png"
                                                      "images/icon-128x128.png"]})
-       event-chan   (async/merge
-                      [(zat/get-key-chan terminal)
-                       (zat/get-mouse-chan terminal)]
-                      10)
+        key-chan   (zat/get-key-chan terminal)
         last-key    (atom nil)
-        trail-length 6
-        last-mouse-pos (atom [])
-        ;; Every 10ms, set the "Rainbow" text to have a random fg color
-        fx-chan     (go-loop []
-                      (dosync
-                        (doseq [x (range (count "Rainbow"))
-                                :let [rgb (hsv->rgb (double (rand 360)) 1.0 1.0)]]
-                            (zat/set-fx-fg! terminal :rainbow (inc x) 1 rgb)))
-                        (zat/refresh! terminal)
-                      (Thread/sleep 10)
-                      (recur))
         ;; Every 33ms, draw a full frame
         render-chan (go-loop []
                       (dosync
@@ -88,55 +71,26 @@
                           (doseq [[i c] (take 23 (map-indexed (fn [i c] [i (char c)]) (range (int \a) (int \z))))]
                             (zutil/put-string terminal :text 0 (inc i) (str c) [128 (* 10 i) 0] [0 0 50]))
                           (zutil/put-string terminal :text 12 0 (str key-in))
-                          (zutil/put-string terminal :rainbow 1 1 "Rainbow")
-                          (zutil/put-string terminal :rainbow 1 7 "Overlay")
-                          (zat/put-chars! terminal :text [
-                            {:c :metal       :fg [128 0 0] :bg [4 4 5] :x 12 :y 12}
-                            {:c :panels      :fg [128 0 0] :bg [4 4 5] :x 13 :y 12}
-                            {:c :stone       :fg [128 128 128] :bg [4 4 5] :x 14 :y 12}
-                            {:c :masonry     :fg [128 128 0] :bg [4 4 5] :x 15 :y 12}
-                            {:c :dark-metal  :fg [128 128 0] :bg [4 4 5] :x 16 :y 12}
-                            {:c :dark-panels :fg [128 128 0] :bg [4 4 5] :x 17 :y 12}
-                            {:c :grass       :fg [4 4 5]   :bg [0 128 0] :x 18 :y 12}
-                            {:c :metal       :fg [4 4 5] :bg [0 128 0] :x 1 :y 7}
-                            {:c :metal       :fg [4 4 5] :bg [0 128 0] :x 2 :y 7}
-                            {:c :metal       :fg [4 4 5] :bg [0 128 0] :x 3 :y 7}
-                            {:c :metal       :fg [4 4 5] :bg [0 128 0] :x 4 :y 7}
-                            {:c :metal       :fg [4 4 5] :bg [0 128 0] :x 5 :y 7}
-                            {:c :metal       :fg [4 4 5] :bg [0 128 0] :x 6 :y 7}
-                            {:c :metal       :fg [4 4 5] :bg [0 128 0] :x 7 :y 7}
-                            {:c :metal       :fg [4 4 5] :bg [0 128 0] :x 8 :y 7}
-                            {:c :metal       :fg [4 4 5] :bg [0 128 0] :x 9 :y 7}
-                            {:c :metal       :fg [4 4 5] :bg [0 128 0] :x 10 :y 7}])
-                          (doseq [[col row] @last-mouse-pos]
-                            (zat/put-chars! terminal :text [{:c \* :fg [200 200 100] :bg [4 4 5] :x col :y row}]))
+                          (zutil/put-string terminal :overlay 2 7 "Overlay")
+                          (zat/put-chars! terminal :text
+                            (for [x (range 1 11)
+                                  y (range 5 10)]
+                              {:c :metal       :fg [4 4 5] :bg [0 128 0] :x x :y y}))
                           (zat/refresh! terminal)))
                           ;; ~30fps
                         (Thread/sleep 33)
                         (recur))]
     ;; get key presses in fg thread
     (loop []
-      (let [new-event (async/<!! event-chan)]
-        (cond
-          (map? new-event)
-            (let [{:keys [mouse-leave]} new-event]
-              (log/info "Got mouse-event" new-event (vec @last-mouse-pos))
-              (when mouse-leave
-                (swap! last-mouse-pos (fn [col] (take trail-length (cons mouse-leave col)))))
-              (recur))
-          (char? new-event)
-            (let [new-key new-event]
-              (reset! last-key new-key)
-              (log/info "got key" (or (str @last-key) "nil"))
-              (case new-key
-                \q (zat/destroy! terminal)
-                nil)
-              (if (= new-key :exit)
-                (do
-                  (async/close! fx-chan)
-                  (async/close! render-chan)
-                  (System/exit 0))
-                ;; change font size on s/m/l keypress
-                (recur))))))))
-
-
+      (let [new-key (async/<!! key-chan)]
+        (reset! last-key new-key)
+        (log/info "got key" (or (str @last-key) "nil"))
+        (case new-key
+          \q (zat/destroy! terminal)
+          nil)
+        (if (= new-key :exit)
+          (do
+            (async/close! render-chan)
+            (System/exit 0))
+          ;; change font size on s/m/l keypress
+          (recur))))))


updates stop words

updates stop words

--- Clojure-Websockets/src/cljs/birdwatch/wordcount.cljs
+++ Clojure-Websockets/src/cljs/birdwatch/wordcount.cljs
@@ -15,8 +15,8 @@
                   "until" "while" "of" "at" "by" "for" "with" "about" "against" "between" "into" "through" "during"
                   "before" "after" "above" "below" "to" "from" "up" "upon" "down" "in" "out" "on" "off" "over" "under"
                   "again" "further" "then" "once" "here" "there" "when" "where" "why" "how" "all" "any" "both" "each"
-                  "few" "more" "most" "other" "some" "such" "no" "nor" "not" "only" "own" "same" "so" "than" "too"
-                  "very" "say" "says" "said" "shall" "via" "htt…" "don" "let" "gonna" "rt" "&amp" "http"})
+                  "few" "more" "most" "other" "some" "such" "no" "nor" "not" "only" "own" "same" "so" "than" "too" "come"
+                  "very" "say" "says" "said" "shall" "via" "htt…" "don" "let" "gonna" "rt" "&amp" "http" "must" "see"})

 (defn get-words [app n]
   (vec (map (fn [w] (let [[k v] w] {:key k :value v})) (take n (:words-sorted-by-count @app)))))
@@ -33,7 +33,7 @@
         (filter #(> (count %) 3) ,)
         (filter #(< (count %) 25) ,)
         (map s/lower-case ,)
-        (map #(s/replace % #"[;:,/‘’…~\-!?#<>()\"@.]+" "" ) ,)
+        (map #(s/replace % #"[;:,/‘’…~\-!?\[\]\"<>()\"@.]+" "" ) ,)
         (filter (fn [item] (not (contains? stop-words item))) ,)
         (map #(add-word app %) ,))))


Window resizing when dragging corners

Window resizing when dragging corners

--- flatguiwidgets/src/flatgui/widgets/window.clj
+++ flatguiwidgets/src/flatgui/widgets/window.clj
@@ -25,12 +25,12 @@

 (fg/defevolverfn window-position-matrix-evolver :position-matrix
   (if (mouse/is-mouse-event? component)
-    (let [ mce (get-property component [:this] :mouse-capture-edges)]
+    (let [mce (get-property component [:this] :mouse-capture-edges)]
       (if mce
-        (condp = (:edge mce)
-          :left (m/mx*
-                  (:position-matrix mce)
-                  (m/translation-matrix (- (mouse/get-mouse-x component) (:x mce)) 0))
+        (if (:left (:edges mce))
+          (m/mx*
+            (:position-matrix mce)
+            (m/translation-matrix (- (mouse/get-mouse-x component) (:x mce)) 0))
           old-position-matrix)
         (flatgui.widgets.floatingbar/position-matrix-evolver component)))
     (flatgui.widgets.floatingbar/position-matrix-evolver component)))


badge adverts schema

badge adverts schema

--- src/cljc/salava/extra/application/schemas.cljc
+++ src/cljc/salava/extra/application/schemas.cljc
@@ -50,13 +50,14 @@
                                            (s/optional-key :issuer_image) (s/maybe s/Str))))

 (s/defschema BadgeAdverts {:applications [(-> BadgeAdvert
-                                              (dissoc :issuer_content_id :badge_content_id
+                                              (dissoc :badge_content_id
                                                       :criteria_content_id :ctime :deleted :remote_url :remote_id :remote_issuer_id :application_url
                                                       :application_url_label :criteria_url)
                                               (assoc :followed s/Int
                                                      :image_file s/Str
                                                      :issuer_content_url s/Str
                                                      :issuer_content_name s/Str
+                                                     :issuer_image (s/maybe s/Str)
                                                      :name s/Str
                                                      :tags (s/maybe s/Str)
                                                      :not_after (s/maybe s/Int)


code chiropracticery

code chiropracticery

--- src/metabase/sync_database/analyze.clj
+++ src/metabase/sync_database/analyze.clj
@@ -175,7 +175,7 @@
        (test:no-preview-display driver field)
        (test:url-special-type   driver field)
        (test:json-special-type  driver field)
-       (test:email-special-type  driver field)))
+       (test:email-special-type driver field)))

 (defn make-analyze-table
   "Make a generic implementation of `analyze-table`."


Macros: Reorder some stuff.

Macros: Reorder some stuff.

--- test/com/nomistech/clojure_the_language/macros/examples.clj
+++ test/com/nomistech/clojure_the_language/macros/examples.clj
@@ -22,7 +22,7 @@
 ;;;; - The full power of the language is available when defining a macro.

 ;;;; ___________________________________________________________________________
-;;;; Simple rearranging of arguments.
+;;;; Simple rearranging of arguments

 ;;;; Define a macro:

@@ -57,12 +57,25 @@
 ;;;; - See syntax-quote below.

 ;;;; ___________________________________________________________________________
-;;;; Intro to syntax-quote and unquote.
+;;;; Syntax-quote, unquote and unquote-splicing.
+;;;; - Templates

-;;;; ` -- syntax-quote (the backquote character)
-;;;; ~ -- unquote
+;;;; `  -- syntax-quote (the backquote character)
+;;;; ~  -- unquote
+;;;; ~@ -- unquote-splicing

-;;;; Allow us to write macros using templates.
+(fact "Unquote inside syntax-quote unquotes"
+  (let [x (range 5)]
+    `[:a ~x :b])
+  => '[:a (0 1 2 3 4) :b])
+
+(fact "Unquote-splicing inside syntax-quote unquotes and splices"
+  (let [x (range 5)]
+    `[:a ~@x :b])
+  => '[:a 0 1 2 3 4 :b])
+
+;;;; ___________________________________________________________________________
+;;;; Defining macros using syntax-quote.

 (defmacro my-if-not-2
   ([test then else]
@@ -91,19 +104,6 @@
 ;;;;   - Note that much of Clojure is implemented using macros.
 ;;;;     e.g. `and`, `or`, `let`, `cond`, `while`, `letfn`, `with-redefs`, `->`,
 ;;;;          `->>`, `as->`.
-
-;;;; ___________________________________________________________________________
-;;;; ~@ -- unquote-splicing
-
-(fact "Unquote unquotes"
-  (let [x (range 5)]
-    `[:a ~x :b])
-  => '[:a (0 1 2 3 4) :b])
-
-(fact "Unquote-splicing unquotes and splices"
-  (let [x (range 5)]
-    `[:a ~@x :b])
-  => '[:a 0 1 2 3 4 :b])

 ;;;; ___________________________________________________________________________
 ;;;; Code transformation.


Flesh out docstring

Flesh out docstring

--- web/src/immutant/web.clj
+++ web/src/immutant/web.clj
@@ -29,7 +29,23 @@
    same env, any prior handler with that env will be replaced. Returns
    the given env with any missing defaults filled in.

-   Needs: options, examples"
+   The env is a map with these valid keys and [default] values:
+
+     :host  The interface bind address [localhost]
+     :port  The port listening for requests [8080]
+     :path  Maps the handler to a prefix of the url path [/]
+
+   Because env is the first argument, run calls can be threaded together, e.g.
+
+     (-> (run hello)
+       (assoc :path "/howdy")
+       (run howdy))
+       (merge {:path "/" :port 8081})
+       (run ola)))
+
+   The above actually creates two web server instances, one listening
+   for hello and howdy requests on port 8080, and another listening
+   for ola requests on 8081"
   ([handler] (run nil handler))
   ([env handler]
      (let [options (->> env


Исправление для логотипа на панели

Исправление для логотипа на панели

--- src-cljs/ixinfestor/omut.cljs
+++ src-cljs/ixinfestor/omut.cljs
@@ -1543,7 +1543,7 @@

 (def nav-app-state-key :menu)

-(defn nav [app _]
+(defn nav [app _ opts]
   (letfn [(f1 [{:keys [sub separator?] :as row}]
             (if separator?
               (ui-navbar-li-separator)
@@ -1554,7 +1554,7 @@
       om/IRender
       (render [_]
         (let [m (nav-app-state-key app)]
-          (ui-nav {}
+          (ui-nav opts
                   (when-let [menus (:left m)]
                     (apply ui-ul-navbar-nav
                            (map f1 menus)))


Add a link to the Clojars entry for clj-http

--- src/io/aviso/rook/clj_http.clj
+++ src/io/aviso/rook/clj_http.clj
@@ -6,7 +6,7 @@
   The implementation is restricted to sending and receiving
   EDN formatted data.

-  In order to make use of this namespace, you must add clj-http to your classpath:"
+  In order to make use of this namespace, you must [add clj-http to your classpath](https://clojars.org/clj-http)."
   {:added "0.1.19"}
   (:import [javax.servlet.http HttpServletResponse])
   (:require [clojure.core.async :refer [thread]]


Update process_lisp.clj

Update process_lisp.clj

--- src/iyye/bios/process_lisp.clj
+++ src/iyye/bios/process_lisp.clj
@@ -34,8 +34,8 @@
         params (for [cur (rest tree)]
                  (if (seq? cur) (process-lispy-control cur (str cur) IO) cur))]
     (if cmd
-      (dorun (scwords/action cmd params IO))
-      (future (Thread/sleep 500) (ioframes/process-output IO (str "failed to parse: " input))))))
+      (let [result (scwords/action cmd params IO)] result)
+      (scwords/->Iyye_Error (str "failed to parse: " input) identity))))

 (defn process-lispy-ctrl-input [IO input]
   (let [tree (parse/get-syntax-tree input)]
@@ -46,11 +46,17 @@
   (if (= \# (first input))
     (process-lispy-ctrl-input IO (subs input 1))
     ;(future (Thread/sleep 1000) (ioframes/process-output IO "parsing lispy sentences not implemented yet"))
-    (let [tree (parse/get-syntax-tree input)]
-      (future (process-lispy-control tree input IO)))))
+    (let [tree (parse/get-syntax-tree input)
+          result (process-lispy-control tree input IO)
+          tostr (if (:toString result) (:toString result) pr-str)]
+      (future (Thread/sleep 100) (ioframes/process-output IO (tostr result))))))
+
+;(defrecord DayRoutine [name day-start day-time threshold function task-future parent])
+

 (defn process-input [IO input]
-   (if (= input "What is answer to life, the universe and everything?")
+  ; (ioframes/process-output IO (str "IO ref" @dbg-IO))
+  (if (= input "What is answer to life, the universe and everything?")
      (future (Thread/sleep 1000) ( ioframes/process-output IO "42" ))
      (if (= \# (first input))
        (process-lispy-input IO (subs input 1))


preparation of tweet ui component for new component model

--- Clojure-Websockets/MainApp/src/cljs/birdwatch/ui/tweets.cljs
+++ Clojure-Websockets/MainApp/src/cljs/birdwatch/ui/tweets.cljs
@@ -69,24 +69,24 @@
    so that so that the tweet-view component and all components down the hierarchy
    can be implemented as pure functions.
    Rerenders the entire list whenever one (or both) of the atoms change."
-  [app tweets put-fn]
-  (let [state @app]
-    [:div (for [t @tweets] (if (:user t)
-                             ^{:key (:id_str t)} [tweet-view t state]
-                             ^{:key (:id_str t)} [missing-tweet t put-fn]))]))
+  [app put-fn]
+  (let [state @app
+        order (:sorted state)
+        n (:n state)
+        page (dec (:page state))]
+    (when order
+      (let [tweets (util/tweets-by-order order state n page)]
+        [:div (for [t tweets] (if (:user t)
+                                 ^{:key (:id_str t)} [tweet-view t state]
+                                 ^{:key (:id_str t)} [missing-tweet t put-fn]))]))))

 (defn init-component
   "Mounts tweet component. Takes put-fn as the function that can be called when some message
    needs to be sent back to the switchboard. Returns a function that handles incoming messages."
   [put-fn]
-  (let [app (atom {})
-        tweets (atom [])]
-    (r/render-component [tweets-view app tweets put-fn] (util/by-id "tweet-frame"))
+  (let [app (atom {})]
+    (r/render-component [tweets-view app put-fn] (util/by-id "tweet-frame"))
     (fn [msg]
-      (let [[_ state-snapshot] msg
-            order (:sorted state-snapshot)
-            n (:n state-snapshot)
-            page (dec (:page state-snapshot))]
+      (let [[_ state-snapshot] msg]
         (when (:live state-snapshot)
-          (reset! app state-snapshot)
-          (reset! tweets (util/tweets-by-order order state-snapshot n page)))))))
+          (reset! app state-snapshot))))))


Updating ports in integration test to use env vars.

--- int_test/cmr/metadata_db/int_test/utility.clj
+++ int_test/cmr/metadata_db/int_test/utility.clj
@@ -8,18 +8,16 @@
             [clj-time.format :as f]
             [clj-time.local :as l]
             [clj-time.coerce :as cr]
-            [inflections.core :as inf]))
-
-;;; Enpoints for services - change this for tcp-mon
-(def port 3001)
-
-(def concepts-url (str "http://localhost:" port "/concepts/"))
-
-(def concept-id-url (str "http://localhost:" port "/concept-id/"))
-
-(def reset-url (str "http://localhost:" port "/reset"))
-
-(def providers-url (str "http://localhost:" port "/providers"))
+            [inflections.core :as inf]
+            [cmr.transmit.config :as transmit-config]))
+
+(def concepts-url (str "http://localhost:" (transmit-config/metadata-db-port) "/concepts/"))
+
+(def concept-id-url (str "http://localhost:" (transmit-config/metadata-db-port) "/concept-id/"))
+
+(def reset-url (str "http://localhost:" (transmit-config/metadata-db-port) "/reset"))
+
+(def providers-url (str "http://localhost:" (transmit-config/metadata-db-port) "/providers"))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; utility methods


Startpath as file in clojure

Startpath as file in clojure

--- clojure/cljsearch/src/cljsearch/searcher.clj
+++ clojure/cljsearch/src/cljsearch/searcher.clj
@@ -83,7 +83,7 @@
         startdir (file startpath)
         tests [(fn [ss] (if (empty? startpath) "Startpath not defined" nil))
                (fn [ss] (if (not (.exists startdir)) "Startpath not found" nil))
-               (fn [ss] (if (not (is-search-dir startdir ss)) "Startpath does not match settings" nil))
+               ; (fn [ss] (if (not (is-search-dir startdir ss)) "Startpath does not match settings" nil))
                (fn [ss] (if (empty? (:searchpatterns ss)) "No search patterns specified" nil))]]
     (take 1 (filter #(not (= % nil)) (map #(% settings) tests)))))

@@ -392,7 +392,9 @@
 (defn search [settings]
   (let [errs (validate-settings settings)]
     (if (empty? errs)
-      (do
-        (search-dirs (get-search-dirs settings) settings)
-        [])
-      errs)))
+      (let [startfile (file (:startpath settings))]
+        (if (.isFile startfile)
+          (search-file startfile settings)
+          (search-dirs (get-search-dirs settings) settings))
+        []))
+      errs))


Get search files in single walkthrough

Get search files in single walkthrough

--- clojure/cljsearch/src/cljsearch/searcher.clj
+++ clojure/cljsearch/src/cljsearch/searcher.clj
@@ -158,11 +158,11 @@
         (not (:archivesonly settings))
         (is-search-file? f settings)))))

-(defn get-search-files-for-directory [d settings]
-  (vec (filter #(filter-file? % settings) (get-files-in-directory d))))
-
-(defn get-search-files [searchdirs settings]
-  (apply concat (map #(get-search-files-for-directory % settings) searchdirs)))
+(defn get-search-files [settings]
+  (let [startdir (file (:startpath settings))]
+    (if (:recursive settings)
+      (vec (filter #(filter-file? % settings) (filter #(.isFile %) (file-seq startdir))))
+      (vec (filter #(filter-file? % settings) (filter #(.isFile %) (.listFiles startdir)))))))

 (defn search-archive-file [f settings]
   (if (:verbose settings)
@@ -193,13 +193,6 @@
             (concat [result] (search-binary-string-for-pattern b m
               endmatchindex settings)))))
       [])))
-
-(defn search-binary-string-for-pattern-old [b p settings]
-  (if (:debug settings)
-    (log-msg (format "Searching binary string for pattern %s" p)))
-  (if (re-find p b)
-    [(->SearchResult p nil 0 0 0 "" [] [])]
-    []))

 (defn search-binary-string [b settings]
   (if (:debug settings)
@@ -422,19 +415,13 @@
       (log-msg "")))
   (doseq [f searchfiles] (search-file f settings)))

-(defn search-dirs [searchdirs settings]
-  (if (:verbose settings)
-    (do
-      (log-msg (format "\nDirectories to be searched (%d):" (count searchdirs)))
-      (doseq [d searchdirs] (log-msg (.getPath d)))))
-  (search-files (get-search-files searchdirs settings) settings))
-
 (defn search [settings]
   (let [errs (validate-settings settings)]
     (if (empty? errs)
-      (let [startfile (file (:startpath settings))]
-        (if (.isFile startfile)
-          (search-file startfile settings)
-          (search-dirs (get-search-dirs settings) settings))
-        []))
+      (let [startfile (file (:startpath settings))
+            searchfiles (if
+                          (.isFile startfile) [startfile]
+                          (get-search-files settings))]
+        (search-files searchfiles settings))
+        [])
       errs))


another attempt

another attempt

--- src/mafia_votecount/models.clj
+++ src/mafia_votecount/models.clj
@@ -82,7 +82,7 @@

 (defn delete-game-by-id [id]
   (delete game
-  (where {:id (string id)})))
+  (where {:id (str id)})))

 (defn delete-player-by-id [id]
   (delete player


Bumped lambda-blog patch version.

Bumped lambda-blog patch version.

--- lambda-blog/project.clj
+++ lambda-blog/project.clj
@@ -1,4 +1,4 @@
-(defproject lambda-blog/lambda-blog "1.1.1"
+(defproject lambda-blog/lambda-blog "1.1.2"
   :description "A static blog generator."
   :url "https://github.com/Idorobots/lambda-blog"
   :license {:name "MIT License"


Refactor

Refactor

--- src/refactor_nrepl/ns/dependencies.clj
+++ src/refactor_nrepl/ns/dependencies.clj
@@ -126,7 +126,9 @@
         (recur (read rdr nil :eof))))
     (filter (partial macro? ns) (filter prefix @syms))))

-(defn- get-symbols-used-in-macros [file-content]
+(defn- get-symbols-used-in-macros
+  "all symbols found below a macro form"
+  [file-content]
   (let [rdr (PushbackReader. (StringReader. (file-content-sans-ns file-content)))
         syms (atom [])
         ns (ns-from-string file-content)
@@ -176,28 +178,50 @@
         (recur (read rdr nil :eof))))
     (set @types)))

+(defn- get-symbols-to-prune-libspecs
+  [ns-form libspecs file-content symbols-from-ast symbols-used-in-macros]
+  (let [fully-qualified-macros (map #(assoc {} :name %)
+                                    (find-fully-qualified-macros file-content))
+        symbols-from-refer (used-symbols-from-refer libspecs symbols-used-in-macros)
+        referred (remove nil? (map (partial adorn-with-name-and-alias
+                                            (second ns-form))
+                                   symbols-from-refer))]
+    (set (concat referred symbols-from-ast fully-qualified-macros))))
+
+(defn get-symbols-to-prune-imports
+  [symbols-from-ast symbols-used-in-macros file-content ns-form]
+  (let [imports (get-imports ns-form)
+        imports-used-in-macros (filter-imports imports
+                                               (map :suffix symbols-used-in-macros))
+        imports-used-in-typehints (filter-imports imports
+                                                  (get-classes-used-in-typehints file-content))]
+    (concat symbols-from-ast imports-used-in-typehints imports-used-in-macros)))
+
+(defn- prune-libspecs
+  [libspecs file-content symbols-from-ast symbols-used-in-macros ns-form]
+  (->> libspecs
+       (remove-unused-requires
+        (get-symbols-to-prune-libspecs ns-form libspecs
+                                       file-content
+                                       symbols-from-ast
+                                       symbols-used-in-macros))
+       (filter (complement nil?))))
+
+(defn- prune-imports
+  [ns-form symbols-from-ast symbols-used-in-macros file-content]
+  (->> ns-form
+       get-imports
+       (remove-unused-imports
+        (get-symbols-to-prune-imports symbols-from-ast
+                                       symbols-used-in-macros
+                                       file-content ns-form))))
+
 (defn extract-dependencies [path ns-form]
   (let [libspecs (get-libspecs ns-form)
         file-content (slurp path)
         symbols-from-ast (-> file-content ns-ast used-vars set)
-        symbols-used-in-macros (get-symbols-used-in-macros file-content)
-        symbols-from-refer (remove nil? (map (partial adorn-with-name-and-alias
-                                                      (second ns-form))
-                                             (used-symbols-from-refer libspecs
-                                                                      symbols-used-in-macros)))
-        imports (get-imports ns-form)
-        imports-used-in-macros (filter-imports imports (map :suffix symbols-used-in-macros))
-        fully-qualified-macros (map #(assoc {} :name %)
-                                    (find-fully-qualified-macros file-content))
-        imports-used-in-typehints (filter-imports imports
-                                                  (get-classes-used-in-typehints file-content))]
-    {:require (->> libspecs
-                   (remove-unused-requires
-                    (set (concat symbols-from-refer symbols-from-ast
-                                 fully-qualified-macros)))
-                   (filter (complement nil?)))
-     :import (->> ns-form
-                  get-imports
-                  (remove-unused-imports (concat symbols-from-ast
-                                                 imports-used-in-typehints
-                                                 imports-used-in-macros)))}))
+        symbols-used-in-macros (get-symbols-used-in-macros file-content)]
+    {:require (prune-libspecs libspecs file-content symbols-from-ast
+                              symbols-used-in-macros ns-form)
+     :import (prune-imports ns-form symbols-from-ast
+                            symbols-used-in-macros file-content)}))


Support contexts in describe/it

Support contexts in describe/it

--- src/main/clojure/com/stuartsierra/lazytest.clj
+++ src/main/clojure/com/stuartsierra/lazytest.clj
@@ -1,12 +1,37 @@
 (ns com.stuartsierra.lazytest
   (:use [com.stuartsierra.lazytest.arguments :only (get-arg get-options seconds
-						    standard-metadata)]
+						    standard-metadata or-nil)]
         [com.stuartsierra.lazytest.groups :only (new-group group?)]
         [com.stuartsierra.lazytest.attach :only (add-group all-groups)]
         [com.stuartsierra.lazytest.plan :only (flat-plan)]
 	[com.stuartsierra.lazytest.run :only (run)]))

+(let [counter (atom 0)]
+  (defn- local-counter []
+    (swap! counter inc)))

+(defmacro with-context
+  "Establishes a local binding of sym to the state returned by context
+  c in all groups and examples found within body."
+  [sym c & body]
+  `(let [~(with-meta sym {::local true ::order (local-counter)}) ~c]
+     ~@body))
+
+(defmacro wrap-context
+  [bindings body]
+  {:pre [(or-nil vector? bindings)
+         (even? (count bindings))]}
+  (if (seq bindings)
+    `(with-context ~(first bindings) ~(second bindings)
+       (wrap-context ~(vec (nnext bindings)) ~body))
+    body))
+
+(defn- find-locals
+  "Returns a vector of locals bound by with-context in the
+  environment."
+  [env]
+  (vec (sort-by #(::order (meta %))
+                (filter #(::local (meta %)) (keys env)))))

 (defmacro describe [& args]
   (let [[sym args] (get-arg symbol? args)
@@ -15,16 +40,21 @@
 	contexts (seconds (:given opts))
 	metadata (merge (standard-metadata &form doc sym)
 			(dissoc opts :given))]
-    `(let [body# (vector ~@body)
-	   examples# (vec (filter fn? body#))
-	   subgroups# (vec (filter group? body#))]
-       (add-group *ns* (new-group ~contexts examples# subgroups# '~metadata)))))
+    `(wrap-context ~(:given opts)
+      (let [~(with-meta (gensym) {::in-describe true}) nil
+	    body# (vector ~@body)
+	    examples# (vec (filter fn? body#))
+	    subgroups# (vec (filter group? body#))
+	    new-group# (new-group ~contexts examples# subgroups# '~metadata)]
+	(if ~(some #(::in-describe (meta %)) (keys &env))
+	  new-group#
+	  (add-group *ns* new-group#))))))

 (defmacro it [& args]
   (let [[doc args] (get-arg string? args)
 	[opts body] (get-options args)
 	metadata (merge (standard-metadata &form doc) opts)]
-    `(with-meta (fn [] ~@body)
+    `(with-meta (fn ~(find-locals &env) ~@body)
        '~metadata)))

 (defn run-tests [& args]


FIX: load parent cache missing brackets, resulted in not loading cache

--- src/main/clojure/pdok/featured/persistence.clj
+++ src/main/clojure/pdok/featured/persistence.clj
@@ -3,6 +3,7 @@
             [pdok.postgres :as pg]
             [clojure.core.cache :as cache]
             [clojure.java.jdbc :as j]
+            [clojure.tools.logging :as log]
             [clj-time [coerce :as tc]]
             [cognitect.transit :as transit])
   (:import [java.io ByteArrayOutputStream]))
@@ -122,7 +123,7 @@
                            " WHERE dataset = ? AND collection = ?")
                       dataset collection] :as-arrays? true)
           for-cache (map (fn [[feature-id parent-collection parent-id parent-field]]
-                           [dataset collection feature-id] [parent-collection parent-id parent-field])
+                           [[dataset collection feature-id] [parent-collection parent-id parent-field]])
                          (drop 1 results))]
       for-cache)))


working on b+tree

working on b+tree

--- sample/src/sample/btree.clj
+++ sample/src/sample/btree.clj
@@ -99,7 +99,7 @@
   (loop [[k* & ks*] ks
          [v* & vs*] vs]
     (cond
-      (nil? k*)             [k* v*]
+      (nil? k*)             [::inf v*]
       (<= (compare k k*) 0) [k* v*]
       true                  (recur ks* vs*))))

@@ -114,15 +114,11 @@
      (internal-node ks2 vs2)]))

 (defn- inode-ins [{:keys [ks vs] :as n} k v]
-  (if-not (nil? k)
-    (let [[ks1 ks2] (split-with #(< (compare % k) 0) ks)
-          [vs1 vs2] (split-at (count ks1) vs)
-          nks       (concat ks1 [k] ks2)
-          nvs       (concat vs1 [v] vs2)]
-      (internal-node nks nvs))
-    (let [nks ks
-          nvs (-> vs butlast (concat [v]))]
-      (internal-node nks nvs))))
+  (let [[ks1 ks2] (split-with #(< (compare % k) 0) ks)
+        [vs1 vs2] (split-at (count ks1) vs)
+        nks       (concat ks1 [k] ks2)
+        nvs       (concat vs1 [v] vs2)]
+    (internal-node nks nvs)))

 (defn- inode-insert [{:keys [ks vs] :as n} k v]
   #_(let [nn (inode-ins n k v)]


gen-class was hiding an old reference to letters-to - now fixed

--- src/alphabet_diamond/core.clj
+++ src/alphabet_diamond/core.clj
@@ -1,5 +1,4 @@
-(ns alphabet-diamond.core
-  	(:gen-class))
+(ns alphabet-diamond.core)

 (def ^:const row-template "ZYXWVUTSRQPONMLKJIHGFEDCBABCDEFGHIJKLMNOPQRSTUVWXYZ")

@@ -18,7 +17,7 @@
 				(into rows-and-letters (rest rows-and-letters))))

 (defn row [row-number letter]
-	(let [row-letter (nth (letters-to letter) (- row-number 1))]
+	(let [row-letter (nth (letter-range \A (ucase-letter letter)) (- row-number 1))]
 				(clojure.string/replace row-template (re-pattern (str "[^" row-letter "]")) " ")
 	))


Support single arity in t!

Support single arity in t!

--- etc/repl.clj
+++ etc/repl.clj
@@ -145,22 +145,30 @@
     (get sys component-name)))

+(def kaocha-conf  {:config "/home/ubuntu/.emacs.d/etc/kaocha.edn"})
+
 (defn t
   "Run tests via kaocha - either all or a list of vars"
   ([]
-   (kaocha.repl/run :unit {:config "/home/ubuntu/.emacs.d/etc/kaocha.edn"}))
+   (kaocha.repl/run :unit kaocha-conf))
   ([ns-list]
-   (apply kaocha.repl/run (conj ns-list {:config "/home/ubuntu/.emacs.d/etc/kaocha.edn"}))))
+   (apply kaocha.repl/run (conj (if (coll? ns-list)
+                                  ns-list
+                                  [ns-list])
+                                kaocha-conf))))

 (defn t!
-  "Run tests via kaocha, but refresh first - runs all tests or a list of vars"
+  "Run tests via kaocha, but refresh first - runs all tests or a list (or one) of ns vars"
   ([]
    (refresh)
-   (kaocha.repl/run :unit {:config "/home/ubuntu/.emacs.d/etc/kaocha.edn"}))
+   (kaocha.repl/run :unit kaocha-conf))
   ([ns-list]
    (refresh)
-   (apply kaocha.repl/run (conj ns-list {:config "/home/ubuntu/.emacs.d/etc/kaocha.edn"}))))
+   (apply kaocha.repl/run (conj (if (coll? ns-list)
+                                  ns-list
+                                  [ns-list])
+                                kaocha-conf))))

 (defn clear-aliases


now instantiate-aws works :-)

now instantiate-aws works :-)

--- main/src/dda/pallet/dda_backup_crate/domain.clj
+++ main/src/dda/pallet/dda_backup_crate/domain.clj
@@ -42,14 +42,14 @@
 ; TODO: Wire hardcoded password through domain config
 (s/defn ^:always-validate
   user-domain-configuration
-  [config :- BackupConfig]
+  [config :- BackupConfigResolved]
   (let [{:keys [backup-user transport-management]} config
         public-gpg (get-in transport-management [:duplicity-push :public-key])
         private-gpg (get-in transport-management [:duplicity-push :private-key])
         passphrase (get-in transport-management [:duplicity-push :passphrase])]
     (merge
       (if (contains? transport-management :duplicity-push)
-        {:root {:hashed-password {:plain "fksdjfiosjfr8o0jterojdo"}
+        {:root {:hashed-password "fksdjfiosjfr8o0jterojdo"
                 :gpg             {:trusted-key {:public-key  public-gpg
                                                 :private-key private-gpg
                                                 :passphrase  passphrase}}}}


up version for new dev

up version for new dev

--- kafka-clj/project.clj
+++ kafka-clj/project.clj
@@ -1,4 +1,4 @@
-(defproject kafka-clj "2.3.8-SNAPSHOT"
+(defproject kafka-clj "2.3.9-SNAPSHOT"
   :description "fast kafka library implemented in clojure"
   :url "https://github.com/gerritjvv/kafka-fast"
   :license {:name "Eclipse Public License"


CMR-1948: Updating mapping settings to that we won't receive errors. Changing the update mapping call to fail if there are any conflicts.

--- cubby-app/src/cmr/cubby/data/elastic_cache_store.clj
+++ cubby-app/src/cmr/cubby/data/elastic_cache_store.clj
@@ -13,7 +13,7 @@
   "The name of the index in elastic search."
   "cubby_cached_values")

-(def string-type
+(def not-indexed-string-type
   "The mapping type of saved string values"
   {:type "string"
    ;; Stored so we can retrieve the value
@@ -21,6 +21,13 @@
    ;; Do not index the field, otherwise strings are limited to 32KB. The theoretical max size for
    ;; a field that is not indexed is 2GB.
    :index "no"})
+
+(def indexed-string-type
+  "A string that is indexed but not analyzed."
+  {:type "string"
+   ;; Stored so we can retrieve the value
+   :store "yes"
+   :index "not_analyzed"})

 (def type-name
   "The name of the mapping type within the cubby elasticsearch index."
@@ -33,13 +40,13 @@
     :_source {:enabled true},
     :_all {:enabled false},
     :_id   {:path "key-name"},
-    :properties {:key-name string-type
+    :properties {:key-name indexed-string-type

                  ;; Deprecated, remove in future sprint. We changed the value to support values
                  ;; larger than 32KB.
-                 :value string-type
+                 :value indexed-string-type

-                 :value2 string-type}}})
+                 :value2 not-indexed-string-type}}})

 (def index-settings
   "Defines the cubby elasticsearch index settings."
@@ -48,6 +55,7 @@
     :number_of_replicas 1,
     :refresh_interval "1s"}})

+
 (defn create-index-or-update-mappings
   "Creates the index needed in Elasticsearch for data storage"
   [elastic-store]
@@ -55,8 +63,10 @@
     (if (esi/exists? conn index-name)
       (do
         (info "Updating cubby mappings and settings")
-        (doseq [[type-name mapping] mappings]
-          (esi/update-mapping conn index-name type-name mapping)))
+        (let [response (esi/update-mapping conn index-name type-name :mapping mappings :ignore_conflicts false)]
+          (when-not (= {:acknowledged true} response)
+            (errors/internal-error! (str "Unexpected response when updating elastic mappings: "
+                                         (pr-str response))))))
       (do
         (info "Creating cubby index")
         (esi/create conn index-name :settings index-settings :mappings mappings)
@@ -66,6 +76,9 @@
 (comment

   (def db (get-in user/system [:apps :cubby :db]))
+
+  (create-index-or-update-mappings db)
+  (esi/get-mapping (:conn db) index-name type-name)

   (d/reset db)


[Fix #2775] Discover: Popular hashtags counter is misplaced

--- src/status_im/ui/screens/discover/styles.cljs
+++ src/status_im/ui/screens/discover/styles.cljs
@@ -11,8 +11,11 @@
    :border-bottom-color styles/color-light-gray4})

 (def row
-  {:flex-direction :row
-   :margin-bottom  10})
+  {:flex            1
+   :flex-direction  :row
+   :align-items     :center
+   :justify-content :space-between
+   :margin-bottom   10})

 (def column
   {:flex-direction :column})


add resume owner name to sample resume

add resume owner name to sample resume

--- app/src/cljs/app/res.cljs
+++ app/src/cljs/app/res.cljs
@@ -15,7 +15,8 @@
                  :description "Supervising of team members. Negotiating prices and special deals with suppliers and customers. Developing weekly promotions for heating products. Determining of prices and conditions for our supplying of goods for bigger projects. Training and teaching of apprentices. Marketing of products utilising renewable energy. Compiling annual reports and goals for the following year."}]})

 (def sample-resume
-  {:profile "Richard hails from Tulsa. He has earned degrees from the University of Oklahoma and Stanford. (Go Sooners and Cardinals!) Before starting Pied Piper, he worked for Hooli as a part time software developer. While his work focuses on applied information theory, mostly optimizing lossless compression schema of both the length-limited and adaptive variants, his non-work interests range widely, everything from quantum computing to chaos theory. He could tell you about it, but THAT would NOT be a “length-limited” conversation! "
+  {:name "Richard Hendriks"
+   :profile "Richard hails from Tulsa. He has earned degrees from the University of Oklahoma and Stanford. (Go Sooners and Cardinals!) Before starting Pied Piper, he worked for Hooli as a part time software developer. While his work focuses on applied information theory, mostly optimizing lossless compression schema of both the length-limited and adaptive variants, his non-work interests range widely, everything from quantum computing to chaos theory. He could tell you about it, but THAT would NOT be a “length-limited” conversation! "
    :contact {:name "Richard Hendriks"
              :email "richard.hendriks@mail.com"
              :phone "(912) 555-4321"}


added stay

added stay

--- src/babel/english/lexicon.clj
+++ src/babel/english/lexicon.clj
@@ -960,6 +960,9 @@
                    :subj {:human true}
                    :obj {:speakable true}}}}

+  "stay" {:synsem {:cat :verb
+                     :sem {:pred :stay}}}
+
    "stain" {:synsem {:cat :verb
                 :sem {:pred :stain}}}


fixes warning about overriding clojure.core/load

--- src/nevergreen/api/version.clj
+++ src/nevergreen/api/version.clj
@@ -9,10 +9,10 @@
 (defn- load-meta []
   (trim (slurp (resource "version_meta.txt"))))

-(defn- load []
+(defn- full-version []
   (str (load-version) "+" (load-meta)))

 (defn version []
-  (let [version (load)]
+  (let [version (full-version)]
     (log/info version)
     version))


Add color of underlying grid to motion seeds.

--- src/videotest/falling/motion_seeds.clj
+++ src/videotest/falling/motion_seeds.clj
@@ -6,23 +6,23 @@

 (def SEED-W 20)
 (def SEED-CREATE-ODDS 0.1)
-(def SEED-RGBA [255 0 255 100])

 (defn seed-created? []
   (> SEED-CREATE-ODDS (rand)))

-(defn init-motion-seed [x y]
-  {:x x :y y})
+(defn init-motion-seed [x y color]
+  {:x x :y y :color color})

-(defn create-motion-seeds [bin-size {:keys [motion-trace motion-seeds] :as state}]
+(defn create-motion-seeds [bin-size {:keys [motion-trace motion-seeds color-record] :as state}]
   (assoc-in state [:motion-seeds]
-            (reduce (fn [memo [[col row] {:keys [life]}]]
+            (reduce (fn [memo [[col row :as coords] {:keys [life]}]]
                       (if (and (<= mtrace/MAX-TRACE-LIFE life)
                                (seed-created?))
                         (conj memo (init-motion-seed (+ (* col bin-size)
                                                         (rand bin-size))
                                                      (+ (* row bin-size)
-                                                        (rand bin-size))))
+                                                        (rand bin-size))
+                                                     (color-record coords)))
                         memo))
                     motion-seeds
                     motion-trace)))
@@ -45,15 +45,15 @@
        (create-motion-seeds bin-size)
        (move-motion-seeds display-height)))

-(defn draw-motion-seed [x y]
+(defn draw-motion-seed [x y color]
+  (apply q/fill color)
   (q/ellipse x y SEED-W SEED-W))

 (defn draw-motion-seeds [{:keys [motion-seeds]}]
   (q/push-style)
   (q/no-stroke)
-  (apply q/fill SEED-RGBA)
   (dorun
-   (map (fn [{:keys [x y]}]
-          (draw-motion-seed x y))
+   (map (fn [{:keys [x y color]}]
+          (draw-motion-seed x y color))
         motion-seeds))
   (q/pop-style))


Default to :move when coords are adjacent

--- src/obb_rules/actions/goto.clj
+++ src/obb_rules/actions/goto.clj
@@ -1,9 +1,11 @@
 (ns obb-rules.actions.goto
   "Allows movement from a unit to non-adjacent coordinates.
   Translates itself to the best found path via :move actions."
-  (:require [obb-rules.actions.move :as move]))
+  (:require [obb-rules.actions.move :as move]
+            [obb-rules.board :as board]))

 (defn build-goto
   "Builds a goto action on a board"
-  [args]
-  (move/build-move args))
+  [[from to quantity]]
+  (if (board/adjacent? from to)
+    (move/build-move [from to quantity])))


RS & MG | #18 | Change some wording on /candidate-writers and about page

--- src/objective8/translation.clj
+++ src/objective8/translation.clj
@@ -64,7 +64,7 @@

An objective is a change that could be achieved by introducing new policy.  For example: improving access to public housing, or increasing the safety of our roads.

-
Writers are experts responsible for drafting policy.  They use the crowdsourced questions, answers and comments to produce policy drafts*.  These are further refined through cycles of feedback and redrafting.

+
Writers work with each other and the community to draft policy.  They use the crowdsourced questions, answers and comments to produce policy drafts*.  These are further refined through cycles of feedback and redrafting.

You can get involved and have your say by creating and sharing objectives, offering your opinion through comments, asking and answering questions, suggesting policy writers*, or even providing feedback on the policy drafts themselves.  The whole process is open and transparent.

@@ -142,11 +142,11 @@
                                   :doc-description "Candidate policy writers..."
                                   :page-title "Invite a policy writer"
                                   :page-intro "Do you know someone with the enthusiasm and expertise to help draft this policy?"
-                                  :writer-name-label "Who"
+                                  :writer-name-label "I'd like to invite: "
                                   :writer-name-title "Writer names are a maximum length of 50 characters"
-                                  :reason-label "Why"
+                                  :reason-label "to help draft this policy, because: "
                                   :reason-title "Reasons are a maximum length of 1000 characters"
-                                  :submit "Invite"}
+                                  :submit "Create an invite"}
                      :invitation-sign-in {:please "Please"
                                           :sign-in "sign in"
                                           :to "to invite a policy writer."}
@@ -155,9 +155,9 @@
                                            :page-title "Can you help us to draft some policy?"
                                            :sign-in-to-accept "Sign in to accept"
                                            :accept "Accept"}
-                     :candidate-list {:page-intro "Writers are experts responsible for drafting policy."
-                                      :candidate-list-heading "Recently added candidates"
-                                      :no-candidates "No writers have been invited yet."
+                     :candidate-list {:page-intro "Writers work with each other and the community to draft policy."
+                                      :candidate-list-heading "Recently added candidate writers"
+                                      :no-candidates "No candidate writers have been invited yet."
                                       :invited-by "Invited by: "}
                      :users-email {:doc-title "Sign up almost there | Objective[8]"
                                    :doc-description ""


Added message printing.

Added message printing.

--- src/simply_credit_mailer/onyx/tasks/mailer.clj
+++ src/simply_credit_mailer/onyx/tasks/mailer.clj
@@ -20,6 +20,7 @@
           :lifecycles []}})

 (defn send-message [segment]
+  (println "Sending message: " (pr-str segment))
   (mailer/send-message (-> segment :to)
                        (-> segment :subject)
                        (-> segment :body)))


When authenticating with github (which we do outside of tentacles) throw on exception.

--- src/circle/workers/github.clj
+++ src/circle/workers/github.clj
@@ -68,14 +68,13 @@
         json (-> response :body json/decode)
         access-token (-> json :access_token)
         error? (-> json :error)]
-    (if error?
-      false ; TODO: we don't have a good way of raising errors to our
-                     ; attention. Use Airbrake.
-      (let [user (mongo/fetch-by-id :users (mongo/object-id userid))
-            updated (merge user {:github_access_token access-token})]
-        (assert user)
-        (mongo/update! :users user updated)
-        true))))
+    (when error?
+      (throw error?))
+    (let [user (mongo/fetch-by-id :users (mongo/object-id userid))
+          updated (merge user {:github_access_token access-token})]
+      (assert user)
+      (mongo/update! :users user updated)
+      true)))

 (defn authorization-url [redirect]
   "The URL that we send a user to, to allow them authorize us for oauth. Redirect is where the should be redirected afterwards"


public json user view

public json user view

--- src/piraspbay/handlers/api.clj
+++ src/piraspbay/handlers/api.clj
@@ -7,38 +7,40 @@
 (defn online? [lastSeen]
   (time/before? (coerce/from-long lastSeen) (time/minus (time/now) (time/minutes 10))))

+(defn user-json [user] {:name (:name user)
+                        :online (online? (:lastSeen user))})
+
 (defn register [req]
   (let [key (-> req :params :key)
-       name (-> req :params :name)
-       address (-> req :remote-addr)]
-       (ping name key address (time/now))))
+        name (-> req :params :name)
+        address (-> req :remote-addr)]
+    (ping name key address (time/now))))

 (defn profile [req]
   (let [me (-> req :params :me)
-       name (-> req :params :user)
-       user (db/find-user name)]
-       {:name (:name user)
-        :online (online? (:lastSeen user))}))
+        name (-> req :params :user)
+        user (db/find-user name)]
+    (user-json user)))

 (defn friend [req]
   (let [me (-> req :params :me)]
-       (to-public (db/find-friends me))))
+    (map user-json (db/find-friends me))))

 (defn request [req]
   (let [me (-> req :params :me)]
-       [me]))
+    [me]))

 (defn accept [req]
   (let [me (-> req :params :me)
-       user (-> req :params :user)]
-       [me user]))
+        user (-> req :params :user)]
+    [me user]))

 (defn delete [req]
   (let [me (-> req :params :me)
-       user (-> req :params :user)]
-       [me user]))
+        user (-> req :params :user)]
+    [me user]))

 (defn new-request [req]
   (let [me (-> req :params :me)
-       user (-> req :params :user)]
-       [me user]))
+        user (-> req :params :user)]
+    [me user]))


Fix namespace expansion

Fix namespace expansion

--- src/clj/clojuredocs/pages.clj
+++ src/clj/clojuredocs/pages.clj
@@ -115,19 +115,23 @@
                       (filter #(get #{"var" "function" "special-form" "macro"} (:type %)))))})

 (defn expand-ns [ns]
-  (:name (mon/fetch-one :namespaces
-           :where {:name (->> (str/split ns #"\.")
-                              (map #(str % "[^.]*"))
-                              (interpose "\\.")
-                              (apply str)
-                              re-pattern)})))
+  (let [pattern (->> (str/split ns #"\.")
+                     (map #(str % "[^.]*"))
+                     (interpose "\\.")
+                     (apply str)
+                     re-pattern)]
+    (->> search/clojure-lib
+         :namespaces
+         (map :name)
+         (filter #(re-find pattern %))
+         first)))

 (defn lookup-var [ns name]
   (mon/fetch-one :vars :where {:name name :ns ns}))

 (defn lookup-var-expand [ns name]
-  (or (lookup-var ns name)
-      (lookup-var (expand-ns ns) name)))
+  (or (search/lookup (str ns "/" name))
+      (search/lookup (str (expand-ns ns) "/" name))))

 (defn format-concept-title [concept]
   (->> (str/split concept #"-")


changed constructors for FireTuple.

changed constructors for FireTuple.

--- src/clj/forma/source/fire.clj
+++ src/clj/forma/source/fire.clj
@@ -46,7 +46,7 @@
   (fn [c t] (and (> t 330)
                 (> c 50))))

-(defn tupleize
+(defn fire-tuple
   [t-above-330 c-above-50 both-preds count]
   (FireTuple. t-above-330 c-above-50 both-preds count))

@@ -58,7 +58,7 @@
       ((c/juxt #'conf-above-50 #'per-day) ?conf :> ?conf-50 ?count)
       (fires-above-330 ?kelvin :> ?temp-330)
       (both-preds ?conf ?kelvin :> ?both-preds)
-      (tupleize ?temp-330 ?conf-50 ?both-preds ?count :> ?tuple)))
+      (fire-tuple ?temp-330 ?conf-50 ?both-preds ?count :> ?tuple)))

 ;; ## Fire Queries

@@ -97,15 +97,15 @@
 (defn add-fires
   "Adds together two FireTuple objects."
   [t1 t2]
-  (tupleize (+ (.temp330 t1) (.temp330 t2))
-            (+ (.conf50 t1) (.conf50 t2))
-            (+ (.bothPreds t1) (.bothPreds t2))
-            (+ (.count t1) (.count t2))))
+  (fire-tuple (+ (.temp330 t1) (.temp330 t2))
+              (+ (.conf50 t1) (.conf50 t2))
+              (+ (.bothPreds t1) (.bothPreds t2))
+              (+ (.count t1) (.count t2))))

 ;; Combines various fire tuples into one.
 (defaggregateop comb
-  ([] (FireTuple. 0 0 0 0))
+  ([] (fire-tuple 0 0 0 0))
   ([state tuple] (add-fires state tuple))
   ([state] [state]))

@@ -132,7 +132,7 @@
 (defmapop [running-fire-sum [start end]]
   "Special case of `running-sum` for `FireTuple` thrift objects."
   [tseries]
-  (let [empty (FireTuple. 0 0 0 0)]
+  (let [empty (fire-tuple 0 0 0 0)]
     (->> tseries
          (running-sum [] empty add-fires)
          (mk-ts start end))))
@@ -143,7 +143,7 @@
   (let [start (datetime->period t-res start)
         end (datetime->period t-res end)
         length (inc (- end start))
-        mk-fire-tseries (p/vals->sparsevec start length (FireTuple. 0 0 0 0))]
+        mk-fire-tseries (p/vals->sparsevec start length (fire-tuple 0 0 0 0))]
     (<- [?dataset ?m-res ?t-res ?tilestring ?sample ?line ?ct-series]
         (src ?dataset ?m-res ?t-res ?tilestring ?tperiod ?sample ?line ?tuple)
         (mk-fire-tseries ?tperiod ?tuple :> _ ?tseries)


Longer drip time before alerting coffee ready

--- src/clj/mokkameister/mqtt.clj
+++ src/clj/mokkameister/mqtt.clj
@@ -17,10 +17,10 @@

 (defn- brew-finished? [history]
   (->> history
-       (take-last 5)
+       (take-last 6)
        (map #(<= THRESHOLD_WATT %))
        (vec)
-       (= [true true false false false])))
+       (= [true true false false false false])))

 (defn- connect! []
   (let [
@@ -33,7 +33,7 @@

 (defn connect-and-process! []
   (let [conn (connect!)
-        history (atom (vec [0 0 0 0 0]))
+        history (atom (vec [0 0 0 0 0 0]))
         on-receive (fn [^String topic _ ^bytes payload]
                      (let [wattage (Float/parseFloat (String. payload "UTF-8"))]
                        (do


Send full uri with :png_image_file

Send full uri with :png_image_file

--- src/clj/salava/badge/main.clj
+++ src/clj/salava/badge/main.clj
@@ -77,8 +77,8 @@

 (defn png-convert-url [ctx image]
   (if (re-find #"\w+\.svg$" image)
-    (str (u/get-base-path ctx) "/obpv1/file/as-png?image=" image)
-    (str "/" image)))
+    (str (u/get-full-path ctx) "/obpv1/file/as-png?image=" image)
+    (str (u/get-site-url ctx) "/" image)))

 (defn check-metabadge!
   "Check if badge is metabadge (= milestonebadge) or part of metabadge (= required badge)"


Add max hp to player info popover

Add max hp to player info popover

--- src/cljc/robinson/render.cljc
+++ src/cljc/robinson/render.cljc
@@ -621,9 +621,8 @@
   (let [screen        (get state :screen)
         x             18
         y             5
-        height        9
+        height        11
         player-name   (rp/get-player-attribute state :name)
-        hp            (int (rp/player-hp state))
         max-hp        (int (rp/player-max-hp state))
         level         (inc (rp/player-level state))
         xp            (or (rp/xp-acc-for-next-level state) -9)
@@ -635,6 +634,8 @@
     (render-list screen (inc x) (inc y) 43 height
         [{:s (format "Name:      %s" player-name) :fg :black :bg :white :style #{}}
          {:s (format "Level:     %d (%d/%d)" level xp xp-next-level) :fg :black :bg :white :style #{}}
+         {:s "" :fg :black :bg :white :style #{}}
+         {:s (format "Max HP:    %d" max-hp ) :fg :black :bg :white :style #{}}
          {:s "" :fg :black :bg :white :style #{}}
          {:s (format "Strength:  %d" strength ) :fg :black :bg :white :style #{}}
          {:s (format "Dexterity: %d" dexterity ) :fg :black :bg :white :style #{}}


Split make-step from simulate.

Split make-step from simulate.

--- src/clojure_robby/genetic.clj
+++ src/clojure_robby/genetic.clj
@@ -78,32 +78,32 @@
   "Adds 2 vectors"
   (mapv + v1 v2))

-(defn simulate [dna the-map]
+
+(defn make-step [[a-dna a-map pos score]]
+  "Makes a single step on the map, according to the DNA sequence."
+  (let [situation (mapv (fn[v] (get-tile-index (get-tile a-map (add-vec pos v)))) dir-vects)
+        action-idx (reduce + (mapv * situation multipliers))
+        action (nth a-dna action-idx)
+        step-to
+        (fn [the-pos]
+          (if (not= \w (get-tile a-map the-pos))
+            [a-dna a-map the-pos score]
+            [a-dna a-map pos (- score wall-penalty)]))]
+    (case action
+      (\l \r \u \d)
+      (let [new-pos (add-vec pos (nth dir-vects (get-action-index action)))]
+        (step-to new-pos))
+      \x
+      (let [new-pos (add-vec pos (rand-nth (take 4 dir-vects)))]
+        (step-to new-pos))
+      \p
+      (if (= \g (get-tile a-map pos))
+        [a-dna (set-tile a-map pos \p) pos (+ score gold-value)]
+        [a-dna a-map pos (- score pick-up-penalty)]))))
+
+(defn simulate [a-dna a-map]
   "Simulates the DNA on a map. Evaluates to the score the robot achieved in simul-steps."
-  (let [make-step
-        (fn [[current-map pos score]]
-          "Makes a single step on the map, according to the DNA sequence."
-          (let [situation (mapv (fn[v] (get-tile-index (get-tile current-map (add-vec pos v)))) dir-vects)
-                action-idx (reduce + (mapv * situation multipliers))
-                action (nth dna action-idx)
-                step-to
-                (fn [the-pos]
-                  (if (not= \w (get-tile current-map the-pos))
-                    [current-map the-pos score]
-                    [current-map pos (- score wall-penalty)]))]
-            ;(print pos)
-            (case action
-              (\l \r \u \d)
-              (let [new-pos (add-vec pos (nth dir-vects (get-action-index action)))]
-                (step-to new-pos))
-              \x
-              (let [new-pos (add-vec pos (rand-nth (take 4 dir-vects)))]
-                (step-to new-pos))
-              \p
-              (if (= \g (get-tile current-map pos))
-                [(set-tile current-map pos \p) pos (+ score gold-value)]
-                [current-map pos (- score pick-up-penalty)]))))
-        iteration (iterate make-step [the-map [1 1] 0])
-        [_ final-pos final-score] (nth iteration simul-steps)]
+  (let [iteration (iterate make-step [a-dna a-map [1 1] 0])
+        [_ _ final-pos final-score] (nth iteration simul-steps)]
     final-score))


making alpha work.

making alpha work.

--- src/play_clj/core_graphics.clj
+++ src/play_clj/core_graphics.clj
@@ -490,7 +490,9 @@
   (let [^Batch batch (.getBatch renderer)]
     (.begin batch)
     (doseq [entity entities]
-      (e/draw! entity screen batch))
+      (.setColor batch (color 1 1 1 (or (:opacity entity) 1.0)))
+      (e/draw! entity screen batch)
+      (.setColor batch (color 1 1 1 1)))
     (.end batch))
   entities)


fix json schema test

fix json schema test

--- test/cljs/gc_api_browser/json_schema_test.cljs
+++ test/cljs/gc_api_browser/json_schema_test.cljs
@@ -27,7 +27,7 @@
            (json-schema/expand-href "/creditors" fixture)))))

 (deftest test-schema->domain
-  (is (= "https://api.gocardless.com"
+  (is (= "https://api-sandbox.gocardless.com"
          (json-schema/schema->domain fixture))))

 (deftest schema->request


Adding some clustered capabilities, but not working due to isRunning always returning false

--- modules/cache/src/main/clojure/immutant/cache.clj
+++ modules/cache/src/main/clojure/immutant/cache.clj
@@ -17,11 +17,15 @@

 (ns immutant.cache
   (:use [clojure.core.cache :only (defcache)])
-  (:require [clojure.core.cache])
+  (:require [clojure.core.cache]
+            [immutant.registry :as lookup])
   (:import [clojure.core.cache CacheProtocol]
+           [org.jboss.msc.service ServiceName]
+           [org.infinispan.config Configuration$CacheMode]
            [org.infinispan.manager DefaultCacheManager]))

 (def local-manager (DefaultCacheManager.))
+(def clustered-manager (lookup/fetch (.append ServiceName/JBOSS (into-array ["infinispan" "web"]))))

 (defcache InfinispanCache [cache]
   CacheProtocol
@@ -47,12 +51,51 @@
   Object
   (toString [_] (str cache)))

+(defn cache-mode
+  [kw {:keys [sync]}]
+  (cond
+   (= :distributed kw) (if sync Configuration$CacheMode/DIST_SYNC Configuration$CacheMode/DIST_ASYNC)
+   (= :replicated kw) (if sync Configuration$CacheMode/REPL_SYNC Configuration$CacheMode/REPL_ASYNC)
+   (= :invalidated kw) (if sync Configuration$CacheMode/INVALIDATION_SYNC Configuration$CacheMode/INVALIDATION_ASYNC)
+   (= :local kw) Configuration$CacheMode/LOCAL
+   :default (throw (IllegalArgumentException. "Must be one of :distributed, :replicated, :invalidated, or :local"))))
+
+(defn reconfigure
+  [name mode]
+  (let [cache (.getCache clustered-manager name)
+        config (.getConfiguration cache)
+        current (.getCacheMode config)]
+    (when-not (= mode current)
+      (println "Reconfiguring cache" name "from" current "to" mode)
+      (.stop cache)
+      (.setCacheMode config mode)
+      (.defineConfiguration clustered-manager name config)
+      (.start cache))
+    cache))
+
+(defn configure
+  [name mode]
+  (println "Configuring cache" name "as" mode)
+  (let [config (.clone (.getDefaultConfiguration clustered-manager))]
+    (println "JC: wtf")
+    (.setClassLoader config (.getContextClassLoader (Thread/currentThread)))
+    (.setCacheMode config mode)
+    (.defineConfiguration clustered-manager name config)
+    (.getCache clustered-manager)))
+
 (defn local-cache
   ([] (InfinispanCache. (.getCache local-manager)))
   ([name] (InfinispanCache. (.getCache local-manager name)))
   ([name base] (clojure.core.cache/seed (local-cache name) base)))

+(defn clustered-cache
+  [name mode & {:as options}]
+  (InfinispanCache. (if (.isRunning clustered-manager name)
+                      (reconfigure name (cache-mode mode options))
+                      (configure name (cache-mode mode options)))))
+
 (defn cache
   "The entry point to determine whether clustered, remote, or local.
    Only local supported currently."
-  [& args] (apply local-cache args))+  [& args] (apply local-cache args))
+


Working for perfectly crafted examples

Working for perfectly crafted examples

--- src/atom_finder/classifier/macro-operator-precedence.clj
+++ src/atom_finder/classifier/macro-operator-precedence.clj
@@ -1,6 +1,13 @@
 (in-ns 'atom-finder.classifier)
 (import '(org.eclipse.cdt.core.dom.ast IASTNode IASTName IASTIdExpression IASTBinaryExpression IASTUnaryExpression IASTExpressionStatement IASTPreprocessorFunctionStyleMacroDefinition IASTDoStatement IASTLiteralExpression IASTPreprocessorMacroExpansion cpp.ICPPASTTemplateId)
         '(org.eclipse.cdt.internal.core.parser.scanner ASTFunctionStyleMacroDefinition ASTMacroDefinition))
+
+;;https://stackoverflow.com/questions/9568050/in-clojure-how-to-write-a-function-that-applies-several-string-replacements
+(s/defn replace-map
+  "given an input string and a hash-map, returns a new string with all
+   keys in map found in input replaced with the value of the key"
+  [replacements :- {s/Str s/Str} target :- s/Str]
+    (reduce #(apply str/replace (re-pattern %1) %2) target replacements))

 (extend-protocol atom-finder.util/ASTTree clojure.lang.ISeq
   (ast-node [lst] (first lst))
@@ -68,68 +75,79 @@
   [root :- IASTTranslationUnit]
   (->> root .getMacroExpansions (keep outer-macro-operator-atom?)))

-(defn parse-expansion-args
-  [expansion]
-  (let [arg-expr (some->> expansion str (re-find #"\w+\((.*)\)") second parse-frag)]
+(s/defn expansion-args-tree
+  "Take the arguments to a macro and parse them into ASTs"
+  [exp :- IASTPreprocessorMacroExpansion]
+  (let [arg-expr (some->> exp str (re-find #"\w+\((.*)\)") second parse-frag)]
     (when arg-expr
       (if (instance? IASTExpressionList arg-expr)
         (children arg-expr)
         [arg-expr]))))

-(s/defn macro-ast-replacement
-  "Find every macro parameter and replace it with the AST of its argument,
-   and compare that against the expanded parse"
+(s/defn expansion-args-str
+  "Extract the code in the arguments to a macro"
   [exp :- IASTPreprocessorMacroExpansion]
-  (let [exp-node   (expansion-container exp)
-        unexpanded (some->> exp-node safe-write-ast )
-        exp-args   (some->> unexpanded parse-expansion-args)]
-    [unexpanded (map write-ast exp-args)])
-  )
+  (->> exp expansion-args-tree (map write-ast)))

-(s/defn maybe-set-operand
+(s/defn -maybe-set-operand!
+  "Take an identifier, and replace it with its full tree"
   [method node replacements]
-  (when-let* [operand     (call-method (pap node) (pap (str 'get method)))
-                 _           (instance? IASTIdExpression operand)
-                 replacement (-> node (call-method (str 'get method)) .getName str replacements)]
+  (when-let* [operand     (call-method node (str 'get method))
+              _           (instance? IASTIdExpression operand)
+              replacement (-> operand .getName str replacements)]
        (doto node
          (call-method (str 'set method) (.copy replacement)))))

-(s/defn replace-identifier!
+(s/defn -replace-identifier!
+  "If this node is capable of causing syntax ambiguities,
+   try replacing parts of it to observe the ambiguity"
   [node :- IASTNode replacements :- {s/Str IASTNode}]
-  (pprn (map-values write-ast replacements))
-  (pap write-ast node)
-  (pap write-ast (condp instance? node
-    IASTUnaryExpression (maybe-set-operand "Operand" node replacements)
-    IASTBinaryExpression (do (maybe-set-operand "Operand1" node replacements)
-                             (maybe-set-operand "Operand2" node replacements))
+  (condp instance? node
+    IASTUnaryExpression      (-maybe-set-operand! "Operand"  node replacements)
+    IASTBinaryExpression (do (-maybe-set-operand! "Operand1" node replacements)
+                             (-maybe-set-operand! "Operand2" node replacements))
       node))
-  )

-(s/defn parse-macro-def
+(s/defn parse-macro
   [macro-exp :- IASTPreprocessorMacroExpansion] ;IASTPreprocessorFunctionStyleMacroDefinition]
-  (let [macro-def  (->> macro-exp .getMacroDefinition)
-        params     (->> macro-def .getParameters (map (memfn getParameter)))
-        args       (->> macro-exp parse-expansion-args)
-        param-args (zipmap params args)
-        macro-body (-> macro-def str (str/split #"=" 2) (nth 1) parse-frag)
-        new-body (pap (.copy macro-body))]
-    (->> new-body (filter-tree expr-operator) reverse (map #(replace-identifier! % param-args)) dorun)
-    (write-ast new-body))
-    ;; => -5 + y + 1
-  )
+  (let [macro-def (->> macro-exp .getMacroDefinition)
+        body-str  (-> macro-def str (str/split #"=" 2) (nth 1))]
+    {:def macro-def
+     :exp macro-exp
+     :params-str (->> macro-def .getParameters (map (memfn getParameter)))
+     :args-str   (->> macro-exp expansion-args-str)
+     :args-tree  (->> macro-exp expansion-args-tree)
+     :body-str   body-str
+     :body-tree  (parse-frag body-str)}))

-'(->> "#define M2(x,y) x+y+1 \n 3%(M2(5<4,7>2))"
+'((->> "#define M2(x,y) x+y+1 \n 3%(M2(5<4,7>2))"
      ;"#define M2(x,y) x+y+1 \n 3%(M2(5,7))"
      ;;(->> "#define M2(x) x+1 \n M2(2)"
      parse-frag root-ancestor
      .getMacroExpansions first
-     parse-macro-def)
+     ((juxt macro-replace-arg-str macro-replace-arg-tree)) (map write-ast)))
+
+(s/defn macro-replace-arg-str
+  [macro-exp :- IASTPreprocessorMacroExpansion]
+  (let [mac        (parse-macro macro-exp)
+        param-args (zipmap (:params-str mac) (:args-str mac))]
+    (->> mac :body-str pprn (replace-map (pprn param-args)) pprn parse-frag)))
+
+(s/defn macro-replace-arg-tree
+  [macro-exp :- IASTPreprocessorMacroExpansion] ;IASTPreprocessorFunctionStyleMacroDefinition]
+  (let [mac        (parse-macro macro-exp)
+        param-args (zipmap (:params-str mac) (:args-tree mac))
+        new-body   (-> mac :body-tree .copy)]
+
+    (->> new-body (filter-tree expr-operator) reverse (map #(replace-identifier! % param-args)) dorun)
+
+    new-body
+    ))

 (s/defn inner-macro-operator-atom? :- (s/maybe IASTNode)
   "Does this expansion lead to a confusion AST tree outside of itself"
   [exp :- IASTPreprocessorMacroExpansion]
-  (let [;arg-nodes (parse-expansion-args expansion)
-        expanded   (->> exp location-parent greatest-trivial-parent)
+  (let [expanded   (->> exp location-parent greatest-trivial-parent)
         unexpanded (->> exp .getMacroDefinition .getExpansion parse-frag)
         pruned-exp   (->> expanded   prune-terminals (tap pprint))
         pruned-unexp (->> unexpanded prune-terminals (tap pprint))]


pedestal-api handler helper

pedestal-api handler helper

--- src/ephemeris_api/service.clj
+++ src/ephemeris_api/service.clj
@@ -13,27 +13,24 @@
                        :sdd s/Num}}})

 (def mundane
-  (api/annotate
-   {:summary     "Get the current mundane planetary positions"
-    :responses   {200 {:body Points}}}
-   (interceptor
-    {:name  ::mundane
-     :enter (fn [ctx]
-              (assoc ctx :response
-                     {:status 200
-                      :body (calc {:angles []
-                                   :houses false
-                                   :meta false})}))})))
+  (helps/handler ::mundane
+   {:summary   "Get the current mundane planetary positions"
+    :responses {200 {:body Points}}}
+   (fn [request]
+     {:status 200
+      :body (calc {:angles []
+                   :houses false
+                   :meta false})})))

-;;(s/with-fn-validation)
+;;(s/with-fn-validation) ;; Optional, but nice to have at compile time
 (api/defroutes routes
   {:info {:title       "Ephemeris Api"
           :description "For Astrology Applications"
           :version     "0.1"}
    :tags [{:name         "ephemeris"
-           :description  "calc"
+           :description  "calculate"
            :externalDocs {:description "Find out more"
-                          :url         "http://swagger.io"}}]}
+                          :url         "https://github.com/astrolet/ephemeris-api"}}]}
   [[["/" ^:interceptors [api/error-responses
                          (api/negotiate-response)
                          (api/body-params)


Add import for HashMap.

Add import for HashMap.

--- test/dsbdp/test/data_processing_dsl_tests.clj
+++ test/dsbdp/test/data_processing_dsl_tests.clj
@@ -12,7 +12,7 @@
   dsbdp.test.data-processing-dsl-tests
   (:require [clojure.test :refer :all]
             [dsbdp.data-processing-dsl :refer :all])
-  (import (java.util ArrayList List)))
+  (import (java.util ArrayList HashMap List)))

 (def byte-array-test-data
   "We use the byte array representation of a captured UDP packet as byte array test data."
@@ -35,7 +35,7 @@
                                 ['udpDst '(int16 52)]]}
         data-processing-fn (create-data-processing-fn dsl-expression)
         result (data-processing-fn byte-array-test-data 0)]
-    (is (= java.util.HashMap (type result)))
+    (is (= HashMap (type result)))
     (is (= expected result))))

 (deftest byte-array-to-clj-map-test
@@ -78,7 +78,7 @@
                                 ['udpDst '(/ (int16 52) 2)]]}
         data-processing-fn (create-data-processing-fn dsl-expression)
         result (data-processing-fn byte-array-test-data 0)]
-    (is (= java.util.HashMap (type result)))
+    (is (= HashMap (type result)))
     (is (= expected result))))

 (deftest byte-array-to-java-map-with-additional-operation-and-float-type-test
@@ -88,7 +88,7 @@
                                 ['udpDst '(float (/ (int16 52) 65535))]]}
         data-processing-fn (create-data-processing-fn dsl-expression)
         result (data-processing-fn byte-array-test-data 0)]
-    (is (= java.util.HashMap (type result)))
+    (is (= HashMap (type result)))
     (is (= expected result))))

 (deftest byte-array-to-java-map-with-additional-operation-and-two-data-values-test
@@ -97,7 +97,7 @@
                         :rules [['quotient '(/ (int16 52) (int16 50))]]}
         data-processing-fn (create-data-processing-fn dsl-expression)
         result (data-processing-fn byte-array-test-data 0)]
-    (is (= java.util.HashMap (type result)))
+    (is (= HashMap (type result)))
     (is (= expected result))))

@@ -112,7 +112,7 @@
                         :rules [['quotient '(/ (nth 1) (nth 5))]]}
         data-processing-fn (create-data-processing-fn dsl-expression)
         result (data-processing-fn input-data 0)]
-    (is (= java.util.HashMap (type result)))
+    (is (= HashMap (type result)))
     (is (= expected result))))

 (deftest clojure-list-to-java-map-with-additional-operation-and-two-data-values-test
@@ -122,7 +122,7 @@
                         :rules [['quotient '(/ (nth 1) (nth 5))]]}
         data-processing-fn (create-data-processing-fn dsl-expression)
         result (data-processing-fn input-data 0)]
-    (is (= java.util.HashMap (type result)))
+    (is (= HashMap (type result)))
     (is (= expected result))))

 (deftest java-list-to-java-map-with-additional-operation-and-two-data-values-test
@@ -132,7 +132,7 @@
                         :rules [['quotient '(/ (nth 1) (nth 5))]]}
         data-processing-fn (create-data-processing-fn dsl-expression)
         result (data-processing-fn input-data 0)]
-    (is (= java.util.HashMap (type result)))
+    (is (= HashMap (type result)))
     (is (= expected result))))

 (deftest clojure-map-to-java-map-with-additional-operation-and-two-data-values-test
@@ -142,16 +142,16 @@
                         :rules [['quotient '(/ (get "x") (get :z))]]}
         data-processing-fn (create-data-processing-fn dsl-expression)
         result (data-processing-fn input-data 0)]
-    (is (= java.util.HashMap (type result)))
+    (is (= HashMap (type result)))
     (is (= expected result))))

 (deftest java-map-to-java-map-with-additional-operation-and-two-data-values-test
   (let [expected {"quotient" 2}
-        input-data (doto (java.util.HashMap.) (.put "x" 12) (.put "y" 42) (.put :z 6))
+        input-data (doto (HashMap.) (.put "x" 12) (.put "y" 42) (.put :z 6))
         dsl-expression {:output-type :java-map
                         :rules [['quotient '(/ (get "x") (get :z))]]}
         data-processing-fn (create-data-processing-fn dsl-expression)
         result (data-processing-fn input-data 0)]
-    (is (= java.util.HashMap (type result)))
+    (is (= HashMap (type result)))
     (is (= expected result))))


Make components look nicer in React's Chrome plugin

--- src/reagent/impl/template.cljs
+++ src/reagent/impl/template.cljs
@@ -83,11 +83,13 @@
         c2 (aget nextprops cljs-children)]
     (not (util/equal-args p1 c1 p2 c2))))

-(defn wrap-component [comp extras]
+(defn wrap-component [comp extras name]
   (.createClass React (js-obj "render"
                               #(this-as C (wrapped-render C comp extras))
                               "shouldComponentUpdate"
-                              #(this-as C (wrapped-should-update C %1 %2)))))
+                              #(this-as C (wrapped-should-update C %1 %2))
+                              "displayName"
+                              (or name "ComponentWrapper"))))

 ;; From Weavejester's Hiccup, via pump:
 (def ^{:doc "Regular expression that parses a CSS-style id and class
@@ -107,7 +109,7 @@

 (defn get-wrapper [tag]
   (let [[comp id-class] (parse-tag tag)]
-    (wrap-component comp id-class)))
+    (wrap-component comp id-class (str tag))))

 (def cached-wrapper (memoize get-wrapper))

@@ -128,7 +130,7 @@
         (if-not (nil? cached-class)
           cached-class
           (if (.isValidClass React tag)
-            (set! (.-cljsReactClass tag) (wrap-component tag nil))
+            (set! (.-cljsReactClass tag) (wrap-component tag nil nil))
             (fn-to-class tag)))))))

 (defn vec-to-comp [v]


added a test for generating triple from diff

--- test/ctia/events/obj_to_event_test.clj
+++ test/ctia/events/obj_to_event_test.clj
@@ -1,5 +1,6 @@
 (ns ctia.events.obj-to-event-test
-  (:require [ctia.events.obj-to-event :as evt]
+  (:require [clojure.data :refer [diff]]
+            [ctia.events.obj-to-event :as evt]
             [ctia.events.schemas :refer [CreateEvent
                                          UpdateEvent
                                          DeleteEvent]]
@@ -25,3 +26,15 @@
   (doseq [actor (generators/sample 100 StoredActor)]
     (let [event (evt/to-delete-event StoredActor actor)]
       (t/is (s/validate DeleteEvent event)))))
+
+(t/deftest test-triplet-generation
+  (t/is
+   #{[:to-remove "deleted" {}]
+     [:to-change "modified" {0 1}]
+     [:to-add "added" {}]}
+   (set (evt/diff-to-list-of-triplet (diff {:to-remove 0
+                                            :to-stay 0
+                                            :to-change 0}
+                                           {:to-stay 0
+                                            :to-change 1
+                                            :to-add 0})))))


setup for future github cards fn

setup for future github cards fn

--- src/pc/views/blog/ideas_are_made_with_precursor.clj
+++ src/pc/views/blog/ideas_are_made_with_precursor.clj
@@ -11,23 +11,59 @@
    [:svg {:class "iconpile" :viewBox "0 0 100 100"}
     [:path {:class "fill-github" :d "M50,0C22.4,0,0,22.4,0,50c0,22.1,14.3,40.8,34.2,47.4 c2.5,0.5,3.4-1.1,3.4-2.4c0-1.2,0-4.3-0.1-8.5c-13.9,3-16.8-6.7-16.8-6.7c-2.3-5.8-5.6-7.3-5.6-7.3c-4.5-3.1,0.3-3,0.3-3 c5,0.4,7.7,5.2,7.7,5.2c4.5,7.6,11.7,5.4,14.6,4.2c0.5-3.2,1.7-5.4,3.2-6.7c-11.1-1.3-22.8-5.6-22.8-24.7c0-5.5,1.9-9.9,5.1-13.4 c-0.5-1.3-2.2-6.3,0.5-13.2c0,0,4.2-1.3,13.7,5.1c4-1.1,8.3-1.7,12.5-1.7c4.2,0,8.5,0.6,12.5,1.7c9.5-6.5,13.7-5.1,13.7-5.1 c2.7,6.9,1,12,0.5,13.2c3.2,3.5,5.1,8,5.1,13.4c0,19.2-11.7,23.4-22.8,24.7c1.8,1.5,3.4,4.6,3.4,9.3c0,6.7-0.1,12.1-0.1,13.7 c0,1.3,0.9,2.9,3.4,2.4C85.7,90.8,100,72.1,100,50C100,22.4,77.6,0,50,0z"}]]])

-(defn featured [username document]
+(defn featured-dribbble [username document]
   [:figure
    (common/dribbble-card username)
-   (let [animation   (cdn-path (str "/blog/ideas-are-made-with-precursor/" username ".gif"))
-         placeholder (cdn-path (str "/blog/ideas-are-made-with-precursor/" username "-placeholder.gif"))]
+   (let [animated    (cdn-path (str "/blog/ideas-are-made-with-precursor/" username ".gif"))
+         placeholder (cdn-path (str "/blog/ideas-are-made-with-precursor/" username "-placeholder.gif"))
+         swap-img    "this.getElementsByTagName('img')[0].src = '%s'"]
      [:div.gif-shot {:data-content "Preview."
-                     :onmouseover  (format "this.getElementsByTagName('img')[0].src = '%s'" animation)
-                     :ontouchstart (format "this.getElementsByTagName('img')[0].src = '%s'" animation)
-                     :onmouseout   (format "this.getElementsByTagName('img')[0].src = '%s'" placeholder)
-                     :ontouchend   (format "this.getElementsByTagName('img')[0].src = '%s'" placeholder)}
+                     :onmouseover  (format swap-img animated)
+                     :ontouchstart (format swap-img animated)
+                     :onmouseout   (format swap-img placeholder)
+                     :ontouchend   (format swap-img placeholder)}
     [:a {:href (str "https://precursorapp.com" "/document/" document)
-         :data-caption "Remake."}
+         :data-caption "Remake."
+         :target "_blank"}
+     [:img {:src placeholder}]]])])
+
+(defn featured-github [username document]
+  [:figure
+   [:div#vendor.dribbble-card
+    [:div.dribbble-head
+     [:div.dribbble-stats
+      [:div.dribbble-stat
+       [:strong "0"]
+       [:span " Followers"]]]
+     [:div.dribbble-photo
+      [:a {:href (str "https://github.com/" username)}
+       [:img.dribbble-avatar {:src "https://avatars0.githubusercontent.com/u/3895824"}]]]
+     [:div.dribbble-follow
+      [:a.dribbble-button {:href (str "https://github.com/" username)}
+       logo-github
+       [:strong "Follow"]]]]
+    [:div.dribbble-body
+     [:div.dribbble-info
+      [:a.dribbble-name {:href (str "https://github.com/" username)}
+       [:strong "Peter Berg"]]]
+     [:div.dribbble-link
+      [:span "New York"]]]]
+   (let [animated    (cdn-path (str "/blog/ideas-are-made-with-precursor/" username ".gif"))
+         placeholder (cdn-path (str "/blog/ideas-are-made-with-precursor/" username "-placeholder.gif"))
+         swap-img    "this.getElementsByTagName('img')[0].src = '%s'"]
+     [:div.gif-shot {:data-content "Preview."
+                     :onmouseover  (format swap-img animated)
+                     :ontouchstart (format swap-img animated)
+                     :onmouseout   (format swap-img placeholder)
+                     :ontouchend   (format swap-img placeholder)}
+    [:a {:href (str "https://precursorapp.com" "/document/" document)
+         :data-caption "Remake."
+         :target "_blank"}
      [:img {:src placeholder}]]])])

 (defn ideas-are-made-with-precursor []
   {:title "Ideas are made with Precursor."
-   :blurb "What we found most interesting about the Product Hunt traffic was not its volume, but its quality of feedback..."
+   :blurb ""
    :author "Danny"
    :image ""
    :body
@@ -38,44 +74,20 @@
          "There are fascinating things being made with Precursor everyday. "
          "I even put together a list of my favorites. "]]

-    (featured "lobanovskiy" "17592197312062?cx=1044&cy=580&z=0.45&replay=true")
-    (featured "dhotlo2"     "17592197311947?cx=629&cy=376&z=1&replay=true")
-    (featured "fatihturan"  "17592197311774?cx=707&cy=502&z=1&replay=true")
-    (featured "jyo208"      "17592197310592?cx=584&cy=581&z=0.55&replay=true")
-    (featured "kenseals"    "17592197311539?cx=517&cy=392&z=1&replay=true&tx-count=59")
-
-    [:figure
-     [:div#vendor.dribbble-card
-      [:div.dribbble-head
-       [:div.dribbble-stats
-        [:div.dribbble-stat
-         [:strong "0"]
-         [:span " Followers"]]]
-       [:div.dribbble-photo
-        [:a {:href "https://github.com/peteratticusberg"}
-         [:img.dribbble-avatar {:src "https://avatars0.githubusercontent.com/u/3895824"}]]]
-       [:div.dribbble-follow
-        [:a.dribbble-button {:href "https://github.com/peteratticusberg"}
-         logo-github
-         [:strong "Follow"]]]]
-      [:div.dribbble-body
-       [:div.dribbble-info
-        [:a.dribbble-name {:href "https://github.com/peteratticusberg"}
-         [:strong "Peter Berg"]]]
-       [:div.dribbble-link
-        [:span "New York"]]]]
-     (let [animation   (cdn-path (str "/blog/ideas-are-made-with-precursor/peteratticusberg.gif"))
-           placeholder (cdn-path (str "/blog/ideas-are-made-with-precursor/peteratticusberg-placeholder.gif"))]
-       [:div.gif-shot {:data-content "Preview."
-                       :onmouseover  (format "this.getElementsByTagName('img')[0].src = '%s'" animation)
-                       :ontouchstart (format "this.getElementsByTagName('img')[0].src = '%s'" animation)
-                       :onmouseout   (format "this.getElementsByTagName('img')[0].src = '%s'" placeholder)
-                       :ontouchend   (format "this.getElementsByTagName('img')[0].src = '%s'" placeholder)}
-      [:a {:href "https://precursorapp.com/document/17592197310304?cx=687&cy=636&z=0.8&replay=true"
-           :data-caption "Remake."}
-       [:img {:src placeholder}]]])]
-
-    (featured "tooks_" "17592197311539?cx=517&cy=392&z=1&replay=true&tx-count=59")
+    [:article [:h3 "Dave was here."]]
+    (featured-dribbble "lobanovskiy" "17592197312062?cx=1044&cy=580&z=0.45&replay=true")
+    [:article [:h3 "Why so artsy?"]]
+    (featured-dribbble "dhotlo2" "17592197311947?cx=629&cy=376&z=1&replay=true")
+    [:article [:h3 "That poor avatar."]]
+    (featured-dribbble "fatihturan" "17592197311774?cx=707&cy=502&z=1&replay=true")
+    [:article [:h3 "Would watch again."]]
+    (featured-dribbble "jyo208" "17592197310592?cx=584&cy=581&z=0.55&replay=true")
+    [:article [:h3 "Cost of living."]]
+    (featured-dribbble "kenseals" "17592197311539?cx=517&cy=392&z=1&replay=true&tx-count=59")
+    [:article [:h3 "Solid spatial awareness."]]
+    (featured-github "peteratticusberg" "17592197310304?cx=687&cy=636&z=0.8&replay=true")
+    [:article [:h3 "Teammate helps out."]]
+    (featured-dribbble "tooks_" "17592197311539?cx=517&cy=392&z=1&replay=true&tx-count=59")

     [:article
      [:h3 "What's with the anonymity?"]


add state to reddit-request-auth-token

add state to reddit-request-auth-token

this function will be check state with (:state @app-state)

--- src/saved_for_reddit/core.cljs
+++ src/saved_for_reddit/core.cljs
@@ -57,9 +57,12 @@
         (>! callback (:username @app-state)))
       ))

-(defn reddit-request-auth-token [client-id redirect-uri code callback]
+(defn reddit-request-auth-token [client-id redirect-uri code state callback]
   ;; request reddit api token from code provided by reddit
   (js/console.log "in reddit-request-auth-token")
+  (js/console.log "checking is state returned from reddit api is same as randomly generated in webapp")
+  (if (not (= state (:state @app-state)))
+    (handle-error "Invalid state returned from reddit."))
   (go
     (let [response (<! (http/post "https://www.reddit.com/api/v1/access_token"
                                   {:with-credentials? false
@@ -107,7 +110,7 @@
               (let [auth-token-callback-chan (chan)
                     username-callback-chan (chan)]
                 (js/console.log "acquiring auth token")
-                (reddit-request-auth-token client-id redirect-uri code auth-token-callback-chan)
+                (reddit-request-auth-token client-id redirect-uri code state auth-token-callback-chan)
                 ;; start process that waits for auth-token; before obtaining username
                 (go (let [token (<! auth-token-callback-chan)]
                       (js/console.log "received callback from request-auth-token")


Tests for cdr.

Tests for cdr.

--- test/little_clojurer/chapter1_test.clj
+++ test/little_clojurer/chapter1_test.clj
@@ -3,6 +3,11 @@
             [little-clojurer.chapter1 :refer :all]))

 (deftest car-test
-  (testing "FIXME, I fail."
+  (testing
     (is (= :a (car '(:a))))
     (is (= 1 (car '(1 :b))))))
+
+(deftest cdr-test
+  (testing
+    (is (= '() (cdr '(:a))))
+    (is (= '(:b) (cdr '(1 :b))))))


comment exceptin

comment exceptin

--- test/nha/boot_uglify/uglifyjs_test.clj
+++ test/nha/boot_uglify/uglifyjs_test.clj
@@ -40,11 +40,11 @@
     (catch java.io.IOException e
       nil)))

-(def uglify-exec (or (maybe-exec "./node_modules/uglifyjs/bin")
-                     (maybe-exec "uglifyjs")))
+;; (def uglify-exec (or (maybe-exec "./node_modules/uglifyjs/bin")
+;;                      (maybe-exec "uglifyjs")))

-(when-not uglify-exec
-  (throw (Exception. "No uglify implementation available")))
+;; (when-not uglify-exec
+;;   (throw (Exception. "No uglify implementation available")))

 (defn clean-output
   "Remove file. If file is a directory, empty it from its contents"


Working on action invoker

Working on action invoker

--- src/helda/actions/invoker.clj
+++ src/helda/actions/invoker.clj
@@ -14,6 +14,7 @@
       (-> action-request :action-ctx keys)
       (->> action-request :action-ctx vals (map #(find-entity-by-id db %)))
       )
+    :params-ctx (:params-ctx action-request)
     }
   )

@@ -29,11 +30,13 @@
     ]
     (println "Getting response " handler-response)
     (if-let [action-ctx (get-in handler-response [:body :action-ctx])]
-      {:action-ctx
+      {
+        :action-ctx
         (zipmap
           (keys action-ctx)
           (->> action-ctx vals (mapv #(save-entity db %)))
           )
+        :params-ctx (get-in handler-response [:body :params-ctx])
         :reasoning-msg (get-in handler-response [:body :reasoning-msg])
         }
       )
@@ -42,9 +45,6 @@

 (defn fire-action [db action-request]
   (let [action-event (populate-action-event db action-request)]
-    (->>
-      (map #(invoke-action db action-event))
-      first
-      )
+    (invoke-action db action-event)
     )
   )


Bug fix, removing extra braces around sync-code

--- storm-core/src/clj/backtype/storm/daemon/nimbus.clj
+++ storm-core/src/clj/backtype/storm/daemon/nimbus.clj
@@ -949,7 +949,7 @@
     (.addToLeaderLockQueue (:leader-elector nimbus))
     (cleanup-corrupt-topologies! nimbus)
     ;register call back for code-distributor
-    (.code-distributor (:storm-cluster-state nimbus) (fn [] ((sync-code conf nimbus))))
+    (.code-distributor (:storm-cluster-state nimbus) (fn [] (sync-code conf nimbus)))
     (when (is-leader nimbus :throw-exception false)
       (doseq [storm-id (.active-storms (:storm-cluster-state nimbus))]
         (transition! nimbus storm-id :startup)))
@@ -1257,7 +1257,7 @@
                   (download-code conf nimbus missing host (Integer/parseInt port))
                   (.addToLeaderLockQueue (:leader-elector nimbus))
                   (catch Exception e (log-error e "Exception while trying to syn-code for missing topology" missing))))))))
-      (log-message "local disk in completely in sync with zk code-distributor."))))
+      (log-message "local disk is completely in sync with zk code-distributor."))))

 (defmethod sync-code :local [conf nimbus]
   nil)


fixed missing param

fixed missing param

--- src/selmer/template_parser.clj
+++ src/selmer/template_parser.clj
@@ -33,7 +33,7 @@
   (let [template (get-tag-params #"extends" tag-str)]
     (.substring ^String template 1 (dec (.length ^String template)))))

-(defn write-tag? [buf blocks-to-close omit-close-tag?]
+(defn write-tag? [buf existing-block blocks-to-close omit-close-tag?]
   (and buf
        (not existing-block)
        (> blocks-to-close (if omit-close-tag? 1 0))))
@@ -49,7 +49,7 @@
               block-name (if block? (get-tag-params #"block" tag-str))
               super-tag? (re-matches #"\{\{\s*block.super\s*\}\}" tag-str)
               existing-block (if block-name (get-in blocks [block-name :content]))]
-          (when (write-tag? buf blocks-to-close omit-close-tag?)
+          (when (write-tag? buf existing-block blocks-to-close omit-close-tag?)
             (.append buf tag-str))
           (recur
             (long


Create new snippets from tempids, return tempid -> real id mapping

--- src/server/parsing/copaste.clj
+++ src/server/parsing/copaste.clj
@@ -1,4 +1,5 @@
 (ns server.parsing.copaste
+  (:import [om.tempid TempId])
   (:require [clj-consonant.store :as s]
             [server.parser :refer [mutatef readf]]
             [server.transaction :as t]))
@@ -39,17 +40,17 @@
 ;;;; Reads

 (defmethod readf :copaste/refs
-  [{:keys [consonant selector]} _ _]
+  [{:keys [consonant query]} _ _]
   {:value (->> (s/get-refs consonant)
                vals
-               (map #(select-keys % selector))
+               (map #(select-keys % query))
                (into []))})

 (defmethod readf :copaste/snippets
-  [{:keys [consonant selector]} _ {:keys [ref]}]
+  [{:keys [consonant query]} _ {:keys [ref]}]
   {:value (->> (s/get-objects consonant (second ref) "snippet")
                (map object->om)
-               (map #(select-keys % selector))
+               (map #(select-keys % query))
                (into []))})

 ;;;; Mutations
@@ -66,7 +67,9 @@
 (defn create-snippet [consonant ref snippet]
   (t/transact! consonant
     (-> (t/begin :source (some-> ref :head :sha1))
-        (t/create :class "snippet" :properties (:properties snippet))
+        (t/create :class "snippet"
+                  :uuid (:uuid snippet)
+                  :properties (:properties snippet))
         (t/commit :target (if ref (:name ref) "HEAD")
                   :author {:name "Jannis Pohlmann" :email "jannis@xfce.org"}
                   :committer {:name "copaste" :email "copaste@copaste.org"}
@@ -74,11 +77,17 @@

 (defmethod mutatef 'copaste/save-snippet
   [{:keys [consonant]} _ {:keys [ref snippet]}]
-  {:value {:keys [:copaste/refs :copaste/snippets]
-           :tempids {}}
-   :action (fn []
-             (let [ref (if ref ref (s/get-ref consonant "HEAD"))
-                   snippet (om->object snippet)]
-               (if (:uuid snippet)
-                 (update-snippet consonant ref snippet)
-                 (create-snippet consonant ref snippet))))})
+  (let [snippet (om->object snippet)
+        uuid (:uuid snippet)
+        real-uuid (cond-> uuid(instance? TempId uuid) (-> :id str))]
+    (println "uuid" uuid)
+    (println "real-uuid" real-uuid)
+    {:value {:keys [:copaste/refs :copaste/snippets]
+             :tempids {[:snippet/by-uuid uuid]
+                       [:snippet/by-uuid real-uuid]}}
+     :action
+     (fn []
+       (let [ref (if ref ref (s/get-ref consonant "HEAD"))]
+         (if (= uuid real-uuid)
+           (update-snippet consonant ref snippet)
+           (create-snippet consonant ref (assoc snippet :uuid real-uuid)))))}))