Remove outer routes from codebase.

Remove outer routes from codebase.

They were deprecated a while ago, so let's just pull the trigger.

--- src-cljs/frontend/routes.cljs
+++ src-cljs/frontend/routes.cljs
@@ -31,10 +31,6 @@
   [app nav-ch navigation-point args]
   (compassus/set-route! app :route/legacy-page)
   (put! nav-ch [navigation-point (assoc args :inner? true)]))
-
-;; TODO: Remove this and everything that uses it. It should be completely obsolete.
-(defn open-to-outer! [nav-ch navigation-point args]
-  (put! nav-ch [navigation-point (assoc args :inner? false)]))

 (defn logout! [nav-ch]
   (put! nav-ch [:logout]))
@@ -285,102 +281,13 @@
   (defroute v1-logout "/logout" []
     (logout! nav-ch))

-  (defroute v1-mobile "/mobile" {:as params}
-    (open-to-outer! nav-ch :mobile (assoc params
-                                     :_title "Mobile Continuous Integration and Mobile App Testing"
-                                     :_description "Build 5-star mobile apps with Mobile Continuous Integration by automating your build, test, and deployment workflow on iOS and Android. ")))
-
-  (defroute v1-ios "/mobile/ios" {:as params}
-    (open-to-outer! nav-ch :ios (assoc params
-                                  :_title "Apple iOS App Testing"
-                                  :_description "Build 5-star iOS apps by automating your development workflow with Mobile Continuous Integration and Delivery.")))
-
-  (defroute v1-android "/mobile/android" {:as params}
-    (open-to-outer! nav-ch :android (assoc params
-                                      :_title "Android App Testing"
-                                      :_description "Build better Android apps with Mobile Continuous Integration. Get testing today!")))
-
-  (defroute v1-pricing "/pricing" {:as params}
-    (open-to-outer! nav-ch :pricing (assoc params
-                                        :_analytics-page "View Pricing Outer"
-                                        :_title "Pricing and Information"
-                                        :_description "Save time and cost by making your engineering team more efficient. Get started for free and see how many containers and parallelism you need to scale with your team.")))
-
-  (defroute v1-jobs "/jobs" {:as params}
-    (open-to-outer! nav-ch :jobs (assoc params
-                                   :_analytics-page "View jobs"
-                                   :_title "Search for Jobs at CircleCI"
-                                   :_description "Come work with us. Join our amazing team of highly technical engineers and business leaders to help us build great developer tools.")))
-
-  (defroute v1-privacy "/privacy" {:as params}
-    (open-to-outer! nav-ch :privacy (assoc params
-                                      :_analytics-page "View Privacy"
-                                      :_title "Privacy Policy"
-                                      :_description "Read our privacy policy to understand how we collect and use information about you.")))
-
-  (defroute v1-security "/security" {:as params}
-    (open-to-outer! nav-ch :security (assoc params
-                                       :_analytics-page "View Security"
-                                       :_title "Security Policy"
-                                       :_description "Read our security policy and guidelines and see how your data is safe with CircleCI.")))
-
-  (defroute v1-security-hall-of-fame "/security/hall-of-fame" {:as params}
-    (open-to-outer! nav-ch :security-hall-of-fame (assoc params
-                                                    :_title "Security Hall of Fame"
-                                                    :_description "Join our Security Hall of Fame by helping us make our platform more secure."
-                                                    :_analytics-page "View Security Hall of Fame")))
-
-  (defroute v1-enterprise "/enterprise" {:as params}
-    (open-to-outer! nav-ch :enterprise (assoc params
-                                         :_title "Enterprise Continuous Integration and Deployment"
-                                         :_description "Reduce risk with Enterprise Continuous Integration from CircleCI. Integrates seamlessly with Github Enterprise and the rest of your technology stack.")))
-
-  (defroute v1-enterprise-aws "/enterprise/aws" {:as params}
-    (open-to-outer! nav-ch :aws (assoc params
-                                         :_title "CircleCI Enterprise on AWS"
-                                         :_description "Run CircleCI Enterprise on the same AWS infrastructure you use for everything else. Integrates seamlessly with GitHub Enterprise on AWS.")))
-
-  (defroute v1-enterprise-azure "/enterprise/azure" {:as params}
-    (open-to-outer! nav-ch :azure (assoc params
-                                         :_title "CircleCI Enterprise on Azure"
-                                         :_description "Install CircleCI Enterprise in your own Microsoft Azure account. Integrates with GitHub Enterprise on Azure and Active Directory authentication.")))
-
-  (defroute v1-stories "/stories/:story" [story]
-    (open-to-outer! nav-ch :stories {:story (keyword story)}))
-
-  (defroute v1-features "/features" {:as params}
-    (open-to-outer! nav-ch :features (assoc params
-                                       :_title "Continuous Integration Product and Features"
-                                       :_description "Build a better product and let CircleCI handle your testing. CircleCI helps your team improve productivity with faster development, reduced risk, and better code.")))
-
-  (defroute v1-languages "/features/:language" {:as params}
-    (open-to-outer! nav-ch :language-landing params))
-
-  (defroute v1-integrations "/integrations/:integration" [integration]
-    (open-to-outer! nav-ch :integrations {:integration (keyword integration)}))
-
   (defroute v1-root "/" {:as params}
     (if authenticated?
       (open-to-inner! app nav-ch :dashboard params)
-      ;; Note: This actually uses the outer styles, but rather than use
-      ;; `open-to-outer!`, it's special-cased in
-      ;; `frontend.components.app/Wrapper`. Meanwhile `open-to-outer!` simply
-      ;; doesn't work anymore, and needs to be cleaned up.
       (open-to-inner! app nav-ch :landing (assoc params :_canonical "/"))))

   (defroute v1-dashboard "/dashboard" {:as params}
-    (open-to-inner! app nav-ch :dashboard params))
-
-  (defroute v1-home "/home" {:as params}
-    (open-to-outer! nav-ch :landing (assoc params :_canonical "/")))
-
-  (defroute v1-press "/press" {:as params}
-    (open-to-outer! nav-ch :press (assoc params
-                                         :_title "Press Releases and Updates"
-                                         :_description "Find the latest CircleCI news and updates here.")))
-
-  (defroute v1-signup "/signup" {:as params}
-    (open-to-outer! nav-ch :signup params)))
+    (open-to-inner! app nav-ch :dashboard params)))

 (defn define-routes! [current-user app nav-ch]
   (let [authenticated? (boolean current-user)]


re-add run-tests form

re-add run-tests form

--- point-mutations/point_mutations_test.clj
+++ point-mutations/point_mutations_test.clj
@@ -21,3 +21,5 @@
 (deftest undefined-when-lengths-are-different
   (is (= nil (point_mutations/hamming-distance "AAAC" "TAGGGGAGGCTAGCGGTAGGAC")))
   (is (= nil (point_mutations/hamming-distance "GACTACGGACAGGGTAACATAG" "GACA"))))
+
+(run-tests)


some refactoring

some refactoring

--- src/c4_arena/core.clj
+++ src/c4_arena/core.clj
@@ -3,6 +3,8 @@
   (:require
    [clojure.core
     [async :as async :refer [go go-loop <! >! chan put! alt! alts!]]]
+   [clojure
+    [string :as string]]
    [taoensso.timbre :as tb]
    [manifold
     [stream :as st]
@@ -56,11 +58,12 @@
     (reset! winner (get-winner @state i))
     true))

+(declare initial-loop)
 (defn game-loop [players]
   (let [ch-ins (mapv :ch-in players)
         ch-outs (mapv :ch-out players)
         state (atom (vec (repeat (* ncols nrows) 0)))
-        turn (atom 0)
+        turn (atom (rand-int 2))
         winner (atom nil)
         notify (fn [ch]
                  (put! ch (cond->
@@ -73,30 +76,37 @@
                              :winner (inc @winner)
                              :turn 0))))]
     (go
+      ;; Start out by notifying both sides of the board state
       (doseq [ch-out ch-outs]
         (notify ch-out))
       ;; During the game
       (loop []
         (when-let [[{:keys [type move] :as msg} ch-in] (alts! ch-ins)]
-          (when msg
-            (let [actor (.indexOf ch-ins ch-in)
-                  ch-out (ch-outs actor)]
-              (cond
-                (= type "state_request")
-                (notify ch-out)
-                (and (= type "move")
-                     (= @turn actor)
-                     (process-move state winner turn move))
-                (doseq [ch-out ch-outs]
-                  (notify ch-out))
-                :else (put! ch-out {:type :ignored :msg msg})))
-            (when-not @winner
-              (recur)))))
-      ;; Cleanup
-      (doseq [{:keys [latch ch-out]} players]
-        (notify ch-out)
-        (put! ch-out {:type (if @winner "end" "disconnected")})
-        (async/close! latch)))))
+          (let [actor (.indexOf ch-ins ch-in)
+                ch-out (ch-outs actor)]
+            (if-not msg
+              ;; Cleanup
+              (doseq [{ch-out0 :ch-out :as player0} players
+                      :when (not= ch-out ch-out0)]
+                (notify ch-out0)
+                (put! ch-out0 {:type "disconnected"})
+                (initial-loop player0))
+              (do (cond
+                    (= type "state_request")
+                    (notify ch-out)
+                    (and (= type "move")
+                         (= @turn actor)
+                         (process-move state winner turn move))
+                    (doseq [ch-out ch-outs]
+                      (notify ch-out))
+                    :else (put! ch-out {:type :ignored :msg msg}))
+                  (if-not @winner
+                    (recur)
+                    ;; Cleanup
+                    (doseq [{:keys [ch-out0] :as player0} players]
+                      (notify ch-out0)
+                      (put! ch-out0 {:type "end"})
+                      (initial-loop player0)))))))))))

 (defn match-once [{:keys [id] :as player0}]
   (if-let [player1 (->> (vals @awaiting)
@@ -108,54 +118,72 @@
                          (fn [{other-id :id}]
                            (@match-count #{id other-id})))
                         first)]
-    (do (swap! awaiting dissoc (:uid player1))
-        (async/close! (:waiter player1))
+    ;; Someone is available!
+    (do (async/close! (:waiter player1))
         (swap! match-count update-in [#{(:id player0) (:id player1)}] (fnil inc 0))
-        (game-loop [player0 player1]))
+        (game-loop (->> [player0 player1] (map #(dissoc % :waiter)))))
+    ;; Nobody is available
     (let [waiter (chan)]
+      (swap! awaiting assoc (:uid player0) (assoc player0 :waiter waiter))
       (go-loop []
         (alt!
-          waiter :done
+          ;; If the control channel is closed, dequeue and stop
+          ;; processing messages (note the lack of recur)
+          waiter
+          ([_]
+           (swap! awaiting dissoc (:uid player0)))
+          ;; Otherwise ignore all messages of the client
           (:ch-in player0)
           ([msg]
            (if-not msg
              (swap! awaiting dissoc (:uid player0))
              (do (put! (:ch-out player0)
                        {:type :ignored :msg msg :reason "waiting for match"})
-                 (recur))))))
-      (swap! awaiting assoc (:uid player0) (assoc player0 :waiter waiter)))))
+                 (recur)))))))))

 (defn matcher-init []
+  ;; This function initializes the matcher channel, which is needed
+  ;; because the data structures used by match-once are not
+  ;; thread-safe - it acts as a lock and serializes access to the
+  ;; awaiting queue
   (let [ch (chan)]
     (go-loop []
       (when-let [player (<! ch)]
-        (match-once player)
+        (try
+          (match-once player)
+          (catch Exception e
+            (tb/error e)))
         (recur)))
     (when-let [prev-ch @matcher]
       (async/close! prev-ch))
     (reset! matcher ch)))

+(defn initial-loop [{:keys [ch-in ch-out] :as player}]
+  (go-loop []
+    (when-let [msg (<! ch-in)]
+      (let [{:keys [type id]} msg
+            reason (cond
+                     (not= type "start")
+                     "Only start messages allowed in current state"
+                     (string/blank? id)
+                     "You need to include an id")]
+        (if-not reason
+          (>! @matcher (assoc player :id id))
+          (do (put! ch-out {:type "ignored" :msg msg :reason reason})
+              (recur)))))))
+
 ;;; Game loop
 (defn game-init [s]
   (let [ch-in (chan)
         ch-out (chan)
-        uid (swap! uid-counter inc)]
+        uid (swap! uid-counter inc)
+        player {:uid uid :ch-in ch-in :ch-out ch-out}]
     ;; Incoming messages
     (st/connect (st/map #(parse-string % true) s) ch-in)
     ;; Outgoing messages
     (st/connect (st/map generate-string ch-out) s)
-    ;; Event loop for the connection
-    (go-loop []
-      (when-let [msg (<! ch-in)]
-        (let [{:keys [type id]} msg]
-          (if (and (= type "start") id)
-            (let [latch (chan)]
-              (>! @matcher {:uid uid :id id :ch-in ch-in :ch-out ch-out :latch latch})
-              ;; Waits here until game ends
-              (<! latch))
-            (put! ch-out {:type "ignored" :msg msg}))
-          (recur))))
-    (st/on-drained s (fn [] (swap! awaiting dissoc uid)))
+    ;; Put into initial loop
+    (initial-loop player)
     {:status 200 :body "success!"}))

 ;;; Websocket connection for the game protocol


whitespace / comments

whitespace / comments


Adding restricted data

Adding restricted data

--- src/clj/apoya/app.clj
+++ src/clj/apoya/app.clj
@@ -137,7 +137,7 @@
                          ["js/main.js" :subresource]))
   (context "/api/public/v1/auth" [] auth-routes)
   (context "/api/v1/auth" [] private-auth-routes)
-  (context "/api/v1/command" [] command-routes)
+  (context "/api/v1/command" [] (restricted command-routes))
   (context "/api/v1/error" [] error-routes)
   (find-more-routes)
   (route/not-found (fn [_] (fleet-resource {:uri "/404.html"}))))


fixed a bug in install message

fixed a bug in install message

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -275,13 +275,13 @@

 (defn card-str
   ([state card] (card-str state card nil))
-  ([state card {:keys [visible] :as args}]
+  ([state card {:keys [visible where] :as args}]
    (str (if (card-is? card :side :corp)
          ; Corp card messages
          (str (if (or (rezzed? card) visible) (:title card) (if (ice? card) "ICE" "a card"))
               (if (ice? card) " protecting " " in ")
               ;TODO add naming of scoring area of corp/runner
-              (zone->name (second (:zone card)))
+              (or where (zone->name (second (:zone card))))
               (if (ice? card) (str " at position " (ice-index state card))))
          ; Runner card messages
          (if (or (:facedown card) visible) "a facedown card" (:title card)))
@@ -1691,7 +1691,8 @@
                      (trash state side prev-card {:keep-server-alive true})))
                  (let [visible (or (= :rezzed-no-cost install-state) (= :face-up install-state))]
                    ; TODO code above could be simplified, check whether visible is really needed here or if card-str is smart enough to figure it out on its own
-                   (system-msg state side (str (build-spend-msg cost-str "install") (card-str state c {:visible visible}))))
+                   (system-msg state side (str (build-spend-msg cost-str "install")
+                                               (card-str state c {:visible visible :where server }))))
                  (let [moved-card (move state side c slot)]
                    (trigger-event state side :corp-install moved-card)
                    (when (= (:type c) "Agenda")


Better code in (advance).

Better code in (advance).

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -998,7 +998,7 @@
   (when (pay state side card :click 1 :credit 1)
     (system-msg state side "advances a card")
     (update-advancement-cost state side card)
-    (add-prop state side card :advance-counter 1)))
+    (add-prop state side (get-card state card) :advance-counter 1)))

 (defn forfeit [state side card]
   (system-msg state side (str "forfeit " (:title card)))


Check OS prefix instead of exact match

Check OS prefix instead of exact match

Fixes #32

--- src/clj/runbld/io.clj
+++ src/clj/runbld/io.clj
@@ -81,7 +81,7 @@
       .toUpperCase))

 (defn which-bin []
-  (case (os)
+  (condp #(.startsWith %2 %1) (os)
     "LINUX" "which"
     "MAC OS X" "which"
     "WINDOWS" "where.exe"))


reduce without reduced

reduce without reduced

--- src/adventofcode2017/day6.clj
+++ src/adventofcode2017/day6.clj
@@ -8,18 +8,20 @@
                (mapv #(Integer/parseInt %))))

 (defn redistribute [blocks]
-  (let [len (count blocks)
-        val (apply max blocks)
+  (let [val (apply max blocks)
         pos (.indexOf blocks val)]
-    (reduce (fn [[blks n] idx]
-              (if (zero? n)
-                (reduced blks)
-                [(-> blks
-                     (update pos dec)
-                     (update idx inc))
-                 (dec n)]))
-            [blocks val]
-            (drop (inc pos) (cycle (range len))))))
+    (reduce #(update %1 %2 inc)
+            (assoc blocks pos 0)
+            (->> (cycle (range (count blocks)))
+                 (drop (inc pos))
+                 (take val)))))
+
+(take 5 (iterate redistribute [0 2 7 0]))
+;([0 2 7 0]
+; [2 4 1 2]
+; [3 1 2 3]
+; [0 2 3 4]
+; [1 3 4 1])

 ;; part 1
 (reduce (fn [r i]


Give player an inventory.

Give player an inventory.

--- src/isla/story.clj
+++ src/isla/story.clj
@@ -12,8 +12,7 @@
          extract-arguments creturn)

 (defrecord Monster [name summary])
-
-(defrecord Player [name summary room])
+(defrecord Player [name summary room items])
 (defrecord Flower [name summary])

 (defprotocol QueryableRoom
@@ -121,6 +120,6 @@
   {
    "monster" (fn [] (new isla.story.Monster "" ""))
    "room" (fn [] (new isla.story.Room "" "" [] :undefined))
-   "_player" (fn [] (new isla.story.Player "" "" :undefined))
    "flower" (fn [] (new isla.story.Flower "" ""))
+   "_player" (fn [] (new isla.story.Player "" "" :undefined #{}))
    })


add whitespace, make it prettier

add whitespace, make it prettier

--- src/domshot/core.cljs
+++ src/domshot/core.cljs
@@ -2,6 +2,7 @@
   (:require [goog.dom]))

 (enable-console-print!)
+

 ;; ---- Node validators ---- ;;

@@ -15,6 +16,7 @@

 (defn add-invalidator [fn]
   (swap! invalidators conj fn))
+

 ;; ---- Serializing the dom ---- ;;

@@ -38,7 +40,7 @@
       node-map)))

 (defn gen-basic-node-map [node]
-  {:node-name (.-nodeName node)
+  {:node-name  (.-nodeName node)
    :attributes (get-attrs node)})

 (defn snapshot


Try ensuring our indexes in the background

--- src/exploud/setup.clj
+++ src/exploud/setup.clj
@@ -75,8 +75,8 @@
 (defn bootstrap-mongo
   "Makes sure that all the indexes we want are present on our collections."
   []
-  (mcol/ensure-index "deployments" (array-map "tasks.status" 1))
-  (mcol/ensure-index "deployments" (array-map "start" -1 "end" -1 "name" 1)))
+  (mcol/ensure-index "deployments" (array-map "tasks.status" 1) {:background true})
+  (mcol/ensure-index "deployments" (array-map "start" -1 "end" -1 "name" 1) {:background true}))

 (defn start-graphite-reporting
   "Starts Graphite reporting."


Handle the error when trying to enter the same library number twice

--- src/mdr2/views.clj
+++ src/mdr2/views.clj
@@ -18,7 +18,8 @@
             [mdr2.dtbook.validation :refer [validate-metadata]]
             [mdr2.production-monitoring :as psm]
             [mdr2.repair :as repair]
-            [mdr2.pipeline1 :as pipeline]))
+            [mdr2.pipeline1 :as pipeline])
+  (:import java.sql.BatchUpdateException))

 (defn home [request]
   (let [identity (friend/identity request)]
@@ -171,9 +172,13 @@

 (defn production-catalog [request id library_signature]
   (if (prod/library-signature? library_signature)
-    (let [p (assoc (prod/find id) :library_signature library_signature)]
-      (prod/set-state-cataloged! p)
-      (response/redirect-after-post "/catalog"))
+    (try
+      (let [p (assoc (prod/find id) :library_signature library_signature)]
+        (prod/set-state-cataloged! p)
+        (response/redirect-after-post "/catalog"))
+      (catch BatchUpdateException e
+        (catalog request (str "Library signature already in use: "
+                              library_signature))))
     (catalog request "Library signature not valid")))

 (defn production-delete [id]


Make lists out of single result queries

Make lists out of single result queries

--- src/mdr2/views.clj
+++ src/mdr2/views.clj
@@ -238,9 +238,9 @@
             (repair/production-id? identifier)
             (when-let [production (prod/find (.substring identifier 3))] [production])
             (prod/library-signature? identifier)
-            (prod/find-by-library-signature identifier)
+            [(prod/find-by-library-signature identifier)]
             (repair/product-number? identifier)
-            (prod/find-by-productnumber identifier)
+            [(prod/find-by-productnumber identifier)]
             :else (let [search-term (str "%" identifier "%")]
                     (prod/find-by-title-or-creator search-term)))
           user (friend/current-authentication request)]


fix typos

fix typos

--- src/babel/english/lexicon.clj
+++ src/babel/english/lexicon.clj
@@ -91,25 +91,25 @@
                      :3plur "were"}}}

    "be able to" {:english {:imperfect {:1sing "was able to"
-                                       :2sing "were was able to"
-                                       :3sing "was was able to"
-                                       :1plur "were was able to"
-                                       :2plur "were was able to"
-                                       :3plur "were was able to"}
-                           :present {:1sing "am was able to"
-                                     :2sing "are was able to"
-                                     :3sing "is was able to"
-                                     :1plur "are was able to"
-                                     :2plur "are was able to"
-                                     :3plur "are was able to"}
-                           :past {:1sing "was was able to"
-                                  :2sing "were was able to"
-                                  :3sing "was was able to"
-                                  :1plur "were was able to"
-                                  :2plur "were was able to"
-                                  :3plur "were was able to"}}
+                                       :2sing "were able to"
+                                       :3sing "was able to"
+                                       :1plur "were able to"
+                                       :2plur "were able to"
+                                       :3plur "were able to"}
+                           :present {:1sing "am able to"
+                                     :2sing "are able to"
+                                     :3sing "is able to"
+                                     :1plur "are able to"
+                                     :2plur "are able to"
+                                     :3plur "are able to"}
+                           :past {:1sing "was able to"
+                                  :2sing "were able to"
+                                  :3sing "was able to"
+                                  :1plur "were able to"
+                                  :2plur "were able to"
+                                  :3plur "were able to"}}
                  :synsem {:cat :verb
-                          :sem {:pred :to-be-missing}}}
+                          :sem {:pred :be-able-to}}}

    "be missed" {:synsem {:cat :verb
                          :sem {:pred :mancare}}


Add published tag to Atom entries

Add published tag to Atom entries

--- src/io/perun/atom.clj
+++ src/io/perun/atom.clj
@@ -6,8 +6,13 @@
             [clj-time.coerce  :as tc]
             [clj-time.format  :as tf]))

-(defn updated [{:keys [date-modified date-published date-created]}]
-  (or date-modified date-published date-created))
+;; Check https://github.com/jekyll/jekyll-feed/blob/master/lib/feed.xml for tags to use
+
+(defn published [{:keys [date-published date-created]}]
+  (or date-published date-created))
+
+(defn updated [{:keys [date-modified] :as post}]
+  (or date-modified (published post)))

 (defn iso-datetime [date]
   (tf/unparse (tf/formatters :date-time-no-ms) (tc/from-date date)))
@@ -42,6 +47,7 @@
             [:title name]
             (if canonical-url
               [:link {:href canonical-url}])
+            [:published (iso-datetime (published post))]
             [:updated (iso-datetime (updated post))]
             [:content {:type "html"} (str content)]
             [:author


fix guard in check-1

fix guard in check-1

Signed-off-by: Rich Hickey <2f3b32171da334ad5d7d0db393d0928eef4308ab@gmail.com>

--- src/clj/clojure/spec/test.clj
+++ src/clj/clojure/spec/test.clj
@@ -325,7 +325,7 @@
         f (or f (when v @v))]
     (try
      (cond
-      (nil? f)
+      (or (nil? f) (some-> v meta :macro))
       {:failure (ex-info "No fn to spec" {::s/failure :no-fn})
        :sym s :spec spec}


get-config replaced the fetch-config-key function

--- src/clj/hellhound/service.clj
+++ src/clj/hellhound/service.clj
@@ -9,11 +9,11 @@

 (def default-system-map
   {:env                  (hellhound/env)
-   ::http/resource-path  (hellhound/fetch-config-key :public-files-path)
+   ::http/resource-path  (hellhound/get-config :public-files-path)
    ::http/secure-headers {:content-security-policy-settings {:object-src "none"}}
    ::http/type           :immutant
-   ::http/host           (hellhound/fetch-config-key :http-host)
-   ::http/port           (hellhound/fetch-config-key :http-port)
+   ::http/host           (hellhound/get-config :http-host)
+   ::http/port           (hellhound/get-config :http-port)
    ;; TODO: Add immutant related features in the
    ;; map blow
    ::http/container-options {:h2c? true


fix country sorting in shared badges and shared pages

--- src/clj/salava/gallery/db.clj
+++ src/clj/salava/gallery/db.clj
@@ -60,33 +60,35 @@
   [ctx user-id]
   (select-user-country {:id user-id} (into {:row-fn :country :result-set-fn first} (get-db ctx))))

-(defn all-badge-countries [ctx]
-  "Return all countries which users have public badges"
-  (let [country-keys (select-badge-countries {} (into {:row-fn :country} (get-db ctx)))]
-    (select-keys all-countries country-keys)))
-
-(defn all-page-countries [ctx]
-  "Return all countries which users have public pages"
-  (let [country-keys (select-page-countries {} (into {:row-fn :country} (get-db ctx)))]
-    (select-keys all-countries country-keys)))
-
 (defn badge-countries
   "Return user's country id and list of all countries which users have public badges"
   [ctx user-id]
   (let [current-country (user-country ctx user-id)
-        countries (merge (all-badge-countries ctx) (select-keys all-countries [current-country]))]
-    (hash-map :countries (into (sorted-map-by
-                                 (fn [a b] (compare (countries a) (countries b)))) countries)
+        countries (select-badge-countries {} (into {:row-fn :country} (get-db ctx)))]
+    (hash-map :countries (-> all-countries
+                             (select-keys (conj countries current-country))
+                             (sort-countries)
+                             (seq))
               :user-country current-country)))

 (defn page-countries
   "Return user's country id and list of all countries which users have public pages"
   [ctx user-id]
   (let [current-country (user-country ctx user-id)
-        countries (merge (all-page-countries ctx) (select-keys all-countries [current-country]))]
-    (hash-map :countries (into (sorted-map-by
-                                 (fn [a b] (compare (countries a) (countries b)))) countries)
+        countries (select-page-countries {} (into {:row-fn :country} (get-db ctx)))]
+    (hash-map :countries (-> all-countries
+                             (select-keys (conj countries current-country))
+                             (sort-countries)
+                             (seq))
               :user-country current-country)))
+
+(defn profile-countries [ctx user-id]
+  (let [current-country (user-country ctx user-id)
+        countries (select-profile-countries {} (into {:row-fn :country} (get-db ctx)))]
+    (-> all-countries
+        (select-keys (conj countries current-country))
+        (sort-countries)
+        (seq))))

 (defn public-badge-content
   "Return data of the public badge by badge-content-id. Fetch badge criteria and issuer data. If user has not received the badge use most recent criteria and issuer. Fetch also average rating of the badge, rating count and recipient count"
@@ -137,14 +139,6 @@
                 (jdbc/query conn (into [query] params)))]
     (p/page-badges ctx pages)))

-(defn profile-countries [ctx user-id]
-  (let [current-country (user-country ctx user-id)
-        countries (select-profile-countries {} (into {:row-fn :country} (get-db ctx)))]
-    (-> all-countries
-        (select-keys (conj countries current-country))
-        (sort-countries)
-        (seq))))
-
 (defn public-profiles
   "Searcn public user profiles by user's name and country"
   [ctx search-params user-id]


shorten lines

shorten lines

--- src/clj_money/web/budgets.clj
+++ src/clj_money/web/budgets.clj
@@ -64,7 +64,8 @@
          [:th.text-right "Start date"]
          [:th " "]]
         (map budget-row (budgets/select-by-entity-id (env :db) entity-id))]
-       [:a.btn.btn-primary {:href (format "/entities/%s/budgets/new" entity-id)} "Add"]]])))
+       [:a.btn.btn-primary {:href (format "/entities/%s/budgets/new" entity-id)}
+        "Add"]]])))

 (defn default-start-date
   []
@@ -79,10 +80,12 @@
                                   {:value :month   :caption "Month"}
                                   {:value :quarter :caption "Quarter"}])
     (number-input-field budget :period-count)
-    (text-input-field budget :start-date {:class "date-field" :format-fn format-date})
+    (text-input-field budget :start-date {:class "date-field"
+                                          :format-fn format-date})
     [:button.btn.btn-primary {:type :submit} "Save"]
     " "
-    [:a.btn.btn-default {:href (format "/entities/%s/budgets" (:entity-id budget))} "Back"]))
+    [:a.btn.btn-default {:href (format "/entities/%s/budgets" (:entity-id budget))}
+     "Back"]))

 (defn new-budget
   ([entity-id]


Removing unused local-date fn.

Removing unused local-date fn.

--- src/cljs/hbg_crime/dates.cljs
+++ src/cljs/hbg_crime/dates.cljs
@@ -24,13 +24,6 @@
   ;; Add a day.
   (goog.date.Interval. 0 0 1))

-(defn local-date-string-from-date
-  [d]
-  (let [date (goog.date.Date. d)]
-    ;; Dear lord why does this alter a date in place
-    (.add date offset-interval)
-    (date-strftimed date)))
-
 (defn within?
   "Test whether Date d is within the range start..end"
   [d start end]


about page update

about page update

--- src/cljs/netrunner/about.cljs
+++ src/cljs/netrunner/about.cljs
@@ -12,18 +12,20 @@
      [:p "This website is created by an avid Netrunner player from Belgium. The goal is to provide a great way to create and test Netrunner decks online."]

      [:h3 "Contact"]
-     [:p "Twitter: " [:a {:href "http://twitter.com/mtgred"} "@mtgred"]]
+     [:p "Twitter: " [:a {:href "http://twitter.com/mtgred" :target "_blank"} "@mtgred"]]
      [:p "Email: " [:a {:href "mailto:mtgred@gmail.com"} "mtgred@gmail.com"]]

      [:h3 "Development"]

-     [:p "The card browser and deck builder are ready for use. The gameplay functionnalities are currently under development. " [:a {:href "https://www.dropbox.com/s/rpkhxafgile5spp/Cards%20status.xlsx"} "Card implementation status"]]
+     [:p "The card browser and deck builder are ready for use. The gameplay functionnalities are currently under development. Card automation "
+      [:a {:href "https://www.dropbox.com/s/rpkhxafgile5spp/Cards%20status.xlsx"
+           :target "_blank"} "status"] "."]

      [:p "The code is open source and available on "
-      [:a {:href "https://github.com/mtgred/netrunner"} "Github"] "."]
+      [:a {:href "https://github.com/mtgred/netrunner" :target "_blank"} "Github"] "."]

      [:p "Bug reports and feature suggestions can be submitted "
-      [:a {:href "https://github.com/mtgred/netrunner/issues"} "here"] "."]
+      [:a {:href "https://github.com/mtgred/netrunner/issues" :target "_blank"} "here"] "."]

      [:h3 "Disclaimer"]
      [:p "Netrunner and Android are trademarks of Fantasy Flight Publishing, Inc. and/or Wizards of the Coast LLC."]


Doubled standard max points setting

Doubled standard max points setting

Doubled the standard max points setting, and also updated some documentation to reflect that max genome size is now a 1/4 of max points

--- src/clojush/pushgp/pushgp.clj
+++ src/clojush/pushgp/pushgp.clj
@@ -31,7 +31,7 @@
           :population-size 1000 ;; Number of individuals in the population
           :max-generations 1001 ;; The maximum number of generations to run GP
           :max-point-evaluations 10e100 ;; The limit for the number of point (instruction) evaluations to execute during the run
-          :max-points 100 ;; Maximum size of push programs and push code, as counted by points in the program. 1/4 this limit is used as the limit for sizes of Plush genomes.
+          :max-points 200 ;; Maximum size of push programs and push code, as counted by points in the program. 1/4 this limit is used as the limit for sizes of Plush genomes.
           :max-genome-size-in-initial-program 50 ;; Maximum size of initial Plush genomes in generation 0. Keep in mind that genome lengths will otherwise be limited by 1/4 of :max-points
           :evalpush-limit 150 ;; The number of Push instructions that can be evaluated before stopping evaluation
           :evalpush-time-limit 0 ;; The time in nanoseconds that a program can evaluate before stopping, 0 means no time limit


Updating in memory instance not to start the bootstrap app.

--- src/cmr/dev_system/system.clj
+++ src/cmr/dev_system/system.clj
@@ -49,7 +49,8 @@
   ;; Memory DB configured to run in memory
   {:apps {:metadata-db (assoc (mdb-system/create-system)
                               :db (memory/create-db))
-          :bootstrap (bootstrap-system/create-system)
+
+          ;; Bootstrap is not enabled for in-memory dev system

           :indexer (indexer-system/create-system)

@@ -96,7 +97,7 @@
 (defn- stop-apps
   [system]
   (reduce (fn [system [app {stop-fn :stop}]]
-            (update-in system [:apps app] stop-fn))
+            (update-in system [:apps app] #(when % (stop-fn %))))
           system
           app-control-functions))

@@ -117,7 +118,8 @@
   (reduce (fn [system [app {start-fn :start}]]
             (update-in system [:apps app]
                        #(try
-                          (start-fn %)
+                          (when %
+                            (start-fn %))
                           (catch Exception e
                             (stop-components (stop-apps system))
                             (throw e)))))


rm println

rm println

--- src/com/kaicode/infamous.cljs
+++ src/com/kaicode/infamous.cljs
@@ -101,7 +101,6 @@
                                                       (.. component (addClass clz)))
                             (= name "depth") (.. component (setDepth value))
                             :else (do
-                                    (println "blah; " name "=" value)
                                     (.. component (setProperty name value)))))
                    component)
               (let [component (clj->js component-descriptor)]


Use more general method to get byte array class.

--- src/puget/data.clj
+++ src/puget/data.clj
@@ -133,7 +133,7 @@

 ; #bin - Binary data in the form of byte arrays.
 (extend-tagged-value
-  (Class/forName "[B") bin
+  (class (byte-array 0)) bin
   (->> this b64/encode (map char) (apply str)))


ready

ready

--- src/notifier/core.clj
+++ src/notifier/core.clj
@@ -1,12 +1,15 @@
 (ns notifier.core
   (:import [javax.crypto Mac]
            [javax.crypto.spec SecretKeySpec]
-           [java.util Base64]
-           [org.httpkit.client :as http])
-  (:require [clojure.data.json :as json])
+           [java.util Base64])
+  (:require [clojure.data.json :as json]
+            [clj-time.core :as t]
+            [chime :refer [chime-at]]
+            [clj-time.periodic :refer [periodic-seq]]
+            [org.httpkit.client :as http])
   (:gen-class))

-(def last-price (atom nil))
+(def ifttt-key (delay (System/getProperty "ifttt-key")))

 (defn sign-req [uri key body]
   (let [mac (doto (Mac/getInstance "HmacSHA512")
@@ -20,22 +23,37 @@
   (let [{:keys [status headers body error] :as resp} @(http/get "https://api.btcmarkets.net/market/BTC/AUD/tick")
         data (json/read-str body)
         last-price (data "lastPrice")]
+    (println "retrieved btc price:" status ", error:" error ", price:" last-price)
     (if error (println "failed with " error)
         last-price)))

+(defn publish-event [level price percent]
+  (let[url (str "https://maker.ifttt.com/trigger/BTC-AUD-%s/with/key/%" level @ifttt-key)
+       {:keys[status body]} (http/post url {:headers {"Content-Type:" "application/json"}
+                                            :body (json/write-str {:value1 price :value2 percent})})]
+    (println "published event:" url " result:" status ":" body)))
+
 (defn mk-price-nofifier [changes]
-  (let[last-prices (atom (into {} (for [c changes] [c (atom nil)])))]
+  (let[last-prices (atom {})]
     (fn[]
       (if-let [price (get-btc-price)]
         (doseq [c changes :let [last-price (@last-prices c)]]
-          (if @last-price
-            (let [change (@last-price (- price @last-price))]
-              (when (> change c)
-                (notify-change c price (/ change @last-price))
-                (assoc! )))
-            (reset! last-price price)))))))
+          (if-let [change (and last-price (- price last-price))]
+            (when (>= (Math/abs change) c)
+              (publish-event c price (/ change last-price))
+              (swap! last-prices assoc c price))
+            (swap! last-prices assoc c price)))))))
+
+(defn schedule []
+  (let [notifier (mk-price-nofifier [10 20 30 40 50 100])
+        times (periodic-seq (t/now) (-> 2 t/minutes))]
+    (chime-at times (fn[time]
+                      (println "chiming at " time)
+                      (notifier)))))

 (defn -main
-  "I don't do a whole lot ... yet."
+  "Starting notifier..."
   [& args]
-  (println "Hello, World!"))
+  (println "Starting notifier..")
+  (schedule)
+  (Thread/sleep (Long/MAX_VALUE)))


stable sort, and multiple keys improve sorting to drop katkolla-dudes out of olist

--- src/ontrail/group.clj
+++ src/ontrail/group.clj
@@ -98,7 +98,7 @@
     (map (fn [rank elem]
       (assoc elem :rank rank))
         ranks
-        (sort-by :resultCount > (november-race-stats-with-day day-now users)))))
+        (sort-by (juxt :resultCount :count) (fn [a b] (compare b a)) (november-race-stats-with-day day-now users)))))

 (defn fetch-group-stats [group-map]
   (let [users (:users group-map)]


fix find-by-team-and-invalid-id

fix find-by-team-and-invalid-id

--- src/pc/models/doc.clj
+++ src/pc/models/doc.clj
@@ -50,7 +50,7 @@
                   :where [[?t :document/invalid-id ?invalid-id]]}
                 db invalid-id)
            ffirst
-           (find-by-id team db)))
+           (find-by-team-and-id db team)))

 (defn find-by-invalid-id [db invalid-id]
   (some->> (d/q '{:find [?t]


api/validate-response

api/validate-response

--- src/ephemeris_api/service.clj
+++ src/ephemeris_api/service.clj
@@ -39,9 +39,9 @@
                          (api/negotiate-response)
                          (api/body-params)
                          api/common-body
-                         (api/coerce-request)]
-                         ;;(api/validate-response)]
-     ["/ephemeris" ^:interceptors [(api/doc {:tags ["ephemeris"]})]
+                         (api/coerce-request)
+                         (api/validate-response)]
+     ["/api" ^:interceptors [(api/doc {:tags ["ephemeris"]})]
       ["/utc" {:get mundane}]]]
     ["/swagger.json" {:get api/swagger-json}]
     ["/*resource" {:get api/swagger-ui}]]])


Standardize use of 'value' as canonize argument name.

--- src/puget/printer.clj
+++ src/puget/printer.clj
@@ -160,11 +160,11 @@
 ;;;;; COLLECTION TYPES ;;;;;

 (defmethod canonize clojure.lang.ISeq
-  [s]
-  (let [elements (if (symbol? (first s))
-                   (cons (color-doc :function-symbol (str (first s)))
-                         (map canonize (rest s)))
-                   (map canonize s))]
+  [value]
+  (let [elements (if (symbol? (first value))
+                   (cons (color-doc :function-symbol (str (first value)))
+                         (map canonize (rest value)))
+                   (map canonize value))]
     [:group
      (color-doc :delimiter "(")
      [:align (interpose :line elements)]
@@ -172,16 +172,16 @@

 (defmethod canonize clojure.lang.IPersistentVector
-  [v]
+  [value]
   [:group
    (color-doc :delimiter "[")
-   [:align (interpose :line (map canonize v))]
+   [:align (interpose :line (map canonize value))]
    (color-doc :delimiter "]")])

 (defmethod canonize clojure.lang.IPersistentSet
-  [s]
-  (let [entries (sort order/rank (seq s))]
+  [value]
+  (let [entries (sort order/rank (seq value))]
     [:group
      (color-doc :delimiter "#{")
      [:align (interpose :line (map canonize entries))]
@@ -189,7 +189,7 @@

 (defn- canonize-map
-  [m]
+  [value]
   (let [canonize-kv
         (fn [[k v]]
           [:span
@@ -199,7 +199,7 @@
              (coll? v) :line
              :else " ")
            (canonize v)])
-        entries (->> (seq m)
+        entries (->> (seq value)
                      (sort-by first order/rank)
                      (map canonize-kv))]
     [:group
@@ -209,17 +209,17 @@

 (defmethod canonize clojure.lang.IPersistentMap
-  [m]
-  (canonize-map m))
+  [value]
+  (canonize-map value))

 (defmethod canonize clojure.lang.IRecord
-  [record]
-  (illegal-when-strict record)
+  [value]
+  (illegal-when-strict value)
   [:span
    (color-doc :delimiter "#")
-   (.getName (class record))
-   (canonize-map record)])
+   (.getName (class value))
+   (canonize-map value)])

 (prefer-method canonize clojure.lang.IRecord clojure.lang.IPersistentMap)
@@ -235,9 +235,9 @@
 ;;;;; OTHER TYPES ;;;;;

 (defmethod canonize :tagged-value
-  [tv]
-  (let [tag   (data/edn-tag tv)
-        value (data/edn-value tv)]
+  [tagged-value]
+  (let [tag   (data/edn-tag tagged-value)
+        value (data/edn-value tagged-value)]
     [:span
      (color-doc :tag (str \# tag))
      (if (coll? value) :line " ")


make version a link to #

make version a link to #

--- src/foosball/views/layout.clj
+++ src/foosball/views/layout.clj
@@ -17,7 +17,7 @@
      [:li.divider-vertical]
      [:li (link-to "/about"         "About")]]
     [:ul.nav.pull-right
-     [:li [:small (str "Version " (:version project))]]]]])
+     [:li (link-to "#" (str "Version " (:version project)))]]]])

 (defn footer []
   [:script "$(document).ready(foosball.main.page_loaded)"])


tweak playguitar320 demo

tweak playguitar320 demo

--- src/functional_music/core.clj
+++ src/functional_music/core.clj
@@ -21,18 +21,19 @@
    string-index-2 fret-index-2 ... ]]
    "
   [interval noteseq]
-  (let [playguitar (partial guitar-pick (guitar))
-        timeseq    (range (now) (+ (now) (* interval (count noteseq))) interval)]
+  (let [timeseq  (range (now) (+ (now) (* interval (count noteseq))) interval)]
     (doseq [[string-fret-seq timeval] (map vector noteseq timeseq)]
       (doseq [[string fret] string-fret-seq]
-        (playguitar string fret timeval)))))
+        (guitar-pick (guitar) string fret timeval)))))

 (def playguitar320
   (partial guitar-pick-note-sequence 320))  ;; 320ms delay between picked strings

 ;; now we can play multiple notes at the same time
 (comment
-  (playguitar320 [[[0 3] [3 0] [4 0] [5 3]]]))
+  (playguitar320 [[[0 3] [3 0] [4 0] [5 3]]])
+  (playguitar320 [[[0 3] [3 0]]
+                  [[4 0] [5 3]]]))


Fix missing items in schema declaration

Fix missing items in schema declaration

--- src/app/db.cljs
+++ src/app/db.cljs
@@ -2,8 +2,7 @@
   (:require [reagent.core]
             [schema.core :as s :include-macros true]))

-(def schema {
-             :controls {:dataview-visible? s/Bool
+(def schema {:controls {:dataview-visible? s/Bool
                         :import-visible? s/Bool
                         :active-list-idx s/Int}
              :player {:playstate (s/enum :running :stopped)
@@ -12,10 +11,10 @@
                       :print-timer s/Int
                       :animation-timer s/Int
                       :items-per-sec s/Num}
-             :channel [{:items [s/Str]
-                        :gain s/Num
-                        :muted? s/Bool}]
-             })
+             :channels [{:title s/Str
+                         :items [s/Str]
+                         :gain s/Num
+                         :muted? s/Bool}]})

 (def default-value


Move buttons above other components.

Move buttons above other components.

--- src/re_demo/core.cljs
+++ src/re_demo/core.cljs
@@ -36,32 +36,32 @@
 (enable-console-print!)

 (def tabs-definition
-  [ {:id ::welcome                :label "Welcome"            :panel welcome/panel}
-    {:id ::checkbox               :label "Checkbox"           :panel checkbox/panel}
-    {:id ::radio-button           :label "Radio Button"       :panel radio-button/panel}
-    {:id ::input-text             :label "Input Text"         :panel input-text/panel}
-    {:id ::slider                 :label "Slider"             :panel slider/panel}
-    {:id ::button                 :label "Button"             :panel button/panel}
-    {:id ::md-circle-icon-button  :label "Circle Icon Button" :panel md-circle-icon-button/panel}
-    {:id ::md-icon-button         :label "Icon Button"        :panel md-icon-button/panel}
-    {:id ::info-button            :label "Info Button"        :panel info-button/panel}
-    {:id ::row-button             :label "Row Button"         :panel row-button/panel}
-    {:id ::hyperlink              :label "Hyperlink"          :panel hyperlink/panel}
-    {:id ::hyperlink-href         :label "Hyperlink (href)"   :panel hyperlink-href/panel}
-    {:id ::dropdown               :label "Dropdowns"          :panel dropdowns/panel}
-    {:id ::alert-box              :label "Alert Box"          :panel alert-box/panel}
-    {:id ::alert-list             :label "Alert List"         :panel alert-list/panel}
-    {:id ::tabs                   :label "Tabs"               :panel tabs/panel}
-    {:id ::popovers               :label "Popovers"           :panel popovers/panel}
-    {:id ::date                   :label "Dates"              :panel date-picker/panel}
-    {:id ::time                   :label "Time"               :panel time/panel}
-    {:id ::lists                  :label "List"               :panel lists/panel}
-    {:id ::tour                   :label "Tour"               :panel tour/panel}
-    {:id ::modals                 :label "Modals"             :panel modals/panel}
-    {:id ::boxes1                 :label "Boxes-1"            :panel boxes/panelA}
-    {:id ::boxes2                 :label "Boxes-2"            :panel boxes/panelB}
-    {:id ::layouts                :label "Layouts"            :panel layouts/panel}
-    ])
+  [{:id ::button                 :label "Button"             :panel button/panel}
+   {:id ::md-circle-icon-button  :label "Circle Icon Button" :panel md-circle-icon-button/panel}
+   {:id ::md-icon-button         :label "Icon Button"        :panel md-icon-button/panel}
+   {:id ::info-button            :label "Info Button"        :panel info-button/panel}
+   {:id ::row-button             :label "Row Button"         :panel row-button/panel}
+   {:id ::hyperlink              :label "Hyperlink"          :panel hyperlink/panel}
+   {:id ::hyperlink-href         :label "Hyperlink (href)"   :panel hyperlink-href/panel}
+   {:id ::welcome                :label "Welcome"            :panel welcome/panel}
+   {:id ::checkbox               :label "Checkbox"           :panel checkbox/panel}
+   {:id ::radio-button           :label "Radio Button"       :panel radio-button/panel}
+   {:id ::input-text             :label "Input Text"         :panel input-text/panel}
+   {:id ::slider                 :label "Slider"             :panel slider/panel}
+   {:id ::dropdown               :label "Dropdowns"          :panel dropdowns/panel}
+   {:id ::alert-box              :label "Alert Box"          :panel alert-box/panel}
+   {:id ::alert-list             :label "Alert List"         :panel alert-list/panel}
+   {:id ::tabs                   :label "Tabs"               :panel tabs/panel}
+   {:id ::popovers               :label "Popovers"           :panel popovers/panel}
+   {:id ::date                   :label "Dates"              :panel date-picker/panel}
+   {:id ::time                   :label "Time"               :panel time/panel}
+   {:id ::lists                  :label "List"               :panel lists/panel}
+   {:id ::tour                   :label "Tour"               :panel tour/panel}
+   {:id ::modals                 :label "Modals"             :panel modals/panel}
+   {:id ::boxes1                 :label "Boxes-1"            :panel boxes/panelA}
+   {:id ::boxes2                 :label "Boxes-2"            :panel boxes/panelB}
+   {:id ::layouts                :label "Layouts"            :panel layouts/panel}
+   ])

 (defn nav-item


Stop if-ns from being so damned vocal.

Stop if-ns from being so damned vocal.

--- src/cake/utils/useful.clj
+++ src/cake/utils/useful.clj
@@ -72,7 +72,8 @@
   `(try (ns ~(.getName *ns*) ~ns-reference)
         (eval '~then-form)
         (catch Exception e#
-          (when (not (instance? java.io.FileNotFoundException e#))
+          (when-not (or (instance? java.io.FileNotFoundException e#)
+                        (instance? ClassNotFoundException e#))
             (println "Error loading" '~ns-reference (.getMessage e#)))
           (eval '~else-form))))


plugging the hole with trying to play an invalid card

--- src/cartagena/console.clj
+++ src/cartagena/console.clj
@@ -26,16 +26,17 @@
     (println "Your cards are:" cards)
     (println "Which card? " (first cards) "is default")
     (let [card (keyword (str/replace (get-input (name (first cards))) #":" ""))]
-      (println "Your pirates are on:" pirates)
-      (println "Which pirate? " (first pirates) "is default")
-      (let [pirate-index (read-string (get-input (str (first pirates))))
-            from-space (get (:board game-state) pirate-index)
-            board (:board game-state)
-            discard-pile (:discard-pile game-state)
-            updated-state (engine/play-card player card from-space board discard-pile)]
-        (assoc game-state :board (:board updated-state)
-                          :discard-pile (:discard-pile updated-state)
-                          :players (conj (remove #{player} (:players game-state)) (:player updated-state)))))))
+      (when (get (set engine/icons) card)
+        (println "Your pirates are on:" pirates)
+        (println "Which pirate? " (first pirates) "is default")
+        (let [pirate-index (read-string (get-input (str (first pirates))))
+              from-space (get (:board game-state) pirate-index)
+              board (:board game-state)
+              discard-pile (:discard-pile game-state)
+              updated-state (engine/play-card player card from-space board discard-pile)]
+          (assoc game-state :board (:board updated-state)
+                            :discard-pile (:discard-pile updated-state)
+                            :players (conj (remove #{player} (:players game-state)) (:player updated-state))))))))

 (defn prompt-move-back
   "Display move options for current player, capture input, perform action"
@@ -60,6 +61,7 @@
   "Takes no active action; returns the game state as-is"
   [game-state]
   game-state)
+
 (declare prompt-action)

 (defn perform-action


Use known cljc.java-time function rather than reflection

--- src/tick/core.cljc
+++ src/tick/core.cljc
@@ -859,10 +859,10 @@
 (extend-type LocalDate
   ITimeRangeable
   (range
-    ([from] (iterate #(.plusDays % 1) from))
-    ([from to] (cond->> (iterate #(.plusDays % 1) from)
+    ([from] (iterate #(cljc.java-time.local-date/plus-days % 1) from))
+    ([from to] (cond->> (iterate #(cljc.java-time.local-date/plus-days % 1) from)
                  to (take-while #(< % to))))
-    ([from to step] (cond->> (iterate #(.plus % step) from)
+    ([from to step] (cond->> (iterate #(cljc.java-time.local-date/plus % step) from)
                       to (take-while #(< % to))))))

 (defn inc [t] (forward-number t 1))


bind only required events

bind only required events

--- src/chessground/drag.cljs
+++ src/chessground/drag.cljs
@@ -56,12 +56,14 @@

 (defn did-update [this prev-state]
   (if (and (-> this .-state (aget "drag-rel")) (not (aget prev-state "drag-rel")))
-    (do (.addEventListener js/document "mousemove" (aget this "onMouseMove"))
-        (.addEventListener js/document "touchmove" (aget this "onTouchMove"))
-        (.addEventListener js/document "mouseup" (aget this "onMouseUp"))
-        (.addEventListener js/document "touchend" (aget this "onTouchEnd")))
+    (if touch-device?
+      (do (.addEventListener js/document "touchmove" (aget this "onTouchMove"))
+          (.addEventListener js/document "touchend" (aget this "onTouchEnd")))
+      (do (.addEventListener js/document "mousemove" (aget this "onMouseMove"))
+          (.addEventListener js/document "mouseup" (aget this "onMouseUp"))))
     (when (and (not (-> this .-state (aget "drag-rel"))) (aget prev-state "drag-rel"))
-      (.removeEventListener js/document "mousemove" (aget this "onMouseMove"))
-      (.removeEventListener js/document "touchmove" (aget this "onTouchMove"))
-      (.removeEventListener js/document "mouseup" (aget this "onMouseUp"))
-      (.removeEventListener js/document "touchend" (aget this "onTouchEnd")))))
+      (if touch-device?
+        (do (.removeEventListener js/document "touchmove" (aget this "onTouchMove"))
+            (.removeEventListener js/document "touchend" (aget this "onTouchEnd")))
+        (do (.removeEventListener js/document "mousemove" (aget this "onMouseMove"))
+            (.removeEventListener js/document "mouseup" (aget this "onMouseUp")))))))


simplify `cljs.analyzer/parse-ns` compilation environment
restoration.

Just use `binding` to do it.

Throw if `parse-ns` called on something that does not supply
an ns form.

--- src/clj/cljs/analyzer.clj
+++ src/clj/cljs/analyzer.clj
@@ -2029,9 +2029,10 @@
       (let [src (if (symbol? src)
                   (io/resource (util/ns->relpath src))
                   src)
-            namespaces' (::namespaces @env/*compiler*)
-            ret
-            (binding [*cljs-ns* 'cljs.user
+            compiler-env @env/*compiler*
+            [ijs compiler-env']
+            (binding [env/*compiler* (atom compiler-env)
+                      *cljs-ns* 'cljs.user
                       *macro-infer*
                       (or (when (contains? opts :macro-infer)
                             (:macro-infer opts))
@@ -2053,26 +2054,27 @@
                         (let [ns-name (:name ast)
                               deps (merge (:uses ast) (:requires ast))]
                           (.close ^Reader rdr)
-                          (merge
-                            {:ns (or ns-name 'cljs.user)
-                             :provides [ns-name]
-                             :requires (if (= ns-name 'cljs.core)
-                                         (set (vals deps))
-                                         (cond-> (conj (set (vals deps)) 'cljs.core)
-                                           (get-in @env/*compiler* [:opts :emit-constants])
-                                           (conj 'constants-table)))
-                             :file dest
-                             :source-file src
-                             :ast ast}
-                            (when (and dest (.exists ^File dest))
-                              {:lines (with-open [reader (io/reader dest)]
-                                        (-> reader line-seq count))})))
-                        (recur (rest forms))))))))]
-        ;; TODO this _was_ a reset! of the old namespaces atom; should we capture and
-        ;; then restore the entirety of env/*compiler* here instead?
-        (when-not (false? (:restore opts))
-          (swap! env/*compiler* assoc ::namespaces namespaces'))
-        ret))))
+                          [(merge
+                             {:ns (or ns-name 'cljs.user)
+                              :provides [ns-name]
+                              :requires (if (= ns-name 'cljs.core)
+                                          (set (vals deps))
+                                          (cond-> (conj (set (vals deps)) 'cljs.core)
+                                            (get-in compiler-env [:opts :emit-constants])
+                                            (conj 'constants-table)))
+                              :file dest
+                              :source-file src
+                              :ast ast}
+                             (when (and dest (.exists ^File dest))
+                               {:lines (with-open [reader (io/reader dest)]
+                                         (-> reader line-seq count))}))
+                           @env/*compiler*])
+                        (recur (rest forms))))
+                    (throw (AssertionError. (str "No ns form found in " src)))))))]
+        (when (false? (:restore opts))
+          (swap! env/*compiler* update-in [::namespaces] merge
+            (get compiler-env' ::namespaces)))
+        ijs))))

 (defn cache-file
   "Given a ClojureScript source file returns the read/write path to the analysis


add corresponding optimization to if emission for falsey constants

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -363,6 +363,10 @@
        (not (or (and (string? form) (= form ""))
                 (and (number? form) (zero? form))))))

+(defn falsey-constant? [{:keys [op form]}]
+  (and (= op :constant)
+       (or (false? form) (nil? form))))
+
 (defn safe-test? [env e]
   (let [tag (ana/infer-tag env e)]
     (or (#{'boolean 'seq} tag) (truthy-constant? e))))
@@ -371,8 +375,10 @@
   [{:keys [test then else env unchecked]}]
   (let [context (:context env)
         checked (not (or unchecked (safe-test? env test)))]
-    (if (truthy-constant? test)
-      (emitln then)
+    (cond
+      (truthy-constant? test) (emitln then)
+      (falsey-constant? test) (emitln else)
+      :else
       (if (= :expr context)
         (emits "(" (when checked "cljs.core.truth_") "(" test ")?" then ":" else ")")
         (do


CLJS-356: make cljs.reader errors conform to Clojure JVM.

--- src/cljs/cljs/reader.cljs
+++ src/cljs/cljs/reader.cljs
@@ -234,7 +234,7 @@
   [delim rdr recursive?]
   (loop [a (transient [])]
     (let [ch (read-past whitespace? rdr)]
-      (when-not ch (reader-error rdr "EOF"))
+      (when-not ch (reader-error rdr "EOF while reading"))
       (if (identical? delim ch)
         (persistent! a)
         (if-let [macrofn (macros ch)]
@@ -303,7 +303,7 @@
   (loop [buffer (gstring/StringBuffer.)
          ch (read-char reader)]
     (cond
-     (nil? ch) (reader-error reader "EOF while reading string")
+     (nil? ch) (reader-error reader "EOF while reading")
      (identical? "\\" ch) (recur (do (.append buffer (escape-char buffer reader)) buffer)
                         (read-char reader))
      (identical? \" ch) (. buffer (toString))
@@ -418,7 +418,7 @@
   [reader eof-is-error sentinel is-recursive]
   (let [ch (read-char reader)]
     (cond
-     (nil? ch) (if eof-is-error (reader-error reader "EOF") sentinel)
+     (nil? ch) (if eof-is-error (reader-error reader "EOF while reading") sentinel)
      (whitespace? ch) (recur reader eof-is-error sentinel is-recursive)
      (comment-prefix? ch) (recur (read-comment reader ch) eof-is-error sentinel is-recursive)
      :else (let [f (macros ch)


Walk the graph datastructure more idiomatically

--- src/cljs/nchart/core.cljs
+++ src/cljs/nchart/core.cljs
@@ -39,7 +39,7 @@
   "Utility function that was abstracted to avoid mutually recursing back to add-node
   when creating helper (p, q, and r) nodes. In particular, helper nodes don't require
   character group processing or bookkeeping metadata"
-  (let [node-num (count (:nodes ((-> graph :layers) layer-id)))
+  (let [node-num (count (-> graph :layers (nth layer-id) :nodes))
         node-id (keyword (s/join "-" [layer-id node-num]))]
     (map->Node (assoc input :id node-id :layer-id layer-id))))


More cleanup.

More cleanup.

--- src/clojurecraft/core.clj
+++ src/clojurecraft/core.clj
@@ -374,53 +374,53 @@
   nil)

 (defn read-packet-handshake [conn]
-  (assoc
+  (assoc {}
     :hash (-read-string16 conn)))

 (defn read-packet-login [conn]
-  (assoc
+  (assoc {}
     :eid (-read-int conn)
     :unknown (-read-string16 conn)
     :seed (-read-long conn)
     :dimension (-read-byte conn)))

 (defn read-packet-chat [conn]
-  (assoc
+  (assoc {}
     :message (-read-string16 conn)))

 (defn read-packet-timeupdate [conn]
-  (assoc
+  (assoc {}
     :time (-read-long conn)))

 (defn read-packet-equipment [conn]
-  (assoc
+  (assoc {}
     :eid (-read-int conn)
     :slot (-read-short conn)
     :itemid (-read-short conn)
     :unknown (-read-short conn)))

 (defn read-packet-spawnposition [conn]
-  (assoc
+  (assoc {}
     :x (-read-int conn)
     :y (-read-int conn)
     :z (-read-int conn)))

 (defn read-packet-useentity [conn]
-  (assoc
+  (assoc {}
     :user (-read-int conn)
     :target (-read-int conn)
     :leftclick (-read-bool conn)))

 (defn read-packet-updatehealth [conn]
-  (assoc
+  (assoc {}
     :health (-read-short conn)))

 (defn read-packet-respawn [conn]
-  (assoc
+  (assoc {}
     :world (-read-byte conn)))

 (defn read-packet-playerpositionlook [conn]
-  (assoc
+  (assoc {}
     :x (-read-double conn)
     :stance (-read-double conn)
     :y (-read-double conn)
@@ -430,7 +430,7 @@
     :onground (-read-bool conn)))

 (defn read-packet-playerdigging [conn]
-  (assoc
+  (assoc {}
     :status (-read-byte conn)
     :x (-read-int conn)
     :y (-read-byte conn)
@@ -438,7 +438,7 @@
     :face (-read-byte conn)))

 (defn read-packet-playerblockplacement [conn]
-  (assoc
+  (assoc {}
     :x (-read-int conn)
     :y (-read-byte conn)
     :z (-read-int conn)
@@ -448,11 +448,11 @@
     :damage (-read-short conn)))

 (defn read-packet-holdingchange [conn]
-  (assoc
+  (assoc {}
     :slot (-read-short conn)))

 (defn read-packet-usebed [conn]
-  (assoc
+  (assoc {}
     :eid (-read-int conn)
     :inbed (-read-byte conn)
     :x (-read-int conn)
@@ -460,17 +460,17 @@
     :z (-read-int conn)))

 (defn read-packet-animate [conn]
-  (assoc
+  (assoc {}
     :eid (-read-int conn)
     :animate (-read-byte conn)))

 (defn read-packet-entityaction [conn]
-  (assoc
+  (assoc {}
     :eid (-read-int conn)
     :action (-read-byte conn)))

 (defn read-packet-namedentityspawn [conn]
-  (assoc
+  (assoc {}
     :eid (-read-int conn)
     :playername (-read-string16 conn)
     :x (-read-int conn)
@@ -481,11 +481,11 @@
     :currentitem (-read-short conn)))

 (defn read-packet-pickupspawn [conn]
-  (assoc
+  (assoc {}
     :eid (-read-int conn)
     :item (-read-short conn)
     :count (-read-byte conn)
-    :damagedata(-read-short conn)
+    :damagedata (-read-short conn)
     :x (-read-int conn)
     :y (-read-int conn)
     :z (-read-int conn)
@@ -494,12 +494,12 @@
     :roll (-read-byte conn)))

 (defn read-packet-collectitem [conn]
-  (assoc
+  (assoc {}
     :collectedeid (-read-int conn)
     :collectoreid (-read-int conn)))

 (defn read-packet-addobjectvehicle [conn]
-  (let [basepacket (assoc
+  (let [basepacket (assoc {}
                      :eid (-read-int conn)
                      :type (-read-byte conn)
                      :x (-read-int conn)
@@ -508,13 +508,13 @@
                      :moar (-read-int conn))]
     (if (< 0 (:moar basepacket))
       basepacket
-      (-> basepacket
+      (assoc basepacket
         :unknownx (-read-int conn)
         :unknowny (-read-int conn)
         :unknownz (-read-int conn)))))

 (defn read-packet-mobspawn [conn]
-  (assoc
+  (assoc {}
     :eid (-read-int conn)
     :type (-read-byte conn)
     :x (-read-int conn)
@@ -525,7 +525,7 @@
     :datastream (-read-metadata conn)))

 (defn read-packet-entitypainting [conn]
-  (assoc
+  (assoc {}
     :eid (-read-int conn)
     :type (-read-string16 conn)
     :x (-read-int conn)
@@ -534,7 +534,7 @@
     :direction (-read-int conn)))

 (defn read-packet-stanceupdate [conn]
-  (assoc
+  (assoc {}
     :unknown1 (-read-float conn)
     :unknown2 (-read-float conn)
     :unknown3 (-read-bool conn)
@@ -543,35 +543,35 @@
     :unknown6 (-read-float conn)))

 (defn read-packet-entityvelocity [conn]
-  (assoc
+  (assoc {}
     :eid (-read-int conn)
     :velocityx (-read-short conn)
     :velocityy (-read-short conn)
     :velocityz (-read-short conn)))

 (defn read-packet-entitydestroy [conn]
-  (assoc
+  (assoc {}
     :eid (-read-int conn)))

 (defn read-packet-entity [conn]
-  (assoc
+  (assoc {}
     :eid (-read-int conn)))

 (defn read-packet-entityrelativemove [conn]
-  (assoc
+  (assoc {}
     :eid (-read-int conn)
     :dx (-read-byte conn)
     :dy (-read-byte conn)
     :dz (-read-byte conn)))

 (defn read-packet-entitylook [conn]
-  (assoc
+  (assoc {}
     :eid (-read-int conn)
     :yaw (-read-byte conn)
     :pitch (-read-byte conn)))

 (defn read-packet-entitylookandrelativemove [conn]
-  (assoc
+  (assoc {}
     :eid (-read-int conn)
     :dx (-read-byte conn)
     :dy (-read-byte conn)
@@ -580,7 +580,7 @@
     :pitch (-read-byte conn)))

 (defn read-packet-entityteleport [conn]
-  (assoc
+  (assoc {}
     :eid (-read-int conn)
     :x (-read-int conn)
     :y (-read-int conn)
@@ -589,28 +589,28 @@
     :pitch (-read-byte conn)))

 (defn read-packet-entitystatus [conn]
-  (assoc
+  (assoc {}
     :eid (-read-int conn)
     :entitystatus (-read-byte conn)))

 (defn read-packet-attachentity [conn]
-  (assoc
+  (assoc {}
     :eid (-read-int conn)
     :vehicleid (-read-int conn)))

 (defn read-packet-entitymetadata [conn]
-  (assoc
+  (assoc {}
     :eid (-read-int conn)
     :metadata (-read-metadata conn)))

 (defn read-packet-prechunk [conn]
-  (assoc
+  (assoc {}
     :x (-read-int conn)
     :z (-read-int conn)
     :mode (-read-bool conn)))

 (defn read-packet-mapchunk [conn]
-  (let [predata (assoc
+  (let [predata (assoc {}
                   :x (-read-int conn)
                   :y (-read-short conn)
                   :z (-read-int conn)
@@ -624,7 +624,7 @@
                             (:compressedsize predata)))))

 (defn read-packet-multiblockchange [conn]
-  (assoc
+  (assoc {}
     :chunkx (-read-int conn)
     :chunkz (-read-int conn)
     :arraysize (-read-short conn)


use fifo instead of ttl for alias creation

--- src/ctia/lib/es/index.clj
+++ src/ctia/lib/es/index.clj
@@ -11,8 +11,7 @@
   (s/either clojurewerkz.elastisch.rest.Connection
             org.elasticsearch.client.transport.TransportClient))

-(def alias-create-cache-ttl-ms
-  (* 1000 60 5))
+(def alias-create-fifo-threshold 5)

 (s/defschema ESConnState
   {:index s/Str
@@ -112,12 +111,12 @@
    filter))

 (def memo-create-filtered-alias!
-  (memo/ttl create-filtered-alias!
-            :ttl/threshold
-            alias-create-cache-ttl-ms))
+  (memo/fifo create-filtered-alias!
+             :fifo/threshold
+             alias-create-fifo-threshold))

 (def memo-create-aliased-index!
-  (memo/ttl create-aliased-index!
-            :ttl/threshold
-            alias-create-cache-ttl-ms))
+  (memo/fifo create-aliased-index!
+             :fifo/threshold
+             alias-create-fifo-threshold))


Bugfix negamax (wip)

Bugfix negamax (wip)

--- src/connect5_ai/core.clj
+++ src/connect5_ai/core.clj
@@ -82,7 +82,7 @@
   ""
   [state grid-width grid-height is-first-player]
   (let [possible-moves (gen-children-points state grid-width grid-height)
-        possible-states (map #(generate-world-from-position state % is-first-player) possible-moves)]
+        possible-states (set (map #(generate-world-from-position state % is-first-player) possible-moves))]
     (reduce #(assoc %1 %2 (heuristic grid-width grid-height is-first-player %2))
             (clojure.data.priority-map/priority-map)
             possible-states)))
@@ -111,26 +111,29 @@
     [(get-value-for-state state) []]
     (if (= max-depth 0)
       [(heuristic grid-width grid-height is-first-player state) []]
-      (let [best Double/NEGATIVE_INFINITY]
         (loop [successor-states (generate-successor-states state grid-width grid-height is-first-player)
                new-alpha alpha
-               new-beta beta]
+               new-beta beta
+               best Double/NEGATIVE_INFINITY
+               best-move []]
           (if (empty? successor-states)
             (if (empty? (state true))
               [best [(long (/ grid-width 2)) (long (/ grid-height 2))]]
-              [best []])
+                [best best-move])
             (let [[successor-state _] (first successor-states)
                   [v-temp _] (negamax-inner successor-state (- new-beta) (- new-alpha) timeout (not is-first-player) (- max-depth 1) grid-width grid-height)
                   v (- v-temp)]
               (if (> v best)
-                (let [new-best v]
+                (let [new-best v
+                      _ (println (type successor-state))
+                      new-best-move (first (clojure.set/difference (set (successor-state is-first-player)) (set (state is-first-player))))]
                   (if (> new-best new-alpha)
-                    (let [ret-alpha best]
+                    (let [ret-alpha new-best]
                       (if (>= ret-alpha new-beta)
-                        [new-best (first (clojure.set/difference successor-state state))]
-                        (recur (rest successor-states) ret-alpha new-beta)))
-                    (recur (rest successor-states) new-alpha new-beta)))
-                (recur (rest successor-states) new-alpha new-beta)))))))))
+                        [new-best new-best-move]
+                        (recur (rest successor-states) ret-alpha new-beta new-best new-best-move)))
+                    (recur (rest successor-states) new-alpha new-beta new-best new-best-move)))
+                (recur (rest successor-states) new-alpha new-beta best best-move))))))))

 (defn negamax
   ""
@@ -139,7 +142,7 @@
   (let [[negamax-value move] (negamax-inner state Double/NEGATIVE_INFINITY Double/POSITIVE_INFINITY timeout is-first-player 1 grid-width grid-height)]
     (if is-first-player
       move
-      (second (negamax-inner state)))))
+      (second (negamax-inner state Double/NEGATIVE_INFINITY Double/POSITIVE_INFINITY timeout is-first-player 1 grid-width grid-height)))))

 (defn -getNextMove
   "Gets the next best move"
@@ -155,11 +158,11 @@
     ;                  is-first-player
     ;                  state
     ;                  timeout)
-    (negamax is-first-player
+    (into [] (negamax is-first-player
              state
              timeout
              grid-width
-             grid-height)))
+             grid-height))))

 (defn chantest
   []


Remember the run lengths

Remember the run lengths

--- src/constraint/core.cljs
+++ src/constraint/core.cljs
@@ -80,7 +80,10 @@
   [world-state]
   (merge world-state
          {:stats {:runs 0,
-                  :success 0}}))
+                  :success 0},
+          :length 0,
+          :lengths {:failure [],
+                    :success []}}))

 (defn toggle-button-text
@@ -131,11 +134,13 @@

 (defn reset-to-initial
-  [world-state]
-  (merge (:initial world-state)
-         {:stats (:stats world-state)}
-         {:random? (:random? world-state)}
-         {:initial (:initial world-state)}))
+  [{:keys [initial length lengths stats random?]}]
+  (merge initial
+         {:lengths lengths,
+          :length length
+          :stats stats,
+          :random? random?,
+          :initial initial}))

 (defn handle-button-click
@@ -219,18 +224,24 @@
    vals
    (some true?)))

+
+
 (defn successful-run
   [world-state]
   (let [inc-stats (partial merge-with + {:runs 1, :success 1})]
     (-> world-state
         reset-to-initial
-        (update-in [:stats] inc-stats))))
+        (update-in [:stats] inc-stats)
+        (update-in [:lengths :success] conj (:length world-state))
+        (assoc-in [:length] 0))))

 (defn unsuccessful-run
   [world-state]
   (-> world-state
       reset-to-initial
+      (update-in [:lengths :failure] conj (:length world-state))
+      (assoc-in [:length] 0)
       (update-in [:stats :runs] inc)))

 (defn move-randomly
@@ -242,7 +253,8 @@
       (if (any-target-flipped? world-state)
         (successful-run world-state)
         (if-let [m (get-random-legal-move-name world-state)]
-          (flip-update-edge m world-state)
+          (flip-update-edge m
+                            (update-in world-state [:length] inc))
           (unsuccessful-run world-state))))
     world-state))


Initial push.

Initial push.

--- src/csv_emailer/core.clj
+++ src/csv_emailer/core.clj
@@ -35,8 +35,8 @@
                                   code)}])]
     (try
       (println (str "Sending message to: " addr))
-      (email/send-message outgoing mail-info-full))
-    (catch Exception e (println "Error sending message: " (.getMessage e)))))
+      (email/send-message outgoing mail-info-full)
+    (catch Exception e (println "Error sending message: " (.getMessage e))))))

 ;; entry point for 'lein run'
 (defn -main


Fix null is not an object error for invalid URLs

Signed-off-by: Julien Eluard <c768e13f1ba4c3ebed2909a1fc1e4b50bb021a2f@gmail.com>

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

 (defn check-if-phishing-url [{:keys [history history-index] :as browser}]
   (let [history-host (http/url-host (try (nth history history-index) (catch js/Error _)))]
-    (assoc browser :unsafe? (dependencies/phishing-detect history-host))))
+    (cond-> browser history-host (assoc :unsafe? (dependencies/phishing-detect history-host)))))

 (def ipfs-proto-code "e3")
 (def swarm-proto-code "e4")


updated

updated

--- src/dbquery/databases.clj
+++ src/dbquery/databases.clj
@@ -158,20 +158,30 @@

 (defn db-meta [ds]
   (with-db-metadata [meta ds]
-    (let [tables (future (with-open [rs (.getTables meta nil (:schema ds) "%" (into-array ["TABLE" "VIEW"]))]
+    (let [tables (future (with-open [rs (.getTables meta nil (:schema ds) "%"
+                                                    (into-array ["TABLE" "VIEW"]))]
                            (read-as-map rs {:fields ["TABLE_NAME" "TABLE_TYPE"]})))
           cols (future (with-open [rs (.getColumns meta nil nil "%" "%")]
                          (-> rs
-                             (read-as-map {:fields ["TABLE_NAME" "COLUMN_NAME" "DATA_TYPE" "TYPE_NAME" "COLUMN_SIZE" "NULLABLE"]})
-                             (#(hash-map (for [e %] [(:table_name e) e] ))))))
+                             (read-as-map {:fields ["TABLE_NAME" "COLUMN_NAME"
+                                                    "DATA_TYPE" "TYPE_NAME"
+                                                    "COLUMN_SIZE" "NULLABLE"]})
+                             (#(into {} (for [e %] [(:table_name e) e] ))))))
           pkfn (fn [tbl] (with-open [rs (.getPrimaryKeys meta nil nil tbl)]
                            (read-as-map rs {:fields ["COLUMN_NAME" "KEY_SEQ"]})))
           fkfn (fn [tbl] (with-open [rs (.getImportedKeys meta nil nil tbl)]
-                           (read-as-map rs {:fields ["PKTABLE_NAME" "PKCOLUMN_NAME" "FKCOLUMN_NAME" "KEY_SEQ" "FK_NAME" "PK_NAME"]})))
-          pks (into {} (for [tbl @tables][tbl (future (pkfn tbl))]))
-          fks (into {} (for [tbl @tables][tbl (future (fkfn tbl))]))
+                           (read-as-map rs {:fields ["PKTABLE_NAME" "PKCOLUMN_NAME"
+                                                     "FKCOLUMN_NAME" "KEY_SEQ"
+                                                     "FK_NAME" "PK_NAME"]})))
+          pks (into {} (for [tbl @tables :let [tbl-name (:table_name tbl)]]
+                         [tbl-name (future (pkfn tbl-name))]))
+          fks (into {} (for [tbl @tables :let [tbl-name (:table_name tbl)]]
+                         [tbl-name (future (fkfn tbl-name))]))
           ]
-      (for [tbl @tables] (assoc :columns (merge-col-keys (@cols (:table_name tbl)) (deref (pks tbl)) (deref (fks tbl)))))
+      (doall (for [tbl @tables :let [tbl-name (:table_name tbl)]]
+               (assoc tbl :columns (merge-col-keys (@cols tbl-name)
+                                               (deref (pks tbl-name))
+                                               (deref (fks tbl-name))))))
       ))
   )


Remove js-value? - it is not used

Remove js-value? - it is not used

--- src/devtools/format.cljs
+++ src/devtools/format.cljs
@@ -34,9 +34,6 @@
     (exists? (aget value "constructor" "cljs$lang$type"))
     (catch js/Object _
       false)))
-
-(defn js-value? [value]
-  (not (cljs-value? value)))

 (defn surrogate? [value]
   (exists? (aget value surrogate-key)))


Added function for updating with date info.

--- src/dragon/post/data.clj
+++ src/dragon/post/data.clj
@@ -30,6 +30,14 @@
   [data]
   (assoc data :uri (string/replace-first (:file-dst data) "docs/" "")))

+(defn add-dates
+  [data]
+  (let [date (util/path->date (:file-src data))]
+    (-> data
+        (assoc :date date
+               :month (util/month->name (:month date))
+               :month-short (util/month->short-name (:month date))))))
+
 (defn add-post-data
   [data]
   (->> data
@@ -44,6 +52,7 @@
   (-> file-obj
       (add-post-data)
       (add-file-data)
+      (add-dates)
       (add-uri)
       (convert-body)
       (update-tags)))


Clean ns in `elfeed-cljsrn.db`

Clean ns in `elfeed-cljsrn.db`

--- src/elfeed_cljsrn/db.cljs
+++ src/elfeed_cljsrn/db.cljs
@@ -1,6 +1,5 @@
 (ns elfeed-cljsrn.db
-  (:require [cljs.spec :as s]
-            [elfeed-cljsrn.local-storage :as ls]))
+  (:require [cljs.spec :as s]))

 ;; spec of app-db


Add :excludes for clojure.core/get and set

--- src/etcd_clojure/core.clj
+++ src/etcd_clojure/core.clj
@@ -1,6 +1,7 @@
 (ns etcd-clojure.core
   (:require [clj-http.client :as client])
-  (:require [cheshire.core :refer :all]))
+  (:require [cheshire.core :refer :all])
+  (:refer-clojure :exclude [get set]))

 (def ^:private endpoint (atom "http://127.0.0.1:4001"))


Style fix for all-users page link

Style fix for all-users page link

--- src/foreclojure/users.clj
+++ src/foreclojure/users.clj
@@ -106,8 +106,7 @@
     {:title "Top 100 Users"
      :content
      (list
-      [:h1 "Top 100 Users"]
-      [:span "(or " (link-to "/users/all" "see all") ")"]
+      [:h1 "Top 100 Users" [:span {:style "font-size: 14px; font-weight: normal; margin-left: 10px;"} "[show " (link-to "/users/all" "all") "]"]]
       (format-user-ranking user-ranking)
       [:div
        [:span.contributor "*"] " "


fixed missing imports

fixed missing imports

--- cljx/plongeur-cljs/src/kierros/async.cljs
+++ cljx/plongeur-cljs/src/kierros/async.cljs
@@ -1,5 +1,5 @@
 (ns kierros.async
-  (:require [cljs.core.async :as a :refer [<! >! chan close!]])
+  (:require [cljs.core.async :as a :refer [<! >! chan close! timeout alts!]])
   (:require-macros [cljs.core.async.macros :refer [go-loop]]))

 (defn chain


azulenoids.clj: more rewriting

azulenoids.clj: more rewriting

--- clojure/org/gavrog/clojure/azulenoids.clj
+++ clojure/org/gavrog/clojure/azulenoids.clj
@@ -7,12 +7,6 @@

 (defn iterate-cycle [coll x]
   (reductions #(%2 %1) x (cycle coll)))
-
-(defn lazy-mapcat [f & colls]
-  (lazy-seq
-   (when (every? seq colls)
-     (concat (apply f (map first colls))
-             (apply lazy-mapcat f (map rest colls))))))

 (defn walk [ds D & idxs]
   (reduce #(.op ds %2 %1) D idxs))
@@ -34,10 +28,6 @@
   (let [dsx (.clone ds)]
     (do (.setVDefaultToOne dsx true) (.curvature2D dsx))))

-(defn syms-for [ds]
-  (filter #(-> %1 .curvature2D .isZero)
-          (lazy-seq (new DefineBranching2d ds 3 2 Whole/ZERO))))
-
 (def template
   (new DSymbol (str "1.1:60:"
                     "2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 "
@@ -53,10 +43,10 @@

 (def boundary-mappings
   (let [template-boundary (boundary-chambers template (Integer. 1) 0 1 2)
-        octagon-boundary (cycle (map #(Integer. %1) (range 1 17)))
-        mapping #(zipmap (drop (mod (- 19 %1) 16) octagon-boundary)
-                         (take 16 template-boundary))]
-    (map mapping (range 1 16 2))))
+        octagon-boundary (cycle (map #(Integer. %1) (range 1 17)))]
+    (for [p (range 1 16 2)]
+      (zipmap (drop (mod (- 19 p) 16) octagon-boundary)
+              (take 16 template-boundary)))))

 (defn apply-to-template [ds oct2tmp]
   (let [tmp2oct (clojure.set/map-invert oct2tmp)
@@ -69,10 +59,14 @@
         (.redefineV tmp 1 2 D (.v ds 1 2 (tmp2oct D)))))
     (-> tmp .dual .minimal .canonical)))

-(def octa-sets (filter (fn [ds] (-> ds max-curvature .isNegative not))
+(def octa-sets (filter #(-> %1 max-curvature .isNegative not)
                        (lazy-seq (new CombineTiles octagon))))

-(def octa-syms (lazy-mapcat syms-for octa-sets))
+(def octa-syms
+  (for [dset octa-sets
+        dsym (lazy-seq (new DefineBranching2d dset 3 2 Whole/ZERO))
+        :when (-> dsym .curvature2D .isZero)]
+    dsym))

 (defn azul-syms-raw []
   (for [ds octa-syms o2t boundary-mappings] (apply-to-template ds o2t)))


Add "__version__" as a meta field

Add "__version__" as a meta field

Formbuilder introduces a new metadata field in the result of the API data
endpoint called "__version__" we want to add this to our metadata fields.
We therefore now have fields containing `:name "__version__"`
being considered meta fields.

Signed-off-by: Njagi Mwaniki <b6a4ba60ad861b9c9afb6daea7294be4be68f44c@urbanslug.com>

--- src/hatti/ona/forms.cljs
+++ src/hatti/ona/forms.cljs
@@ -100,7 +100,9 @@

 (defn meta?
   [field]
-  (or (field-name-in-set? #{"meta" "instanceID"} field)
+  (or (field-name-in-set? #{"meta"
+                            "instanceID"
+                            "__version__"} field)
       (field-type-in-set? #{"deviceid"
                             "end"
                             "imei"


remove json doc generator, and keep sections one-word

--- scripts/get-symbol-metadata/src/core.clj
+++ scripts/get-symbol-metadata/src/core.clj
@@ -245,27 +245,14 @@
      (cljsdoc-section "Signature" (join "\n" (:signatures item)))
      (cljsdoc-section "Filename" (:filename item))
      (cljsdoc-section "Source" (:source item))
-     (cljsdoc-section "Github Link" (:github-link item))]))
-
-(defn make-json
-  [item]
-  (json/write-str
-    {:name (:full-name item)
-     :type (:fn-or-macro item)
-     :docstring (:docstring item)
-     :signature (map pr-str (:signatures item))
-     :filename (:filename item)
-     :source (:source item)
-     :github (:github-link item)}))
+     (cljsdoc-section "Github" (:github-link item))]))

 (defn write-item
   [item]
   (let [filename (item-filename item)
-        cljsdoc-content (make-cljsdoc item)
-        json-content (make-json item)]
+        cljsdoc-content (make-cljsdoc item)]
     (println "Writing" filename "...")
-    (spit (str filename ".cljsdoc") cljsdoc-content)
-    (spit (str filename ".json") json-content)))
+    (spit (str filename ".cljsdoc") cljsdoc-content)))

 ;;------------------------------------------------------------
 ;; Symbol Retrieval


Refactor and use ImageNumber to simplify; clean up.

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -64,7 +64,7 @@

 (defn state-assoc! [& args]
   (apply swap! state assoc args))
-
+
 (def attached-runnables (atom (vec nil)))

 (def pending-devices (atom #{}))
@@ -107,7 +107,7 @@
             (= "Default" simple-channel-name))
       camera-channel-name
       (str simple-channel-name "-" camera-channel-name))))
-
+
 ;; image metadata

 (defn generate-metadata [event state]
@@ -150,10 +150,10 @@
        "YPositionUm" y
        "ZPositionUm" (get-in state [:last-stage-positions (state :default-z-drive)])
       })))
-
+
 (defn annotate-image [img event state elapsed-time-ms]
   {:pix (:pix img)
-   :tags
+   :tags
    (merge
      (generate-metadata event state)
      (:tags img)
@@ -176,7 +176,7 @@
                        (add-to-pending ~device)
                        ~@body)]
     (when-not
-      (or
+      (or
         (successful? (attempt#)) ; first attempt
         (do (log "second attempt") (successful? (attempt#)))
         (when false
@@ -206,7 +206,7 @@

 (defn get-z-stage-position [stage]
   (if-not (empty? stage) (core getPosition stage) 0))
-
+
 (defn get-xy-stage-position [stage]
   (if-not (empty? stage)
     (let [xy (.getXYStagePosition gui)]
@@ -285,7 +285,7 @@
       (when new-seq
         (core loadPropertySequence d p (str-vector s))))
     (reset! active-property-sequences property-sequences)))
-
+
 (defn load-slice-sequence [slice-sequence relative-z]
   (when slice-sequence
     (let [z (core getFocusDevice)
@@ -303,7 +303,7 @@
   (doseq [[[d p] vals] property-sequences]
     (core startPropertySequence d p)
     (swap! state assoc-in [:last-property-settings d p] (last vals))))
-
+
 (defn start-slice-sequence [slices]
   (let [z-stage (core getFocusDevice)]
     (core startStageSequence z-stage)
@@ -322,19 +322,21 @@
     (core startSequenceAcquisition (if (first-trigger-missing?) (inc length) length) 0 true)
     (swap! state assoc-in [:last-stage-positions (core getFocusDevice)]
            (last absolute-slices))))
-
-(defn pop-burst-image [timeout-ms]
+
+(defn pop-burst-image
+  "Returns a TaggedImage from the circular buffer -- times out if no
+   image is found in circular buffer after waiting up to timeout-ms."
+  [timeout-ms]
   (let [start-time (System/currentTimeMillis)]
     (while (and (. mmc isSequenceRunning)
                 (zero? (. mmc getRemainingImageCount)))
       (if (< timeout-ms (- (System/currentTimeMillis) start-time))
         (throw (Exception. "Timed out waiting for image to arrive from camera."))
         (Thread/sleep 5))))
-  (let [md (Metadata.)
-        pix (core popNextImageMD md)
-        tags (parse-core-metadata md)]
-    {:pix pix :tags (dissoc tags "StartTime-ms")}))
-
+  (let [tagged-image (core popNextTaggedImage)]
+    {:pix (.pix tagged-image)
+     :tags (json-to-data (.tags tagged-image))}))
+
 (defn make-multicamera-channel [raw-channel-index camera-channel]
   (+ camera-channel (* (core getNumberOfCameraChannels) (or raw-channel-index 0))))

@@ -354,10 +356,60 @@
    burst-events))

 (defn burst-cleanup []
-   (when (@state :circular-buffer-overflow)
+ (when (@state :circular-buffer-overflow)
    (ReportingUtils/showError "Circular buffer overflowed."))
  (while (and (not (@state :stop)) (. mmc isSequenceRunning))
    (Thread/sleep 5)))
+
+(defn keep-collecting-from-circular-buffer?
+  "Returns true if there is no reason to stop popping images
+   from the circular buffer."
+  []
+  (when (. mmc isBufferOverflowed)
+    (swap! state assoc :circular-buffer-overflow true))
+  (and (not (@state :stop))
+       (or (pos? (. mmc getRemainingImageCount))
+           (and (. mmc isSequenceRunning)
+                (not (@state :circular-buffer-overflow))))))
+
+(defn assoc-if-nil [m k v]
+  (if (nil? (m k))
+    (assoc m k v)
+    m))
+
+(defn show [x]
+  (do (println x)
+      x))
+
+(defn tag-burst-image [image burst-events camera-channel-names camera-index-tag]
+  (swap! state assoc-if-nil :burst-time-offset
+         (- (elapsed-time @state)
+            (core-time-from-tags (image :tags))))
+  (let [cam-chan (if-let [cam-chan-str (get-in image [:tags camera-index-tag])]
+                   (Long/parseLong cam-chan-str)
+                   0)
+        image-number (Long/parseLong (get-in image [:tags "ImageNumber"]))
+        burst-event (nth burst-events image-number)
+        camera-channel-name (nth camera-channel-names cam-chan)
+        event (-> burst-event
+                  (update-in [:channel-index] make-multicamera-channel cam-chan)
+                  (update-in [:channel :name] super-channel-name camera-channel-name)
+                  (assoc :camera-channel-index cam-chan))
+        time-stamp (burst-time (:tags image) @state)]
+    (annotate-image image event @state time-stamp)))
+
+(defn produce-burst-images
+  "Pops images from circular buffer and sends them to output queue."
+  [burst-events camera-channel-names timeout-ms out-queue]
+  (let [total (* (count burst-events)
+                 (count camera-channel-names))
+        camera-index-tag (str (. mmc getCameraDevice) "-CameraChannelIndex")]
+    (doseq [i (range total) :while (keep-collecting-from-circular-buffer?)]
+      (.put out-queue
+            (-> (pop-burst-image timeout-ms)
+                (tag-burst-image burst-events camera-channel-names camera-index-tag)
+                make-TaggedImage))))
+  (burst-cleanup))

 (defn collect-burst-images [event out-queue]
   (let [pop-timeout-ms (+ 20000 (* 10 (:exposure event)))]
@@ -365,36 +417,8 @@
       (pop-burst-image pop-timeout-ms)) ; drop first image if first trigger doesn't happen
     (swap! state assoc :burst-time-offset nil)
     (let [burst-events (assign-z-offsets (event :burst-data))
-          camera-index (str (core getCameraDevice) "-CameraChannelIndex")
-          camera-channel-count (core getNumberOfCameraChannels)
-          bursts-per-camera-channel (vec (repeat camera-channel-count burst-events))
           camera-channel-names (get-camera-channel-names)]
-      (doall
-        (loop [burst-seqs bursts-per-camera-channel i 0]
-          (when (core isBufferOverflowed)
-            (swap! state assoc :circular-buffer-overflow true))
-          (when (and (not (@state :stop))
-                     (not (apply = nil burst-seqs))
-                     (or (pos? (core getRemainingImageCount))
-                         (and (core isSequenceRunning)
-                              (not (@state :circular-buffer-overflow)))))
-            (let [image (pop-burst-image pop-timeout-ms)
-                  cam-chan (if-let [cam-chan-str (get-in image [:tags camera-index])]
-                             (Long/parseLong cam-chan-str)
-                             0)
-                  camera-channel-name (nth camera-channel-names cam-chan)
-                  event (-> (first (burst-seqs cam-chan))
-                            (update-in [:channel-index] make-multicamera-channel cam-chan)
-                            (update-in [:channel :name] super-channel-name camera-channel-name)
-                            (assoc :camera-channel-index cam-chan))]
-              (when (zero? i)
-                (swap! state assoc
-                       :burst-time-offset (- (elapsed-time @state)
-                                             (core-time-from-tags (image :tags)))))
-              (.put out-queue (make-TaggedImage (annotate-image image event @state
-                                                                (burst-time (:tags image) @state))))
-              (recur (update-in burst-seqs [cam-chan] next) (inc i)))))))
-    (burst-cleanup))) ;; burst is done!
+      (produce-burst-images burst-events camera-channel-names pop-timeout-ms out-queue))))

 (defn collect-snap-image [event out-queue]
   (let [image
@@ -440,7 +464,7 @@
         delta (- target-time (jvm-time-ms))]
      (when (and (< 1000 delta)
                 (@state :live-mode-on)
-                (not (.isLiveModeOn gui)))
+                (not (.isLiveModeOn gui)))
       (.enableLiveMode gui true))
     (when (pos? delta)
       (interruptible-sleep delta))
@@ -498,7 +522,8 @@
             stage-name (.stageName stage-pos)]
         (when (= 1 (.numAxes stage-pos))
           (when (z-stage-needs-adjustment stage-name)
-            (set-msp-z-position msp-index stage-name (get-z-stage-position stage-name))))))))
+            (set-msp-z-position msp-index stage-name
+                                (get-z-stage-position stage-name))))))))

 (defn recall-z-reference [current-position]
   (let [z-drive (@state :default-z-drive)]
@@ -572,7 +597,7 @@
                            (ReportingUtils/showError t "Acquisition cleanup failed.")))))

 ;; running events
-
+
 (defn make-event-fns [event out-queue]
   (let [current-position (:position event)
         z-drive (@state :default-z-drive)
@@ -585,7 +610,8 @@
         (list
           #(log event)
           (when (:new-position event)
-            (for [[axis pos] (:axes (MultiStagePosition-to-map (get-msp current-position)))
+            (for [[axis pos] (:axes (MultiStagePosition-to-map
+                                      (get-msp current-position)))
                   :when pos]
               #(apply set-stage-position axis pos)))
           (for [prop (get-in event [:channel :properties])]
@@ -660,7 +686,8 @@
               :customIntervalsMs       :custom-intervals-ms
               )
             (assoc :frames (range (.numFrames settings))
-                   :channels (vec (filter :use-channel (map ChannelSpec-to-map (.channels settings))))
+                   :channels (vec (filter :use-channel
+                                          (map ChannelSpec-to-map (.channels settings))))
                    :positions (vec (range (.. settings positions size)))
                    :slices (vec (.slices settings))
                    :default-exposure (core getExposure)
@@ -685,27 +712,31 @@
     (let [n (long (core getNumberOfComponents))]
       (set-property default-cam)
       (get {1 1 , 4 3} n))))
-
+
 (defn super-channels [simple-channel camera-channel-names]
   (if (< 1 (count camera-channel-names))
-    (map #(update-in simple-channel [:name] super-channel-name %) camera-channel-names)
-    simple-channel))
+    (map #(update-in simple-channel [:name] super-channel-name %)
+         camera-channel-names)
+    simple-channel))

 (defn all-super-channels [simple-channels camera-channel-names]
   (flatten (map #(super-channels % camera-channel-names) simple-channels)))

 (defn channel-colors [simple-channels super-channels channel-names]
   (if (= (count simple-channels) (count super-channels))
-    (map #(.getRGB (:color %)) super-channels)
+    (map #(.getRGB (:color %)) super-channels)
     (map #(. MMAcquisition getMultiCamDefaultChannelColor % (channel-names %))
-         (range (count super-channels)))))
-
+         (range (count super-channels)))))
+
 (defn make-summary-metadata [settings]
   (let [depth (core getBytesPerPixel)
         channels (:channels settings)
         num-camera-channels (core getNumberOfCameraChannels)
-        simple-channels (if-not (empty? channels) channels [{:name "Default" :color java.awt.Color/WHITE}])
-        super-channels (all-super-channels simple-channels (get-camera-channel-names))
+        simple-channels (if-not (empty? channels)
+                          channels
+                          [{:name "Default" :color java.awt.Color/WHITE}])
+        super-channels (all-super-channels simple-channels
+                                           (get-camera-channel-names))
         ch-names (vec (map :name super-channels))]
      (JSONObject. {
       "BitDepth" (core getImageBitDepth)
@@ -757,9 +788,9 @@
   (select-values-match?
     @current-album-tags
     image-tags
-    ["Width" "Height" "PixelType"]))
-
-(defn initialize-display-ranges [window]
+    ["Width" "Height" "PixelType"]))
+
+(defn initialize-display-ranges [window]
   (do (.setChannelDisplayRange window 0 0 256)
       (.setChannelDisplayRange window 1 0 256)
       (.setChannelDisplayRange window 2 0 256)))
@@ -783,7 +814,8 @@
   (core snapImage)
   (let [events (make-multicamera-events (create-basic-event))]
     (for [event events]
-      (annotate-image (collect-snap-image event nil) event (create-basic-state) nil))))
+      (annotate-image (collect-snap-image event nil) event
+                      (create-basic-state) nil))))

 (defn add-to-album []
   (doseq [img (acquire-tagged-images)]
@@ -868,7 +900,7 @@
                  :when (not (neg? v))]
             [k v]))]
     (swap! attached-runnables conj [template runnable])))
-
+
 (defn -clearRunnables [this]
   (reset! attached-runnables (vec nil)))

@@ -892,4 +924,3 @@
 (defn stop []
   (when-let [acq-thread (:acq-thread (.state last-acq))]
     (.stop acq-thread)))
-


Refactor

Refactor

--- backend/src/akvo/lumen/lib/update.clj
+++ backend/src/akvo/lumen/lib/update.clj
@@ -17,20 +17,15 @@
 (hugsql/def-db-fns "akvo/lumen/lib/transformation.sql")
 (hugsql/def-db-fns "akvo/lumen/lib/dataset.sql")

-(defn columns-used-in-txs [initial-dataset-version latest-dataset-version]
-  (log/debug :columns (walk/keywordize-keys (:columns initial-dataset-version)))
-  (log/debug :all-txs (walk/keywordize-keys (:transformations latest-dataset-version)))
-  (let [res (loop [columns (-> initial-dataset-version :columns walk/keywordize-keys)
-                   txs (-> latest-dataset-version :transformations walk/keywordize-keys)
-                   cols0 #{}]
-              (let [tx (first txs)
-                    cols1 (apply  conj cols0 (engine/columns-used (first txs) columns))]
-                (if-let [txs (seq (next txs))]
-                  (recur (engine/undif-columns tx columns) txs cols1)
-                  cols1))
-              )]
-    (log/error :YUPIE res)
-    res))
+(defn- columns-used-in-txs [initial-dataset-version latest-dataset-version]
+  (loop [columns (-> initial-dataset-version :columns walk/keywordize-keys)
+         txs (-> latest-dataset-version :transformations walk/keywordize-keys)
+         cols0 #{}]
+    (let [tx (first txs)
+          cols1 (apply  conj cols0 (engine/columns-used (first txs) columns))]
+      (if-let [txs (seq (next txs))]
+        (recur (engine/undif-columns tx columns) txs cols1)
+        cols1))))

 (defn- successful-update
   "On a successful update we need to create a new dataset-version that
@@ -177,7 +172,3 @@
            (p/track error-tracker e)
            (log/error e))))
      (lib/ok {"updateId" job-execution-id}))))
-
-
-
-