Work on island fn

Work on island fn

--- src/cljx/robinson/prism.cljx
+++ src/cljx/robinson/prism.cljx
@@ -66,21 +66,21 @@
   (fn [[x y]]
     (center (radius (xy->pos x y)))))

+(defn vnoise
+  [n]
+  (fn [[x y]]
+    (vector (rn/noise n x y) (rn/noise n (+ x 12.301) (+ y 70.261)))))
+
 (defn vsnoise
-  [fnoise]
+  [n]
   (fn [[x y]]
-    (vec (fnoise x y) (fnoise (+ x 12.301) (+ y 70.261)))))
-
-(defn vnoise
-  [noise]
-  (fn [[x y]]
-    (vec (rn/noise noise x y) (rn/noise noise (+ x -78.678) (+ y 7.6789)))))
+  (vector (rn/snoise n x y) (rn/snoise n (+ x 12.301) (+ y 70.261)))))

 (defn v+
   [xy-or-fn-0 xy-or-fn-1]
   (cond
-    (and (vector xy-or-fn-0)
-         (vector xy-or-fn-1))
+    (and (vector? xy-or-fn-0)
+         (vector? xy-or-fn-1))
       (mapv + xy-or-fn-0 xy-or-fn-1)
     (and (vector? xy-or-fn-0)
          (fn? xy-or-fn-1))
@@ -114,8 +114,8 @@
 (defn v-
   [xy-or-fn-0 xy-or-fn-1]
   (case
-    (and (vector xy-or-fn-0)
-         (vector xy-or-fn-1))
+    (and (vector? xy-or-fn-0)
+         (vector? xy-or-fn-1))
       (mapv - xy-or-fn-0 xy-or-fn-1)
     :else
       (v+ xy-or-fn-0 (v* -1 xy-or-fn-1))))
@@ -129,46 +129,60 @@
 (defn sample-tree [n]
   (offset [-0.5 -0.5] (s+ -0.5 (scale 0.01 (noise n)))))

-#_(defn sample-island
-  [noise x y]
-  (cliskf/vectorize
-    (cliskf/vlet [c  ((invert (scale 0.43 (offset (vnoise noise) (radius)))) x y)
-                  c1 ((offset [0.5 0.5] (s+ -0.5 (scale 0.06 noise))) x y)
-                  c2 ((offset [-0.5 -0.5] (s+ -0.5 (scale 0.08 noise))) x y)]
-      (cond
-        ;; interior biomes
-        (> -0.55  c)
-          (cond
-            (and (pos? c1) (pos? c2) (> c1 c2))
-            ;; interior jungle
-            jungle
-            (and (pos? c1) (pos? c2))
-            heavy-forest
-            (and (pos? c1) (neg? c2) (> c1 c2))
-            light-forest
-            (and (pos? c1) (neg? c2))
-            bamboo-grove
-            (and (neg? c1) (pos? c2) (> c1 c2))
-            meadow
-            (and (neg? c1) (pos? c2))
-            rocky
-            (and (neg? c1) (neg? c2) (> c1 c2))
-            swamp
-            :else
-            dirt)
-        ;; shore/yellow
-        (> -0.5  c)
-            sand
-        ;; surf/light blue
-        (> -0.42 c)
-          surf
-        ;; else ocean
-        :else
-          ocean))))
+(defn sample-island
+  [n x y]
+  (let [c  ((coerce (scale 4.3 (offset (vnoise n) (radius)))) x y)
+        c1 ((coerce (offset [0.5 0.5] (s+ -0.5 (scale 0.6 (noise n))))) x y)
+        c2 ((coerce (offset [-110.5 -640.5] (s+ -0.5 (scale 0.8 (noise n))))) x y)]
+    (cond
+      ;; interior biomes
+      (> 0.55  c)
+        (cond
+          (and (pos? c1) (pos? c2) (> c1 c2))
+          ;; interior jungle
+          :jungle
+          (and (pos? c1) (pos? c2))
+          :heavy-forest
+          (and (pos? c1) (neg? c2) (> c1 c2))
+          :light-forest
+          (and (pos? c1) (neg? c2))
+          :bamboo-grove
+          (and (neg? c1) (pos? c2) (> c1 c2))
+          :meadow
+          (and (neg? c1) (pos? c2))
+          :rocky
+          (and (neg? c1) (neg? c2) (> c1 c2))
+          :swamp
+          :else
+          :dirt)
+      ;; shore/yellow
+      (> 0.6  c)
+          :sand
+      ;; surf/light blue
+      (> 0.68 c)
+        :surf
+      ;; else ocean
+      :else
+        :ocean)))
+
+(defn map-biome [k]
+  (case k
+    :jungle \j
+    :heavy-forest \F
+    :light-forest \f
+    :bamboo-grove \b
+    :meadow \m
+    :rocky \^
+    :swamp \s
+    :dirt \.
+    :sand \,
+    :surf \=
+    :ocean \~))

 (defn -main [& args]
   (let [n (rn/create-noise)]
     #_(rn/print-fn (fn [x y] (rn/noise n x y)) 180 180)
-    (rn/print-fn (coerce (sample-tree n)) 180 180)
-    #_(rn/print-fn (coerce (invert (offset (vsnoise (partial rn/noise n))  (scale 0.2 (radius))))) 180 180)))
+    #_(rn/print-fn (coerce (sample-tree n)) 180 180)
+    (rn/print-fn map-biome (fn [x y] (sample-island n x y)) 180 180)
+    #_(rn/print-fn (coerce (invert (offset (vsnoise n)  (scale 0.2 (radius))))) 180 180)))


Yet another utility copy-paste.

Yet another utility copy-paste.

--- src/clojure/parkour/util.clj
+++ src/clojure/parkour/util.clj
@@ -1,4 +1,8 @@
 (ns parkour.util)
+
+(defmacro ignore-errors
+  "Returns the result of evaluating body, or nil if it throws an exception."
+  [& body] `(try ~@body (catch java.lang.Exception _# nil)))

 (defmacro returning
   "Evaluates the result of `expr`, then evaluates the forms in


Add more messages

Add more messages

--- src/clojure_fabric/proto.clj
+++ src/clojure_fabric/proto.clj
@@ -28,7 +28,9 @@
            [org.hyperledger.fabric.protos.common Common$Block Common$BlockData Common$BlockHeader Common$BlockMetadata Common$ChannelHeader Common$Envelope Common$Header Common$HeaderType Common$Payload Common$SignatureHeader Configtx$ConfigGroup Configtx$ConfigPolicy Configtx$ConfigSignature Configtx$ConfigUpdate Configtx$ConfigUpdateEnvelope Configtx$ConfigValue Ledger$BlockchainInfo Policies$Policy]
            org.hyperledger.fabric.protos.msp.Identities$SerializedIdentity
            [org.hyperledger.fabric.protos.peer Chaincode$ChaincodeDeploymentSpec Chaincode$ChaincodeDeploymentSpec$ExecutionEnvironment Chaincode$ChaincodeID Chaincode$ChaincodeInput Chaincode$ChaincodeInvocationSpec Chaincode$ChaincodeSpec Chaincode$ChaincodeSpec$Type EndorserGrpc ProposalPackage$ChaincodeHeaderExtension ProposalPackage$ChaincodeProposalPayload ProposalPackage$Proposal ProposalPackage$SignedProposal Query$ChaincodeInfo Query$ChaincodeQueryResponse Query$ChannelInfo Query$ChannelQueryResponse TransactionPackage$ProcessedTransaction]
-           [org.hyperledger.fabric.protos.orderer AtomicBroadcastGrpc Ab$BroadcastResponse]))
+           [org.hyperledger.fabric.protos.orderer AtomicBroadcastGrpc Ab$BroadcastResponse
+            Ab$SeekSpecified Ab$SeekPosition Ab$SeekOldest Ab$SeekNewest Ab$SeekInfo
+            Ab$SeekInfo$SeekBehavior]))

 ;;;
 ;;;
@@ -434,6 +436,66 @@
 (defn make-processed-transaction
   [& {:keys [transaction-envelope validation-code]}]
   (map->ProcessedTransaction {:transaction-envelope transaction-envelope :validation-code validation-code}))
+
+(defrecord SeekSpecified [^Long number]
+  ICljToProto
+  (clj->proto [this]
+    (cond-> (Ab$SeekSpecified/newBuilder)
+      number (.setNumber number)
+      true (.build))))
+
+(defn make-seek-specified
+  [& {:keys [number]}]
+  (map->SeekSpecified {:number number}))
+
+(defrecord SeekOldest []
+  ICljToProto
+  (clj->proto [this]
+    (cond-> (Ab$SeekOldest/newBuilder)
+      true (.build))))
+
+(defn make-seek-oldest
+  []
+  (->SeekOldest))
+
+(defrecord SeekNewest []
+  ICljToProto
+  (clj->proto [this]
+    (cond-> (Ab$SeekNewest/newBuilder)
+      true (.build))))
+
+(defn make-seek-newest
+  []
+  (->SeekNewest))
+
+(defrecord SeekPosition [newest oldest specified]
+  ICljToProto
+  (clj->proto [this]
+    (cond-> (Ab$SeekPosition/newBuilder)
+      newest (.setNewest ^Ab$SeekNewest (clj->proto newest))
+      oldest (.setOldest ^Ab$SeekOldest (clj->proto oldest))
+      specified (.setSpecified ^Ab$SeekSpecified (clj->proto specified))
+      true (.build))))
+
+(defn make-seek-position
+  [& {:keys [newest oldest specified]}]
+  (map->SeekSpecified {:newest newest :oldest oldest :specified specified}))
+
+(defonce seek-behavior-map {:block-until-ready Ab$SeekInfo$SeekBehavior/BLOCK_UNTIL_READY
+                            :fail-if-not-ready Ab$SeekInfo$SeekBehavior/FAIL_IF_NOT_READY})
+
+(defrecord SeekInfo [^SeekPosition start ^SeekPosition stop behavior];; behaviour keyword
+  ICljToProto
+  (clj->proto [this]
+    (cond-> (Ab$SeekInfo/newBuilder)
+      start (.setStart ^Ab$SeekPosition (clj->proto start))
+      stop (.setStop ^Ab$SeekPosition (clj->proto stop))
+      behavior (.setBehavior ^Ab$SeekBehavior (seek-behavior-map behavior))
+      true (.build))))
+
+(defn make-seek-info
+  [& {:keys [start stop behavior]}]
+  (map->SeekInfo {:start start :stop stop :behavior behavior}))

 (defn- convert-args
   [args]


Block the caller when rendering the ui before performing an action.

--- src/fm/simrunner/actions.clj
+++ src/fm/simrunner/actions.clj
@@ -159,6 +159,6 @@

 (defn dispatch [action {app-state :state :as app} args]
   (when-not (-> @app-state :ui :locked?)
-    (rdg/render! app rdg/lock rdg/render-ui)
+    @(rdg/render! app rdg/lock rdg/render-ui)
     (apply on-action action app args)))


Wrap fn calls

Wrap fn calls

--- src/github_changelog/git.clj
+++ src/github_changelog/git.clj
@@ -67,8 +67,8 @@

 (defn initial-commit [dir]
   (-> (exec "git" "rev-list" "--max-parents=0" "HEAD" :dir dir)
-      :out
-      str/trim))
+      (:out)
+      (str/trim)))

 (defn commits [dir from until]
   (let [commit (format "%s..%s"


Do some gross stuff to manifold->chan

Do some gross stuff to manifold->chan

See #51.

--- src/icecap/handlers/http.clj
+++ src/icecap/handlers/http.clj
@@ -8,5 +8,7 @@
 (defstep :http
   {:url URI}
   [step]
-  (let [ch (chan)]
-    (connect (request {:url "http://www.rackspace.com"}) ch)))
+  (let [ch (chan)
+        req (request {:url "http://www.rackspace.com"})]
+    (do (connect req ch)
+        ch)))


Add quickie test runner to plugins.

Add quickie test runner to plugins.

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -8,6 +8,7 @@
         :plugins [[lein-difftest "1.3.7"]
                   [lein-exec "0.3.0"]
                   [org.bodil/lein-noderepl "0.1.10"]
+                  [quickie "0.2.1"]
                   [lein-clojars "0.9.1"]
                   [lein-pprint "1.1.1"]
                   [lein-ring "0.8.0"]


check docstring for internal tag

check docstring for internal tag

--- src/core.clj
+++ src/core.clj
@@ -1,6 +1,7 @@
 (ns core
   (:refer-clojure :exclude [replace])
   (:require
+    [clojure.string :refer [lower-case]]
     [clojure.java.io :as io]
     [clojure.java.shell :refer [sh]]
     [clojure.tools.reader :as reader]
@@ -421,10 +422,13 @@

 (defn internal-def-only?
   [form]
-  (let [c (:potential-comment form)
-        tokens (split c #"\s+")]
-    (and (#{";;" ";"} (first tokens))
-         (= "internal" (second tokens)))))
+  (let [[c0 c1] (split (:potential-comment form) #"\s+")
+        comment-flag? (and (#{";;" ";"} c0)
+                           c1
+                           (= "internal" (lower-case c1)))
+        [d0] (split (or (:docstring form) "") #"\s+")
+        docstring-flag? (and d0 (= "internal" (lower-case d0)))]
+    (or comment-flag? docstring-flag?)))

 (defn parse-form
   [form ns- repo]


add html/table

add html/table

--- src/html.clj
+++ src/html.clj
@@ -59,6 +59,13 @@
 (defn code [s]
   [:code {:class "prettyprint"} s])

+(defn table [[head & bodies] :as rows]
+  [:table
+    [:thead [:tr (for h head [:th h])]]
+    [:tbody
+      (for [body bodies]
+        [:tr (for [row body] [:td row])])]])
+
 ;(defn table
 ;  [opt & rows]
 ;  (if-not (map? opt)


Fix macchiato updates test implementation (#3283)

--- frameworks/Clojure/macchiato/hello/src/hello/db.cljs
+++ frameworks/Clojure/macchiato/hello/src/hello/db.cljs
@@ -51,13 +51,6 @@
       (.then handler)
       (.catch error-handler)))

-(defn update-world! [world handler error-handler]
-  (-> @worlds
-      (.update (clj->js {:randomnumber (:randomnumber world)})
-               (clj->js {:where {:id (:id world)} :raw true}))
-      (.then #(when handler (handler (js->clj world))))
-      (.catch error-handler)))
-
 (defn get-query-count
   "Parse provided string value of query count, clamping values to between 1 and 500."
   [queries]
@@ -91,13 +84,6 @@
           (conj result {:id 0 :message "Additional fortune added at request time."}))))
     error-handler))

-(defn set-random-number!
-  "set a new randomNumber, persist, and return the record"
-  [error-handler world]
-  (let [w (assoc world :randomnumber (unchecked-inc (rand-int 9999)))]
-    (update-world! w nil error-handler)
-    w))
-
 (defn update-and-persist
   "Changes the :randomnumber of a number of world entities.
   Persists the changes to sql then returns the updated entities"
@@ -105,6 +91,16 @@
   (run-queries
     queries
     (fn [results]
-      (handler (clj->js (mapv (partial set-random-number! error-handler) (js->clj results)))))
+      (-> (js/Promise.all
+            (map
+              (fn [world]
+                (let [id (:id world) randomnumber (unchecked-inc (rand-int 10000))]
+                  (-> @worlds
+                      (.update (clj->js {:randomnumber randomnumber})
+                               (clj->js {:where {:id id} :raw true}))
+                      (.then (fn [result] (clj->js { :id id :randomnumber randomnumber })))
+                      (.catch error-handler))))
+              (js->clj results :keywordize-keys true)))
+          (.then handler)
+          (.catch error-handler)))
     error-handler))
-


fixes typo in join docstring

fixes typo in join docstring

--- pigpen-core/src/main/clojure/pigpen/join.clj
+++ pigpen-core/src/main/clojure/pigpen/join.clj
@@ -373,7 +373,7 @@
 In this example, foo and bar are other pig queries and :a and :b are the
 key-selector functions for foo and bar, respectively. These can be any
 functions - not just keywords. There can be more than two select clauses.
-By default, a matching key value from eatch source relation is required,
+By default, a matching key value from each source relation is required,
 meaning that they must exist in all source relations to be part of the output.
 To specify a relation as optional, add 'optional' to the select clause. The
 third argument is a function used to consolidate matching key values. For each


Removes unused cljs data in bb_test script

--- bin/bb_test.clj
+++ bin/bb_test.clj
@@ -1,5 +1,3 @@
-;; TODO - carve out CLJS
-
 (ns bb
   (:require [babashka.deps :as deps]
             [clojure.test :refer [is testing deftest]]
@@ -32,10 +30,8 @@
                          (try
                            (f)
                            (catch Exception e (Throwable->map e))))
-        ed #?(:cljs (-> exception-data :data)
-              :clj (-> exception-data :via last :data))
-        cause# (-> #?(:cljs (:message exception-data)
-                      :clj (:cause exception-data))
+        ed (-> exception-data :via last :data)
+        cause# (-> (:cause exception-data)
                    (clojure.string/replace #"Call to (.*) did not conform to spec:"
                                            "Call to #'$1 did not conform to spec."))]

@@ -437,8 +433,7 @@

 -------------------------
 Detected 2 errors\n"
-             #?(:cljs "(fn [%] (pos? (count %)))"
-                :clj "(fn [%] (pos? (count %)))"))
+             "(fn [%] (pos? (count %)))")
          (expound/expound-str :and-spec/names ["bob" "sally" "" 1])))))

 (s/def :coll-of-spec/big-int-coll (s/coll-of int? :min-count 10))
@@ -461,8 +456,7 @@

 -------------------------
 Detected 1 error\n"
-             #?(:cljs "9007199254740991"
-                :clj "Integer/MAX_VALUE"))
+             "Integer/MAX_VALUE")
          (expound/expound-str :coll-of-spec/big-int-coll [])))))

 (s/def :cat-spec/kw (s/cat :k keyword? :v any?))
@@ -641,111 +635,9 @@

 -------------------------
 Detected 1 error\n"
-               #?(:cljs "(cljs.spec.alpha/keys :req [:keys-spec/name] :req-un [:keys-spec/age])"
-                  :clj "(clojure.spec.alpha/keys\n   :req\n   [:keys-spec/name]\n   :req-un\n   [:keys-spec/age])"))
+               "(clojure.spec.alpha/keys\n   :req\n   [:keys-spec/name]\n   :req-un\n   [:keys-spec/age])")
            (expound/expound-str :keys-spec/user {}))))
-  ;; FIXME - I'm guessing spartan.spec doesn't work for compound keys i.e. (and :state :city)
-  #_(testing "missing compound keys"
-    (is (= (pf "-- Spec failed --------------------
-
-  {}
-
-should contain keys:
-
-(and (and :keys-spec/name :keys-spec/age) (or :zip (and :state :city)))
-
-| key             | spec     |
-|=================+==========|
-| :city           | string?  |
-|-----------------+----------|
-| :state          | string?  |
-|-----------------+----------|
-| :zip            | pos-int? |
-|-----------------+----------|
-| :keys-spec/age  | int?     |
-|-----------------+----------|
-| :keys-spec/name | string?  |
-
--- Relevant specs -------
-
-:keys-spec/user2:
-  (pf.spec.alpha/keys
-   :req
-   [(and :keys-spec/name :keys-spec/age)]
-   :req-un
-   [(or :key-spec/zip (and :key-spec/state :key-spec/city))])
-
--------------------------
-Detected 1 error\n")
-           (expound/expound-str :keys-spec/user2 {})))
-    (is (= (pf "-- Spec failed --------------------
-
-  {}
-
-should contain keys:
-
-(or :zip (and :state :city))
-
-| key    | spec     |
-|========+==========|
-| :city  | string?  |
-|--------+----------|
-| :state | string?  |
-|--------+----------|
-| :zip   | pos-int? |
-
--- Relevant specs -------
-
-:keys-spec/user3:
-  (pf.spec.alpha/keys
-   :req-un
-   [(or :key-spec/zip (and :key-spec/state :key-spec/city))])
-
--------------------------
-Detected 1 error\n")
-           (expound/expound-str :keys-spec/user3 {}))))
-
-  ;; spartan.spec doesn't support multi-spec yet
-  #_(testing "inline spec with req-un"
-    (is (= (pf "-- Spec failed --------------------
-
-  {}
-
-should contain keys: :age, :name
-
-| key   | spec    |
-|=======+=========|
-| :age  | int?    |
-|-------+---------|
-| :name | string? |
-
--------------------------
-Detected 1 error\n"
-               #?(:cljs "(cljs.spec.alpha/keys :req [:keys-spec/name] :req-un [:keys-spec/age])"
-                  :clj "(clojure.spec.alpha/keys\n   :req\n   [:keys-spec/name]\n   :req-un\n   [:keys-spec/age])"))
-           (expound/expound-str (s/keys :req-un [:keys-spec/name :keys-spec/age]) {})))
-    (s/def :key-spec/mspec (s/multi-spec key-spec-mspec :tag))
-    (s/def :key-spec/i int?)
-    (s/def :key-spec/s string?)
-    ;; We can't inspect the contents of a multi-spec (to figure out
-    ;; which spec we mean by :i), so this is the best we can do.
-    (is (= "-- Spec failed --------------------
-
-  {:tag :int}
-
-should contain key: :i
-
-| key | spec                                              |
-|=====+===================================================|
-| :i  | <can't find spec for unqualified spec identifier> |
-
--------------------------
-Detected 1 error\n"
-           (expound/expound-str
-            :key-spec/mspec
-            {:tag :int}
-            {:print-specs? false}))))
-
+
   (testing "invalid key"
     (is (= (pf "-- Spec failed --------------------

@@ -765,8 +657,7 @@

 -------------------------
 Detected 1 error\n"
-               #?(:cljs "(cljs.spec.alpha/keys :req [:keys-spec/name] :req-un [:keys-spec/age])"
-                  :clj "(clojure.spec.alpha/keys\n   :req\n   [:keys-spec/name]\n   :req-un\n   [:keys-spec/age])"))
+               "(clojure.spec.alpha/keys\n   :req\n   [:keys-spec/name]\n   :req-un\n   [:keys-spec/age])")
            (expound/expound-str :keys-spec/user {:age 1 :keys-spec/name :bob}))))
   (testing "contains compound specs"
     (s/def :keys-spec/states (s/coll-of :key-spec/state :kind vector?))
@@ -1303,29 +1194,7 @@
     (is (= "hello"
            (s/assert :test-assert/name "hello"))))
   (testing "assertion fails"
-    #?(:cljs
-       (try
-         (binding [s/*explain-out* expound/printer]
-           (s/assert :test-assert/name :hello))
-         (catch :default e
-           (is (= "Spec assertion failed\n-- Spec failed --------------------
-
-  :hello
-
-should satisfy
-
-  string?
-
--- Relevant specs -------
-
-:test-assert/name:
-  cljs.core/string?
-
--------------------------
-Detected 1 error\n"
-                  (.-message e)))))
-       :clj
-       (try
+           (try
          (binding [s/*explain-out* expound/printer]
            (s/assert :test-assert/name :hello))
          (catch Exception e
@@ -1346,7 +1215,7 @@
 -------------------------
 Detected 1 error\n"
                   ;; FIXME - move assertion out of catch, similar to instrument tests
-                  (:cause (Throwable->map e)))))))))
+                  (:cause (Throwable->map e))))))))

 (s/def :test-explain-str/name string?)
 (deftest test-explain-str
@@ -1572,12 +1441,11 @@

 -------------------------
 Detected 1 error\n"
-             #?(:clj "(clojure.spec.alpha/alt
+             "(clojure.spec.alpha/alt
    :int
    clojure.core/int?
    :string
-   clojure.core/string?)"
-                :cljs "(cljs.spec.alpha/alt :int cljs.core/int? :string cljs.core/string?)"))
+   clojure.core/string?)")
          (expound/expound-str :alt-spec/int-alt-str [:hi])))

   (is (= "-- Spec failed --------------------
@@ -1786,8 +1654,7 @@
     (str x)

     (char? x)
-    #?(:cljs (.charCodeAt x)
-       :clj (int x))
+    (int x)

     (uuid? x)
     (str x)
@@ -1825,7 +1692,7 @@

 (deftest test-assert2
   (is (thrown-with-msg?
-       #?(:cljs :default :clj Exception)
+       Exception
        #"\"Key must be integer\"\n\nshould be one of: \"Extra input\", \"Insufficient input\", \"no method"
        (binding [s/*explain-out* expound/printer]
          (try
@@ -1921,9 +1788,7 @@
     ;; for string parsing, so I'm OK with it
     (testing "conform string to seq"
       (is (=
-           ;; clojurescript doesn't have a character type
-           #?(:cljs "-- Spec failed --------------------\n\n  \"A\"C\"\"\n    ^^^\n\nshould be: \"B\"\n\n-------------------------\nDetected 1 error\n"
-              :clj "-- Spec failed --------------------
+           "-- Spec failed --------------------

   \"A\\C\"
     ^^
@@ -1932,7 +1797,7 @@

 -------------------------
 Detected 1 error
-")
+"
            (s/explain-str :conformers-test/string-AB "AC"))))
     (testing "s/cat"
       (s/def :conformers-test/sorted-pair (s/and (s/cat :x int? :y int?) #(< (-> % :x) (-> % :y))))
@@ -1951,10 +1816,9 @@
 -------------------------
 Detected 1 error
 "
-                 #?(:cljs "(fn [%] (< (-> % :x) (-> % :y)))"
-                    :clj "(fn
+                 "(fn
    [%]
-   (< (-> % :x) (-> % :y)))"))
+   (< (-> % :x) (-> % :y)))")
              (expound/expound-str :conformers-test/sorted-pair [1 0] {:print-specs? false})))
       (is (= (pf "-- Spec failed --------------------

@@ -1971,10 +1835,9 @@

 -------------------------
 Detected 1 error\n"
-                 #?(:cljs "(fn [%] (< (-> % :x) (-> % :y)))"
-                    :clj "(fn
+                 "(fn
    [%]
-   (< (-> % :x) (-> % :y)))"))
+   (< (-> % :x) (-> % :y)))")
              (expound/expound-str (s/coll-of :conformers-test/sorted-pair) [[0 1] [1 0]] {:print-specs? false})))
       (is (= (pf "-- Spec failed --------------------

@@ -1991,10 +1854,9 @@

 -------------------------
 Detected 1 error\n"
-                 #?(:cljs "(fn [%] (< (-> % :x) (-> % :y)))"
-                    :clj "(fn
+                 "(fn
    [%]
-   (< (-> % :x) (-> % :y)))"))
+   (< (-> % :x) (-> % :y)))")
              (expound/expound-str (s/map-of keyword? :conformers-test/sorted-pair) {:a [1 0]} {:print-specs? false})))
       (is (= (pf "-- Spec failed --------------------

@@ -2188,10 +2050,9 @@
 -------------------------
 Detected 1 error
 "
-                 #?(:cljs "(fn [%] (< (-> % :x) (-> % :y)))"
-                    :clj "(fn
+                 "(fn
    [%]
-   (< (-> % :x) (-> % :y)))"))
+   (< (-> % :x) (-> % :y)))")
              (binding [s/*explain-out* (expound/custom-printer {:print-specs? false})]
                (s/explain-str (s/map-of :conformers-test/sorted-pair any?) {[0 1] [1 0]
                                                                             [1 0] [1 0]})))))))
@@ -2380,116 +2241,6 @@
 (defn my-minus [x y]
   (- x y))

-;; FIXME: support fspec
-#_(deftest fspec-fn-test
-  (testing "invalid ret"
-    (is (= (pf "-- Function spec failed -----------
-
-  expound.alpha-test/my-minus
-
-failed spec. Function arguments and return value
-
-  {:args {:x 0, :y 0}, :ret 0}
-
-should satisfy
-
-  %s
-
--------------------------
-Detected 1 error\n"
-
-               #?(:clj
-                  "(fn
-   [%]
-   (< (:ret %) (-> % :args :x)))"
-                  :cljs "(fn [%] (< (:ret %) (-> % :args :x)))"))
-           (binding [s/*explain-out* (expound/custom-printer {:print-specs? false})]
-             (until-unsuccessful #(s/explain-str :fspec-fn-test/minus my-minus)))))
-
-    (is (= (pf "-- Function spec failed -----------
-
-  [expound.alpha-test/my-minus]
-   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-failed spec. Function arguments and return value
-
-  {:args {:x 0, :y 0}, :ret 0}
-
-should satisfy
-
-  %s
-
--------------------------
-Detected 1 error\n"
-               #?(:clj
-                  "(fn
-   [%]
-   (< (:ret %) (-> % :args :x)))"
-                  :cljs "(fn [%] (< (:ret %) (-> % :args :x)))"))
-           (binding [s/*explain-out* (expound/custom-printer {:print-specs? false})]
-             (until-unsuccessful #(s/explain-str (s/coll-of :fspec-fn-test/minus) [my-minus])))))))
-
-;; FIXME: support fspec
-#_(deftest ifn-fspec-test
-  (testing "keyword ifn / ret failure"
-    (is (= "-- Function spec failed -----------
-
-  [:foo]
-   ^^^^
-
-returned an invalid value
-
-  nil
-
-should satisfy
-
-  int?
-
--------------------------
-Detected 1 error\n"
-           (binding [s/*explain-out* (expound/custom-printer {:print-specs? false})]
-             (until-unsuccessful #(s/explain-str (s/coll-of (s/fspec :args (s/cat :x int?) :ret int?))
-                                                 [:foo])))))
-    (testing "set ifn / ret failure"
-      (is (= "-- Function spec failed -----------
-
-  [#{}]
-   ^^^
-
-returned an invalid value
-
-  nil
-
-should satisfy
-
-  int?
-
--------------------------
-Detected 1 error\n"
-             (binding [s/*explain-out* (expound/custom-printer {:print-specs? false})]
-               (until-unsuccessful #(s/explain-str (s/coll-of (s/fspec :args (s/cat :x int?) :ret int?))
-                                                   [#{}])))))))
-  #?(:clj
-     (testing "vector ifn / exception failure"
-       (is (= "-- Exception ----------------------
-
-  [[]]
-   ^^
-
-threw exception
-
-  nil
-
-with args:
-
-  0
-
--------------------------
-Detected 1 error\n"
-              (binding [s/*explain-out* (expound/custom-printer {:print-specs? false})]
-                (until-unsuccessful #(s/explain-str (s/coll-of (s/fspec :args (s/cat :x int?) :ret int?))
-                                                    [[]]))))))))
-
 (defmulti pet :pet/type)
 (defmethod pet :dog [_]
   (s/keys))
@@ -2509,82 +2260,6 @@
 (s/def :multispec-in-compound-spec/pet2 (s/or
                                          :map1 (s/multi-spec pet :pet/type)
                                          :map2 (s/multi-spec animal :animal/type)))
-
-;; FIXME: support multipspec
-#_(deftest multispec-in-compound-spec
-  (testing "multispec combined with s/and"
-    (is (= (pf "-- Missing spec -------------------
-
-Cannot find spec for
-
-  {:pet/type :fish}
-
-with
-
- Spec multimethod:      `expound.alpha-test/pet`
- Dispatch value:        `:fish`
-
--- Relevant specs -------
-
-:multispec-in-compound-spec/pet1:
-  (pf.spec.alpha/and
-   pf.core/map?
-   (pf.spec.alpha/multi-spec expound.alpha-test/pet :pet/type))
-
--------------------------
-Detected 1 error\n")
-           (expound/expound-str :multispec-in-compound-spec/pet1 {:pet/type :fish}))))
-  ;; FIXME - improve this, maybe something like:
-  ;;;;;;;;;;;;;;;;;;;
-
-  ;;   {:pet/type :fish}
-
-  ;; should be described by a spec multimethod, but
-
-  ;;   expound.alpha-test/pet
-
-  ;; is missing a method for value
-
-  ;;   (:pet/type {:pet/type :fish}) ; => :fish
-
-  ;; or
-
-  ;; should be described by a spec multimethod, but
-
-  ;;   expound.alpha-test/pet
-
-  ;; is missing a method for value
-
-  ;;  (:animal/type {:pet/type :fish}) ; => nil
-  (testing "multispec combined with s/or"
-    (is (= (pf "-- Missing spec -------------------
-
-Cannot find spec for
-
-  {:pet/type :fish}
-
-with
-
- Spec multimethod:      `expound.alpha-test/pet`
- Dispatch value:        `:fish`
-
-or with
-
- Spec multimethod:      `expound.alpha-test/animal`
- Dispatch value:        `nil`
-
--- Relevant specs -------
-
-:multispec-in-compound-spec/pet2:
-  (pf.spec.alpha/or
-   :map1
-   (pf.spec.alpha/multi-spec expound.alpha-test/pet :pet/type)
-   :map2
-   (pf.spec.alpha/multi-spec expound.alpha-test/animal :animal/type))
-
--------------------------
-Detected 1 error\n")
-           (expound/expound-str :multispec-in-compound-spec/pet2 {:pet/type :fish})))))

 (expound/def :predicate-messages/string string? "should be a string")
 (expound/def :predicate-messages/vector vector? "should be a vector")
@@ -2683,8 +2358,7 @@
               101))))))

 (defn results-str-fn1 [x y]
-  #?(:clj (+' x y)
-     :cljs (+ x y)))
+  (+' x y))

 (defn results-str-fn2 [x y]
   (+ x y))
@@ -2697,8 +2371,7 @@

 (defn results-str-fn5
   [_x _y]
-  #?(:clj (throw (Exception. "Ooop!"))
-     :cljs (throw (js/Error. "Oops!"))))
+  (throw (Exception. "Ooop!")))

 (defn results-str-fn6
   [f]
@@ -2794,7 +2467,7 @@
                        ::test-problem3)]

       (is (thrown-with-msg?
-           #?(:cljs :default :clj Exception)
+           Exception
            #"No method in multimethod"
            (printer-str {:print-specs? false} ed))))))


Added 12 new tests into core-test module

--- test/clj_mrazik/core_test.clj
+++ test/clj_mrazik/core_test.clj
@@ -23,3 +23,76 @@
     [function-name]
     (clojure.test/function? function-name))

+
+(deftest test-between?-existence
+    "Check that the clj-mrazik.core/between? definition exists."
+    (testing "if the clj-mrazik.core/between? definition exists."
+        (is (callable? 'clj-mrazik.core/between?))))
+
+
+(deftest test-in-schedule?-existence
+    "Check that the clj-mrazik.core/in-schedule? definition exists."
+    (testing "if the clj-mrazik.core/in-schedule? definition exists."
+        (is (callable? 'clj-mrazik.core/in-schedule?))))
+
+
+(deftest test-open-window-existence
+    "Check that the clj-mrazik.core/open-window definition exists."
+    (testing "if the clj-mrazik.core/open-window definition exists."
+        (is (callable? 'clj-mrazik.core/open-window))))
+
+
+(deftest test-close-window-existence
+    "Check that the clj-mrazik.core/close-window definition exists."
+    (testing "if the clj-mrazik.core/close-window definition exists."
+        (is (callable? 'clj-mrazik.core/close-window))))
+
+
+(deftest test-sunrise-existence
+    "Check that the clj-mrazik.core/sunrise definition exists."
+    (testing "if the clj-mrazik.core/sunrise definition exists."
+        (is (callable? 'clj-mrazik.core/sunrise))))
+
+
+(deftest test-sunset-existence
+    "Check that the clj-mrazik.core/sunset definition exists."
+    (testing "if the clj-mrazik.core/sunset definition exists."
+        (is (callable? 'clj-mrazik.core/sunset))))
+
+
+(deftest test-is-sunrise?-existence
+    "Check that the clj-mrazik.core/is-sunrise? definition exists."
+    (testing "if the clj-mrazik.core/is-sunrise? definition exists."
+        (is (callable? 'clj-mrazik.core/is-sunrise?))))
+
+
+(deftest test-is-sunset?-existence
+    "Check that the clj-mrazik.core/is-sunset? definition exists."
+    (testing "if the clj-mrazik.core/is-sunset? definition exists."
+        (is (callable? 'clj-mrazik.core/is-sunset?))))
+
+
+(deftest test-run-bot-existence
+    "Check that the clj-mrazik.core/run-bot definition exists."
+    (testing "if the clj-mrazik.core/run-bot definition exists."
+        (is (callable? 'clj-mrazik.core/run-bot))))
+
+
+(deftest test-start-bot-existence
+    "Check that the clj-mrazik.core/start-bot definition exists."
+    (testing "if the clj-mrazik.core/start-bot definition exists."
+        (is (callable? 'clj-mrazik.core/start-bot))))
+
+
+(deftest test-show-help-existence
+    "Check that the clj-mrazik.core/show-help definition exists."
+    (testing "if the clj-mrazik.core/show-help definition exists."
+        (is (callable? 'clj-mrazik.core/show-help))))
+
+
+(deftest test--main-existence
+    "Check that the clj-mrazik.core/-main definition exists."
+    (testing "if the clj-mrazik.core/-main definition exists."
+        (is (callable? 'clj-mrazik.core/-main))))
+
+


CMR-4537: Update version of AWS java SDK to fix problem socket exception in SIT.

--- message-queue-lib/project.clj
+++ message-queue-lib/project.clj
@@ -10,7 +10,7 @@
   :dependencies [
     [cheshire "5.8.0"]
     [clj-time "0.14.2"]
-    [com.amazonaws/aws-java-sdk "1.10.60"]
+    [com.amazonaws/aws-java-sdk "1.11.261"]
     [com.novemberain/langohr "3.4.0"]
     [commons-logging "1.2"]
     [nasa-cmr/cmr-acl-lib "0.1.0-SNAPSHOT"]


Spy on what's going on; invalid HTTP step tests

--- test/icecap/e2e/http_test.clj
+++ test/icecap/e2e/http_test.clj
@@ -4,7 +4,8 @@
             [clojure.test :refer :all]
             [aleph.http :as http]
             [manifold.deferred :refer [let-flow]]
-            [byte-streams :as bs]))
+            [byte-streams :as bs]
+            [taoensso.timbre :refer [info spy]]))

 (def ^:dynamic http-server)
 (def ^:dynamic recvd-reqs)
@@ -37,11 +38,17 @@
 (use-fixtures :each store-reqs-fixture)

 (deftest http-tests
-  (is (let [d (let-flow
-               [create-result (create-cap {:type :http})
-                cap-url (bs/to-string (:body create-result))
-                exercise-result (execute-cap cap-url)]
-               [create-result exercise-result cap-url])
-            [{create-code :code} {} cap-url] @d]
-        (and (= create-code 201)
+  (is (let [create-result @(create-cap {:type :http
+                                        :url (spy (str http-server-base-url
+                                                       "/test/example"))})
+            cap-url (spy (bs/to-string (:body create-result)))
+            exercise-result @(execute-cap cap-url)]
+        (and (= (select-keys create-result [:code])
+                {:code 201})
              (= cap-url nil)))))
+
+(deftest invalid-http-step-tests
+  (are [step expected] (let [create-result @(create-cap step)
+                             message (bs/to-string (:body create-result))]
+                         (apply = (map pr-str expected)))
+       {:type :http} '{:url missing-required-key}))


fixes the http tests

fixes the http tests

--- test/nevergreen/http_test.clj
+++ test/nevergreen/http_test.clj
@@ -5,30 +5,28 @@
   (:import (java.net UnknownHostException URISyntaxException)
            (clojure.lang ExceptionInfo)))

-(facts "sets headers"
-       (fact "without authentication"
-             (subject/http-get ..url.. {}) => ..some-body..
+(facts "http"
+       (fact "adds authentication header"
+             (subject/http-get irrelevant {"Authentication" "Basic some-password"}) => irrelevant
              (provided
-               (client/get ..url.. {:insecure?             true
-                                    :timeout               30000
-                                    :headers               {"Accept" "application/xml"}
-                                    :as                    :stream
-                                    :throw-entire-message? true}) => {:body ..some-body..}))
-       (fact "with authentication"
-             (subject/http-get ..url.. {"Authentication" "Basic some-password"}) => ..some-body..
+               (client/get anything (contains {:headers (contains {"Authentication" "Basic some-password"})})) => {:body irrelevant}))
+
+       (fact "returns the body"
+             (subject/http-get irrelevant {}) => ..some-body..
              (provided
-               (client/get ..url.. {:insecure?             true
-                                    :timeout               30000
-                                    :headers               {"Accept" "application/xml" "Authentication" "Basic some-password"}
-                                    :as                    :stream
-                                    :throw-entire-message? true}) => {:body ..some-body..}))
+               (client/get anything anything) => {:body ..some-body..}))
+
+       (fact "uses the given url"
+             (subject/http-get ..url.. {}) => irrelevant
+             (provided
+               (client/get ..url.. anything) => {:body irrelevant}))

        (fact "throws exception info for unknown hosts"
-             (subject/http-get ..url.. {}) => (throws ExceptionInfo "some-host is an unknown host")
+             (subject/http-get irrelevant {}) => (throws ExceptionInfo "some-host is an unknown host")
              (provided
-               (client/get ..url.. anything) =throws=> (UnknownHostException. "some-host: unkown error")))
+               (client/get anything anything) =throws=> (UnknownHostException. "some-host: unkown error")))

        (fact "throws exception info for bad uri syntax"
-             (subject/http-get ..url.. {}) => (throws ExceptionInfo "Illegal character in authority at index 0: some-url")
+             (subject/http-get irrelevant {}) => (throws ExceptionInfo "Illegal character in authority at index 0: some-url")
              (provided
-               (client/get ..url.. anything) =throws=> (URISyntaxException. "some-url" "Illegal character in authority at index 0"))))
+               (client/get anything anything) =throws=> (URISyntaxException. "some-url" "Illegal character in authority at index 0"))))


Minor changes on bench code.

Minor changes on bench code.

--- dev/bench/core.cljs
+++ dev/bench/core.cljs
@@ -1,5 +1,6 @@
 (ns bench.core
-  (:require [kdtree :as k]))
+  (:require [kdtree :as k]
+            [cljs.nodejs :as node]))

 (enable-console-print!)

@@ -7,65 +8,67 @@
   [n]
   (for [x (range 0 n)
         y (range 0 n)]
-    (k/point2d x y)))
+    #js [x y]))

 (defn bench-init-100
   []
+  (js/console.time "init:100")
   (let [points (into-array (generate-points 10))]
-    (time
-     (k/create2d points))))
-
-(defn bench-init-1000
-  []
-  (let [points (into-array (generate-points 100))]
-    (time
-     (k/create2d points))))
+    (k/create2d points)
+    (js/console.timeEnd "init:100")))

 (defn bench-init-10000
   []
-  (let [points (into-array (generate-points 1000))]
-    (time
-     (k/create2d points))))
+  (js/console.time "init:10000")
+  (let [points (into-array (generate-points 100))]
+    (k/create2d points)
+    (js/console.timeEnd "init:10000")))
+
+(defn bench-init-160000
+  []
+  (js/console.time "init:160000")
+  (let [points (into-array (generate-points 400))]
+    (k/create2d points)
+    (js/console.timeEnd "init:160000")))

 (defn bench-init
   []
-  (println "init:100")
   (bench-init-100)
-  (println "init:1000")
-  (bench-init-1000)
-  (println "init:10000")
-  (bench-init-10000))
+  (bench-init-10000)
+  (bench-init-160000))

-(defn bench-knn-100000-2
+(defn bench-knn-160000
   []
-  (let [tree (-> (into-array (generate-points 10000))
-                 (k/create2d points))
-        pt (k/point2d (rand-int 10000)
-                      (rand-int 10000))]
+  (let [tree (-> (into-array (generate-points 400))
+                 (k/create2d))]
+    (dotimes [i 100]
+      (js/console.time "knn:160000")
+      (let [pt #js [(rand-int 400)
+                    (rand-int 400)]]
+        (.nearest tree pt 2))
+      (js/console.timeEnd "knn:160000"))))

+(defn bench-knn-360000
+  []
+  (let [tree (-> (into-array (generate-points 600))
+                 (k/create2d))]
     (dotimes [i 100]
-      (time
-       (.nearest tree pt 2)))))
-
-(defn bench-knn-10000-2
-  []
-  (let [tree (-> (into-array (generate-points 1000))
-                 (k/create2d points))
-        pt (k/point2d (rand-int 1000)
-                      (rand-int 1000))]
-
-    (dotimes [i 100]
-      (time
-       (.nearest tree pt 2)))))
+      (js/console.time "knn:360000")
+      (let [pt #js [(rand-int 600)
+                    (rand-int 600)]]
+        (.nearest tree pt 2))
+      (js/console.timeEnd "knn:360000"))))

 (defn bench-knn
   []
-  (println "knn:10000:2")
-  (bench-knn-10000-2))
+  (bench-knn-160000)
+  (bench-knn-360000))

 (defn main
   [& [type]]
-  (cond
+  (bench-init)
+  (bench-knn)
+  #_(cond
     (= type "init")
     (bench-init)


Sequence schemas for subconfigs.

Sequence schemas for subconfigs.

--- src/active/clojure/config.cljc
+++ src/active/clojure/config.cljc
@@ -852,8 +852,10 @@
 (defn section-subconfig
   "Extract a section from a config as a config."
   [config & sections]
-  (really-make-configuration (access-section config sections identity)
-                             (section-schema (last sections))))
+  (access-section config sections
+                  (fn [cf]
+                    (really-make-configuration cf
+                                               (section-schema (last sections))))))

 (defn reduce-scalar-config-settings
   "Reduce over all scalary config values in config, where `f` is


add indices to english

add indices to english

--- src/babel/english/grammar.cljc
+++ src/babel/english/grammar.cljc
@@ -3,7 +3,7 @@
   (:require
    [babel.english.lexicon :refer [lexicon]]
    [babel.english.morphology :refer (analyze fo)]
-   [babel.index :refer [map-subset-by-path]]
+   [babel.index :refer [create-indices lookup-spec]]
    [babel.over :refer (over)]
    [babel.parse :as parse]
    [babel.ug :refer [comp-modifies-head
@@ -23,6 +23,11 @@
    #?(:cljs [babel.logjs :as log])
    [clojure.core.cache :as cache]
    [dag_unify.core :refer (fail? get-in remove-matching-keys unifyc)]))
+
+(def index-lexicon-on-paths
+  [[:synsem :cat]
+   [:synsem :aux]
+   [:synsem :sem :pred]])

 (declare cache)

@@ -661,16 +666,7 @@
                                       (= :it (get-in % [:target])))
                                  v)]
                      (if (not (empty? filtered-v))
-                       [k filtered-v]))))}
-
-     :aux2lex
-     (map-subset-by-path lexicon [:synsem :aux])
-
-     :pred2lex ;; map:<pred => subset of lexicon with that pred>
-     (map-subset-by-path lexicon [:synsem :sem :pred])
-
-     :cat2lex ;; map:<cat => subset of lexicon with that cat>
-     (map-subset-by-path lexicon [:synsem :cat])}))
+                       [k filtered-v]))))}}))

 (defn medium []
   (let [lexicon
@@ -678,9 +674,11 @@
               (for [[k v] @lexicon]
                 (let [filtered-v v]
                   (if (not (empty? filtered-v))  ;; TODO: this empty-filtering should be done in lexicon.cljc, not here.
-                    [k filtered-v]))))]
+                    [k filtered-v]))))
+        indices (create-indices lexicon index-lexicon-on-paths)]
     {:name "medium"

+     :index-fn (fn [spec] (lookup-spec spec indices index-lexicon-on-paths))
      ;; Will throw a clojure/core-level exception if more than 1 rule has the same :rule value:
      :grammar-map (zipmap
                    (map #(keyword (get-in % [:rule])) grammar)
@@ -698,19 +696,7 @@
      :morph fo
      :morph-ps fo-ps
      :lexical-cache (atom (cache/fifo-cache-factory {} :threshold 1024))
-     :lexicon lexicon
-
-     :aux2lex
-     (map-subset-by-path lexicon [:synsem :aux])
-
-     :infl2lex
-     (map-subset-by-path lexicon [:synsem :infl])
-
-     :pred2lex ;; map:<pred => subset of lexicon with that pred>
-     (map-subset-by-path lexicon [:synsem :sem :pred])
-
-     :cat2lex ;; map:<cat => subset of lexicon with that cat>
-     (map-subset-by-path lexicon [:synsem :cat])}))
+     :lexicon lexicon}))

 (defn np-grammar []
   (let [grammar


"Juan and me" is reflexive=false

"Juan and me" is reflexive=false

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1015,6 +1015,7 @@
    [{:synsem {:cat :noun
               :pronoun true
               :case :acc
+              :reflexive false
               :agr {:gender :masc
                     :person :1st
                     :number :plur}


cleanup

cleanup

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -99,7 +99,6 @@
    "at" (let [obj (atom {:place true})]
           {:synsem {:cat :prep
                     :subcat {:1 {:cat :noun
-                                 :subcat '()
                                  :sem obj}}
                     :sem {:obj obj
                           :pred :at}}})


Adjust indentation per project standard

Adjust indentation per project standard

--- src/braid/core/server/core.clj
+++ src/braid/core/server/core.clj
@@ -1,13 +1,14 @@
 (ns braid.core.server.core
-  (:require [braid.core.server.handler :refer [mobile-client-app
-                                               desktop-client-app
-                                               api-server-app]]
-            [braid.base.server.ws-handler] ; for mount
-            [braid.core.server.sync] ; for multimethods
-            [braid.base.server.jobs] ; for mount
-            [mount.core :as mount :refer [defstate]]
-            [org.httpkit.server :refer [run-server server-port server-stop!]]
-            [taoensso.timbre :as timbre]))
+  (:require
+   [braid.core.server.handler :refer [mobile-client-app
+                                      desktop-client-app
+                                      api-server-app]]
+   [braid.base.server.ws-handler] ; for mount
+   [braid.core.server.sync] ; for multimethods
+   [braid.base.server.jobs] ; for mount
+   [mount.core :as mount :refer [defstate]]
+   [org.httpkit.server :refer [run-server server-port server-stop!]]
+   [taoensso.timbre :as timbre]))

 ;; server


Makes a few minor changes to the training page's markup.

--- src/cadence/views/training.clj
+++ src/cadence/views/training.clj
@@ -34,14 +34,19 @@
      [:div#completion.row-fluid
       (let [trcount (count (patrec/kept-cadences))]
         (html
-          [:div.progress.progress-success.progress-striped.span10
+
+          [:div
+           {:class (str "progress progress-success progress-striped span10"
+                        (when (>= trcount @patrec/training-min) " active"))}
            [:div.bar
             {:style (str "width: "
-                         (* 100.0 (/ trcount @patrec/training-min))
+                         (min 100 (* 100.0 (/ trcount @patrec/training-min)))
                          "%;")}]]
           (if (>= trcount @patrec/training-min)
-            [:button.btn.btn-large.btn-success.span2 "I'm done"]
-            [:button.btn.btn-large.disabled.span2 "Complete"])))]]))
+            [:div.span2 [:a.btn.btn-large.btn-success
+             {:href "/user/profile"} "Already done!"]]
+            [:div.span2 [:a.btn.btn-large.disabled
+             {:href "#"} "Complete"]])))]]))

 (defpage post-training [:post "/user/training"] {:as unkeyed-cad}
   ; I like maps with keyword keys
@@ -53,11 +58,11 @@
         (let [trnmin @patrec/training-min
               kept (patrec/kept-cadences)
               trcount (count kept)
-              done (<= trnmin trcount)]
+              done (>= trcount trnmin)]
           (resp/json {:success true
                       :done done
                       :session kept
-                      :progress (* 100.0 (/ trcount @patrec/training-min))}))
+                      :progress (* 100.0 (/ trcount trnmin))}))
         (resp/json {:success true
                     :done false
                     :progress 0}))


Added support for single-domain live updates.

--- src/clj/elephantdb/service.clj
+++ src/clj/elephantdb/service.clj
@@ -183,12 +183,18 @@
         (log-message "Finished updating all domains from remote")
         (catch Throwable t (log-error t "Error when syncing data") (throw t))))))

-(defn- update-domains [domains]
-  (log-message "Updating domains: " domains)
-  true) ;; just return true for now
-
-(defn- update-domain [domain]
-  (update-domains [domain]))
+(defn- update-domain [domain domains-info global-config local-config]
+  (let [max-kbs 1024]
+    (log-message "Updating SINGLE domain: " domain)
+    (start-download-supervisor 1 max-kbs)
+    (future
+      (let [loader (load-and-sync-status-of-domain
+                    domains-info domain
+                    (fn [domain]
+                      (use-cache-or-update domain domains-info global-config local-config false)))]
+        (with-ret (.get loader)
+          (log-message "Successfully loaded domain: " domain))))
+    true)) ;; return true to indicate we're loading

 ;; 1. after *first* load finishes, right the global config with the token within
 ;; 2. when receive an update, open up the version and mkdir immediately,
@@ -303,8 +309,7 @@

               (update
                [#^String domain]
-                ;; TODO
-                (update-domain domain)
+                (update-domain domain domains-info global-config local-config)
                ))]
       (reset! client (client. ret (:hdfs-conf local-config) global-config))
       ret ))


fix yang dikomen

fix yang dikomen

--- src/clj/mobile_survey/core.clj
+++ src/clj/mobile_survey/core.clj
@@ -46,8 +46,8 @@

 (defn create-survey-helper [values]
   (println values)
-  #_(models/create-survey! values)
-  #_(models/get-survey-id (:user_id values) (:name values)))
+  (models/create-survey! values)
+  (models/get-survey-id (:user_id values) (:name values)))

 (defn handle-file-number [file-number]
     (let [file-num (io/upload-file "/temp/" file-number)]
@@ -73,11 +73,11 @@
                     (clojure.string/split (clojure.string/triml numbersText) #"\s+")
                     (handle-file-number numbersFile))]
       (doseq [number numbers]
-        #_(models/create-number! {:survey_id survey-id
+        (models/create-number! {:survey_id survey-id
                                :number number
                                :reply ""}))
-      #_(sms/publish-survey! {:id survey-id :content content} numbers)
-      #_(redirect "/surveys")))
+      (sms/publish-survey! {:id survey-id :content content} numbers)
+      (redirect "/surveys")))

 (defn detail-survey [id]
     (let [{:keys [name description created_on content status]} (models/get-survey-with-id id)


Return correct context to next request even in timeout case

--- src/clj_gatling/simulation.clj
+++ src/clj_gatling/simulation.clj
@@ -39,7 +39,7 @@
             :id user-id
             :start @start-promise
             :end (now)
-            :result false} (first context)])))))
+            :result false} context])))))

 (defn- run-requests [requests timeout user-id result-channel]
   (go-loop [r requests


change logic to suppress buy/sell buttons

--- src/clj_money/web/accounts.clj
+++ src/clj_money/web/accounts.clj
@@ -223,7 +223,7 @@
       (format-number gain)
       " ")]
    [:td
-    (when (= :data style)
+    (when shares
       [:div.btn-group
        (glyph-button :plus-sign
                      (format "/accounts/%s/purchases/new?commodity-id=%s"


Sort by rid to maintain consistent ordering

--- src/cljs/retrobard/client.cljs
+++ src/cljs/retrobard/client.cljs
@@ -237,7 +237,7 @@
                         (map (fn [note] (om/build note-view {:connection connection
                                                             :column-id id
                                                             :note note}))
-                             (:notes column)))
+                             (sort-by first (:notes column))))
                  (om/build create-note-button {:connection connection
                                                :column-id id}))))))

@@ -270,7 +270,7 @@
                                    (map (fn [col]
                                           (om/build column-view {:connection connection
                                                                  :column col}))
-                                        columns)))))))))
+                                        (sort-by first columns))))))))))

 (def app-state (atom {:state {} :connection (web-socket)}))


Catch transaction errors with meaningful context.

--- src/cljx/geschichte/stage.cljx
+++ src/cljx/geschichte/stage.cljx
@@ -60,9 +60,15 @@

 (defn trans-apply [eval-fn val [trans-fn params]]
-  (if (= trans-fn repo/store-blob-trans-value)
-    (repo/store-blob-trans val params)
-    ((eval-fn trans-fn) val params)))
+  (try
+    (if (= trans-fn repo/store-blob-trans-value)
+      (repo/store-blob-trans val params)
+      ((eval-fn trans-fn) val params))
+    (catch Exception e
+      (throw ex-info "Cannot transact."
+             {:trans-fn trans-fn
+              :params params
+              :exception e}))))

 #_(def commit-value-cache (atom {}))


Use the new clj-chess.game/board function in clj-chess.game/to-uci.

--- src/clojure/clj_chess/game.clj
+++ src/clojure/clj_chess/game.clj
@@ -120,7 +120,7 @@
   "Exports the current game state in a format ready to be sent to a UCI
   chess engine, i.e. like 'position fen' followed by a sequence of moves."
   [game]
-  (-> game :current-node :board board/board-to-uci))
+  (-> game board board/board-to-uci))

 (defn move-tree


edges -> raw-edges, filtered-edges -> edges

--- src/clojure/confgraph/core.clj
+++ src/clojure/confgraph/core.clj
@@ -4,22 +4,22 @@
   (:import java.io.File)
   (:import org.yaml.snakeyaml.Yaml))

-(def yaml     (Yaml. (ExtendedConstructor.)))
-(def extends  (memoize (fn [d] (.get (.load yaml (slurp (.getPath d))) "ddts_extends"))))
-(def defs     (for [x (.listFiles (File. "defs/runs")) :when (.isFile x)] x))
-(def vertices (for [x defs] (.getName x)))
-(def edges    (zipmap vertices (for [x defs] (extends x))))
+(def yaml      (Yaml. (ExtendedConstructor.)))
+(def extends   (memoize (fn [d] (.get (.load yaml (slurp (.getPath d))) "ddts_extends"))))
+(def defs      (for [x (.listFiles (File. "defs/runs")) :when (.isFile x)] x))
+(def vertices  (for [x defs] (.getName x)))
+(def raw-edges (zipmap vertices (for [x defs] (extends x))))

 (def rootpath
   (memoize (fn [src]
-             (let [dst (edges src)]
+             (let [dst (raw-edges src)]
                (if (nil? dst)
                  {}
                  (conj {src dst} (rootpath dst)))))))

-(defn filtered-edges [prefix]
+(defn edges [prefix]
   (let [re (re-pattern (str prefix ".*"))]
-    (into {} (for [[src dst] edges :when (re-matches re src)] (rootpath src)))))
+    (into {} (for [[src dst] raw-edges :when (re-matches re src)] (rootpath src)))))

 (defn usage []
   (println "Supply at most a single filtering prefix.")
@@ -28,5 +28,5 @@
 (defn -main [& args]
   (alter-var-root #'*read-eval* (constantly false))
   (if (> (count args) 1) (usage))
-  (let [fe (filtered-edges (first args))]
+  (let [fe (edges (first args))]
     (prn fe)))


Remove unnecessary require

Remove unnecessary require

--- src/clojure/nightmod/input.clj
+++ src/clojure/nightmod/input.clj
@@ -1,6 +1,5 @@
 (ns nightmod.input
-  (:require [nightcode.shortcuts :as shortcuts]
-            [play-clj.core :as play-clj])
+  (:require [play-clj.core :as play-clj])
   (:import [com.badlogic.gdx.backends.lwjgl LwjglInput]
            [java.awt.event KeyEvent KeyListener]
            [nightmod KeyCodeConverter]


Add missing header-type to chaincode call

--- src/clojure_fabric/channel.clj
+++ src/clojure_fabric/channel.clj
@@ -178,7 +178,8 @@
                                      name
                                      channel
                                      (apply core/get-user user-key)
-                                     :args [name])))
+                                     :args [name]
+                                     :header-type :endorser-transaction)))

 ;;;query_block
 (defn query-block-by-number
@@ -194,7 +195,8 @@
                                      name
                                      channel
                                      (apply core/get-user user-key)
-                                     :args [name block-number])))
+                                     :args [name block-number]
+                                     :header-type :endorser-transaction)))

 (defn query-block-by-hash
   "Queries the ledger for Block by block hash


Implement get-genesis-block

Implement get-genesis-block

--- src/clojure_fabric/channel.clj
+++ src/clojure_fabric/channel.clj
@@ -28,8 +28,10 @@
 (ns clojure-fabric.channel
   (:require [clojure-fabric.chaincode :as chaincode]
             [clojure-fabric.core :as core]
+            [clojure-fabric.proto :as proto]
             [clojure-fabric.utils :as utils])
-  (:import org.bouncycastle.util.encoders.Hex))
+  (:import org.bouncycastle.util.encoders.Hex
+           org.hyperledger.fabric.protos.orderer.Ab$DeliverResponse))

 ;;;
 ;;; Functions
@@ -327,5 +329,28 @@
    ))
 ;;;

+
+(defn get-genesis-block
+  ([]
+   (get-genesis-block core/*channel* (chaincode/get-random-node core/*channel* :orderers)))
+  ([{:keys [user-key name] :as channel} orderer]
+   (let [seek-start-stop (proto/make-seek-position :specified (proto/make-seek-specified :number 0)) ]
+     (let [result (->> (proto/make-seek-info :start seek-start-stop :stop seek-start-stop :behavior :block-until-ready)
+                (chaincode/make-envelope name (apply core/get-user user-key) :deliver-seek-info)
+                (proto/broadcast-or-deliver-via-orderer :deliver orderer))]
+       (.getBlock ^Ab$DeliverResponse (first result))))))
+
+;; (def u1 (core/get-user "Org1MSP" "user1"))
+;; (def u2 (assoc-in u1 [:channels "testchan14"] (get-in u1 [:channels "mychannel"])))
+;; (def u3 (update-in u2 [:channels "testchan14" :name] (fn [_] "testchan14")))
+;; (binding [core/*channel* (get-in u3 [:channels "testchan14"] )]
+;;   (get-genesis-block))
+
+(defn join-channel
+  ([peers block]
+   (join-channel core/*channel* peers))
+  ([channel peers block]
+   ))
+
 ;;;;;;;;;


Added defservice macro back in

Added defservice macro back in

--- src/compojure/http/servlet.clj
+++ src/compojure/http/servlet.clj
@@ -119,3 +119,16 @@
      (~'service [request# response#]
        (request-handler [~'this request# response#]
          ~routes))))
+
+(defmacro defservice
+  "Defines a service method with an optional prefix suitable for being used by
+  genclass to compile a HttpServlet class.
+  e.g. (defservice my-routes)
+       (defservice \"my-prefix-\" my-routes)"
+  ([routes]
+   `(defservice "-" ~routes))
+  ([prefix routes]
+   `(defn ~(symbol (str prefix "service"))
+      [servlet# request# response#]
+      (request-handler [servlet# request# response#]
+        ~routes))))


disabled es analyzers on relation mapping

--- src/ctia/stores/es/mapping.clj
+++ src/ctia/stores/es/mapping.clj
@@ -18,9 +18,9 @@
 (def all_text {:type "string" :copy_to "_all"})

 (def related
-  {:confidence {:type "string"}
-   :source {:type "string"}
-   :relationship {:type "string"}})
+  {:confidence string
+   :source string
+   :relationship string})

 (def valid-time
   {:properties


Endpoints for job-start and job-finished

--- src/emender_service/server.clj
+++ src/emender_service/server.clj
@@ -21,9 +21,26 @@
                 (http-response/content-type content-type))
             (println "return-file(): can not access file: " (.getName file)))))

+(defn job-start-handler
+    [uri]
+    (println "job started" uri))
+
+(defn job-finished-handler
+    [uri]
+    (println "job finished" uri))
+
+(defn unknown-call-handler
+    [uri]
+    (println "unknown API call" uri))
+
+; todo API call prefix -> config
+
 (defn api-call-handler
     [uri method]
-    nil)
+    (condp = (subs uri (.length "/v1"))
+        "/job-start"    (job-start-handler    uri)
+        "/job-finished" (job-finished-handler uri)
+                           (unknown-call-handler uri)))

 (defn non-api-call-handler
     [request uri]
@@ -35,6 +52,8 @@
         "/bootstrap.min.js"    (return-file "bootstrap.min.js"    "application/javascript")
         "/"                    (render-front-page request)))

+; todo API call prefix -> config
+
 (defn handler
     "Handler that is called by Ring for all requests received from user(s)."
     [request]


Dokumentation fuer indexed-*-map angepasst

--- src/excellence/spreadsheet.clj
+++ src/excellence/spreadsheet.clj
@@ -378,12 +378,12 @@
   "Speichert Zellreferenzen eines Zellbereiches in einen
 assoziativen Speicher (map):
    'index-type' steuert den Aufbau der Datenstruktur:
-   :address-key         - {:A1 foo :A2 bar}
-   :address-nested-map  - {:1 {:A foo} :2 {:A bar}}
-   :row-col-vec         _ {[0 0] foo [0 1] bar}
-   :row-col-nested-map  - {0 {0 foo} 0 {1 :bar}}
-   :coordinates-vec       - {[zeile1 spalte1] foo [zeile1 spalte1] bar}
-   :coordinates-nested-map- {:zeile1 {:spalte1 foo} :zeile1 {:spalte2 bar}}"
+   :address-key            - {:A1 foo :A2 bar}
+   :address-nested-map     - {:1 {:A foo} :2 {:A bar}}
+   :row-col-vec            - {[0 0] foo [0 1] bar}
+   :row-col-nested-map     - {0 {0 foo} 0 {1 :bar}}
+   :coordinates-vec        - {[zeile1 spalte1] foo [zeile1 spalte1] bar}
+   :coordinates-nested-map - {:zeile1 {:spalte1 foo} :zeile1 {:spalte2 bar}}"
   [x index-type]
   (indexed-*-map x index-type identity))

@@ -391,12 +391,12 @@
 (defn indexed-value-map
   "Laedt den Inhalt eines Zellbereiches in einen assoziativen Speicher (map):
 'index-type' steuert den Aufbau der Datenstruktur:
-:address-key         - {:A1 foo :A2 bar}
-:address-nested-map  - {:1 {:A foo} :2 {:A bar}}
-:row-col-vec         _ {[0 0] foo [0 1] bar}
-:row-col-nested-map  - {0 {0 foo} 0 {1 :bar}}
-:coord-sys-vec       - {[zeile1 spalte1] foo [zeile1 spalte1] bar}
-:coord-sys-nested-map- {:zeile1 {:spalte1 foo} :zeile1 {:spalte2 bar}}"
+:address-key            - {:A1 foo :A2 bar}
+:address-nested-map     - {:1 {:A foo} :2 {:A bar}}
+:row-col-vec            - {[0 0] foo [0 1] bar}
+:row-col-nested-map     - {0 {0 foo} 0 {1 :bar}}
+:coordinates-vec        - {[zeile1 spalte1] foo [zeile1 spalte1] bar}
+:coordinates-nested-map - {:zeile1 {:spalte1 foo} :zeile1 {:spalte2 bar}}"
   [x index-type]
   (indexed-*-map x index-type get-cell-value))


add list-hooks

add list-hooks

--- src/gh_waiting_room/github.clj
+++ src/gh_waiting_room/github.clj
@@ -1,6 +1,6 @@
 (ns gh-waiting-room.github
   (:require [tentacles.issues :refer [my-issues create-comment]]
-            [tentacles.repos :refer [create-hook]]
+            [tentacles.repos :refer [create-hook hooks]]
             [gh-waiting-room.config :refer [gh-auth issue-url-regex gh-hide-labels app-domain]]))

 ;;; util fns
@@ -71,6 +71,12 @@
                {:url (full-url-for "/webhook") :content_type "json"}
                (assoc (gh-auth) :events ["issues"])))

+(defn list-hooks [user name]
+  (->>
+   (hooks user name (gh-auth))
+   (map (fn [h]
+          {:url (get-in! h [:config :url]) :id (:id h)}))))
+
 (defn create-issue-comment [db issue-id issue-num]
   (let [issue (or
                (some #(and (= (:id %) issue-id) %) (viewable-issues db))


Update gate to operate on JS arrays/data

--- src/main/audio_utils/gate.cljs
+++ src/main/audio_utils/gate.cljs
@@ -1,8 +1,8 @@
 (ns audio-utils.gate
   (:require [audio-utils.ring-buffer :as rb]
             [audio-utils.rms-buffer :as rms]
-            [audio-utils.util :refer [aatom << >> aswap!
-                                      db->amplitude time->samples]]
+            [audio-utils.util :as u
+             :refer [aatom << >> aswap! db->amplitude time->samples]]
             [audio-utils.worker :as w]))

 (defprotocol IGate
@@ -22,16 +22,16 @@
     (reset! next nil))

   (process-audio [this data]
-    (let [n-channels (count data)
-          n-samples  (count (first data))
-          output     (volatile! (into [] (repeat n-channels [])))]
+    (let [n-channels (u/acount data)
+          n-samples  (u/acount (u/afirst data))
+          output     (into-array (repeat n-channels #js []))]
       (dotimes [n n-samples]
         (dotimes [channel n-channels]
-          (let [input-sample  ((data channel) n)
+          (let [input-sample  (u/anth (u/anth data channel) n)
                 output-sample (generate-output-sample this channel
                                                       input-sample)]
-            (vswap! output update channel conj output-sample))))
-      (some-> @next (w/process-audio @output))))
+            (u/aconj (u/anth output channel) output-sample))))
+      (some-> @next (w/process-audio output))))

   IGate
   (generate-output-sample [this channel input-sample]


Add board slug or uuid to all the allow-authors call where we have one to make sure we check also against the board access, not only the org.

--- src/oc/storage/api/entries.clj
+++ src/oc/storage/api/entries.clj
@@ -383,7 +383,7 @@
     :options true
     :get (fn [ctx] (access/access-level-for conn org-slug board-slug-or-uuid (:user ctx)))
     :post (fn [ctx] (access/allow-authors conn org-slug board-slug-or-uuid (:user ctx)))
-    :delete (fn [ctx] (access/allow-authors conn org-slug (:user ctx)))})
+    :delete (fn [ctx] (access/allow-authors conn org-slug board-slug-or-uuid (:user ctx)))})

   ;; Validations
   :processable? (by-method {
@@ -435,7 +435,7 @@
   ;; Authorization
   :allowed? (by-method {
     :options true
-    :post (fn [ctx] (access/allow-authors conn org-slug (:user ctx)))})
+    :post (fn [ctx] (access/allow-authors conn org-slug board-slug-or-uuid (:user ctx)))})

   ;; Media type client accepts
   :available-media-types (by-method {
@@ -503,7 +503,7 @@
   ;; Authorization
   :allowed? (by-method {
     :options true
-    :post (fn [ctx] (access/allow-authors conn org-slug (:user ctx)))})
+    :post (fn [ctx] (access/allow-authors conn org-slug board-slug (:user ctx)))})

   ;; Media type client accepts
   :available-media-types (by-method {
@@ -562,7 +562,7 @@
   ;; Authorization
   :allowed? (by-method {
     :options true
-    :post (fn [ctx] (access/allow-authors conn org-slug (:user ctx)))})
+    :post (fn [ctx] (access/allow-authors conn org-slug board-slug (:user ctx)))})

   ;; Media type client accepts
   :available-media-types (by-method {


Cleanup.

Cleanup.

--- src/onyx/plugin/bookkeeper.clj
+++ src/onyx/plugin/bookkeeper.clj
@@ -150,21 +150,21 @@

           :else
           (let [no-recovery? (:bookkeeper/no-recovery? task-map)
+                ledger-id (:bookkeeper/ledger-id task-map)
                 _ (when-not ledger-handle
-                    ;; FIXME
-                    (let [f (if (and no-recovery? (not (.isClosed client (:bookkeeper/ledger-id task-map))))
-                              open-ledger-no-recovery
-                              open-ledger)]
+                    (let [open-f (if (and no-recovery? (not (.isClosed client ledger-id)))
+                                   open-ledger-no-recovery
+                                   open-ledger)]
                       (set! ledger-handle
-                            (f client
-                               (:bookkeeper/ledger-id task-map)
-                               digest
-                               (:bookkeeper/password-bytes task-map)))))
+                            (open-f client
+                                    ledger-id
+                                    digest
+                                    (:bookkeeper/password-bytes task-map)))))
                 chunk-size (:bookkeeper/read-max-chunk-size task-map)
                 chunk-size 1
                 ;; too many isClosed checks
                 ;; should only check is closed when we have done an empty read
-                ledger-closed? (.isClosed client (:bookkeeper/ledger-id task-map))
+                ledger-closed? (.isClosed client ledger-id)
                 last-confirmed (if no-recovery?
                                  (.readLastConfirmed ledger-handle)
                                  (.getLastAddConfirmed ledger-handle))


Don't convert coordinates for non-isometric screens

--- src/play_clj/core_graphics.clj
+++ src/play_clj/core_graphics.clj
@@ -377,12 +377,20 @@
                       (int (.getTileWidth layer))
                       (int (.getTileHeight layer))))

+(defn ^:private isometric?
+  "Internal use only"
+  [{:keys [renderer] :as screen}]
+  (or (isa? (type renderer) IsometricTiledMapRenderer)
+      (isa? (type renderer) IsometricStaggeredTiledMapRenderer)))
+
 (defn ^:private split-layer
   "Internal use only"
   [screen layer-name]
   (let [^TiledMapTileLayer l (tiled-map-layer screen layer-name)]
     (reduce (fn [layers {:keys [x y] :as map-tile}]
-              (let [screen-tile (isometric->screen screen map-tile)
+              (let [screen-tile (if (isometric? screen)
+                                  (isometric->screen screen map-tile)
+                                  map-tile)
                     new-layer (or (->> layers (filter #(= y (:y %))) first)
                                   (assoc screen-tile :layer (create-layer l)))]
                 (->> (tiled-map-layer! l :get-cell x y)


dissoc :css attribute from props map

dissoc :css attribute from props map

--- src/sablono/cljss_compiler.clj
+++ src/sablono/cljss_compiler.clj
@@ -19,7 +19,9 @@
         (->> (seq attrs)
              (reduce (fn [attrs [name value]]
                        (if (= name :css)
-                         (assoc attrs :class (compile-class class value))
+                         (-> attrs
+                             (assoc :class (compile-class class value))
+                             (dissoc :css))
                          (assoc attrs name (s/compile-attr name value))))
                      nil)
              (sutil/html-to-dom-attrs)


fix http-fetch: handle error status code

--- src/status_im/utils/utils.cljs
+++ src/status_im/utils/utils.cljs
@@ -44,8 +44,15 @@
    (-> (.fetch js/window url (clj->js {:method "GET"}))
        (.then (fn [response]
                 (log response)
-                (.text response)))
-       (.then on-success)
+                [(.text response) (.-ok response)]))
+       (.then (fn [[response ok?]]
+                (cond
+                  ok? (on-success response)
+
+                  (and on-error (not ok?))
+                  (on-error response)
+
+                  :else false)))
        (.catch (or on-error
                    (fn [error]
                      (show-popup "Error" (str error))))))))


CMR-4461: Fix test to get the updated batch size from the side-api.

--- system-int-test/test/cmr/system_int_test/search/collection_humanized_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/collection_humanized_search_test.clj
@@ -94,31 +94,39 @@
       (testing "Ensure that the returned report is the same as the cached one"
        (is (= report (get-cached-report)))))))

+(defn- get-humanizer-report-batch-size
+  "Returns the currently configured value for the humanizer report batch size."
+  []
+  (-> (side/eval-form `(hrs/humanizer-report-collection-batch-size))
+      :body
+      Integer/parseInt))
+
 (deftest humanizer-report-batch
   (side/eval-form `(hrs/set-humanizer-report-collection-batch-size! 10))
-  ;; Insert more entries than the batch size to test batches
-  (doseq [n (range (inc (hrs/humanizer-report-collection-batch-size)))]
-    (d/ingest-umm-spec-collection "PROV1"
-     (data-umm-c/collection n
-      {:ShortName "B"
-       :Version n
-       :Platforms [(data-umm-cmn/platform {:ShortName "AM-1"})]})))
-  (index/wait-until-indexed)
-  ;; Refresh the metadata cache
-  (search/refresh-collection-metadata-cache)
-  (testing "Humanizer report batches"
-    (let [report-lines (str/split (search/get-humanizers-report) #"\n")]
-      (is (= (count report-lines) (+ 2 (hrs/humanizer-report-collection-batch-size))))
-      (doall
-       (map-indexed (fn [n actual-line]
-                      (let [coll-normalized (+ n 7) ;; First collection concept ID ends with 7
-                            coll-suffix (if (< coll-normalized 10)
-                                          (str "0" coll-normalized)
-                                          (str coll-normalized))]
-                        (is (= (format "PROV1,C12000000%s-PROV1,B,%d,AM-1,Terra" coll-suffix n)
-                               actual-line))))
-                    (rest report-lines)))))
-  (side/eval-form `(hrs/set-humanizer-report-collection-batch-size! 500)))
+  (let [updated-batch-size (get-humanizer-report-batch-size)]
+    ;; Insert more entries than the batch size to test batches
+    (doseq [n (range (inc updated-batch-size))]
+      (d/ingest-umm-spec-collection "PROV1"
+       (data-umm-c/collection n
+        {:ShortName "B"
+         :Version n
+         :Platforms [(data-umm-cmn/platform {:ShortName "AM-1"})]})))
+    (index/wait-until-indexed)
+    ;; Refresh the metadata cache
+    (search/refresh-collection-metadata-cache)
+    (testing "Humanizer report batches"
+      (let [report-lines (str/split (search/get-humanizers-report) #"\n")]
+        (is (= (count report-lines) (+ 2 (hrs/humanizer-report-collection-batch-size))))
+        (doall
+         (map-indexed (fn [n actual-line]
+                        (let [coll-normalized (+ n 7) ;; First collection concept ID ends with 7
+                              coll-suffix (if (< coll-normalized 10)
+                                            (str "0" coll-normalized)
+                                            (str coll-normalized))]
+                          (is (= (format "PROV1,C12000000%s-PROV1,B,%d,AM-1,Terra" coll-suffix n)
+                                 actual-line))))
+                      (rest report-lines)))))
+    (side/eval-form `(hrs/set-humanizer-report-collection-batch-size! 500))))

 (deftest search-by-platform-humanized
   (let [coll1 (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection 1 {:Platforms [(data-umm-cmn/platform {:ShortName "TERRA"})]}))


ARM: kirkwood: fix typo in Makefile.boot

Just a small typo fix to make lsxl dtbs compile

Signed-off-by: Sebastian Hesselbarth <1d402fe89ace836b52164ed4c0f247cb6f80efc1@googlemail.com>
Cc: Jason Cooper <68c46a606457643eab92053c1c05574abb26f861@lakedaemon.net>
Cc: Andrew Lunn <02e0a999c50b1f88df7a8f5a04e1b76b35ea6a88@lunn.ch>
Cc: Russell King <ba324ca7b1c77fc20bb970d5aff6eea9377918a5@arm.linux.org.uk>
Cc: f99ef57ccac738b558d0fc2e44478b3c5def9522@lists.infradead.org
Cc: 2578944098299abf708b08eff6fcf60565553586@vger.kernel.org
Signed-off-by: Arnd Bergmann <f2c659f01951776204a6c5b902787d9019fbeebd@arndb.de>

--- arch/arm/mach-kirkwood/Makefile.boot
+++ arch/arm/mach-kirkwood/Makefile.boot
@@ -9,5 +9,5 @@
 dtb-$(CONFIG_MACH_IB62X0_DT) += kirkwood-ib62x0.dtb
 dtb-$(CONFIG_MACH_TS219_DT)	+= kirkwood-qnap-ts219.dtb
 dtb-$(CONFIG_MACH_GOFLEXNET_DT) += kirkwood-goflexnet.dtb
-dbt-$(CONFIG_MACH_LSXL_DT) += kirkwood-lschlv2.dtb
-dbt-$(CONFIG_MACH_LSXL_DT) += kirkwood-lsxhl.dtb
+dtb-$(CONFIG_MACH_LSXL_DT) += kirkwood-lschlv2.dtb
+dtb-$(CONFIG_MACH_LSXL_DT) += kirkwood-lsxhl.dtb


Remove dev.clj

Remove dev.clj

--- env/dev/clj/dato/dev.clj
+++ env/dev/clj/dato/dev.clj
@@ -1,33 +0,0 @@
-(ns dato.dev
-  (:require [environ.core :as config]
-            [cemerick.piggieback :as piggieback]
-            [weasel.repl.websocket :as weasel]
-            [figwheel-sidecar.auto-builder :as fig-auto]
-            [figwheel-sidecar.core :as fig]
-            [clojurescript-build.auto :as auto]
-            [clojure.java.shell :refer [sh]]))
-
-(def is-dev?
-  (config/env :is-dev))
-
-(defn browser-repl []
-  (let [repl-env (weasel/repl-env :ip "0.0.0.0" :port 9001)]
-    (piggieback/cljs-repl repl-env)))
-
-(defn start-figwheel! []
-  (let [server (fig/start-server { :css-dirs ["resources/public/css"] })
-        config {:builds [{:id           "dev"
-                          :source-paths ["src/cljs" "src/shared/" "yaks/datascript/src" "yaks/datascript/bench/src"]
-                          :figwheel     true
-                          :compiler     {:asset-path    "/js/bin-debug"
-                                         :main          'dato.client.core
-                                         :output-to     "resources/public/js/bin-debug/main.js"
-                                         :output-dir    "resources/public/js/bin-debug/"
-                                         :optimizations :none
-                                         :pretty-print  true
-                                         :preamble      ["react/react.js"]
-                                         :externs       ["react/externs/react.js"]
-                                         :source-map    true
-                                         :warnings      {:single-segment-namespace false}}}]
-                :figwheel-server server}]
-    (fig-auto/autobuild* config)))


tweak `cellophane.test-utils/remove-whitespace`

--- test/cellophane/test_utils.clj
+++ test/cellophane/test_utils.clj
@@ -2,6 +2,4 @@
   (:require [clojure.string :as str]))

 (defn remove-whitespace [s]
-  (->> (str/split s #">\s+<")
-    (filter #(not (str/blank? %)))
-    (str/join "><")))
+  (str/replace s #"(>)\s+(<)" "$1$2"))


configure logging for ragtime

configure logging for ragtime

--- test/clojento/magento/t_db.clj
+++ test/clojento/magento/t_db.clj
@@ -22,12 +22,18 @@

 ; ------------------------------------------------------------------------------

+(defn migration-reporter [op id]
+  (case op
+    :up   (log/debug "Applying" id)
+    :down (log/debug "Rolling back" id)))
+
 (defn prepare-test-db []
   (log/info "preparing read-only test DB")
   (io/delete-file "./data/test-db.mv.db" true)
   (io/delete-file "./data/test-db.trace.db" true)
   (ragtime.repl/migrate {:datastore  (ragtime.jdbc/sql-database test-db-rw)
-                         :migrations (ragtime.jdbc/load-resources "migrations/magento-tests")}))
+                         :migrations (ragtime.jdbc/load-resources "migrations/magento-tests")
+                         :reporter   migration-reporter}))

 (defn fresh-system [before-start db-config]
   (before-start)


more test

more test

--- test/clojento/magento/t_db.clj
+++ test/clojento/magento/t_db.clj
@@ -132,16 +132,22 @@
             (get-product-data (:db @system) 2)  =>     (contains {:variants anything})
             (get-product-data (:db @system) 3)  =not=> (contains {:variants anything})
             (get-product-data (:db @system) 2)  =>     (contains {:variants []}))
+      (future-fact "type"
+                   (get-product-data (:db @system) -1) =not=> (contains {:type anything})
+                   (get-product-data (:db @system) 1)  => (contains {:type "simple"})
+                   (get-product-data (:db @system) 2)  => (contains {:type "configurable"})
+                   (get-product-data (:db @system) 3)  => (contains {:type "simple"})
+                   (get-product-data (:db @system) 2)  => (contains {:type "configurable"}))
       (future-fact "sku"
-            (get-product-data (:db @system) -1) => (contains {:sku nil})
-            (get-product-data (:db @system) 1)  => (contains {:sku "sku-1"})
-            (get-product-data (:db @system) 2)  => (contains {:sku "sku-2"})
-            (get-product-data (:db @system) 3)  => (contains {:sku "sku-2.1"})
-            (get-product-data (:db @system) 6)  => (contains {:sku "sku-6"}))
+                   (get-product-data (:db @system) -1) =not=> (contains {:sku anything})
+                   (get-product-data (:db @system) 1)  => (contains {:sku "sku-1"})
+                   (get-product-data (:db @system) 2)  => (contains {:sku "sku-2"})
+                   (get-product-data (:db @system) 3)  => (contains {:sku "sku-2.1"})
+                   (get-product-data (:db @system) 6)  => (contains {:sku "sku-6"}))
       (fact "has meta"
             (meta (get-product-data (:db @system) -1 :debug true)) =not=> nil?)
-      (fact "meta contains total time"
-            (meta (get-product-data (:db @system) -1 :debug true)) => (contains {:total-time pos?}))
+      (fact "meta contains time and total time"
+            (meta (get-product-data (:db @system) -1 :debug true)) => (contains {:time pos? :total-time pos?}))
       (fact "meta contains all queries"
             (count (:queries (meta (get-product-data (:db @system) -1 :debug true)))) => 2))


Clean up cljs doc utils

Clean up cljs doc utils

--- frontend/utils/docs.cljs
+++ frontend/utils/docs.cljs
@@ -8,13 +8,6 @@
             [om.core :as om :include-macros true])
   (:require-macros [dommy.macros :refer [node]]))

-(defn include-article [template-name]
-  ((aget (aget js/window "HAML") template-name)))
-
-(defn render-haml-template [template-name & [args]]
-  [:div {:dangerouslySetInnerHTML
-         #js {"__html"  ((aget (aget js/window "HAML") template-name)
-                         (clj->js (merge {"include_article" include-article} args)))}}])

 (defn api-curl [endpoint]
   (let [curl-args (if-not (= (:method endpoint) "GET")
@@ -93,12 +86,6 @@
     (aset context "include_article" include-article)
     context))

-(defn ->template-kw [template-name]
-  (keyword (string/replace (name template-name) "_" "-")))
-
-(defn article? [template-fn]
-  (re-find #"this.title =" (str template-fn)))
-
 (defn article-info [doc-kw doc]
   (let [doc-name (name doc-kw)
         children (map keyword (or (:children doc) []))


Removes examples directory

Removes examples directory


clean up dual-dubstep synth example

clean up dual-dubstep synth example

--- example/dubstep.clj
+++ example/dubstep.clj
@@ -66,28 +66,6 @@

    (clip2 (+ wob kick snare) 1)))
 (ctl dubstep :bpm 250)
-;; An inst that lets you modulate the speed, wobble and note of the dubstep synth
-(defsynth dubstep [bpm 120 wobble 1 note 50 snare-vol 1 kick-vol 1 v 1]
- (let [trig (impulse:kr (/ bpm 120))
-       freq (midicps (lag (demand trig 0 (dxrand [note] INF)) 0.25))
-       swr (demand trig 0 (dseq [wobble] INF))
-       sweep (lin-exp (lf-tri swr) -1 1 40 3000)
-       wob (apply + (saw (* freq [0.99 1.01])))
-       wob (lpf wob sweep)
-       wob (* 0.8 (normalizer wob))
-       wob (+ wob (bpf wob 1500 2))
-       wob (+ wob (* 0.2 (g-verb wob 9 0.7 0.7)))
-
-       kickenv (decay (t2a (demand (impulse:kr (/ bpm 30)) 0 (dseq [1 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0] INF))) 0.7)
-       kick (* (* kickenv 7) (sin-osc (+ 40 (* kickenv kickenv kickenv 200))))
-       kick (clip2 kick 1)
-
-       snare (* 3 (pink-noise [1 1]) (apply + (* (decay (impulse (/ bpm 240) 0.5) [0.4 2]) [1 0.05])))
-       snare (+ snare (bpf (* 4 snare) 2000))
-       snare (clip2 snare 1)]
-
-   (out 0    (* v (clip2 (+ wob (* kick-vol kick) (* snare-vol snare)) 1)))))
-

 (defsynth dubstep [bpm 120 wobble 1 note 50 snare-vol 1 kick-vol 1 v 1]
  (let [trig (impulse:kr (/ bpm 120))
@@ -112,8 +90,6 @@

-
-(stop)
 (comment
   ;;Control the dubstep synth with the following:
   (dubstep)
@@ -123,79 +99,7 @@
   (stop)
   )

-(poly/led-on m 1 2)
-(poly/clear m)
-(stop)
-(at (+ (now) 1000)
-    (def b1 (dubstep))
-    (def b2 (dubstep :snare-vol 0 :kick-vol 0)))

-(ctl b1 :wobble 1 :note 78 :v 0.25)
-(ctl b2 :note 53 :wobble 4 :v 3)
-
-(defn swap-vol
-  [v]
-  (mod (inc v) 2))
-
-(stop)
-
-(defn fetch-note
-  [base idx]
-  (+ base (nth-interval :minor-pentatonic idx)))
-
-(defn low-bass
-  [x y]
-  (println "low" [x y])
-  (if (= [x y]
-         (:b1 @curr-vals))
-    (ctl b1 :v (swap! curr-vol-b1 swap-vol))
-    (do
-      (ctl b1 :wobble (inc x) :note (fetch-note 20 y))
-      (swap! curr-vals assoc :b1 [x y])))
-  (relight))
-
-(defn hi-bass
-  [x y]
-  (println "hi" [x y])
-  (if (= [x y]
-         (:b2 @curr-vals))
-    (ctl b2 :v (swap! curr-vol-b2 swap-vol))
-    (do
-      (ctl b2 :wobble (- x 3) :note (fetch-note 40 y))
-      (swap! curr-vals assoc :b2 [x y])))
-  (relight))
-
-(swap! curr-vals assoc :b1 [1 1])
-
-
-(def curr-vals (atom {:b1 [0 0]
-                      :b2 [5 0]}))
-
-(def curr-vol-b1 (atom 1))
-(def curr-vol-b2 (atom 1))
-
-
-(defn relight
-  []
-  (poly/clear m)
-  (apply poly/led-on m (:b1 @curr-vals))
-  (apply poly/led-on m (:b2 @curr-vals)))
-
-(relight)
-
-
-(poly/on-press m (fn [x y s]
-                   (if (< x 4)
-                     (apply #'low-bass [x y])
-                     (apply #'hi-bass [x y]))))
-
-(poly/on-press m (fn [x y s]
-                   (poly/toggle-led m x y)))
-
-(poly/remove-all-callbacks m)
-(dubstep)
-
-(stop)
 (comment
   ;;For connecting with a monome to control the wobble and note
   (require '(polynome [core :as poly]))
@@ -212,3 +116,64 @@
                        (ctl dubstep :wobble wobble)
                        (ctl dubstep :note note)))))
   (poly/disconnect m))
+
+(comment
+  ;;For connecting with a monome to drive two separate dubstep bass synths
+  (do
+    (require '(polynome [core :as poly]))
+    (def m (poly/init "/dev/tty.usbserial-m64-0790"))
+    (def curr-vals (atom {:b1 [0 0]
+                          :b2 [5 0]}))
+    (def curr-vol-b1 (atom 1))
+    (def curr-vol-b2 (atom 1))
+
+    (at (+ 1000 (now))
+        (def b1 (dubstep))
+        (def b2 (dubstep)))
+
+    (defn swap-vol
+      [v]
+      (mod (inc v) 2))
+
+    (defn fetch-note
+      [base idx]
+      (+ base (nth-interval :minor-pentatonic idx)))
+
+    (defn relight
+      []
+      (poly/clear m)
+      (apply poly/led-on m (:b1 @curr-vals))
+      (apply poly/led-on m (:b2 @curr-vals)))
+
+    (defn low-bass
+      [x y]
+      (println "low" [x y])
+      (if (= [x y]
+             (:b1 @curr-vals))
+        (ctl b1 :v (swap! curr-vol-b1 swap-vol))
+        (do
+          (ctl b1 :wobble (inc x) :note (fetch-note 20 y))
+          (swap! curr-vals assoc :b1 [x y])))
+      (relight))
+
+    (defn hi-bass
+      [x y]
+      (println "hi" [x y])
+      (if (= [x y]
+             (:b2 @curr-vals))
+        (ctl b2 :v (swap! curr-vol-b2 swap-vol))
+        (do
+          (ctl b2 :wobble (- x 3) :note (fetch-note 40 y))
+          (swap! curr-vals assoc :b2 [x y])))
+      (relight))
+
+    (poly/on-press m (fn [x y s]
+                       (if (< x 4)
+                         (apply #'low-bass [x y])
+                         (apply #'hi-bass [x y]))))
+
+    (poly/on-press m (fn [x y s]
+                       (poly/toggle-led m x y))))
+)
+
+;;(stop)


upgrade ring-jetty7-adapter in example

upgrade ring-jetty7-adapter in example

--- example/project.clj
+++ example/project.clj
@@ -11,6 +11,6 @@
   :dev-dependencies [[swank-clojure "1.2.1"]
 		     [ring/ring-devel "0.3.11"]
   		     [uk.org.alienscience/leiningen-war "0.0.12"]
-                     [org.signaut/ring-jetty7-adapter "0.3.11"]]
+                     [org.signaut/ring-jetty7-adapter "0.3.11.2"]]
   :war {:name "example.war"}
   :aot [example.servlet])


For WebDAV mount point from Bonjour name

This is for #42. Since we can't tell the compiler
to use a new :output-dir after setup, we need
a mount point name that doesn't change if the IP
address of the endpoint changes. Change from
using IP:port to hex of hash of the Bonjour name.

--- Clojure/src/ambly/repl/jsc.clj
+++ Clojure/src/ambly/repl/jsc.clj
@@ -218,8 +218,8 @@
     (shutdown-agents)))

 (defn- mount-webdav
-  [repl-env endpoint-address endpoint-port]
-  (let [webdav-mount-point (str "/Volumes/Ambly-" endpoint-address ":" endpoint-port)
+  [repl-env bonjour-name endpoint-address endpoint-port]
+  (let [webdav-mount-point (str "/Volumes/Ambly-" (format "%X" (hash bonjour-name)))
         output-dir (io/file webdav-mount-point)]
     (when (.exists output-dir)
       (shell/sh "umount" webdav-mount-point))
@@ -242,7 +242,7 @@
           [bonjour-name endpoint] (discover-and-choose-device (:choose-first-discovered (:options repl-env)) opts)
           endpoint-address (.getHostAddress (:address endpoint))
           endpoint-port (:port endpoint)
-          webdav-mount-point (mount-webdav repl-env endpoint-address endpoint-port)
+          webdav-mount-point (mount-webdav repl-env bonjour-name endpoint-address endpoint-port)
           output-dir (io/file webdav-mount-point)
           env (ana/empty-env)
           core (io/resource "cljs/core.cljs")]


removing chazel dep form hface client jar

--- client/project.clj
+++ client/project.clj
@@ -1,4 +1,4 @@
-(defproject org.hface/hface-client "0.1.0"
+(defproject org.hface/hface-client "0.1.1"
   :description "look your Hazelcast cluster in the face!"
   :url "https://github.com/tolitius/hface"
   :license {:name "Eclipse Public License"
@@ -6,7 +6,7 @@

   :java-source-paths ["src/java"]

-  :dependencies [[chazel "0.1.0"]]
+  :dependencies [[com.hazelcast/hazelcast "3.4.2"]]

   ;; ceremony for maven central


[#1450] Use write-edn-files in dev

[#1450] Use write-edn-files in dev

--- backend/dev/src/dev.clj
+++ backend/dev/src/dev.clj
@@ -29,6 +29,8 @@
   (:import [org.postgresql.util PSQLException PGobject]
            [java.time Instant]))

+(def dev-flow-datasets-dir "flow-datasets")
+
 (defn check-specs! []
   (log/warn "instrumenting specs!")
   (stest/instrument))
@@ -43,6 +45,13 @@
   (check-specs!))

 (defn go []
+  (alter-var-root #'flow/adapter (fn [f]
+                                   (fn [{:keys [version rows-cols instance survey-id form-id]} data]
+                                     (doall (map (fn [d]
+                                                   (let [file-name (format "./dev/resources/%s/%s-%s-%s.edn" dev-flow-datasets-dir (format "%s-%s-%s" instance survey-id form-id) (name rows-cols) version)]
+                                                     (spit file-name data :append true)
+                                                     d)) data))
+                                     (f nil data))))
   (commons/config)
   (ir/go))

@@ -118,7 +127,7 @@
 (defn read-edn-filename
   "file should live in resources"
   [filename]
-  (let [x (->> filename
+  (let [x (->> (format "%s/%s" dev-flow-datasets-dir filename)
                (clojure.java.io/resource)
                (clojure.java.io/file)
                (slurp))]
@@ -137,15 +146,11 @@

 (comment
   (read-edn-filename "uat1-638889127-638879132-cols-3.edn")
-  (with-redefs [flow/adapter (fn [file version rows-cols col*]
-                               (map (fn [data](let [file-name (format "./dev/resources/%s-%s-%s.edn" file (name rows-cols) version)]
-                                                (spit file-name data :append true)
-                                                data)) col*))]
-    (def dataset-id (tu/import-file (db-conn)
-                                    (:akvo.lumen.utils.local-error-tracker/local system)
-                                    {:dataset-name "dataset-name"
-                                     :kind "clj-flow"
-                                     :data (read-edn-flow-dataset "uat1" "638889127" "638879132")})))
+  (def dataset-id (tu/import-file (db-conn)
+                                  (:akvo.lumen.utils.local-error-tracker/local system)
+                                  {:dataset-name "dataset-name"
+                                   :kind "clj-flow"
+                                   :data (read-edn-flow-dataset "uat1" "638889127" "638879132")}))

   (def dataset-id-updated (tu/update-file (db-conn)
                                           (:akvo.lumen.component.caddisfly/local system)


Upgrading to latest bidi

Upgrading to latest bidi

--- modules/bidi/project.clj
+++ modules/bidi/project.clj
@@ -1,12 +1,12 @@
 ;; Copyright © 2014 JUXT LTD.

-(defproject juxt.modular/bidi "0.7.4"
+(defproject juxt.modular/bidi "0.7.5"
   :description "A modular extension that provides support for bidi routing"
   :url "https://github.com/juxt/modular/tree/master/modules/bidi"
   :license {:name "The MIT License"
             :url "http://opensource.org/licenses/MIT"}
   :dependencies [[com.stuartsierra/component "0.2.1"]
-                 [bidi "1.17.0"]
+                 [bidi "1.17.1"]
                  [juxt.modular/ring "0.5.2"]
                  [prismatic/schema "0.3.3"]
                  [prismatic/plumbing "0.3.5"]]


Added range to parser errors

Added range to parser errors

--- parser/parser.clj
+++ parser/parser.clj
@@ -4,17 +4,13 @@
         (Symbol name _)  name
         _                Empty))

-(def transform (value f)
-    (f value))
-
 (typ type          (SimpleType          (list int32) range)
                    (ComplexType         (list int32) (list type) range))
 (typ definition    (TypeDefinition      type sexp range)
                    (OptOut              sexp))

-(typ error         MalformedDefinitionError
-                   MalformedTypeError)
-
+(typ error         (MalformedDefinitionError range)
+                   (MalformedTypeError range))

 (def type-definition? (type)
@@ -27,7 +23,7 @@
                             (ComplexType name sub-types range))
                         (result-of-list (list-map sexp-to-type parameters)))
         (Symbol name range)                             (Result (SimpleType name range))
-        _                                               (Error MalformedTypeError)))
+        (List _ range)                                  (Error (MalformedTypeError range))))

 (def sexp-to-definition' (kind name rest range)
     (match (type-definition? (symbol-name kind))
@@ -39,7 +35,8 @@
 (def sexp-to-definition (expression)
      (match expression
         (List (Cons kind (Cons name rest)) range)  (sexp-to-definition' kind name rest range)
-        _                                          (Error MalformedDefinitionError)))
+        (List _ range)                             (Error (MalformedDefinitionError range))
+        (Symbol _ range)                           (Error (MalformedDefinitionError range))))

 (def sexps-to-definitions (expressions)
     (list-map sexp-to-definition expressions))


Separate mirrors for central vs clojars.

--- opt/profiles.clj
+++ opt/profiles.clj
@@ -1,5 +1,8 @@
-{:user {:mirrors {"clojars" "http://s3pository.herokuapp.com/clojure"}
+{:user {:mirrors {"central" "http://s3pository.herokuapp.com/maven-central"
+                  "clojars" "http://s3pository.herokuapp.com/clojars"}
         :aliases {"repl" "standalone-repl"}
         :plugins [[lein-standalone-repl "0.1.3"]]}
- :production {:mirrors {"clojars" "http://s3pository.herokuapp.com/clojure"}}
- :heroku {:mirrors {"clojars" "http://s3pository.herokuapp.com/clojure"}}}+ :production {:mirrors {"central" "http://s3pository.herokuapp.com/maven-central"
+                        "clojars" "http://s3pository.herokuapp.com/clojars"}}
+ :heroku {:mirrors {"central" "http://s3pository.herokuapp.com/maven-central"
+                    "clojars" "http://s3pository.herokuapp.com/clojars"}}}


I don't know how to pass these in yet, but this looks like a thing.

--- src-cljs/dev/dev.cljs
+++ src-cljs/dev/dev.cljs
@@ -1,2 +1,7 @@
-(ns githubcomments.dev)
+(ns githubcomments.dev
+  (:require [clojure.browser.repl :as repl]))
+
 (enable-console-print!)
+
+(goog-define repl-uri false)
+(if repl-uri (defonce conn (repl/connect repl-uri)))


Add damage prevention and boosting routines.

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -67,6 +67,10 @@
      (when-let [leave-effect (:leave-play (card-def card))]
        (when (or (= (:side card) "Runner") (:rezzed card))
          (leave-effect state side card nil)))
+     (when-let [prevent (:prevent (card-def card))]
+               (doseq [dtype prevent]
+                      (swap! state update-in [:damage :prevent dtype]
+                             (fn [pv] (remove #(= (:cid %) (:cid card)) pv)))))
      (unregister-events state side card)
      (when-let [mu (:memoryunits card)]
        (gain state :runner :memory mu))
@@ -360,34 +364,59 @@
       (register-events state side
                        {(if (= side :corp) :corp-turn-begins :runner-turn-begins)
                         {:effect (effect (set-prop card :counter recurring))}} c))
+    (when-let [prevent (:prevent cdef)]
+       (doseq [dtype prevent]
+              (swap! state update-in [:damage :prevent dtype] #(conj % card))))
     (update! state side c)
     (resolve-ability state side cdef c nil)
     (when-let [events (:events cdef)] (register-events state side events c))
     (get-card state c)))

 (defn damage-count [state side dtype n]
-  (max 0 (if-let [bonus (get-in @state [:special :damage-bonus dtype])]
-                 (+ n bonus) n)))
+  (-> n
+      (+ (or (get-in @state [:damage :damage-bonus dtype]) 0))
+      (- (or (get-in @state [:damage :damage-prevent dtype]) 0))
+      (max 0)))

 (defn damage-bonus [state side dtype n]
-      ;(system-msg state side (str (+ n (get-in state [:special :damage-bonus dtype]))))
-  (swap! state update-in [:special :damage-bonus dtype] (fnil #(+ % n) 0)))
+  (swap! state update-in [:damage :damage-bonus dtype] (fnil #(+ % n) 0)))
+
+(defn damage-prevent [state side dtype n]
+  (swap! state update-in [:damage :damage-prevent dtype] (fnil #(+ % n) 0)))
+
 (defn flatline [state]
   (system-msg state :runner "is flatlined"))

-(defn damage [state side type n]
-  (trigger-event state side :pre-damage type)
-  (let [n (damage-count state side type n) hand (get-in @state [:runner :hand])]
-       (system-msg state side (str n " " type))
-    (when (< (count hand) n)
-      (flatline state))
-    (when (= type :brain)
-      (swap! state update-in [:runner :brain-damage] #(+ % n))
-      (swap! state update-in [:runner :max-hand-size] #(- % n)))
-    (doseq [c (take n (shuffle hand))]
-      (trash state side c type))
-    (trigger-event state side :damage type))
-  (swap! state update-in [:special :damage-bonus] dissoc type))
+(defn resolve-damage [state side type n]
+  (let [hand (get-in @state [:runner :hand])]
+       (when (< (count hand) n)
+             (flatline state))
+       (when (= type :brain)
+             (swap! state update-in [:runner :brain-damage] #(+ % n))
+             (swap! state update-in [:runner :max-hand-size] #(- % n)))
+       (doseq [c (take n (shuffle hand))]
+              (trash state side c type))
+       (trigger-event state side :damage type)))
+
+(defn damage
+  ([state side type n] (damage state side type n false))
+  ([state side type n unpreventable]
+    (swap! state update-in [:damage :damage-bonus] dissoc type)
+    (swap! state update-in [:damage :damage-prevent] dissoc type)
+    (trigger-event state side :pre-damage type)
+    (let [n (damage-count state side type n)]
+         (let [prevent (get-in @state [:damage :prevent type])]
+              (if (and (not unpreventable) prevent (> (count prevent) 0))
+                (do (system-msg state :runner "has the option to prevent damage")
+                    (show-prompt
+                      state :runner nil (str "Prevent any of the " n " " (name type) " damage?") ["Done"]
+                      (fn [choice]
+                          (let [prevent (get-in @state [:damage :damage-prevent type])]
+                               (system-msg state :runner
+                                           (if prevent (str "prevents " prevent " " (name type) " damage")
+                                                       "will not prevent damage"))
+                               (resolve-damage state side type (max 0 (- n (or prevent 0))))))))
+                (resolve-damage state side type n))))))

 (defn shuffle! [state side kw]
   (swap! state update-in [side kw] shuffle))
@@ -725,7 +754,7 @@

 (defn runner-install
   ([state side card] (runner-install state side card nil))
-  ([state side {:keys [title type cost memoryunits uniqueness] :as card} {:keys [extra-cost no-cost]}]
+  ([state side {:keys [title type cost memoryunits uniqueness prevent] :as card} {:keys [extra-cost no-cost]}]
      (let [dest [:rig (to-keyword type)]
            cost (if no-cost 0 cost)]
        (when (and (or (not uniqueness) (not (in-play? state card)))