adds tests for military-to-standard time formatting function

--- test/cljs/early_vote_site/utils_test.cljs
+++ test/cljs/early_vote_site/utils_test.cljs
@@ -7,3 +7,25 @@
     (let [start-str "2017-10-10T06:00:00.00Z"]
       (is (= "2017-10-10"
              (utils/format-date-string start-str))))))
+
+(deftest military-to-standard
+  (testing "pm times are formatted correctly"
+    (let [time "16:00:00"]
+      (is (= "4:00 PM"
+            (utils/military-to-standard time)))))
+  (testing "noon is formatted correctly"
+    (let [time "12:00:00"]
+      (is (= "12:00 PM"
+            (utils/military-to-standard time)))))
+  (testing "midnight is formatted correctly"
+    (let [time "00:00:00"]
+      (is (= "12:00 AM"
+            (utils/military-to-standard time)))))
+  (testing "single-digit hours are formatted correctly"
+    (let [time "09:00:00"]
+      (is (= "9:00 AM"
+            (utils/military-to-standard time)))))
+  (testing "double-digit morning hours are formatted correctly"
+    (let [time "10:00:00"]
+      (is (= "10:00 AM"
+            (utils/military-to-standard time))))))


Add test

Add test

--- test/clojars/integration/uploads_test.clj
+++ test/clojars/integration/uploads_test.clj
@@ -993,3 +993,29 @@
       (is (= "[Clojars] dantheman deployed org.clojars.dantheman/test 0.0.1" title))
       (is (re-find #"User 'dantheman' just deployed org.clojars.dantheman/test 0.0.1" body))
       (is (re-find #"https://clojars.org/org.clojars.dantheman/test/versions/0.0.1" body)))))
+
+(deftest user-can-deploy-a-pom-only-release
+  (-> (session (help/app-from-system))
+      (register-as "dantheman" "test@example.org" "password"))
+  (let [token (create-deploy-token (session (help/app-from-system)) "dantheman" "password" "testing")]
+    (deploy
+      {:coordinates '[org.clojars.dantheman/test "0.0.1"]
+       :pom-file (help/rewrite-pom (io/file (io/resource "test-0.0.1/test.pom"))
+                                   {:groupId "org.clojars.dantheman"})
+       :password  token})
+
+    (help/match-audit {:username "dantheman"}
+                      {:tag "deployed"
+                       :user "dantheman"
+                       :group_name "org.clojars.dantheman"
+                       :jar_name "test"
+                       :version "0.0.1"})
+
+    (-> (session (help/app-from-system))
+        (visit "/")
+        (fill-in [:#search] "test")
+        (press [:#search-button])
+        (within [:div.result
+                 :div
+                 :div]
+          (has (text? "org.clojars.dantheman/test 0.0.1"))))))


prompt select list

prompt select list

--- src/pretty/cli/prompt.clj
+++ src/pretty/cli/prompt.clj
@@ -44,7 +44,7 @@

     (let [term (Terminal/getTerminal)
           num-opts (count choices)
-          tip (if (= true first-rendering?) (c/dim " (Move with arrow up/down. Submit with ENTER)") "")]
+          tip (if (= true first-rendering?) (c/dim " (UP/DOWN move, ENTER submit)") "")]
       (println (str "[" (c/green "?") "] " question ":" tip))
       (doseq [opt (get-list-options choices selected)]
         (println opt))


allow name-of to print names of non-ugen objects via pr

--- src/overtone/sc/machinery/ugen/check.clj
+++ src/overtone/sc/machinery/ugen/check.clj
@@ -13,7 +13,9 @@
   (= (:rate ug) rate-int))

 (defn name-of [obj]
-  (overtone-ugen-name (:name obj)))
+  (if (:name obj)
+    (overtone-ugen-name (:name obj))
+    (with-out-str (pr obj))))

 (defn name-of? [obj name]
   (= (name-of obj) name))


Fix for cast-all; tests passing now

Fix for cast-all; tests passing now

--- src/semantic_csv/core.clj
+++ src/semantic_csv/core.clj
@@ -193,7 +193,8 @@
             (drop 1)
             (cast-all cast-fn rows)
             (cons (first rows)))
-     (let [cast-fns (into {} (map vector only cast-fn))]
+     (let [only (if (coll? only) only [only])
+           cast-fns (into {} (map vector only (repeat cast-fn)))]
        (cast-with cast-fns {:ignore-first ignore-first} rows)))))


remove old code

remove old code

--- src/cake.clj
+++ src/cake.clj
@@ -130,10 +130,7 @@
   {:arglists '([ns-forms* bindings body*])}
   [& forms]
   (let [[ns-forms [bindings & body]] (split-with (complement vector?) forms)
-        bindings (into ['opts 'cake/opts, 'project 'cake/project] bindings)
-        ;; ns-forms (for [[kname & args] ns-forms]
-        ;;            (cons (symbol (name kname)) (map #(list 'quote %) args)))
-        ]
+        bindings (into ['opts 'cake/opts, 'project 'cake/project] bindings)]
     `(bake* '~ns-forms ~(quote-if even? bindings) '~body)))

 (defmacro task-doc


adjustments

adjustments

--- ws/overall-network.clj
+++ ws/overall-network.clj
@@ -2,7 +2,7 @@

 ;; **
 ;;; # OVERALL NETWORK
-;;; In the following the complete network is studying by using a subset of measures explained in Section (ref). This worksheet compiles measures between 3 April 2015 and 3 May 2015 by computing statistics for hourly expansions, distributions over 30 days, as well as the average value at a time of day on the complete dataset.
+;;; In the following the complete network is studying by using a subset of measures explained in Section (ref). This worksheet compiles measures between 5 April 2015 and 15 April 2015 by computing statistics for hourly expansions, distributions over 30 days, as well as the average value at a time of day on the complete dataset.
 ;; **

 ;; @@


Adjust matting on kaleido

Adjust matting on kaleido

--- spectacles/src/spectacles/kaleidoscope.clj
+++ spectacles/src/spectacles/kaleidoscope.clj
@@ -51,8 +51,8 @@
   (draw-dots 300 300 1 (:ldots state) q/rect)
   (draw-dots (/ (q/width) 2) (/ (q/height) 2) -1 (:rdots state) q/ellipse)
   (q/fill 0 0 0 255)
-  (q/rect 0 0 (/ (q/width) 4) (q/height))
-  (q/rect (* 0.75 (q/width)) 0 (q/width) (q/height)))
+  (q/rect 0 0 (* 0.20 (q/width)) (q/height))
+  (q/rect (* 0.80 (q/width)) 0 (q/width) (q/height)))

 (defn update-position [m]


accept connections from within vpc

accept connections from within vpc

--- src/terraboot/cluster.clj
+++ src/terraboot/cluster.clj
@@ -193,11 +193,11 @@
              (cluster-security-group "admin-security-group" {}
                                      {:from_port 0
                                       :to_port 65535
-                                      :cidr_blocks (vec (vals (:public vpc/cidr-block)))}
+                                      :cidr_blocks [vpc/vpc-cidr-block]}
                                      {:from_port 0
                                       :to_port 65535
                                       :protocol "udp"
-                                      :cidr_blocks (vec (vals (:public vpc/cidr-block)))}
+                                      :cidr_blocks [vpc/vpc-cidr-block]}
                                      )

              (cluster-security-group "lb-security-group" {}


bug #5248 - updated REP contract address to match the re-deployed contract

Signed-off-by: Goran Jovic <fc686822162e6f379ea05b6f92d78d206147085c@gmail.com>

--- src/status_im/utils/ethereum/tokens.cljs
+++ src/status_im/utils/ethereum/tokens.cljs
@@ -41,7 +41,7 @@
                     :decimals 8}
                    {:symbol   :REP
                     :name     "Reputation"
-                    :address  "0xe94327d07fc17907b4db788e5adf2ed424addff6"
+                    :address  "0x1985365e9f78359a9B6AD760e32412f4a445E862"
                     :decimals 18}
                    {:symbol   :POWR
                     :name     "PowerLedger"


Add profile-updated event with proper success notification.

--- src/uxbox/data/users.cljs
+++ src/uxbox/data/users.cljs
@@ -39,6 +39,21 @@
   []
   (FetchProfile.))

+;; --- Profile Updated
+
+(defrecord ProfileUpdated [data]
+  rs/WatchEvent
+  (-apply-watch [_ state s]
+    (rx/of (profile-fetched data)))
+
+  rs/EffectEvent
+  (-apply-effect [_ state]
+    (udm/info! (tr "settings.profile-saved"))))
+
+(defn profile-updated
+  [data]
+  (ProfileUpdated. data))
+
 ;; --- Update Profile

 (defrecord UpdateProfile [data]
@@ -50,7 +65,7 @@
                    (rx/of)))]
       (->> (rp/req :update/profile data)
            (rx/map :payload)
-           (rx/map profile-fetched)
+           (rx/map profile-updated)
            (rx/catch rp/client-error? on-error)))))

 (def update-profile-schema


Remove limit-break dependency.

Remove limit-break dependency.

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -1,8 +1,7 @@
 {:user {:dependencies [[clj-stacktrace "0.2.5"]
                        [redl "0.1.0"]
                        [spyscope "0.1.2"]
-                       [slamhound "1.3.3"]
-                       [limit-break "0.1.0-SNAPSHOT"]]
+                       [slamhound "1.3.3"]]
         :plugins [[lein-difftest "1.3.7"]
                   [lein-drip "0.1.1-SNAPSHOT"]
                   [lein-clojars "0.9.1"]


Increases repl timeout and adds lein-deps-tree.

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -5,9 +5,11 @@
                   [lein-pprint "1.1.1"]
                   [slamhound "1.2.0"]
                   [lein-cljsbuild "0.1.9"]
+                  [lein-deps-tree "0.1.1"]
                   ;[lein-autodoc "0.9.0"]
                   [lein-marginalia "0.7.0"]
                   [lein-noir "1.2.0"]]
+        :repl-options {:timeout 40000}
         :injections [(let [orig (ns-resolve (doto 'clojure.stacktrace require)
                                             'print-cause-trace)
                            new (ns-resolve (doto 'clj-stacktrace.repl require)


Add test-refresh

Add test-refresh

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -8,6 +8,7 @@
     [jonase/eastwood "0.0.2"]
     [lein-expectations "0.0.7"]
     [lein-autoexpect "0.2.5"]
+    [com.jakemccrary/lein-test-refresh "0.13.0"]
     [lein-ancient "0.5.5"]]
   :repl-options {:timeout 300000}
   :aliases {"slamhound" ["run" "-m" "slam.hound"]}


Simplfied destructuring in renderattacktargets.

--- src-browser/simplestrat/renderstate.cljs
+++ src-browser/simplestrat/renderstate.cljs
@@ -366,8 +366,8 @@
                        (.drawCircle x y 6)))
         ]
     (doseq [actiontarget-pair attacktargets
-            :let [[action target] actiontarget-pair
-                  [px py ] (tilexy->pixelsxy [(:x target) (:y target)])]
+            :let [[action {x :x y :y}] actiontarget-pair
+                  [px py] (tilexy->pixelsxy [x y])]
             ]
       (renderfunc px py))))


make sure layer gets updated when the layer its target gets updated

--- src-cljs/frontend/components/canvas.cljs
+++ src-cljs/frontend/components/canvas.cljs
@@ -216,12 +216,28 @@
                                layer-id
                                (om/get-state owner :listener-key)
                                (fn [tx-report]
-                                 (om/refresh! owner))))
+                                 (om/refresh! owner)))
+      (fdb/add-attribute-listener (om/get-shared owner :db)
+                                  :layer/ui-id
+                                  (om/get-state owner :listener-key)
+                                  (fn [tx-report]
+                                    (let [targets (reduce (fn [acc datom]
+                                                            (if (= :layer/ui-id (:a datom))
+                                                              (conj acc (:v datom))
+                                                              acc))
+                                                          #{} (:tx-data tx-report))
+                                          db @(om/get-shared owner :db)]
+                                      (when (contains? targets
+                                                       (:layer/ui-target (d/entity db layer-id)))
+                                        (om/refresh! owner))))))
     om/IWillUnmount
     (will-unmount [_]
       (fdb/remove-entity-listener (om/get-shared owner :db)
                                   layer-id
-                                  (om/get-state owner :listener-key)))
+                                  (om/get-state owner :listener-key))
+      (fdb/remove-attribute-listener (om/get-shared owner :db)
+                                     :layer/ui-id
+                                     (om/get-state owner :listener-key)))
     om/IDisplayName (display-name [_] "Layer Group")
     om/IRender
     (render [_]


Remove the workflows button from build list

--- src-cljs/frontend/components/header.cljs
+++ src-cljs/frontend/components/header.cljs
@@ -48,20 +48,6 @@
           :kind :primary
           :size :small}
          "Follow Project")))))
-
-(defn show-workflows-link? [app]
-  (let [repo (get-in app [:navigation-data :repo])
-        workflows-enabled? (get-in app (conj state/feature-flags-path
-                                             :workflows))]
-    (boolean (and repo workflows-enabled?))))
-
-(defn workflows-link [app]
-  (let [{:keys [vcs_type org repo]} (:navigation-data app)]
-    (button/link
-     {:href (routes/v1-project-workflows-path vcs_type org repo)
-      :bordered? true
-      :size :small}
-     "Workflows")))

 (defn show-settings-link? [app]
   (and
@@ -387,9 +373,6 @@
                                                                                (get-in app state/user-organizations-path))
                                                         :nav-point (get-in app state/current-view-path)}
                                           :actions (cond-> []
-                                                     (show-workflows-link? app)
-                                                     (conj (workflows-link app))
-
                                                      (show-settings-link? app)
                                                      (conj (settings-link app owner))


force lazy seq when logging

force lazy seq when logging

--- src/clj/shale/nodes.clj
+++ src/clj/shale/nodes.clj
@@ -46,7 +46,7 @@
     (logging/info "Starting the node pool...")
     (let [node-provider (node-provider-from-config config)
           default-session-limit (or (:node-max-sessions config) 3)]
-      (logging/infof "Found nodes: %s" (node-providers/get-nodes node-provider))
+      (logging/infof "Found nodes: %s" (vec (node-providers/get-nodes node-provider)))
       (assoc cmp
              :node-provider node-provider
              :default-session-limit default-session-limit)))


Adding logical ops and combinators: not, complement, constantly, and identity

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -468,8 +468,29 @@
   "Returns a number one less than num."
   [x] (- x 1))

+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; predicates and logic ;;;;;;;;;;;;;;;;
+
+(defn not
+  "Returns true if x is logical false, false otherwise."
+  [x] (if x false true))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; fn stuff ;;;;;;;;;;;;;;;;
-;; at the moment only comp has the necessary pieces in place
+
+(defn identity [x] x)
+
+(defn complement
+  "Takes a fn f and returns a fn that takes the same arguments as f,
+  has the same effects, if any, and returns the opposite truth value."
+  [f]
+  (fn
+    ([] (not (f)))
+    ([x] (not (f x)))
+    ([x y] (not (f x y)))
+    ([x y & zs] (not (apply f x y zs)))))
+
+(defn constantly
+  "Returns a function that takes any number of arguments and returns x."
+  [x] (fn [& args] x))

 (defn comp
   "Takes a set of functions and returns a fn that is the composition


make missing protocol errors more informative, include the type name if the type is a ClojureScript type.

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -75,10 +75,20 @@
   argv as arguments"}
   *main-cli-fn* nil)

+(declare pr-str)
+
+(defn type [x]
+  (when-not (nil? x)
+    (.-constructor x)))
+
 (defn missing-protocol [proto obj]
-  (js/Error
-   (.join (array "No protocol method " proto
-                 " defined for type " (goog/typeOf obj) ": " obj) "")))
+  (let [ty (type obj)
+        ty (if (and ty (.-cljs$lang$type ty))
+             (pr-str ty)
+             (goog/typeOf obj))]
+   (js/Error.
+     (.join (array "No protocol method " proto
+                   " defined for type " ty ": " obj) ""))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; arrays ;;;;;;;;;;;;;;;;

@@ -416,10 +426,6 @@
          (recur y (first more) (next more))
          (= y (first more)))
        false)))
-
-(defn type [x]
-  (when-not (nil? x)
-    (.-constructor x)))

 (defn ^boolean instance? [t o]
   (js* "(~{o} instanceof ~{t})"))


Fixed issue #18: Add input box for a user name.

--- src/clouseau/server.clj
+++ src/clouseau/server.clj
@@ -114,6 +114,15 @@
             (form/text-field {:size "40" :class "form-control" :placeholder "Examples: 'bash', 'vim-enhanced', 'kernel', 'gnome-desktop'"} "package" (str package))
             [:div {:class "input-group-btn"}
                 (form/submit-button {:class "btn btn-default"} "Search")]]))
+
+(defn render-name-field
+    [user-name]
+    (form/form-to {:class "navbar-form navbar-left" :role "search"} [:get "/" ]
+        [:div {:class "input-group"}
+            ;[:span {:class "input-group-addon"} "Name"]
+            (form/text-field {:size "10" :class "form-control" :placeholder "User name"} "user-name" (str user-name))
+            [:div {:class "input-group-btn"}
+                (form/submit-button {:class "btn btn-default"} "Remember me")]]))

 (defn render-navigation-bar-section
     [package]
@@ -133,6 +142,9 @@
                         [:a {:href "/descriptions" :class "navbar-brand"} "All CCS descriptions"]
                     ] ; ./navbar-header
                 ] ; col ends
+                [:div {:class "col-md-3"}
+                    (render-name-field "")
+                    ]
             ] ; row ends
         ] ; /.container-fluid
 ]); </nav>


Allow random :knock-off-chip-off-the-old-block as long as history allows for enough distinct error vectors

--- src/clojush/pushgp/selection/preselection.clj
+++ src/clojush/pushgp/selection/preselection.clj
@@ -97,7 +97,7 @@
               limit (if (= outof :random) (nth knock-spec 2) nil)
               outof (if (= outof :random) (inc (lrand-int limit)) outof)
               diffs  (if (= diffs :random) (inc (lrand-int outof)) diffs)
-              changed (vec (filter #(or (< (count (:history %)) outof)
+              changed (vec (filter #(or (< (count (:history %)) diffs)
                                         (>= (count (distinct (take outof (:history %))))
                                             diffs))
                                    pop))]


Remove debugging default bot avatar

Remove debugging default bot avatar

--- src/braid/bots/client/views/bots_page.cljs
+++ src/braid/bots/client/views/bots_page.cljs
@@ -119,7 +119,7 @@
         admin? (subscribe [:current-user-is-group-admin?] [group-id])
         dragging? (r/atom false)
         error (r/atom nil)
-        new-bot (r/atom {:avatar "https://s3.amazonaws.com/chat.leanpixel.com/uploads/5730f31a-8b10-451d-a1b0-3c515045481c/ptero.gif"})
+        new-bot (r/atom {})
         state (r/atom :initial)
         bot-valid? (reaction (and
                                (and (string? (@new-bot :name))


Fix misplaced argument.

Fix misplaced argument.

--- src/afterglow/controllers/ableton_push.clj
+++ src/afterglow/controllers/ableton_push.clj
@@ -1471,7 +1471,7 @@
                                                     cue (get (:variables cue) var-index) (:id info))
                                true))
                            (handle-control-change [this controller message]
-                             (adjust-variable-value controller message cue (get (:variables cue) var-index)) (:id info))
+                             (adjust-variable-value controller message cue (get (:variables cue) var-index) (:id info)))
                            (handle-note-on [this controller message]
                              false)
                            (handle-note-off [this controller message]


Fix compatibility issue with latest LambdaCD version in test

--- test/lambdacd_cctray/sample_pipeline.clj
+++ test/lambdacd_cctray/sample_pipeline.clj
@@ -5,7 +5,7 @@
             [lambdacd.steps.manualtrigger :as manualtrigger]
             [lambdacd.core :as lambdacd]
             [ring.server.standalone :as ring-server]
-            [lambdacd.ui.ui-server :as ui]
+            [lambdacd.ui.core :as ui]
             [lambdacd.runners :as runners]
             [lambdacd-cctray.core :as cctray]
             [ring.util.response :as resp])


Fixed bug when calling zoom-interaction hook

sometimes given scene is null. Then we wont' call the hooks.

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

--- src/conexp/graphics/nodes_and_connections.clj
+++ src/conexp/graphics/nodes_and_connections.clj
@@ -274,7 +274,8 @@
     (proxy [GInteraction] []
       (event [#^GScene scn, evt, x, y]
 	(.event zoom-obj scn evt x y)
-	(call-hook-with scn :zoom-interaction)))))
+	(when scn
+	  (call-hook-with scn :zoom-interaction))))))

 (defn add-nodes-with-connections
   "Adds to scene scn nodes placed by node-coordinate-map and connected


Trigger is unnecessary.

Trigger is unnecessary.

--- test/onyx/health_test.clj
+++ test/onyx/health_test.clj
@@ -91,14 +91,6 @@
               :window/window-key :event-time
               :window/range [5 :minutes]
 	      :window/aggregation :onyx.windowing.aggregation/count}]
-	    triggers
-	    [{:trigger/window-id window-id
-	      :trigger/id :sync
-	      :trigger/refinement :onyx.refinements/accumulating
-	      :trigger/fire-all-extents? true
-	      :trigger/on :onyx.triggers/segment
-	      :trigger/threshold [15 :elements]
-	      :trigger/sync ::ignore}]

 	    workflow [[:in :my/inc] [:my/inc :out]]
 	    lifecycles [{:lifecycle/task :in
@@ -115,7 +107,6 @@
 						  :workflow workflow
 						  :lifecycles lifecycles
                                                   :windows windows
-                                                  :triggers triggers
 						  :task-scheduler :onyx.task-scheduler/balanced
 						  :metadata {:job-name :click-stream}}))
 	    _ (Thread/sleep 2000)


Add fn to set and reset search results

Add fn to set and reset search results

--- src/discuss/components/search/statements.cljs
+++ src/discuss/components/search/statements.cljs
@@ -13,9 +13,16 @@
             [discuss.utils.common :as lib]
             [om.dom :as dom]))

-(defn set-search-results! [statements]
+(defn set-search-results!
+  "Store the search results into the app-state."
+  [statements]
   (lib/update-state-item! :search :results (fn [_] statements))
   (nom/transact! parser/reconciler `[(search/results {:results ~statements})]))
+
+(defn remove-search-results!
+  "Reset the search results."
+  []
+  (set-search-results! {}))

 (defn- search-results
   "Handler which is called with the results from ElasticSearch. Extract statements
@@ -44,7 +51,7 @@
               [:div.col-sm-8
                [:p (vlib/safe-html content)]
                [:p [:span.btn.btn-sm.btn-primary
-                    {:on-click #(.log js/console origin)}
+                    {:on-click #(lib/store-origin! origin)}
                     (t :search :reuse)]]]
               [:div.col-sm-4
                [:div.text-right


remove debugging println

remove debugging println

--- src/cljs/conference_rating/conference.cljs
+++ src/cljs/conference_rating/conference.cljs
@@ -124,8 +124,7 @@
                                   :keywords? true
                                   :handler #(let [conference-id (:_id %)]
                                              (history/redirect-to (str "/conferences/" conference-id)))
-                                  :error-handler #(js/alert (str "could not create conference" %1))})
-  (println @form-data))
+                                  :error-handler #(js/alert (str "could not create conference" %1))}))

 (defn add-conference-page []
   (let [doc (atom {})]


added orphaned status to task list

added orphaned status to task list

--- src/cljs/swarmpit/component/task/list.cljs
+++ src/cljs/swarmpit/component/task/list.cljs
@@ -39,6 +39,7 @@
     "complete" (comp/label-blue value)
     "running" (comp/label-green value)
     "shutdown" (comp/label-grey value)
+    "orphaned" (comp/label-grey value)
     "rejected" (comp/label-red value)
     "failed" (comp/label-red value)))


Layout manager #41

Layout manager #41

--- src/flatgui/samples/forms/layoutdemopanel.clj
+++ src/flatgui/samples/forms/layoutdemopanel.clj
@@ -20,16 +20,16 @@
             [flatgui.widgets.scrollpanel :as scrollpanel]))

 (def layout-cfg
-  [[:name-label       [:name-editor :-]]
-   [:password-label   [:password-textfield :-]                      :show-chars-btn]
-   [:position-label   [:x :y :-]                                    :edit-pos-btn]
-   [:dimensions-label [[:w-label] [:w :---] [:h-label] [:h :--] :-] :edit-dim-btn]
-   [[:one :two :']    [:notes-entry :-|]]
-   [[:upper-ed :-']   [:notes-entry]]
-   [[:three :four]    [:notes-entry]]
-   [[:five :six :-.]  [:notes-entry]]
-   [[:long-editor :-] [:long-editor :-]]
-   [:bottom-labels    [[:bleft :<] [:bright :>]]]])
+  [[[:name-label :>]       [:name-editor :-]]
+   [[:password-label :>]   [:password-textfield :-]                      :show-chars-btn]
+   [:position-label        [:x :y :-]                                    :edit-pos-btn]
+   [:dimensions-label      [[:w-label] [:w :---] [:h-label] [:h :--] :-] :edit-dim-btn]
+   [[:one :two :']         [:notes-entry :-|]]
+   [[:upper-ed :-']        [:notes-entry]]
+   [[:three :four]         [:notes-entry]]
+   [[:five :six :-.]       [:notes-entry]]
+   [[:long-editor :-]      [:long-editor :-]]
+   [[:bottom-labels :<]    [:bleft :bright :-]]])

 (def demo-window
   (fg/defcomponent


Look up question and answer text before creating csv output

--- src/clj/collect_earth_online/db/projects.clj
+++ src/clj/collect_earth_online/db/projects.clj
@@ -758,12 +758,11 @@
   "Returns a list of every question answer combo like
    (question1:answer1 question1:answer2 question2:answer1)"
   [survey-questions]
-  (->> survey-questions
-       (mapcat (fn [group]
-                 (let [question-label (name (get group :question))]
-                   (map (fn [answer]
-                          (str question-label ":" (name (get answer :answer))))
-                        (get group :answers)))))))
+  (mapcat (fn [[_ {:keys [question answers]}]]
+            (map (fn [[_ {:keys [answer]}]]
+                   (str question ":" answer))
+                 answers))
+          survey-questions))

 (defn- count-answer [sample-size question-answers]
   (u/mapm (fn [[question answers]]
@@ -772,11 +771,12 @@

 (defn- get-value-distribution
   "Count the answers given, and return a map of {'question:answers' count}"
-  [samples]
+  [survey-questions samples]
   (count-answer (count samples)
                 (mapcat (fn [sample]
-                          (map (fn [[question-label answer]]
-                                 (str (name question-label) ":" (:answer answer)))
+                          (map (fn [[question-id {:keys [answerId]}]]
+                                 (let [{:keys [question answers]} (get survey-questions question-id)]
+                                   (str question ":" (get-in answers [(str answerId) :answer]))))
                                (:saved_answers sample)))
                         samples)))

@@ -821,7 +821,7 @@
                                                                      (prefix-keys "pl_" extra-plot-info))
                                                               text-headers
                                                               "")
-                                                    (map->csv (get-value-distribution samples)
+                                                    (map->csv (get-value-distribution survey-questions samples)
                                                               number-headers
                                                               0)))))
                               plots)]
@@ -847,9 +847,14 @@
 ;;; Dump raw
 ;;;

-(defn- extract-answers [value]
+(defn- extract-answers [survey-questions value]
   (if value
-    (reduce (fn [acc [k v]] (merge acc {(name k) (:answer v)})) {} value)
+    (reduce (fn [acc [k v]]
+              (let [{:keys [question answers]} (get survey-questions k)]
+                (merge acc {question
+                            (get-in answers [(str (:answerId v)) :answer])})))
+            {}
+            value)
     ""))

 (def sample-base-headers [:plotid
@@ -872,7 +877,9 @@
             text-headers     (concat sample-base-headers
                                      (get-ext-headers samples :extra_plot_info "pl_")
                                      (get-ext-headers samples :extra_sample_info "smpl_")
-                                     (map :question survey-questions))
+                                     (map (fn [[_ val]]
+                                            (:question val "not-found"))
+                                          survey-questions))
             headers-out      (->> text-headers
                                   (map #(-> % name csv-quotes))
                                   (str/join ",")
@@ -887,7 +894,7 @@
                                                                      (update :analysis_duration #(when % (str % " secs"))))
                                                                  (prefix-keys "pl_" extra-plot-info)
                                                                  (prefix-keys "smpl_" extra-sample-info)
-                                                                 (extract-answers saved-answers))
+                                                                 (extract-answers survey-questions saved-answers))
                                                           text-headers
                                                           ""))))
                                   samples)]


Show the production_type instead of the type for productions

--- src/cljs/mdr2/productions/in_production.cljs
+++ src/cljs/mdr2/productions/in_production.cljs
@@ -240,13 +240,13 @@

 (defn production [id]
-  (let [{:keys [uuid id title type state] :as production} @(rf/subscribe [::production id])]
+  (let [{:keys [uuid id production_type state] :as production} @(rf/subscribe [::production id])]
     [:tr
      [:td id]
      [:td [production-link production]]
-     [:td type]
+     [:td production_type]
      [:td state]
-     [:td {:width "11%"} [buttons production]]]))
+     [:td {:width "14%"} [buttons production]]]))

 (defn productions []
   (let [productions @(rf/subscribe [::productions-sorted])]
@@ -256,7 +256,7 @@
        [:tr
         [:th (tr [:dam])]
         [:th (tr [:title])]
-        [:th (tr [:type])]
+        [:th (tr [:production_type])]
         [:th (tr [:state])]
         [:th (tr [:action])]]]
       [:tbody


restore doc

restore doc

--- src/clojure/zensols/nlparse/config_parse.clj
+++ src/clojure/zensols/nlparse/config_parse.clj
@@ -23,7 +23,10 @@
 which creates a shift reduce parser that times out after a second (per
 sentence).

-To use a separate namespace for custom plug and play
+Note that arguments are option (the parenthetical portion of the form) and so
+is the namespace, which defaults to `zensols.nlparse.config`.  To use a
+separate namespace for custom plug and play To use a separate namespace for
+custom plug and play
 components (see [[zensols.nlparse.config/register-library]]) you can specify
 your own namespace with a `/`, for example:
 ```


cleaned up type hints, no reflection warnings

--- src/karras.clj
+++ src/karras.clj
@@ -3,18 +3,19 @@
   (:import [com.mongodb Mongo DB DBCollection BasicDBObject
             DBObject DBCursor DBAddress MongoOptions
             ObjectId]))
+
 (defn has-option? [options k]
   (boolean (some #{k} options)))

-(defn db-object [#^clojure.lang.IPersistentMap m]
+(defn db-object [m]
   (let [to-s #(if (keyword? %) (name %) (str %))
         to-v #(if (map? %) (db-object %) %)
-        r (BasicDBObject.)]
+        dbo  (BasicDBObject.)]
     (doseq [[k v] m]
-      (.put r #^String (to-s k) #^Object (to-v v)))
-    r))
+      (.put dbo (to-s k) (to-v v)))
+    dbo))

-(defn clojure-object [#^DBObject dbo]
+(defn clojure-object [dbo]
   (apply merge (map (fn [#^java.util.Map$Entry e]
                        (let [k (.getKey e)
                              v (.getValue e)]
@@ -24,16 +25,16 @@
                             v)}))
                     (seq dbo))))

-(defn connect [host & [port]]
-  (Mongo. #^String host (or port 27017)))
+(defn connect [#^String host & [port]]
+  (Mongo. host (int (or port 27017))))

-(defn mongo-db [connection name]
+(defn mongo-db [#^Mongo connection #^String name]
   (.getDB connection name))

 (defn collection
-  ([db collection-name]
+  ([#^DB db collection-name]
      (.getCollection db collection-name))
-  ([mongo db-name collection-name]
+  ([#^Mongo mongo db-name collection-name]
      (collection (.getDB mongo db-name) collection-name)))

 (defn drop-collection [#^DBCollection collection]
@@ -46,18 +47,19 @@
     (map clojure-object
          (.insert collection #^java.util.List (map db-object objs)))))

-(defn update [#^DBCollection collection query obj & [upsert? multi?]]
-  (clojure-object (.update collection
-                           #^DBObject (db-object query)
-                           #^DBObject (db-object obj)
-                           (boolean upsert?)
-                           (boolean multi?))))
+(defn update [#^DBCollection collection query obj & options]
+  (let [o? #(has-option? options %)]
+    (clojure-object (.update collection
+                             (db-object query)
+                             (db-object obj)
+                             (o? :upsert)
+                             (o? :multi)))))

-(defn upsert [#^DBCollection collection query obj]
-  (update collection query obj true))
+(defn upsert [collection query obj]
+  (update collection query obj :upsert))

-(defn update-all [#^DBCollection collection query obj]
-  (update collection query obj false true))
+(defn update-all [collection query obj]
+  (update collection query obj :multi))

 (defn include-keys [& keys]
   (apply merge (map (fn [k] {k 1}) (remove nil? keys))))
@@ -77,7 +79,7 @@
         cursor (if count? (.count cursor) cursor)]
     (map clojure-object cursor)))

-(defnk fetch [#^DBCollection collection query :limit nil :skip nil :include nil :exclude nil :order-by nil :count false]
+(defnk fetch [collection query :limit nil :skip nil :include nil :exclude nil :order-by nil :count false]
   (search* collection
            query
            (merge (apply include-keys include) (apply exclude-keys exclude))
@@ -86,7 +88,7 @@
            order-by
            count))

-(defnk fetch-all [#^DBCollection collection :limit nil :skip nil :order-by nil :count false]
+(defnk fetch-all [collection :limit nil :skip nil :order-by nil :count false]
   (search* collection
            nil
            nil
@@ -99,7 +101,7 @@
   (.findOne collection (ObjectId. s)))

 (defn distinct-values [#^DBCollection collection s]
-  (seq (.distinct collection #^String (name s))))
+  (seq (.distinct collection (name s))))

 (defn delete [#^DBCollection collection obj]
   (.remove collection (db-object obj)))
@@ -142,8 +144,10 @@
 (defn ensure-index
   [#^DBCollection collection fields & options]
   (let [o? #(has-option? options %)]
-    (.ensureIndex collection (db-object fields)
-                  (o? :force) (o? :unique))))
+    (.ensureIndex collection #^DBObject
+                  (db-object fields)
+                  (boolean (o? :force))
+                  (boolean (o? :unique)))))

 (defn drop-index [#^DBCollection collection o]
   (.dropIndex collection #^DBObject (db-object o)))


Comment for the future.

Comment for the future.

--- src/appengine_magic/services/datastore.clj
+++ src/appengine_magic/services/datastore.clj
@@ -381,6 +381,8 @@
         ;; XXX: The keyword and str composition below works
         ;; around a weird Clojure bug (see
         ;; http://groups.google.com/group/clojure-dev/browse_thread/thread/655f6e7d1b312f17).
+        ;; TODO: This bug is fixed in Clojure 1.3 (see
+        ;; http://dev.clojure.org/jira/browse/CLJ-693).
         clj-properties (set (map (comp keyword str)
                                  (filter #(= (:tag (meta %)) :clj) properties)))]
     `(defrecord ~name ~properties


Fixed AQL science-keywords case sensitive search.

--- src/cmr/search/services/aql/conversion.clj
+++ src/cmr/search/services/aql/conversion.clj
@@ -36,13 +36,13 @@
                 :entry-id {:name :entry-id :type :string}
                 :associated-difs {:name :associated-difs :type :string}
                 :scienceKeywords {:name :science-keywords :type :science-keywords}
-                :categoryKeyword {:name :category :type :string}
-                :topicKeyword {:name :topic :type :string}
-                :termKeyword {:name :term :type :string}
-                :variableLevel1Keyword {:name :variable-level-1 :type :string}
-                :variableLevel2Keyword {:name :variable-level-2 :type :string}
-                :variableLevel3Keyword {:name :variable-level-3 :type :string}
-                :detailedVariableKeyword {:name :detailed-variable :type :string}
+                :categoryKeyword {:name :science-keywords.category :type :string}
+                :topicKeyword {:name :science-keywords.topic :type :string}
+                :termKeyword {:name :science-keywords.term :type :string}
+                :variableLevel1Keyword {:name :science-keywords.variable-level-1 :type :string}
+                :variableLevel2Keyword {:name :science-keywords.variable-level-2 :type :string}
+                :variableLevel3Keyword {:name :science-keywords.variable-level-3 :type :string}
+                :detailedVariableKeyword {:name :science-keywords.detailed-variable :type :string}
                 :TwoDCoordinateSystemName {:name :two-d-coordinate-system-name :type :string}
                 :spatial {:name :spatial :type :spatial}}
    :granule {:dataCenterId {:name :provider-id :type :collection-query :coll-tag :dataCenterId}


[#952] Remove commented code per review

[#952] Remove commented code per review

--- backend/src/akvo/lumen/config.clj
+++ backend/src/akvo/lumen/config.clj
@@ -10,7 +10,6 @@
   (assert (:lumen-keycloak-client-secret env)
           (error-msg "LUMEN_KEYCLOAK_CLIENT_SECRET"))
   (assert (:lumen-keycloak-url env) (error-msg "LUMEN_KEYCLOAK_URL"))
-  #_(assert (:exporter-api-url env) (error-msg "EXPORTER_API_URL"))
   (assert (:lumen-file-upload-path env) (error-msg "LUMEN_FILE_UPLOAD_PATH"))
   (when-not (= "yes" (:ci-build env))
     (assert (:lumen-email-password env) (error-msg "LUMEN_EMAIL_PASSWORD"))


render as a frame event handler

render as a frame event handler

--- spinning/src/app/core.cljs
+++ spinning/src/app/core.cljs
@@ -44,7 +44,7 @@
    {:app {:name "Spinning"
           :version "0.1.0"
           :measure-fps? false
-          :simple-animation? false
+          :rendering? false
           }
     :ech {:env-keyboard-key nil
           :env-mouse-click nil
@@ -128,9 +128,9 @@

 ;; -----------------------------------------------------------------------------
-;; Simple Animation Cycle
+;; Render Cycle

-(defn animate [timestamp state]
+(defn render! [timestamp state]
   (let [app-name (get-in state [:app :name])
         env-time (get-in state [:env :time])
         fps (get-in state [:env :frames-per-second])
@@ -141,45 +141,15 @@
     (set! (.-innerText (app-div))
           (string/join ", " [app-name fps env-time timestamp mouse-pos]))))

-(declare request-simple-animation)
+(defn on-env-animation-frame [timestamp]
+  (render! timestamp @state)
+  (get-in @state [:app :rendering?]))

-(defn simple-animation-cycle [timestamp]
-  (when (get-in @state [:app :simple-animation?])
-    (request-simple-animation)
-    (animate timestamp @state)))
+(defn start-rendering! []
+  (poly/listen-animation-frame! on-env-animation-frame))

-(def request-simple-animation (partial poly/request-animation-frame
-                                       simple-animation-cycle))
-
-(defn setup-simple-animation! []
-  (swap! state assoc-in [:app :simple-animation?] true)
-  (request-simple-animation))
-
-(defn teardown-simple-animation! []
-  (swap! state assoc-in [:app :simple-animation?] false))
-
-
-;; -----------------------------------------------------------------------------
-;; Simple Render Cycle
-
-(defn render []
-  ;Update the dom
-  true)
-
-(defn request-frame [f]
-  (poly/request-animation-frame f))
-
-(declare step)
-
-(def request-step (partial request-frame step))
-
-(defn step [timestamp]
-  (request-step)
-  (render))
-
-(defn simple-render-cycle [timestamp]
-  (poly/request-animation-frame simple-render-cycle)
-  (render))
+(defn stop-rendering! []
+  (swap! state assoc-in [:app :rendering?] false))

 ;; -----------------------------------------------------------------------------
@@ -190,11 +160,11 @@
   (poly/set-title! (get-in @state [:app :name]))
   (setup-event-channels!)
   (setup-event-subscriptions!)
-  (setup-simple-animation!))
+  (start-rendering!))

 (defn teardown []
   (console/info "teardown")
-  (teardown-simple-animation!)
+  (stop-rendering!)
   (teardown-event-subscriptions!)
   (teardown-event-channels!))


start text layout functions

start text layout functions

--- src/cljs/infinitelives/pixi/pixelfont.cljs
+++ src/cljs/infinitelives/pixi/pixelfont.cljs
@@ -68,13 +68,13 @@
               (recur l (+ xp w 1.0 koff) yp c (conj sprite-set sprite))
               (conj sprite-set sprite))))))))

-(defn add-text! [batch font-key text]
-  (doseq [spr (make-char-sprite-set font-key text)]
+(defn add-text! [batch font-key text tint]
+  (doseq [spr (make-char-sprite-set font-key text tint)]
     (.addChild batch spr)))

-(defn change-text! [batch font-key text]
+(defn change-text! [batch font-key text tint]
   (clear-text! batch)
-  (add-text! batch font-key text))
+  (add-text! batch font-key text tint))

 (defn make-text [font-key text & {:keys [tint scale anchor rotation
                                          x y visible
@@ -123,6 +123,75 @@
         (when r (recur r))))
     batch))

+(defn string-width
+  "return the width of this text in this font (in unit pixels)."
+  [font-key text]
+  (let [{:keys [font kerning space]} (get-font font-key)]
+    (+
+     ;; char sizes
+     (reduce + (for [c text]
+                 (if (= " " c)
+                   space
+                   ((:size (font c)) 0))))
+
+     ;; kerning adjustments
+     (reduce + (map (comp kerning str) text (subs text 1)))
+
+     ;; char spacing
+     (dec (count text)))))
+
+(defn char-fits? [font-key x left right char]
+  (let [{:keys [font kerning space]} (get-font font-key)
+        {:keys [size]} (font char)]
+    (if (< (+ x size)) (+ x size) left)))
+
+(defn regex-modifiers
+  "Returns the modifiers of a regex, concatenated as a string."
+  [re]
+  (str (if (.-multiline re) "m")
+       (if (.-ignoreCase re) "i")))
+
+(defn re-pos
+  "Returns a vector of vectors, each subvector containing in order:
+   the position of the match, the matched string, and any groups
+   extracted from the match."
+  [re s]
+  (let [re (js/RegExp. (.-source re) (str "g" (regex-modifiers re)))]
+    (loop [res []]
+      (if-let [m (.exec re s)]
+        (recur (conj res (vec (cons (.-index m) m))))
+        res))))
+
+
+(defn word-beginnings-ends
+  "given a string of words:
+
+  'this is a string of words'
+
+  return the slice position of the end of each word as a vector
+
+  [4 7 9 16 19 25]
+  "
+  [s]
+  (map
+   (fn [[n t]] [n (+ n (count t))])
+   (re-pos #"\S+" s)))
+
+(defn how-many-words-fit [font-key text ends size]
+  (loop [n 0
+         [e & r] ends]
+    (let [words (subs text 0 e)
+          width (string-width font-key words)
+          ]
+      (log "words" words width r n size
+           )
+      (if (and (< width size) r)
+        (recur (inc n) r)
+        n))))
+
+
+
+
 (comment
   (infinitelives.pixi.pixelfont/load-pixel-font :test-font :test [["A" 146 89 140 97] ["B" 154 89 148 97]])


using countdown timer in task

using countdown timer in task

--- src/clojure/com/example/gt/metime/main.clj
+++ src/clojure/com/example/gt/metime/main.clj
@@ -9,8 +9,9 @@
             [neko.threading :refer [on-ui]])
   (:import [android.widget CursorAdapter TextView LinearLayout]
            android.graphics.Color
-           [android.os SystemClock Handler]
+           [android.os SystemClock CountDownTimer]
            java.util.Calendar
+           java.util.concurrent.TimeUnit
            [android.app Activity DialogFragment]
            android.view.View
            [android.app DatePickerDialog DatePickerDialog$OnDateSetListener]
@@ -20,7 +21,19 @@
 (declare date-picker)
 (declare time-picker)

-;(def my-handler (Handler.))
+(defn create-counter-class [text-time-view millis-in-future countdown-timer-interval]
+  (proxy [CountDownTimer] [millis-in-future countdown-timer-interval]
+    (onTick [millis-until-finished]
+      (on-ui
+        (config
+          text-time-view
+          :text
+          (str (format "%02d:%02d:%02d"
+                       (.toHours TimeUnit/MICROSECONDS millis-until-finished)
+                       (- (.toMinutes TimeUnit/MICROSECONDS millis-until-finished) (.toMinutes TimeUnit/HOURS (.toHours TimeUnit/MICROSECONDS millis-until-finished)))
+                       (- (.toSeconds TimeUnit/MICROSECONDS millis-until-finished) (.toSeconds TimeUnit/MINUTES (.toMinutes TimeUnit/MICROSECONDS millis-until-finished))))))))
+    (onFinish []
+      (on-ui config text-time-view :text "Completed."))))

 (defrecord Task [date name duration date-index])

@@ -34,31 +47,19 @@
                           (into [] (map-indexed (fn [i ele] (apply ->Task (concat [(first sorted-map-data)] ele [i]))) (second sorted-map-data))))
                         lst)))

-(defn create-update-timer-method [event-timer-view start-time time-swap ]
-  (defn update-timer-method []
-    (let [time-in-millis (- (SystemClock/uptimeMillis) start-time)
-          final-time (+ time-swap time-in-millis)
-          total-seconds (mod final-time 1000)
-          minutes (quot total-seconds 1000)
-          seconds (mod total-seconds 60)
-          milliseconds (mod final-time 1000)]
-      (config event-timer-view :text (str "" minutes ":" (format "%02d" seconds) ":" (format "%02d" milliseconds))))))
-
-;myHandler.postDelayed(this, 0);
-
 (defn make-date-adapter []
   (adapters/ref-adapter
     (fn [_]
       [:linear-layout {:id-holder   true
                        :orientation :vertical}
        [:text-view {:id ::date-tv}]
-       [:linear-layout {:id ::event-ll
-                        :id-holder true
+       [:linear-layout {:id          ::event-ll
+                        :id-holder   true
                         :orientation :horizontal}
         [:text-view {:id ::event-tv}]
         [:text-view {:id ::time-tv}]
-        [:button {:id ::event-btn
-                  :text  "start",
+        [:button {:id   ::event-btn
+                  :text "start",
                   ;:on-click
                   }]
         ]])
@@ -68,12 +69,13 @@
             event-text-view (find-view event-linear-layout-view ::event-tv)
             event-timer-view (find-view event-linear-layout-view ::time-tv)
             event-button-view (find-view event-linear-layout-view ::event-btn)
-            my-handler (Handler.)]
+            timer (create-counter-class event-timer-view 180000 1000)]
+
         ;symptom of mutability
         (config date-text-view :visibility (if (= (:date-index task) 0) View/VISIBLE View/GONE))
         (config date-text-view :text (str (:date task)))

-        (config event-button-view :on-click (fn [_] (.postDelayed my-handler (create-update-timer-method event-timer-view 0 0) 0)))
+        (config event-button-view :on-click (fn [_] (.start timer)))
         (config event-text-view :text (str (:name task) " " (:duration task) " " (:date-index task)))))
     listing
     sorted-map-array-to-array-task))
@@ -106,8 +108,6 @@

 (defn set-elmt-text [activity elmt s]
   (on-ui (config (find-view activity elmt) :text s)))
-
-

 (defn update-ui [activity]
   (set-elmt-text activity ::name ""))


this change was causing a weird exception in nimbus, reverting it.

--- src/clj/backtype/storm/daemon/common.clj
+++ src/clj/backtype/storm/daemon/common.clj
@@ -239,7 +239,7 @@
   (->> (get storm-conf TOPOLOGY-METRICS-CONSUMER-REGISTER)
        (map #(get % "class"))
        (number-duplicates)
-       (map #(str Constants/METRICS_COMPONENT_ID_PREFIX "_" %))))
+       (map #(str Constants/METRICS_COMPONENT_ID_PREFIX %))))

 (defn metrics-consumer-bolt-specs [components-ids-that-emit-metrics storm-conf]
   (let [inputs (->> (for [comp-id components-ids-that-emit-metrics]


Rename widget store

Rename widget store

--- src/cljs/dashboard_clj/widgets/core.cljs
+++ src/cljs/dashboard_clj/widgets/core.cljs
@@ -2,13 +2,13 @@
   (:require-macros [reagent.ratom :refer [reaction]])
   (:require [re-frame.core :as rf]))

-(def widget (atom {}))
+(def widget-store (atom {}))

 (defn register-widget [name w]
-  (swap! widget assoc name w))
+  (swap! widget-store assoc name w))

 (defn setup-widget [{:keys [:data-source :type] :as w}]
   (if data-source
     (let [data (rf/subscribe [:app-db data-source])]
-      [(get @widget type) (merge w {:data data})])
-    ((get @widget type) w)))
+      [(get @widget-store type) (merge w {:data data})])
+    ((get @widget-store type) w)))


small fix

small fix

--- src/cljs/salava/social/ui/dashboard.cljs
+++ src/cljs/salava/social/ui/dashboard.cljs
@@ -148,7 +148,7 @@
         [:div
          [:i.fa.fa-chevron-down.icon] (if welcome-tip  (str (t :core/Welcometo) " " site-name (t :core/Service)) (str (t :core/Welcometo) " " (session/get :site-name) " " (get-in @state [:user-profile :user :first_name] "") "!"))]]
        [:div.collapse.hidden-content {:id "hidden" }
-        [:p "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."]
+        [:p "Some description here..."]
         ]
        ]]]))

@@ -350,7 +350,7 @@
        [:span.title.help (t :core/Help)]]
       [:div.content
        [:p  {:style {:font-size "20px" :color "black"} } (t :social/Iwantto)]
-       [:div.content[:a {:href (str (path-for "/user/profile/") (session/get-in [:user :id]))}[:p (t :social/Iwanttoseeprofile)]]
+       [:div [:a {:href (str (path-for "/user/profile/") (session/get-in [:user :id]))}[:p (t :social/Iwanttoseeprofile)]]
        [:a {:href (str (path-for "/user/edit/profile"))}[:p (t :social/Iwanttoeditprofile)]]
        [:a {:href (str (path-for "/badge"))}[:p (t :social/Iwanttoseemysbadges)]]
        [application-button "link"]


Experiment more with meta-errors

Experiment more with meta-errors

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -1029,7 +1029,7 @@
         gc2b-diff (diff c2 gc2b)
         gc2c-diff (diff c2 gc2c)]
     (assoc ind :diversifying
-      (and ;(not (some #{0} [gc1a-diff gc1b-diff gc2a-diff gc2b-diff]))
+      (and ;(not (some zero? [gc1a-diff gc1b-diff gc1c-diff gc2a-diff gc2b-diff gc2c-diff]))
            (not (some #{gc1a-diff} [gc2a-diff gc2b-diff gc2c-diff]))
            (not (some #{gc1b-diff} [gc2a-diff gc2b-diff gc2c-diff]))
            (not (some #{gc1c-diff} [gc2a-diff gc2b-diff gc2c-diff]))


Safeguard notify-join: only allow if already prepared and not already joined

--- src/onyx/log/commands/notify_join_cluster.clj
+++ src/onyx/log/commands/notify_join_cluster.clj
@@ -8,11 +8,15 @@
             [clojure.data :refer [diff]]
             [onyx.extensions :as extensions]))

+(defn already-joined? [replica entry]
+  (boolean (get (set (:peers replica))
+                (:observer (:args entry)))))
+
 (s/defmethod extensions/apply-log-entry :notify-join-cluster :- Replica
   [{:keys [args] :as entry} :- LogEntry replica]
   (let [prepared (get (map-invert (:prepared replica)) (:observer args))]
     (assert (not= prepared (:observer args)))
-    (if prepared
+    (if (and prepared (not (already-joined? replica entry)))
       (-> replica
           (update-in [:accepted] merge {prepared (:observer args)})
           (update-in [:prepared] dissoc prepared))
@@ -30,15 +34,16 @@

 (s/defmethod extensions/reactions :notify-join-cluster :- Reactions
   [entry old new diff peer-args]
-  (cond (and (= (vals diff) (remove nil? (vals diff)))
-             (= (:id peer-args) (:observer diff)))
-        [{:fn :accept-join-cluster
-          :args diff}]
-        (get (set (:peers old)) (:observer (:args entry)))
-        []
-        (= (:id peer-args) (:observer (:args entry)))
-        [{:fn :abort-join-cluster
-          :args {:id (:observer (:args entry))}}]))
+  (let [success? (and (= (vals diff) (remove nil? (vals diff)))
+                      (= (:id peer-args) (:observer diff)))]
+    (cond success?
+          [{:fn :accept-join-cluster
+            :args diff}]
+          (already-joined? old entry)
+          []
+          (= (:id peer-args) (:observer (:args entry)))
+          [{:fn :abort-join-cluster
+            :args {:id (:observer (:args entry))}}])))

 (s/defmethod extensions/fire-side-effects! :notify-join-cluster :- State
   [{:keys [args message-id]} old new diff {:keys [monitoring] :as state}]


day 19 part two

day 19 part two

--- src/adventofcode/day19.clj
+++ src/adventofcode/day19.clj
@@ -31,3 +31,12 @@
                    (mapcat #(apply-replacement molecule %))
                    (into #{})
                    count))
+
+(def part-two (loop [m molecule
+                     c 0]
+                (if (= m "e")
+                  c
+                  (let [r (->> replacements
+                               (filter #(not= -1 (.indexOf m (second %))))
+                               first)]
+                    (recur (apply #(str/replace-first m %2 %1) r) (inc c))))))


Clear old OSC cue bindings if creating sample show


Fix can-can tilt-max parameter.

Fix can-can tilt-max parameter.

--- src/afterglow/examples.clj
+++ src/afterglow/examples.clj
@@ -1150,14 +1150,14 @@
         pan-min (params/bind-keyword-param pan-min Number 0)
         pan-max (params/bind-keyword-param pan-max Number 0)
         tilt-min (params/bind-keyword-param tilt-min Number -30)
-        tilt-max (params/bind-keyword-param pan-max Number 30)
+        tilt-max (params/bind-keyword-param tilt-max Number 30)
         pan-ratio (params/build-param-formula Number #(/ (* 4 %1) %2) bars cycles)
         tilt-ratio (params/build-param-formula Number #(/ %1 %2) bars cycles)
         fx (for [head [{:key :blade-1 :phase 0.0 :pan-offset 2}
                        {:key :blade-2 :phase 0.2 :pan-offset 1}
                        {:key :blade-3 :phase 0.6 :pan-offset -1}
                        {:key :blade-4 :phase 0.8 :pan-offset -2}
-                       {:key :blade-5 :phase 0.4 :tilt-offset 20}]]
+                       {:key :blade-5 :phase 0.4 :tilt-offset 10}]]
              (let [head-phase (params/build-param-formula Number #(* % (:phase head 0)) stagger)
                    tilt-osc (oscillators/sine :interval :bar :interval-ratio tilt-ratio :phase head-phase)
                    head-tilt-min (params/build-param-formula Number #(+ % (:tilt-offset head 0)) tilt-min)


cleanup

cleanup

--- src/server/daveconservatoire/server/core.cljs
+++ src/server/daveconservatoire/server/core.cljs
@@ -1,12 +1,11 @@
 (ns daveconservatoire.server.core
   (:require-macros [cljs.core.async.macros :refer [go]])
   (:require [cljs.nodejs :as nodejs]
-            [cljs.core.async :as async :refer [chan <! put! promise-chan]]
+            [cljs.core.async :refer [chan <! put! promise-chan]]
             [cljs.reader :refer [read-string]]
             [cljs.pprint]
             [cljs.spec :as s]
             [cognitect.transit :as ct]
-            [com.rpl.specter :as st :include-macros true]
             [common.async :refer-macros [<? go-catch]]
             [daveconservatoire.server.data :as d]
             [daveconservatoire.server.parser :as parser]
@@ -132,7 +131,7 @@
 (ex/get app "/google-login"
   (passport/authenticate "google" {:scope ["openid profile email"]}))

-(.get app "/google-return"
+(ex/get app "/google-return"
   (passport/authenticate "google" auth-redirects))

 (ex/get app "/facebook-login"


Add type hint.

Add type hint.

--- test/dsbdp/test/data_processing_dsl_tests.clj
+++ test/dsbdp/test/data_processing_dsl_tests.clj
@@ -11,7 +11,8 @@
     :doc "Unit tests for data processing DSL"}
   dsbdp.test.data-processing-dsl-tests
   (:require [clojure.test :refer :all]
-            [dsbdp.data-processing-dsl :refer :all]))
+            [dsbdp.data-processing-dsl :refer :all])
+  (import (java.util ArrayList List)))

 (def byte-array-test-data
   "We use the byte array representation of a captured UDP packet as byte array test data."
@@ -126,7 +127,7 @@

 (deftest java-list-to-java-map-with-additional-operation-and-two-data-values-test
   (let [expected {"quotient" 2}
-        input-data (reduce (fn [l v] (.add l v) l) (java.util.ArrayList.) [1 8 1 1 1 4 1 1])
+        input-data (reduce (fn [l v] (.add ^List l v) l) (ArrayList.) [1 8 1 1 1 4 1 1])
         dsl-expression {:output-type :java-map
                         :rules [['quotient '(/ (nth 1) (nth 5))]]}
         data-processing-fn (create-data-processing-fn dsl-expression)


:bug: Revert db pool size.

:bug: Revert db pool size.

--- backend/src/uxbox/db.clj
+++ backend/src/uxbox/db.clj
@@ -27,7 +27,7 @@
                   (assoc :password password)
                   (str))]
     (log/info "creating connection pool with" dburi)
-    (pg/pool dburi {:system system :max-size 1})))
+    (pg/pool dburi {:system system :max-size 8})))

 (defstate pool
   :start (create-pool cfg/config system))


Added service aliases

Added service aliases

--- streamable.clj
+++ streamable.clj
@@ -18,6 +18,15 @@
 (kdb/defdb db sqll)
 (kcore/defentity episodes)

+(def service-aliases
+  {"Netflix Instant" "NFLX"
+   "Amazon Prime Instant" "AMZN"
+   "Epix" "EPIX"
+   "Fandor" "FNDR"
+   "Hulu Plus" "HULU"
+   "Snagfilms" "SNAG"
+   "XFINITY Streampix" "XFTY"})
+
 (defn assoc-streaming-options [ep]
   (println "Getting options for" (:media_title ep))
   (flush)
@@ -32,6 +41,7 @@
          :body
          vals
          (map :friendlyName)
+         (map #(or (service-aliases %) %))
          set
          (assoc ep :streaming_options))))


beginnings of try-each

beginnings of try-each

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

--- acqEngine/src/org/micromanager/mm.clj
+++ acqEngine/src/org/micromanager/mm.clj
@@ -142,6 +142,14 @@
     `(if (and ~@args_)
       (~f ~@args_))))

+(defn try-each [fns]
+  "Attempt to run each fn in fns, and if they fail,
+   then report at end."
+  (let [errs (atom nil)]
+    (doseq [fun fns]
+      (try (fun)
+           (catch Throwable t (swap! errs conj t))))))
+
 (defn get-default-devices
   "Get the list of default (core) devices."
   []


Integrate hubzilla posting

Integrate hubzilla posting

--- src/defragment/feed.clj
+++ src/defragment/feed.clj
@@ -254,7 +254,10 @@
   (->> out-oggs-path
        (get-files rss-base-url db-path python-path duration-path)
        (xml-feedify rss-self-url)
-       (spit rss-out-file)))
+       (spit rss-out-file))
+  (->> out-oggs-path
+       (get-files rss-base-url db-path python-path duration-path)
+       (hubzilla/post-all hubzilla)))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -306,9 +309,8 @@
         (-> "/home/cust/spaz/src/fake-rss.edn"
             slurp
             edn/read-string)]
-    (->> out-oggs-path
-         (get-files rss-base-url db-path python-path duration-path)
-         (hubzilla/post-all hubzilla)))
+    ;;do stufff
+    )


CMR-4841: Log the first 255 characters of the response body. (#496)

* CMR-4841: Log the first 255 characters of the response body.

* CMR-4841: Changed a name.

* CMR-4841: Addressed the PR comments: changed .length to count; logged warning instead of info.

--- transmit-lib/src/cmr/transmit/metadata_db.clj
+++ transmit-lib/src/cmr/transmit/metadata_db.clj
@@ -331,7 +331,15 @@
                                 :throw-exceptions false
                                 :headers (ch/context->http-headers context)}))
         status (int (:status response))
-        body (json/decode (:body response))
+        ;; For CMR-4841 - log the first 255 characters of the response body if
+        ;; the parsing of the html throws exception.
+        response-body (:body response)
+        response-body-logged (subs response-body 0 (min 255 (count response-body)))
+        body (try
+               (json/decode response-body)
+               (catch Exception e
+                 (warn "Exception occurred while parsing the response body: " response-body-logged)
+                 (throw e)))
         {:strs [concept-id revision-id]} body]
     (case status
       422


CMR-1812: Fixing compilation error.

CMR-1812: Fixing compilation error.

--- search-app/src/cmr/search/results_handlers/atom_results_handler.clj
+++ search-app/src/cmr/search/results_handlers/atom_results_handler.clj
@@ -205,8 +205,8 @@
             :size (when size (str size))
             :original-format (metadata-format->atom-original-format metadata-format)
             :data-center provider-id
-            :start-date (parse-elastic-datetime start-date)
-            :end-date (parse-elastic-datetime end-date)
+            :start-date (acl-rhh/parse-elastic-datetime start-date)
+            :end-date (acl-rhh/parse-elastic-datetime end-date)
             :atom-links atom-links
             :orbit orbit
             :orbit-calculated-spatial-domains orbit-calculated-spatial-domains


better arg name

better arg name

--- src/midje/util/thread_safe_var_nesting.clj
+++ src/midje/util/thread_safe_var_nesting.clj
@@ -1,7 +1,7 @@
 (ns midje.util.thread-safe-var-nesting)

-(defn push-safely [the-var fakes]
-  (alter-var-root the-var (partial cons fakes)))
+(defn push-safely [the-var some-sequence]
+  (alter-var-root the-var (partial cons some-sequence)))

 (defn pop-safely [the-var]
   (alter-var-root the-var rest))


simpler with 'are', more reasonable w/ 'hundreds'

--- src/pc/views/blog/blue_ocean_made_of_ink.clj
+++ src/pc/views/blog/blue_ocean_made_of_ink.clj
@@ -2,7 +2,7 @@

 (defn blue-ocean-made-of-ink []
   {:title "Our blue ocean is made of ink."
-   :blurb "For every single designer or developer using an app to prototype their product, there's a thousand using pen and paper..."
+   :blurb "For every single designer or developer using an app to prototype their product, there are hundreds using pen and paper."
    :author "Danny"
    :body
    (list
@@ -21,7 +21,7 @@
      [:p [:a {:href "http://www.teslamotors.com/blog/all-our-patent-are-belong-you"} "Elon Musk"]
          " said that about Telsa last year.
          Prototyping stands on similar shores.
-         For every single designer or developer using an app to prototype their product, there's a thousand using pen and paper."]]
+         For every single designer or developer using an app to prototype their product, there are hundreds using pen and paper."]]

     [:article
      [:h3 "Can we compete with paper?"]


Fix up error-404

Fix up error-404

--- src/langnostic/core.clj
+++ src/langnostic/core.clj
@@ -135,7 +135,7 @@
   (GET "/feed/atom/by-tag/:tag" [tag] (atom-feed (posts/find-by-tag tag)))

   (route/resources "/static/")
-  (route/not-found (fn [req] (error-404 (get-in req [:session :user])))))
+  (route/not-found (fn [req] (error-404))))

 (defn -main
   ([] (-main "8000"))


Check early if project.clj could not be found

--- src/leiningen/droid.clj
+++ src/leiningen/droid.clj
@@ -61,6 +61,8 @@
      (help #'droid))
   ([project & [cmd & args]]
      (init-hooks)
+     (when (and (nil? project) (not (#{"new" "help" "init"} cmd)))
+       (abort "Subtask" cmd "should be run from the project folder."))
      (some-> project
              android-parameters
              (execute-subtask cmd args))))
@@ -68,8 +70,6 @@
 (defn execute-subtask
   "Executes a subtask defined by `name` on the given project."
   [project name args]
-  (when (and (nil? project) (not (#{"new" "help" "init"} name)))
-    (abort "Subtask" name "should be run from the project folder."))
   (case name
     ;; Standalone tasks
     "new" (if (< (count args) 2)


added unit test for submitting inactive topology

--- test/clj/backtype/storm/integration_test.clj
+++ test/clj/backtype/storm/integration_test.clj
@@ -1,7 +1,7 @@
 (ns backtype.storm.integration-test
   (:use [clojure test])
   (:import [backtype.storm.topology TopologyBuilder])
-  (:import [backtype.storm.generated InvalidTopologyException])
+  (:import [backtype.storm.generated InvalidTopologyException SubmitOptions TopologyInitialStatus])
   (:import [backtype.storm.testing TestWordCounter TestWordSpout TestGlobalCount
               TestAggregatesCounter TestConfBolt AckFailMapTracker])
   (:use [backtype.storm bootstrap testing])
@@ -276,6 +276,50 @@
   (emit-bolt! collector [1] :anchor [tuple tuple])
   (ack! collector tuple))

+(def bolt-prepared? (atom false))
+(defbolt prepare-tracked-bolt [] {:prepare true}
+  [conf context collector]
+  (reset! bolt-prepared? true)
+  (bolt
+   (execute [tuple]
+            (ack! collector tuple))))
+
+(def spout-opened? (atom false))
+(defspout open-tracked-spout ["val"]
+  [conf context collector]
+  (reset! spout-opened? true)
+  (spout
+   (nextTuple [])))
+
+(deftest test-submit-inactive-topology
+  (with-tracked-cluster [cluster]
+    (let [[feeder checker] (ack-tracking-feeder ["num"])
+          tracked (mk-tracked-topology
+                   cluster
+                   (topology
+                    {"1" (spout-spec feeder)
+                     "2" (spout-spec open-tracked-spout)}
+                    {"3" (bolt-spec {"1" :shuffle} prepare-tracked-bolt)}))]
+      (reset! bolt-prepared? false)
+      (reset! spout-opened? false)
+
+      (submit-local-topology-with-opts (:nimbus cluster)
+        "test"
+        {}
+        (:topology tracked)
+        (SubmitOptions. TopologyInitialStatus/INACTIVE))
+      (.feed feeder [1])
+      (Thread/sleep 5000)
+      (is (= 0 (global-amt (-> tracked :cluster :backtype.storm.testing/track-id) "spout-emitted")))
+      (is (not @bolt-prepared?))
+      (is (not @spout-opened?))
+
+      (.activate (:nimbus cluster) "test")
+      (tracked-wait tracked 1)
+      (checker 1)
+      (is @bolt-prepared?)
+      (is @spout-opened?))))
+
 (deftest test-acking-self-anchor
   (with-tracked-cluster [cluster]
     (let [[feeder checker] (ack-tracking-feeder ["num"])


query.om-next: Add Om Next query disambiguation algorithm

This algorithm merges compatible queries recursively and splits
conflicting queries into non-conflicting groups. It then returns
a relatively minimal sequence of such groups, each of which can be
used as a standalone Om Next query without swalling results of
conflicting queries under the same key in the query result map.

--- src/main/workflo/macros/query/om_next.cljc
+++ src/main/workflo/macros/query/om_next.cljc
@@ -6,7 +6,11 @@
             #?(:cljs [workflo.macros.util.js :refer [resolve]])
             [workflo.macros.specs.om-query :as om-query]
             [workflo.macros.specs.parsed-query :as parsed-query]
-            [workflo.macros.query.bind :refer [path?]]))
+            [workflo.macros.query.bind :refer [path?]]
+            [workflo.macros.query.om-util :as om-util]))
+
+
+;;;; Om Next query generation

 (s/def ::property-query-from-parsed-property
@@ -95,3 +99,213 @@
    (query parsed-query #?(:cljs :cljs :clj :clj)))
   ([parsed-query gen-type]
    (into [] (map #(property-query % gen-type)) parsed-query)))
+
+
+;;;; Om Next query disambiguation
+
+
+(declare merge-query-exprs)
+(declare disambiguate)
+
+
+(defn- detect-query-merge-conflicts
+  [path expr-1 expr-2]
+  (cond
+    ;; Parameterized vs. unparameterized
+    (not= (om-util/param-expr? expr-1)
+          (om-util/param-expr? expr-2))
+    (throw (ex-info (str "Conflicting parameterized vs. unparameterized "
+                         "queries at " path)
+                    {:path path
+                     :expressions [expr-1 expr-2]}))
+
+    ;; Conflicting parameters
+    (and (om-util/param-expr? expr-1)
+         (om-util/param-expr? expr-2)
+         (not= (om-util/param-map expr-1)
+               (om-util/param-map expr-2)))
+    (throw (ex-info (str "Conflicting parameters in queries at " path)
+                    {:path path
+                     :expressions [expr-1 expr-2]}))
+
+    ;; Join with ... and non-...
+    (and (om-util/join-expr? expr-1)
+         (om-util/join-expr? expr-2)
+         (or (= '... (om-util/join-target expr-1))
+             (= '... (om-util/join-target expr-2)))
+         (not= (om-util/join-target expr-1)
+               (om-util/join-target expr-2)))
+    (throw (ex-info (str "Conflicting recursive and non-recursive "
+                         "join queries at " path)
+                    {:path path
+                     :expressions [expr-1 expr-2]}))
+
+    ;; Join with limited recursion and no limited recursion
+    (and (om-util/join-expr? expr-1)
+         (om-util/join-expr? expr-2)
+         (not= (number? (om-util/join-target expr-1))
+               (number? (om-util/join-target expr-2))))
+    (throw (ex-info (str "Conflicting join queries with limited recursion and "
+                         "no limited recursion at " path)
+                    {:path path
+                     :expressions [expr-1 expr-2]}))
+
+    ;; Ident vs. non-ident
+    (not= (om-util/ident-expr? expr-1)
+          (om-util/ident-expr? expr-2))
+    (throw (ex-info (str "Conflicting ident vs. non-ident queries at " path)
+                    {:path path
+                     :expressions [expr-1 expr-2]}))
+
+    ;; Different idents
+    (and (om-util/ident-expr? expr-1)
+         (om-util/ident-expr? expr-2)
+         (not= expr-1 expr-2))
+    (throw (ex-info (str "Conflicting ident queries at " path)
+                    {:path path
+                     :expressions [expr-1 expr-2]}))))
+
+
+(defmulti ^:private merge-query-exprs
+  (fn [path expr-1 expr-2]
+    (detect-query-merge-conflicts path expr-1 expr-2)
+    (if (= expr-1 expr-2)
+      :identical
+      [(om-util/expr-type expr-1)
+       (om-util/expr-type expr-2)])))
+
+
+(defmethod merge-query-exprs :identical
+  [_ expr-1 expr-2]
+  {:pre [(= expr-1 expr-2)]}
+  ;; Identical expressions -> pick either
+  expr-1)
+
+
+(defmethod merge-query-exprs [:keyword :keyword]
+  [_ expr-1 expr-2]
+  {:pre [(= expr-1 expr-2)]}
+  ;; Identical keywords -> pick either
+  expr-1)
+
+
+(defmethod merge-query-exprs [:limited-recursion :limited-recursion]
+  [_ expr-1 expr-2]
+  ;; Two limited recursions -> pick the one that recurses deeper
+  (max expr-1 expr-2))
+
+
+(defmethod merge-query-exprs [:keyword :join]
+  [_ expr-1 expr-2]
+  ;; Keyword vs. join -> pick the join (it returns more information)
+  expr-2)
+
+
+(defmethod merge-query-exprs [:join :keyword]
+  [_ expr-1 expr-2]
+  ;; Join vs. keyword -> pick the join (it returns more information)
+  expr-1)
+
+
+(defmethod merge-query-exprs [:join :join]
+  [path expr-1 expr-2]
+  {:pre [(= (om-util/dispatch-key expr-1)
+            (om-util/dispatch-key expr-1))]}
+  {(merge-query-exprs (conj path :join-source)
+                      (om-util/join-source expr-1)
+                      (om-util/join-source expr-2))
+   (let [target-1 (om-util/join-target expr-1)
+         target-2 (om-util/join-target expr-2)]
+     (if (and (sequential? target-1) (sequential? target-2))
+       (first (disambiguate (conj path :join-target)
+                            (into [] cat [target-1 target-2])
+                            {:throw-on-conflicts? true}))
+       (merge-query-exprs (conj path :join-target)
+                          target-1 target-2)))})
+
+(defmethod merge-query-exprs [:param :param]
+  [path expr-1 expr-2]
+  {:pre [(= (om-util/dispatch-key expr-1)
+            (om-util/dispatch-key expr-2))
+         (= (om-util/param-map expr-1)
+            (om-util/param-map expr-2))]}
+  (list (merge-query-exprs (conj path :param-query)
+                           (om-util/param-query expr-1)
+                           (om-util/param-query expr-2))
+        (om-util/param-map expr-1)))
+
+
+(defn- try-merge-query-exprs
+  [path expr-1 expr-2 throw-on-conflicts?]
+  (if throw-on-conflicts?
+    (merge-query-exprs path expr-1 expr-2)
+    (try
+      (merge-query-exprs path expr-1 expr-2)
+      (catch #?(:clj Exception :cljs js/Error) error
+        nil))))
+
+
+(defn- disambiguate-query-expr
+  [path expr]
+  (case (om-util/expr-type expr)
+    :join  {(om-util/join-source expr)
+            (let [join-target (om-util/join-target expr)]
+              (if (sequential? join-target)
+                (first (disambiguate (conj path :join-target)
+                                     (om-util/join-target expr)
+                                     {:throw-on-conflicts? true}))
+                join-target))}
+    :param (list (disambiguate-query-expr (conj path :param-query)
+                                    (om-util/param-query expr))
+                 (om-util/param-map expr))
+    expr))
+
+
+(defn- merge-or-append-query-expr
+  [path exprs expr {:keys [throw-on-conflicts?]
+                    :or   {throw-on-conflicts? false}
+                    :as   opts}]
+  (loop [exprs-out []
+         exprs-to-try exprs]
+    (if (empty? exprs-to-try)
+      (conj exprs-out expr)
+      (if-some [merged-expr (try-merge-query-exprs path
+                                                   (first exprs-to-try) expr
+                                                   throw-on-conflicts?)]
+        (into exprs-out cat [[merged-expr] (rest exprs-to-try)])
+        (recur (conj exprs-out (first exprs-to-try))
+               (rest exprs-to-try))))))
+
+
+(defn- disambiguate-query-exprs
+  [path exprs opts]
+  (letfn [(disambiguate-query-expr-at-index [index expr]
+            (disambiguate-query-expr (conj path index) expr))
+          (merge-or-append-query-expr* [exprs-out expr]
+            (merge-or-append-query-expr path exprs-out expr opts))]
+    (->> exprs
+         (map-indexed disambiguate-query-expr-at-index)
+         (reduce merge-or-append-query-expr* []))))
+
+
+(defn- spread-query-exprs-into-query-seq
+  [query-seq exprs]
+  (reduce (fn [query-seq' [index expr]]
+            (update query-seq' index (comp vec conj) expr))
+          query-seq
+          (map-indexed vector exprs)))
+
+
+(defn disambiguate
+  "Disambiguates a query and returns a sequence of non-conflicting
+   queries that together correspond ask for the same information
+   as the original query."
+  ([query]
+   (disambiguate [] query {}))
+  ([query opts]
+   (disambiguate [] query opts))
+  ([path query opts]
+   (reduce (fn [query-seq [key exprs]]
+             (->> (disambiguate-query-exprs (conj path key) exprs opts)
+                  (spread-query-exprs-into-query-seq query-seq)))
+           [] (group-by om-util/dispatch-key query))))


Remove comment

Remove comment

--- src/matchmaker_sparql/evaluation/setup.clj
+++ src/matchmaker_sparql/evaluation/setup.clj
@@ -80,11 +80,6 @@
         first
         :count)))

-(comment
-  (let [{{:keys [graph]} :data} config]
-    (println (stencil/render-file "templates/evaluation/setup/count_contracts" {:graph graph}))
-    #_(sparql/select-query endpoint )))
-
 (defn count-awarded-contracts
   []
   (count-query "templates/evaluation/setup/count_contracts"))


SER-1338 | Add necessary imports

SER-1338 | Add necessary imports

--- test/vignette/storage/static_assets_test.clj
+++ test/vignette/storage/static_assets_test.clj
@@ -1,9 +1,11 @@
 (ns vignette.storage.static-assets-test
   (:require [midje.sweet :refer :all]
             [org.httpkit.client :as http]
+            [vignette.storage.core :refer :all]
+            [vignette.storage.local :refer :all]
+            [vignette.storage.static-assets :as sa]
             [vignette.storage.protocols :refer :all]
-            [vignette.storage.static-assets :as sa]
-            ))
+  ))

 (facts :static-assets :get-original
      (let [store (create-image-storage ..disk-store..)]


remove extra paren from highcharts recipe;

--- recipes/highcharts/src/cljs/highcharts/core.cljs
+++ recipes/highcharts/src/cljs/highcharts/core.cljs
@@ -31,12 +31,12 @@
    })

 (defn home-render []
-  [:div {:style {:min-width "310px" :max-width "800px"
+  [:div {:style {:min-width "310px" :max-width "800px"
                  :height "400px" :margin "0 auto"}}])

 (defn home-did-mount [this]
   (js/Highcharts.Chart. (reagent/dom-node this)
-                        (clj->js chart-config))))
+                        (clj->js chart-config)))

 (defn home []
   (reagent/create-class {:reagent-render home-render
@@ -45,4 +45,3 @@
 (defn ^:export main []
   (reagent/render [home]
                   (.getElementById js/document "app")))
-


Test for /usr/bin/gcc44 instead of use which

--- config/software/gecode.clj
+++ config/software/gecode.clj
@@ -17,7 +17,7 @@
 ;;

 (let
-  [env (if (= 0 (get (clojure.java.shell/sh "/bin/sh" :args [ "-c" "which g++44" ] :return-map true) :exit))
+  [env (if (= 0 (get (clojure.java.shell/sh "/usr/bin/test" :args [ "-f" "/usr/bin/gcc44" ] :return-map true) :exit))
          { "CC" "gcc44" "CXX" "g++44" }
          { })]


fix write earliest

fix write earliest

--- kafka-clj/src/kafka_clj/fetch.clj
+++ kafka-clj/src/kafka_clj/fetch.clj
@@ -102,7 +102,7 @@
   (with-size buff write-fetch-request-header topics state))

-(defn write-offset-request-message [^ByteBuf buff {:keys [topics max-offsets] :or {max-offsets 10}}]
+(defn write-offset-request-message [^ByteBuf buff {:keys [topics use-earliest max-offsets] :or {max-offsets 10 use-earliest false}}]
   "
 	OffsetRequest => ReplicaId [TopicName [Partition Time MaxNumberOfOffsets]]
 	  ReplicaId => int32
@@ -122,7 +122,7 @@
       (do
         (-> buff
             (.writeInt (int partition))
-            (.writeLong -1)
+            (.writeLong (if use-earliest -2 -1))
             (.writeInt (int max-offsets))))))

   buff)


try optional args via map keys when making blocks

hoping to make this easier to test by allowing some of
the keys to be overridden by an options map

--- src/block_chain/blocks.clj
+++ src/block_chain/blocks.clj
@@ -17,13 +17,16 @@
   (sha256 (block-hashable header)))

 (defn generate-block
-  [transactions]
-  {:header {:parent-hash (chain/latest-block-hash)
-            :transactions-hash (transactions-hash transactions)
-            :target (chain/next-target)
-            :timestamp (current-time-seconds)
-            :nonce 0}
-   :transactions transactions})
+  ([transactions] (generate-block transactions {}))
+  ([transactions {:keys [parent-hash target timestamp nonce chain]}]
+   {:header {:parent-hash (or parent-hash
+                              (chain/latest-block-hash
+                               (or chain @chain/block-chain)))
+             :transactions-hash (transactions-hash transactions)
+             :target (or target (chain/next-target))
+             :timestamp (or timestamp (current-time-seconds))
+             :nonce (or nonce 0)}
+    :transactions transactions}))

 (defn meets-target? [{{target :target hash :hash} :header}]
  (< (hex->int hash) (hex->int target)))


(maint) - Add exception handler around message sending so that we don't drop the server into a bad state on a bad message

--- src/puppetlabs/cthun/connection_states.clj
+++ src/puppetlabs/cthun/connection_states.clj
@@ -113,8 +113,12 @@
   "Process a message directed at a connected client"
   [host ws message-body]
   (doseq [websocket (parse-endpoints (:endpoints message-body) @endpoint-map)]
-    (let [modified-body (assoc message-body :sender (:endpoint (get (get @connection-map host) ws)))]
-      (jetty-adapter/send! websocket (cheshire/generate-string modified-body))))
+    (try
+      (let [modified-body (assoc message-body :sender (:endpoint (get (get @connection-map host) ws)))]
+        (jetty-adapter/send! websocket (cheshire/generate-string modified-body)))
+      (catch Exception e (log/warn (str "Exception raised while trying to process a client message: "
+                              (.getMessage e)
+                              ". Dropping message"))))))

  (defn- logged-in?
   "Determine if host/websocket combination has logged in"


macro needs to be in clj only

macro needs to be in clj only

--- src/cats/monad/either.cljc
+++ src/cats/monad/either.cljc
@@ -318,10 +318,11 @@
     (right (p/-extract e))
     (left (p/-extract e))))

-(defmacro try-either
-  "try to evalute the body and return the result as an either
-  if an exception is throw return the exception as a left,
-  otherwise returns the result as a right"
-  [& body]
-  `(try (right ~@body)
-        (catch Exception e# (left e#))))
+#?(:clj
+   (defmacro try-either
+     "try to evalute the body and return the result as an either
+     if an exception is throw return the exception as a left,
+     otherwise returns the result as a right"
+     [& body]
+     `(try (right ~@body)
+           (catch Exception e# (left e#)))))


multiple app-state schema errors have different idents

to avoid duplicate key error from react

--- src/chat/client/store.cljs
+++ src/chat/client/store.cljs
@@ -70,7 +70,7 @@
         (reset! app-state old-state)
         ; Not just calling display-error! to avoid possibility of infinite loop
         (swap! app-state update-in [:errors] conj
-               [:internal-consistency "Something has gone wrong"])))))
+               [(str :internal-consistency (rand-int 100)) "Something has gone wrong"])))))

 ; login state


Add missing result

Add missing result

--- src/clj_tutorials/core.clj
+++ src/clj_tutorials/core.clj
@@ -45,7 +45,8 @@
   `(let [~(first binding) (repeatedly ~(second binding) async/chan)
     ~'result (do ~@body)]
     (dorun ~'result) ;Lazy results must be evaluated before channels are closed
-    (doseq [~'c ~(first binding)] (async/close! ~'c))                                                        ~'result))
+    (doseq [~'c ~(first binding)] (async/close! ~'c))
+  ~'result))

 (defn run-with-macro [number-of-users step]
   (with-channels [cs number-of-users]


Connect WebSocket when the page is first loaded.

--- src/cljs/chatapp/core.cljs
+++ src/cljs/chatapp/core.cljs
@@ -21,9 +21,7 @@

 (def socket (atom nil))

-(defn oonclick [event]
-  (.preventDefault event)
-
+(defn connect []
   (let [uri       (str "ws://" (.-host js/location) "/ws")
         websocket (js/WebSocket. uri)]
     (set! (.-onerror websocket) onerror)
@@ -59,9 +57,6 @@
                 :placeholder "Enter text to reverse!"
                 :on-change   #(reset! val (-> % .-target .-value))}]
        [:button {:type     "button"
-                 :on-click oonclick}
-        "Open"]
-       [:button {:type     "button"
                  :on-click (partial sonclick @val)}
         "Send"]
        [:button {:type "button" :on-click conclick} "Close"]
@@ -72,4 +67,5 @@
    [:div
     [:h1 "WebSocket Demo"]
     [demo]]
-   (.getElementById js/document "root")))
+   (.getElementById js/document "root"))
+  (connect))


Linking to About page from the header

Linking to About page from the header

We were missing a link to the about page when already logged in. While
this is non-obvious, it'd be good if it acts as a "Help".

Also added an "About" link on the right of the navbar, it should help
guide users while keeping the UI uncluttered.

--- src/cljs/memento/core.cljs
+++ src/cljs/memento/core.cljs
@@ -130,7 +130,10 @@
       [Navbar {:collapseOnSelect true
                :fixedTop         true}
        [Navbar.Header
-        [Navbar.Brand "Memento"]
+        ;; Oddly, if the :a is inside the Navbar.Brand, it ends up being converted to a span
+        ;; Not quite sure what the hiccup rule is in that case
+        [:a {:href "/about"}
+         [Navbar.Brand "Memento"]]
         [Navbar.Toggle]]
        [Navbar.Collapse
         (if (nil? @token)
@@ -139,7 +142,10 @@
            [navbar-item "Sign up" :signup]]
           [Nav
            [navbar-item "Record" :record]
-           [navbar-item "Remember" :remember]])]
+           [navbar-item "Remember" :remember]])
+        [Nav {:pullRight true}
+         [NavItem {:href "/about"} "About"]]
+        ]
        ]
       )))


Use sablono templating

Use sablono templating

--- src/clojure_cafe/core.cljs
+++ src/clojure_cafe/core.cljs
@@ -4,6 +4,7 @@
     [cljs.core.async :as async :refer [<! >! chan close! timeout]]
     [om.core :as om :include-macros true]
     [om.dom :as dom :include-macros true]
+    [sablono.core :as html :refer-macros [html]]
     [clojure-cafe.schema :as schema])
   (:require-macros
     [cljs.core.async.macros :refer [go]]))
@@ -42,13 +43,23 @@

 (load-events result-chan)

-(om/root
-  (fn [data owner]
-    (reify om/IRender
-      (render [_]
-        (dom/h1 nil (:text data)))))
-  app-state
-  {:target (. js/document (getElementById "app"))})
+(defn calendar-widget [events]
+  (om/component
+   (html [:div "Hello bob!"
+          [:ul (for [n (range 1 10)]
+                 [:li {:key n} n])]
+          (html/submit-button "React!")])))
+
+;; (om/root
+;;   (fn [data owner]
+;;     (reify om/IRender
+;;       (render [_]
+;;         (dom/h1 nil (:text data)))))
+;;   app-state
+;;   {:target (. js/document (getElementById "app"))})
+
+;; just paste from sablono readme
+(om/root calendar-widget (:events @app-state) {:target js/document.body})

 (defn on-js-reload []


RS & ML | 161 | Remove some superfluous functionality in open-id tests - take 2

--- test/stonecutter_journey_test/common.clj
+++ test/stonecutter_journey_test/common.clj
@@ -66,7 +66,7 @@
   (wd/click stonecutter-sign-in-button))

 (defn register-and-sign-out []
-  (wd/to (str c/scheme "://" stonecutter-url))
+  (wd/to (str scheme "://" stonecutter-url))
   (wait-for-selector stonecutter-index-page-body)
   (wd/input-text stonecutter-register-email-input "stonecutter-journey-test@tw.com")
   (wd/input-text stonecutter-register-password-input "password")


Show use of `debug` middleware in todomvc

--- examples/todomvc/src/todomvc/handlers.cljs
+++ examples/todomvc/src/todomvc/handlers.cljs
@@ -1,7 +1,8 @@
 (ns todomvc.handlers
   (:require
     [todomvc.db    :refer [default-value ls->todos todos->ls! schema]]
-    [re-frame.core :refer [register-handler path trim-v after]]
+    [re-frame.core :refer [register-handler path trim-v after debug]]
+    [clojure.data  :as data]
     [schema.core   :as s]))

@@ -19,16 +20,18 @@
 ;; Event handlers change state, that's their job. But what heppens if there's
 ;; a bug and they corrupt this state in some subtle way? This middleware is run after
 ;; each event handler has finished, and it checks app-db against a schema.  This
-;; helpd us detect event handler bugs very early.
+;; helps us detect event handler bugs early.
 (def check-schema-mw (after (partial check-and-throw schema)))

 (def ->ls (after todos->ls!))    ;; middleware to store todos into local storage

+
 ;; middleware for any handler that manipulates todos
 (def todo-middleware [check-schema-mw ;; ensure the schema is still valid
                       (path :todos)   ;; 1st param to handler will be value from this path
                       ->ls            ;; write to localstore each time
+                      (when ^boolean js/goog.DEBUG debug)       ;; look in your browser console
                       trim-v])        ;; remove event id from event vec


rename player var to last-player

rename player var to last-player

--- src/greybear/websocket.clj
+++ src/greybear/websocket.clj
@@ -42,11 +42,13 @@
   (let [game-id (:game_id message)
         user-id (:user_id message)
         game (read-game game-id)
-        {:keys [player x y] :or {player 1 x nil y nil}} (last-move game-id)]
+        {:keys [last-player x y]
+         :or {last-player 1 x nil y nil}}
+        (last-move game-id)]
     (.send conn
            (json/write-str {:cmd "board"
                             :stones (stones-to-js (game :stones))
-                            :playing (get-playing player user-id game)
+                            :playing (get-playing last-player user-id game)
                             :last-x x
                             :last-y y}))))


Make now workflow error fatal.

Make now workflow error fatal.

Fix bug in deploy.core/get.

--- src/incise/deploy/core.clj
+++ src/incise/deploy/core.clj
@@ -1,18 +1,19 @@
 (ns incise.deploy.core
-  (:require [taoensso.timbre :refer [warn]])
-  (:clojure-refer :exclude [get]))
+  (:require [incise.config :as conf]
+            [taoensso.timbre :refer [fatal]])
+  (:refer-clojure :exclude [get]))

 (def workflows (atom {}))

 (defn get [& args]
-  (apply clojure.core/get @workflow args))
+  (apply clojure.core/get @workflows args))

 (defn deploy []
   (let [{workflow-name :workflow :as settings} (conf/get :deploy)
-        [workflow (get workflow-name)]]
+        workflow (get workflow-name)]
     (if workflow
       (workflow settings)
-      (warn "No workflow registered as" workflow-name))))
+      (fatal "No workflow registered as" workflow-name))))

 (defn register
   "Register a deployment workflow."


RS & CM | #57 | Add integration flag to functional tests to prevent it being run in unit test

--- functional/objective8/functional_tests.clj
+++ functional/objective8/functional_tests.clj
@@ -7,7 +7,7 @@

 (def config-without-twitter (assoc core/app-config :authentication stub-twitter-auth-config))

-(facts "some tests" :functional
+(facts "some tests" :functional :integration
        (against-background
          [(before :contents (do (core/start-server config-without-twitter)
                              (webdriver/set-driver! {:browser :firefox})))


minor tweak to fizz-buzz-plus problem training cases

--- src/clojush/problems/software/fizz_buzz_plus.clj
+++ src/clojush/problems/software/fizz_buzz_plus.clj
@@ -110,11 +110,13 @@
     [(fizz-buzz-plus-training-case 1111111 239 4649)
      (fizz-buzz-plus-training-case 1111111 4649 239)
      (fizz-buzz-plus-training-case 1111112 239 4649)
+     (fizz-buzz-plus-training-case 1111110 239 4649)
      (fizz-buzz-plus-training-case 1111112 138889 7)
      (fizz-buzz-plus-training-case 1111112 138889 8)
      (fizz-buzz-plus-training-case 11111111111 21649 513239)
      (fizz-buzz-plus-training-case 11111111111 513239 21649)
      (fizz-buzz-plus-training-case 11111111111 513238 21649)
+     (fizz-buzz-plus-training-case 11111111111 513240 21649)
      (fizz-buzz-plus-training-case 11111111111 513239 21648)
      (fizz-buzz-plus-training-case 22 22 22)
      ]))


add compile, pass all dynamic vars together

--- src/main/cljs/cljs/js.cljs
+++ src/main/cljs/cljs/js.cljs
@@ -42,16 +42,17 @@
 ;; -----------------------------------------------------------------------------
 ;; Analyze

+(declare compile*)
+
 (def *loaded* (atom #{}))

 (defn require
-  ([name cb]
+  ([bound-vars name opts cb]
    (when-not (contains? @*loaded* name)
      (*load-fn* name
        (fn [source]
-         (*eval-fn* source)
-         (cb true)))))
-  ([name reload cb]
+         (compile* bound-vars source opts (fn [ret] (cb true)))))))
+  ([bound-vars name reload opts cb]
    (when (= :reload reload)
      (swap! *loaded* disj name))
    (when (= :reload-all reload)
@@ -59,27 +60,25 @@
    (when-not (contains? @*loaded* name)
      (*load-fn* name
        (fn [source]
-         (*eval-fn* source)
-         (cb true))))))
+         (compile* bound-vars source opts (fn [ret] (cb true))))))))

 (declare ns-side-effects)

-(defn analyze* [env bound-vars source opts cb]
+(defn analyze* [bound-vars source opts cb]
   (let [rdr  (rt/string-push-back-reader source)
         eof  (js-obj)
         aenv (ana/empty-env)]
-    (binding [ana/*cljs-ns*    (:*cljs-ns* bound-vars)
+    (binding [env/*compiler*   (:*compiler* bound-vars)
+              ana/*cljs-ns*    (:*cljs-ns* bound-vars)
               *ns*             (:*ns* bound-vars)
-              r/*data-readers* (:*data-readers* bound-vars)
-              env/*compiler*   env]
+              r/*data-readers* (:*data-readers* bound-vars)]
       (loop []
         (let [form (r/read {:eof eof} rdr)]
           (if-not (identical? eof form)
             (let [aenv (assoc aenv :ns (ana/get-namespace ana/*cljs-ns*))
                   ast  (ana/analyze aenv form)]
               (if (= (:op ast) :ns)
-                (ns-side-effects env ast opts bound-vars
-                  (fn [_] (cb)))
+                (ns-side-effects bound-vars aenv ast opts (fn [_] (cb)))
                 (recur)))
             (cb)))))))

@@ -87,8 +86,8 @@
   "Given a lib, a namespace, deps, its dependencies, env, an analysis environment
    and opts, compiler options - analyze all of the dependencies. Required to
    correctly analyze usage of other namespaces."
-  ([lib deps env bound-vars cb] (analyze-deps lib deps env bound-vars nil cb))
-  ([lib deps env bound-vars opts cb]
+  ([bound-vars ana-env lib deps cb] (analyze-deps bound-vars lib deps nil cb))
+  ([bound-vars ana-env lib deps opts cb]
    (let [compiler @(:*compiler* bound-vars)]
      (binding [ana/*cljs-dep-set* (vary-meta (conj (:*cljs-dep-set* bound-vars) lib)
                                     update-in [:dep-path] conj lib)]
@@ -102,49 +101,51 @@
              (*load-fn* name
                (fn [source]
                  (if-not (nil? source)
-                   (analyze* env bound-vars source opts
+                   (analyze* bound-vars source opts
                      (fn []
-                       (analyze-deps lib (next deps) env bound-vars opts cb)))
+                       (analyze-deps bound-vars lib (next deps) opts cb)))
                    (throw
-                     (ana/error env
+                     (ana/error ana-env
                        (ana/error-message :undeclared-ns
                          {:ns-sym dep :js-provide (name dep)}))))))))
          (cb))))))

-(defn load-macros [k macros reload reloads bound-vars cb]
+(defn load-macros [bound-vars k macros reload reloads opts cb]
   (if (seq macros)
-    (let [nsym (first (vals macros))]
+    (let [env  (:*compiler* bound-vars)
+          nsym (first (vals macros))]
       (let [k (or (k reload)
                   (get-in reloads [k nsym])
                   (and (= nsym name) (:*reload-macros* bound-vars) :reload))]
         (if k
-          (require nsym k
+          (require bound-vars nsym k opts
             (fn []
-              (load-macros k (next macros) reload reloads bound-vars cb)))
-          (require nsym
+              (load-macros bound-vars k (next macros) reload reloads opts cb)))
+          (require bound-vars nsym opts
             (fn []
-              (load-macros k (next macros) reload reloads bound-vars cb))))
+              (load-macros bound-vars k (next macros) reload reloads opts cb))))
         ;(intern-macros nsym k)
         ))
     (cb)))

 (defn ns-side-effects
-  [env {:keys [op] :as ast} opts bound-vars cb]
+  [bound-vars ana-env {:keys [op] :as ast} opts cb]
   (if (= :ns op)
-    (let [{:keys [deps uses require-macros use-macros reload reloads]} ast]
+    (let [{:keys [deps uses require-macros use-macros reload reloads]} ast
+          env (:*compiler* bound-vars)]
       (letfn [(check-uses-and-load-macros []
                 (when (and (:*analyze-deps* bound-vars) (seq uses))
                   (ana/check-uses uses env))
                 (when (:*load-macros* bound-vars)
-                  (load-macros :use-macros use-macros reload reloads bound-vars
+                  (load-macros bound-vars :use-macros use-macros reload reloads opts
                     (fn []
-                      (load-macros :require-macros require-macros reloads reloads bound-vars
+                      (load-macros bound-vars :require-macros require-macros reloads reloads opts
                         (fn []
                           (when (seq use-macros)
                             (ana/check-use-macros use-macros env))
                           (cb ast)))))))]
         (if (and (:*analyze-deps* bound-vars) (seq deps))
-          (analyze-deps name deps env (dissoc opts :macros-ns)
+          (analyze-deps bound-vars name deps (dissoc opts :macros-ns)
             check-uses-and-load-macros)
           (check-uses-and-load-macros))))
     (cb ast)))
@@ -153,8 +154,9 @@
   ([env source cb]
    (analyze env source nil cb))
   ([env source opts cb]
-   (analyze* env
-     {:*cljs-ns*      (or (:ns env) 'cljs.user)
+   (analyze*
+     {:*compiler*     env
+      :*cljs-ns*      (or (:ns env) 'cljs.user)
       :*ns*           (create-ns ana/*cljs-ns*)
       :*data-readers* tags/*cljs-data-readers*}
      source opts cb)))
@@ -171,8 +173,8 @@
 ;; -----------------------------------------------------------------------------
 ;; Eval

-(defn eval* [env bound-vars form opts cb]
-  (binding [env/*compiler*   env
+(defn eval* [bound-vars form opts cb]
+  (binding [env/*compiler*   (:*compiler* bound-vars)
             *eval-fn*        (:*eval-fn* bound-vars)
             ana/*cljs-ns*    (:*cljs-ns* bound-vars)
             *ns*             (:*ns* bound-vars)
@@ -186,9 +188,32 @@
 (defn eval
   ([env form cb] (eval env form nil cb))
   ([env form opts cb]
-   (eval* env
-     {:*cljs-ns*      'cljs.user
+   (eval*
+     {:*compiler*     env
+      :*cljs-ns*      'cljs.user
       :*ns*           (create-ns 'cljs.user)
       :*data-readers* tags/*cljs-data-readers*
       :*eval-fn*      (or (:js-eval opts) js/eval)}
-     form opts cb)))+     form opts cb)))
+
+;; -----------------------------------------------------------------------------
+;; Compile
+
+(defn compile* [bound-vars source opts cb]
+  (binding [env/*compiler    (:*compiler* bound-vars)
+            *eval-fn*        (:*eval-fn* bound-vars)
+            ana/*cljs-ns*    (:*cljs-ns* bound-vars)
+            *ns*             (:*ns* bound-vars)
+            r/*data-readers* (:*data-readers* bound-vars)]
+    ))
+
+(defn compile
+  ([env source cb] (compile env source cb))
+  ([env source opts cb]
+    (compile*
+      {:*compiler*     env
+       :*cljs-ns*      'cljs.user
+       :*ns*           (create-ns 'cljs.user)
+       :*data-readers* tags/*cljs-data-readers*
+       :*eval-fn*      (or (:js-eval opts) js/eval)}`
+      source opts cb)))