Spotlights

Spotlights

they don't seem to show...

--- src/clojure/yaw/world.clj
+++ src/clojure/yaw/world.clj
@@ -1,10 +1,9 @@
 (ns yaw.world
   (:import (yaw.engine.meshs MeshBuilder)
            (yaw.engine World)
-           (yaw.engine.light AmbientLight DirectionalLight PointLight))
+           (yaw.engine.light AmbientLight DirectionalLight PointLight SpotLight))
   (:require [yaw.mesh]))
   ;;(gen-class)
-

 ;;UTILS------------------------------------------------------------------
 (defn flat-map "flatten 'map'" [m]
@@ -174,6 +173,18 @@
   (let [[r g b] color [px py pz] position]
     (.setPointLight (lights world) (PointLight. r g b px py pz i const lin quad) n)))

+(defn set-spot-light!
+  "Set the `n`th spotlight with the given `color`, `intensity`, `position`, `direction` and attenuation factors"
+  [world n & {{:keys [const lin quad] :or {const 0.3 lin 0.5 quad 0.9}} :att
+              :keys [color i position direction angle]
+              :or {color [1 1 1]
+                   i 1
+                   position [0 0 0]
+                   direction [0 0 -1]
+                   angle 30}}]
+  (let [[r g b] color [px py pz] position [dx dy dz] direction]
+    (.setSpotLight (lights world) (SpotLight. r g b px py pz i const lin quad dx dy dz angle) n)))
+
 ;;COLLISIONS------------------------------------------------------

 (defn create-bouding-box!


Item methods

Item methods

--- src/clojure/yaw/world.clj
+++ src/clojure/yaw/world.clj
@@ -83,6 +83,11 @@
                    scale    1
                    mesh     (create-mesh! world)}}]         ;;error here
   (.createItem world id (float-array position) scale mesh))
+
+(defn remove-item!
+  "Remove the specified `item` from the `world`"
+  [world item]
+  (.removeItem world item))

 (defn create-block!
   "Create a rectangular block in the `world` with the
@@ -172,3 +177,5 @@
                                  y 0
                                  z 0}}]
   (.translate item x y z))
+
+(defn clone! [world item] (.clone world item))


added ^:dynamic for clojure-1.3.x

added ^:dynamic for clojure-1.3.x

--- src/karras/core.clj
+++ src/karras/core.clj
@@ -1,17 +1,17 @@
 ;; The MIT License
-;;
+;;
 ;; Copyright (c) 2010 Wilkes Joiner
-;;
+;;
 ;; Permission is hereby granted, free of charge, to any person obtaining a copy
 ;; of this software and associated documentation files (the "Software"), to deal
 ;; in the Software without restriction, including without limitation the rights
 ;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 ;; copies of the Software, and to permit persons to whom the Software is
 ;; furnished to do so, subject to the following conditions:
-;;
+;;
 ;; The above copyright notice and this permission notice shall be included in
 ;; all copies or substantial portions of the Software.
-;;
+;;
 ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -67,7 +67,7 @@
  (to-dbo [v] (to-dbo (vec v)))
  (to-clj [v] (to-clj (vec v)))
  (to-description [v] (to-description (vec v)))
-
+
  clojure.lang.Keyword
  (to-dbo [v] (str v))
  (to-clj [v] (str v))
@@ -77,7 +77,7 @@
  (to-dbo [v] (str v))
  (to-clj [v] (str v))
  (to-description [v] java.lang.String)
-
+
  Object
  (to-dbo [v] v)
  (to-clj [v] v)
@@ -88,7 +88,7 @@
  (to-clj [v] v)
  (to-description [v] v))

-(defvar *mongo-db* nil
+(defvar ^:dynamic *mongo-db* nil
   "Var to bind a com.mongo.DB. Use with with-mongo or with-mongo-request.")

 (defmacro with-mongo
@@ -130,7 +130,7 @@
      (.requestDone ~db))))

 (defn write-concern-none
-  "From the mongo driver javadocs:
+  "From the mongo driver javadocs:
    Don't check for or report any errors on writes."
   [#^DB db]
   (.setWriteConcern db com.mongodb.DB$WriteConcern/NONE))


Revert "CMR-5281: Refactored code based on review comment."

This reverts commit 2a9a16e8cffd2a61a48d3726acd57634ec13568d.

--- umm-spec-lib/test/cmr/umm_spec/test/validation/umm_spec_granule_validation_tests.clj
+++ umm-spec-lib/test/cmr/umm_spec/test/validation/umm_spec_granule_validation_tests.clj
@@ -715,31 +715,6 @@
          {:path [:two-d-coordinate-system :start-coordinate-1]
           :errors ["The field [Start Coordinate 1] falls outside the bounds [0 ∞] defined in the collection"]}]))))

-(defn- make-granule-with-equator-crossing
-  "Creates a granule with the given equator-crossing-date-time.
-  This function is tied to the collection that is used in test
-  granule-ocsd-equator-crossing-date-time and is only intended to be used in that test."
-  [equator-crossing-date-time]
-  (make-granule
-   {:temporal (g/map->GranuleTemporal
-               {:range-date-time
-                {:beginning-date-time (dtp/parse-datetime "2015-01-01T00:00:00Z")
-                 :ending-date-time (dtp/parse-datetime "2015-06-01T00:00:00Z")}})
-    :spatial-coverage (g/map->SpatialCoverage
-                       {:orbit (g/->Orbit 76.123 50.0 :asc 50.0 :desc)})
-    :orbit-calculated-spatial-domains
-    [;; a valid equator crossing to test handling of more than one orbit calculated spatial domains
-     (g/map->OrbitCalculatedSpatialDomain
-      {:orbit-number  1
-       :start-orbit-number 1
-       :stop-orbit-number 1
-       :equator-crossing-date-time (dtp/parse-datetime "2015-02-01T00:00:00Z")})
-     (g/map->OrbitCalculatedSpatialDomain
-      {:orbit-number  1
-       :start-orbit-number 1
-       :stop-orbit-number 1
-       :equator-crossing-date-time (dtp/parse-datetime equator-crossing-date-time)})]}))
-
 (deftest granule-ocsd-equator-crossing-date-time
   (let [collection-with-orbit (make-collection
                                {:TemporalExtents [(cmn/map->TemporalExtentType
@@ -750,7 +725,28 @@
                                                    :Period 100.0
                                                    :SwathWidth 2600.0
                                                    :StartCircularLatitude 50.0
-                                                   :NumberOfOrbits 2.0}}})]
+                                                   :NumberOfOrbits 2.0}}})
+        make-granule-with-equator-crossing
+        (fn [equator-crossing-date-time]
+          (make-granule
+           {:temporal (g/map->GranuleTemporal
+                       {:range-date-time
+                        {:beginning-date-time (dtp/parse-datetime "2015-01-01T00:00:00Z")
+                         :ending-date-time (dtp/parse-datetime "2015-06-01T00:00:00Z")}})
+            :spatial-coverage (g/map->SpatialCoverage
+                               {:orbit (g/->Orbit 76.123 50.0 :asc 50.0 :desc)})
+            :orbit-calculated-spatial-domains
+            [;; a valid equator crossing to test handling of more than one orbit calculated spatial domains
+             (g/map->OrbitCalculatedSpatialDomain
+              {:orbit-number  1
+               :start-orbit-number 1
+               :stop-orbit-number 1
+               :equator-crossing-date-time (dtp/parse-datetime "2015-02-01T00:00:00Z")})
+             (g/map->OrbitCalculatedSpatialDomain
+              {:orbit-number  1
+               :start-orbit-number 1
+               :stop-orbit-number 1
+               :equator-crossing-date-time (dtp/parse-datetime equator-crossing-date-time)})]}))]

     (testing "granules with orbit calcualted spatial domains equator crossing date time"
       (are3 [equator-crossing expected-errors]


Implemented available specializations view

--- src/kmg/client.cljs
+++ src/kmg/client.cljs
@@ -31,6 +31,9 @@
 (em/defsnippet recommendation-completed tmpl ".recommendation-completed" [{:keys [media]}]
   ".recommendation-completed-title" (ef/content (:media/title media)))

+(em/defsnippet specialization-available tmpl ".specialization-available" [specialization]
+  ".specialization-available-title" (ef/content (:specialization/title specialization)))
+
 (defn error-handler [{:keys [status status-text]}]
   (js/alert (str "somthing bad happened: " status " " status-text))
   #_(.log js/console (str "somthing bad happened: " status " " status-text)))
@@ -40,6 +43,9 @@

 (defn recommendation-completed-list [data]
   (ef/at "#recommenations-completed" (ef/content (map recommendation-completed data))))
+
+(defn specialization-available-list [data]
+  (ef/at "#specializations-available" (ef/content (map specialization-available data))))

 (defn try-load-recommendations []
   (GET (str "/recommendation/list/" (:username @user))
@@ -51,9 +57,15 @@
        {:handler recommendation-completed-list
         :error-handler error-handler}))

+(defn try-load-specializations-available []
+  (GET (str "/specialization/available/" (:username @user))
+       {:handler specialization-available-list
+        :error-hadler error-handler}))
+
 (defn refresh []
   (try-load-recommendations)
-  (try-load-recommendations-completed))
+  (try-load-recommendations-completed)
+  (try-load-specializations-available))

 (defn try-mark-as-completed [recommendation]
   (POST (str "/recommendation/mark-as-completed/" (:username @user) "/" (:recommendation/id recommendation))
@@ -84,8 +96,9 @@
          (ef/do-> (ef/content (kmg-header))
                   (ef/append (kmg-content))
                   (ef/append (kmg-sidebar))))
-  (try-load-recommendations)
-  (try-load-recommendations-completed)
+  (refresh)
+  #_(try-load-recommendations)
+  #_(try-load-recommendations-completed)
   (try-get-users)
   (observe-change-user))


fix tests broken by removing json-ware and action rename

--- test/gh_waiting_room/service_test.clj
+++ test/gh_waiting_room/service_test.clj
@@ -4,6 +4,7 @@
             [gh-waiting-room.test-helper :refer [disallow-web-requests!]]
             [io.pedestal.service.http :as bootstrap]
             [gh-waiting-room.github :as github]
+            [clojure.data.json :as json]
             [gh-waiting-room.service :as service]))

 (def service
@@ -52,16 +53,19 @@
                mocks-called (atom {})
                json {"action" action
                      "repository" {"full_name" full-name}
-                     "issue" {"number" "1"}}]
+                     "issue" {"number" "1"}}
+               body (json/write-str json)]
      (with-redefs [service/update-gh-issues (inc-mock-count mocks-called :update-gh-issues)
                    github/create-issue-comment (inc-mock-count mocks-called :create-issue-comment)
-                   github/viewable-issues (constantly issues)]
-       (service/webhook-page {:json-params json}))
+                   github/viewable-issues (constantly issues)
+                   ;; just create an actual stream
+                   slurp (constantly body)]
+       (service/webhook-page {:body body}))
      @mocks-called)))

 ;;; Doesn't use response-for as it doesn't support :post yet
 (deftest webhook-page-test
-  (is (= (fns-called-for-webhook-page "opened")
+  (is (= (fns-called-for-webhook-page "created")
          {:update-gh-issues 1 :create-issue-comment 1})
       "Updates issues and creates comment for a newly created issue")
   (is (= (fns-called-for-webhook-page "closed")


Fix whitespace

Fix whitespace

--- src/expound/problems.cljc
+++ src/expound/problems.cljc
@@ -65,6 +65,7 @@
       (into '() (-> displayed-form
                     vec
                     (assoc k (summary-form show-valid-values? (nth (seq form) k) rst))))
+
       (and (int? k) (string? form))
       (string/join (assoc (vec form) k ::relevant))

@@ -121,7 +122,7 @@
                      (or (= '(apply fn) (:pred problem))
                          (#{:ret} (first (:path problem))))
                      (:in problem)
-
+
                      :else
                      nil)]


release ports for instances that died (#112)

--- waiter/src/waiter/shell_scheduler.clj
+++ waiter/src/waiter/shell_scheduler.clj
@@ -301,10 +301,11 @@

 (defn- associate-exit-codes
   "Associates exit codes with exited instances"
-  [{:keys [:shell-scheduler/process] :as instance}]
+  [{:keys [:shell-scheduler/process port] :as instance} port->reservation-atom port-grace-period-ms]
   (if (and (active? instance) (not (.isAlive process)))
     (let [exit-value (.exitValue process)]
       (log/info "instance exited with value" {:instance instance :exit-value exit-value})
+      (release-port! port->reservation-atom port port-grace-period-ms)
       (assoc instance :healthy? false
                       :failed (if (zero? exit-value) false true)
                       :killed true                          ; does not actually mean killed -- using this to mark inactive
@@ -368,7 +369,7 @@
   (timers/start-stop-time!
     (metrics/waiter-timer "shell-scheduler" "update-health")
     (let [pid->memory (get-pid->memory)
-          exit-codes-check #(associate-exit-codes %)]
+          exit-codes-check #(associate-exit-codes % port->reservation-atom port-grace-period-ms)]
       (loop [remaining-service-entries (vals id->service)
              id->service' {}]
         (if-let [{:keys [service id->instance] :as service-entry} (first remaining-service-entries)]


Minor cleanup for new korma replacement DB stuff :honey_pot:

--- src/metabase/db.clj
+++ src/metabase/db.clj
@@ -137,50 +137,26 @@

 (defn connection-pool
   "Create a C3P0 connection pool for the given database SPEC."
-  [{:keys [subprotocol
-           subname
-           classname
-           excess-timeout
-           idle-timeout
-           initial-pool-size
-           minimum-pool-size
-           maximum-pool-size
-           test-connection-query
-           idle-connection-test-period
-           test-connection-on-checkin
-           test-connection-on-checkout]
-    :or {excess-timeout              (* 30 60)
-         idle-timeout                (* 3 60 60)
-         initial-pool-size           3
-         minimum-pool-size           3
-         maximum-pool-size           15
-         test-connection-query       nil
-         idle-connection-test-period 0
-         test-connection-on-checkin  false
-         test-connection-on-checkout false}
-    :as spec}]
+  [{:keys [subprotocol subname classname minimum-pool-size idle-connection-test-period excess-timeout]
+    :or   {minimum-pool-size           3
+           idle-connection-test-period 0
+           excess-timeout              (* 30 60)}
+    :as   spec}]
   {:datasource (doto (ComboPooledDataSource.)
                  (.setDriverClass                  classname)
                  (.setJdbcUrl                      (str "jdbc:" subprotocol ":" subname))
                  (.setMaxIdleTimeExcessConnections excess-timeout)
-                 (.setMaxIdleTime                  idle-timeout)
-                 (.setInitialPoolSize              initial-pool-size)
+                 (.setMaxIdleTime                  (* 3 60 60))
+                 (.setInitialPoolSize              3)
                  (.setMinPoolSize                  minimum-pool-size)
-                 (.setMaxPoolSize                  maximum-pool-size)
+                 (.setMaxPoolSize                  15)
                  (.setIdleConnectionTestPeriod     idle-connection-test-period)
-                 (.setTestConnectionOnCheckin      test-connection-on-checkin)
-                 (.setTestConnectionOnCheckout     test-connection-on-checkout)
-                 (.setPreferredTestQuery           test-connection-query)
+                 (.setTestConnectionOnCheckin      false)
+                 (.setTestConnectionOnCheckout     false)
+                 (.setPreferredTestQuery           nil)
                  (.setProperties                   (u/prog1 (java.util.Properties.)
-                                                     (doseq [[k v] (dissoc spec
-                                                                           :make-pool? :classname :subprotocol :subname
-                                                                           :naming :delimiters :alias-delimiter
-                                                                           :excess-timeout :idle-timeout
-                                                                           :initial-pool-size :minimum-pool-size :maximum-pool-size
-                                                                           :test-connection-query
-                                                                           :idle-connection-test-period
-                                                                           :test-connection-on-checkin
-                                                                           :test-connection-on-checkout)]
+                                                     (doseq [[k v] (dissoc spec :make-pool? :classname :subprotocol :subname :naming :delimiters :alias-delimiter
+                                                                                :excess-timeout :minimum-pool-size :idle-connection-test-period)]
                                                        (.setProperty <> (name k) (str v))))))})

 (def ^:private db-connection-pool


Update answer.clj

Update answer.clj

修正してみたけどダメだったみたい
result:
https://paiza.jp/poh/enshura-special-ending/82e44900

--- POH5plus/answer.clj
+++ POH5plus/answer.clj
@@ -1,5 +1,5 @@
 ;; 15 puzzle solver
-;; 2015-05-17
+;; 2015-05-18
 ;; Leonardone @ NEETSDKASU
 ;;
 ;; ググったら15パズルにはA*アルゴリズムを使えと書いてあった
@@ -121,7 +121,9 @@
 						(list true (assoc o mdt mst) c n)
 						(if (contains? o mdt)
 							(if (< mval (Puzzle-GetValue (o mdt)))
-								(recur (assoc o mdt mst) c (assoc n mval (assoc (n mval) mdt mst)) (inc k))
+								(let [st2 (o mdt) dt2 (Puzzle-GetPuzzle st2) v2 (Puzzle-GetValue st2)
+										n2 (assoc n v2 (dissoc (n v2) dt2))]
+									(recur (assoc o mdt mst) c (assoc n2 mval (assoc (n2 mval) mdt mst)) (inc k)))
 								(recur o c n (inc k)))
 							(if (contains? c mdt)
 								(if (< mval (Puzzle-GetValue (c mdt)))
@@ -153,6 +155,7 @@

 (defn Puzzle-Solve [pb]
+	;;(Puzzle-Print pb)
 	(let [pbst (Puzzle-MakeState pb 0 0) pbdt (Puzzle-Data pb) pbval (Puzzle-Cost pb)]
 	(if (== pbdt (Puzzle-Data Puzzle-Default))
 		()
@@ -189,6 +192,7 @@

 (defn main []
+	;;(loop [r (Puzzle-Solve (Puzzle-Shuffle Puzzle-Default 200))]
 	(loop [r (Puzzle-Solve (Puzzle-Input))]
 		(if (empty? r) nil
 			(let [n (peek r)]


ensure *read-eval* false

ensure *read-eval* false

--- ClojureScript/replete/src/replete/core.cljs
+++ ClojureScript/replete/src/replete/core.cljs
@@ -38,7 +38,8 @@
   (binding [r/*data-readers* tags/*cljs-data-readers*]
     (with-compiler-env cenv
       (try
-        (r/read-string line)
+        (binding [*read-eval* false]
+          (r/read-string {:read-cond :allow :features #{:cljs}} line))
         true
         (catch :default _
           false)))))
@@ -74,7 +75,8 @@
                                        :def-emits-var true)]
         (try
           (let [_ (when DEBUG (prn "line:" line))
-                form (r/read-string line)]
+                form (binding [*read-eval* false]
+                        (r/read-string {:read-cond :allow :features #{:cljs}} line))]
             (if (repl-special? form)
               (case (first form)
                 in-ns (reset! current-ns (second (second form)))


calc experimentation

calc experimentation

--- src/clojush/experimental/calc.clj
+++ src/clojush/experimental/calc.clj
@@ -86,79 +86,117 @@

 ; button-entrypoints

+(def digit-keys
+  [:zero :one :two :three :four :five :six :seven :eight :nine])
+
+(def digit-key-map (into {} (map vector digit-keys (iterate inc 0))))
+
 (define-registered
   signal_error
   (fn [state] (push-item :error :auxiliary state)))

-(def digit-entry-tests
-  (let [keys [:zero :one :two :three :four :five :six :seven :eight :nine]]
-    (vec (for [k (range 10)]
-           [[(nth keys k)] (float k) false]))))
-
-(def digit-entry-pair-tests
-  (let [keys [:zero :one :two :three :four :five :six :seven :eight :nine]]
-    (vec (for [k1 (range 10) k2 (range 10)]
-           [[(nth keys k1) (nth keys k2)] (float (+ (* 10 k1) k2)) false]))))
-
-(def single-digit-math-tests
-  (vec (for [[arg1-key arg1-val] {:zero 0, :three 3, :seven 7}
-             [arg2-key arg2-val] {:two 2, :four 4, :nine 9}
-             [op-key op-fn] {:plus +, :minus -, :times *, :divided-by /}]
-         [[arg1-key op-key arg2-key :equals] (float (op-fn arg1-val arg2-val)) false])))
-
-;single-digit-math-tests
-
-(def single-digit-incomplete-math-tests
-  (vec (apply concat
-              (for [[arg1-key arg1-val] {:zero 0, :three 3, :seven 7}
-                    [arg2-key arg2-val] {:two 2, :four 4, :nine 9}
+(defn digit-entry-tests [n]
+  (take n (lshuffle (for [k (range 10)]
+                      [[(nth digit-keys k)]
+                       (float k)
+                       false]))))
+
+(defn digit-entry-pair-tests [n]
+  (take n (lshuffle (for [k1 (range 10) k2 (range 10)]
+                      [[(nth digit-keys k1) (nth digit-keys k2)]
+                       (float (+ (* 10 k1) k2))
+                       false]))))
+
+(defn single-digit-math-tests [n]
+  (take n (lshuffle
+            (for [[arg1-key arg1-val] digit-key-map
+                  [arg2-key arg2-val] digit-key-map
+                  [op-key op-fn] {:plus +, :minus -, :times *, :divided-by /}
+                  :when (not (and (= op-key :divided-by) (zero? arg2-val)))]
+              [[arg1-key op-key arg2-key :equals]
+               (float (op-fn arg1-val arg2-val))
+               false]))))
+
+;(single-digit-math-tests 4)
+
+(defn single-digit-incomplete-math-tests [n]
+  (take n (lshuffle
+            (apply concat
+              (for [[arg1-key arg1-val] digit-key-map
+                    [arg2-key arg2-val] digit-key-map
                     [op-key op-fn] {:plus +, :minus -, :times *, :divided-by /}]
-                [[[arg1-key op-key arg2-key] (float arg2-val) false]
-                 [[arg1-key op-key] (float arg1-val) false]]))))
+                [[[arg1-key op-key arg2-key] ;; leave off the =
+                  (float arg2-val)
+                  false]
+                 [[arg1-key op-key] ;; leave off the second arg and the =
+                  (float arg1-val)
+                  false]])))))

-;single-digit-incomplete-math-tests
+;(single-digit-incomplete-math-tests 4)

-(def single-digit-chained-math-tests
-  (vec (for [[arg1-key arg1-val] {:zero 0, :three 3, :seven 7}
-             [arg2-key arg2-val] {:two 2, :four 4, :nine 9}
-             [op1-key op1-fn] {:plus +, :minus -, :times *, :divided-by /}
-             [arg3-key arg3-val] {:three 3, :five 5, :eight 8}
-             [op2-key op2-fn] {:plus +, :minus -, :times *, :divided-by /}]
-         [[arg1-key op1-key arg2-key op2-key arg3-key :equals]
-          (float (op2-fn (op1-fn arg1-val arg2-val) arg3-val))
-          false])))
-
-;single-digit-chained-math-tests
-
-(def division-by-zero-tests
-  (vec (for [[arg1-key arg1-val] {:zero 0, :three 3, :seven 7}
-             [arg2-key arg2-val] {:zero 0}]
-         [[arg1-key :divided-by arg2-key :equals] 0.0 true])))
+(defn single-digit-chained-math-tests [n]
+  (take n (lshuffle
+            (for [[arg1-key arg1-val] digit-key-map
+                  [arg2-key arg2-val] digit-key-map
+                  [op1-key op1-fn] {:plus +, :minus -, :times *, :divided-by /}
+                  [arg3-key arg3-val] digit-key-map
+                  [op2-key op2-fn] {:plus +, :minus -, :times *, :divided-by /}
+                  :when (not (or (and (= op1-key :divided-by) (zero? arg2-val))
+                                 (and (= op2-key :divided-by) (zero? arg3-val))))]
+              (do #_(println arg1-key arg1-val arg2-key arg2-val op1-key
+                       op1-fn arg3-key arg3-val op2-key op2-fn)
+              [[arg1-key op1-key arg2-key op2-key arg3-key :equals]
+               (float (op2-fn (op1-fn arg1-val arg2-val) arg3-val))
+               false])))))
+
+;(single-digit-chained-math-tests 4)
+
+(defn division-by-zero-tests [n]
+  (take n (lshuffle
+            (for [[arg1-key arg1-val] digit-key-map
+                  [arg2-key arg2-val] {:zero 0}]
+              [[arg1-key :divided-by arg2-key :equals]
+               0.0
+               true]))))

-;division-by-zero-tests
+;(division-by-zero-tests 4)

-(def double-digit-float-entry-tests
-  (vec (for [[arg1-key arg1-val] {:zero 0, :three 3, :seven 7}
-             [arg2-key arg2-val] {:two 2, :four 4, :nine 9}]
-         [[arg1-key :point arg2-key] (float (+ arg1-val (* 0.1 arg2-val))) false])))
-
-;(double-digit-float-entry-tests)
-
-(def calc-tests
+(defn double-digit-float-entry-tests [n]
+  (take n (lshuffle
+            (for [[arg1-key arg1-val] digit-key-map
+                  [arg2-key arg2-val] digit-key-map]
+              [[arg1-key :point arg2-key]
+               (float (+ arg1-val (* 0.1 arg2-val)))
+               false]))))
+
+;(double-digit-float-entry-tests 4)
+
+(def calc-tests (atom []))
+
+(defn reset-calc-tests! []
   ;; [inputs answer error]
   ;; answer doesn't matter if error is true
   ;; if no error, answer must be correct on float stack and true cannot be top boolean
-  (concat
-    digit-entry-tests
-    digit-entry-pair-tests
-    single-digit-math-tests
-    ;single-digit-incomplete-math-tests
-    ;single-digit-chained-math-tests
-    ;division-by-zero-tests
-    ;double-digit-float-entry-tests
-    ))
-
-(println "Number of tests:" (count calc-tests))
+  (reset! calc-tests
+          (vec (concat
+                 (digit-entry-tests 10)
+                 (digit-entry-pair-tests 10)
+                 (single-digit-math-tests 10)
+                 ;single-digit-incomplete-math-tests
+                 ;single-digit-chained-math-tests
+                 ;division-by-zero-tests
+                 ;double-digit-float-entry-tests
+                 ))))
+
+(defn calc-report-with-reset!
+  [best population generation error-function report-simplifications]
+  (println "Resetting cases.")
+  (reset-calc-tests!)
+  (println "New tests:" @calc-tests))
+
+(reset-calc-tests!)
+(println "Number of tests:" (count @calc-tests))
+(println "Tests:" @calc-tests)

 (defn tag-before-entry-points
   [push-state]
@@ -196,7 +234,7 @@
                                    0.0
                                    :float
                                    (assoc (make-push-state) :tag (:tag first-run-result)))
-        test-errors (doall (for [t calc-tests]
+        test-errors (doall (for [t @calc-tests]
                              (loop [push-state initialized-push-state
                                     buttons (first t)]
                                (if (empty? buttons)
@@ -489,4 +527,5 @@
    :print-history false
    ;:use-bushy-code true
    :use-ultra-no-paren-mutation true
+   :problem-specific-report calc-report-with-reset!
   })


Print Exceptions

Print Exceptions

--- dev/user.clj
+++ dev/user.clj
@@ -14,7 +14,10 @@

   (time
     (let [service-document (<?? (hap/fetch (URI/create "http://localhost:5003/wh")))
-          ch (parse! (io/input-stream "/home/akiel/coding/odm-export/out.xml"))]
-      (<!! (import! service-document 100 ch))))
+          ch (parse! (io/input-stream "/home/akiel/coding/odm-export/all.xml"))
+          res (<!! (import! service-document 100 ch))]
+      (if (instance? Throwable res)
+        (println res)
+        (println "Finished!"))))

   )


-> syntax

-> syntax

--- src/uruk/core.clj
+++ src/uruk/core.clj
@@ -148,7 +148,7 @@
    "xs:untypedAtomic" str ;; NB: also referred to as "xdt:untypedAtomic" in type listing
    "xs:yearMonthDuration" str})

-(defn result-type
+(defn result->type
   "Returns type string of the given query Result object. Currently
   assumes result is homogenous."
   [result]
@@ -492,10 +492,11 @@
   "Construct, submit, and return raw results of request for the given
   `session` using `request-factory` and `query`. Modify it
   with (possibly empty) `options` and `variables` maps. Applies type
-  conversion to response according to defaults and `xcc-type->conv-fn`. Variables
-  may be passed as a map of Strings or with String names corresponding
-  to maps describing the variable using mandatory key `:value` and
-  optional keys `:namespace` and `:type`.`"
+  conversion to response according to defaults and
+  `xcc-type->conv-fn`. Variables may be passed as a map of Strings or
+  with String names corresponding to maps describing the variable
+  using mandatory key `:value` and optional keys `:namespace` and
+  `:type`.`"
   [request-factory session query options variables types shape]
   (let [req (sling/try+ (.submitRequest session
                                         (make-request-obj request-factory options variables))


lein-release plugin: preparing 0.2.3 release

--- material/project.clj
+++ material/project.clj
@@ -1,4 +1,4 @@
-(defproject re-view/material "0.2.3-SNAPSHOT"
+(defproject re-view/material "0.2.3"

   :description "Material design components in re-view"


When replacing accents be really thorough

i.e. also handle chars like ø. The method refered to in the gist did
not handle this char. For that reason a socond cleaning cycle is added
which just replaces anything not in basic latin by '_'


Flesh out the docstring

Flesh out the docstring

--- src/io/aviso/rook/swagger.clj
+++ src/io/aviso/rook/swagger.clj
@@ -139,8 +139,13 @@
       remove-nil-vals)))

 (defn ->swagger-schema
-  "Converts a schema to a schema reference; the schema must be named.  Returns a tuple
-  of the possibly updated swagger object and a Swagger schema definition (or a \"$ref\" map)."
+  "Converts a Prismatic schema to a Swagger schema (or possibly, a \"$ref\" map pointing to a schema). A $ref
+  will occur when the schema has the :name and :ns metadata, otherwise it will be inlined.
+
+  nil or s/Any returns nil.
+
+
+  Typically, the result of this is wrapped inside map with key :schema."
   [swagger-options swagger-object schema]
   (cond-let
     (or (nil? schema) (= s/Any schema))


Who wants to jam row-row?

Who wants to jam row-row?

--- src/kolmogorov_music/talk.clj
+++ src/kolmogorov_music/talk.clj
@@ -91,7 +91,6 @@

 (comment
   (live/play row-row)
-  (live/jam (var row-row))
 )


json middleware

json middleware

--- src/axo/core.clj
+++ src/axo/core.clj
@@ -5,6 +5,7 @@
             [compojure.handler :as handler]
             [axo.app-config :as config]
             [axo.repo-handler :as repo]
+            [ring.middleware.json :as json]
             [ring.util.response :refer [resource-response header]])
   (:import [org.apache.commons.io FilenameUtils])
   (:gen-class))
@@ -47,6 +48,8 @@
 (defn get-handlers
   [app-dir repos-db]
   (-> (handler/site app)
+      json/wrap-json-response
+      (json/wrap-json-body {:keywords? true})
       config/app-config-handler
       (partial app-repos-handler repos-db)
       (partial app-dir-handler app-dir)))


Cleaned up QCMeatone and made a few things private.

--- src/overtone/music/tuning.clj
+++ src/overtone/music/tuning.clj
@@ -45,43 +45,21 @@
 (defmethod perfn :arabic [[symb initial freq]]
     (perfn (list :edo 24 initial freq)))

-(def qcmeantone-list
-    (let [x (expt 5 1/4)]
-        '(1
-         (* 8/25 (sqrt 5) x)
-         (* 1/2 (sqrt 5))
-         (* 4/5 x)
-         5/4
-         (* 2/5 (sqrt 5) x)
-         (* 5/8 (sqrt 5)) ; Could also use (* 16/25 (sqrt 5))
-         x
-         8/5
-         (* 1/2 (sqrt 5) x)
-         (* 4/5 (sqrt 5))
-         (* 5/4 x))))

-(def qcmeantone-hack
-    (let [x (expt 5 1/4)]
-        (sort
-            (map #(if (< % 1) (* 2 %) %) ; Dear DAemon. What the hell. Love DAemon.
-                 (for [expnt (range -5 7)]
-                     (* (expt x expnt)
-                        (expt 2 (ceil (* expnt -0.5)))))))))
-
-(defn collapse-to-ntave [number ntave]
+(defn- collapse-to-ntave [number ntave]
     (condp > number
              1 (recur (* number ntave) ntave)
              ntave number
              (recur (/ number ntave) ntave)))

-(defn notesetfromgenerator [generator initpower finpower ntave]
+(defn- note-set-from-generator [generator initpower finpower ntave]
     (let [tempset (for [exponent (range initpower finpower)] (expt generator exponent))]
         (sort (map #(collapse-to-ntave % ntave) tempset))))

 (def qcmeantone
-    (notesetfromgenerator (expt 5 1/4) -5 7 2))
+    (note-set-from-generator (expt 5 1/4) -5 7 2))

-(defn perfmap [note initial freq notemap]
+(defn- perfmap [note initial freq notemap]
     (let [pos (mod (- note initial) (count notemap))
           octave (quot (- note initial (- (count notemap) 1 )) (count notemap))]
         (* freq (nth notemap pos) (expt (ceil (reduce max notemap)) octave))))


added code-quote to core.clj

added code-quote to core.clj

--- src/push/interpreter/core.clj
+++ src/push/interpreter/core.clj
@@ -4,6 +4,7 @@
             [push.util.exceptions         :as oops]
             [push.router.core             :as router]
             [push.util.scratch            :as scratch]
+            [push.type.definitions.quoted :as quoted]
             [push.util.type-checkers      :as types   :refer [pushcode?]]
             ))


add doc example for elasticsearch and formatter

--- src/riemann/elasticsearch.clj
+++ src/riemann/elasticsearch.clj
@@ -40,8 +40,19 @@
   :es-endpoint     Elasticsearch, default is \"http://127.0.0.1:9200\".
   :es-index        Index name, default is \"riemann\".
   :index-suffix    Index-suffix, default is \"-yyyy.MM.dd\".
-  :type            Type to send to index, default is \"event\"."
+  :type            Type to send to index, default is \"event\".

+  Example:
+
+  (elasticsearch
+    ; ES options
+    {:es-endpoint \"https:example-elastic.com\"
+     :index-suffix \"-yyyy.MM\"}
+    ; (optional) custom event formatter
+    (fn [event]
+      (let
+        [newtags (concat (:tags event) [\"extra-tag\"])]
+        (merge event {:tags newtags}))))"
   [opts & maybe-formatter]
   (let
     [opts (merge {:es-endpoint "http://127.0.0.1:9200"


better error messages for non-homogeneous ds colls

--- src/spec_tools/data_spec.cljc
+++ src/spec_tools/data_spec.cljc
@@ -139,14 +139,18 @@
   (when-not (= 1 (count v))
     (throw
       (ex-info
-        (str "only single maps allowed in nested " proto)
-        {:k n :v v})))
+        (str "data-spec collection " proto
+             " should be homogeneous, " (count v)
+             " values found")
+        {:name n
+         :proto proto
+         :values v})))
   (let [spec (spec n (first v))]
     (st/create-spec {:spec (coll-of-spec spec proto)})))

 (defn spec
   ([name x]
-    (spec name x true))
+   (spec name x true))
   ([name x coll-specs?]
    (cond
      (st/spec? x) x


parsing lines working with regex

parsing lines working with regex

--- src/trend_compliance/core.clj
+++ src/trend_compliance/core.clj
@@ -1,8 +1,8 @@
 (ns trend-compliance.core
-  (:require [clojure.data.csv :as csv]
-            [clojure.java.io :as io]
+  (:require [clojure.java.io :as io]
             [clojure.string :as str]
-            [clojure.pprint :as pp])
+            [clojure.pprint :as pp]
+            [clojure-csv.core :as csv])
   (:gen-class))

 (defn trend-installed?
@@ -49,12 +49,55 @@
      ;; :rem-install rem-install
      }))

+(defn create-detail-map
+  "parse the detail file"
+  [item]
+  (let [[ip cp-name domain mac-ad off-scan-status ping prod-name platform os-server version patt-file scan-eng prev-pol cp-des rem-install] item]
+    {:ip ip
+     ;; :cp-name cp-name
+     ;; :domain domain
+     ;; :mac-ad mac-ad
+     :off-scan-status off-scan-status
+     :ping ping
+     ;; :prod-name prod-name
+     :platform platform
+     ;; :os-server os-server
+     ;; :version version
+     ;; :patt-file patt-file
+     ;; :scan-eng scan-eng
+     ;; :prev-pol prev-pol
+     ;; :cp-des cp-des
+     ;; :rem-install rem-install
+     }))
+
+(defn parse-line
+  "parse each line of a large file"
+  [line]
+  (str/split line #" = "))
+
+(def state (atom {}))
+
+(defn line-to-map
+  "take a line from detail and put into map using an atom"
+  [line]
+  (reset! state {})
+  (swap! state assoc
+    (keyword (re-find #"(?x)\S+" (str (first line))))
+    (re-find #"[^\\\"]\S+[^\\\"]" (str (second line)))))
+
+(defn read-detail
+  "read in a large detail file"
+  [file-name]
+  (with-open [rdr (io/reader file-name)]
+    (let [lines (doall (map parse-line (line-seq rdr)))]
+      (map line-to-map lines))))
+
 (defn read-csv
   "read in a csv file"
   [file-name]
   (with-open [in-file (io/reader file-name)]
-    (doall
-       (csv/read-csv in-file))))
+    (doall (csv/parse-csv in-file))))
+    ;; (doall (csv/parse-csv in-file :end-of-line "\n\n"))))

 (defn -main
   "do some fun stuff with csv files"
@@ -64,6 +107,7 @@
           file-names (str/split in #" ")
           wired (first file-names)
           wireless (second file-names)
+          detail (nth file-names 2)
           wired-csv-data (read-csv wired)
           wireless-csv-data (read-csv wireless)
           wired-data-map (map create-data-map wired-csv-data)


Revert Revert b1673ecac60adf9a404080dbeb08f6ae1124b9ee 0f4c192fca7a640cde4c84b110d12bf24accabc9 bis

--- backend/src/akvo/lumen/endpoint/user.clj
+++ backend/src/akvo/lumen/endpoint/user.clj
@@ -30,8 +30,8 @@
                                                   firstName lastName))}}]
     ["/profile" {:get {:handler (fn [{tenant :tenant
                                     query-params :query-params}]
-                                  (let [u (user/user authorizer tenant (get query-params "email"))]
-                                    (lib/ok (select-keys u [:admin :email :firstName :id :lastName]))))}}]
+                                (let [u (user/user authorizer tenant (get query-params "email"))]
+                                  (lib/ok (select-keys u [:admin :email :firstName :id :lastName]))))}}]]
    ["/admin/users"
     ["" {:get {:handler (fn [{tenant :tenant}]
                           (user/users authorizer tenant))}}]


fix bug caused by partial refactoring

fix bug caused by partial refactoring

--- boot/core/src/boot/core.clj
+++ boot/core/src/boot/core.clj
@@ -205,8 +205,8 @@
 (defn mktgtdir!
   "Create a tempdir managed by boot into which tasks can emit artifacts. See
   https://github.com/tailrecursion/boot#boot-managed-directories for more info."
-  [key & [name]]
-  (util/with-let [f (mktmpdir! key name)]
+  [key]
+  (util/with-let [f (mktmpdir! key)]
     (swap! tgtdirs conj f)
     (set-env! :src-paths #{(.getPath f)})
     (add-sync! (get-env :tgt-path) [(.getPath f)])))


Bump the nREPL dep to 0.2.8

Bump the nREPL dep to 0.2.8

--- boot/core/src/boot/repl.clj
+++ boot/core/src/boot/repl.clj
@@ -2,7 +2,7 @@
   (:require [boot.util :as util]))

 (def ^:dynamic *default-dependencies*
-  (atom '[[org.clojure/tools.nrepl "0.2.7" :exclusions [[org.clojure/clojure]]]]))
+  (atom '[[org.clojure/tools.nrepl "0.2.8" :exclusions [[org.clojure/clojure]]]]))

 (def ^:dynamic *default-middleware*
   (atom (if-not @util/*colorize?* [] ['boot.from.io.aviso.nrepl/pretty-middleware])))


Fix whitespace

Fix whitespace

--- test/buddy/sign/jws_tests.clj
+++ test/buddy/sign/jws_tests.clj
@@ -62,7 +62,7 @@
       (is (= (unsign-exp-fail signed) :nbf))

       (Thread/sleep 3000)
-      (let[unsigned  (jws/unsign signed secret)]
+      (let [unsigned (jws/unsign signed secret)]
         (is (= unsigned (assoc candidate :nbf nbf)))))))

 (deftest jws-other-claims-validation


Update thing->t contract tests

Update thing->t contract tests

--- test/grimoire/things_test.clj
+++ test/grimoire/things_test.clj
@@ -13,6 +13,9 @@
 (defmacro is-assert-error? [x]
   `(is (~'thrown? AssertionError ~x)))

+(defmacro is-nil? [x]
+  `(is (~'nil? ~x)))
+
 (deftest thing-conversion-test
   ;; Testing stuff that should work
   (is (t/group?     (t/thing->group t)))
@@ -25,71 +28,71 @@
 (deftest thing->def-tests
   ;; Testing stuff that should fail
   (testing "Testing thing->def"
-    (is-assert-error?
+    (is-nil?
      (t/thing->def
       (t/thing->namespace t)))

-    (is-assert-error?
+    (is-nil?
      (t/thing->def
       (t/thing->platform t)))

-    (is-assert-error?
+    (is-nil?
      (t/thing->def
       (t/thing->version t)))

-    (is-assert-error?
+    (is-nil?
      (t/thing->def
       (t/thing->artifact t)))

-    (is-assert-error?
+    (is-nil?
      (t/thing->def
       (t/thing->group t)))))

 (deftest thing->namespace-tests
   (testing "Testing thing->namespace"
-    (is-assert-error?
+    (is-nil?
      (t/thing->namespace
       (t/thing->platform t)))

-    (is-assert-error?
+    (is-nil?
      (t/thing->namespace
       (t/thing->version t)))

-    (is-assert-error?
+    (is-nil?
      (t/thing->namespace
       (t/thing->artifact t)))

-    (is-assert-error?
+    (is-nil?
      (t/thing->namespace
       (t/thing->group t)))))

 (deftest thing->platform-tests
   (testing "Testing thing->platform"
-    (is-assert-error?
+    (is-nil?
      (t/thing->platform
       (t/thing->version t)))

-    (is-assert-error?
+    (is-nil?
      (t/thing->platform
       (t/thing->artifact t)))

-    (is-assert-error?
+    (is-nil?
      (t/thing->platform
       (t/thing->group t)))))

 (deftest thing->version-tests
   (testing "Testing thing->version"
-    (is-assert-error?
+    (is-nil?
      (t/thing->version
       (t/thing->artifact t)))

-    (is-assert-error?
+    (is-nil?
      (t/thing->version
       (t/thing->group t)))))

 (deftest thing->artifact-tests
   (testing "Testing thing->artifact"
-    (is-assert-error?
+    (is-nil?
      (t/thing->artifact
       (t/thing->group t)))))


fix minor z bug

fix minor z bug

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -166,7 +166,8 @@
 (defn create-presnap-actions [event]
   (concat
     (when-let [z-drive (:z-drive event)]
-      (list [z-drive #(set-stage-position z-drive (:z event))]))
+      (when-let [z (:z event)]
+        (list [z-drive #(set-stage-position z-drive z)])))
     (for [[axis pos] (get-in event [:position :axes])]
       [axis #(apply set-stage-position axis pos)])
     (for [prop (get-in event [:channel :properties])]
@@ -244,14 +245,15 @@
 (defn make-event-fns [event out-queue]
   (let [event (compute-z-position event)]
     (list
-		#(run-actions (create-presnap-actions event))
-		#(await-for 10000 (device-agents (. mmc getCameraDevice)))
-		#(when-let [wait-time-ms (event :wait-time-ms)]
-		  (acq-sleep wait-time-ms))
-		#(when (:autofocus event)
-		  (store-z-correction (run-autofocus)))
-		#(expose event)
-		#(collect-image event out-queue)
+      ;#(println event)
+      #(run-actions (create-presnap-actions event))
+      #(await-for 10000 (device-agents (. mmc getCameraDevice)))
+      #(when-let [wait-time-ms (event :wait-time-ms)]
+        (acq-sleep wait-time-ms))
+      #(when (:autofocus event)
+        (store-z-correction (run-autofocus)))
+      #(expose event)
+      #(collect-image event out-queue)
     )))

 (defn execute [event-fns]


Fix skip issue

Fix skip issue

--- src/rester/core.clj
+++ src/rester/core.clj
@@ -268,8 +268,8 @@
             (assoc test :error (str (or (.getMessage e) e))))))))

 (defn exec-tests [tests opts]
-  (let [opts (atom opts)
-        skip-tag (opts "skip")
+  (let [skip-tag (opts "skip")
+        opts (atom opts)
         name-to-test (into {} (for [t tests] [(:test t) t]))
         test-agents (vec (map agent tests))
         exec-test (fn [test]
@@ -279,7 +279,7 @@
                           (if (every? (comp :done deref) deps)
                             (assoc
                              (cond
-                               (and skip-tag (= skip-tag skip)) (assoc test :skipped "skip requested")
+                               (and skip-tag (= skip-tag skip)) (assoc test :ignored "skip requested")
                                (true? ignore) (assoc test :ignored "ignored")
                                (every? (comp :success deref) deps)
                                (try


covered current handlers version with tests

--- test/lopare/handlers_test.clj
+++ test/lopare/handlers_test.clj
@@ -31,3 +31,28 @@
              (pre ..start-time.. ..config..) => {:config ..config.. :pre {:error "the error"} :error true :start-time ..start-time..}
              (provided
               (error-handler-wrapper anything) => {:error "the error" :exit 1})))
+
+(fact "handler"
+      (fact "should return correct map when no error"
+            (handler ..time.. ..pre-result..) => {:start-time ..time.. :end-time ..end-time..}
+            (provided
+             (error-handler-wrapper anything) => ..job-result..
+             (time/local-now) => ..end-time..))
+      (fact "should return error map when error"
+            (handler ..start-time.. ..config..) => {:error "the error"}
+            (provided
+             (error-handler-wrapper anything) => {:error "the error" :exit 1})))
+
+(facts "post"
+       (fact "should save correct map when no error"
+             (post ..start-time.. {}) => anything
+             (provided
+              (error-handler-wrapper anything) => ..job-result..
+              (save-run {:post {:start-time ..start-time.. :end-time ..end-time..}}) => anything
+              (time/local-now) => ..end-time..))
+       (fact "should save error map when error"
+             (post ..start-time.. {}) => anything
+             (provided
+              (error-handler-wrapper anything) => {:error "the error"}
+              (time/local-now) => ..end-time..
+              (save-run {:post {:error "the error"} :end-time ..end-time..}) => anything)))


Adds a TODO to hard code http-get instead of using with-fake-routes, maybe we should just do that everywhere? Yes.

--- test/loudmoauth/core_test.clj
+++ test/loudmoauth/core_test.clj
@@ -112,6 +112,7 @@
     (is (= (:code final-state-map) (a/<!! code-chan)))))

 ;This throws an exception that no one catches, but what can we do?
+;TODO - Don't use with-fake-routes here, hard code the http/get method and go with redefs instead.
 (deftest test-fetch-code
   (testing "Test issuing http get for auth-code from oauth provider."
     (reset-channels)


api test base url should get the port value from our config so that we can change it easily if we want to.

--- test/metabase/http_client.clj
+++ test/metabase/http_client.clj
@@ -3,6 +3,7 @@
   (:require [clojure.tools.logging :as log]
             [cheshire.core :as cheshire]
             [clj-http.lite.client :as client]
+            [metabase.config :as config]
             [metabase.util :as u])
   (:import com.metabase.corvus.api.ApiException))

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

 (def ^:dynamic *url-prefix*
   "Prefix to automatically prepend to the URL of calls made with `client`."
-  "http://localhost:3000/api/")
+  (str "http://localhost:" (config/config-str :mb-jetty-port) "/api/"))

 (defn
   ^{:arglists ([credentials? method expected-status-code? url http-body-map? & url-kwargs])}


test that metrics really contains the request stats

--- test/prometheus/core_test.clj
+++ test/prometheus/core_test.clj
@@ -22,5 +22,6 @@
       (is (= {:status 200 :body "ok"} response)))
     (testing "metrics should be a ring response"
       (is (= 200 (:status metrics)))
-      (is (= TextFormat/CONTENT_TYPE_004
-             (get-in metrics [:headers "Content-Type"]))))))
+      (is (= TextFormat/CONTENT_TYPE_004 (get-in metrics [:headers "Content-Type"])))
+      (is (.contains (:body metrics) "http_request_latency_seconds"))
+      (is (.contains (:body metrics) "http_requests_total")))))


Fix GET /api/cards?f=recent :scream_cat:

--- src/metabase/api/card.clj
+++ src/metabase/api/card.clj
@@ -66,19 +66,20 @@
   "Return `Cards` with CARD-IDS.
    Make sure cards are returned in the same order as CARD-IDS`; `[in card-ids]` won't preserve the order."
   [card-ids]
+  {:pre [(every? integer? card-ids)]}
   (let [card-id->card (sel :many :field->obj [Card :id], :id [in card-ids])]
     (filter identity (map card-id->card card-ids))))

 (defn- cards:recent
   "Return the 10 `Cards` most recently viewed by the current user, sorted by how recently they were viewed.0"
   []
-  (cards-with-ids (k/select (k/subselect ViewLog
-                              (k/fields :model_id)
-                              (k/where {:model "card", :user_id *current-user-id*})
-                              (k/order :timestamp :DESC))
-                    (k/modifier "DISTINCT")
-                    (k/fields :model_id)
-                    (k/limit 10))))
+  (cards-with-ids (map :model_id (k/select (k/subselect ViewLog
+                                             (k/fields :model_id)
+                                             (k/where {:model "card", :user_id *current-user-id*})
+                                             (k/order :timestamp :DESC))
+                                   (k/modifier "DISTINCT")
+                                   (k/fields :model_id)
+                                   (k/limit 10)))))

 (defn- cards:popular
   "All `Cards`, sorted by popularity (the total number of times they are viewed in `ViewLogs`).


present shuppet errors better

present shuppet errors better

--- src/shuppet/web.clj
+++ src/shuppet/web.clj
@@ -159,9 +159,27 @@

   (route/not-found (error-response "Resource not found" 404)))

+(defn format-shuppet-exceptions
+  [handler]
+  (fn [req]
+    (try+
+     (handler req)
+     (catch [:type :shuppet.util/aws] e
+       (->  (ring-response/response (write-str e))
+            (ring-response/content-type "application/json")
+            (ring-response/status 409)))
+     (catch  clojure.lang.Compiler$CompilerException e
+       (->  (ring-response/response (write-str {:message (.getMessage e)}))
+            (ring-response/content-type "application/json")
+            (ring-response/status 400)))
+      (catch java.io.FileNotFoundException e
+       (->  (ring-response/response (write-str {:message "Cannot find this one"}))
+            (ring-response/content-type "application/json")
+            (ring-response/status 404))))))

 (def app
   (-> routes
+      (format-shuppet-exceptions)
       (instrument)
       (wrap-error-handling)
       (wrap-ignore-trailing-slash)


Themis will now normalize rules at the validation-seq level, the lowest level of validation

--- src/themis/core.clj
+++ src/themis/core.clj
@@ -68,10 +68,12 @@

 (defn validation-seq
   "Create a lazy sequence of validating a given data structure
-  against the a normalized validation rule-set vector/seq"
-  [t normalized-query]
-  (when (rules/balanced? normalized-query)
-    (mapcat #(validate-vec t %) normalized-query)))
+  against a validation rule-set vector/seq.
+  The resulting seq is of `(coordinate validation-result)` tuples/seq"
+  [t rule-set]
+  (let [normalized-rules (rules/normalize rule-set)]
+    (when (rules/balanced? normalized-rules)
+      (mapcat #(validate-vec t %) normalized-rules))))

 (defn validation
   "Validate a data structure, `t`,
@@ -85,9 +87,9 @@
    (apply merge-with #(flatten (concat [%1] [%2]))
           (mapcat (fn [result-seq]
                     (map #(apply hash-map %) (partition-all 2 result-seq)))
-                  (validation-seq t (rules/normalize rule-set)))))
+                  (validation-seq t rule-set))))
   ([t rule-set merge-fn]
-   (merge-fn (validation-seq t (rules/normalize rule-set)))))
+   (merge-fn (validation-seq t rule-set))))

 (comment


Minor change on code on core ns.

Minor change on code on core ns.

--- src/uxbox/core.cljs
+++ src/uxbox/core.cljs
@@ -1,4 +1,5 @@
 (ns uxbox.core
+  (:require-macros [uxbox.util.syntax :refer [define-once]])
   (:require [beicon.core :as rx]
             [cats.labs.lens :as l]
             [uxbox.state :as st]
@@ -9,8 +10,7 @@

 (enable-console-print!)

-(defn main
-  "Initialize the storage subsystem."
+(defn- main
   []
   (let [lens (l/select-keys [:pages-by-id
                              :shapes-by-id
@@ -23,13 +23,11 @@
                     (rx/tap #(println "[save]")))]
     (rx/on-value stream #(dl/persist-state %))))

-(defonce +setup+
-  (do
-    (println "bootstrap")
+(define-once :setup
+  (println "bootstrap")
+  (st/init)
+  (rt/init)
+  (ui/init)

-    (st/init)
-    (rt/init)
-    (ui/init)
-
-    (rs/emit! (dl/load-data))
-    (main)))
+  (rs/emit! (dl/load-data))
+  (main))


RS+CM #27 - api handler for getting draft section - function order

--- src/objective8/drafts.clj
+++ src/objective8/drafts.clj
@@ -34,24 +34,6 @@
 (defn store-section! [section-data]
   (-> (assoc section-data :entity :section)
       storage/pg-store!))
-
-(defn has-section-label? [section-label section]
-  (some-> (second section)
-      :data-section-label
-      (= section-label)))
-
-(defn get-section-from-hiccup [hiccup section-label]
-  (some #(when (has-section-label? section-label %) [%]) hiccup))
-
-(defn get-section [section-uri]
-  (let [{:keys [entity section-label draft-id] :as query} (uris/uri->query section-uri)]
-    (when (= :section entity)
-      (let [{:keys [content objective-id] :as draft} (retrieve-draft draft-id)
-            section (get-section-from-hiccup content section-label)]
-        (when section
-          {:section section
-           :section-uri section-uri
-           :objective-id objective-id})))))

 (defn store-draft! [draft-data]
   (some-> draft-data
@@ -110,3 +92,21 @@
 (defn get-section-labels-for-draft [draft-id]
   (let [{:keys [content] :as draft} (retrieve-draft draft-id)]
     (map get-section-label content)))
+
+(defn has-section-label? [section-label section]
+  (some-> (second section)
+      :data-section-label
+      (= section-label)))
+
+(defn get-section-from-hiccup [hiccup section-label]
+  (some #(when (has-section-label? section-label %) [%]) hiccup))
+
+(defn get-section [section-uri]
+  (let [{:keys [entity section-label draft-id] :as query} (uris/uri->query section-uri)]
+    (when (= :section entity)
+      (let [{:keys [content objective-id] :as draft} (retrieve-draft draft-id)
+            section (get-section-from-hiccup content section-label)]
+        (when section
+          {:section section
+           :section-uri section-uri
+           :objective-id objective-id})))))


debug ACKs

debug ACKs

--- src/onyx/plugin/kafka.clj
+++ src/onyx/plugin/kafka.clj
@@ -202,6 +202,7 @@

   (ack-segment [_ _ segment-id]
     (when-let [offset (:offset (get @pending-messages segment-id))]
+      (clojure.pprint/pprint ["ACK" (get @pending-messages segment-id)])
       (swap! pending-commits conj offset))
     (swap! pending-messages dissoc segment-id))


Logging as data, also with dates.

Logging as data, also with dates.

* now pretty printing clojure maps to the log
* added date field to the log

--- src/overtone/util/log.clj
+++ src/overtone/util/log.clj
@@ -3,14 +3,16 @@
      :author "Jeff Rose"}
   overtone.util.log
   (:import [java.util.logging Logger Level ConsoleHandler FileHandler
-            StreamHandler SimpleFormatter])
-  (:use [overtone.config store]))
+            StreamHandler Formatter LogRecord]
+           [java.util Date])
+  (:use [overtone.config store]
+        [clojure.pprint :only (pprint)]))

 ; Sets up some basic logging infrastructure and helpers for the project.

 (defonce LOGGER (Logger/getLogger "overtone"))

-(defonce LOG-APPEND false)
+(defonce LOG-APPEND true)
 (defonce LOG-CONSOLE (ConsoleHandler.))

 (def LOG-FILE-HANDLER (FileHandler. OVERTONE-LOG-FILE LOG-APPEND))
@@ -19,6 +21,8 @@
              :info  Level/INFO
              :warn  Level/WARNING
              :error Level/SEVERE})
+
+(def REVERSE-LEVELS (apply hash-map (flatten (map reverse LEVELS))))

 (def DEFAULT-LEVEL :warn)

@@ -29,8 +33,19 @@
       (assert (contains? LEVELS lvl))
       (.setLevel LOGGER (lvl LEVELS)))))

+(defn- log-formatter []
+  (proxy [Formatter] []
+    (format [^LogRecord log-rec]
+      (let [lvl (REVERSE-LEVELS (.getLevel log-rec))
+            msg (.getMessage log-rec)
+            ts (.getMillis log-rec)]
+        (with-out-str (pprint {:level lvl
+                               :timestamp ts
+                               :date (Date. (long ts))
+                               :msg msg}))))))
+
 (defn- print-handler []
-  (let [formatter (SimpleFormatter.)]
+  (let [formatter (log-formatter)]
     (proxy [StreamHandler] []
       (publish [msg] (println (.format formatter msg))))))

@@ -40,7 +55,7 @@
 (defonce LOG-SETUP?
   (do
     (level DEFAULT-LEVEL)
-    (.setFormatter LOG-FILE-HANDLER (SimpleFormatter.))
+    (.setFormatter LOG-FILE-HANDLER (log-formatter))
     (.addHandler LOGGER LOG-FILE-HANDLER)
     true))


Fix misstyped problem

Fix misstyped problem

--- backend/src/akvo/lumen/component/keycloak.clj
+++ backend/src/akvo/lumen/component/keycloak.clj
@@ -51,7 +51,7 @@
                                 json/decode
                                 (get "access_token"))]
        {"Authorization" (str "bearer " access-token)
-        "Conternt-Type" "application/json"}))))
+        "Content-Type" "application/json"}))))

 (defn group-by-path
   "Get the group id (uuid) by using group path.


Add test for details in details

Add test for details in details

--- backend/test/lambdaui/common/details_test.clj
+++ backend/test/lambdaui/common/details_test.clj
@@ -60,6 +60,23 @@
                                   :endTime   nil
                                   :details   []}]}
                       (subject/build-details-from-pipeline foo-pipeline (foo-pipeline-build-state running-status) buildId nil)))))))
+
+  (testing "that it returns build details with details of a running step"
+    (let [buildId 1]
+      (is (= {:buildId 1
+              :steps   [{:stepId    "1"
+                         :state     :success
+                         :name      "do-stuff"
+                         :startTime joda-date-12-str
+                         :type      :step
+                         :steps     []
+                         :endTime   joda-date-14-str
+                         :details   [{:label   "Artifacts"
+                                      :href    "some-href"
+                                      :details [:label "file.txt"
+                                                :href "link-to-file"]}]}]}
+             (subject/build-details-from-pipeline foo-pipeline (artifacts-pipeline-build-state) buildId nil)))))
+
   (testing "that it returns build details of a finished step"
     (doall (for [finished-status [:success :failure :killed]]
              (let [buildId 1]


update core.cljs to upstream

update core.cljs to upstream

--- src/main/cljs/cljs/core.cljs
+++ src/main/cljs/cljs/core.cljs
@@ -94,6 +94,10 @@
 (defn ^boolean not
   "Returns true if x is logical false, false otherwise."
   [x] (if x false true))
+
+(defn ^boolean some?
+  "Returns true if x is not nil, false otherwise."
+  [x] (not (nil? x)))

 (defn ^boolean object? [x]
   (if-not (nil? x)
@@ -395,9 +399,130 @@
     (-flush writer)
     (str sb)))

+;;;;;;;;;;;;;;;;;;; Murmur3 ;;;;;;;;;;;;;;;
+
+;;http://hg.openjdk.java.net/jdk7u/jdk7u6/jdk/file/8c2c5d63a17e/src/share/classes/java/lang/Integer.java
+(defn ^number int-rotate-left [x n]
+  (bit-or
+    (bit-shift-left x n)
+    (unsigned-bit-shift-right x (- n))))
+
+;; http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul
+(if (and (exists? Math/imul)
+         (not (zero? (Math/imul 0xffffffff 5))))
+  (defn ^number imul [a b] (js/Math.imul a b))
+  (defn ^number imul [a b]
+    (let [ah (bit-and (unsigned-bit-shift-right a 16) 0xffff)
+          al (bit-and a 0xffff)
+          bh (bit-and (unsigned-bit-shift-right b 16) 0xffff)
+          bl (bit-and b 0xffff)]
+      (bit-or
+        (+ (* al bl)
+           (unsigned-bit-shift-right
+             (bit-shift-left (+ (* ah bl) (* al bh)) 16) 0)) 0))))
+
+;; http://smhasher.googlecode.com/svn/trunk/MurmurHash3.cpp
+(def m3-seed 0)
+(def m3-C1 0xcc9e2d51)
+(def m3-C2 0x1b873593)
+
+(defn ^number m3-mix-K1 [k1]
+  (-> k1 (imul m3-C1) (int-rotate-left 15) (imul m3-C2)))
+
+(defn ^number m3-mix-H1 [h1 k1]
+  (-> h1 (bit-xor k1) (int-rotate-left 13) (imul 5) (+ 0xe6546b64)))
+
+(defn ^number m3-fmix [h1 len]
+  (as-> h1 h1
+    (bit-xor h1 len)
+    (bit-xor h1 (unsigned-bit-shift-right h1 16))
+    (imul h1 0x85ebca6b)
+    (bit-xor h1 (unsigned-bit-shift-right h1 13))
+    (imul h1 0xc2b2ae35)
+    (bit-xor h1 (unsigned-bit-shift-right h1 16))))
+
+(defn ^number m3-hash-int [in]
+  (if (zero? in)
+    in
+    (let [k1 (m3-mix-K1 in)
+          h1 (m3-mix-H1 m3-seed k1)]
+      (m3-fmix h1 4))))
+
+(defn ^number m3-hash-unencoded-chars [in]
+  (let [h1 (loop [i 1 h1 m3-seed]
+             (if (< i (alength in))
+               (recur (+ i 2)
+                 (m3-mix-H1 h1
+                   (m3-mix-K1
+                     (bit-or (.charCodeAt in (dec i))
+                       (bit-shift-left (.charCodeAt in i) 16)))))
+               h1))
+        h1 (if (== (bit-and (alength in) 1) 1)
+             (bit-xor h1 (m3-mix-K1 (.charCodeAt in (dec (alength in)))))
+             h1)]
+    (m3-fmix h1 (imul 2 (alength in)))))
+
 ;;;;;;;;;;;;;;;;;;; symbols ;;;;;;;;;;;;;;;

-(declare list hash-combine hash Symbol = compare)
+(declare list Symbol = compare)
+
+;; Simple caching of string hashcode
+(def string-hash-cache (js-obj))
+(def string-hash-cache-count 0)
+
+;;http://hg.openjdk.java.net/jdk7u/jdk7u6/jdk/file/8c2c5d63a17e/src/share/classes/java/lang/String.java
+(defn hash-string* [s]
+  (if-not (nil? s)
+    (let [len (alength s)]
+      (if (pos? len)
+        (loop [i 0 hash 0]
+          (if (< i len)
+            (recur (inc i) (+ (imul 31 hash) (.charCodeAt s i)))
+            hash))
+        0))
+    0))
+
+(defn add-to-string-hash-cache [k]
+  (let [h (hash-string* k)]
+    (aset string-hash-cache k h)
+    (set! string-hash-cache-count (inc string-hash-cache-count))
+    h))
+
+(defn hash-string [k]
+  (when (> string-hash-cache-count 255)
+    (set! string-hash-cache (js-obj))
+    (set! string-hash-cache-count 0))
+  (let [h (aget string-hash-cache k)]
+    (if (number? h)
+      h
+      (add-to-string-hash-cache k))))
+
+(defn hash [o]
+  (cond
+    (implements? IHash o)
+    (-hash ^not-native o)
+
+    (number? o)
+    (js-mod (.floor js/Math o) 2147483647)
+
+    (true? o) 1
+
+    (false? o) 0
+
+    (string? o)
+    (m3-hash-int (hash-string o))
+
+    (nil? o) 0
+
+    :else
+    (-hash o)))
+
+(defn hash-combine [seed hash]
+  ; a la boost
+  (bit-xor seed
+    (+ hash 0x9e3779b9
+      (bit-shift-left seed 6)
+      (bit-shift-right seed 2))))

 (defn ^boolean instance? [t o]
   (cljs.core/instance? t o))
@@ -406,7 +531,9 @@
   (instance? Symbol x))

 (defn- hash-symbol [sym]
-  (hash-combine (hash (.-ns sym)) (hash (.-name sym))))
+  (hash-combine
+    (m3-hash-unencoded-chars (.-name sym))
+    (hash-string (.-ns sym))))

 (defn- compare-symbols [a b]
   (cond
@@ -423,26 +550,34 @@
 (deftype Symbol [ns name str ^:mutable _hash _meta]
   Object
   (toString [_] str)
+  (equiv [this other] (-equiv this other))
+
   IEquiv
   (-equiv [_ other]
     (if (instance? Symbol other)
       (identical? str (.-str other))
       false))
+
   IFn
   (-invoke [sym coll]
     (-lookup coll sym nil))
   (-invoke [sym coll not-found]
     (-lookup coll sym not-found))
+
   IMeta
   (-meta [_] _meta)
+
   IWithMeta
   (-with-meta [_ new-meta] (Symbol. ns name str _hash new-meta))
+
   IHash
   (-hash [sym]
     (caching-hash sym hash-symbol _hash))
+
   INamed
   (-name [_] name)
   (-namespace [_] ns)
+
   IPrintWithWriter
   (-pr-writer [o writer _] (-write writer str)))

@@ -540,6 +675,43 @@
          (recur y (first more) (next more))
          (= y (first more)))
        false)))
+
+;;;;;;;;;;;;;;;;;;; Murmur3 Helpers ;;;;;;;;;;;;;;;;
+
+(defn ^number mix-collection-hash
+  "Mix final collection hash for ordered or unordered collections.
+   hash-basis is the combined collection hash, count is the number
+   of elements included in the basis. Note this is the hash code
+   consistent with =, different from .hashCode.
+   See http://clojure.org/data_structures#hash for full algorithms."
+  [hash-basis count]
+  (let [h1 m3-seed
+        k1 (m3-mix-K1 hash-basis)
+        h1 (m3-mix-H1 h1 k1)]
+    (m3-fmix h1 count)))
+
+(defn ^number hash-ordered-coll
+  "Returns the hash code, consistent with =, for an external ordered
+   collection implementing Iterable.
+   See http://clojure.org/data_structures#hash for full algorithms."
+  [coll]
+  (loop [n 0 hash-code 1 coll (seq coll)]
+    (if-not (nil? coll)
+      (recur (inc n) (bit-or (+ (imul 31 hash-code) (hash (first coll))) 0)
+        (next coll))
+      (mix-collection-hash hash-code n))))
+
+(defn ^number hash-unordered-coll
+  "Returns the hash code, consistent with =, for an external unordered
+   collection implementing Iterable. For maps, the iterator should
+   return map entries whose hash is computed as
+     (hash-ordered-coll [k v]).
+   See http://clojure.org/data_structures#hash for full algorithms."
+  [coll]
+  (loop [n 0 hash-code 0 coll (seq coll)]
+    (if-not (nil? coll)
+      (recur (inc n) (bit-or (+ hash-code (hash (first coll))) 0) (next coll))
+      (mix-collection-hash hash-code n))))

 ;;;;;;;;;;;;;;;;;;; protocols on primitives ;;;;;;;;
 (declare hash-map list equiv-sequential)
@@ -673,6 +845,8 @@
   Object
   (toString [coll]
    (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))

   ICloneable
   (-clone [_] (IndexedSeq. arr i))
@@ -723,7 +897,7 @@
     (array-reduce arr f start i))

   IHash
-  (-hash [coll] (hash-coll coll))
+  (-hash [coll] (hash-ordered-coll coll))

   IReversible
   (-rseq [coll]
@@ -750,6 +924,8 @@
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))

   ICloneable
   (-clone [_] (RSeq. ci i meta))
@@ -774,7 +950,7 @@
     (if (pos? i)
       (RSeq. ci (dec i) nil)
       ()))
-
+
   INext
   (-next [coll]
     (when (pos? i)
@@ -791,7 +967,7 @@
   (-empty [coll] (with-meta js/cljs.core.List.EMPTY meta))

   IHash
-  (-hash [coll] (hash-coll coll))
+  (-hash [coll] (hash-ordered-coll coll))

   IReduce
   (-reduce [col f] (seq-reduce f col))
@@ -870,7 +1046,7 @@

       (array? coll)
       (alength coll)
-
+
       (string? coll)
       (alength coll)

@@ -975,14 +1151,14 @@
         (array? o)
         (when (< k (.-length o))
           (aget o k))
-
+
         (string? o)
         (when (< k (.-length o))
           (aget o k))

         (native-satisfies? ILookup o)
         (-lookup o k)
-
+
         :else nil)))
   ([o k not-found]
     (if-not (nil? o)
@@ -994,7 +1170,7 @@
         (if (< k (.-length o))
           (aget o k)
           not-found)
-
+
         (string? o)
         (if (< k (.-length o))
           (aget o k)
@@ -1046,6 +1222,8 @@
     (MetaFn. afn new-meta))
   Fn
   IFn
+  (-invoke [_]
+    (afn))
   (-invoke [_ a]
     (afn a))
   (-invoke [_ a b]
@@ -1134,45 +1312,6 @@
           (recur ret (first ks) (next ks))
           ret)))))

-;; Simple caching of string hashcode
-(def string-hash-cache (js-obj))
-(def string-hash-cache-count 0)
-
-(defn add-to-string-hash-cache [k]
-  (let [h (goog.string/hashCode k)]
-    (aset string-hash-cache k h)
-    (set! string-hash-cache-count (inc string-hash-cache-count))
-    h))
-
-(defn check-string-hash-cache [k]
-  (when (> string-hash-cache-count 255)
-    (set! string-hash-cache (js-obj))
-    (set! string-hash-cache-count 0))
-  (let [h (aget string-hash-cache k)]
-    (if (number? h)
-      h
-      (add-to-string-hash-cache k))))
-
-(defn hash [o]
-  (cond
-    (implements? IHash o)
-    (-hash ^not-native o)
-
-    (number? o)
-    (js-mod (.floor js/Math o) 2147483647)
-
-    (true? o) 1
-
-    (false? o) 0
-
-    (string? o)
-    (check-string-hash-cache o)
-
-    (nil? o) 0
-
-    :else
-    (-hash o)))
-
 (defn ^boolean empty?
   "Returns true if coll has no items - same as (not (seq coll)).
   Please use the idiom (seq x) rather than (not (empty? x))"
@@ -1462,7 +1601,7 @@

        (string? coll)
        (array-reduce coll f)
-
+
        (native-satisfies? IReduce coll)
        (-reduce coll f)

@@ -1475,10 +1614,10 @@

        (array? coll)
        (array-reduce coll f val)
-
+
        (string? coll)
        (array-reduce coll f val)
-
+
        (native-satisfies? IReduce coll)
        (-reduce coll f val)

@@ -1675,19 +1814,19 @@
 (defn unchecked-remainder-int [x n]
   (cljs.core/unchecked-remainder-int x n))

-(defn ^number unchecked-substract
+(defn ^number unchecked-subtract
   "If no ys are supplied, returns the negation of x, else subtracts
   the ys from x and returns the result."
   ([x] (cljs.core/unchecked-subtract x))
   ([x y] (cljs.core/unchecked-subtract x y))
-  ([x y & more] (reduce unchecked-substract (cljs.core/unchecked-subtract x y) more)))
-
-(defn ^number unchecked-substract-int
+  ([x y & more] (reduce unchecked-subtract (cljs.core/unchecked-subtract x y) more)))
+
+(defn ^number unchecked-subtract-int
   "If no ys are supplied, returns the negation of x, else subtracts
   the ys from x and returns the result."
   ([x] (cljs.core/unchecked-subtract-int x))
   ([x y] (cljs.core/unchecked-subtract-int x y))
-  ([x y & more] (reduce unchecked-substract-int (cljs.core/unchecked-subtract-int x y) more)))
+  ([x y & more] (reduce unchecked-subtract-int (cljs.core/unchecked-subtract-int x y) more)))

 (defn- ^number fix [q]
   (if (>= q 0)
@@ -1887,12 +2026,6 @@
              (= (first xs) (first ys)) (recur (next xs) (next ys))
              :else false)))))

-(defn hash-combine [seed hash]
-  ; a la boost
-  (bit-xor seed (+ hash 0x9e3779b9
-                   (bit-shift-left seed 6)
-                   (bit-shift-right seed 2))))
-
 (defn- hash-coll [coll]
   (if (seq coll)
     (loop [res (hash (first coll)) s (next coll)]
@@ -1940,6 +2073,8 @@
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))

   IList

@@ -1981,7 +2116,7 @@
   (-equiv [coll other] (equiv-sequential coll other))

   IHash
-  (-hash [coll] (caching-hash coll hash-coll __hash))
+  (-hash [coll] (caching-hash coll hash-ordered-coll __hash))

   ISeqable
   (-seq [coll] coll)
@@ -1997,6 +2132,8 @@
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))

   IList

@@ -2077,6 +2214,8 @@
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))

   IList

@@ -2109,11 +2248,11 @@
   (-equiv [coll other] (equiv-sequential coll other))

   IHash
-  (-hash [coll] (caching-hash coll hash-coll __hash))
+  (-hash [coll] (caching-hash coll hash-ordered-coll __hash))

   ISeqable
   (-seq [coll] coll)
-
+
   IReduce
   (-reduce [coll f] (seq-reduce f coll))
   (-reduce [coll f start] (seq-reduce f start coll)))
@@ -2129,10 +2268,15 @@
 (defn ^boolean list? [x]
   (satisfies? IList x))

+(defn hash-keyword [k]
+  (int (+ (hash-symbol k) 0x9e3779b9)))
+
 (deftype Keyword [ns name fqn ^:mutable _hash]
   Object
   (toString [_] (str ":" fqn))
-
+  (equiv [this other]
+    (-equiv this other))
+
   IEquiv
   (-equiv [_ other]
     (if (instance? Keyword other)
@@ -2145,14 +2289,8 @@
     (get coll kw not-found))

   IHash
-  (-hash [_]
-    ; This was checking if _hash == -1, should it stay that way?
-    (if (nil? _hash)
-      (do
-        (set! _hash (+ (hash-combine (hash ns) (hash name))
-                        0x9e3779b9))
-        _hash)
-      _hash))
+  (-hash [this]
+    (caching-hash this hash-keyword _hash))

   INamed
   (-name [_] name)
@@ -2198,7 +2336,8 @@
   Object
   (toString [coll]
     (pr-str* coll))
-
+  (equiv [this other]
+    (-equiv this other))
   (sval [coll]
     (if (nil? fn)
       s
@@ -2241,7 +2380,7 @@
   (-equiv [coll other] (equiv-sequential coll other))

   IHash
-  (-hash [coll] (caching-hash coll hash-coll __hash))
+  (-hash [coll] (caching-hash coll hash-ordered-coll __hash))

   ISeqable
   (-seq [coll]
@@ -2312,7 +2451,9 @@
   Object
   (toString [coll]
     (pr-str* coll))
-
+  (equiv [this other]
+    (-equiv this other))
+
   IWithMeta
   (-with-meta [coll m]
     (ChunkedCons. chunk more m __hash))
@@ -2366,7 +2507,7 @@
   (-empty [coll] (with-meta js/cljs.core.List.EMPTY meta))

   IHash
-  (-hash [coll] (caching-hash coll hash-coll __hash)))
+  (-hash [coll] (caching-hash coll hash-ordered-coll __hash)))

 (defn chunk-cons [chunk rest]
   (if (zero? (-count chunk))
@@ -3374,6 +3515,8 @@
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))

   ICloneable
   (-clone [_] (PersistentVector. meta cnt shift root tail __hash))
@@ -3429,7 +3572,7 @@
   (-equiv [coll other] (equiv-sequential coll other))

   IHash
-  (-hash [coll] (caching-hash coll hash-coll __hash))
+  (-hash [coll] (caching-hash coll hash-ordered-coll __hash))

   ISeqable
   (-seq [coll]
@@ -3556,6 +3699,8 @@
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))

   IWithMeta
   (-with-meta [coll m]
@@ -3614,7 +3759,7 @@
         (chunked-seq vec (unchecked-array-for vec end) end 0))))

   IHash
-  (-hash [coll] (caching-hash coll hash-coll __hash))
+  (-hash [coll] (caching-hash coll hash-ordered-coll __hash))

   IReduce
   (-reduce [coll f]
@@ -3635,6 +3780,8 @@
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))

   ICloneable
   (-clone [_] (Subvec. meta v start end __hash))
@@ -3665,7 +3812,7 @@
   (-equiv [coll other] (equiv-sequential coll other))

   IHash
-  (-hash [coll] (caching-hash coll hash-coll __hash))
+  (-hash [coll] (caching-hash coll hash-ordered-coll __hash))

   ISeqable
   (-seq [coll]
@@ -3937,6 +4084,8 @@
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))

   IWithMeta
   (-with-meta [coll meta] (PersistentQueueSeq. meta front rear __hash))
@@ -3964,7 +4113,7 @@
   (-equiv [coll other] (equiv-sequential coll other))

   IHash
-  (-hash [coll] (caching-hash coll hash-coll __hash))
+  (-hash [coll] (caching-hash coll hash-ordered-coll __hash))

   ISeqable
   (-seq [coll] coll))
@@ -3973,6 +4122,8 @@
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))

   ICloneable
   (-clone [coll] (PersistentQueue. meta count front rear __hash))
@@ -4010,7 +4161,7 @@
   (-equiv [coll other] (equiv-sequential coll other))

   IHash
-  (-hash [coll] (caching-hash coll hash-coll __hash))
+  (-hash [coll] (caching-hash coll hash-ordered-coll __hash))

   ISeqable
   (-seq [coll]
@@ -4024,6 +4175,9 @@
 (set! js/cljs.core.PersistentQueue.EMPTY (PersistentQueue. nil 0 nil [] 0))

 (deftype NeverEquiv []
+  Object
+  (equiv [this other]
+    (-equiv this other))
   IEquiv
   (-equiv [o other] false))

@@ -4093,6 +4247,8 @@
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))

   IWithMeta
   (-with-meta [coll meta] (ObjMap. meta keys strobj update-count __hash))
@@ -4115,7 +4271,7 @@
   (-equiv [coll other] (equiv-map coll other))

   IHash
-  (-hash [coll] (caching-hash coll hash-imap __hash))
+  (-hash [coll] (caching-hash coll hash-unordered-coll __hash))

   ISeqable
   (-seq [coll]
@@ -4195,6 +4351,45 @@

 (set! js/cljs.core.ObjMap.HASHMAP_THRESHOLD 8)

+
+;; EXPERIMENTAL: subject to change
+(deftype Iterator [^:mutable s]
+  Object
+  (next [_]
+    (if-not (nil? s)
+      (let [x (first s)]
+        (set! s (next s))
+        #js {:value x :done false})
+      #js {:value nil :done true})))
+
+(defn iterator [coll]
+  (Iterator. (seq coll)))
+
+;; EXPERIMENTAL: subject to change
+(deftype EntriesIterator [^:mutable s]
+  Object
+  (next [_]
+    (if-not (nil? s)
+      (let [[k v] (first s)]
+        (set! s (next s))
+        #js {:value #js [k v] :done false})
+      #js {:value nil :done true})))
+
+(defn entries-iterator [coll]
+  (EntriesIterator. (seq coll)))
+
+;; EXPERIMENTAL: subject to change
+(deftype SetEntriesIterator [^:mutable s]
+  Object
+  (next [_]
+    (if-not (nil? s)
+      (let [x (first s)]
+        (set! s (next s))
+        #js {:value #js [x x] :done false})
+      #js {:value nil :done true})))
+
+(defn set-entries-iterator [coll]
+  (SetEntriesIterator. (seq coll)))
 (set! js/cljs.core.ObjMap.fromObject (fn [ks obj] (ObjMap. nil ks obj 0 nil)))

 ;;; PersistentArrayMap
@@ -4278,7 +4473,9 @@
   Object
   (toString [coll]
     (pr-str* coll))
-
+  (equiv [this other]
+    (-equiv this other))
+
   IMeta
   (-meta [coll] _meta)

@@ -4305,8 +4502,8 @@
   (-empty [coll] (with-meta js/cljs.core.List.EMPTY _meta))

   IHash
-  (-hash [coll] (hash-coll coll))
-
+  (-hash [coll] (hash-ordered-coll coll))
+
   ISeq
   (-first [coll]
     [(aget arr i) (aget arr (inc i))])
@@ -4329,10 +4526,29 @@
   (when (<= i (- (alength arr) 2))
     (PersistentArrayMapSeq. arr i _meta)))

+(declare keys vals)
+
 (deftype PersistentArrayMap [meta cnt arr ^:mutable __hash]
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))
+
+  ;; EXPERIMENTAL: subject to change
+  (keys [coll]
+    (iterator (keys coll)))
+  (entries [coll]
+    (entries-iterator (seq coll)))
+  (values [coll]
+    (iterator (vals coll)))
+  (has [coll k]
+    (contains? coll k))
+  (get [coll k]
+    (-lookup coll k))
+  (forEach [coll f]
+    (doseq [[k v] coll]
+      (f v k)))

   ICloneable
   (-clone [_] (PersistentArrayMap. meta cnt arr __hash))
@@ -4363,7 +4579,7 @@
   (-equiv [coll other] (equiv-map coll other))

   IHash
-  (-hash [coll] (caching-hash coll hash-imap __hash))
+  (-hash [coll] (caching-hash coll hash-unordered-coll __hash))

   ISeqable
   (-seq [coll]
@@ -4433,13 +4649,13 @@
               @init
               (recur (+ i 2) init)))
           init))))
-
+
   IReduce
   (-reduce [coll f]
     (seq-reduce f coll))
   (-reduce [coll f start]
     (seq-reduce f start coll))
-
+
   IFn
   (-invoke [coll k]
     (-lookup coll k))
@@ -4457,7 +4673,7 @@

 (set! js/cljs.core.PersistentArrayMap.fromArray
   (fn [arr ^boolean no-clone ^boolean no-check]
-    (let [arr (if no-clone arr (aclone arr))]
+    (let [arr (if no-clone arr (aclone arr))]
       (if no-check
         (let [cnt (/ (alength arr) 2)]
           (PersistentArrayMap. nil cnt arr nil))
@@ -5050,6 +5266,8 @@
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))

   IMeta
   (-meta [coll] meta)
@@ -5088,7 +5306,7 @@
   (-equiv [coll other] (equiv-sequential coll other))

   IHash
-  (-hash [coll] (caching-hash coll hash-coll __hash))
+  (-hash [coll] (caching-hash coll hash-ordered-coll __hash))

   IReduce
   (-reduce [coll f] (seq-reduce f coll))
@@ -5115,6 +5333,8 @@
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))

   IMeta
   (-meta [coll] meta)
@@ -5146,7 +5366,7 @@
   (-equiv [coll other] (equiv-sequential coll other))

   IHash
-  (-hash [coll] (caching-hash coll hash-coll __hash))
+  (-hash [coll] (caching-hash coll hash-ordered-coll __hash))

   IReduce
   (-reduce [coll f] (seq-reduce f coll))
@@ -5172,6 +5392,23 @@
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))
+
+  ;; EXPERIMENTAL: subject to change
+  (keys [coll]
+    (iterator (keys coll)))
+  (entries [coll]
+    (entries-iterator (seq coll)))
+  (values [coll]
+    (iterator (vals coll)))
+  (has [coll k]
+    (contains? coll k))
+  (get [coll k]
+    (-lookup coll k))
+  (forEach [coll f]
+    (doseq [[k v] coll]
+      (f v k)))

   ICloneable
   (-clone [_] (PersistentHashMap. meta cnt root has-nil? nil-val __hash))
@@ -5202,7 +5439,7 @@
   (-equiv [coll other] (equiv-map coll other))

   IHash
-  (-hash [coll] (caching-hash coll hash-imap __hash))
+  (-hash [coll] (caching-hash coll hash-unordered-coll __hash))

   ISeqable
   (-seq [coll]
@@ -5404,6 +5641,8 @@
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))

   ISeqable
   (-seq [this] this)
@@ -5436,7 +5675,7 @@
   (-empty [coll] (with-meta js/cljs.core.List.EMPTY meta))

   IHash
-  (-hash [coll] (caching-hash coll hash-coll __hash))
+  (-hash [coll] (caching-hash coll hash-ordered-coll __hash))

   IMeta
   (-meta [coll] meta)
@@ -5590,7 +5829,7 @@
   (-val [node] val)

   IHash
-  (-hash [coll] (caching-hash coll hash-coll __hash))
+  (-hash [coll] (caching-hash coll hash-ordered-coll __hash))

   IEquiv
   (-equiv [coll other] (equiv-sequential coll other))
@@ -5731,7 +5970,7 @@
   (-val [node] val)

   IHash
-  (-hash [coll] (caching-hash coll hash-coll __hash))
+  (-hash [coll] (caching-hash coll hash-ordered-coll __hash))

   IEquiv
   (-equiv [coll other] (equiv-sequential coll other))
@@ -5909,6 +6148,23 @@
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))
+
+  ;; EXPERIMENTAL: subject to change
+  (keys [coll]
+    (iterator (keys coll)))
+  (entries [coll]
+    (entries-iterator (seq coll)))
+  (values [coll]
+    (iterator (vals coll)))
+  (has [coll k]
+    (contains? coll k))
+  (get [coll k]
+    (-lookup coll k))
+  (forEach [coll f]
+    (doseq [[k v] coll]
+      (f v k)))

   (entry-at [coll k]
     (loop [t tree]
@@ -5947,7 +6203,7 @@
   (-equiv [coll other] (equiv-map coll other))

   IHash
-  (-hash [coll] (caching-hash coll hash-imap __hash))
+  (-hash [coll] (caching-hash coll hash-unordered-coll __hash))

   ICounted
   (-count [coll] cnt)
@@ -6087,6 +6343,8 @@
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))

   IMeta
   (-meta [coll] _meta)
@@ -6109,8 +6367,8 @@
   (-empty [coll] (with-meta js/cljs.core.List.EMPTY _meta))

   IHash
-  (-hash [coll] (hash-coll coll))
-
+  (-hash [coll] (hash-ordered-coll coll))
+
   ISeq
   (-first [coll]
     (let [^not-native me (-first mseq)]
@@ -6151,6 +6409,8 @@
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))

   IMeta
   (-meta [coll] _meta)
@@ -6173,7 +6433,7 @@
   (-empty [coll] (with-meta js/cljs.core.List.EMPTY _meta))

   IHash
-  (-hash [coll] (hash-coll coll))
+  (-hash [coll] (hash-ordered-coll coll))

   ISeq
   (-first [coll]
@@ -6257,6 +6517,21 @@
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))
+
+  ;; EXPERIMENTAL: subject to change
+  (keys [coll]
+    (iterator (seq coll)))
+  (entries [coll]
+    (set-entries-iterator (seq coll)))
+  (values [coll]
+    (iterator (seq coll)))
+  (has [coll k]
+    (contains? coll k))
+  (forEach [coll f]
+    (doseq [[k v] coll]
+      (f v k)))

   ICloneable
   (-clone [_] (PersistentHashSet. meta hash-map __hash))
@@ -6283,7 +6558,7 @@
              other)))

   IHash
-  (-hash [coll] (caching-hash coll hash-iset __hash))
+  (-hash [coll] (caching-hash coll hash-unordered-coll __hash))

   ISeqable
   (-seq [coll] (keys hash-map))
@@ -6372,6 +6647,21 @@
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))
+
+  ;; EXPERIMENTAL: subject to change
+  (keys [coll]
+    (iterator (seq coll)))
+  (entries [coll]
+    (set-entries-iterator (seq coll)))
+  (values [coll]
+    (iterator (seq coll)))
+  (has [coll k]
+    (contains? coll k))
+  (forEach [coll f]
+    (doseq [[k v] coll]
+      (f v k)))

   ICloneable
   (-clone [_] (PersistentTreeSet. meta tree-map __hash))
@@ -6398,7 +6688,7 @@
              other)))

   IHash
-  (-hash [coll] (caching-hash coll hash-iset __hash))
+  (-hash [coll] (caching-hash coll hash-unordered-coll __hash))

   ISeqable
   (-seq [coll] (keys tree-map))
@@ -6611,6 +6901,8 @@
   Object
   (toString [coll]
     (pr-str* coll))
+  (equiv [this other]
+    (-equiv this other))

   ICloneable
   (-clone [_] (Range. meta start end step __hash))
@@ -6656,7 +6948,7 @@
   (-equiv [rng other] (equiv-sequential rng other))

   IHash
-  (-hash [rng] (caching-hash rng hash-coll __hash))
+  (-hash [rng] (caching-hash rng hash-ordered-coll __hash))

   ICounted
   (-count [rng]
@@ -6808,11 +7100,14 @@
 (defn re-matches
   "Returns the result of (re-find re s) if re fully matches s."
   [re s]
-  (let [matches (.exec re s)]
-    (when (= (first matches) s)
-      (if (== (count matches) 1)
-        (first matches)
-        (vec matches)))))
+  (if (string? s)
+    (let [matches (.exec re s)]
+      (when (= (first matches) s)
+        (if (== (count matches) 1)
+          (first matches)
+          (vec matches))))
+    (throw (js/TypeError. "re-matches must match against a string."))))
+

 (defn re-find
   "Returns the first regex match, if any, of s to re, using
@@ -6820,11 +7115,13 @@
   substring, then any capturing groups if the regular expression contains
   capturing groups."
   [re s]
-  (let [matches (.exec re s)]
-    (when-not (nil? matches)
-      (if (== (count matches) 1)
-        (first matches)
-        (vec matches)))))
+  (if (string? s)
+    (let [matches (.exec re s)]
+      (when-not (nil? matches)
+        (if (== (count matches) 1)
+          (first matches)
+          (vec matches))))
+    (throw (js/TypeError. "re-find must match against a string."))))

 (defn re-seq
   "Returns a lazy sequence of successive matches of re in s."
@@ -6913,11 +7210,11 @@
               ;; handle CLJS ctors
               ^boolean (.-cljs$lang$type obj)
               (.cljs$lang$ctorPrWriter obj obj writer opts)
-
+
               ; Use the new, more efficient, IPrintWithWriter interface when possible.
               (implements? IPrintWithWriter obj)
               (-pr-writer ^not-native obj writer opts)
-
+
               (or (identical? (type obj) js/Boolean) (number? obj))
               (-write writer (str obj))

@@ -7161,7 +7458,7 @@

   Subvec
   (-compare [x y] (compare-indexed x y))
-
+
   PersistentVector
   (-compare [x y] (compare-indexed x y)))

@@ -7176,8 +7473,12 @@
   (-swap! [o f] [o f a] [o f a b] [o f a b xs]))

 (deftype Atom [state meta validator watches]
+  Object
+  (equiv [this other]
+    (-equiv this other))
+
   IAtom
-
+
   IEquiv
   (-equiv [o other] (identical? o other))

@@ -7356,17 +7657,17 @@

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Delay ;;;;;;;;;;;;;;;;;;;;

-(deftype Delay [state f]
+(deftype Delay [^:mutable f ^:mutable value]
   IDeref
   (-deref [_]
-    (:value (swap! state (fn [{:keys [done] :as curr-state}]
-                           (if done
-                             curr-state,
-                             {:done true :value (f)})))))
+    (when f
+      (set! value (f))
+      (set! f nil))
+    value)

   IPending
   (-realized? [d]
-    (:done @state)))
+    (not f)))

 (defn ^boolean delay?
   "returns true if x is a Delay created with delay"
@@ -7449,7 +7750,7 @@

                   (array? x)
                   (vec (map thisfn x))
-
+
                   (identical? (type x) js/Object)
                   (into {} (for [k (js-keys x)]
                              [(keyfn k) (thisfn (aget x k))]))
@@ -7823,7 +8124,7 @@
       (when-not target-fn
         (throw-no-method-error name dispatch-val))
       (apply target-fn a b c d e f g h i j k l m n o p q r s t rest)))
-
+
   IMultiFn
   (-reset [mf]
     (swap! method-table (fn [mf] {}))
@@ -7903,6 +8204,8 @@
 (deftype UUID [uuid]
   Object
   (toString [_] uuid)
+  (equiv [this other]
+    (-equiv this other))

   IEquiv
   (-equiv [_ other]


Fix bad merge.

Fix bad merge.

--- src/onyx/messaging/aeron.clj
+++ src/onyx/messaging/aeron.clj
@@ -378,7 +378,7 @@
       (extensions/emit (:onyx.core/monitoring event) (->MonitorEventBytes :peer-send-bytes size))
       (pubm/write pub-man buf 0 size))))

-(defmethod extensions/internal-complete-message AeronMessenger
+(defmethod extensions/internal-complete-segment AeronMessenger
   [messenger event completion-id {:keys [peer-task-id channel] :as conn-spec}]
   (if ((:short-circuitable? messenger) channel)
     (complete-message-short-circuit (:release-ch (lookup-channels messenger peer-task-id)) completion-id)


Fix clojure syntax issue

Fix clojure syntax issue

--- MOAL/storage/serialization/sexpressions.clj
+++ MOAL/storage/serialization/sexpressions.clj
@@ -19,7 +19,7 @@

 ; Using raw data instead of evaluation via `

-; (str ("foo" "bar")) Error
+; (str ("foo" "bar")) ; Error
 (str `("foo" "bar")) ; No error

 (= 2 2)
@@ -35,7 +35,7 @@
 (dec 2)
 (+ (inc 3) (dec 2))
 (= (inc 3) (+ 3 1))
-(< 3.14159 Math/PI
+(< 3.14159 Math/PI)

 (format "Hello, %s %s" "Chris" "Tabor")
 (str "foo" "bar")


changed structure of atom

changed structure of atom

--- src/quick_chess/core.cljs
+++ src/quick_chess/core.cljs
@@ -41,14 +41,17 @@
          {:piece piece :color color})
        row-pieces row-colors))
     init-pieces init-colors)
-   :white-string-map (string-mapping
-                      (range 6 8)
-                      (range 8)
-                      (map char (range 97 113)))
-   :black-string-map (string-mapping
-                      (range 2)
-                      (range 8)
-                      (map char (range 97 113)))
+
+   :string-map
+   {:white (string-mapping
+            (range 6 8)
+            (range 8)
+            (map char (range 97 113)))
+    :black (string-mapping
+            (range 2)
+            (range 8)
+            (map char (range 97 113)))}
+
    :turn :white})

 (defonce black #{\u265F \u265C \u265E \u265D \u265B \u265A})
@@ -91,7 +94,7 @@
   [:input {:type "range" :value (:width state) :min 250 :max 700
            :style {:width "200px"}
            :on-change (fn [e]
-                        (let [val (.-target.value e)]
+                        (let [val (js/parseInt (.-target.value e))]
                           (swap! app-state assoc :width val :height val)))}])

 (defn input-view
@@ -105,20 +108,31 @@
                             (let [c (-> e .-target .-value)]
                               (reset! value c)))}])))

+(defn cell-view
+  "todo"
+  [state]
+  )
+
+(defn row-view
+  "todo"
+  [state]
+  )
+
 (defn board-view
   "the board"
   [state]
   [:table {:style (board-style state)}
-   (map-indexed
-    (fn [row-idx row]
-      ^{:key row-idx} [:tr {:style (tr-style state)}
-                   (map-indexed
-                    (fn [col-idx elem]
-                      ^{:key col-idx} [:td {:style (td-style state (:color elem))}
-                                       [:div {:style (piece-style state)} (:piece elem)]
-                                       [:div {:style {:text-align "center"}} "_"]])
-                    row)])
-    (:board state))])
+   [:tbody
+    (map-indexed
+     (fn [row-idx row]
+       ^{:key row-idx} [:tr {:style (tr-style state)}
+                        (map-indexed
+                         (fn [col-idx elem]
+                           ^{:key col-idx} [:td {:style (td-style state (:color elem))}
+                                            [:div {:style (piece-style state)} (:piece elem)]
+                                            [:div {:style {:text-align "center"}} "_"]])
+                         row)])
+     (:board state))]])

 (defn app-view
   "main component of our app"


Specify :dynamic metadata with Clojure 1.2 compatible syntax.

--- src/rosado/processing.clj
+++ src/rosado/processing.clj
@@ -15,7 +15,7 @@

 ;; used by functions in this lib. Use binding to set it
 ;; to an instance of processing.core.PApplet
-(def ^:dynamic *applet*)
+(def ^{:dynamic true} *applet*)

 (def toupper (memfn toUpperCase))


core: key, val

core: key, val

--- data/core.clj
+++ data/core.clj
@@ -1037,3 +1037,15 @@
   "Returns a sequence of the map's values, in the same order as (seq map)."
   {:added "1.0"}
   [map] (vals* map))
+
+(defn key
+  "Returns the key of the map entry."
+  {:added "1.0"}
+  [e]
+  (first e))
+
+(defn val
+  "Returns the value in the map entry."
+  {:added "1.0"}
+  [e]
+  (second e))


cleanup resolve-type, properly handle non-nullable types

--- src/main/clojure/cljs/compiler.cljc
+++ src/main/clojure/cljs/compiler.cljc
@@ -495,7 +495,8 @@
     (get mapped-types t) (get mapped-types t)

     #?(:clj  (.startsWith t "!")
-       :cljs (gstring/startsWith t "!")) t
+       :cljs (gstring/startsWith t "!"))
+    (str "!" (resolve-type env (subs t 1)))

     #?(:clj  (.startsWith t "{")
        :cljs (gstring/startsWith t "{")) t
@@ -503,16 +504,12 @@
     #?(:clj  (.startsWith t "function")
        :cljs (gstring/startsWith t "function")) t

+    #?(:clj  (.endsWith t "=")
+       :cljs (gstring/endsWith t "="))
+    (str (resolve-type env (subs t 0 (dec (count t)))) "=")
+
     :else
-    (let [optional? #?(:clj  (.endsWith t "=")
-                       :cljs (gstring/endsWith t "="))
-          t         (if optional?
-                      (subs t 0 (dec (count t)))
-                      t)
-          ret       (munge (str (:name (ana/resolve-var env (symbol t)))))]
-      (if optional?
-        (str ret "=")
-        ret))))
+    (munge (str (:name (ana/resolve-var env (symbol t)))))))

 (defn resolve-types [env ts]
   (let [ts (-> ts string/trim (subs 1 (dec (count ts))))


Fix region selector placeholder text

Fix region selector placeholder text

--- frontend/components/project_settings.cljs
+++ frontend/components/project_settings.cljs
@@ -1170,13 +1170,12 @@
                [:form
                 [:legend (name app-name)]

-                [:p "The AWS region " (name app-name) " lives in."]
                 [:div.styled-select
                   [:select {:class (when (not aws-region) "placeholder")
                             :value (or aws-region "")
                             ;; Updates the project cursor in order to trigger a re-render
                             :on-change #(utils/edit-input controls-ch (conj state/project-path :aws :services :codedeploy app-name :region) %)}
-                    [:option {:value ""} "AWS Region"]
+                    [:option {:value ""} "Choose AWS Region..."]
                     [:option {:disabled "disabled"} "-----"]
                     [:option {:value "us-east-1"} "us-east-1"]
                     [:option {:value "us-west-2"} "us-west-2"]]


reposition entity

reposition entity

--- higher/desktop/src-common/higher/core.clj
+++ higher/desktop/src-common/higher/core.clj
@@ -6,7 +6,7 @@
   :on-show
   (fn [screen entities]
     (update! screen :renderer (stage))
-    (texture "Clojure_logo.gif"))
+    (assoc (texture "Clojure_logo.gif") :x 50 :y 100))

   :on-render
   (fn [screen entities]


bind new report per thread

bind new report per thread

--- src/shuppet/core_shuppet.clj
+++ src/shuppet/core_shuppet.clj
@@ -7,6 +7,7 @@
             [clojail.core :refer [sandbox safe-read]]
             [clojail.testers :refer [secure-tester-without-def blanket]]
             [shuppet
+             [report :as report]
              [git :as git]
              [securitygroups :refer [ensure-sgs delete-sgs]]
              [elb :refer [ensure-elb delete-elb]]
@@ -117,19 +118,22 @@
   [config]
   (execute-string config))

+;TODO: extract campfire and remove all calls in various ensure-*
 (defn apply-config
   [environment app-name]
   (let [config (cf/with-messages {:environment environment :app-name app-name}
-                   (load-config environment app-name))]
+                 (load-config environment app-name))]
     (cf/with-messages {:environment environment :app-name app-name :config config}
       (when app-name
         (validate config))
-      (doto config
-        ensure-sgs
-        ensure-elb
-        ensure-iam
-        ensure-s3s
-        ensure-ddbs))))
+      (binding [report/report (atom [])]
+        (doto config
+          ensure-sgs
+          ensure-elb
+          ensure-iam
+          ensure-s3s
+          ensure-ddbs)
+        @report/report))))

 (defn clean-config [environment app-name]
   (let [config (load-config environment app-name)]


Adding -L and -I to linux openssl builds

--- config/software/openssl.clj
+++ config/software/openssl.clj
@@ -20,6 +20,6 @@
                     :steps [
                             (cond
                               (and (is-os? "darwin") (is-machine? "x86_64")) ["./Configure" "darwin64-x86_64-cc" "--prefix=/opt/opscode/embedded" "--with-zlib-lib=/opt/opscode/embedded/lib" "--with-zlib-include=/opt/opscode/embedded/include" "zlib" "shared"]
-                              true ["./config" "--prefix=/opt/opscode/embedded" "--with-zlib-lib=/opt/opscode/embedded/lib" "--with-zlib-include=/opt/opscode/embedded/include" "zlib" "shared"])
+                              true ["./config" "--prefix=/opt/opscode/embedded" "--with-zlib-lib=/opt/opscode/embedded/lib" "--with-zlib-include=/opt/opscode/embedded/include" "zlib" "shared" "-L/opt/opscode/embedded/lib" "-I/opt/opscode/embedded/include"])
                             ["bash" "-c" "make"]
                             ["sudo" "make" "install"]])


Add lein-ancient to lein profiles

Add lein-ancient to lein profiles

--- leiningen/.lein/profiles.clj
+++ leiningen/.lein/profiles.clj
@@ -1 +1 @@
-{}
+{:user {:plugins [[lein-ancient "0.6.10"]]}}


implement `execute-query` for generic-sql driver.

--- src/metabase/driver/generic_sql.clj
+++ src/metabase/driver/generic_sql.clj
@@ -338,6 +338,7 @@
           :describe-database       describe-database
           :describe-table          describe-table
           :describe-table-fks      describe-table-fks
+          :execute-query           (resolve 'metabase.driver.generic-sql.native/execute-query)
           :features                features
           :field-values-lazy-seq   field-values-lazy-seq
           :mbql->native            (resolve 'metabase.driver.generic-sql.query-processor/mbql->native)


Convert durations from seconds to minutes

--- src/strava_activity_graphs/core.clj
+++ src/strava_activity_graphs/core.clj
@@ -14,10 +14,6 @@
          :per_page     200}})
       :body)))

-(defn- to-millis [str-date]
-  (.getTime
-    (clojure.instant/read-instant-date str-date)))
-
 (defn- ts-plot [x y & options]
   (doto
     (apply time-series-plot*
@@ -30,7 +26,11 @@
     (set-alpha 0.8)
     view))

-(def m-per-h->km-per-h (partial * 3.6))
+(def meters-per-hour->kilometers-per-hour (partial * 3.6))
+(defn- seconds->minutes [s] (/ s 60))
+(defn- string-date->millis [str-date]
+  (.getTime
+    (clojure.instant/read-instant-date str-date)))

 (defn -main
   [& args]
@@ -41,9 +41,10 @@
   (let
     [token (first args)
      activities (->> (strava-json-activities token)
-                     (map #(update-in % ["average_speed"] m-per-h->km-per-h))
-                     (map #(update-in % ["start_date_local"] to-millis)))
-     to-millis (fn [dates] (map #(to-millis %) dates))]
+                     (map #(update-in % ["average_speed"] meters-per-hour->kilometers-per-hour))
+                     (map #(update-in % ["start_date_local"] string-date->millis))
+                     (map #(update-in % ["elapsed_time"] seconds->minutes))
+                     (map #(update-in % ["moving_time"] seconds->minutes)))]

     (with-data
       (to-dataset activities)
@@ -75,5 +76,5 @@
         :group-by ($ :type)
         :title "Activity duration over time"
         :x-label "time"
-        :y-label "activity's elapsed time (s)"))
+        :y-label "activity's elapsed time (minutes)"))
     ))