remove private qualifier from sessions things

--- src/shale/sessions.clj
+++ src/shale/sessions.clj
@@ -29,16 +29,16 @@
 (defn session-tags-key [session-id]
   (format session-tags-key-template session-id))

-(defn ^:private is-ip? [s]
+(defn is-ip? [s]
   (re-matches #"(?:\d{1,3}\.){3}\d{1,3}" s))

-(def ^:private Node
+(def Node
   "A schema for a node spec."
   {(s/optional-key :url)   s/Str
    (s/optional-key :id)    s/Str
    (s/optional-key :tags) [s/Str]})

-(def ^:private Session
+(def Session
   "A schema for a session spec."
   {:id                            s/Str
    (s/optional-key :tags)        [s/Str]
@@ -47,7 +47,7 @@
    (s/optional-key :browser-name) s/Str
    (s/optional-key :node)         Node})

-(def ^:private Requirement
+(def Requirement
   "A schema for a session requirement."
   (s/either
     (s/pair :session-tag  "type"  s/Str        "tag")
@@ -61,14 +61,14 @@
     (s/pair :and          "type" [Requirement] "requirements")
     (s/pair :or           "type" [Requirement] "requirements")))

-(defn ^:private maybe-bigdec [x]
+(defn maybe-bigdec [x]
   (try (bigdec x) (catch NumberFormatException e nil)))

-(def ^:private DecString
+(def DecString
   "A schema for a string that is convertable to bigdec."
   (s/pred #(boolean (maybe-bigdec %)) 'decimal-string))

-(def ^:private Score
+(def Score
   "A schema for a session score rule."
   {:weight  DecString
    :require Requirement})
@@ -95,7 +95,7 @@
   (let [u (if (string? url) (uri/uri url) url)]
     (assoc u :host (resolve-host (uri/host u)))))

-(defn ^:private matches-requirements [session-model requirements]
+(defn matches-requirements [session-model requirements]
   (let [exact-match-keys [:browser-name :reserved]
         resolved-nodes (map (comp str host-resolved-url)
                             (filter identity


Show menus

Show menus

--- src/varjocafe/view.clj
+++ src/varjocafe/view.clj
@@ -6,16 +6,24 @@
                [date]
                [[:.date]] (en/content (str date)))

+(en/defsnippet menu-cell "templates/layout.html" [:.menu]
+               [restaurant date]
+               [[:.menu]] (en/content (->> (get-in restaurant [:menu date :data])
+                                           (map :name)
+                                           (clojure.string/join ", "))))
+
 (en/defsnippet restaurant-row "templates/layout.html" [:.restaurant-row]
-               [restaurant]
+               [restaurant dates]
                [[:.restaurant-name]] (en/content (:name restaurant))
-               [[:.menu]] (en/content (first (vals (:menu restaurant)))))
+               [[:.menu]] (en/substitute (map #(menu-cell restaurant %) dates)))

 (en/deftemplate layout "templates/layout.html"
-                [{:keys [data]}]
-                [:.date] (en/substitute (map #(date-cell %) (core/dates data)))
-                [:.restaurant-row] (en/substitute (map #(restaurant-row %) (vals data)))
+                [{:keys [data dates]}]
+                [:.date] (en/substitute (map #(date-cell %) dates))
+                [:.restaurant-row] (en/substitute (map #(restaurant-row % dates)
+                                                       (vals data)))
                 [:#data-dump] (en/content data))

 (defn main-page [data]
-  (layout {:data data}))
+  (layout {:data  data
+           :dates (take 5 (core/dates data))}))


Refactored

Refactored

--- src/varjocafe/view.clj
+++ src/varjocafe/view.clj
@@ -2,6 +2,9 @@
   (:require [net.cgrand.enlive-html :as html]
             [varjocafe.core :as core]
             [varjocafe.format :as format]))
+
+(defn refine [selector transformation]
+  (fn [nodes] (html/at nodes selector transformation)))

 (html/defsnippet date-cell "templates/layout.html" [:.date-column]
                  [date today]
@@ -13,11 +16,11 @@

 (html/defsnippet food-line "templates/layout.html" [:.food]
                  [food]
-                 [:.allergens] (if (empty? (format/allergens food))
-                                 nil
-                                 identity)
-                 [:.food html/any-node] (html/replace-vars {:food      (:name food)
-                                                            :allergens (format/allergens food)})
+                 [:.allergens] (let [allergens (format/allergens food)]
+                                 (if (empty? allergens)
+                                   nil
+                                   (refine [html/any-node] (html/replace-vars {:allergens allergens}))))
+                 [:.food html/any-node] (html/replace-vars {:food (:name food)})
                  [:.food] (html/after "\n            "))

 (html/defsnippet menu-cell "templates/layout.html" [:.restaurant-row.expanded :.menu]


generate-code now takes a number instea dof a map

--- src/wishlistd/code.clj
+++ src/wishlistd/code.clj
@@ -2,7 +2,7 @@

 (def letters ["A","B","C","D","E","F","G","H","I","J","K"])

-(defn generate-code [{:keys [id]}]
+(defn generate-code [id]
   (apply str
     (map
       (comp


maching latest instance changes

maching latest instance changes

--- test/celestial/features/gce.clj
+++ test/celestial/features/gce.clj
@@ -10,10 +10,10 @@
   (:use midje.sweet)
  )

-(with-conf
+(with-conf local-conf
   (let [{:keys [machine gce]} redis-gce]
     (fact "legal gce system" :gce
-      (:spec (vconstruct redis-gce)) =>
+      (:gce (vconstruct redis-gce)) =>
          (contains {:machineType  "zones/europe-west1-d/machineTypes/n1-standard-1"}))))

 #_(with-admin


Add a more robust wait-for-step-waiting

Add a more robust wait-for-step-waiting

--- test/lambdacd_git/core_test.clj
+++ test/lambdacd_git/core_test.clj
@@ -22,6 +22,12 @@
     (async/pipe step-result-updates-ch only-status-updates)
     only-status-updates))

+(defn- clear-channel [ch]
+  (loop []
+    (let [[v _] (async/alts!! [ch] :default :finished)]
+      (when (not= :finished v)
+        (recur)))))
+
 (defn- init-state []
   (let [is-killed (atom false)
         ctx (some-ctx-with :is-killed is-killed)
@@ -69,19 +75,19 @@

 (defn wait-for-step-waiting [state]
   (let [step-status-ch (:step-status-channel @state)
-        result-ch      (:result-channel @state)
         result         (read-channel-or-time-out
                          (async/go
                            (loop []
-                             (let [[status ch] (async/alts! [step-status-ch result-ch])]
-                               (cond (= ch result-ch) (Exception. (str "Step already finished! " status))
-                                     (not= :waiting status) (recur)
-                                     :default nil)))))]
+                             (let [status (async/<! step-status-ch)]
+                               (if (not= :waiting status)
+                                 (recur)
+                                 nil)))))]
     (when (instance? Exception result)
       (throw result)))
   state)

 (defn execute-pipeline-step [state step]
+  (clear-channel (:step-status-channel @state))
   (let [future (future
                  (let [execute-step-result (lambdacd-core/execute-step {} (:ctx @state)
                                                                        step)]
@@ -89,10 +95,14 @@
     (swap! state #(assoc % :step-future future))
     state))

-(defn start-wait-for-git-step [state & {:keys [ref ms-between-polls] :or {ms-between-polls 100
-                                                                          ref              "refs/heads/master"}}]
+(defn start-wait-for-git-step [state & {:keys [ref ms-between-polls wait] :or {ms-between-polls 100
+                                                                          ref              "refs/heads/master"
+                                                                               wait true}}]
   (execute-pipeline-step state (fn [_ ctx]
-                                 (wait-for-git ctx (get-in @state [:git :remote]) :ref ref :ms-between-polls ms-between-polls))))
+                                 (wait-for-git ctx (get-in @state [:git :remote]) :ref ref :ms-between-polls ms-between-polls)))
+  (when wait
+    (wait-for-step-waiting state))
+  state)

 (defn start-clone-step [state ref cwd]
@@ -269,7 +279,7 @@
                     (wait-for-step-to-complete)
                     (wait-for-pipeline-state-to-have-seen-commit "master" "other commit")
                     (git-commit "commit while not waiting")
-                    (start-wait-for-git-step)
+                    (start-wait-for-git-step :wait false)
                     (get-step-result))]
       (is (= :success (:status (step-result state))))
       (is (= (commit-hash-by-msg state "other commit") (:old-revision (step-result state))))


clean up naming in test

clean up naming in test

--- test/lambdacd_git/core_test.clj
+++ test/lambdacd_git/core_test.clj
@@ -41,7 +41,7 @@
                                                                                (fn [args ctx]
                                                                                (wait-for-git ctx (get-in @state [:git :remote]) "master" :ms-between-polls 100)))]
                                     (first (vals (:outputs execute-step-result)))))]
-    (swap! state #(assoc % :wait-for-result-channel wait-for-result-channel))
+    (swap! state #(assoc % :result-channel wait-for-result-channel))
     state))

 (defn start-clone-step [state ref cwd]
@@ -50,7 +50,7 @@
                                                                                (fn [args ctx]
                                                                                (clone ctx (get-in @state [:git :remote]) ref cwd)))]
                                     (first (vals (:outputs execute-step-result)))))]
-    (swap! state #(assoc % :wait-for-result-channel wait-for-result-channel))
+    (swap! state #(assoc % :result-channel wait-for-result-channel))
     state))

 (defn read-channel-or-time-out [c & {:keys [timeout]
@@ -65,8 +65,8 @@

 (defn get-step-result [state]
   (try
-    (let [result (read-channel-or-time-out (:wait-for-result-channel @state))]
-      (swap! state #(assoc % :wait-for-git-result result))
+    (let [result (read-channel-or-time-out (:result-channel @state))]
+      (swap! state #(assoc % :step-result result))
       state)
     (catch Exception e
       (kill-waiting-step state)
@@ -83,8 +83,8 @@
 (defn commit-hash-by-msg [state msg]
   (git-utils/commit-by-msg (:git @state) msg))

-(defn wait-for-git-result [state]
-  (:wait-for-git-result @state))
+(defn step-result [state]
+  (:step-result @state))

 (deftest wait-for-git-test-clean
   (testing "that it waits for a new commit to happen and that it prints out information on old and new commit hashes"
@@ -95,10 +95,10 @@
                     (wait-a-bit)
                     (git-commit "other commit")
                     (get-step-result))]
-      (is (= :success                               (:status (wait-for-git-result state))))
-      (is (= (commit-hash-by-msg state "initial commit") (:old-revision (wait-for-git-result state))))
-      (is (= (commit-hash-by-msg state "other commit") (:revision     (wait-for-git-result state))))
-      (is (str-containing (commit-hash-by-msg state "initial commit") (:out (wait-for-git-result state))))))
+      (is (= :success (:status (step-result state))))
+      (is (= (commit-hash-by-msg state "initial commit") (:old-revision (step-result state))))
+      (is (= (commit-hash-by-msg state "other commit") (:revision     (step-result state))))
+      (is (str-containing (commit-hash-by-msg state "initial commit") (:out (step-result state))))))
   (testing "that it prints out information on old and new commit hashes"
     (let [state (-> (init-state)
                     (git-init)
@@ -107,8 +107,8 @@
                     (wait-a-bit)
                     (git-commit "other commit")
                     (get-step-result))]
-      (is (str-containing (commit-hash-by-msg state "initial commit") (:out (wait-for-git-result state))))
-      (is (str-containing (commit-hash-by-msg state "other commit") (:out (wait-for-git-result state))))))
+      (is (str-containing (commit-hash-by-msg state "initial commit") (:out (step-result state))))
+      (is (str-containing (commit-hash-by-msg state "other commit") (:out (step-result state))))))
   (testing "that waiting returns immediately when a commit happened while it was not waiting"
     (let [state (-> (init-state)
                     (git-init)
@@ -120,9 +120,9 @@
                     (git-commit "commit while not waiting")
                     (start-wait-for-git-step)
                     (get-step-result))]
-      (is (= :success                                           (:status (wait-for-git-result state))))
-      (is (= (commit-hash-by-msg state "other commit") (:old-revision (wait-for-git-result state))))
-      (is (= (commit-hash-by-msg state "commit while not waiting") (:revision     (wait-for-git-result state))))))
+      (is (= :success (:status (step-result state))))
+      (is (= (commit-hash-by-msg state "other commit") (:old-revision (step-result state))))
+      (is (= (commit-hash-by-msg state "commit while not waiting") (:revision     (step-result state))))))
   (testing "that wait-for can be killed and that the last seen revision is being kept"
     (let [state (-> (init-state)
                     (git-init)
@@ -131,8 +131,8 @@
                     (wait-a-bit)
                     (kill-waiting-step)
                     (get-step-result))]
-      (is (= :killed                                (:status (wait-for-git-result state))))
-      (is (= (commit-hash-by-msg state "initial commit") (:_git-last-seen-revision (wait-for-git-result state))))))
+      (is (= :killed (:status (step-result state))))
+      (is (= (commit-hash-by-msg state "initial commit") (:_git-last-seen-revision (step-result state))))))
   (testing "that it retries until being killed if the repository cannot be reached"
     (let [state (-> (init-state)
                     (set-git-remote "some-uri-that-doesnt-exist")
@@ -140,7 +140,7 @@
                     (wait-a-bit)
                     (kill-waiting-step)
                     (get-step-result))]
-      (is (= :killed (:status (wait-for-git-result state))))))
+      (is (= :killed (:status (step-result state))))))
   (testing "that it prints out errors if a repository can't be reached"
     (let [state (-> (init-state)
                     (set-git-remote "some-uri-that-doesnt-exist")
@@ -148,7 +148,7 @@
                     (wait-a-bit)
                     (kill-waiting-step)
                     (get-step-result))]
-      (is (str-containing "some-uri-that-doesnt-exist" (:out (wait-for-git-result state)))))))
+      (is (str-containing "some-uri-that-doesnt-exist" (:out (step-result state)))))))

 (deftest clone-test
   (testing "that we can clone a specific commit"
@@ -162,7 +162,7 @@
           (git-commit "second commit")
           (start-clone-step (commit-hash-by-msg state "first commit") workspace)
           (get-step-result))
-      (is (= :success (:status (wait-for-git-result state))))
+      (is (= :success (:status (step-result state))))
       (is (= "some content"
              (slurp (io/file workspace "some-file"))))))
   (testing "that we can get information on the progress of a clone"
@@ -174,7 +174,7 @@
           (git-commit "some commit")
           (start-clone-step (commit-hash-by-msg state "some commit") workspace)
           (get-step-result))
-      (is (str-containing "Receiving" (:out (wait-for-git-result state))))))
+      (is (str-containing "Receiving" (:out (step-result state))))))
   (testing "that we get a proper error if a commit cant be found"
     (let [state (init-state)
           workspace (util/create-temp-dir)]
@@ -184,5 +184,5 @@
           (git-commit "some commit")
           (start-clone-step "some-ref" workspace)
           (get-step-result))
-      (is (= :failure (:status (wait-for-git-result state))))
-      (is (str-containing "Could not find ref some-ref" (:out (wait-for-git-result state)))))))+      (is (= :failure (:status (step-result state))))
+      (is (str-containing "Could not find ref some-ref" (:out (step-result state)))))))


Add CTA to bottom of changelog

Add CTA to bottom of changelog

--- src-cljs/frontend/components/changelog.cljs
+++ src-cljs/frontend/components/changelog.cljs
@@ -58,5 +58,11 @@
                             (:name team-member)]))]
                   [:p.description {:dangerouslySetInnerHTML #js {"__html" (:description entry)}}]]]])]
             (when show-id
-              [:a {:href "/changelog"} "View Full Changelog"])]]])))))
+              [:a {:href "/changelog"} "View Full Changelog"])]]
+          [:div.bottom-cta.outer-section.outer-section-condensed
+           common/language-background
+           [:h2 "Start shipping faster, build for free using CircleCI today."]
+           [:p.subheader "You have a product to focus on, let CircleCI handle your continuous integration and deployment."]
+           (common/sign-up-cta owner "changelog")
+           ]])))))


add pager node

add pager node

--- examples/lesson-carousel-starter-kit/src/carousel/core.cljs
+++ examples/lesson-carousel-starter-kit/src/carousel/core.cljs
@@ -1,8 +1,8 @@
 (ns ^:figwheel-always carousel.core
-    (:require-macros [cljs.core.async.macros :refer [go]])
-    (:require [com.famous.Famous]
-              [carousel.util :refer [events->chan get-children]]
-              [cljs.core.async :refer [>! <! put! chan alts!]]))
+  (:require-macros [cljs.core.async.macros :refer [go]])
+  (:require [com.famous.Famous]
+            [carousel.util :refer [events->chan get-children]]
+            [cljs.core.async :refer [>! <! put! chan alts!]]))

 (enable-console-print!)

@@ -26,237 +26,239 @@
 (defonce ABSOLUTE (.. Size -ABSOLUTE))

 (defn create-pages [root-node simulation]
-  (let [url-base "http://demo.famo.us.s3.amazonaws.com/hub/apps/carousel/Museo_del_Prado_-_Goya_-_Caprichos_-_No._"
-        image-names ["01_-_Autorretrato._Francisco_Goya_y_Lucientes2C_pintor_thumb.jpg"
-                     "02_-_El_si_pronuncian_y_la_mano_alargan_al_primero_que_llega_thumb.jpg"
-                     "03_-_Que_viene_el_Coco_thumb.jpg"
-                     "04_-_El_de_la_rollona_thumb.jpg"
-                     "05_-_Tal_para_qual_thumb.jpg"
-                     "06_-_Nadie_se_conoce_thumb.jpg"
-                     "07_-_Ni_asi_la_distingue_thumb.jpg"
-                     "09_-_Tantalo_thumb.jpg"
-                     "10_-_El_amor_y_la_muerte_thumb.jpg"
-                     "11_-_Muchachos_al_avC3ADo_thumb.jpg"
-                     "12_-_A_caza_de_dientes_thumb.jpg"
-                     "13_-_Estan_calientes_thumb.jpg"]
-        pages (map (fn [image-name]
-                     (let [_image-url (str url-base image-name)
-                           image-url (str "url('" _image-url "')")
-                           image-node (.. root-node addChild)
-                           el (DOMElement. image-node)
-                           box (FamousBox. (clj->js {:mass 100 :size [100 100 100]}))
-                           anchor (Vec3. 1 0 0)
-                           spring (Spring. nil box (clj->js {:period 0.5 :dampingRatio 0.5 :anchor anchor}))
-                           quaternion (.. (Quaternion.) (fromEuler 0 (/ (.. js/Math -PI) -2) 0))
-                           rotational-spring (RotationalSpring. nil box (clj->js {:period 1 :dampingRatio 0.2 :anchor quaternion}))]
-                       (.. image-node
-                           (setSizeMode ABSOLUTE ABSOLUTE ABSOLUTE)
-                           (setAbsoluteSize 500 500 0)
-                           (setAlign 0.5 0.5)
-                           (setMountPoint 0.5 0.5)
-                           (setOrigin 0.5 0.5))
-                       (.. el
-                           (setProperty "backgroundImage" image-url)
-                           (setProperty "background-repeat" "no-repeat")
-                           (setProperty "background-size" "cover"))
-
-                       {:node              image-node
-                        :el                el
-                        :box               box
-                        :spring            spring
-                        :quaternion        quaternion
-                        :rotational-spring rotational-spring
-                        :anchor            anchor}))
-                   image-names)]
-    (doseq [{:keys [box spring rotational-spring]} pages]
-      (.. simulation (add box spring rotational-spring)))
-
-    pages))
+      (let [url-base "http://demo.famo.us.s3.amazonaws.com/hub/apps/carousel/Museo_del_Prado_-_Goya_-_Caprichos_-_No._"
+            image-names ["01_-_Autorretrato._Francisco_Goya_y_Lucientes2C_pintor_thumb.jpg"
+                         "02_-_El_si_pronuncian_y_la_mano_alargan_al_primero_que_llega_thumb.jpg"
+                         "03_-_Que_viene_el_Coco_thumb.jpg"
+                         "04_-_El_de_la_rollona_thumb.jpg"
+                         "05_-_Tal_para_qual_thumb.jpg"
+                         "06_-_Nadie_se_conoce_thumb.jpg"
+                         "07_-_Ni_asi_la_distingue_thumb.jpg"
+                         "09_-_Tantalo_thumb.jpg"
+                         "10_-_El_amor_y_la_muerte_thumb.jpg"
+                         "11_-_Muchachos_al_avC3ADo_thumb.jpg"
+                         "12_-_A_caza_de_dientes_thumb.jpg"
+                         "13_-_Estan_calientes_thumb.jpg"]
+            pages (map (fn [image-name]
+                           (let [_image-url (str url-base image-name)
+                                 image-url (str "url('" _image-url "')")
+                                 image-node (.. root-node addChild)
+                                 el (DOMElement. image-node)
+                                 box (FamousBox. (clj->js {:mass 100 :size [100 100 100]}))
+                                 anchor (Vec3. 1 0 0)
+                                 spring (Spring. nil box (clj->js {:period 0.5 :dampingRatio 0.5 :anchor anchor}))
+                                 quaternion (.. (Quaternion.) (fromEuler 0 (/ (.. js/Math -PI) -2) 0))
+                                 rotational-spring (RotationalSpring. nil box (clj->js {:period 1 :dampingRatio 0.2 :anchor quaternion}))]
+                                (.. image-node
+                                    (setSizeMode ABSOLUTE ABSOLUTE ABSOLUTE)
+                                    (setAbsoluteSize 500 500 0)
+                                    (setAlign 0.5 0.5)
+                                    (setMountPoint 0.5 0.5)
+                                    (setOrigin 0.5 0.5))
+                                (.. el
+                                    (setProperty "backgroundImage" image-url)
+                                    (setProperty "background-repeat" "no-repeat")
+                                    (setProperty "background-size" "cover"))
+
+                                {:node              image-node
+                                 :el                el
+                                 :box               box
+                                 :spring            spring
+                                 :quaternion        quaternion
+                                 :rotational-spring rotational-spring
+                                 :anchor            anchor}))
+                       image-names)]
+           (doseq [{:keys [box spring rotational-spring]} pages]
+                  (.. simulation (add box spring rotational-spring)))
+
+           pages))

 (defn make-tree []
-  [:node {:id "root"}
-   [[:node {:id          "back"
-            :size-mode   [ABSOLUTE ABSOLUTE]
-            :absolute-size [40 40]
-            :align       [0 0.5 0]
-            :position    [40 0 0]
-            :mount-point [0 0.5 0]
-            :components  [[:DOMElement {:color "white"
-                                        :fontSize "40px"
-                                        :lineHeight "40px"
-                                        :cursor "pointer"
-                                        :textHighlight "none"
-                                        :zIndex "2"
-                                        :content "<"}]]}]
-    [:node {:id          "next"
-            :size-mode   [ABSOLUTE ABSOLUTE]
-            :absolute-size [40 40]
-            :align       [1 0.5 0]
-            :position    [-40 0 0]
-            :mount-point [1 0.5 0]
-            :components  [[:DOMElement {:color "white"
-                                        :fontSize "40px"
-                                        :lineHeight "40px"
-                                        :cursor "pointer"
-                                        :textHighlight "none"
-                                        :zIndex "2"
-                                        :content ">"}]]}]
-
-    (let [url-base "http://demo.famo.us.s3.amazonaws.com/hub/apps/carousel/Museo_del_Prado_-_Goya_-_Caprichos_-_No._"
-          image-names ["01_-_Autorretrato._Francisco_Goya_y_Lucientes2C_pintor_thumb.jpg"
-                       "02_-_El_si_pronuncian_y_la_mano_alargan_al_primero_que_llega_thumb.jpg"
-                       "03_-_Que_viene_el_Coco_thumb.jpg"
-                       "04_-_El_de_la_rollona_thumb.jpg"
-                       "05_-_Tal_para_qual_thumb.jpg"
-                       "06_-_Nadie_se_conoce_thumb.jpg"
-                       "07_-_Ni_asi_la_distingue_thumb.jpg"
-                       "09_-_Tantalo_thumb.jpg"
-                       "10_-_El_amor_y_la_muerte_thumb.jpg"
-                       "11_-_Muchachos_al_avC3ADo_thumb.jpg"
-                       "12_-_A_caza_de_dientes_thumb.jpg"
-                       "13_-_Estan_calientes_thumb.jpg"]]
-      (for [image-name image-names
-            :let [url-base "http://demo.famo.us.s3.amazonaws.com/hub/apps/carousel/Museo_del_Prado_-_Goya_-_Caprichos_-_No._"
-                  image-url (str url-base image-name)
-                  url (str "url('" image-url "')")]]
-        [:node {:size-mode [ABSOLUTE ABSOLUTE ABSOLUTE]
-                :absolute-size [500 500 0]
-                :align [0.5 0.5]
-                :mount-point [0.5 0.5]
-                :origin [0.5 0.5]
-                :components [ [:DOMElement {:backgroundImage url
-                                            :background-repeat "no-repeat"
-                                            :background-size "cover"}]]}]))
-    [:node {:id "dots"
-            :size-mode [ABSOLUTE ABSOLUTE]
-            :absolute-size [20 20]
-            :position [0 -50 0]
-            :align [0.5 1 0]
-            :mount-point [0.5 1 0]}
-     (for [i (range 5)]
-       [:node {:size-mode [ABSOLUTE ABSOLUTE]
-               :absolute-size [5 5]
-               :components [[:DOMElement {:borderRadius "5px"
-                                          :border "2px solid white"
-                                          :boxSizing "border-box"}]]}])]]])
+      [:node {:id "root"}
+       [[:node {:id            "back"
+                :size-mode     [ABSOLUTE ABSOLUTE]
+                :absolute-size [40 40]
+                :align         [0 0.5 0]
+                :position      [40 0 0]
+                :mount-point   [0 0.5 0]
+                :components    [[:DOMElement {:color         "white"
+                                              :fontSize      "40px"
+                                              :lineHeight    "40px"
+                                              :cursor        "pointer"
+                                              :textHighlight "none"
+                                              :zIndex        "2"
+                                              :content       "<"}]]}]
+        [:node {:id            "next"
+                :size-mode     [ABSOLUTE ABSOLUTE]
+                :absolute-size [40 40]
+                :align         [1 0.5 0]
+                :position      [-40 0 0]
+                :mount-point   [1 0.5 0]
+                :components    [[:DOMElement {:color         "white"
+                                              :fontSize      "40px"
+                                              :lineHeight    "40px"
+                                              :cursor        "pointer"
+                                              :textHighlight "none"
+                                              :zIndex        "2"
+                                              :content       ">"}]]}]
+
+        [:node {:id "pager"}
+         (let [url-base "http://demo.famo.us.s3.amazonaws.com/hub/apps/carousel/Museo_del_Prado_-_Goya_-_Caprichos_-_No._"
+                image-names ["01_-_Autorretrato._Francisco_Goya_y_Lucientes2C_pintor_thumb.jpg"
+                             "02_-_El_si_pronuncian_y_la_mano_alargan_al_primero_que_llega_thumb.jpg"
+                             "03_-_Que_viene_el_Coco_thumb.jpg"
+                             "04_-_El_de_la_rollona_thumb.jpg"
+                             "05_-_Tal_para_qual_thumb.jpg"
+                             "06_-_Nadie_se_conoce_thumb.jpg"
+                             "07_-_Ni_asi_la_distingue_thumb.jpg"
+                             "09_-_Tantalo_thumb.jpg"
+                             "10_-_El_amor_y_la_muerte_thumb.jpg"
+                             "11_-_Muchachos_al_avC3ADo_thumb.jpg"
+                             "12_-_A_caza_de_dientes_thumb.jpg"
+                             "13_-_Estan_calientes_thumb.jpg"
+                             ]]
+            (for [image-name image-names
+                  :let [url-base "http://demo.famo.us.s3.amazonaws.com/hub/apps/carousel/Museo_del_Prado_-_Goya_-_Caprichos_-_No._"
+                        image-url (str url-base image-name)
+                        url (str "url('" image-url "')")]]
+              [:node {:size-mode     [ABSOLUTE ABSOLUTE ABSOLUTE]
+                      :absolute-size [500 500 0]
+                      :align         [0.5 0.5]
+                      :mount-point   [0.5 0.5]
+                      :origin        [0.5 0.5]
+                      :components    [[:DOMElement {:backgroundImage   url
+                                                    :background-repeat "no-repeat"
+                                                    :background-size   "cover"}]]}]))]
+        [:node {:id            "dots"
+                :size-mode     [ABSOLUTE ABSOLUTE]
+                :absolute-size [20 20]
+                :position      [0 -50 0]
+                :align         [0.5 1 0]
+                :mount-point   [0.5 1 0]}
+         (for [i (range 5)]
+              [:node {:size-mode     [ABSOLUTE ABSOLUTE]
+                      :absolute-size [5 5]
+                      :components    [[:DOMElement {:borderRadius "5px"
+                                                    :border       "2px solid white"
+                                                    :boxSizing    "border-box"}]]}])]]])

 (defn make-nodes [node-as-vec]
-  (let [attributes (nth node-as-vec 1)
-        node (Node.)
-        size-mode (clj->js (:size-mode attributes))
-        absolute-size (clj->js (:absolute-size attributes))
-        align (clj->js (:align attributes))
-        position (clj->js (:position attributes))
-        components (:components attributes)
-        mount-point (clj->js (:mount-point attributes))
-        origin (clj->js (:origin attributes))
-        children (get-children node-as-vec)]
-    (.apply (.-setSizeMode node) node size-mode)
-    (.apply (.-setAbsoluteSize node) node absolute-size)
-    (.apply (.-setAlign node) node align)
-    (.apply (.-setPosition node) node position)
-    (.apply (.-setMountPoint node) node mount-point)
-    (.apply (.-setOrigin node) node origin)
-
-    (if-not (empty? components)
-      (doseq [component components
-              :let [dom-element (DOMElement. node)
-                    properties (nth component 1)]]
-        (doseq [p properties
-                :let [name  (name (first p))
-                      value (second p)]]
-          (if (= name "content")
-            (.. dom-element (setContent value))
-            (.. dom-element (setProperty name value))))))
-
-    (if-not (empty? children)
-      (doseq [n (nth node-as-vec 2)
-              :let [a-child-node (make-nodes n)]]
-        (.. node (addChild a-child-node))))
-
-    node))
+      (let [attributes (nth node-as-vec 1)
+            node (Node.)
+            size-mode (clj->js (:size-mode attributes))
+            absolute-size (clj->js (:absolute-size attributes))
+            align (clj->js (:align attributes))
+            position (clj->js (:position attributes))
+            components (:components attributes)
+            mount-point (clj->js (:mount-point attributes))
+            origin (clj->js (:origin attributes))
+            children (get-children node-as-vec)]
+           (.apply (.-setSizeMode node) node size-mode)
+           (.apply (.-setAbsoluteSize node) node absolute-size)
+           (.apply (.-setAlign node) node align)
+           (.apply (.-setPosition node) node position)
+           (.apply (.-setMountPoint node) node mount-point)
+           (.apply (.-setOrigin node) node origin)
+
+           (if-not (empty? components)
+                   (doseq [component components
+                           :let [dom-element (DOMElement. node)
+                                 properties (nth component 1)]]
+                          (doseq [p properties
+                                  :let [name (name (first p))
+                                        value (second p)]]
+                                 (if (= name "content")
+                                   (.. dom-element (setContent value))
+                                   (.. dom-element (setProperty name value))))))
+
+           (if-not (empty? children)
+                   (doseq [n (nth node-as-vec 2)
+                           :let [a-child-node (make-nodes n)]]
+                          (.. node (addChild a-child-node))))
+
+           node))

 (defn Carousel []
-  (let [simulation (PhysicsEngine.)
-        tree (make-tree)
-        root-node (make-nodes tree)
-        children (.. root-node getChildren)
-        context (.. FamousEngine (createScene "body"))
-
-        back-node (first children)
-        back-clicks (events->chan back-node "tap")
-
-        next-node (second children)
-        next-clicks (events->chan next-node "tap")
-
-        pages (.. children (slice 2 (count children)))
-        _ (println "count= "(count children))
-
-        dot-container-node (last children)
-        dot-nodes (.. dot-container-node getChildren)
-        resize (clj->js {:onSizeChange (fn [^Float32Array size]
-                                         "NOTE: this call back is called only once because root-dot setSizeMode is ABSOLUTE (value of 1)"
-                                         (let [size (IndexedSeq. size 0)
-                                               dotWidth 10
-                                               numPages 5
-                                               spacing 5
-                                               totalDotSize (+ (* numPages dotWidth)
-                                                               (* spacing (dec numPages)))
-                                               start-x (/ (- (nth size 0) totalDotSize)
-                                                          2)]
-                                           (doseq [n (range (count dot-nodes))
-                                                   :let [dot-node (nth dot-nodes n)]]
-                                             (.. dot-node (setPosition (+ start-x
-                                                                          (* n
-                                                                             (+ dotWidth spacing)))
-                                                                       0
-                                                                       0)))))})
-        current-index (atom 0)]
-    (.. dot-container-node (addComponent resize))
-    (.. context (addChild root-node))
-
-
-                                        ;(add-watch current-index :watcher (fn [key atom old-index new-index]
-                                        ;                                      (let [old-page (nth pages old-index)
-                                        ;                                            new-page (nth pages new-index)]
-                                        ;                                           (.. (:anchor old-page) (set 1 0 0))
-                                        ;                                           (.. (:quaternion old-page) (fromEuler 0 (/ (.. js/Math -PI) -2) 0))
-                                        ;                                           (.. (:anchor new-page) (set 0 0 0))
-                                        ;                                           (.. (:quaternion new-page) (set 1 0 0 0)))))
-
-    (go
-      (while true
-        (let [[v channel] (alts! [back-clicks next-clicks])]
-          (cond
-            (= channel back-clicks) (do
-                                      (println "back" @current-index)
-                                      (swap! current-index dec)
-                                      )
-            (= channel next-clicks) (do
-                                      (println "next" @current-index)
-                                      (swap! current-index inc)
-                                      )))))
-
-    ;; (.. FamousEngine (requestUpdate (clj->js {:onUpdate (fn [time]
-    ;;                                                       (.. simulation (update time))
-    ;;                                                       (doseq [page pages
-    ;;                                                               :let [physics-transform (.. simulation (getTransform (:box page)))
-    ;;                                                                     p (.. physics-transform -position)
-    ;;                                                                     r (.. physics-transform -rotation)
-    ;;                                                                     node (:node page)]]
-    ;;                                                         (.. node
-    ;;                                                             (setPosition (* 0 1446) 0 0)
-    ;;                                                             (setRotation (nth r 0) (nth r 1) (nth r 2) (nth r 3))
-    ;;                                                             )
-    ;;                                                         )
-
-    ;;                                                       (this-as this
-    ;;                                                                (.. FamousEngine (requestUpdateOnNextTick this)))
-    ;;                                                       )})))
-    )
-
-  )
+      (let [simulation (PhysicsEngine.)
+            tree (make-tree)
+            root-node (make-nodes tree)
+            children (.. root-node getChildren)
+            context (.. FamousEngine (createScene "body"))
+
+            back-node (first children)
+            back-clicks (events->chan back-node "tap")
+
+            next-node (second children)
+            next-clicks (events->chan next-node "tap")
+
+            pages (.. children (slice 2 (count children)))
+            _ (println "count= " (count children))
+
+            dot-container-node (last children)
+            dot-nodes (.. dot-container-node getChildren)
+            resize (clj->js {:onSizeChange (fn [^Float32Array size]
+                                               "NOTE: this call back is called only once because root-dot setSizeMode is ABSOLUTE (value of 1)"
+                                               (let [size (IndexedSeq. size 0)
+                                                     dotWidth 10
+                                                     numPages 5
+                                                     spacing 5
+                                                     totalDotSize (+ (* numPages dotWidth)
+                                                                     (* spacing (dec numPages)))
+                                                     start-x (/ (- (nth size 0) totalDotSize)
+                                                                2)]
+                                                    (doseq [n (range (count dot-nodes))
+                                                            :let [dot-node (nth dot-nodes n)]]
+                                                           (.. dot-node (setPosition (+ start-x
+                                                                                (* n
+                                                                                (+ dotWidth spacing)))
+                                                                                0
+                                                                                0)))))})
+            current-index (atom 0)]
+           (.. dot-container-node (addComponent resize))
+           (.. context (addChild root-node))
+
+
+           ;(add-watch current-index :watcher (fn [key atom old-index new-index]
+           ;                                      (let [old-page (nth pages old-index)
+           ;                                            new-page (nth pages new-index)]
+           ;                                           (.. (:anchor old-page) (set 1 0 0))
+           ;                                           (.. (:quaternion old-page) (fromEuler 0 (/ (.. js/Math -PI) -2) 0))
+           ;                                           (.. (:anchor new-page) (set 0 0 0))
+           ;                                           (.. (:quaternion new-page) (set 1 0 0 0)))))
+
+           (go
+             (while true
+                    (let [[v channel] (alts! [back-clicks next-clicks])]
+                         (cond
+                           (= channel back-clicks) (do
+                                                     (println "back" @current-index)
+                                                     (swap! current-index dec)
+                                                     )
+                           (= channel next-clicks) (do
+                                                     (println "next" @current-index)
+                                                     (swap! current-index inc)
+                                                     )))))
+
+           ;; (.. FamousEngine (requestUpdate (clj->js {:onUpdate (fn [time]
+           ;;                                                       (.. simulation (update time))
+           ;;                                                       (doseq [page pages
+           ;;                                                               :let [physics-transform (.. simulation (getTransform (:box page)))
+           ;;                                                                     p (.. physics-transform -position)
+           ;;                                                                     r (.. physics-transform -rotation)
+           ;;                                                                     node (:node page)]]
+           ;;                                                         (.. node
+           ;;                                                             (setPosition (* 0 1446) 0 0)
+           ;;                                                             (setRotation (nth r 0) (nth r 1) (nth r 2) (nth r 3))
+           ;;                                                             )
+           ;;                                                         )
+
+           ;;                                                       (this-as this
+           ;;                                                                (.. FamousEngine (requestUpdateOnNextTick this)))
+           ;;                                                       )})))
+           )
+
+      )

 (Carousel)
 (.. FamousEngine init)


fixing startup from main

fixing startup from main

--- resources/leiningen/new/closp/clj/core.clj
+++ resources/leiningen/new/closp/clj/core.clj
@@ -1,10 +1,12 @@
 (ns {{ns}}.core
   (:require [clojure.tools.logging :as log]
+            [system.repl :refer [set-init! start]]
             [{{ns}}.cljccore :as cljc]
             [{{ns}}.components.components :refer [prod-system]]
             [com.stuartsierra.component :as component])
   (:gen-class))

 (defn -main [& args]
-  (alter-var-root #'prod-system component/start)
+  (set-init! #'prod-system)
+  (start)
   (log/info "server started."))


Center docker diagram text for now

Center docker diagram text for now

--- src-cljs/frontend/components/docker.cljs
+++ src-cljs/frontend/components/docker.cljs
@@ -50,7 +50,7 @@
            [:a
             {:on-click #(raise! owner [:docker-diagram-index-selected (- active-section-index 1)])}
             [:img.diagram-arrow {:src (utils/cdn-path "/img/outer/docker/diagram-arrow-left.svg")}]])]
-        [:div.col-xs-6.text-justify
+        [:div.col-xs-6.text-center
          [:h3
           (last (nth diagram-structure active-section-index))]]
         [:div.col-xs-3.text-left


focus and select description on edit

focus and select description on edit

--- src-cljs/frontend/components/issues.cljs
+++ src-cljs/frontend/components/issues.cljs
@@ -14,6 +14,8 @@
             [frontend.urls :as urls]
             [frontend.utils.ajax :as ajax]
             [frontend.utils :as utils]
+            [goog.dom]
+            [goog.dom.forms :as gforms]
             [goog.string :as gstring]
             [goog.string.format]
             [om.core :as om]
@@ -133,6 +135,12 @@
     om/IDisplayName (display-name [_] "Description form")
     om/IInitState (init-state [_] {:issue-description nil
                                    :editing? nil})
+    om/IDidUpdate
+    (did-update [_ _ prev-props]
+      (when (and (not (:editing? prev-props))
+                 (om/get-state owner :editing?)
+                 (om/get-node owner "description-input"))
+        (gforms/focusAndSelect (om/get-node owner "description-input"))))
     om/IRenderState
     (render-state [_ {:keys [issue-description]}]
       (let [{:keys [issue-db cust cast!]} (om/get-shared owner)
@@ -149,6 +157,7 @@
            [:form.issue-description-form {:on-submit submit}
             [:div.adaptive.issue-description-in ;{:class (when (:issue/description issue) " to-edit ")}
              [:textarea {;:class (when (:issue/description issue) " to-edit ")
+                         :ref "description-input"
                          :value (or issue-description (:issue/description issue ""))
                          :required "true"
                          :on-change #(om/set-state! owner :issue-description (.. % -target -value))


Added support for the Channel Presence API.

--- src/appengine_magic/services/channel.clj
+++ src/appengine_magic/services/channel.clj
@@ -4,6 +4,9 @@

 (defonce *channel-service* (atom nil))
+
+
+(defrecord ClientStatus [id status])

 (defn get-channel-service []
@@ -27,3 +30,9 @@
      (.sendMessage (get-channel-service) message))
   ([^String client-id, ^String message]
      (send (make-message client-id message))))
+
+
+(defn parse-presence [request]
+  (let [presence-obj (.parsePresence (get-channel-service) (:request request))]
+    (ClientStatus. (.clientId presence-obj)
+                   (if (.isConnected presence-obj) :connected :disconnected))))


(maint) applied-migrations: don't ignore exceptions

Check to see if there is a schema_migrations table before querying it.
This eliminates these error messages from the postgresql log:

  STATEMENT:  SELECT version FROM schema_migrations ORDER BY version
  ERROR:  relation "schema_migrations" does not exist at character 21

A very large number of these messages are produced during the unit
tests.

--- src/com/puppetlabs/puppetdb/scf/migrate.clj
+++ src/com/puppetlabs/puppetdb/scf/migrate.clj
@@ -931,12 +931,14 @@
   {:post  [(sorted? %)
            (set? %)
            (apply < 0 %)]}
-  (try
-    (let [query   "SELECT version FROM schema_migrations ORDER BY version"
-          results (sql/transaction (query-to-vec query))]
-      (apply sorted-set (map :version results)))
-    (catch java.sql.SQLException e
-      (sorted-set))))
+  (sql/transaction
+   (if-not (some #(= (string/lower-case %) "schema_migrations")
+                 (scf-utils/sql-current-connection-table-names))
+     (sorted-set)
+     (apply sorted-set
+            (map :version
+                 (query-to-vec
+                  "SELECT version FROM schema_migrations ORDER BY version"))))))

 (defn pending-migrations
   "Returns a collection of pending migrations, ordered from oldest to latest."


Leverage http abstraction to provide easier helpers to setup graphql connections

--- src/com/wsscode/pathom/connect/graphql.cljc
+++ src/com/wsscode/pathom/connect/graphql.cljc
@@ -2,9 +2,12 @@
   (:require [camel-snake-kebab.core :as csk]
             [clojure.spec.alpha :as s]
             [clojure.string :as str]
+            [#?(:clj  com.wsscode.common.async-clj
+                :cljs com.wsscode.common.async-cljs) :refer [let-chan go-catch <? <?maybe]]
             [com.wsscode.pathom.core :as p]
             [com.wsscode.pathom.connect :as pc]
-            [com.wsscode.pathom.graphql :as pg]))
+            [com.wsscode.pathom.graphql :as pg]
+            [com.wsscode.pathom.diplomat.http :as p.http]))

 (s/def ::ident-map (s/map-of string? (s/tuple string? string?)))

@@ -102,7 +105,7 @@
         #{(keyword (entity-field-key prefix entity field))}))
     #{}))

-(defn index-schema-oif [{::keys    [prefix schema resolver]
+(defn index-schema-oir [{::keys    [prefix schema resolver]
                          ::pc/keys [index-io]
                          :as       input}]
   (let [schema (:__schema schema)
@@ -162,7 +165,7 @@
      index-io

      ::pc/index-oir
-     (index-schema-oif input)
+     (index-schema-oir input)

      ::pc/autocomplete-ignore
      (index-autocomplete-ignore input)
@@ -222,9 +225,9 @@
     (catch #?(:clj Throwable :cljs :default) _ nil)))

 (def parser-item
-  (p/parser {::p/plugins [(p/env-plugin {::p/reader [error-stamper
-                                                     (p/map-reader* {::p/map-key-transform camel-key})
-                                                     gql-ident-reader]})]}))
+  (p/parser {::p/env {::p/reader [error-stamper
+                                  (p/map-reader* {::p/map-key-transform camel-key})
+                                  gql-ident-reader]}}))

 (defn query->graphql
   "Like the pg/query-graphql, but adds name convertion so clj names like :first-name turns in firstName."
@@ -261,3 +264,28 @@
                  (assoc x k v)))
     {}
     data))
+
+(defn gql-request [{::keys [url] :as env} query]
+  (let-chan [response (p.http/request (assoc env ::p.http/url url
+                                                 ::p.http/method ::p.http/post
+                                                 ::p.http/as ::p.http/json
+                                                 ::p.http/form-params {:query (if (string? query) query (query->graphql query))}))]
+    (::p.http/body response)))
+
+(defn load-index [req]
+  (let-chan [{:keys [data]} (gql-request req (pg/query->graphql schema-query))]
+    (index-schema (assoc req ::schema data))))
+
+(defn defgraphql-resolver [resolver-fn {::keys [resolver] :as config}]
+  (defmethod resolver-fn resolver [env ent]
+    (let [env' (merge env config)
+          q    (build-query env' ent)
+          gq   (query->graphql q)]
+      (let-chan [{:keys [data errors]} (gql-request env' gq)]
+        (-> (parser-item {::p/entity      data
+                          ::p/errors*     (::p/errors* env)
+                          ::base-path     (vec (butlast (::p/path env)))
+                          ::graphql-query gq
+                          ::errors        (index-graphql-errors errors)}
+              q)
+            (pull-idents))))))


gpg now works for root also

gpg now works for root also

--- src/dda/pallet/dda_user_crate/infra/gpg.clj
+++ src/dda/pallet/dda_user_crate/infra/gpg.clj
@@ -19,6 +19,7 @@
    [clojure.java.io :as io]
    [pallet.actions :as actions]
    [pallet.action :as action]
+   [dda.config.commons.user-env :as user-env]
    [dda.pallet.dda-user-crate.infra.schema :as schema]))

 (s/defn install
@@ -38,7 +39,7 @@
    config :- schema/OsUser]
   (let [{:keys [trusted-key]} (:gpg config)
         {:keys [public-key private-key passphrase]} trusted-key
-        user-home (str "/home/" user-name "/")]
+        user-home (user-env/user-home-dir user-name)]
     (actions/remote-file
       (str user-home "pub.key")
       :content public-key


Tidy up indentation and clean up of generate-predicate-function.

--- clj_record/query.clj
+++ clj_record/query.clj
@@ -2,21 +2,21 @@
   (:require [clojure.contrib.str-utils :as str-utils]))

-(defmacro generate-predicate [predicate join-predicate-params-with values]
-  `(fn [attribute#]
-     (let [[clause# params#]
-	   [(str-utils/str-join ~join-predicate-params-with
-	     (reduce
-	      (fn [predicate-params# value#]
-		(conj predicate-params# (if (nil? value#) "NULL" "?"))) [] ~values))
-	    (filter (complement nil?) ~values)]]
-       [(format (str "%s " ~predicate) (name attribute#) clause#) params#])))
+(defn- generate-predicate-fn [predicate join-predicate-params-with values]
+  (fn [attribute]
+     (let [[clause params]
+	   [(str-utils/str-join join-predicate-params-with
+             (reduce
+               (fn [predicate-params value]
+                 (conj predicate-params (if (nil? value) "NULL" "?"))) [] values))
+            (filter (complement nil?) values)]]
+       [(format (str "%s " predicate) (name attribute) clause) params])))

 (defn between [value1 value2]
-  (generate-predicate "BETWEEN %s" " AND " [value1 value2]))
+  (generate-predicate-fn "BETWEEN %s" " AND " [value1 value2]))

 (defn in [& values]
-  (generate-predicate "IN (%s)" ", " values))
+  (generate-predicate-fn "IN (%s)" ", " values))

 (defn like [value]
-  (generate-predicate "LIKE %s" "" [value]))+  (generate-predicate-fn "LIKE %s" "" [value]))


Ported the original -main to a new version, which uses the more idiomatic technique of applying the middleware functions (the -> macro). Confirmed working, including checking that each middleware function is still doing its thing. Retaining the original version for now, for reference (and will try to keep them in parity for the time being, until my understanding of the -> macro increases).

--- src/blaagh/core.clj
+++ src/blaagh/core.clj
@@ -6,8 +6,7 @@

 (require 'clojure.pprint)

-(defn home-handler
-    [request]
+(defn home-handler [request]
     (str "Blaagh version " (:app-version request) " foo=" (:foo (:params request))))

 (defn wrap-version [handler]
@@ -15,7 +14,8 @@
         (handler (assoc request :app-version "0.1"))))

 (defn wrap-spy [handler]
-    ""
+    "Output (to the server console) some pretty-printed representations
+    of the Request and Response maps."
     (fn [request]
         (println "-------------------------------")
         (println "Incoming Request Map:")
@@ -37,6 +37,21 @@
     (HEAD "/" [] "Preview something"))

 (defn -main []
+    "This is the idiomatic way of applying the various middleware pieces,
+     using the -> macro. It works, and all of the middleware still functions correctly,
+     however I still must get a better understanding of how this works. I basically
+     just lined the middlewares from inside-to-out based on the original -main implementation."
+    (run-server
+        (-> all-routes
+            (wrap-defaults site-defaults)
+            (wrap-version)
+            (wrap-spy)
+            (reload/wrap-reload)
+            ) {:port 5000}))
+
+(defn -main-ORIGINAL []
+    "This is the non-idiomatic way of applying the various middleware pieces.
+     It works, but the nesting gets a little crazy."
     (run-server
         (reload/wrap-reload
             (wrap-spy


Add sahucs-simple-dijkstra

Add sahucs-simple-dijkstra

--- src/exp/hierarchical_incremental_search.clj
+++ src/exp/hierarchical_incremental_search.clj
@@ -81,6 +81,9 @@
 (defn hfs-can-reach? [hfs s]
   (or (seq (:remaining-actions hfs)) (= s (:state hfs))))

+(defn hfs-cycle-level [hfs]
+  (when-let [a (first (:remaining-actions hfs))] (hierarchy/cycle-level a (:state hfs))))
+
 (defn hfs-optimistic-map [hfs]
   (let [{:keys [state remaining-actions]} hfs]
     (assert (util/singleton? remaining-actions))
@@ -102,39 +105,49 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Searches ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

+; Basic idea behind heterogenous search:
+;   We can generate expansions for nodes in different ways.
+;   Always assume we have an HFS within a recursive ID.
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Flat search ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(defn hfs-simple-children [hfs] (map hfs->simple-node (hfs-children hfs)))
+(defn expand-hfs [hfs] (map hfs->simple-node (hfs-children hfs)))

 (defn make-fast-flat-search [root-hfs]
-  (is/make-flat-incremental-dijkstra (hfs->simple-node root-hfs) (comp hfs-simple-children :data)))
+  (is/make-flat-incremental-dijkstra (hfs->simple-node root-hfs) (comp expand-hfs :data)))

 (defn make-flat-search  [root-hfs]
-  (is/make-recursive-incremental-dijkstra (hfs->simple-node root-hfs) (comp hfs-simple-children :data)))
+  (is/make-recursive-incremental-dijkstra (hfs->simple-node root-hfs) (comp expand-hfs :data)))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Recursive search ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-;; TODO: recursive recursively is where polymorphism fits in.
-
-(declare make-recursive-search)
-
-
-(defn make-abstracted-subgoal-search [hfs]
+
+(defn abstract-subsearch [hfs searchify-fn]
   (is/WrappedSubSearch
    (let [[name abstract-hfs-fn] (drop-hfs hfs)]
      (is/get-cached-search *problem-cache* name
        (let [dropped (abstract-hfs-fn)]
          (is/make-recursive-ef-search
-          (hfs->simple-node dropped) (hfs-simple-children dropped)
-          #(make-abstracted-subgoal-search (:data %))))))
+          (hfs->simple-node dropped) (expand-hfs dropped)
+          #(searchify-fn (:data %))))))
    (:reward hfs)
    #(is/offset-simple-summary % (:reward hfs))
    #(->> % :data (lift-hfs hfs) hfs->simple-node)))

-
-(defn make-recursive-search [root-hfs]
-  (:search (make-abstracted-subgoal-search root-hfs)))
-
+(def recursive-subsearch (fn [hfs] (abstract-subsearch hfs recursive-subsearch)))
+
+(defn make-recursive-search [root-hfs] (:search (recursive-subsearch root-hfs)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Hybrid flat/rec search ;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn make-acyclic-searchify [root-hfs]
+  (let [root-cycle-level (hfs-cycle-level root-hfs)]
+    #(if (and root-cycle-level (= (hfs-cycle-level %) root-cycle-level))
+        (expand-hfs %)
+      (abstract-subsearch % (make-acyclic-searchify %)))))
+
+(defn make-acyclic-recursive-search [root-hfs]
+  (:search (abstract-subsearch root-hfs (make-acyclic-searchify root-hfs))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Inverted ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

@@ -266,6 +279,9 @@
 (defn sahucs-simple [henv]
   (hierarchical-search henv nil make-recursive-search))

+(defn sahucs-dijkstra [henv]
+  (hierarchical-search henv nil make-acyclic-recursive-search))
+
 (defn sahucs-inverted [henv]
   (hierarchical-search henv nil make-inverted-search))

@@ -275,8 +291,8 @@

 (comment
-  (do (use '[exp env hierarchy taxi ucs] 'edu.berkeley.ai.util) (require '[exp sahucs-simple sahucs-inverted saha-simple] '[exp.old ahois]))
-  (let [e (make-random-taxi-env 5 5 5 3) _ (println e) h (simple-taxi-hierarchy e)]
+  (do (use '[exp env hierarchy taxi ucs hierarchical-incremental-search] 'edu.berkeley.ai.util) (require '[exp sahucs-simple sahucs-simple-dijkstra sahucs-inverted saha-simple] '[exp.old ahois]))
+   (let [e (make-random-taxi-env 5 5 5 3) _ (println e) h (simple-taxi-hierarchy e)]
     (time (println "ucs" (run-counted #(second (uniform-cost-search e)))))
-    (doseq [alg `[sahucs-flat sahucs-fast-flat exp.sahucs-simple/sahucs-simple sahucs-simple exp.sahucs-inverted/sahucs-inverted sahucs-inverted exp.saha-simple/saha-simple saha-simple ]]
+    (doseq [alg `[sahucs-flat sahucs-fast-flat exp.sahucs-simple/sahucs-simple sahucs-simple exp.sahucs-simple-dijkstra/sahucs-simple-dijkstra sahucs-dijkstra exp.sahucs-inverted/sahucs-inverted sahucs-inverted exp.saha-simple/saha-simple saha-simple ]]
       (time (println alg (run-counted #(debug 0 (second ((resolve alg) h)))))))))


tests should be (is x) (is y) (is z)...not: (and (is x) (is y) (is z)...etc)

--- test/babel/test/fr.clj
+++ test/babel/test/fr.clj
@@ -54,17 +54,17 @@
                        (unifyc rule
                                {:head (last (get lexicon "être"))}))
                      (:grammar @small)))]
-    (and (is (not (empty? result)))
-         (is (= (get-in (first result) [:rule]) "vp-aux")))))
+    (is (not (empty? result)))
+    (is (= (get-in (first result) [:rule]) "vp-aux"))))

 (deftest vp-aux-test
   (let [rule (first (filter #(= (:rule %) "vp-aux")
                             (:grammar @small)))]
-    ))
+    (is (not (nil? rule)))))

 (def etre-test
-  (first (filter #(= true (get-in % [:synsem :aux]))
-                 (get (:lexicon @small) "être"))))
+  (is (not (nil? (first (filter #(= true (get-in % [:synsem :aux]))
+                                (get (:lexicon @small) "être")))))))

 (deftest over-test
   (let [lexicon (:lexicon @small)
@@ -74,9 +74,9 @@
               (get lexicon "je")
               (over grammar
                     (get lexicon "sommes") (get lexicon "aller")))]
-    (and (not (nil? result))
-         (not (empty? result))
-         (= 1 (.size result)))))
+    (is (not (nil? result)))
+    (is (not (empty? result)))
+    (is (= 1 (.size result)))))

 (deftest passe-compose-morphology
   (let [result
@@ -151,6 +151,7 @@
                                                 :aspect :perfect
                                                 :tense :past}}}
                                 small)]
-    (and (is (not (nil? result)))
-         (is (= (fo result) "nous sommes allées")))))
+    (is (not (nil? result)))
+    (is (= (fo result) "nous sommes allées"))))

+


Add newline if form is not complete on Enter.

--- src/cljs/cljs_repl_web/console/cljs.cljs
+++ src/cljs/cljs_repl_web/console/cljs.cljs
@@ -1,6 +1,7 @@
 (ns cljs-repl-web.console.cljs
   (:require [clojure.string :as string]
             [replumb.core :as replumb]
+            [replumb.repl :as replumb-repl]
             [re-frame.core :refer [subscribe dispatch]]
             [cljs-repl-web.console :as console]
             [cljs-repl-web.highlight :as highlight]))
@@ -38,14 +39,36 @@
                                                        (re-pattern (replumb/get-prompt)) 2)))
          0 "")))

+(defn cljs-console-multiline?
+  "Following jq-console specs:
+
+  multiline_callback: If specified, this function is called when the
+  user presses Enter to check whether the input should continue to the
+  next line. The function must return one of the following values:
+
+    false: the input operation is completed.
+
+    0: the input continues to the next line with the current indent.
+
+    N (int): the input continues to the next line, and the current
+    indent is adjusted by N, e.g. -2 to unindent two levels."
+  [input]
+  (try
+    (replumb-repl/repl-read-string input)
+    false
+    (catch :default _
+      0)))
+
 (defn cljs-console-prompt!
   [console]
-  (doto console
-    (.Prompt true (fn [input]
-                    (cljs-read-eval-print! console input)
-                    (.SetPromptLabel console (replumb/get-prompt)) ;; necessary for namespace changes
-                    (cljs-console-prompt! console)
-                    (dispatch [:set-console-text :cljs-console input]))))
+  (.Prompt console true
+           (fn [input]
+             (cljs-read-eval-print! console input)
+             (.SetPromptLabel console (replumb/get-prompt)) ;; necessary for namespace changes
+             (cljs-console-prompt! console)
+             (dispatch [:set-console-text :cljs-console input]))
+           cljs-console-multiline?)
+
   (when-let [example @(subscribe [:get-next-example :cljs-console])]
     (cljs-console-set-prompt-text! console example)
     (dispatch [:delete-first-example :cljs-console])))


Fixed ULTRA to never return program 'ultra-padding.

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -209,8 +209,8 @@
 (defn remove-empties
   "Removes empty sequences from tree t."
   [t]
-  (prewalkseq
-    (fn [node] (if (seq? node)
+  (prewalkseq
+    (fn [node] (if (seq? node)
                  (remove #(and (seq? %) (empty? %)) node)
                  node))
     t))
@@ -218,11 +218,13 @@
 (defn remove-ultra-padding
   "Removes instances of 'ultra-padding from tree t."
   [t]
-  (prewalkseq
-    (fn [node] (if (seq? node)
-                 (remove #{'ultra-padding} node)
-                 node))
-    t))
+  (if (= t 'ultra-padding)
+    '()
+    (prewalkseq
+      (fn [node] (if (seq? node)
+                   (remove #{'ultra-padding} node)
+                   node))
+      t)))

 (defn list-to-open-close-sequence
   [lst]


Renamed :no-clones diversification test to :doesnt-clone.

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -818,7 +818,7 @@
     (and (> (reduce min diffs) 0) ;; diversification threshold set here
          (> (count (distinct diffs)) 1))))

-(defn no-clones-diversifying?
+(defn doesnt-clone-diversifying?
   "Returns true iff genome g passes the diversification test."
   [g argmap]
   (not= (translate-plush-genome-to-push-program
@@ -1033,7 +1033,7 @@
      :minimal-reproductive-difference minimal-reproductive-difference-diversifying?
      :use-mate-differently use-mate-differently-diversifying?
      :si-and-mate-use si-and-mate-use-diversifying?
-     :no-clones no-clones-diversifying?
+     :doesnt-clone doesnt-clone-diversifying?
      :not-a-clone not-a-clone-diversifying?
      :minimum-genetic-difference minimum-genetic-difference-diversifying?
      :none (fn [genome argmap] true))


make kibit happy

make kibit happy

--- src/open_company/representations/common.clj
+++ src/open_company/representations/common.clj
@@ -25,5 +25,4 @@
   (array-map :rel "delete" :method DELETE :href url))

 (defn revision-link [url updated-at media-type]
-  (-> (link-map "revision" GET url media-type)
-    (assoc :updated-at updated-at)))+  (assoc (link-map "revision" GET url media-type) :updated-at updated-at))


Minor doc editing.

Minor doc editing.

--- src/com/lemondronor/turboshrimp/pave.clj
+++ src/com/lemondronor/turboshrimp/pave.clj
@@ -2,7 +2,8 @@
   "Code for reading and parsing video data in Parrot Video
   Encapsulated (PaVE) format.

-  Typically you will do something like the following:
+  Typically you will do something like the following to process drone
+  video:

   * Create a frame queue ([[make-frame-queue]]), a video input
   stream ([[video-input-stream]]), and a video decoder (see e.g.


Fix fetch-and-update via notification

Fix fetch-and-update via notification

--- src/cider_ci/repository/repositories.clj
+++ src/cider_ci/repository/repositories.clj
@@ -157,17 +157,26 @@
                 state))
             repository git-repository))

+
+
+(defn- git-fetch-and-update-fn [state repository]
+  (catcher/wrap-with-suppress-and-log-warn
+    (git-fetch-or-initialize repository)
+    (git-update repository))
+  (conj state  {:git-fetched-at (time/now)}))
+
 (defn- submit-git-fetch-and-update [repository git-repository]
   (logging/debug submit-git-fetch-and-update [repository git-repository])
-  (send-off (:agent git-repository)
-            (fn [state repository git-repository]
-              ; possibly skip overflow of the queue
-              (if (git-fetch-is-due? repository git-repository)
-                (do (git-fetch-or-initialize repository)
-                  (git-update repository)
-                  (conj state {:git_fetched_at (time/now)}))
-                state))
-            repository git-repository))
+  (let [repo-agent (:agent git-repository)]
+    (send-off repo-agent
+              (fn [state repository git-repository]
+                (if-let [git-fetched-at (:git-fetched-at state)]
+                  ; skip if it has been fetched in the last 500ms
+                  (if (time/after? (time/now) (time/plus git-fetched-at (time/millis 500)))
+                    (git-fetch-and-update-fn state repository)
+                    state)
+                  (git-fetch-and-update-fn state repository)))
+              repository git-repository)))

 (defn- submit-git-initialize [repository git-repository]
   (send-off (:agent git-repository)


Add ability to peek

Add ability to peek

--- src/cljs/pushpopchestnutreless/core.cljs
+++ src/cljs/pushpopchestnutreless/core.cljs
@@ -7,7 +7,8 @@
 (defonce app-state
   (atom
     {:stack (list "first" "second")
-     :new-item-text ""}))
+     :new-item-text ""
+     :snooping false}))

 (defmulti step
   (fn [_ {:keys [id]}]
@@ -19,10 +20,15 @@
   (assoc state :new-item-text (:text m)))

 (defmethod step :push [{:keys [new-item-text] :as state} _]
-  (update state :stack conj new-item-text))
+  (-> state
+    (update :stack conj new-item-text)
+    (assoc :new-item-text "")))

 (defmethod step :pop [state _]
   (update state :stack pop))
+
+(defmethod step :toggle-snoop [state _]
+  (update state :snooping not))

 ; VIEW HELPERS
@@ -40,15 +46,6 @@

 ;: VIEW

-(defn counter [count inc-msg dec-msg]
-  [:div
-   [:h2 (str "count " count)]
-   [:button
-    {:on-click (on-click inc-msg)}
-    "+"]
-   [:button
-    {:on-click (on-click dec-msg)}
-    "-"]])

 (defn greeting [state]
   [:div
@@ -58,6 +55,13 @@
     [:button
      {:on-click (on-click :pop)}
      "Pop"]]
+   [:div
+    [:a
+     {:on-click (on-click :toggle-snoop)}
+     (if (:snooping state) "peeking..." "peek...")]
+    (when (:snooping state)
+     (into [:ol]
+      (map #(vec [:li %]) (:stack state))))]
    [:div
     [:p (:new-item-text state)]
     [:input


select style fixes

select style fixes

--- src/cljs/re_form/inputs/select_impl.cljs
+++ src/cljs/re_form/inputs/select_impl.cljs
@@ -11,7 +11,6 @@
    {:position :relative}
    [:.re-re-select
     {:display "inline-block"
-     :min-width "30em"
      :background-color :white
      :border-radius (u/px 2)
      :padding [[(u/px-div h 2) (u/px 12)]]
@@ -37,6 +36,10 @@
    [:.re-search-search
     {:border border
      :width "100%"
+     :position :absolute
+     :z-index 1000
+     :left (u/px 0)
+     :top (u/px+ 10 (+ 16 (* h 1.5)))
      :padding [[0 (u/px w)]]
      :border-radius (u/px radius)
      :line-height (u/px* h3)}
@@ -46,7 +49,7 @@
     {:position "absolute"
      :background-color "white"
      :z-index 1000
-     :left (u/px -1)
+     :left (u/px 0)
      :top (u/px+ 10 (* 2 (+ 16 (* h 1.5))))
      :width "100%"
      :display "inline-block"
@@ -56,6 +59,10 @@
      :border "1px solid #ddd"}
     [:&.no-input
      {:top (u/px+ 10 (+ 16 (* h 1.5)))}]
+    [:.no-results
+     {:text-align :center
+      :padding (u/px 10)
+      :color :gray}]
     [:.option {:cursor "pointer"
                :display "block"
                :padding-left (u/px h)
@@ -67,11 +74,13 @@
 (defn options-list [options label-fn on-change]
   (let [opts (if (instance? reagent.ratom/Reaction options) @options options)]
     [:div
-     (for [i opts]
-       [:div.option
-        {:key (pr-str i)
-         :on-click (fn [_] (on-change i))}
-        (label-fn i)])]))
+     (if (empty? opts)
+       [:div.no-results "No results"]
+       (for [i opts]
+         [:div.option
+          {:key (pr-str i)
+           :on-click (fn [_] (on-change i))}
+          (label-fn i)]))]))

 (defn select [{:keys [on-search debounce-interval on-blur]}]
   (let [state (r/atom {:active false})


doc ids func and doc

doc ids func and doc

--- src/clojure/zensols/dataset/elsearch.clj
+++ src/clojure/zensols/dataset/elsearch.clj
@@ -164,10 +164,13 @@
          (esrsp/total-hits))))

 (defn document-ids
-  []
-  (->> (search {:query (q/match-all)
-                :fields []})
-       (map :id)))
+  "Return document IDs only.  The query default to `match_all`."
+  ([]
+   (document-ids (q/match-all)))
+  ([query]
+   (->> (search {:query query
+                 :fields []})
+        (map :id))))

 (defn documents
   "Return all documents as a lazy sequence."


Reduced median training cases back to 100.

--- src/clojush/problems/software/median.clj
+++ src/clojush/problems/software/median.clj
@@ -37,10 +37,10 @@
   [#_[(list [2 6 8] [2 8 6] [6 2 8] [6 8 2] [8 2 6] [8 6 2] ; Permutations of [2 6 8]
            [-5 0 5] [-5 5 0] [0 -5 5] [0 5 -5] [5 -5 0] [5 0 -5] ; Permutations of [-5 0 5]
            [23 0 0] [0 23 0] [0 0 23] [-31 0 0] [0 -31 0] [0 0 -31]) 18 0] ; Two zeroes
-   [(fn [] (repeatedly 3 #(- (lrand-int 201) 100))) 180 500] ;; Each input includes 3 integers in range [-100,100]
+   [(fn [] (repeatedly 3 #(- (lrand-int 201) 100))) 60 500] ;; Each input includes 3 integers in range [-100,100]
    [(fn [] (shuffle (conj (repeat 2 (- (lrand-int 201) 100))
-                          (- (lrand-int 201) 100)))) 90 300] ;; Edge cases where two of three are the same
-   [(fn [] (repeat 3 (- (lrand-int 201) 100))) 30 100] ;; Edge cases where all are the same
+                          (- (lrand-int 201) 100)))) 30 300] ;; Edge cases where two of three are the same
+   [(fn [] (repeat 3 (- (lrand-int 201) 100))) 10 100] ;; Edge cases where all are the same
    ])

 (defn test-and-train-data-from-domains


CMR-707: Change keyword search to use 'AND' instead of 'OR'

--- src/cmr/search/data/query_to_elastic.clj
+++ src/cmr/search/data/query_to_elastic.clj
@@ -136,7 +136,8 @@
                                                   query_string-reserved-characters-regex
                                                   "\\\\$1")
                               :analyzer :whitespace
-                              :default_field field}}}))
+                              :default_field field
+                              :default_operator :and}}}))

   cmr.search.models.query.StringCondition
   (condition->elastic


CMR-203: Added long-name

CMR-203: Added long-name

--- src/cmr/search/data/query_to_elastic.clj
+++ src/cmr/search/data/query_to_elastic.clj
@@ -87,7 +87,7 @@
   "Create filters for keyword search"
   [keywords]
   [;; entry-title, short-name
-   (keywords->name-filter :entry-title.lowercase :short-name.lowercase keywords 1.4)
+   (keywords->name-filter :long-name.lowercase :short-name.lowercase keywords 1.4)
    ;; project (ECHO campaign)
    (keywords->name-filter :project-ln.lowercase :project-sn.lowercase keywords 1.3)
    ;; platform


Name test correctly

Name test correctly

--- test/io/perun_test.clj
+++ test/io/perun_test.clj
@@ -272,7 +272,7 @@
                          :content "assortment 6"))

         (p/collection :renderer 'io.perun-test/render-collection)
-        (testing "assortment"
+        (testing "collection"
           (content-check :path "public/index.html"
                          :content "collection 7"))


fix testcase (a stray closing paren)

fix testcase (a stray closing paren)

--- test/linkification.clj
+++ test/linkification.clj
@@ -49,4 +49,4 @@
       "#hashtag lipsum http://example.org#anchor-name")
   (dcompare
       (linkify "lipsum http://example.org#anchor-name #hashtag")
-      "lipsum http://example.org#anchor-name #hashtag"))
+      "lipsum http://example.org#anchor-name #hashtag")


fix offset page

fix offset page

--- src/restaurant_inspections_api/services.clj
+++ src/restaurant_inspections_api/services.clj
@@ -63,9 +63,8 @@
     :businessName (when-let [businessName (:businessName params-map)]
                     (clojure.string/replace businessName #"\*" "%"))
     :zipCodes (when-let [zipCodes (:zipCodes params-map)]
-                ;(str "[\"" (clojure.string/replace zipCodes #"," "\",\"") "\"]")
-                (str/split zipCodes #",")
-                )))
+                (str/split zipCodes #","))
+    :page (* (:page params-map) (:perPage params-map))))

 (defn inspections-by-all
   "Retrieves and formats inspections, filtered by all, any, or no criteria."


DJSON-30 Fix broken test

DJSON-30 Fix broken test

- Misplaced `)` so test always passed
- Wrongly written test
- Change `use` to `:refer :all`

Signed-off-by: Alex Miller <99328387f8334f68433c424d2dfd83062f62754b@cognitect.com>

--- src/test/clojure/clojure/data/json_test.clj
+++ src/test/clojure/clojure/data/json_test.clj
@@ -1,6 +1,6 @@
 (ns clojure.data.json-test
-  (:use clojure.test)
-  (:require [clojure.data.json :as json]))
+  (:require [clojure.data.json :as json]
+            [clojure.test :refer :all]))

 (deftest read-from-pushback-reader
   (let [s (java.io.PushbackReader. (java.io.StringReader. "42"))]
@@ -266,7 +266,7 @@
   (is (= "{\"a\":1,\"b\":2}" (json/write-str (sorted-map :a 1 :b 2)))))

 (deftest object-keys-must-be-strings
-  (is (= "{\"1\":1,\"2\":2") (json/write-str (sorted-map 1 1 2 2))))
+  (is (= "{\"1\":1,\"2\":2}" (json/write-str (sorted-map 1 1 2 2)))))

 (deftest print-empty-objects
   (is (= "{}" (json/write-str {}))))


collisions

collisions

--- examples/yaw/pad_ball_4.clj
+++ examples/yaw/pad_ball_4.clj
@@ -368,6 +368,10 @@
    [:hitbox :test/ball-hitbox {:pos [0 0 0]
                                :scale 0.4
                                :length [1 1 1]}
+    ;; :collisions [[:pad-group1 :hitbox-top  #(react/dispatch [::ball-collision-top1])]
+    ;;              [:test/pad-group1 :test/pad-hitbox-middle-1 #(react/dispatch [::ball-collision-middle1])]
+    ;;              ... etc ...]
+
     [{:group-id :test/pad-group-1 :hitbox-id :test/pad-hitbox-top-1 :collision-handler #(react/dispatch [::ball-collision-top1])}
      {:group-id :test/pad-group-1 :hitbox-id :test/pad-hitbox-middle-1 :collision-handler #(react/dispatch [::ball-collision-middle1])}
      {:group-id :test/pad-group-1 :hitbox-id :test/pad-hitbox-bottom-1 :collision-handler #(react/dispatch [::ball-collision-bottom1])}


Update dependencies.

Update dependencies.

--- metlog-vault/project.clj
+++ metlog-vault/project.clj
@@ -12,18 +12,20 @@

   :source-paths ["src-server"]

-  :dependencies [[metlog-common "0.1.0-SNAPSHOT"]
-                 [org.clojure/clojure "1.7.0"]
-                 [org.clojure/clojurescript "0.0-3308"]
+  :dependencies [[org.clojure/clojure "1.7.0"]
+                 [org.clojure/clojurescript "1.7.145"]
                  [com.ksmpartners/sql-file "0.1.0"]
-                 [ring/ring-jetty-adapter "1.3.2"]
-                 [compojure "1.3.4"]
-                 [cljs-ajax "0.3.11"]
+                 [ring/ring-jetty-adapter "1.4.0"]
+                 [slester/ring-browser-caching "0.1.1"]
+                 [compojure "1.4.0"]
+                 [hiccup "1.0.5"]
+
                  [org.clojure/core.async "0.1.346.0-17112a-alpha"]
-                 [reagent "0.5.0"]
-                 [com.andrewmcveigh/cljs-time "0.3.5"]
-                 [hiccup "1.0.5"]
-                 [slester/ring-browser-caching "0.1.1"]]
+                 [cljs-ajax "0.5.0"]
+                 [reagent "0.5.1"]
+                 [com.andrewmcveigh/cljs-time "0.3.14"]
+
+                 [metlog-common "0.1.0-SNAPSHOT"]]

   :main ^:skip-aot metlog-vault.core
   :target-path "target/%s"


gfeature-row -> grow

gfeature-row -> grow

--- src-cljs/frontend/components/features.cljs
+++ src-cljs/frontend/components/features.cljs
@@ -178,7 +178,7 @@
         [:div.feature.feature-offset
          (common/feature-icon "scale")
          [:h4.text-center "Start free and scale without limit"]
-         [:p "Start with one build container for free, and dial up the capacity as you gfeature-row."]]
+         [:p "Start with one build container for free, and dial up the capacity as you grow."]]
         [:div.feature
          (common/feature-icon "free")
          [:h4.text-center "Free for OSS"]


tidy oop

tidy oop

--- src/doctopus/db.clj
+++ src/doctopus/db.clj
@@ -105,7 +105,7 @@
                      (dissoc :image))
                  (dissoc ent :image))))
   (belongs-to tentacles)
-  (entity-fields :name :uri :tentacle_name :body :mime_type))
+  (entity-fields :name :uri :tentacle_name :body :image :mime_type))

 (defn get-tentacle
   [name]
@@ -248,7 +248,7 @@
   ([]
    (update documents
            (set-fields {:search-vector (raw "to_tsvector('english', body)")})
-           (where {:uri [like "%html"]})))
+           (where {:mime_type [like "text%"]})))
   ([document]
    (update documents
            (set-fields {:search-vector (raw "to_tsvector('english', body)")})


fixed persistence middleware not sending the signal further when local storage is empty

--- src/frontend/persistence-middleware.cljs
+++ src/frontend/persistence-middleware.cljs
@@ -7,17 +7,21 @@
   "On load-signal middleware will load the model from storage and send the signal further with updated model to the component.
   Blacklist should contain model keys which will not be loaded from storage."
   [control load-signal storage key load-blacklist]
-  (fn control-reconcile
+  (fn wrapped-control
     [model signal dispatch]
     (if (= load-signal signal)
       (let [storage-model (get storage key :not-found)]
-        (when (not= storage-model :not-found)
+        (if (not= storage-model :not-found)
           (let [new-model (merge storage-model (select-keys model load-blacklist))]
             ; update model
             (dispatch [:reset-from-storage new-model])

             ; also let component handle the loaded state
-            (control new-model signal dispatch))))
+            (control new-model signal dispatch))
+
+          ; else - hand signal further to component
+          (control model signal dispatch)))
+
       ; else - hand signal further to component
       (control model signal dispatch))))


Fix spec generation for domains

Fix spec generation for domains

--- src/clj_chrome_devtools/impl/define.clj
+++ src/clj_chrome_devtools/impl/define.clj
@@ -50,6 +50,18 @@
              ~@(when-not (empty? opt-un)
                  `(:opt-un [~@(map (comp ns-kw :name) opt-un)])))))

+(defn spec-for-type [{type :type :as t}]
+  (if (:enum t)
+    ;; Enumerated type, just output the set of valid values
+    (into #{} (:enum t))
+
+    (case type
+      "object" (keys-spec (:properties t))
+      "string" `string?
+      "integer" `integer?
+      "number" `number?
+      "boolean" `boolean?
+      "array" `(s/coll-of ~(spec-for-type (:items t))))))

 (defmacro define-type-specs [domain]
   `(do
@@ -58,30 +70,13 @@

          `(do
             ;; If this is an object, create specs for basic type keys
-            ~@(for [{:keys [name type]} (:properties t)
-                    :when (#{"string" "number" "integer" "boolean"} type)]
+            ~@(for [{name :name :as property-type} (:properties t)
+                    :when (#{"string" "number" "integer" "boolean" "array"} type)]
                 `(s/def ~(ns-kw name)
-                   ~(case type
-                      "string" `string?
-                      "number" `number?
-                      "integer" `integer?
-                      "boolean" `boolean?)))
-            (s/def ~name-kw
-              ~(cond
-                 (:enum t)
-                 (into #{} (:enum t))
+                   ~(spec-for-type property-type)))
+            (s/def ~name-kw ~(spec-for-type t))))))

-                 (= "object" type)
-                 (keys-spec (:properties t))
-
-                 "string" `string?
-                 "integer" `integer?
-                 "number" `number?
-                 "boolean" `boolean?
-
-                 :default
-                 ::FIXME))))))
-
+(define-type-specs "DOM")

 (defmacro define-command-functions [domain]
   `(do
@@ -117,7 +112,16 @@
                                       :error error#}))
                      (:result result#))))))
             (s/fdef ~fn-name
-                    :args ~(keys-spec parameters)
+                    :args (s/or :no-args
+                                (s/cat)
+
+                                :just-params
+                                (s/cat :params ~(keys-spec parameters))
+
+                                :connection-and-params
+                                (s/cat
+                                 :connection (s/? connection/connection?)
+                                 :params ~(keys-spec parameters)))
                     :ret ~(keys-spec returns))))))

 (defmacro define-domain [domain]


remove debug log

remove debug log

--- src/cljs/dokkaa_builder/views/user.cljs
+++ src/cljs/dokkaa_builder/views/user.cljs
@@ -14,7 +14,6 @@
     (will-mount [_]
       (go
         (let [response (<! (api/get-access-tokens "dokkaa.io:8080"))]
-          (.log js/console response)
           (om/transact! app :api-tokens (fn [_] (json-decode (:body response)))))))

     om/IRenderState


sprite pos can take a vector or a vec2

sprite pos can take a vector or a vec2

--- src/cljs/infinitelives/pixi/sprite.cljs
+++ src/cljs/infinitelives/pixi/sprite.cljs
@@ -29,8 +29,11 @@
   ([sprite x y]
    (set! (.-position.x sprite) x)
    (set! (.-position.y sprite) y))
-  ([sprite [x y]]
-   (set-pos! sprite x y)))
+  ([sprite pos]
+   (if (vector? pos)
+     (set-pos! sprite (pos 0) (pos 1))
+     (set-pos! sprite (aget pos 0) (aget pos 1))
+     )))

 (defn set-anchor! [sprite x y]
   (set! (.-anchor sprite) (make-point x y)))


small fix

small fix

--- src/cljs/salava/core/ui/badge_grid.cljs
+++ src/cljs/salava/core/ui/badge_grid.cljs
@@ -65,7 +65,7 @@
                                              [:div.lefticon [:i {:class "fa fa-history"}] (t :badge/Expired)]
                                              [:a.righticon {:class "righticon expired" :on-click (fn [] (m/modal! [delete-badge-modal id state init-data]
                                                                                {:size :lg})) :title (t :badge/Delete)} [:i {:class "fa fa-trash"}]]])
-                                 [:a {:href "#" :on-click #(mo/open-modal [:badge :info] {:badge-id id} {:hide (fn [] (init-data state))})}
+                                 [:a {:href "#" :on-click #(do (.preventDefault %)(mo/open-modal [:badge :info] {:badge-id id} {:hide (fn [] (init-data state))}))}
                                   (if image_file
                                     [:div.media-left
                                      [:img.badge-img {:src (str "/" image_file)
@@ -78,6 +78,7 @@
                                   ]]
                                 [:div {:class (str "media-content " (if expired? "media-expired") (if revoked " media-revoked"))}
                                  [:a {:href "#" :on-click #(do
+                                                             (.preventDefault %)
                                                              (mo/open-modal [:badge :info] {:badge-id id} {
                                                                                :shown (fn [] (.replaceState js/history {} "Badge modal" (path-for (str "/badge?id=" id))))
                                                                                :hidden (fn []


Add header to the table.

Add header to the table.

--- src/clojure/my/stuff/fitlogger/main.clj
+++ src/clojure/my/stuff/fitlogger/main.clj
@@ -64,7 +64,13 @@
   (apply conj [:table-layout {:id :table,
                               :layout-width :fill,
                               :layout-weight 1
-                              :stretch-all-columns true}]
+                              :stretch-all-columns true}
+               [:table-row {}
+                [:text-view {:text "Date"}]
+                [:text-view {:text "Weight"}]
+                [:text-view {:text "BF%"}]
+                [:text-view {:text "Water%"}]
+                [:text-view {:text "Muscle%"}]]]
          (map (fn [[_ measurements]]
                 (format-measurements measurements))
               lst)))
@@ -102,7 +108,8 @@
 (defn update-table [activity key m]
   (let [idx (index-of-key key m)
         row (format-measurements (m key))]
-    (on-ui (.addView (find-view activity :table) (make-ui (*a) row) idx))
+    ;Increase idx so that we don't overwrite the header of the table.
+    (on-ui (.addView (find-view activity :table) (make-ui (*a) row) (inc idx)))
     row))

 (defn update-ui [activity date-key]


Doubled max points

Doubled max points

--- src/clojush/problems/software/grade.clj
+++ src/clojush/problems/software/grade.clj
@@ -198,7 +198,7 @@
 (def argmap
   {:error-function (grade-error-function grade-data-domains)
    :atom-generators grade-atom-generators
-   :max-points 800
+   :max-points 1600
    :max-genome-size-in-initial-program 200
    :evalpush-limit 800
    :population-size 1000


Fix build warnings by properly refering to macros in cljs.

Fix for
https://github.com/replikativ/kabel/issues/4#issuecomment-326000187
Thanks to

--- src/kabel/middleware/block_detector.cljc
+++ src/kabel/middleware/block_detector.cljc
@@ -1,6 +1,7 @@
 (ns kabel.middleware.block-detector
   "Block detection middleware for replikativ."
-  (:require #?(:clj [kabel.platform-log :refer [debug info warn error]])
+  (:require [kabel.platform-log #?@(:clj [:refer [debug info warn error]]
+                                    :cljs [:refer-macros [debug info warn error]])]
             [clojure.set :as set]
             #?(:clj [clojure.core.async :as async
                      :refer [<! >! >!! <!! timeout chan alt! go put!


add nope check in for

add nope check in for

--- kafka-clj/src/kafka_clj/consumer/util.clj
+++ kafka-clj/src/kafka_clj/consumer/util.clj
@@ -55,16 +55,17 @@
            (let [topic-data (get metadata topic)
                  by-broker (group-by second (map-indexed vector topic-data))]
              (into {}
-                   (for [[broker v] by-broker]
+                   (for [[broker v] by-broker :when (:host broker)]
                      ;here we have data {{:host "localhost", :port 1} [[0 {:host "localhost", :port 1}] [1 {:host "localhost", :port 1}]], {:host "abc", :port 1} [[2 {:host "abc", :port 1}]]}
                      ;doing map first v gives the partitions for a broker
-                     (try
-                       (let [offset-producer (get-create-offset-producer offset-producers broker conf)
-                             offsets-response (get-offsets offset-producer topic (map first v))]
-                         ;(info "offsets: " v)
-                         [broker (transform-offsets topic offsets-response conf)])
-                       (catch Exception e (do
-                                            (error e e)
-                                            (meta/black-list-producer! blacklisted-offsets-producers-ref {:host (:host broker) :port (:port broker)} e)
-                                            (spit "/tmp/blacklistoffsets" (str blacklisted-offsets-producers-ref " --- " {:host (:host broker) :port (:port broker)} "\n") :append true)
-                                            [broker nil])))))))))
+                     (do
+                       (try
+                         (let [offset-producer (get-create-offset-producer offset-producers broker conf)
+                               offsets-response (get-offsets offset-producer topic (map first v))]
+                           ;(info "offsets: " v)
+                           [broker (transform-offsets topic offsets-response conf)])
+                         (catch Exception e (do
+                                              (error e e)
+                                              (meta/black-list-producer! blacklisted-offsets-producers-ref {:host (:host broker) :port (:port broker)} e)
+                                              (spit "/tmp/blacklistoffsets" (str blacklisted-offsets-producers-ref " --- " {:host (:host broker) :port (:port broker)} "\n") :append true)
+                                              [broker nil]))))))))))


remove corrupt entries from build

remove corrupt entries from build

--- src-cljs/frontend/components/admin.cljs
+++ src-cljs/frontend/components/admin.cljs
@@ -130,6 +130,7 @@
     om/IRender
     (render [_]
       (let [fleet-state (->> (get-in app state/fleet-state-path)
+                             (filter #(-> % :ec2_instance_type not-empty)) ;; remove corrupt entries
                              (remove #(-> % :builder_tags (= ["os:none"])))
                              (sort-by :instance_id))
             summary-counts (get-in app state/build-system-summary-path)


Changed get-padded-strided-dimension to use ceiling function and match caffe

--- src/cortex/impl/layers/convolution.cljc
+++ src/cortex/impl/layers/convolution.cljc
@@ -49,8 +49,8 @@
   "http://caffe.berkeleyvision.org/tutorial/layers.html.  Returns the dimensions
 of the output of a conv-net ignoring channels."
   ^long [^long input-dim ^long pad ^long kernel-size ^long stride]
-  (long (+ (quot (- (+ input-dim (* 2 pad))  kernel-size)
-                 stride)
+  (long (+ (Math/ceil (/ (- (+ input-dim (* 2 pad))  kernel-size)
+                         stride))
            1)))


Put `-integer` back to using canned regex fn, `one-token-pattern`.

--- src/isla/parser.clj
+++ src/isla/parser.clj
@@ -55,8 +55,8 @@
 (defn -identifier [tokens] (one-token-pattern tokens #"(?!^is$)[A-Za-z]+" :identifier))

 (defn -integer [tokens]
-  (if (is-type #"[0-9]+" (first tokens))
-    {:node (nnode :integer [(Integer/parseInt (first tokens))]) :left-tokens (rest tokens)}))
+  (one-token-pattern tokens #"[0-9]+" :integer
+                     (fn [x] [(Integer/parseInt (first tokens))])))

 (defn -string [tokens]
   (one-token-pattern tokens #"'[A-Za-z0-9 ]+'" :string


A little more work on cli tool

A little more work on cli tool

--- src/joiner/main.clj
+++ src/joiner/main.clj
@@ -6,31 +6,36 @@
   (:use clojure.contrib.json)
   (:use clojure.contrib.command-line))

-(defn- save-doc [database doc]
-  (let [db (get-secure-database database)
-	existing
-	(with-db db
-	  (get-document (:_id doc)))]
-    (with-db db
-      (update-document (merge existing doc)))))

-(defn- attach-file [database doc file]
-  (with-db (get-secure-database database)
-    (update-attachment doc file)))
+(defn- update-doc [id doc file]
+  (let [existing (get-document (:_id (merge {:_id id} doc)))
+	updated-doc (update-document (merge existing doc))]
+    (if (nil? file)
+      updated-doc
+      (update-attachment updated-doc file))))

 (defn -main [& args]
   (with-command-line args
     "Joiner - bending CouchDB"
-    [[db "Database"]
-     [doc "Document to save"]
+    [[db "Database" nil]
+     [op "Operation: get, save, update or delete" nil]
+     [id "Document id"]
+     [doc "Document" "{}"]
      [file "File to attach"]
      remaining]
-    (if (nil? db)
-      (println "Specify database")
-      (if (nil? doc)
-	(println "Specify document")
-	(let [new-doc (save-doc db (read-json doc))]
-	  (if (nil? file)
-	    (println new-doc)
-	    (println (attach-file db new-doc file))))))))
+    (let [missing-options (filter #(nil? (:op %))
+				  [{:op db :name "db"} {:op op :name "op"}])]
+      (if (empty? missing-options)
+	(with-db (get-secure-database db)
+	  (let [json-doc (read-json doc)]
+	    (println
+	     (case (keyword op)
+		   :get (get-document id)
+		   :save (create-document json-doc)
+		   :update (update-doc id json-doc file)
+		   :delete (delete-document json-doc)
+		   (str "Unknown operation " op)))))
+	(println (str "Missing options: " (seq (map #(:name %) missing-options))))))))
+
+


updates

updates

--- files/lein/profiles.clj
+++ files/lein/profiles.clj
@@ -1,4 +1,6 @@
 {:ppedn {:dependencies [[org.clojure/clojure "1.6.0"]
                         [mvxcvi/puget "0.8.0"]]}
- :user {:dependencies [[proto-repl "0.3.1"]]
+ :user {:dependencies [[proto-repl "0.3.1"]
+                       [cljfmt "0.5.1"]]
+        :repl-options {:init (require 'cljfmt.core)}
         :plugins [[cider/cider-nrepl "0.17.0"]]}}


`hint` -> `tag` refactor

`hint` -> `tag` refactor

--- src/cljc/mikron/runtime/buffer_macros.cljc
+++ src/cljc/mikron/runtime/buffer_macros.cljc
@@ -18,13 +18,13 @@
      (~(symbol (str method "LE")) ~@args)
      (~(symbol (str method "BE")) ~@args)))

-(defn without-hint
-  "Removes the type hint metadata from `value`."
+(defn without-tag
+  "Removes the `tag` metadata from `value`."
   [value]
   (vary-meta value dissoc :tag))

-(defn without-primitive-hint
-  "Removes the primitive type hint metadata from `value`."
+(defn without-primitive-tag
+  "Removes the primitive `tag` metadata from `value`."
   [value]
   (vary-meta value (fn [{:keys [tag] :as meta}]
                      (cond-> meta
@@ -35,8 +35,8 @@
   [value]
   (or (symbol? value) (coll? value)))

-(defn with-runtime-hint
-  "Takes the metadata of `value` and returns a piece of code which reapplies it to what `value` evaluates to."
+(defn with-runtime-tag
+  "Takes the `tag` metadata of `value` and returns a piece of code which reapplies it to what `value` evaluates to."
   [value]
   `(if-not (can-have-metadata? ~value)
      ~value
@@ -49,8 +49,8 @@
     (if (compiler.util/cljs?)
       `(defprotocol ~interface-name
          ~@(map (fn [{:keys [op-name args docs]}]
-                  `(~(without-hint op-name)
-                    ~(into [(gensym "this")] (map without-hint args))
+                  `(~(without-tag op-name)
+                    ~(into [(gensym "this")] (map without-tag args))
                     ~@(when docs [docs])))
                 ops))
       `(do (definterface ~interface-name
@@ -65,11 +65,11 @@
                                                                    {:tag (symbol (str (ns-name *ns*) "." interface-name))})]
                                                        args)
                                                  (meta op-name))]
-                      `(defn ~(without-hint op-name)
+                      `(defn ~(without-tag op-name)
                          ~@(when docs [docs])
-                         {:inline (fn ~(mapv without-hint args)
+                         {:inline (fn ~(mapv without-tag args)
                                     `(~'~munged-name
-                                      ~~@(map (comp with-runtime-hint without-primitive-hint) args)))}
+                                      ~~@(map (comp with-runtime-tag without-primitive-tag) args)))}
                          ~args
-                         (~munged-name ~@(map without-hint args)))))
+                         (~munged-name ~@(map without-tag args)))))
                   ops)))))