fixing fact

fixing fact

--- test/celestial/features/kvm.clj
+++ test/celestial/features/kvm.clj
@@ -20,7 +20,7 @@
         (:node domain)  => (just {:user "ronen" :host "localhost" :port 22})
         (:domain domain) =>
           (just {
-            :user "celestial" :name "red1.local"
+            :user "celestial" :name "red1.local" :hostname "red1"
             :image {:flavor :debian :template "ubuntu-15.04"}
             :cpu 2 :ram 1024
            })))))


Cleanup the example

Cleanup the example

--- src/ashiba/core.cljs
+++ src/ashiba/core.cljs
@@ -33,27 +33,29 @@
   [:h1
    "MESSAGE: "
    @(ui/subscription ctx :message)
+   [:br]
    [:a {:href (ui/url ctx {:baz "qux"})} "Click Here"]
+   [:br]
+   [:a {:href (ui/url ctx {:message "Or Here"})} "Or here"]
+   [:br]
    [:button {:on-click #(ui/send-command ctx :some-command)} "Send Command"]])

 (def main-component (ui/constructor {:renderer main-renderer
                                      :subscription-deps [:message]}))

-(def app-definition {:services {:hello (->HelloWorld)}
+(def app-definition {:html-element (.getElementById js/document "app")
+                     :services {:hello (->HelloWorld)}
                      :components {:main (-> main-component
                                             (assoc :topic :hello)
                                             (ui/resolve-subscription-dep :message message))}})

 (defn start-app! []
-  (reset! running-app (app-state/start!
-                       (assoc app-definition
-                         :html-element (.getElementById js/document "app")))))
+  (reset! running-app (app-state/start! app-definition)))

 (defn restart-app! []
   (let [current @running-app]
     (if current
-      (do
-        (app-state/stop! current start-app!))
+      (app-state/stop! current start-app!)
       (start-app!))))

 (restart-app!)


Add testing string for sort test

Add testing string for sort test

--- test/simple_check/core_test.clj
+++ test/simple_check/core_test.clj
@@ -114,7 +114,7 @@

 (deftest sorting
   (testing
-    ""
+    "For all vectors V, sorted(V) should have the elements in order"
     (is (:result
           (sc/quick-check 1000 elements-are-in-order-after-sorting
                           [(gen/vector gen/int)])))))


Fix scalarmult order

Fix scalarmult order

--- src/caesium/crypto/box.clj
+++ src/caesium/crypto/box.clj
@@ -68,7 +68,7 @@
   Curve25519 scalar mult."
   [sk]
   (let [pk (bb/alloc publickeybytes)]
-    (s/scalarmult-to-buf! sk pk)
+    (s/scalarmult-to-buf! pk sk)
     {:public pk :secret sk}))

 (defn box-easy-to-buf!


Add FIFO within priority levels of beauty

--- src/async_ring/beauty.clj
+++ src/async_ring/beauty.clj
@@ -8,16 +8,18 @@
   "This defers its body to run on the specied pool, with the optionally specified
    priority. If you want to execute side-effects in the body, you'll want to wrap it
    in a do."
+  ;; Note that we prioritize so that a higher user-provided priority runs sooner,
+  ;; and the oldest requests run sooner
   ([pool body]
    `{::beauty true
      :thunk (fn [] ~body)
      :pool ~pool
-     :priority 5})
+     :priority [5 (- (System/currentTimeMillis))]})
   ([pool priority body]
    `{::beauty true
      :thunk (fn [] ~body)
      :pool ~pool
-     :priority ~priority}))
+     :priority [~priority (- (System/currentTimeMillis))]}))

 (defn beauty-router
   "Creates a beauty-router pool. The pools-config should be a map, where the keys


fixes too many cookies response code (#1666)

--- waiter/integration/waiter/authentication_test.clj
+++ waiter/integration/waiter/authentication_test.clj
@@ -528,7 +528,8 @@
             edit-token? (or (str/blank? oidc-token-from-env) edit-oidc-token-from-env?)
             _ (when edit-token?
                 (let [service-parameters (assoc (kitchen-params)
-                                           :env {"USE_OIDC_AUTH" "true"}
+                                           :env (cond-> {"USE_OIDC_AUTH" "true"}
+                                                  use-spnego (assoc "USE_SPNEGO_AUTH" "false"))
                                            :name (rand-name)
                                            :run-as-user (retrieve-username))
                       token-response (post-token waiter-url (assoc service-parameters :token waiter-token))]
@@ -546,13 +547,16 @@
             port (waiter-settings-port waiter-url)
             target-url (str waiter-host ":" port)]
         (try
-          (let [initial-response
+          (let [token-response (get-token waiter-url waiter-token)
+                _ (assert-response-status token-response http-200-ok)
+                spnego-disabled? (-> token-response :body (json/read-str) (get-in ["env" "USE_SPNEGO_AUTH"]) (= "false"))
+                initial-response
                 (make-request-with-debug-info
                   request-headers
                   #(make-request target-url (str "/request-" (rand-int 1000))
                                  :disable-auth true :headers % :method :get))]
             (assert-waiter-response initial-response)
-            (assert-response-status initial-response http-403-forbidden))
+            (assert-response-status initial-response (if spnego-disabled? http-403-forbidden http-401-unauthorized)))
           (testing "oidc enabled endpoint"
             (let [response (make-request-with-debug-info
                              {:x-waiter-token waiter-token}


add alt-text to emoji

add alt-text to emoji

--- src/chat/client/emoji.cljs
+++ src/chat/client/emoji.cljs
@@ -9,11 +9,13 @@
       :png
       (dom/img #js {:className "emojione"
                     :alt shortcode
+                    :title shortcode
                     :src (str "//cdn.jsdelivr.net/emojione/assets/png/" (last (unicode shortcode)) ".png")})
       :svg
       (dom/object #js {:className "emojione"
                        :data (str "//cdn.jsdelivr.net/emojione/assets/svg/" (last (unicode shortcode)) ".svg")
                        :type "image/svg+xml"
+                       :title shortcode
                        :standby shortcode}))))


Fixing typo caught by Armando

Fixing typo caught by Armando

--- src/cia/schemas/common.clj
+++ src/cia/schemas/common.clj
@@ -55,7 +55,7 @@
    MinimalStixIdentifiers
    {:title s/Str
     :description [s/Str]
-    (s/optional-key :sort_description) [s/Str]}))
+    (s/optional-key :short_description) [s/Str]}))

 (s/defschema TimeStructure
   "See http://stixproject.github.io/data-model/1.2/cyboxCommon/TimeType/"


Authorize API-Token routes

Authorize API-Token routes

--- src/cider_ci/users/web.clj
+++ src/cider_ci/users/web.clj
@@ -3,6 +3,7 @@
   (:require [cider-ci.utils.core :refer [keyword str]])
   (:require
     [cider-ci.users.api-tokens.core :as api-tokens]
+    [cider-ci.auth.authorize :as authorize]

     [compojure.core :as cpj]
     [ring.util.response]
@@ -19,12 +20,27 @@
   {:status 404
    :body "Not found in /users !"})

+(defn user? [req]
+  (= :user (-> req :authenticated-entity :type)))
+
+(defn authentication-method-not-token? [req]
+  (not= :token (-> req :authenticated-entity :authentication-method)))
+
+(defn route-id-matches-signed-in-user-id? [req]
+  (= (-> req :authenticated-entity :id str)
+     (-> req :route-params :id str)))
+
+(defn authorize? [req]
+  (and
+    (user? req)
+    (authentication-method-not-token? req)
+    (route-id-matches-signed-in-user-id? req)))

 (def routes
   (cpj/routes
-    (cpj/ANY "/users/:id/api-tokens/*" [] api-tokens/routes)
-    (cpj/ANY "*" [] dead-end-handler)
-    ))
+    (cpj/ANY "/users/:id/api-tokens/*" []
+             (authorize/wrap-require! api-tokens/routes authorize?))
+    (cpj/ANY "*" [] dead-end-handler)))

-
-
+;### Debug ####################################################################
+(debug/debug-ns *ns*)


some shared articles analysis

some shared articles analysis

--- src/clj/ceres/analyzer.clj
+++ src/clj/ceres/analyzer.clj
@@ -265,8 +265,6 @@
      (mc/count @db "reactions"))

-  ;; asdasd
-
   (mc/count @db "origins" {:source nil
                                :ts time-interval })

@@ -294,24 +292,34 @@
        aprint)

-  (mc/count @db "urls")
-
-  (mc/count @db "articles" {:ts time-interval})
-
+  (mc/count @db "publications" {:type :share})
+
+
+
+
+  (->> (mc/find-maps @db "publications" {:type :share})
+       (take 100)
+       (pmap (fn [p] (->> (mc/find-map-by-id @db "tweets" (:tweet p)) :entities :urls first :expanded_url)))
+       (pmap #(mc/find-maps @db "urls" {:url %}))
+       (remove empty?)
+       count)
+
+  (->> (mc/find-maps @db "urls")
+       first)
+
+
+  (->> (mc/find-maps @db "publications" {:type :share})
+       (take 100)
+       (pmap (fn [p] (:article (mc/find-one-as-map @db "origins" {:tweet (:tweet p)}))))
+       (pmap (fn [a] (:url (mc/find-map-by-id @db "articles" a))))
+       aprint)

   (->> (mc/find-maps @db "articles" {:ts time-interval})
-       (pmap (comp (fn [{:keys [user]}] (:screen_name user)) #(mc/find-one-as-map @db "tweets" {:created_at %}) :ts))
-       (into #{}))
-
-
-  (mc/count @db "tweets" {:created_at time-interval
-                          :user.screen_name {$in news-accounts}})
-
-  (mc/count @db "tweets" {:created_at time-interval
-                          :user.screen_name {$nin news-accounts}
-                          :in_reply_to_status_id {$ne nil}
-                          :retweeted_status nil})
-
-  (mc/count @db "publications" {:type :reply})
+       (take 100)
+       (pmap (fn [a] (mc/find-one-as-map @db "origins" {:article (:_id a)})))
+       (pmap :source)
+       (remove nil?)
+       count)
+

   )


minor grammar fix in Swordsman

minor grammar fix in Swordsman

--- src/clj/game/cards-ice.clj
+++ src/clj/game/cards-ice.clj
@@ -821,7 +821,7 @@
    "Swordsman"
    {:abilities [(do-net-damage 1)
                 {:prompt "Choose an AI program to trash"
-                 :msg (msg "trashes " (:title target))
+                 :msg (msg "trash " (:title target))
                  :label "Trash an AI program"
                  :effect (effect (trash target))
                  :choices {:req #(and (installed? %)


Refactors bad pub.

Refactors bad pub.

--- src/clj/game/cards-ice.clj
+++ src/clj/game/cards-ice.clj
@@ -70,6 +70,11 @@
   {:label (str "Psi Game - " label)
    :msg (str "start a psi game (" label ")")
    :psi {:not-equal ability}})
+
+(def take-bad-pub
+  "Bad pub on rez effect."
+  (effect (gain :bad-publicity 1)
+          (system-msg (str "takes 1 bad publicity from " (:title card)))))

 ;;; For Advanceable ICE
@@ -260,7 +265,7 @@
    (morph-ice "Barrier" "Sentry" end-the-run)

    "Checkpoint"
-   {:effect (effect (gain :bad-publicity 1) (system-msg "takes 1 bad publicity"))
+   {:effect take-bad-pub
     :abilities [(trace-ability 5 {:label "Do 3 meat damage when this run is successful"
                                   :msg "do 3 meat damage when this run is successful"
                                   :effect (req (swap! state assoc-in [:run :run-effect :end-run]
@@ -392,7 +397,7 @@
                  :msg "prevent the Runner from making another run" :effect (effect (prevent-run))}]}

    "Fenris"
-   {:effect (effect (gain :bad-publicity 1) (system-msg "takes 1 bad publicity"))
+   {:effect take-bad-pub
     :abilities [(do-brain-damage 1)
                 end-the-run]}

@@ -422,7 +427,7 @@
    (constellation-ice (do-net-damage 1))

    "Grim"
-   {:effect (effect (gain :bad-publicity 1) (system-msg "takes 1 bad publicity"))
+   {:effect take-bad-pub
     :abilities [trash-program]}

    "Guard"
@@ -626,7 +631,7 @@
       :events {:rez ab :trash ab :derez ab}})

    "Muckraker"
-   {:effect (effect (gain :bad-publicity 1))
+   {:effect take-bad-pub
     :abilities [(tag-trace 1)
                 (tag-trace 2)
                 (tag-trace 3)
@@ -741,7 +746,7 @@
                          :effect (effect (move :runner target :deck {:front true}))}}]}

    "Shinobi"
-   {:effect (effect (gain :bad-publicity 1) (system-msg "takes 1 bad publicity"))
+   {:effect take-bad-pub
     :abilities [(trace-ability 1 (do-net-damage 1))
                 (trace-ability 2 (do-net-damage 2))
                 (trace-ability 3 {:label "Do 3 net damage and end the run"
@@ -795,7 +800,7 @@
                               (update-run-ice state side))}]}

    "Swarm"
-   {:effect (effect (gain :bad-publicity 1))
+   {:effect take-bad-pub
     :advanceable :always
     :abilities [trash-program]}


Improves Grail refactor.

Improves Grail refactor.

--- src/clj/game/cards-ice.clj
+++ src/clj/game/cards-ice.clj
@@ -80,11 +80,11 @@
 ;;; For Advanceable ICE
 (def advance-counters
   "Number of advancement counters - for advanceable ICE."
-  (req (or (:advance-counter card) 0)))
+  (req (:advance-counter card 0)))

 (def space-ice-rez-bonus
   "Amount of rez reduction for the Space ICE."
-  (req (* -3 (or (:advance-counter card) 0))))
+  (req (* -3 (:advance-counter card 0))))

 (defn space-ice
   "Creates data for Space ICE with specified abilities."
@@ -95,22 +95,25 @@

 ;;; For Grail ICE
+(defn grail-in-hand
+  "Req that specified card is a Grail card in the Corp's hand."
+  [card]
+  (and (= (:side card) "Corp")
+       (in-hand? card)
+       (has-subtype? card "Grail")))
+
 (def reveal-grail
   "Ability for revealing Grail ICE from HQ."
   {:label "Reveal up to 2 Grail ICE from HQ"
    :choices {:max 2
-             :req #(and (:side % "Corp")
-                        (in-hand? %)
-                        (has-subtype? % "Grail"))}
+             :req grail-in-hand}
    :msg (let [sub-label #(:label (first (:abilities (card-def %))))]
          (msg "reveal " (join ", " (map #(str (:title %) " (" (sub-label %) ")") targets))))})

 (def resolve-grail
   "Ability for resolving a subroutine on a Grail ICE in HQ."
   {:label "Resolve a Grail ICE subroutine from HQ"
-   :choices {:req #(and (:side % "Corp")
-                        (in-hand? %)
-                        (has-subtype? % "Grail"))}
+   :choices {:req grail-in-hand}
    :effect (req (doseq [ice targets]
                   (let [subroutine (first (:abilities (card-def ice)))]
                     (resolve-ability state side subroutine card nil))))})


Add missing meta call

Add missing meta call

--- src/clj/skytwit/server.clj
+++ src/clj/skytwit/server.clj
@@ -130,7 +130,7 @@
     ;;       is stopped in the middle of a JSON string, the lazy seq may
     ;;       be blocked and the go-block may not get GC'd.
     (fn []
-      ((:cancel s))
+      ((:cancel (meta s)))
       (reset! end? true))))

 (comment


Exclude any? to remove warning with Clojure 1.9.

--- src/clj_fuzzy/helpers.cljc
+++ src/clj_fuzzy/helpers.cljc
@@ -7,6 +7,7 @@
 ;;   Version: 0.1
 ;;
 (ns clj-fuzzy.helpers
+  (:refer-clojure :exclude [any?])
   (:require clojure.string))

 ;; Strings helpers


Refactor non-blocking-http sending

Refactor non-blocking-http sending

--- src/clj_tutorials/core.clj
+++ src/clj_tutorials/core.clj
@@ -54,19 +54,14 @@

 ;(STEP 5 "Non blocking http")

-(defn non-blocking-http-get [url]
-  (fn [cb]
-    (http/get url {} #(cb (= 200 (:status %))))))

-(defn callback->chan [fn-with-cb]
-  (let [c (async/chan)
-        start (System/currentTimeMillis)]
-    (fn-with-cb #(async/put! c [(- (System/currentTimeMillis) start) %]))
-    c))
+(defn chan-http-get [url c]
+  (let [start (System/currentTimeMillis)]
+    (http/get url {} #(async/put! c [(- (System/currentTimeMillis) start)
+                                     (= 200 (:status %))]))))

 (defn run-non-blocking [number-of-users url]
   (let [cs (repeatedly number-of-users async/chan)]
     (doseq [c cs]
-      (go (>! c (callback->chan (non-blocking-http-get url)))))
-    (let [results (mapv (fn [_] (collect-result cs)) cs)]
-      (doall (repeatedly number-of-users  #(collect-result results))))))
+        (go (chan-http-get url c)))
+    (repeatedly number-of-users #(collect-result cs))))


Fix for avoiding the use of :read-file-fn! when not provided

--- src/cljs/replumb/repl.cljs
+++ src/cljs/replumb/repl.cljs
@@ -206,19 +206,24 @@
   src-cb] where src-cb is itself a function (fn [source] ...) that needs
   to be called with the full source of the library (as string)."
   [verbose? src-paths read-file-fn!]
-  (fn [{:keys [name macros path] :as load-map} cb]
-    (cond
-      (load/skip-load? load-map) (load/fake-load-fn! load-map cb)
-      (re-matches #"^goog/.*" path) (if-let [goog-path (get-goog-path name)]
-                                      (load/read-files-and-callback! verbose?
-                                                                     (load/goog-file-paths-to-try src-paths goog-path)
-                                                                     read-file-fn!
-                                                                     cb)
-                                      (cb nil))
-      :else (load/read-files-and-callback! verbose?
-                                           (load/file-paths-to-try src-paths macros path)
-                                           read-file-fn!
-                                           cb))))
+  (if (and read-file-fn! (sequential? src-paths))
+    (fn [{:keys [name macros path] :as load-map} cb]
+      (cond
+        (load/skip-load? load-map) (load/fake-load-fn! load-map cb)
+        (re-matches #"^goog/.*" path) (if-let [goog-path (get-goog-path name)]
+                                        (load/read-files-and-callback! verbose?
+                                                                       (load/goog-file-paths-to-try src-paths goog-path)
+                                                                       read-file-fn!
+                                                                       cb)
+                                        (cb nil))
+        :else (load/read-files-and-callback! verbose?
+                                             (load/file-paths-to-try src-paths macros path)
+                                             read-file-fn!
+                                             cb)))
+    (do (when verbose?
+          (common/debug-prn "Invalid :read-file-fn! or :src-paths (is it a valid sequence?). No *load-fn* will be passed to cljs.js."))
+        ;; AR - by returning nil we force a "No *load-fn* set" in cljs.js
+        nil)))

 ;;;;;;;;;;;;;;;;
 ;;; Options ;;;;
@@ -251,14 +256,10 @@
   [opts user-opts]
   (assoc opts :load-fn!
          (or (:load-fn! user-opts)
-             (let [read-file-fn! (:read-file-fn! user-opts)
-                   src-paths (:src-paths user-opts)]
-               (if (and read-file-fn! (sequential? src-paths))
-                 (make-load-fn (:verbose user-opts)
-                               (into [] src-paths)
-                               read-file-fn!)
-                 (when (:verbose user-opts)
-                   (common/debug-prn "Invalid :read-file-fn! or :src-paths (is it a valid sequence?). Cannot create *load-fn*.")))))))
+             ;; AR - make-load-fn will validate :src-paths/:read-file-fn!
+             (make-load-fn (:verbose user-opts)
+                           (:src-paths user-opts)
+                           (:read-file-fn! user-opts)))))

 (defn add-init-fns
   "Given current and user options, returns a map containing a
@@ -513,20 +514,24 @@

 (defn fetch-source
   [{:keys [verbose read-file-fn!]} var paths-to-try cb]
-  (load/read-files-and-callback! verbose
-                                 paths-to-try
-                                 read-file-fn!
-                                 (fn [result]
-                                   (if result
-                                     (let [source (:source result)
-                                           rdr (rt/source-logging-push-back-reader source)]
-                                       (dotimes [_ (dec (:line var))] (rt/read-line rdr))
-                                       (-> (r/read {:read-cond :allow :features #{:cljs}} rdr)
-                                           meta
-                                           :source
-                                           common/wrap-success
-                                           cb))
-                                     (cb (common/wrap-success "nil"))))))
+  (if read-file-fn!
+    (load/read-files-and-callback! verbose
+                                   paths-to-try
+                                   read-file-fn!
+                                   (fn [result]
+                                     (if result
+                                       (let [source (:source result)
+                                             rdr (rt/source-logging-push-back-reader source)]
+                                         (dotimes [_ (dec (:line var))] (rt/read-line rdr))
+                                         (-> (r/read {:read-cond :allow :features #{:cljs}} rdr)
+                                             meta
+                                             :source
+                                             common/wrap-success
+                                             cb))
+                                       (cb (common/wrap-success "nil")))))
+    (do (when verbose
+          (common/debug-prn "No :read-file-fn! provided, skipping source fetching..."))
+        (cb (common/wrap-success "nil")))))

 (defn process-source
   [opts cb data sym]
@@ -625,18 +630,21 @@
   [opts]
   (let [verbose? (:verbose opts)
         read-file! (:read-file-fn! opts)]
-    (when verbose?
-      (common/debug-prn "Discovering goog/deps.js in" (:src-paths opts)))
-    (doseq [path (:src-paths opts)]
-      (let [goog-deps-path (str (common/normalize-path path) "goog/deps.js")]
-        (read-file! goog-deps-path
-                    (fn [content]
-                      (when content
-                        (do (when verbose?
-                              (common/debug-prn "Found valid" goog-deps-path))
-                            (swap! app-env
-                                   update :goog-provide->path
-                                   merge (goog-deps-map content))))))))))
+    (if read-file!
+      (do (when verbose?
+            (common/debug-prn "Discovering goog/deps.js in" (:src-paths opts)))
+          (doseq [path (:src-paths opts)]
+            (let [goog-deps-path (str (common/normalize-path path) "goog/deps.js")]
+              (read-file! goog-deps-path
+                          (fn [content]
+                            (when content
+                              (do (when verbose?
+                                    (common/debug-prn "Found valid" goog-deps-path))
+                                  (swap! app-env
+                                         update :goog-provide->path
+                                         merge (goog-deps-map content)))))))))
+      (when verbose?
+        (common/debug-prn "No :read-file-fn! provided, skipping goog/deps.js discovering...")))))

 (defn init-repl!
   "The init-repl function. It uses the following opts keys:


Fixes the bad output when doc is called on unresolved var. Closes #9.

--- src/cljs/replumb/repl.cljs
+++ src/cljs/replumb/repl.cljs
@@ -79,20 +79,29 @@
 (defn resolve
   "From cljs.analizer.api.clj. Given an analysis environment resolve a
   var. Analogous to clojure.core/resolve"
-  [env sym]
+  [opts env sym]
   {:pre [(map? env) (symbol? sym)]}
   (try
-    (ana/resolve-var env sym
-      (ana/confirm-var-exists-throw))
-    (catch :default _
-      (ana/resolve-macro-var env sym))))
+    (when (:verbose opts)
+      (debug-prn "Calling cljs.analyzer/resolve-var..."))
+    (ana/resolve-var env sym ana/confirm-var-exist-warning)
+    (catch :default e
+      (when (:verbose opts)
+        (debug-prn "Exception caught in resolve: " e))
+      (try
+        (when (:verbose opts)
+          (debug-prn "Calling cljs.analyzer/resolve-macro-var..."))
+        (ana/resolve-macro-var env sym)
+        (catch :default e
+          (when (:verbose opts)
+            (debug-prn "Exception caught in resolve: " e)))))))

 (defn get-var
-  [env sym]
-  (let [var (with-compiler-env st (resolve env sym))
+  [opts env sym]
+  (let [var (with-compiler-env st (resolve opts env sym))
         var (or var
               (if-let [macro-var (with-compiler-env st
-                                   (resolve env (symbol "cljs.core$macros" (name sym))))]
+                                   (resolve opts env (symbol "cljs.core$macros" (name sym))))]
                 (update (assoc macro-var :ns 'cljs.core)
                   :name #(symbol "cljs.core" (name %)))))]
     (if (= (namespace (:name var)) (str (:ns var)))
@@ -332,7 +341,7 @@
                  (cond
                    (docs/special-doc-map sym) (repl/print-doc (docs/special-doc sym))
                    (docs/repl-special-doc-map sym) (repl/print-doc (docs/repl-special-doc sym))
-                   :else (repl/print-doc (get-var env sym)))))))
+                   :else (repl/print-doc (get-var opts env sym)))))))

 (defn process-pst
   [opts cb data expr]


item view for one

item view for one

--- src/cljs/unfolds/core.cljs
+++ src/cljs/unfolds/core.cljs
@@ -117,9 +117,11 @@
   (reify
     om/IRender
     (render [this]
-      ;; TODO: View a specific item!
-      (dom/div #js {:style (hidden (-> app :hidden :item))}
-               (str (-> app :item))))))
+      (let [current-item  (:current-item @app-state)]
+        (dom/div #js {:style (hidden (-> app :hidden :item))}
+                 (dom/h1 nil "Current item")
+                 (dom/p nil (str (second (get (:items @app-state)
+                                              (int current-item))))))))))

 (defn event-loop [app event-chan]
   (go
@@ -146,6 +148,7 @@
     (render-state [this {:keys [chan] :as state}]
       (dom/div nil
                #_(dom/h1 nil (str (:text app) " " (:count state)))
+               (om/build item-view app)
                (dom/a #js {:href "#/notes/1"} "1")
                (dom/a #js {:href "#/notes/2"} "2")
                (dom/p nil


Add artillery data

Add artillery data

--- src/cljs/zetawar/data.cljs
+++ src/cljs/zetawar/data.cljs
@@ -376,7 +376,30 @@
                  {:personnel 15
                   :armored   12}
                  :zoc
-                 [:personnel :armored]}}}})
+                 [:personnel :armored]}
+     :artillery {:description "Artillery"
+                 :cost 400
+                 :movement 8
+                 :can-capture false
+                 :can-repair #{}
+                 :min-range 3
+                 :max-range 4
+                 :armor-type :armored
+                 :armor 6
+                 :repair 1
+                 :state-map :exclusive
+                 :image "tilesets/elite-command/units/artillery-COLOR.png"
+                 :terrain-effects
+                 {:plains {:movement-cost 4 :armor-bonus  0 :attack-bonus  0}
+                  :woods  {:movement-cost 6 :armor-bonus -3 :attack-bonus -3}
+                  :desert {:movement-cost 5 :armor-bonus  0 :attack-bonus  0}
+                  :tundra {:movement-cost 5 :armor-bonus  0 :attack-bonus  0}
+                  :swamp  {:movement-cost 6 :armor-bonus -3 :attack-bonus -3}
+                  :ford   {:movement-cost 6 :armor-bonus -2 :attack-bonus  0}
+                  :base   {:movement-cost 2 :armor-bonus  0 :attack-bonus  0}}
+                 :attack-strengths
+                 {:personnel 12
+                  :armored   13}}}}})

 ;; TODO: remove redundant id keys (?)
 (def maps


Redo how to load :can-build into the db during setup -Retrieve :buildable-at from unit defs instead of :can-build from terrain defs -Largely modeled off of terrain-effects

--- src/cljs/zetawar/game.cljs
+++ src/cljs/zetawar/game.cljs
@@ -1199,16 +1199,6 @@
       :game/self-repair (:self-repair settings-def)
       :game/move-through-friendly (:move-through-friendly settings-def)}]))

-(defn build-terrains-tx [db game-id terrain-type-id can-build-def]
-  (let [game (game-by-id db game-id)]
-    (into []
-          (map
-           (fn [unit-type-name]
-             {:db/id (db/next-temp-id)
-              :terrain-type/_can-build terrain-type-id
-              :terrain-build/unit-type (e (find-by db :unit-type/id (to-unit-type-id unit-type-name)))}))
-          can-build-def)))
-
 (defn terrain-types-tx [db game-id terrains-def]
   (let [game (game-by-id db game-id)]
     (into []
@@ -1224,16 +1214,6 @@
                 :terrain-type/image (:image terrain-def)})))
           terrains-def)))

-(defn terrain-can-build-tx [db game-id terrains-def]
-  (let [game (game-by-id db game-id)]
-    (into []
-          (map
-           (fn [[terrain-type-name terrain-def]]
-             (let [terrain-type-id (to-terrain-type-id terrain-type-name)]
-               {:db/id (e (find-by db :terrain-type/id terrain-type-id))
-                :terrain-type/can-build (into (build-terrains-tx db game-id terrain-type-id (:can-build terrain-def)))})))
-          terrains-def)))
-
 (defn attack-strengths-tx [db game-id unit-type-eid attack-strengths-def]
   (let [game (game-by-id db game-id)]
     (into []
@@ -1259,6 +1239,17 @@
                 :terrain-effect/attack-bonus attack-bonus
                 :terrain-effect/armor-bonus armor-bonus})))
           terrain-effects-def)))
+
+(defn terrain-build-tx [db game-id unit-type-eid buildable-at-def]
+  (let [game (game-by-id db game-id)]
+    (into []
+          (map
+           (fn [terrain-type-name]
+             (let [terrain-type-idx (->> terrain-type-name to-terrain-type-id (game-id-idx game-id))]
+               {:db/id (db/next-temp-id)
+                :terrain-type/_can-build [:terrain-type/game-id-idx terrain-type-idx]
+                :terrain-can-build/unit-type unit-type-eid})))
+          buildable-at-def)))

 (defn unit-types-tx [db game-id units-def]
   (let [game (game-by-id db game-id)]
@@ -1286,7 +1277,8 @@
                      :unit-type/image (:image unit-def)
                      :unit-type/zoc-armor-types (map #(to-armor-type %) (:zoc unit-def))}]
                    (into (attack-strengths-tx db game-id unit-type-eid (:attack-strengths unit-def)))
-                   (into (terrain-effects-tx db game-id unit-type-eid (:terrain-effects unit-def)))))))
+                   (into (terrain-effects-tx db game-id unit-type-eid (:terrain-effects unit-def)))
+                   (into (terrain-build-tx db game-id unit-type-eid (:buildable-at unit-def)))))))
           units-def)))

 (defn unit-states-tx [db game-id state-map-eid state-map-name states]
@@ -1455,7 +1447,6 @@
     (d/transact! conn (terrain-types-tx @conn game-id (:terrains ruleset)))
     (d/transact! conn (unit-state-map-tx @conn game-id (:unit-state-maps ruleset)))
     (d/transact! conn (unit-types-tx @conn game-id (:units ruleset)))
-    (d/transact! conn (terrain-can-build-tx @conn game-id (:terrains ruleset)))

     ;; Map and bases
     (d/transact! conn (game-map-tx @conn game-id (map-defs map-id)))


add tag to source display (close #33)

add tag to source display (close #33)

--- src/cljs_api_gen/write.clj
+++ src/cljs_api_gen/write.clj
@@ -84,7 +84,7 @@
       (map-indexed
         (fn [i crumb]
           (if (zero? i)
-            crumb
+            (str crumb "@" (second (re-find #"blob/([^/]*)" (:source-link item))))
             (str (join (repeat (dec i) space))
                  branch
                  (if (= i last-i)


Bitnum field now formats the bit array as an int

--- src/binary/core.cljs
+++ src/binary/core.cljs
@@ -26,7 +26,9 @@

                :bit {:size 1
                      :js-get "getUint8"
-                     :process (fn [value pos] (bit-test value (mod pos 8)))}})
+                     :process (fn [value pos]
+                                (println value)
+                                (bit-test value (mod pos 8)))}})

 (def binary-types {
                    :charstring {:sizable true
@@ -35,6 +37,12 @@
                    :uint8       {:js-type :uint8}
                    :bit         {:js-type :bit}
                    :ubitnum     {:js-type :bit
+                                 :formatter #(reduce + (map-indexed
+                                                         (fn [i val]
+                                                           (if val
+                                                             (bit-shift-left 1 i)
+                                                             0)) %))
+
                                  :sizable true}})

 (defn parse-type-key [key]
@@ -83,7 +91,7 @@
 (defn on-js-reload []
     (println (read-spec [:name :charstring-4
                          :two :uint8
-                         :smallnum :ubitnum-13
+                         :smallnum :ubitnum-8
                          ]))

     ;; optionally touch your app-state to force rerendering depending on


reader: style fixes

reader: style fixes

--- src/blind/reader.clj
+++ src/blind/reader.clj
@@ -735,7 +735,7 @@
     (if-let [ns-str (namespace s)]
       (let [^Namespace ns (resolve-ns (symbol ns-str))]
         (if (or (nil? ns)
-                (= (name (.name ns)) ns-str)) ;; not an alias
+                (= (name (ns-name ns)) ns-str)) ;; not an alias
           s
           (symbol (name (.name ns)) (name s))))
       (if-let [o ((ns-map *ns*) s)]
@@ -743,7 +743,7 @@
           (symbol (.getName ^Class o))
           (if (var? o)
             (symbol (-> ^Var o .ns .name name) (-> ^Var o .sym name))))
-        (symbol (name (.name *ns*)) (name s))))))
+        (symbol (name (ns-name *ns*)) (name s))))))

 (defn- add-meta [form ret]
   (if (and (instance? IObj form)
@@ -762,7 +762,7 @@
 (defn syntax-quote [form]
   (->>
    (cond
-    (.containsKey Compiler/specials form) (list 'quote form)
+    (special-symbol? form) (list 'quote form)

     (symbol? form)
     (list 'quote


Sure. Sliding buffer.

Sure. Sliding buffer.

--- src/canvas/main.cljs
+++ src/canvas/main.cljs
@@ -2,7 +2,7 @@
   (:require-macros
    [cljs.core.async.macros :refer [go-loop]])
   (:require
-   [cljs.core.async :refer [chan <! put!]]))
+   [cljs.core.async :refer [chan <! put! sliding-buffer]]))

 (enable-console-print!)

@@ -195,7 +195,7 @@
   []
   (println "Welcome to the Canvas Scratch App.")
   (let [ctx (.getContext (by-id "canvas") "2d")
-        events (chan 1 control-stream)]
+        events (chan (sliding-buffer 10) control-stream)]
     (event-loop! state events)
     (listen! js/window   "resize"  #(resize! ctx))
     (listen! js/document "keydown" #(put! events (.-keyCode %)))


Shrink empty lists

Shrink empty lists

Empty lists have a different type than non-empty lists,
so separately implement shrink for that type. Fixes #21.

--- src/simple_check/generators.clj
+++ src/simple_check/generators.clj
@@ -318,6 +318,10 @@
   ;; this shrink goes into an infinite loop with floats
   {:shrink shrink-list})

+(extend (type '())
+  Shrink
+  {:shrink (constantly [])})
+
 ;; Bytes
 ;; ---------------------------------------------------------------------------


[#11904] update swarm gateway

[#11904] update swarm gateway

Signed-off-by: andrey <b713972e59b8e606e23253c4a13e948139fea4d1@gmail.com>

--- src/status_im/browser/core.cljs
+++ src/status_im/browser/core.cljs
@@ -213,7 +213,7 @@

 (defmethod storage-gateway :swarm
   [{:keys [hash]}]
-  (str "https://swarm-gateways.net/bzz:/" hash))
+  (str "https://gateway.ethswarm.org/bzz/" hash))

 (fx/defn resolve-ens-multihash-success
   {:events [:browser.callback/resolve-ens-multihash-success]}


notify bots when watched threads get messaged

--- src/braid/server/sync.clj
+++ src/braid/server/sync.clj
@@ -176,12 +176,16 @@
                     (assoc :subject "Notification from Braid")
                     (->> (email/send-message (db/user-email uid))))))))))))

-; TODO: when else should this happen? should it be configurable?
 (defn notify-bots [new-message]
+  ; Notify bots mentioned in the message
   (when-let [bot-name (second (re-find #"^/(\w+)\b" (:content new-message)))]
     (when-let [bot (db/bot-by-name-in-group bot-name (new-message :group-id))]
       (timbre/debugf "notifying bot %s" bot)
-      (bots/send-notification bot new-message))))
+      (bots/send-notification bot new-message)))
+  ; Notify bots subscribed to the thread
+  (doseq [bot (db/bots-watching-thread (new-message :thread-id))]
+    (timbre/debugf "notifying bot %s" bot)
+    (bots/send-notification bot new-message)))

 (defn user-join-group!
   [user-id group-id]


Make the editorial form more generic

Make the editorial form more generic

so it can handle multiple formats

--- src/catalog/web/views.clj
+++ src/catalog/web/views.clj
@@ -17,7 +17,8 @@
             [ring.util
              [anti-forgery :refer [anti-forgery-field]]
              [response :as response]]
-            [schema.core :as s]))
+            [schema.core :as s]
+            [clojure.string :as string]))

 (defn icon-button [href icon label]
   [:a.btn.btn-default {:href href :role "button" :aria-label label}
@@ -179,11 +180,11 @@
         ;; and redirect to the index
         (response/redirect-after-post "/")))))

-(defn editorial-form [request]
+(defn editorial-form [request fmt]
   (let [identity (friend/identity request)]
     (layout/common
      identity
-     [:h1 "Editorial"]
+     [:h1 (format "Editorial und Buchtipps für %s" (string/capitalize fmt))]
      (form/form-to
       [:post "/editorial"]
       (anti-forgery-field)


show the third place board on the dashboard

--- src/client/dashboard.cljs
+++ src/client/dashboard.cljs
@@ -121,7 +121,7 @@
         $board ($ (str "#" id " .board-45de4"))]

     ;; hide board that are not in the top three
-    (if (< place 3)
+    (if (<= place 3)
       (.css $board "display" "")
       (.css $board "display" "none"))


store root ancestor

store root ancestor

--- src/clj/ceres/curator.clj
+++ src/clj/ceres/curator.clj
@@ -89,7 +89,7 @@
     :ts ts}))

-(defn store-origin [{:keys [article record ts source ancestors]}]
+(defn store-origin [{:keys [article record ts source ancestors root]}]
   (mc/insert-and-return
    (:db @mongo-state)
    "origins"
@@ -97,6 +97,7 @@
     :article article
     :source source
     :ancestors ancestors
+    :root root
     :ts ts}))

@@ -134,15 +135,15 @@
         ancestors (trace-parent record [])]
     (if (nil? articles)
       (do
-        (store-origin (assoc % :record oid :ts ts :source source :ancestors ancestors))
+        (store-origin {:record oid :ts ts :source source :ancestors ancestors :article nil :root (last ancestors)})
         nil)
       (doall
        (map
         #(if (:article %)
-           (do (store-origin (assoc % :record oid :ts ts :source source :ancestors ancestors))
+           (do (store-origin (assoc % :record oid :ts ts :source source :ancestors ancestors :root (last ancestors)))
                (update-in (mc/find-map-by-id (:db @mongo-state) "articles" (:article %)) [:ts] (fn [x] (f/unparse (:custom-formatter @mongo-state) x))))
            (let [article (store-article (assoc % :ts ts))]
-             (do (store-origin (assoc % :article (:_id article) :record oid :ts ts :source source :ancestors ancestors))
+             (do (store-origin (assoc % :article (:_id article) :record oid :ts ts :source source :ancestors ancestors :root (last ancestors)))
                  (do (store-url (assoc % :record oid :ts ts :source source))
                      (update-in article [:ts] (fn [x] (f/unparse (:custom-formatter @mongo-state) x)))))))
         articles)))))
@@ -252,6 +253,7 @@
 (defn find-source [id]
   (mc/find-maps (:db @mongo-state) "urls" {$and [{:article id} {:source {$ne nil}}]} [:source :tweet :ts]))

+
 (comment

   ;; TODO update on server
@@ -271,58 +273,32 @@

   (mc/ensure-index (:db @mongo-state) "tweets" (array-map :id 1) {:unique true})

-  (def sz-url (->> (mc/find-maps (:db @mongo-state) "articles" {:ts {$gt (t/today)}} [:title])
-                  (map #(vec [(:_id %) (:title %) (first (find-source (:_id %)))]))
-                  (remove #(empty? (last %)))
-                  (filter #(= "SZ" (-> % last :source)))
-                  first))
-
-
-  (def sz-tweet (mc/find-map-by-id (:db @mongo-state) "tweets" (-> sz-url last :tweet)))
-
-  (->> (compute-tweet-diffusion (:id_str sz-tweet))
-       clojure.pprint/pprint)
-
-
   (->> (mc/find-maps (:db @mongo-state) "urls" {:article (first sz-url)})
        (mapv #(assoc % :tweet  (mc/find-map-by-id (:db @mongo-state) "tweets" (:tweet %) [:in_reply_to_status_id_str :text :user.screen_name :retweeted :id_str])))
        clojure.pprint/pprint)

-  (def spon-url (->> (mc/find-maps (:db @mongo-state) "articles" {:ts {$gt (t/date-time 2014 7 27)}} [:title])
+
+  (->> (mc/find-maps (:db @mongo-state) "articles" {:ts {$gt (t/today)}} [:title])
                   (map #(vec [(:_id %) (:title %) (first (find-source (:_id %)))]))
                   (remove #(empty? (last %)))
                   (filter #(= "SPIEGELONLINE" (-> % last :source)))
-                  first))
-
-  (def spon-tweet (mc/find-map-by-id (:db @mongo-state) "tweets" (-> spon-url last :tweet)))
-
-  (->> (compute-tweet-diffusion (:id_str spon-tweet) [])
-       flatten
-       clojure.pprint/pprint)
-
-  (->> (mc/find-maps (:db @mongo-state) "urls" {:article (first spon-url)})
+                  rand-nth)
+
+  (def spon-url (mc/find-map-by-id (:db @mongo-state) "urls" (ObjectId. "53d615fe657a4f9d852ca271")))
+
+  (def spon-tweet (mc/find-map-by-id (:db @mongo-state) "tweets" (-> spon-url :tweet)))
+
+  spon-url
+  spon-tweet
+
+  (->> (compute-tweet-diffusion (:id_str spon-tweet) []) flatten count)
+
+  (->> (mc/find-maps (:db @mongo-state) "origins" {:article (:article spon-url)})
        (mapv #(assoc % :tweet  (mc/find-map-by-id (:db @mongo-state) "tweets" (:tweet %) [:in_reply_to_status_id_str :text :user.screen_name :retweeted_status.id_str :id_str])))
-       count
-       clojure.pprint/pprint)
-
-
-  (let [tweet (-> (mc/find-maps (:db @mongo-state) "tweets" {:created_at {$gt (t/today)}})
-                  rand-nth)
-        record-urls (-> tweet :entities :urls)
-        expanded-urls (if (empty? record-urls)
-                        nil
-                        (map #(let [expanded-url (expand-url (:expanded_url %))]
-                                (if (:url expand-url)
-                                  expanded-url
-                                  (assoc expanded-url :url (:expanded_url %)))) record-urls))
-        articles (if (nil? expanded-urls)
-                   nil
-                   (map #(assoc % :article (-> (mc/find-one-as-map (:db @mongo-state) "articles" {:url (:url %)}) :_id)) expanded-urls))]
-    (-> (vec [(:text tweet) (trace-parent tweet []) articles])
-        clojure.pprint/pprint))
-
-  (->> (mc/find-maps (:db @mongo-state) "origins")
-       (filter #(nil? (-> % :article)))
-       )
+       count)
+
+(->> (mc/find-maps (:db @mongo-state) "urls" {:article (:article spon-url)})
+       (mapv #(assoc % :tweet  (mc/find-map-by-id (:db @mongo-state) "tweets" (:tweet %) [:in_reply_to_status_id_str :text :user.screen_name :retweeted_status.id_str :id_str])))
+       count)

   )


tweak cljs.analyzer/parse-ns docstring

tweak cljs.analyzer/parse-ns docstring

--- src/clj/cljs/analyzer.clj
+++ src/clj/cljs/analyzer.clj
@@ -1750,8 +1750,9 @@
 (defn parse-ns
   "Helper for parsing only the ns information from a ClojureScript source
    file. By default does not load macros or perform any analysis of
-   dependencies. If provided :analyze-deps and :load-macros these will
-   be used for *analyze-deps* and *load-macros* bindings respectively."
+   dependencies. If opts parameter provided :analyze-deps and :load-macros keys
+   their values will be used for *analyze-deps* and *load-macros* bindings
+   respectively."
   ([src] (parse-ns src nil nil))
   ([src opts] (parse-ns src nil opts))
   ([src dest opts]


Avoid hard fail on unrecognized signals

Avoid hard fail on unrecognized signals

Fixes #37

--- src/clj/reply/signals.clj
+++ src/clj/reply/signals.clj
@@ -1,8 +1,12 @@
 (ns reply.signals)

 (defn set-signal-handler! [signal f]
-  (sun.misc.Signal/handle
-    (sun.misc.Signal. signal)
-    (proxy [sun.misc.SignalHandler] []
-      (handle [signal] (f signal)))))
+  (try
+    (sun.misc.Signal/handle
+      (sun.misc.Signal. signal)
+      (proxy [sun.misc.SignalHandler] []
+        (handle [signal] (f signal))))
+    (catch IllegalArgumentException e
+      ; unrecognized signal - CONT on Windows, for instance
+      )))


fix timestamp handler

fix timestamp handler

--- src/clj/tictag/server.clj
+++ src/clj/tictag/server.clj
@@ -240,11 +240,11 @@
   (if-let [user (db/get-user-by-id db user-id)]
     (do
       (debugf "Received a timestamp: %s" (pr-str params))
-      (save {:db db :user user}
-            (-> params
-                (assoc :user-id (:id user))
-                (update :timestamp utils/str-number?)
-                (dissoc :username :password)))
+      (db/update-tags! db
+                       [(-> params
+                            (assoc :user-id (:id user))
+                            (update :timestamp utils/str-number?)
+                            (dissoc :username :password))])
       (response {:status 200}))
     UNAUTHORIZED))


buggy bug fix fix

buggy bug fix fix


Remove superfluous parameter name in process-csr-deletion!

--- src/clj/puppetlabs/puppetserver/certificate_authority.clj
+++ src/clj/puppetlabs/puppetserver/certificate_authority.clj
@@ -995,7 +995,7 @@
   :- {:outcome (schema/enum :success :not-found :error) :message schema/Str}
   "Delete pending certificate requests for subject"
   [subject :- schema/Str
-   {:keys [csrdir] :as settings} :- CaSettings]
+   {:keys [csrdir]} :- CaSettings]
   (let [csr-path (path-to-cert-request csrdir subject)]
     (if (fs/exists? csr-path)
       (if (fs/delete csr-path)


Add more tests.

Add more tests.


requiring for multimethod load and fixing expectation

--- test/celestial/test/actions.clj
+++ test/celestial/test/actions.clj
@@ -1,4 +1,5 @@
 (ns celestial.test.actions
+ (:require capistrano.remoter)
  (:use
     midje.sweet
     [celestial.model :only (rconstruct)]
@@ -9,5 +10,5 @@
   (let [cap (rconstruct redis-actions {:action :deploy :target "192.168.5.31"})]
      cap  => (contains  {:args ["deploy" "-s" "hostname=192.168.5.31"]
                          :src  "git://github.com/narkisr/cap-demo.git"
-                         :dst  ""})))
+                         })))


Add test to reproduce #112 (seems not to occur on OS X so I want to make sure at least travis catches it)

--- test/clj/lambdacd/util_test.clj
+++ test/clj/lambdacd/util_test.clj
@@ -56,7 +56,16 @@
       (is (= "some-value-from-function" (with-temp d (throw-if-not-exists d))))

       (is (not (fs/exists? (fs/file d "somefile"))))
-      (is (not (fs/exists? d))))))
+      (is (not (fs/exists? d)))))
+  (testing "that it can deal with circular symlinks"
+    (let [f (create-temp-dir)]
+      (is (= "some-value-from-function"
+             (with-temp f (let [link-parent (io/file f "foo" "bar")]
+                            (fs/mkdirs link-parent)
+                            (fs/sym-link (io/file link-parent "link-to-the-start") f)
+                            "some-value-from-function"
+                            ))))
+      (is (not (fs/exists? f))))))

 (deftest json-test


Fix clipboard

Fix clipboard

--- src/discuss/clipboard.cljs
+++ src/discuss/clipboard.cljs
@@ -16,7 +16,7 @@
   []
   (let [selections (get-stored-selections)
         current (lib/get-selection)
-        with-current (distinct (conj selections current))]
+        with-current (distinct (merge selections {:title current}))]
     (lib/update-state-item! :clipboard :selections (fn [_] with-current))))

@@ -41,7 +41,7 @@

 ;;;; Views
-(defn clipboard-item [data owner]
+(defn clipboard-item [data]
   (reify
     om/IInitState
     (init-state [_]
@@ -52,17 +52,15 @@
                     :className   "bs-callout bs-callout-info"
                     :draggable   true
                     :onDragStart drag-event}
-               (dom/div nil data)
+               (dom/div nil (:title data))
                #_(dom/button #js {:className "btn btn-sm btn-default"
                                 :onClick   #(discuss.communication/ajax-get "api/cat-or-dog")
                                 :title     "Select this reference for your statement"}
                            (vlib/fa-icon "fa-check"))))))

-(defn view [data owner]
-  (reify om/IRender
-    (render [_]
-      (when (pos? (count (get-stored-selections)))
-        (dom/div nil
-                 (dom/h5 nil "Clipboard")
-                 (apply dom/div nil
-                        (map #(om/build clipboard-item (lib/merge-react-key %)) (get-stored-selections))))))))+(defn view []
+  (when (pos? (count (get-stored-selections)))
+    (dom/div nil
+             (dom/h5 nil "Clipboard")
+             (apply dom/div nil
+                    (map #(om/build clipboard-item (lib/merge-react-key %)) (get-stored-selections))))))


Remove redundant quotes from log in token

--- src/env_logger/handler.clj
+++ src/env_logger/handler.clj
@@ -125,7 +125,7 @@
                                (get-conf-value :jwt-token-timeout))
                             getEpochSecond)}
             token (jwt/encrypt claims jwe-secret {:alg :a256kw :enc :a128gcm})]
-        (generate-string token))
+        token)
       response-unauthorized)))

 (defn get-last-obs-data


scrolldown on new message

scrolldown on new message

--- src/frontend/renderer.cljs
+++ src/frontend/renderer.cljs
@@ -64,9 +64,12 @@

 (defn messages-window [data owner]
   (reify
-    om/IRender
-    (render [this]
-      (println data)
+    om/IDidUpdate
+    (did-update [_ _ _]
+      (println "DID UPDATE")
+      (set! (.-scrollTop (sel1 "#messages-window")) (.-scrollHeight (sel1 "#messages-window"))))
+    om/IRender
+    (render [this]
       (dom/div #js {:id "messages-window"}
         (om/build-all message-view data)))))


Fix to support multiple forms inside with-transaction.

--- src/grafter/rdf/sesame.clj
+++ src/grafter/rdf/sesame.clj
@@ -299,7 +299,7 @@
   Exceptions are rolled back on failure."
   `(try
     (pr/begin ~repo)
-    (let [return# ~@forms]
+    (let [return# (do ~@forms)]
       (pr/commit ~repo)
       return#)
     (catch Exception e#


Figwheel REPLiin

Figwheel REPLiin

--- mtg-pairings-server/env/dev/clj/mtg_pairings_server/repl.clj
+++ mtg-pairings-server/env/dev/clj/mtg_pairings_server/repl.clj
@@ -2,7 +2,8 @@
   (:require [mount.core :as m]
             [ring.middleware.file-info :refer :all]
             [ring.middleware.file :refer :all]
-            [figwheel-sidecar.repl-api :refer :all]
+            [figwheel-sidecar.repl-api :as figwheel]
+            [clojure.tools.namespace.repl :as repl]
             [mtg-pairings-server.handler :refer [app]]
             [mtg-pairings-server.server :refer [run-server!]]
             [mtg-pairings-server.properties :refer [properties]]))
@@ -18,6 +19,21 @@
       ; Content-Type, Content-Length, and Last Modified headers for files in body
       (wrap-file-info)))

+(m/defstate figwheel
+  :start (figwheel/start-figwheel!)
+  :stop (figwheel/stop-figwheel!))
+
+(m/defstate figwheel-autobuilder
+  :start (figwheel/start-autobuild "app")
+  :stop (figwheel/stop-autobuild "app"))
+
 (m/defstate server
   :start (run-server! (get-handler) (:server properties))
-  :stop (.stop server))
+  :stop (server))
+
+(defn cljs-repl []
+  (figwheel/cljs-repl))
+
+(defn restart []
+  (m/stop)
+  (repl/refresh :after `m/start))


working?

working?

--- src/hack_the_drive/web.clj
+++ src/hack_the_drive/web.clj
@@ -74,7 +74,7 @@
             (resp/redirect "/grid")
           {:status 200 :headers {"Content-Type" "text/plain"} :body (pr-str data)})
         ;  {:status 200 :headers {"Content-Type" "text/plain"} :body (pr-str content)})
-        ))
+        )
         {:store (byte-array-store)})
   (GET "/media/:id" [id]
     (render-media-response


Read and Loading

Read and Loading

--- src/hackernews/events.cljs
+++ src/hackernews/events.cljs
@@ -35,7 +35,6 @@
  (fn [db [_ story-id]]
    (let [stories (get-in db [:front-page :front-page-stories])
          updated-stories (map #(if (= story-id (:id %)) (assoc % :read? true) %) stories)]
-     (println updated-stories)
      (assoc-in db [:front-page :front-page-stories] updated-stories))))

 (reg-event-fx
@@ -43,7 +42,8 @@
  validate-spec
  (fn [cofx [_ stories]]
    {:db (-> (update-in (:db cofx) [:front-page :front-page-stories] #(apply conj % stories))
-            (update-in [:front-page :current-page-num] inc))}))
+            (update-in [:front-page :current-page-num] inc)
+            (assoc-in [:front-page :is-loading?] false))}))

 ;; -- Effects --

@@ -52,11 +52,13 @@
 (reg-event-fx
  :load-front-page-stories
  (fn [{:keys [db]} [_]]
-   {:db db
-    :http-xhrio {:method          :get
-                 :uri             hn-api
-                 :params {:page (get-in db [:front-page :current-page-num])}
-                 :timeout         8000
-                 :response-format (ajax/json-response-format {:keywords? true})
-                 :on-success      [:loaded-front-page-stories]
-                 :on-failure      [:failed-loading-front-page-stories]}}))
+   (if (not (get-in db [:front-page :is-loading?]))
+     {:db (assoc-in db [:front-page :is-loading?] true)
+      :http-xhrio {:method          :get
+                   :uri             hn-api
+                   :params {:page (get-in db [:front-page :current-page-num])}
+                   :timeout         8000
+                   :response-format (ajax/json-response-format {:keywords? true})
+                   :on-success      [:loaded-front-page-stories]
+                   :on-failure      [:failed-loading-front-page-stories]}}
+     {:db db})))


More work on status messages

More work on status messages

--- src/leiningen/amp/impl.clj
+++ src/leiningen/amp/impl.clj
@@ -10,10 +10,11 @@
 ;    Peter Monks - initial implementation

 (ns leiningen.amp.impl
-  (:require [clojure.string    :as s]
-            [clojure.java.io   :as io]
-            [leiningen.uberjar :as uj]
-            [me.raynes.fs      :as fs]))
+  (:require [clojure.string      :as s]
+            [clojure.java.io     :as io]
+            [leiningen.uberjar   :as uj]
+            [me.raynes.fs        :as fs]
+            [leiningen.core.main :as main]))

 (defn- map-function-on-map-vals
   "From http://stackoverflow.com/questions/1676891/mapping-a-function-on-the-values-of-a-map-in-clojure"
@@ -106,7 +107,7 @@
         src-amp                (io/file project-home "amp")
         module-properties-file (io/file src-amp "module.properties")
         _                      (if (not (fexists module-properties-file))
-                                 (throw (RuntimeException. (str "Invalid AMP project - " module-properties-file " is missing."))))
+                                 (main/abort (str "Invalid AMP project - " module-properties-file " is missing.")))
         module-properties      (read-module-properties project module-properties-file)
         module-id              (get module-properties "module.id")
         module-version         (get module-properties "module.version")
@@ -177,10 +178,10 @@
     ; Now zip the AMP
     (zip-directory! tgt-amp-file tgt-amp)

-    (println "Created AMP" module-id "version" module-version "in" (str tgt-amp-file))))
+    (main/info (str "Created AMP " module-id " v" module-version " in " (str tgt-amp-file)))))

 (defn deploy-amp!
   [project args]
-  (comment "####TODO: NOT YET IMPLEMENTED"))
+  (main/abort "AMP deployment is not yet implemented. Sorry!"))


whoops

whoops

--- src/demogorgon/config.clj
+++ src/demogorgon/config.clj
@@ -2,10 +2,10 @@

 (def config
      {:un-dir "/opt/nethack.nu/var/unnethack/"
-      :twitter {:consumer_key "reEFD0AjpXtn7mJ6MVlX1g"
-                :consumer_secret "Nij9GdGR58VRDR5dbTqQin97HnhgdXwogY6lnrKxSrs"
-                :oauth_token "179042090-SNSfPwsE2EIKTAUPicBLKaccdbBkgoSt5y737FsY"
-                :oauth_token_secret "SqskJ8PTPXfMCwMxwioJRcpHGGNutC7xsgfeBmR9rMU"}
+      :twitter {:consumer_key ""
+                :consumer_secret ""
+                :oauth_token ""
+                :oauth_token_secret ""}
       :irc {:nick "demogorgon"
             :username "demogorgon"
             :realname "demogorgon"


Send the select-shape event before acquire move action.

--- src/uxbox/ui/shapes/icon.cljs
+++ src/uxbox/ui/shapes/icon.cljs
@@ -28,8 +28,8 @@
         (and (not selected?) (empty? selected))
         (do
           (dom/stop-propagation event)
-          (uuc/acquire-action! "ui.shape.move")
-          (rs/emit! (dw/select-shape id)))
+          (rs/emit! (dw/select-shape id))
+          (uuc/acquire-action! "ui.shape.move"))

         (and (not selected?) (not (empty? selected)))
         (do


Update password_admin.clj

Update password_admin.clj

--- src/webapp/password_admin.clj
+++ src/webapp/password_admin.clj
@@ -10,4 +10,3 @@
 (defn set_roles_to_redis [username password roles] (wcar* (car/set (str "password:" username) {:hashed-password (creds/hash-bcrypt password) :roles roles})))

 (set_roles_to_redis "" "" #{:webapp.core/user})
-(set_roles_to_redis "doug_admin" "pimpin" #{:webapp.core/admin})


whitespace

whitespace

--- sidecar/src/figwheel_sidecar/cljs_utils/exception_parsing.clj
+++ sidecar/src/figwheel_sidecar/cljs_utils/exception_parsing.clj
@@ -15,7 +15,7 @@
     ;; just in case we get a URL or some such let's change it to a string first
     (.toURI (io/file (str path))))))

-;; TODO this should append before sending across the wire
+;; TODO this should only happen before sending across the wire
 (defn data-serialize [k o]
   (cond
     (= k :root-source-info) o
@@ -25,7 +25,7 @@
         (symbol? o)
         (keyword? o)) o
     :else (str o)))
-
+
 (defn inspect-exception [ex]
   (->
    {:class (type ex)


Standardize a function map structure

Standardize a function map structure

--- src/icfp2014/compiler.clj
+++ src/icfp2014/compiler.clj
@@ -70,7 +70,7 @@
            address 0]
       (if-let [func (get funcs index)]
         (let [new-funcs (update-in funcs [index] assoc :address address)
-              address (+ address (count (:code func)))]
+              address (+ address (:length func))]
           (recur new-funcs (inc index) address))
         funcs))))

@@ -101,10 +101,13 @@
   [[name args & body :as code] fns]
   {:pre [(list? code)]}
   (let [fns (assoc fns name {})
-        [stmt & stmts] (mapcat #(compile-form args fns %) body)]
-    (concat [(conj stmt (format "; define %s" name))]
-            stmts
-            [[:rtn]])))
+        [stmt & stmts] (mapcat #(compile-form args fns %) body)
+        code (concat [(conj stmt (format "; define %s" name))]
+                     stmts
+                     [[:rtn]])]
+    {:name name
+     :code code
+     :length (count code)}))

 (defn compile-ai
   [file]
@@ -114,6 +117,6 @@
     (loop [form (read prog false nil)
            fns {}]
       (if form
-        (let [code (compile-function form fns)]
-          (recur (read prog false nil) (assoc fns (first form) {:name (first form) :code code})))
+        (let [func (compile-function form fns)]
+          (recur (read prog false nil) (assoc fns (:name func) func)))
         (emit-code (assign-addresses fns))))))


:point_down: Move class location

:point_down: Move class location

--- src/moves_server/core.clj
+++ src/moves_server/core.clj
@@ -1,11 +1,11 @@
 (ns moves-server.core
-  (:gen-class)
   (:require [ring.adapter.jetty :as jetty]
             [ring.middleware.keyword-params :refer [wrap-keyword-params]]
             [ring.middleware.params :refer [wrap-params]]
             [ring.middleware.resource :refer [wrap-resource]]
             [clj-http.client :as client]
-            [environ.core :refer [env]]))
+            [environ.core :refer [env]])
+  (:gen-class))

 (defn get-access-token [code]
   (let [client-id (env :client-id)


Add more data to latest request for rendering purposes.

--- src/ontrail/websocket.clj
+++ src/ontrail/websocket.clj
@@ -8,7 +8,8 @@
             [clj-time.local :as local]
             )
   (:use [compojure.core]
-        [ontrail.scheduler])
+        [ontrail.scheduler]
+        [ontrail.user])
   (:import [java.lang IllegalStateException]))

 (def #^{:private true} logger (org.slf4j.LoggerFactory/getLogger (str *ns*)))
@@ -61,12 +62,15 @@

 (defn server-message [type user value]
   (condp = type
-    :comment-ex {:user user
-                 :action (str "kommentoi käyttäjän " (:user value) " harjoitusta")
+    :comment-ex {:user user
+                 :avatar (get-avatar-url user)
+                 :action (str "kommentoi käyttäjän " (:user value) " harjoitusta")
+                 :otherUser (:user value)
                  :message (:title value)
                  :link (ex-link value)}
-    :create-ex {:user user
-                :action "kirjasi harjoituksen"
+    :create-ex {:user user
+                :avatar (get-avatar-url user)
+                :action "kirjasi harjoituksen"
                 :message (:title value)
                 :link (ex-link value)}))


Some fixes from bad repl state.

Some fixes from bad repl state.

[ci skip]

--- src/onyx/plugin/kafka.clj
+++ src/onyx/plugin/kafka.clj
@@ -30,19 +30,19 @@
          broker-ids)))
       [])))

-(defn read-from-bound [consumer topic partition task-map]
+(defn read-from-bound [consumer topic kpartition task-map]
   (cond (= (:kafka/offset-reset task-map) :smallest)
-        (kc/topic-offset consumer topic partition :earliest)
+        (kc/topic-offset consumer topic kpartition :earliest)
         (= (:kafka/offset-reset task-map) :largest)
-        (kc/topic-offset consumer topic partition :latest)
+        (kc/topic-offset consumer topic kpartition :latest)
         :else (throw (ex-info ":kafka/offset-reset must be either :smallest or :largest" {:task-map task-map}))))

-(defn starting-offset [m consumer topic partition group-id task-map]
+(defn starting-offset [m consumer topic kpartition group-id task-map]
   (if (:kafka/force-reset? task-map)
-    (read-from-bound consumer topic partition task-map)
-    (if-let [x (kzk/committed-offset m group-id topic partition)]
+    (read-from-bound consumer topic kpartition task-map)
+    (if-let [x (kzk/committed-offset m group-id topic kpartition)]
       x
-      (read-from-bound consumer topic partition task-map))))
+      (read-from-bound consumer topic kpartition task-map))))

 (defn highest-offset-to-commit [offsets]
   (->> (partition-all 2 1 offsets)
@@ -51,54 +51,63 @@
        (last)
        (last)))

+(defn commit-loop [consumer m topic kpartition commit-interval pending-commits]
+  (future
+    (try
+      (loop []
+        (Thread/sleep commit-interval)
+        (when-let [offset (highest-offset-to-commit @pending-commits)]
+          (kzk/set-offset! m consumer topic kpartition offset)
+          (swap! pending-commits (fn [coll] (remove (fn [k] (<= k offset)) coll))))
+        (recur))
+      (catch InterruptedException e
+        (throw e))
+      (catch Throwable e
+        (fatal e)))))
+
+(defn reader-loop [m client-id group-id topic partitions kpartition task-map ch pending-commits]
+  (try
+    (loop []
+      (try
+        (let [brokers (get partitions (str kpartition))
+              broker (get (id->broker m) (first brokers))
+              consumer (kc/consumer (:host broker) (:port broker) client-id)
+              offset (starting-offset m consumer topic kpartition group-id task-map)
+              fetch-size (or (:kafka/fetch-size task-map) (:kafka/fetch-size defaults))
+              messages (kc/messages consumer "onyx" topic kpartition offset fetch-size)
+              empty-read-back-off (or (:kafka/empty-read-back-off task-map) (:kafka/empty-read-back-off defaults))
+              commit-interval (or (:kafka/commit-interval task-map) (:kafka/commit-interval defaults))
+              commit-fut (future (commit-loop m topic kpartition commit-interval pending-commits))]
+          (log/debug "Opening Kafka consumer" task-map)
+          (log/debug (str "Kafka consumer is starting at offset " offset))
+          (loop [ms messages]
+            (if (first ms)
+              (>!! ch {:message (read-string (String. (.value ^KafkaMessage (first ms)) "UTF-8"))
+                       :offset (.offset ^int (first ms))})
+              (Thread/sleep empty-read-back-off))
+            (recur (rest ms))))
+        (catch InterruptedException e
+          (throw e))
+        (catch Throwable e
+          (fatal e))))
+    (catch InterruptedException e
+      (throw e))))
+
 (defn start-kafka-consumer
   [{:keys [onyx.core/task-map] :as event} lifecycle]
   (let [{:keys [kafka/topic kafka/partition kafka/group-id]} task-map
-        fetch-size (or (:kafka/fetch-size task-map) (:kafka/fetch-size defaults))
+        kpartition (Integer/parseInt partition)
+        commit-interval (or (:kafka/commit-interval task-map) (:kafka/commit-interval defaults))
         chan-capacity (or (:kafka/chan-capacity task-map) (:kafka/chan-capacity defaults))
-        empty-read-back-off (or (:kafka/empty-read-back-off task-map) (:kafka/empty-read-back-off defaults))
-        commit-interval (or (:kafka/commit-interval task-map) (:kafka/commit-interval defaults))
-        partition (Integer/parseInt partition)
         client-id "onyx"
         m {"zookeeper.connect" (:kafka/zookeeper task-map)}
         partitions (kzk/partitions m topic)
-        brokers (get partitions (str partition))
-        broker (get (id->broker m) (first brokers))
-        consumer (kc/consumer (:host broker) (:port broker) client-id)
-        offset (starting-offset m consumer topic partition group-id task-map)
-        messages (kc/messages consumer "onyx" topic partition offset fetch-size)
         ch (chan chan-capacity)
         pending-messages (atom {})
         pending-commits (atom (sorted-set))
-        reader-fut (future
-                     (try
-                       (log/debug "Opening Kafka consumer" task-map)
-                       (log/debug (str "Kafka consumer is starting at offset " offset))
-                       (loop [ms messages]
-                         (if (first ms)
-                           (>!! ch {:message (read-string (String. (.value ^KafkaMessage (first ms)) "UTF-8"))
-                                    :offset (.offset ^int (first ms))})
-                           (Thread/sleep empty-read-back-off))
-                         (recur (rest ms)))
-                       (catch InterruptedException e)
-                       (catch Throwable e
-                         (fatal e))))
-        commit-fut (future
-                     (try
-                       (loop []
-                         (Thread/sleep commit-interval)
-                         (when-let [offset (highest-offset-to-commit @pending-commits)]
-                           (kzk/set-offset! m consumer topic partition offset)
-                           (swap! pending-commits (fn [coll] (remove (fn [k] (<= k offset)) coll))))
-                         (recur))
-                       (catch InterruptedException e)
-                       (catch Throwable e
-                         (fatal e))))]
-    {:kafka/consumer consumer
-     :kafka/messages messages
-     :kafka/read-ch ch
+        reader-fut (future (reader-loop m client-id group-id topic partitions kpartition task-map ch pending-commits))]
+    {:kafka/read-ch ch
      :kafka/reader-future reader-fut
-     :kafka/commit-future commit-fut
      :kafka/pending-messages pending-messages
      :kafka/pending-commits pending-commits}))

@@ -146,7 +155,6 @@
 (defn close-read-messages
   [{:keys [kafka/read-ch] :as pipeline} lifecycle]
   (future-cancel (:kafka/reader-future pipeline))
-  (future-cancel (:kafka/commit-future pipeline))
   (close! read-ch)
   {})


for docstring manipulation, treat single occurrences of \n as whitespace and only force carriage returns with two in a row: \n\n

--- src/overtone/doc_util.clj
+++ src/overtone/doc_util.clj
@@ -2,7 +2,9 @@
     ^{:doc "Utility functions for the generation of docstrings"
       :author "Sam Aaron"}
   overtone.doc-util
-  (:use [clojure.contrib.string :only (split)]))
+  (:use
+   [clojure.contrib.string :only (split replace-re replace-str)])
+)

 (defn length-of-longest-key
   "Returns the length of the longest key of map m. Assumes m's keys are strings
@@ -29,7 +31,12 @@
   "Appends a list ls of strings to string s in a formatted block with a specific
    width max-len and indentation indent. May be called with a basic text string
    and max-len and indent in which case text will be split on whitespace."
-  ([txt max-len indent] (indented-str-block "" (split #" +" txt) 0 max-len indent))
+  ([txt max-len indent] (let [id (str (java.util.UUID/randomUUID))
+                              split-text (replace-re #"[\n]{2}" id txt)
+                              split-text (replace-str "\n" " " split-text)
+                              split-text (replace-str id "\n" split-text)
+                              split-text (split #" +" split-text)]
+                          (indented-str-block "" split-text 0 max-len indent)))
   ([s ls cur-len max-len indent]
      (if (empty? ls)
        s


Add two synth arg utility fns:

Add two synth arg utility fns:

* synth-args - return a list of the synth's args as keywords
* synth-arg-index - find a synth's arg index

--- src/overtone/sc/synth.clj
+++ src/overtone/sc/synth.clj
@@ -736,3 +736,22 @@
 (defmacro with-ugen-debugging [& body]
   `(binding [overtone.sc.machinery.ugen.specs/*debugging* true]
      ~@body))
+
+(defn synth-args
+  "Returns a seq of the synth's args as keywords"
+  [synth]
+  (map keyword (:args synth)))
+
+(defn synth-arg-index
+  "Returns an integer index of synth's argument with arg-name.
+
+   For example:
+
+   (defsynth foo [freq 440 amp 0.5] (out 0 (* amp (sin-osc freq))))
+
+   (synth-arg-index foo :amp) #=> 1
+   (synth-arg-index foo \"freq\") #=> 0
+   (synth-arg-index foo :baz) #=> nil"
+  [synth arg-name]
+  (let [arg-name (name arg-name)]
+    (index-of (:args synth) arg-name)))


Simple random seed threading

Simple random seed threading

--- src/simple_check/core.clj
+++ src/simple_check/core.clj
@@ -12,8 +12,8 @@
     (gen/shrink value)))

 (defn- run-test
-  [property args]
-  (let [vars (map util/nullary-apply args)
+  [property seed args]
+  (let [vars (map #(% seed 100) args)
         result (try
                  (apply property vars)
                  (catch Throwable t t))]
@@ -21,20 +21,27 @@

 (declare shrink-loop failure)

+(defn make-seed
+  [s]
+  (if s
+    s
+    (gen/random)))
+
 (defn quick-check
-  [num-tests property-fun & args]
-  (loop [so-far 0]
+  [num-tests property-fun args {seed :random-seed}]
+  (let [random-seed (make-seed seed)]
+    (loop [so-far 0]
     (if (== so-far num-tests)
       (do
         (ct/report-trial property-fun so-far num-tests)
         {:result true :num-tests so-far})
-      (let [[result vars] (run-test property-fun args)]
+      (let [[result vars] (run-test property-fun random-seed args)]
         (cond
           (instance? Throwable result) (failure property-fun result so-far args vars)
           result (do
                    (ct/report-trial property-fun so-far num-tests)
                    (recur (inc so-far)))
-          :default (failure property-fun result so-far args vars))))))
+          :default (failure property-fun result so-far args vars)))))))

 (defmacro forall [bindings expr]
   `(let [~@bindings]


add more tests

add more tests

--- src/test/om_css/tests.clj
+++ src/test/om_css/tests.clj
@@ -49,44 +49,62 @@
                                    :ns-name "ns.core"}
                       :class ["ns_core_Foo_root"]}))))))

-(comment
-  (reshape-defui
-    '(om/IQuery
-        (query [this])
-      om/Ident
-      (ident [this])
-      Object
-      (componentWillMount [this])
-      (render [dia]
-        (dom/div nil (dom/div nil "3")))
-      static field a 3
-      static om/IQuery
-      (query [this] [:a])))
+(deftest test-get-style
+  (let [form '(static om/IQuery
+               (query [this])
+               static oc/Style
+               (style [_]
+                 [:root {:color "#FFFFF"}
+                  :section {:background-color :green}])
+               static om/Ident
+               (ident [this])
+               Object
+               (render [this])
+               static om/IQueryParams
+               (params [this]))]
+    (is (= (oc/get-style-form form)
+          '(style [_]
+            [:root {:color "#FFFFF"}
+             :section {:background-color :green}])))
+    (is (nil? (oc/get-style-form
+                '(Object
+                   (render [this])
+                   static om/Ident
+                   (ident [this])))))
+    (is (= (oc/get-component-style form)
+          [:root {:color "#FFFFF"}
+           :section {:background-color :green}]))))

-  (get-component-style
-    '(static om/IQuery
-      (query [this])
-      static oc/Style
-      (style [_]
-        [:root {:color "#FFFFF"}
-         :section (merge {} ;;css/default-section
-                    {:background-color :green})])
-     static om/Ident
-     (ident [this])
-     Object
-     (render [this])
-     static om/IQueryParams
-     (params [this])))
-
-  (get-style-form
-    '(Object
-      (render [this])
-      static om/Ident
-      (ident [this])))
-
-  (reshape-style-form
-    '(style [_]
-       [:root {:color "#FFFFF"}
-        :section (merge {} {:background-color :green})]))
-
-  )
+(deftest test-reshape-defui
+  (let [form '(om/IQuery
+                (query [this])
+                om/Ident
+                (ident [this])
+                Object
+                (componentWillMount [this])
+                (render [dia]
+                  (dom/div {:class :foo} (dom/div nil "3")))
+                static field a 3
+                static om/IQuery
+                (query [this] [:a]))
+        expected '[om/IQuery
+                   (query [this])
+                   om/Ident
+                   (ident [this])
+                   Object
+                   (componentWillMount [this])
+                   (render [dia]
+                     (dom/div
+                       {:class "ns_core_Foo_foo"
+                        :omcss$this {:component-name "Foo"
+                                     :ns-name "ns.core"}}
+                       (dom/div nil "3")))
+                   static field a 3
+                   static om/IQuery
+                   (query [this] [:a])]]
+    (is (= (oc/reshape-defui form component-info)
+          expected))
+    (is (= (oc/reshape-defui
+             '(Object (render [this] (dom/div nil "foo")))
+             component-info)
+          '[Object (render [this] (dom/div nil "foo"))]))))


updating luxvalue related fns to also accept scene as arg, updating material-ref to inject interior/exterior (if given), updating luxattrib to inject transform & material settings

--- src/thi/ng/luxor/core.clj
+++ src/thi/ng/luxor/core.clj
@@ -19,6 +19,8 @@

 (def ^:dynamic *indent* 2)

+(def ^:dynamic *float-format* "%1.8f")
+
 (def ^:const mesh-types {:inline :trimesh :ply :plymesh :stl :stlmesh})

 (def ^:dynamic *degrees* true)
@@ -35,196 +37,197 @@
   [rgb scale d]
   (mapv #(scaled-absorption-at-depth % scale d) rgb))

+(defn- material-ref
+  [scene id]
+  (let [{:keys [__interior __exterior]} (get-in scene [:materials id])]
+    (str
+     (format "NamedMaterial \"%s\"\n" id)
+     (when __interior (format "Interior \"%s\"\n" __interior))
+     (when __exterior (format "Exterior \"%s\"\n" __exterior)))))
+
 (declare luxvalue)

 (defn- filter-opts
   [xs] (->> xs (filter #(not (.startsWith (name (key %)) "__"))) (into {})))

 (defn- luxvalues
-  [opts]
+  [scene opts]
   (let [indent (apply str (repeat *indent* \space))]
     (->> opts
          (filter-opts)
          (into (sorted-map))
          (reduce-kv
-          (fn [s k [type v]] (str s indent (luxvalue type k v))) ""))))
+          (fn [s k [type v]] (str s indent (luxvalue type scene k v))) ""))))

 (defn- luxvalues-typed
-  [type coll]
-  (reduce (fn [s [k v]] (str s (luxvalue type k v))) "" (into (sorted-map) coll)))
+  [scene type coll]
+  (reduce (fn [s [k v]] (str s (luxvalue type scene k v))) "" (into (sorted-map) coll)))

 (defn- luxentity
-  [type id opts]
-  (prn type)
-  (format "%s \"%s\"\n%s\n" type (name id) (luxvalues opts)))
+  [scene type id opts]
+  (format "%s \"%s\"\n%s\n" type (name id) (luxvalues scene opts)))

 (defn- luxattrib
-  [id body]
-  (let [sep (str "# -------- " id " --------\n")]
-    (format "AttributeBegin %s%sAttributeEnd   %s\n" sep body sep)))
+  [scene id {:keys [__transform __material]} body]
+  (let [sep (str "# -------- " id " --------\n")
+        inject (str
+                (when __transform (luxtransform __transform))
+                (when __material (material-ref scene __material)))]
+    (format "AttributeBegin %s%s%sAttributeEnd   %s\n" sep inject body sep)))

 (defn- luxtransform
   [tx]
   (format "Transform [%s]\n"
           (apply str (interpose " " (map #(format "%1.8f" %) tx)))))

-(defn- material-ref
-  [id]
-  (format "NamedMaterial \"%s\"\n" id))
-
 (defmulti luxvalue (fn [type & _] type))

 (defmethod luxvalue :float
-  [_ id x] (format "\"float %s\" [%1.8f]\n" (name id) (float x)))
+  [_ _ id x] (format "\"float %s\" [%1.8f]\n" (name id) (float x)))

 (defmethod luxvalue :float-vec
-  [_ id xs]
+  [_ _ id xs]
   (format "\"float %s\" [%s]\n"
           (name id)
           (apply str (interpose " " (map #(format "%1.8f" (float %)) xs)))))

 (defmethod luxvalue :int
-  [_ id x] (format "\"integer %s\" [%d]\n" (name id) (int x)))
+  [_ _ id x] (format "\"integer %s\" [%d]\n" (name id) (int x)))

 (defmethod luxvalue :int-vec
-  [_ id xs]
+  [_ _ id xs]
   (format "\"integer %s\" [%s]\n"
           (name id)
           (apply str (interpose " " (map #(format "%d" (int %)) xs)))))

 (defmethod luxvalue :point-vec
-  [_ id xs]
+  [_ _ id xs]
   (format "\"point %s\" [%s]\n"
           (name id)
           (apply str (interpose " " (map #(format "%1.8f" (float %)) (mapcat identity xs))))))

 (defmethod luxvalue :bool
-  [_ id x] (format "\"bool %s\" [\"%b\"]\n" (name id) x))
+  [_ _ id x] (format "\"bool %s\" [\"%b\"]\n" (name id) x))

 (defmethod luxvalue :string
-  [_ id x] (format "\"string %s\" [\"%s\"]\n" (name id) x))
+  [_ _ id x] (format "\"string %s\" [\"%s\"]\n" (name id) x))

 (defmethod luxvalue :string-vec
-  [_ id xs]
+  [_ _ id xs]
   (format "\"string %s\" [%s]\n"
           (name id)
           (apply str (interpose " " (map #(format "\"%s\"" %) xs)))))

 (defmethod luxvalue :color
-  [_ id [r g b]]
+  [_ _ id [r g b]]
   (format "\"color %s\" [%1.6f %1.6f %1.6f]\n" (name id) (float r) (float g) (float b)))

 (defmethod luxvalue :log-color
-  [_ id [col scale depth]]
+  [_ _ id [col scale depth]]
   (let [[r g b] (scaled-absorption-color-at-depth col scale depth)]
     (format "\"color %s\" [%1.6f %1.6f %1.6f]\n" (name id) r g b)))

 (defmethod luxvalue :renderer
-  [_ id opts]
-  (luxentity "Renderer" id opts))
+  [_ scene id opts]
+  (luxentity scene "Renderer" id opts))

 (defmethod luxvalue :sampler
-  [_ id opts]
-  (luxentity "Sampler" id opts))
+  [_ scene id opts]
+  (luxentity scene "Sampler" id opts))

 (defmethod luxvalue :integrator
-  [_ id opts]
-  (luxentity "SurfaceIntegrator" id opts))
+  [_ scene id opts]
+  (luxentity scene "SurfaceIntegrator" id opts))

 (defmethod luxvalue :volume-integrator
-  [_ id _]
+  [_ _ id _]
   (format "VolumeIntegrator \"%s\"\n\n" id))

 (defmethod luxvalue :accelerator
-  [_ id opts]
-  (luxentity "Accelerator" id opts))
+  [_ scene id opts]
+  (luxentity scene "Accelerator" id opts))

 (defmethod luxvalue :film
-  [_ id opts]
-  (luxentity "Film" id opts))
+  [_ scene id opts]
+  (luxentity scene "Film" id opts))

 (defmethod luxvalue :area-light
-  [_ id opts]
+  [_ scene id opts]
   (let [[stype sopts] (:__shape opts)]
     (str
-     (luxentity "AreaLightSource" "area" opts)
-     (luxvalue stype (str id "-mesh") sopts))))
+     (luxentity scene "AreaLightSource" "area" opts)
+     (luxvalue stype scene (str id "-mesh") sopts))))

 (defmethod luxvalue :light
-  [_ id opts]
+  [_ scene id opts]
   (luxattrib
-   id
+   scene id opts
    (str
-    (when-let [tx (:__transform opts)] (luxtransform tx))
-    (when-let [mat (:__material opts)] (material-ref mat))
     (when-let [g (:__parent opts)] (format "LightGroup \"%s\"\n" g))
-    (luxvalue (:__type opts) id opts))))
+    (luxvalue (:__type opts) scene id opts))))

 (defmethod luxvalue :camera
-  [_ id opts]
+  [_ scene id opts]
   (let [{[ex ey ez] :eye [tx ty tz] :target [ux uy uz] :up} (:__lookat opts)]
     (str
      (format "LookAt %1.6f %1.6f %1.6f  %1.6f %1.6f %1.6f  %1.6f %1.6f %1.6f\n\n"
              ex ey ez tx ty tz ux uy uz)
-     (luxentity "Camera" id opts))))
+     (luxentity scene "Camera" id opts))))

 (defmethod luxvalue :material
-  [_ id opts]
-  (luxentity "MakeNamedMaterial" id opts))
+  [_ scene id opts]
+  (luxentity scene "MakeNamedMaterial" id opts))

 (defmethod luxvalue :volume
-  [_ id opts]
+  [_ scene id opts]
   (str
    (format "MakeNamedVolume \"%s\" \"%s\"\n" (name id) (name (:__type opts)))
-   (luxvalues opts)
+   (luxvalues scene opts)
    "\n"))

 (defmethod luxvalue :trimesh
-  [_ id {:keys [__mesh]}]
+  [_ scene id {:keys [__mesh]}]
   (let [verts (vec (keys (:vertices __mesh)))
         vidx (zipmap verts (range))
         indices (mapcat (fn [[a b c]] [(vidx a) (vidx b) (vidx c)]) (:faces __mesh))]
     (luxentity
-     "Shape" "trianglemesh"
+     scene "Shape" "trianglemesh"
      {:indices [:int-vec (vec indices)]
       :P [:point-vec verts]
       :name [:string id]})))

 (defmethod luxvalue :plymesh
-  [_ id {:keys [__mesh __basename path filename] :as opts}]
+  [_ scene id {:keys [__mesh __basename path filename] :as opts}]
   (when __mesh
     (let [path (or (second filename) (str __basename ".ply"))]
       (prn "exporting ply mesh: " id path)
       (with-open [out (io/output-stream path)]
         (mio/write-ply out __mesh))))
-  (luxentity "Shape" "plymesh" opts))
+  (luxentity scene "Shape" "plymesh" opts))

 (defmethod luxvalue :stlmesh
-  [_ id {:keys [__mesh __basename path filename] :as opts}]
+  [_ scene id {:keys [__mesh __basename path filename] :as opts}]
   (when __mesh
     (let [path (or (second filename) (str __basename ".stl"))]
       (prn "exporting stl mesh: " id path)
       (with-open [out (io/output-stream path)]
         (mio/write-stl out __mesh))))
-  (luxentity "Shape" "stlmesh" opts))
+  (luxentity scene "Shape" "stlmesh" opts))

 (defmethod luxvalue :shape
-  [_ id {:keys [__type __transform __material] :as opts}]
+  [_ scene id {:keys [__type] :as opts}]
   (luxattrib
-   id
+   scene id opts
    (str
-    (when __transform (luxtransform __transform))
-    (when __material (material-ref __material))
     (if ((set (vals mesh-types)) __type)
-      (luxvalue __type id opts)
-      (luxentity "Shape" __type opts)))))
+      (luxvalue __type scene id opts)
+      (luxentity scene "Shape" __type opts)))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; serialization

 (defn- lx-header
   [path & comments]
-  (prn comments)
   (format "# %s\n# generated %s by luxor v%s\n%s\n"
           path (.toString (Date.)) version
           (if (seq comments)
@@ -304,7 +307,7 @@
      (let [scene* (reduce
                    (fn [s [k type]]
                      (if-let [ents (k scene)]
-                       (assoc s k (luxvalues-typed type ents))
+                       (assoc s k (luxvalues-typed scene type ents))
                        s))
                    (select-keys scene [:comments :includes])
                    {:renderer :renderer
@@ -345,28 +348,38 @@
   [scene & paths]
   (update-in scene [:includes :partials] (fnil into []) paths))

+(defn- material-common
+  [{:keys [interior exterior]}]
+  {:__interior interior
+   :__exterior exterior})
+
 (defn material-null
   [scene id]
   (append scene :materials (name id) {:type [:string "null"]} true))

 (defn material-matte
-  [scene id & {:keys [diffuse sigma] :or {diffuse [1.0 1.0 1.0] sigma 0}}]
+  [scene id & {:keys [diffuse sigma] :or {diffuse [1.0 1.0 1.0] sigma 0} :as opts}]
   (append
    scene :materials (name id)
-   {:type [:string "matte"]
-    :Kd [:color diffuse]
-    :sigma [:float sigma]}))
+   (merge
+    (material-common opts)
+    {:type [:string "matte"]
+     :Kd [:color diffuse]
+     :sigma [:float sigma]})))

 (defn material-matte-translucent
   [scene id & {:keys [reflect transmit sigma conserve?]
-               :or {reflect [0.3 0.3 0.3] transmit [0.65 0.65 0.65] sigma 0 conserve? true}}]
+               :or {reflect [0.3 0.3 0.3] transmit [0.65 0.65 0.65] sigma 0 conserve? true}
+               :as opts}]
   (append
    scene :materials (name id)
-   {:type [:string "mattetranslucent"]
-    :Kr [:color reflect]
-    :Kt [:color transmit]
-    :sigma [:float sigma]
-    :energyconserving [:bool conserve?]}))
+   (merge
+    (material-common opts)
+    {:type [:string "mattetranslucent"]
+     :Kr [:color reflect]
+     :Kt [:color transmit]
+     :sigma [:float sigma]
+     :energyconserving [:bool conserve?]})))

 (defn volume
   [scene id & {:keys [type fresnel absorb abs-scale abs-depth]
@@ -655,16 +668,18 @@
   (def lxs (-> (lux-scene)
                (camera :eye [10 -2 10] :target [0 0 0] :up [0 0 1])
                (film :width 640 :height 360 :display-interval 5 :halt-spp 50)
+               (volume "inside" :type :clear :absorb [0.972 0.8 0.7] :abs-depth 1 :fresnel 2.04)
                (area-light "left" :p [0 0 5] :size 1 :gain 1 :tx {:translate [-5 0 0] :ry -20})
                (area-light "top" :p [0 0 7] :size 6 :gain 0.5 :tx {:translate [0 4 0] :rx -45})
                (area-light "right" :p [0 0 5] :size 1 :gain 1 :tx {:translate [5 0 0] :ry 20})
                (shape-disk "floor" :radius 20 :material "white")
                ;;(shape-disk "d1" :radius 3 :inner-radius 2 :material "red" :tx {:rx -30})
                ;;(shape-disk "d2" :radius 3 :inner-radius 2 :material "orange" :tx {:rx 30})
-               (stl-mesh "map" :material "orange" :tx {:scale [5 3 1] :translate [0 0 1]} :mesh (g/extrude (r/rect -1 -1 2 2) {:depth 1 :scale 0.8}))
+               (stl-mesh "map" :material "orange-trans" :tx {:scale [5 3 1] :translate [0 0 1]} :mesh (g/extrude (r/rect -1 -1 2 2) {:depth 1 :scale 0.8}))
                (material-matte "white" :diffuse [0.8 0.8 0.8])
                (material-matte "red" :diffuse [1.0 0 0])
                (material-matte "orange" :diffuse [1.0 0.3 0])
-               (serialize-scene "foo" false)
+               (material-matte-translucent "orange-trans" :interior "inside" :transmit [0.9 0.3 0.05] :reflect [0.3 0.3 0.3] :conserve? true)
+               ;;(serialize-scene "foo" false)
                ))
   )


Switched logging to timbre

Switched logging to timbre

--- src/tropefest/handler.clj
+++ src/tropefest/handler.clj
@@ -19,15 +19,15 @@
            (route/resources "/")
            (route/not-found "Not Found"))

-
 (defn seed-database []
+  (timbre/info "Seeding...")
   (let [seed (p/load-resource-url "http://tvtropes.org/pmwiki/pmwiki.php/Anime/CowboyBebop")]
     (p/save-page-links seed)))

 (defn update-handler [t opts]
-  (print (str "Remaining " (count (db/query-nodes-to-crawl (db/get-connection) 9999999)) " updating " (:total opts) "... "))
-  (p/crawl-and-update (db/get-connection) (:total opts))
-  (println "Done"))
+  (timbre/info (str "Remaining " (count (db/query-nodes-to-crawl (db/get-connection) 9999999)) " updating " (:total opts) "... "))
+  (p/crawl-and-update (db/get-connection) (Integer. (:total opts)))
+  (timbre/info "Done"))

 (def update-task
   {:id "update-task"
@@ -44,11 +44,6 @@
    put any initialization code here"
   []

-  (println (str "Updating " (:update-size env) " using " (:update-cron env)))
-
-  (seed-database)
-  (cronj/start! cj)
-
   (timbre/set-config!
     [:appenders :rotor]
     {:min-level             :info
@@ -61,11 +56,20 @@
     [:shared-appender-config :rotor]
     {:path "tropefest.log" :max-size (* 512 1024) :backlog 10})

+
+  (timbre/info (str "Updating " (:update-size env) " using " (:update-cron env)))
+  (seed-database)
+  (cronj/start! cj)
+
   (if (env :dev) (parser/cache-off!))
+
+
   ;;start the expired session cleanup job
   (cronj/start! session/cleanup-job)
   (timbre/info "\n-=[ tropefest started successfully"
                (when (env :dev) "using the development profile") "]=-"))
+
+

 (defn destroy
   "destroy will be called when your application


add new fn buffer-live?

add new fn buffer-live?

--- src/overtone/sc/buffer.clj
+++ src/overtone/sc/buffer.clj
@@ -131,6 +131,12 @@
   [buf]
   (isa? (type buf) ::file-buffer))

+(defn buffer-live?
+  "Returns true if b is a live buffer on the server"
+  [b]
+  (and (buffer? b)
+       (= :live @(:status b))))
+
 (defn buffer-free
   "Synchronously free an audio buffer and the memory it was consuming."
   [buf]


(apply mono-player id nil) is equivalent to (mono-player id)

--- src/overtone/sc/sample.clj
+++ src/overtone/sc/sample.clj
@@ -119,9 +119,7 @@
   (let [{:keys [path args] :as s} (apply load-sample path args)
         player (fn [& pargs]
                  (let [id (:id (get @loaded-samples* [path args]))]
-                   (if (empty? pargs)
-                     (mono-player id)
-                     (apply mono-player id pargs))))]
+                   (apply mono-player id pargs)))]
     (callable-map (merge {:player player} s)
                   player)))


138 make square

138 make square

--- stuf/src/sandbox/4clojure.clj
+++ stuf/src/sandbox/4clojure.clj
@@ -1085,3 +1085,16 @@
   ([num base res]
    (if (= 0 (quot num base)) (cons num res)
        (recur (quot num base) base (cons (mod num base) res)))))
+
+(defn f
+  ([xs num] (take num (f xs
+                        (cycle [[-1 0] [0 1] [1 0] [0 -1]])
+                        #{})))
+  ([xy ops history]
+  (lazy-seq
+   (let [nxy (map + xy (first ops))
+         nnxy (map + xy (second ops))]
+     (if (history nnxy)
+       (cons xy (f nxy ops (conj history xy)))
+       (cons xy (f nnxy (rest ops) (conj history xy))))))))
+


150 not eficient solution

150 not eficient solution

--- stuf/src/sandbox/4clojure.clj
+++ stuf/src/sandbox/4clojure.clj
@@ -1277,21 +1277,21 @@
     (+ (sum n fst) (sum n scd) (- (sum n (* fst scd))))))

 ;;150
-(defn f [xs]
-  (lazy-seq
-   (let [cnt (count xs)
-         mdl (int (Math/ceil (/ cnt 2)))
-         part (take mdl xs)
-         trap (if (odd? cnt) (rest (reverse part)) (reverse part))
-         num (read-string (apply str (concat part trap)))
-         nxt (read-string (apply str xs))]
-     (cons num (f (str (inc nxt)))))))
-
-(defn dcount [num]
-  (count (str num)))
-
-(defn pow [num n]
-  (case
-      (< n 1) 1
-      (= n 1) num
-      :else (pow (* num num) (dec n))))
+(letfn
+    [(mid [cnt]
+       (let [middle (int (Math/ceil (/ cnt 2)))]
+         (if (odd? cnt) (dec middle) middle)))
+     (reverce-num [num]
+       (Integer/parseInt (apply str (reverse (str num)))))]
+  (defn f [num]
+    (lazy-seq
+     (let [cnt (count (str num))
+           midl (mid cnt)
+           base (int (Math/pow 10 midl))
+           lpart (quot num base)
+           lbase (* lpart base)
+           rpart (mod (reverce-num lpart) base)
+           new-num (+ lbase rpart)]
+       (if (< new-num num)
+         (f (+ lbase base))
+         (cons new-num (f (+ lbase base))))))))


change vcr anim for paren fracturing to show a more common use case: var renaming


Fix tests

Fix tests

--- src/zaffre/glterminal.clj
+++ src/zaffre/glterminal.clj
@@ -605,7 +605,13 @@
   ;; characters is a list of {:c \character :x col :y row :fg [r g b] :bg [r g b]}
   (put-chars! [_ layer-id characters]
     {:pre [(is (not (nil? (get layer-id->group layer-id))) (format "Invalid layer-id %s" layer-id))
-           (is (not (nil? (get layer-character-map layer-id))) (format "Invalid layer-id %s" layer-id))]}
+           (is (not (nil? (get layer-character-map layer-id))) (format "Invalid layer-id %s" layer-id))
+           (is (coll? characters) "characters must be a collection")
+           (every? true? (map (fn [character]
+                                (is (every? character #{:x :y :c :fg :bg}) (str character "missing required keys"))
+                                (is number? (get character :x))
+                                (is number? (get character :y)))
+                              characters))]}
     #_(log/info "characters" (str characters))
     (let [columns (-> layer-id layer-id->group deref :columns)
           rows    (-> layer-id layer-id->group deref :rows)]


Added best-agree boolean attribute to repness output for comments which are disgaree repfull, but actually agreed upon (as the first comment in the selection)

--- src/polismath/clusters.clj
+++ src/polismath/clusters.clj
@@ -546,7 +546,12 @@
     (map-vals
       (fn [{:keys [best best-agree sufficient]}]
         (let [best-agree (when best-agree
-                           (finalize-cmt-stats (:tid best-agree) best-agree))
+                           ; finalize, and assoc in a :best-agree attribute, so the client can render
+                           ; accordingly
+                           (assoc
+                             (finalize-cmt-stats (:tid best-agree) best-agree)
+                             :best-agree true))
+              ; Use best agree if that's what we have; otherwise best (possibly disagree); otherwise nothing
               best-head (cond
                           best-agree [best-agree]
                           best       [best]


Added db logic for measuring actual # ptpts; separated from vistors

--- src/polismath/intercom.clj
+++ src/polismath/intercom.clj
@@ -91,7 +91,9 @@
   (->
     get-db-users
     (ko/fields :owned_convs.avg_n_ptpts
+               :owned_convs.avg_n_visitors
                :owned_convs.n_owned_convs
+               :owned_convs.n_owned_convs_ptptd
                :ptpt_summary.n_ptptd_convs)
     ; Join summary stats of owned conversations
     (ko/join :left
@@ -103,13 +105,26 @@
            [(ko/subselect
               participants
               (ko/fields :zid)
-              (ko/aggregate (count (ko/raw "DISTINCT pid")) :n_ptpts :zid))
-            ; as conv_summary
-            :conv_summary]
-           (= :conv_summary.zid :zid))
+              (ko/aggregate (count (ko/raw "DISTINCT pid")) :n_visitors :zid))
+            ; as visitor_summary
+            :visitor_summary]
+           (= :visitor_summary.zid :zid))
+         (ko/join
+           :left
+           [(ko/subselect
+              participants
+              (ko/fields :participants.zid [(ko/raw "COUNT(DISTINCT votes.pid) > 0") :any_votes])
+              (ko/join votes (and (= :votes.pid :participants.pid)
+                                  (= :votes.zid :participants.zid)))
+              (ko/aggregate (count (ko/raw "DISTINCT votes.pid")) :n_ptpts :participants.zid))
+            ; as ptpt_summary
+            :ptpt_summary]
+           (= :ptpt_summary.zid :zid))
          ; Average participant counts, and count number of conversations
-         (ko/aggregate (avg :conv_summary.n_ptpts) :avg_n_ptpts)
+         (ko/aggregate (avg :visitor_summary.n_visitors) :avg_n_visitors)
+         (ko/aggregate (avg :ptpt_summary.n_ptpts) :avg_n_ptpts)
          (ko/aggregate (count (ko/raw "DISTINCT conversations.zid")) :n_owned_convs)
+         (ko/aggregate (sum (ko/raw "CASE WHEN ptpt_summary.any_votes THEN 1 ELSE 0 END")) :n_owned_convs_ptptd)
          (ko/group :owner))
        ; as owned_convs
        :owned_convs]
@@ -141,6 +156,7 @@
       get-db-users-with-stats
       (ko/where (in :email emails))
       (ko/select))))
+

 (defn update-icuser-from-dbuser
   [dbuser]
@@ -156,7 +172,7 @@
          [:custom_attributes
             (pc/fn->
               (hash-map-subset
-                [:avg_n_ptpts :n_owned_convs :n_ptptd_convs]))]
+                [:avg_n_ptpts :n_owned_convs :n_ptptd_convs :n_owned_convs_ptptd :avg_n_visitors]))]
          [:remote_created_at
             #(/ (:created %) 1000)]]))))


Make InfluxDB port default to 8086.

Make InfluxDB port default to 8086.

--- src/riemann/influxdb_9.clj
+++ src/riemann/influxdb_9.clj
@@ -12,7 +12,7 @@
   [opts]
   (str (if (:tls opts) "https" "http")
        "://" (:host opts)
-       \: (:port opts)
+       \: (:port opts 8086)
        "/write"))

@@ -65,14 +65,15 @@

   (batch 500 1
     (influxdb {:host \"influxdb.example.com\"
-               :port 8086
-               :database \"my_db\"}))
+               :database \"my_db\"
+               :user \"riemann\"
+               :password \"secret\"}))

   Options:

   `:host`           Hostname to write points to.

-  `:port`           API port number.
+  `:port`           API port number. (optional)

   `:tls`            Whether to write using HTTPS. (optional)


oh fuu - and order is tricky, #prefixed

oh fuu - and order is tricky, #prefixed

--- src/cljs/conference_rating/view_utils/conference.cljs
+++ src/cljs/conference_rating/view_utils/conference.cljs
@@ -55,10 +55,10 @@
     (if (is-future-conference? conference)
       (if (= 0 number-of-attendees)
         "No one is going, yet."
-        (str "You and " (- 1 number-of-attendees) " others are going."))
+        (str "You and " (- number-of-attendees 1) " others are going."))
       (if (= 0 number-of-attendees)
         "No one was here."
-        (str "You and " (- 1 number-of-attendees) " others were here.")))))
+        (str "You and " (- number-of-attendees 1) " others were here.")))))

 (defn attending-summary-label [conference]
     [:div


as users and registries can be empty set init state on nil

--- src/cljs/swarmpit/component/service/create_image.cljs
+++ src/cljs/swarmpit/component/service/create_image.cljs
@@ -28,9 +28,9 @@
   {:color    "rgb(117, 117, 117"
    :minWidth "200px"})

-(defonce registries (atom []))
+(defonce registries (atom nil))

-(defonce users (atom []))
+(defonce users (atom nil))

 (defn- registries-handler
   []
@@ -107,6 +107,6 @@
   (let [registries (rum/react registries)
         users (rum/react users)]
     (progress/form
-      (or (empty? registries)
-          (empty? users))
+      (or (nil? registries)
+          (nil? users))
       (form-tabs registries users))))


add lein-immutant

add lein-immutant

--- home/.lein/profiles.clj
+++ home/.lein/profiles.clj
@@ -1,5 +1,6 @@
 {:user {:plugins [[cider/cider-nrepl "0.9.1"]
-                  [refactor-nrepl "1.1.0"]]
+                  [refactor-nrepl "1.1.0"]
+                  [lein-immutant "2.0.0"]]
         :dependencies [[org.clojure/tools.nrepl "0.2.10"]]}}


update cider-nrepl

update cider-nrepl

--- home/.lein/profiles.clj
+++ home/.lein/profiles.clj
@@ -1 +1 @@
-{:user {:plugins [[cider/cider-nrepl "0.8.1"]]}}
+{:user {:plugins [[cider/cider-nrepl "0.9.0-SNAPSHOT"]]}}