Update project template deps

Update project template deps

--- project-template/project.clj
+++ project-template/project.clj
@@ -1,7 +1,7 @@
 (defproject sketch "0.1.0-SNAPSHOT"
   :description "A template for a sketch with Quil/Processing"
-  :dependencies [[org.clojure/clojure "1.10.0"]
-                 [genartlib/genartlib "0.1.19"] ; utility functions
+  :dependencies [[org.clojure/clojure "1.10.1"]
+                 [genartlib/genartlib "0.1.20"] ; utility functions
                  [com.seisw/gpcj "2.2.0"]] ; polygon clipping
   :jvm-opts ["-Xms4000m" "-Xmx4000M" "-server"] ; 4GB heap size
   :source-paths ["src/clj"]


clojure handler response

clojure handler response

--- src/cserver/chandler.clj
+++ src/cserver/chandler.clj
@@ -1,6 +1,16 @@
 (ns cserver.chandler
-  (:import (io.netty.channel SimpleChannelInboundHandler ChannelHandlerContext)))
+  (:import (io.netty.channel SimpleChannelInboundHandler ChannelHandlerContext ChannelFutureListener)
+           (io.netty.handler.codec.http HttpRequest LastHttpContent)
+           (io.netty.buffer Unpooled)))

+(defn do-request [ctx msg]
+  (.write ctx msg))
+
+(defn do-content [ctx msg]
+  (if (instance? LastHttpContent msg)
+    (.addListener (.writeAndFlush ctx Unpooled/EMPTY_BUFFER) ChannelFutureListener/CLOSE))
+  (println "Content = " msg)
+  (println "---------------------------------------"))

 (defn handler
   "创建SimpleChannelInboundHandler子类，处理请求"
@@ -20,5 +30,5 @@
       (.printStackTrace cause)
       (.close ctx))
     (channelRead0 [^ChannelHandlerContext ctx msg]
-      (println "msg = " msg))
+      (if (instance? HttpRequest msg) (do-request ctx msg) (do-content ctx msg)))
     ))


Optimize atom reference

Optimize atom reference

--- src/discuss/communication/main.cljs
+++ src/discuss/communication/main.cljs
@@ -104,18 +104,19 @@
    (post-json url body process-url-handler {"Content-Type" "application/json"})))

 (defn post-statement [statement reference add-type]
-  (let [url (get-in config/api [:add add-type])
+  (let [app @lib/app-state
+        url (get-in config/api [:add add-type])
         headers (merge {"Content-Type" "application/json"} (token-header))
         body {:statement     (htmlEscape statement)
               :reference     (htmlEscape reference)
               :conclusion_id (get-conclusion-id)            ; Relevant for add-start-premise
-              :supportive    (get-in @lib/app-state [:discussion :is_supportive])
-              :arg_uid       (get-in @lib/app-state [:discussion :arg_uid]) ; For premisses for arguments
-              :attack_type   (get-in @lib/app-state [:discussion :attack_type])
+              :supportive    (get-in app [:discussion :is_supportive])
+              :arg_uid       (get-in app [:discussion :arg_uid]) ; For premisses for arguments
+              :attack_type   (get-in app [:discussion :attack_type])
               :host          js/location.host
               :path          js/location.pathname
-              :issue_id      (get-in @lib/app-state [:issues :uid])
-              :slug          (get-in @lib/app-state [:issues :slug])}]
+              :issue_id      (get-in app [:issues :uid])
+              :slug          (get-in app [:issues :slug])}]
     (post-json url body process-url-handler headers)))


Remove unused import

Remove unused import

--- src/detritus/logging.clj
+++ src/detritus/logging.clj
@@ -4,8 +4,7 @@

   Note that the API here is likely very volatile and subject to
   change due to being bare bones to the point of trivial."
-  (:require [detritus.text :as text])
-  (:require [detritus.pred :refer [maybe-fix]]))
+  (:require [detritus.text :as text]))

 ;; Logging levels


refactored convert-prices

refactored convert-prices

--- src-cljs/complico/prices.cljs
+++ src-cljs/complico/prices.cljs
@@ -33,12 +33,15 @@
   (let [conv-func (select-conv-func price conv-funcs)]
     (apply conv-func currency price nil)))

+(defn- build-replacement [price-parts]
+  (let [original-price (first price-parts)
+        currency (second price-parts)
+        price (nth price-parts 2)
+        replacement-price (convert-price currency price select-conv-func funcs/conversion-functions)]
+  (vector original-price replacement-price)))
+
 (defn- convert-prices [prices]
-  (map
-    #(vector
-      (first %)
-      (convert-price (second %) (nth % 2) select-conv-func funcs/conversion-functions))
-    prices))
+  (map build-replacement prices))

 (defn find-elems [root-elem]
   (sel root-elem price-elem-selector))


use scheduled-executor as name for our ScheduledThreadPoolExecutor instance

and mark it private

--- src/fscrawler_tika_convert/core.clj
+++ src/fscrawler_tika_convert/core.clj
@@ -19,19 +19,20 @@
   (:gen-class))

-(def es (ScheduledThreadPoolExecutor. 4))
+(def ^:private scheduled-executor (ScheduledThreadPoolExecutor. 4))

 (defn periodically
   "periodically run function f with a fixed delay of n milliseconds"

   [n f]
-  (.scheduleWithFixedDelay es ^Runnable f 0 n TimeUnit/MILLISECONDS))
+  (.scheduleWithFixedDelay scheduled-executor ^Runnable f 0 n TimeUnit/MILLISECONDS))

 (def future-map (atom {}))

 (defn register-future
+
   [a-future nackfn]
   (swap! future-map assoc a-future nackfn))


program should set gl program

program should set gl program

--- src/gamma_driver/impl/resource.cljs
+++ src/gamma_driver/impl/resource.cljs
@@ -21,20 +21,24 @@

 (defn program [gl spec]
-  (let [v (shader gl (assoc (:vertex-shader spec) :tag :vertex-shader))
-        f (shader gl (assoc (:fragment-shader spec) :tag :fragment-shader))
-        p (.createProgram gl)]
-    (.attachShader gl p (:vertex-shader v))
-    (.attachShader gl p (:fragment-shader f))
-    (.linkProgram gl p)
-    (if (.getProgramParameter gl p ggl/LINK_STATUS)
-      (assoc spec :program p
-                  :vertex-shader v
-                  :fragment-shader f)
-      (throw
-        (js/Error.
-          (str "failed to link program: "
-               (.getProgramInfoLog gl p)))))))
+  (if (:program spec)
+    (.useProgram gl (:program spec))
+    (let [v (shader gl (assoc (:vertex-shader spec) :tag :vertex-shader))
+         f (shader gl (assoc (:fragment-shader spec) :tag :fragment-shader))
+         p (.createProgram gl)]
+     (.attachShader gl p (:vertex-shader v))
+     (.attachShader gl p (:fragment-shader f))
+     (.linkProgram gl p)
+     (if (.getProgramParameter gl p ggl/LINK_STATUS)
+       (do
+         (.useProgram gl p)
+         (assoc spec :program p
+                    :vertex-shader v
+                    :fragment-shader f))
+       (throw
+         (js/Error.
+           (str "failed to link program: "
+                (.getProgramInfoLog gl p))))))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Add some foaf properties to the foaf namespace for our example.

--- src/grafter/rdf/ontologies/foaf.clj
+++ src/grafter/rdf/ontologies/foaf.clj
@@ -2,5 +2,12 @@
   (:use [grafter.rdf.ontologies.util]))

 (def foaf (prefixer "http://xmlns.com/foaf/0.1/"))
-
+(def foaf:Person (foaf "Person"))
+(def foaf:age (foaf "age"))
 (def foaf:depiction (foaf "depiction"))
+(def foaf:gender (foaf "gender"))
+(def foaf:homepage (foaf "homepage"))
+(def foaf:interest (foaf "interest"))
+(def foaf:knows (foaf "knows"))
+(def foaf:name (foaf "name"))
+(def foaf:nick (foaf "nick"))


Reverse condition for readability.

Reverse condition for readability.

--- src/kolmogorov_music/kolmogorov.clj
+++ src/kolmogorov_music/kolmogorov.clj
@@ -30,7 +30,7 @@

 (defmacro random? [expr]
-  `(<= 1 (randomness ~expr)))
+  `(>= (randomness ~expr) 1))

 (fact "A value is random if its description isn't shorter than its value."
   (random? (repeat 65 \A)) => false


Implemented the features setting properties to map or list.

--- src/main/clj/sa_compojure/beans.clj
+++ src/main/clj/sa_compojure/beans.clj
@@ -29,7 +29,6 @@
       (getDynaProperties [this]
         (into-array DynaProperty (vals prop-map)))
       (getDynaProperty [this name]
-        (println "getDynaProperty:" name ":" prop-map)
         (get prop-map name))
       (getName [this]
         (.getName bean-class))
@@ -73,7 +72,16 @@
     (^void set [this ^String name ^String key value]
       (throw (UnsupportedOperationException. "set")))))

-(defn set-map-property [bean k v])
+(defn string-array? [v]
+  (and (not (nil? v))
+       (.isArray (class v))
+       (= (.getComponentType (class v)) String)))
+
+(defn set-map-property [m k v]
+  (if (string-array? v)
+    (.put m k (if (> (.-length v) 0) (aget v 0) nil))
+    (.put m k v)))
+
 (defn set-simple-property [bean k v]
   (if (instance? Map bean)
     (set-map-property bean k v)
@@ -95,7 +103,8 @@
               (nil? v)
               (.setValue prop-desc bean nil)

-              ;; TODO String[]
+              (string-array? v)
+              (.setValue prop-desc bean (if (> (.-length v) 0) (aget v 0) nil))

               :else
               (.setValue prop-desc bean v))))))))


lift macroexpand-1 body out of try/catch, drop binding *ns* for now, use symbol-identical?, = -> identical? for char checks

--- src/main/clojure/cljs/analyzer.cljc
+++ src/main/clojure/cljs/analyzer.cljc
@@ -1999,38 +1999,46 @@
                :cljs ^boolean (.isMacro mvar)))
       mvar)))

+(defn macroexpand-1*
+  [env form]
+  (let [op (first form)]
+    (if-not (nil? (get specials op))
+      form
+      (let [mac-var (when (symbol? op) (get-expander op env))]
+        (if-not (nil? mac-var)
+          (#?@(:clj [binding [*ns* (create-ns *cljs-ns*)]]
+               :cljs [do])
+            (let [form' (apply @mac-var form env (rest form))]
+              (if (seq? form')
+                (let [sym' (first form')
+                      sym  (first form)]
+                  (if #?(:clj (= sym' 'js*) :cljs (symbol-identical? sym' 'js*))
+                    (vary-meta form' merge
+                      (cond-> {:js-op (if (namespace sym) sym (symbol "cljs.core" (str sym)))}
+                        (-> mac-var meta ::numeric) (assoc :numeric true)))
+                    form'))
+                form')))
+          (if (symbol? op)
+            (let [opname (str op)]
+              (cond
+                (identical? (first opname) \.)
+                (let [[target & args] (next form)]
+                  (with-meta (list* '. target (symbol (subs opname 1)) args)
+                    (meta form)))
+
+                (identical? (last opname) \.)
+                (with-meta
+                  (list* 'new (symbol (subs opname 0 (dec (count opname)))) (next form))
+                  (meta form))
+
+                :else form))
+            form))))))
+
 (defn macroexpand-1
   "Given a env, an analysis environment, and form, a ClojureScript form,
    macroexpand the form once."
   [env form]
-  (ensure
-    (wrapping-errors env
-      (let [op (first form)]
-        (if (specials op)
-          form
-          (if-let [mac-var (and (symbol? op) (get-expander op env))]
-            (binding [*ns* (create-ns *cljs-ns*)]
-              (let [form' (apply @mac-var form env (rest form))]
-                (if (seq? form')
-                  (let [sym' (first form')
-                        sym  (first form)]
-                    (if (= sym' 'js*)
-                      (vary-meta form' merge
-                                 (cond-> {:js-op (if (namespace sym) sym (symbol "cljs.core" (str sym)))}
-                                         (-> mac-var meta ::numeric) (assoc :numeric true)))
-                      form'))
-                  form')))
-            (if (symbol? op)
-              (let [opname (str op)]
-                (cond
-                 (= (first opname) \.) (let [[target & args] (next form)]
-                                         (with-meta (list* '. target (symbol (subs opname 1)) args)
-                                           (meta form)))
-                 (= (last opname) \.) (with-meta
-                                        (list* 'new (symbol (subs opname 0 (dec (count opname)))) (next form))
-                                        (meta form))
-                 :else form))
-              form)))))))
+  (ensure (wrapping-errors env (macroexpand-1* env form))))

 (declare analyze-list)


Remove non-existent dep.

Remove non-existent dep.

--- integration-tests/apps/ring/basic-ring/project.clj
+++ integration-tests/apps/ring/basic-ring/project.clj
@@ -1,7 +1,6 @@
 (defproject
   basic-ring "1.0.0-SNAPSHOT"
   :description "FIXME: write description"
-  :dependencies [[org.clojure/clojure "1.3.0"]
-                 [i-should-fail "1.0.0"]]
+  :dependencies [[org.clojure/clojure "1.3.0"]]
   :java-source-path "src/java/"
   :immutant {:ham :biscuit})


Added timeit

Added timeit

--- src/net/slreynolds/ds/speedtest.clj
+++ src/net/slreynolds/ds/speedtest.clj
@@ -30,5 +30,21 @@
                 otherComp (+ computation (. res getIntParam))]
             (Math/max 0 (- after before)))))

-
-
+
+; Do dowork N times and record the time taken.
+; Return list of times
+(defn timeit[setup dowork N]
+  (loop [ctr (- N 1)
+         times (vector)
+         computation 7]
+    (let [o (setup)
+          before (System/nanotime)
+          res (dowork o)
+          after (System/nanotime)
+          (conj times (- after before))]
+      (if (zero? ctr)
+        times
+        (recur ((dec ctr) times (+ computation (. res getIntParam))))))))
+
+
+


Translate action results

Translate action results

--- src/obb_api/core/turn_processor.clj
+++ src/obb_api/core/turn_processor.clj
@@ -30,6 +30,13 @@
         simplified (simplify/clean-result translated-result)]
     (simplified :board)))

+(defn- translate-results
+  "Translates the results fo the view of the player"
+  [viewer action-results]
+  (map (fn translate-results [[action info]]
+         [(translator/action viewer action) info])
+       action-results))
+
 (defn save-game
   "Saves a game after turn processing"
   [request game result username save?]
@@ -45,7 +52,7 @@
         (assoc :saved save?)
         (dissoc :viewed-by)
         (assoc :board (translate-board player-code result))
-        (assoc-in [:board :action-results] action-results)
+        (assoc-in [:board :action-results] (translate-results player-code action-results))
         (assoc :success (sresult :success)))))

 (defn turn-error-response


:bug: Fixes copy/paste with groups

:bug: Fixes copy/paste with groups

--- frontend/src/uxbox/main/data/workspace.cljs
+++ frontend/src/uxbox/main/data/workspace.cljs
@@ -2193,28 +2193,52 @@
                   frame-id (if frame-id
                              frame-id
                              (calculate-frame-overlap objects moved-obj))
-                  reframed-obj (assoc moved-obj :frame-id frame-id)]
-              {:type :add-obj
-               :id id
-               :frame-id frame-id
-               :obj reframed-obj}))
+
+                  prepare-child
+                  (fn [child-id]
+                    (prepare-shape-change objects (get objects child-id) delta frame-id))
+
+                  children-changes (mapcat prepare-child (:shapes obj))
+                  is-child? (set (:shapes obj))
+                  children-uuids (->> children-changes
+                                      (filter #(and (= :add-obj (:type %)) (is-child? (:old-id %))))
+                                      (map #(:id %)))
+
+                  move-change (when (not (empty? (:shapes obj)))
+                                [{:type :mov-objects
+                                  :parent-id id
+                                  :shapes (vec children-uuids)}])
+
+                  reframed-obj (-> moved-obj
+                                   (assoc  :frame-id frame-id)
+                                   (dissoc :shapes))]
+              (into [{:type :add-obj
+                      :id id
+                      :old-id (:id obj)
+                      :frame-id frame-id
+                      :obj (dissoc reframed-obj :shapes)}]
+                    (concat children-changes move-change))))

           (prepare-frame-change [objects obj delta]
             (let [frame-id (uuid/next)
                   frame-name (impl-generate-unique-name objects (:name obj))
                   sch (->> (map #(get objects %) (:shapes obj))
-                           (map #(prepare-shape-change objects % delta frame-id)))
+                           (mapcat #(prepare-shape-change objects % delta frame-id)))
+                  is-child? (set (:shapes obj))
+                  children-uuids (->> sch
+                                      (filter #(and (= :add-obj (:type %)) (is-child? (:old-id %))))
+                                      (map #(:id %)))
                   renamed-frame (-> obj
                                     (assoc :id frame-id)
                                     (assoc :name frame-name)
                                     (assoc :frame-id uuid/zero)
-                                    (assoc :shapes (mapv :id sch)))
+                                    (assoc :shapes (vec children-uuids)))
                   moved-frame (geom/move renamed-frame delta)
                   fch {:type :add-obj
                        :id frame-id
                        :frame-id uuid/zero
                        :obj moved-frame}]
-              (d/concat [fch] sch)))]
+              (into [fch] sch)))]

   (ptk/reify ::paste-impl
     ptk/WatchEvent
@@ -2229,11 +2253,11 @@
             uchanges (map (fn [ch]
                             {:type :del-obj
                              :id (:id ch)})
-                          rchanges)]
+                          (filter #(= :add-obj (:type %)) rchanges))]
         (rx/of (commit-changes (vec rchanges)
                                (vec (reverse uchanges))
                                {:commit-local? true})
-               (select-pasted-objs rchanges)))))))
+               (select-pasted-objs selected rchanges)))))))

 (def paste
   (ptk/reify ::paste
@@ -2250,12 +2274,15 @@
                        (rx/empty)))))))

 (defn select-pasted-objs
-  [rchanges]
+  [selected rchanges]
   (ptk/reify ::select-pasted-objs
     ptk/UpdateEvent
     (update [_ state]
-      (assoc-in state [:workspace-local :selected]
-                (into #{} (map #(get-in % [:obj :id])) rchanges)))))
+      (let [new-selected (->> rchanges
+                 (filter #(selected (:old-id %)))
+                 (map #(get-in % [:obj :id]))
+                 (into #{}))]
+        (assoc-in state [:workspace-local :selected] new-selected)))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Page Changes Reactions


Bump lein-template version

Bump lein-template version

--- re-view-template/project.clj
+++ re-view-template/project.clj
@@ -1,4 +1,4 @@
-(defproject re-view/lein-template "0.1.4"
+(defproject re-view/lein-template "0.1.5"
   :description "Template for creating re-view apps."
   :url "https://www.github.com/re-view/re-view"
   :license {:name "Eclipse Public License"


Better workespace state re/initialization.

--- frontend/src/uxbox/main/data/workspace.cljs
+++ frontend/src/uxbox/main/data/workspace.cljs
@@ -50,23 +50,25 @@
 (defrecord InitializeWorkspace [project page]
   ptk/UpdateEvent
   (update [_ state]
-    (if (:workspace state)
-      (update state :workspace merge
-              {:project project
-               :page page
-               :selected #{}
-               :drawing nil
-               :drawing-tool nil
-               :tooltip nil})
-      (assoc state :workspace
-             {:project project
-              :zoom 1
-              :page page
-              :flags #{:sitemap :drawtools :layers :element-options :rules}
-              :selected #{}
-              :drawing nil
-              :drawing-tool nil
-              :tooltip nil})))
+    (let [default-flags #{:sitemap :drawtools :layers :element-options :rules :ruler}]
+      (if (:workspace state)
+        (update state :workspace merge
+                {:project project
+                 :page page
+                 :selected #{}
+                 :flags default-flags
+                 :drawing nil
+                 :drawing-tool nil
+                 :tooltip nil})
+        (assoc state :workspace
+               {:project project
+                :zoom 1
+                :page page
+                :flags default-flags
+                :selected #{}
+                :drawing nil
+                :drawing-tool nil
+                :tooltip nil}))))

   ptk/WatchEvent
   (watch [_ state s]


Increase timeout for end-to-end test

Increase timeout for end-to-end test

--- test/yorck_ratings/core_test.clj
+++ test/yorck_ratings/core_test.clj
@@ -14,5 +14,5 @@
                                       fixtures/carol-rated-movie]
                             actual (atom [])]
                         (rated-movies (fn [movies] (swap! actual concat movies)))
-                        (Thread/sleep 200)
+                        (Thread/sleep 500)
                         @actual => expected)))


Updated add_provider_meta migration

Updated add_provider_meta migration

--- migrations/20140927130732232-add_provider_meta.clj
+++ migrations/20140927130732232-add_provider_meta.clj
@@ -1,7 +1,7 @@
 ;; migrations/20140927130732232-add_provider_meta.clj

 (defn up []
-  ["create extension hstore", "alter table identities add column provider_meta text"])
+  ["alter table identities add column provider_meta text"])

 (defn down []
   ["alter table identities drop column provider_meta"])


Added ServletInputStream proxy to test request body

--- ring-servlet/test/ring/util/servlet_test.clj
+++ ring-servlet/test/ring/util/servlet_test.clj
@@ -39,7 +39,8 @@

 (deftest servlet-test
   (testing "request"
-    (let [req  {:server-port    8080
+    (let [body (proxy [javax.servlet.ServletInputStream] [])
+          req  {:server-port    8080
                 :server-name    "foobar"
                 :remote-addr    "127.0.0.1"
                 :uri            "/foo"
@@ -50,7 +51,7 @@
                 :content-type   "text/plain"
                 :content-length 10
                 :character-encoding "UTF-8"
-                :body           nil}
+                :body           body}
           resp (atom {})
           svlt (servlet (fn [r]
                           (are [k v] (= (r k) v)
@@ -65,7 +66,7 @@
                             :content-type   "text/plain"
                             :content-length 10
                             :character-encoding "UTF-8"
-                            :body           nil)
+                            :body           body)
                           {:status 200, :headers {}}))]
       (doto svlt
         (.init (servlet-config))


removing type comment

removing type comment

--- src/celestial/api/systems.clj
+++ src/celestial/api/systems.clj
@@ -62,7 +62,7 @@
 (defc [:env] (keyword v))

 (defn systems-range
-  "Get systems in range by type"
+  "Get systems in range"
   [from to]
   {:pre [(> from -1)]}
   (let [{:keys [username]} (friend/current-authentication)


s/-/_/ on action log start time

s/-/_/ on action log start time

--- src/circle/backend/action.clj
+++ src/circle/backend/action.clj
@@ -88,7 +88,7 @@

 (defn add-start-time
   []
-  (record assoc :start-time (time/ju-now)))
+  (record assoc :start_time (time/ju-now)))

 (defn add-end-time
   []


fix test reporting

fix test reporting

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

--- src/clj/clojure/spec/test.clj
+++ src/clj/clojure/spec/test.clj
@@ -29,7 +29,8 @@
               (assoc ret :result explain)
               ret)]
     (if-let [shrunk-explain (-> ret :shrunk :result ex-data ::check-call)]
-      (assoc-in ret [:shrunk :result] shrunk-explain))))
+      (assoc-in ret [:shrunk :result] shrunk-explain)
+      ret)))

 (defn- check-call
   "Returns true if call passes specs, otherwise *returns* an exception


slimmed down fires by trimming macro.

slimmed down fires by trimming macro.

--- src/clj/forma/source/fire.clj
+++ src/clj/forma/source/fire.clj
@@ -14,29 +14,31 @@
   (let [[month day year] (split datestring #"/")]
     (format "%s-%s-%s" year month day)))

+;; ### Fire Predicates
+;;
+;; TODO: Figure out a way to dynamically generate these that doesn't
+;;involve anonymous functions
 (defmacro defpredsummer
-  [name pred]
+  [name vals pred]
   `(defaggregateop ~name
      ([] 0)
-     ([count# val#] (if (~pred val#)
+     ([count# ~@vals] (if (~pred ~@vals)
                       (inc count#)
                       count#))
      ([count#] [count#])))

 (defpredsummer fires-above-330
+  [val]
   (fn [v] (> v 330)))

 (defpredsummer conf-above-50
+  [val]
   (fn [v] (> v 50)))

-(defaggregateop both-preds
-  ([] 0)
-  ([count conf temp]
-     (if (and (> temp 330)
-              (> conf 50))
-       (inc count)
-       count))
-  ([count] [count]))
+(defpredsummer both-preds
+  [conf temp]
+  (fn [c t] (and (> t 330)
+                (> c 50))))

 (def fire-characteristics
   (<- [?conf ?kelvin :> ?temp-330 ?conf-50 ?both-preds ?max-t]


implement Political assets

implement Political assets

--- src/clj/game/cards-assets.clj
+++ src/clj/game/cards-assets.clj
@@ -90,6 +90,16 @@
                                 :effect (effect (gain :credit 1)
                                                 (lose :runner :credit 1))}}}

+   "Bio-Ethics Association"
+   (let [ability {:req (req (no-ice? state (second (:zone card))))
+                  :label "Do 1 net damage (start of turn)"
+                  :once :per-turn
+                  :msg "do 1 net damage"
+                  :effect (effect (damage :net 1 {:card card}))}]
+     {:derezzed-events {:runner-turn-ends corp-rez-toast}
+      :events {:corp-turn-begins ability}
+      :abilities [ability]})
+
    "Blacklist"
    {:effect (effect (lock-zone (:cid card) :runner :discard))
     :leave-play (effect (release-zone (:cid card) :runner :discard))}
@@ -123,6 +133,27 @@
               :effect (req (if-not (and (= target "Pay 1 [Credits]") (pay state side card :credit 1))
                              (do (tag-runner state side 1) (system-msg state side "takes 1 tag"))
                              (system-msg state side "pays 1 [Credits]")))}}}
+
+   "Clone Suffrage Movement"
+   {:derezzed-events {:runner-turn-ends corp-rez-toast}
+    :flags {:corp-phase-12 (req (and (some #(is-type? % "Operation") (:discard corp))
+                                     (no-ice? state (second (:zone card)))))}
+    :abilities [{:label "Add 1 operation from Archives to HQ"
+                 :prompt "Choose an operation in Archives to add to HQ" :show-discard true
+                 :choices {:req #(and (is-type? % "Operation")
+                                      (= (:zone %) [:discard]))}
+                 :effect (effect (move target :hand)) :once :per-turn
+                 :msg (msg "add " (card-str state target) " to HQ")}]}
+
+   "Commercial Bankers Group"
+   (let [ability {:req (req (no-ice? state (second (:zone card))))
+                  :label "Gain 3 [Credits] (start of turn)"
+                  :once :per-turn
+                  :msg "gain 3 [Credits]"
+                  :effect (effect (damage :net 1 {:card card}))}]
+     {:derezzed-events {:runner-turn-ends corp-rez-toast}
+      :events {:corp-turn-begins ability}
+      :abilities [ability]})

    "Constellation Protocol"
    {:derezzed-events {:runner-turn-ends corp-rez-toast}
@@ -181,7 +212,7 @@
               :req (req (first-event state side :corp-draw))
               :effect (req
                         (let [dbs (count (filter #(and (rezzed? %) (= (:title %) "Daily Business Show"))
-                                                  (all-installed state :corp)))
+                                                  (all-installed state :corp)))
                               newcards (take dbs (:deck corp))
                               drawn (concat newcards (take-last target (:hand corp)))]
                           (doseq [c newcards] (move state side c :hand))
@@ -683,6 +714,20 @@
                  :msg (msg "trash " (:title target) " to gain 4 [Credits]")
                  :label "Trash a rezzed ICE to gain 4 [Credits]"
                  :effect (effect (trash target) (gain :credit 4))}]}
+
+   "Sensie Actors Union"
+   {:derezzed-events {:runner-turn-ends corp-rez-toast}
+    :flags {:corp-phase-12 (req (no-ice? state (second (:zone card))))}
+    :abilities [{:label "Draw 3 cards and add 1 card in HQ to the bottom of R&D"
+                 :once :per-turn
+                 :msg "draw 3 cards"
+                 :effect (effect (draw 3)
+                                 (resolve-ability
+                                   {:prompt "Choose a card in HQ to add to the bottom of R&D"
+                                    :choices {:req #(and (= (:side %) "Corp")
+                                                         (in-hand? %))}
+                                    :effect (effect (move target :deck))}
+                                  card nil))}]}

    "Server Diagnostics"
    (let [ability {:effect (effect (gain :credit 2))


Add warning message when rezzing in corp step 1.2.

--- src/clj/game/core-actions.clj
+++ src/clj/game/core-actions.clj
@@ -198,6 +198,9 @@
                                        (update-in [:host :zone] #(map to-keyword %)))))
              (system-msg state side (str (build-spend-msg cost-str "rez" "rezzes")
                                          (:title card) (when ignore-cost " at no cost")))
+             (when (:corp-phase-12 @state)
+               (toast state :corp "You are not allowed to rez cards at this time. Please rez prior to clicking
+                  Start Turn in the future." "warning"))
              (when (ice? card)
                (update-ice-strength state side card)
                (update-run-ice state side))


tests for City Surveillance, Ghost Branch, Mental Health Clinic

--- src/clj/test/cards-assets.clj
+++ src/clj/test/cards-assets.clj
@@ -75,6 +75,23 @@
       (is (= 5 (:max-hand-size (get-runner))) "Runner max hand size restored to 5")
       (is (= 1 (count (get-in @state [:runner :scored]))) "Chairman Hiro added to Runner score area")
       (is (= 2 (:agenda-point (get-runner))) "Runner gained 2 agenda points"))))
+
+(deftest city-surveillance
+  "City Surveillance - Runner chooses to pay 1 credit or take 1 tag at start of their turn"
+  (do-game
+    (new-game (default-corp [(qty "City Surveillance" 1)]) (default-runner))
+    (play-from-hand state :corp "City Surveillance" "New remote")
+    (let [surv (first (get-in @state [:corp :servers :remote1 :content]))]
+      (core/rez state :corp surv)
+      (take-credits state :corp)
+      (prompt-choice :runner "Pay 1 [Credits]")
+      (is (= 4 (:credit (get-runner))) "Runner paid 1 credit")
+      (is (= 0 (:tag (get-runner))) "Runner didn't take a tag")
+      (take-credits state :runner)
+      (take-credits state :corp)
+      (prompt-choice :runner "Take 1 tag")
+      (is (= 8 (:credit (get-runner))) "Runner paid no credits")
+      (is (= 1 (:tag (get-runner))) "Runner took 1 tag"))))

 (deftest elizabeth-mills
   "Elizabeth Mills - Remove 1 bad publicity when rezzed; click-trash to trash a location"
@@ -167,6 +184,22 @@
     (is (find-card "Franchise City" (:scored (get-corp))) "Franchise City in corp scored area")
     (is (= 1 (:agenda-point (get-corp))) "Corp has 1 point")))

+(deftest ghost-branch
+  "Ghost Branch - Advanceable; give the Runner tags equal to advancements when accessed"
+  (do-game
+    (new-game (default-corp [(qty "Ghost Branch" 1)]) (default-runner))
+    (play-from-hand state :corp "Ghost Branch" "New remote")
+    (let [gb (first (get-in @state [:corp :servers :remote1 :content]))]
+      (core/advance state :corp {:card (refresh gb)})
+      (core/advance state :corp {:card (refresh gb)})
+      (is (= 2 (get-in (refresh gb) [:advance-counter])))
+      (take-credits state :corp)
+      (core/click-run state :runner {:server :remote1})
+      (core/no-action state :corp nil)
+      (core/successful-run state :runner nil)
+      (prompt-choice :corp "Yes") ; choose to do the optional ability
+      (is (= 2 (:tag (get-runner))) "Runner given 2 tags"))))
+
 (deftest jackson-howard-draw
   "Jackson Howard - Draw 2 cards"
   (do-game
@@ -214,6 +247,18 @@
         (is (= 9 (:credit (get-corp))) "Gained 2 credits")
         (is (= 1 (count (:discard (get-corp)))) "Mark Yale trashed")))))

+(deftest mental-health-clinic
+  "Mental Health Clinic - Gain 1 credit when turn begins; Runner max hand size increased by 1"
+  (do-game
+    (new-game (default-corp [(qty "Mental Health Clinic" 1)]) (default-runner))
+    (play-from-hand state :corp "Mental Health Clinic" "New remote")
+    (let [mhc (first (get-in @state [:corp :servers :remote1 :content]))]
+      (core/rez state :corp mhc)
+      (is (= 6 (:max-hand-size (get-runner))) "Runner max hand size increased by 1")
+      (take-credits state :corp)
+      (take-credits state :runner)
+      (is (= 8 (:credit (get-corp))) "Gained 1 credit at start of turn"))))
+
 (deftest public-support
   "Public support scoring and trashing"
   ;TODO could also test for NOT triggering "when scored" events


WIP

WIP

Removed some stuff from main

--- src/cljs/my_project/core.cljs
+++ src/cljs/my_project/core.cljs
@@ -45,133 +45,6 @@

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (enable-console-print!)
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; (def system ( mk-system "shit-div" "shit-canvas" ))
-
-; (def rt-gaz
-;   (-> (get-resource-manager system)
-;       (create-render-target! "shit-canvas" 100 100)))
-
-; (def im-gaz
-;  (-> (get-resource-manager system)
-;      (load-img! "shit-tiles")))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; (defonce update-chan (chan))
-
-; (def level-dims (v2 10 10))
-
-; (def level
-;   (->
-;     (mk-tile-map (:x level-dims) (:y level-dims) :blank)
-;     (mix-it-up)))
-
-; (defn make-game-render-data [rd t rendered-level]
-;   (assoc rd
-;          :xforms
-;          (concat
-;            (list
-;              [:identity]
-;              [:clear (cos-01 (* t 1)) 0 (cos-01 (* t 20))]
-;              [:scale {:x 10 :y 10}]
-;              [:translate (v2/mul (v2/v2 (cos-01 (* t 3)) (cos-01 t)) (v2/v2 20 20))]
-;              )
-;            (list
-;                    [:box {:x 0 :y 0} {:x 20 :y 20} [0 0 0]]
-;              )
-;            rendered-level)
-;          )
-;   )
-
-; (defn make-level-render-data [rd t]
-;   (assoc rd
-;          :xforms (list
-;                    [:identity]
-;                    [:clear 0 0 1]
-;                    [:box {:x 0 :y 0} {:x 20 :y 20} [0 0 0]] )))
-
-
-; (def rendered-level (vec  (render-level level)))
-
-; (defn update-game [{:keys [tick main-render-data level-render-data] :as game} dt]
-;   (let [new-tick (+ dt  tick) ]
-;     (do
-
-;       (assoc game
-;              :level-render-data (make-level-render-data level-render-data new-tick )
-;              :main-render-data (make-game-render-data level-render-data new-tick rendered-level)
-;              :tick new-tick))
-;     ))
-
-; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; (defn make-pogue-game [renderer resource-manager]
-;   (game/make-game
-;     (reify
-;       game/IGameInit
-;       (game-init [_]
-;         (println "initialised game!"))
-
-;       game/IGameUpdate
-;       (game-update [this dt]
-;         (println "updated game!")))))
-
-; (def img-chan (chan))
-; (def rt-chan (chan))
-
-; (defn om-loader [_ owner]
-;   (reify
-;     om/IWillMount
-;     (will-mount [_]
-;       (go-loop []
-;                (let [[msg port] (alts! [img-chan rt-chan])]
-;                  (cond
-;                    (= port img-chan) (println (str "img: " msg))
-;                    (= port rt-chan) (println (str "rt: " msg))
-;                    ))
-;                (recur)))
-
-;     om/IDidUpdate
-;     (did-update [this next-props next-state]
-;       )
-
-;     om/IRender
-;     (render [_]
-;       (dom/p nil "Loaded")
-;       )
-;     )
-;   )
-
-; (defonce loader-atom (atom {:rt-chan (chan) :img-chan (chan)}))
-
-; (defn str->bytes [s]
-;   (->
-;     (fn [ch]
-;       (let [cc (.charCodeAt ch 0)]
-;         (if (> cc 255)
-;           [(bit-and cc 255) (bit-shift-right cc 8)]
-;           [cc])))
-;     (mapcat s)))
-
-; (defn col->array [col]
-;   (let [arr #js []]
-;     (doseq [i (range (count col))]
-;       (.push arr (nth col i)))
-;     arr))
-
-; (defn str->enc64 [s]
-;   (b64/encodeByteArray (-> s str->bytes col->array)))
-
-; (defn str->inline-png [s]
-;   (str "data:image/png;base64," (str->enc64 s)))
-
-; (defn <!-inline-img-enc [url]
-;   (let [ret (chan)]
-;     (go (->>
-;           (http/get url)
-;           (<!)
-;           (:body)
-;           (put! ret)))
-;     ret))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (defn log-window
@@ -259,7 +132,9 @@
           (log-js (rman/height img))
           (log-js (rman/width img)))))))

+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
 (def pogue-game
   (game/make-game
     (reify
@@ -275,33 +150,5 @@
       (game-close [this]
         this))))

+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; (defonce first-time? (atom true))
-
-; (defn main' []
-;   (om/root
-;     (fn [game-state owner]
-;       (reify
-;         om/IWillMount
-;         (will-mount [_ ]
-;           (go-loop []
-;                    (let [dt (<! update-chan) ]
-;                      (om/transact! game-state #(update-game % dt))
-;                      (recur))))
-
-;         om/IRender
-;         (render [_]
-;           (dom/div #js {:id "wrapper"}
-;                    (dom/div nil (dom/h1 nil (-> game-state :main-app :name)))
-;                    (dom/p nil (-> game-state :tick))
-;                    ))))
-;     app-state
-;     {:target (. js/document (getElementById "app"))})
-
-;   (when @first-time?
-;     (do
-;       (swap! first-time? not)
-;       (js/setInterval (fn [] (put! update-chan (/ 1 60))) 16))))
-
-


updated docs for array2

updated docs for array2

--- src/cljs/schutzen/array2.cljs
+++ src/cljs/schutzen/array2.cljs
@@ -1,5 +1,35 @@
 (ns schutzen.array2
-  "Set of helpful functions for manipulating 2d arrays")
+  "Simple and helpful functions for manipulating 2d arrays. This is a set
+  of functions for manipulating a mutable js/Array instance, and
+  treats it like a 2d array. This is useful for the domain of 2d games.
+
+  Examples:
+
+  (def array1 (aa 1 2))
+  (def array2 (aa 3 4))
+
+  (ax array1) ; 1
+  (ay array1) ; 2
+
+  ;; add the contents of array2 to array1 and returns array1. array1 will now have the
+  ;; contents of array2
+  (a++ array1 array2) ; (aa 4 6)
+
+  ;; to add contents, and return a new array
+  (a++ (ac array1) array2) ; (aa 4 6)
+
+  ;; scalar multiplication
+  (a**i array1 2) ; (aa 8 12)
+
+  ;; component addition, multiplication
+  (ax+ array1 4) ; (aa 12 12)
+  (ax* array1 2) ; (aa 24 12)
+
+  (a** array1 (/ 1 12)) ; (aa 1 2)
+
+  ;; assign new values to 2d array. array1 will now be (aa 0 0)
+  (a== array1 (a 0 0)) ; (aa 0 0)
+")

 (defn aa
   "Create 2d array from provided x and y values"
@@ -9,7 +39,7 @@
     (js/Array. x y)))

 (defn ac
-  "Create copy of an array"
+  "Create copy of a 2d array"
   [a]
   (aa (ax a) (ay a)))

@@ -87,7 +117,7 @@
   (ay- a (ay a2)))

 (defn a**
-  "multiply the second array to the first array"
+  "component-wise multiply the second array to the first array"
   [a a2]
   (ax* a (ax a2))
   (ay* a (ay a2)))


disallow editing vertex labels

disallow editing vertex labels

--- src/clojure/defgraph/core.clj
+++ src/clojure/defgraph/core.clj
@@ -39,6 +39,7 @@
           jgraph (JGraph. adapter)
           facade (JGraphFacade. jgraph)
           layout (JGraphFastOrganicLayout.)]
+      (doto jgraph (.setEditable false))
       (.run layout facade)
       (let [m (.createNestedMap facade true true)
             cache (.getGraphLayoutCache jgraph)]


Adding username/password for the store

Adding username/password for the store

--- src/io/cyanite/store.clj
+++ src/io/cyanite/store.clj
@@ -139,14 +139,15 @@
 (defn cassandra-metric-store
   "Connect to cassandra and start a path fetching thread.
    The interval is fixed for now, at 1minute"
-  [{:keys [keyspace cluster hints repfactor chan_size batch_size]
+  [{:keys [keyspace cluster hints repfactor chan_size batch_size username password]
     :or   {hints {:replication {:class "SimpleStrategy"
                                 :replication_factor (or repfactor 3)}}
            chan_size 10000
            batch_size 500}}]
   (info "creating cassandra metric store")
-  (let [cluster (if (sequential? cluster) cluster [cluster])
-        session (-> (alia/cluster {:contact-points cluster})
+(let [cluster (if (sequential? cluster) cluster [cluster])
+        session (-> (alia/cluster {:contact-points cluster
+                                   :credentials {:user username, :password password} })
                     (alia/connect keyspace))
         insert! (insertq session)
         fetch!  (fetchq session)]


CMR-488: Updated routes to handle encoded slashes in native id.

--- src/cmr/ingest/api/routes.clj
+++ src/cmr/ingest/api/routes.clj
@@ -25,7 +25,7 @@
 (defn- build-routes [system]
   (routes
     (context "/providers/:provider-id" [provider-id]
-      (context "/collections/:native-id" [native-id]
+      (context ["/collections/:native-id" :native-id #".*$"] [native-id]
         (PUT "/" {:keys [body content-type headers request-context]}
           (let [metadata (string/trim (slurp body))
                 base-concept {:metadata metadata
@@ -40,7 +40,7 @@
                                  :native-id native-id
                                  :concept-type :collection}]
             (r/response (ingest/delete-concept request-context concept-attribs)))))
-      (context "/granules/:native-id" [native-id]
+      (context ["/granules/:native-id" :native-id #".*$"] [native-id]
         (PUT "/" {:keys [body content-type headers request-context]}
           (let [metadata (string/trim (slurp body))
                 base-concept {:metadata metadata


Email styling tweak.

Email styling tweak.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -204,9 +204,9 @@
     [:td
       (spacer 30 "header")
       (when logo? (logo snapshot))
-      (when logo? (spacer 12 "header"))
+      (when logo? (spacer 10 "header"))
       (company-name snapshot)
-      (when title? (spacer 12 "header"))
+      (when title? (spacer 10 "header"))
       (when title? (title snapshot))
       (spacer 22 "header")
       [:table


Revert "Format slack pastes as code"

Revert "Format slack pastes as code"

This reverts commit 06dc0f1f54bc7a06bca3e391f93dc10e8951b826.

--- src/yetibot/core/adapters/slack.clj
+++ src/yetibot/core/adapters/slack.clj
@@ -54,7 +54,7 @@
                            {:unfurl_media "true" :as_user "true"}))

 (defn send-paste [msg]
-  (send-msg (str "```" msg "```")))
+  (send-msg msg))

 (def messaging-fns
   {:msg send-msg


Add fn to add react-key to existing dict

--- src/discuss/utils/common.cljs
+++ src/discuss/utils/common.cljs
@@ -51,7 +51,12 @@
 (defn get-unique-key
   "Return unique react-key."
   []
-  (str (:name config/project) "-unique-react-key-" (swap! counter inc)))
+  (str config/project "-unique-react-key-" (swap! counter inc)))
+
+(defn merge-react-key
+  "Get a unique key, create a small map with :react-key property and merge it with the given collection."
+  [col]
+  (merge {:react-key (get-unique-key)} col))

 (defn get-cursor
   "Return a cursor to the corresponding key in the app-state."


Fix enterprise queue explanation display

It was printing the cljs data structure to the page instead of the html
it should've produced

--- src-cljs/frontend/components/build_head.cljs
+++ src-cljs/frontend/components/build_head.cljs
@@ -64,9 +64,9 @@

 (defn queued-explanation-text []
   (if (not (enterprise?))
-    "We're sorry; this is our fault. Typically you should only see this when load spikes overwhelm our auto-scaling; waiting to acquire containers should be brief and infrequent."
+    " We're sorry; this is our fault. Typically you should only see this when load spikes overwhelm our auto-scaling; waiting to acquire containers should be brief and infrequent."
     [:span
-     "Typically, this means you have more builds scheduled to be run than available capacity in the fleet. "
+     " Typically, this means you have more builds scheduled to be run than available capacity in the fleet. "
      (if (:admin (utils/current-user))
        [:span "Check " [:a {:href "/admin/fleet-state"} "Fleet State"] " for details and potentially start new builders"]
        "Ask a CircleCI Enterprise administrator to check fleet state and launch new builder machines")]))
@@ -104,7 +104,7 @@

              (when (< 10000 (build-model/run-queued-time build))
                [:span#circle_queued_explanation
-                (str " " (queued-explanation-text))])
+                (queued-explanation-text)])
              (when (seq builds)
                [:span
                 " This build " (if usage-queued? "has been" "was")


Fix info-functions (like game-counter) conversion to string

--- src/glory_of_empires/main.clj
+++ src/glory_of_empires/main.clj
@@ -41,7 +41,7 @@

 (defn execute-post [ message-type game-id game game-func ]
   (case message-type
-    :info (game-func game)
+    :info (str (game-func game))
     :view (xml-to-text (game-func game))
     :command (do (game-state/swap-game game-func game-id) "ok") ; game-modifying commands
     :admin-command (do (game-state/swap-games game-func) "ok")  )) ; commands modifying the whole app state


stray & infront of args to conn/make-manager.   Caused class cast exception in non-default case

--- src/clj_http/conn_mgr.clj
+++ src/clj_http/conn_mgr.clj
@@ -103,7 +103,7 @@

 (defn make-manager
   "returns reusable PoolingClientConnectionManager"
-  [& opts]
+  [opts]
   (let [timeout# (or (:timeout opts) 5)
         threads# (or (:threads opts) 4)
         default-per-route# (or (:default-per-route opts) dmcpr)


replace local reference

replace local reference

--- test/forma/source/logistic_test.clj
+++ test/forma/source/logistic_test.clj
@@ -17,17 +17,19 @@
   [file-name]
   (io/input-stream (io/resource file-name)))

-;; (def y (apply concat (read-csv "mys-label-data.csv")))
+(def y (apply concat
+              (read-csv (test-file "testdata/mys-label-data.csv"))))

-;; (def X (map (partial cons 1) (read-csv "mys-feature-data.csv")))
+(def X (map (partial cons 1)
+            (read-csv (test-file "testdata/mys-feature-data.csv"))))

-(def y (apply
-        concat
-        (take 1000 (read-csv "/Users/danhammer/Desktop/myslab.csv"))))
+;; (def y (apply
+;;         concat
+;;         (take 1000 (read-csv "/Users/danhammer/Desktop/myslab.csv"))))

-(def X (take 1000
-             (map (partial cons 1)
-                  (read-csv "/Users/danhammer/Desktop/mys.csv"))))
+;; (def X (take 1000
+;;              (map (partial cons 1)
+;;                   (read-csv "/Users/danhammer/Desktop/mys.csv"))))

 (def beta (repeat
            (count (first X))


added multi-band requests to server_test

--- test/lcmap/aardvark/server_test.clj
+++ test/lcmap/aardvark/server_test.clj
@@ -25,12 +25,17 @@
     (testing "get tiles as JSON"
       (let [resp (req :get "http://localhost:5679/landsat/tiles"
                       :headers {"Accept" "application/json"}
-                      :form-params {:x 0 :y 0 :ubid "LANDSAT_5/TM/sr_band1" :acquired "2000-01-01/2005-01-01"})]
+                      :form-params {:x 0 :y 0
+                                    :ubid ["LANDSAT_5/TM/sr_band1"
+                                           "LANDSAT_5/TM/sr_band2"]
+                                    :acquired "2000-01-01/2005-01-01"})]
         (is (= 200 (:status resp)))))
     (testing "get tiles as an unsupported type"
       (let [resp (req :get "http://localhost:5679/landsat/tiles"
                       :headers {"Accept" "application/foo"}
-                      :form-params {:x 0 :y 0 :ubid "LANDSAT_5/TM/sr_band1" :acquired "2000-01-01/2005-01-01"})]
+                      :form-params {:x 0 :y 0
+                                    :ubid "LANDSAT_5/TM/sr_band1"
+                                    :acquired "2000-01-01/2005-01-01"})]
         (is (= 406 (:status resp)))))))

 (deftest landsat-tile-spec-resource


CMR-2480: Fixed typo

CMR-2480: Fixed typo

--- metadata-db-app/src/migrations/033_replace_tags_namespace_and_value_with_tag_key.clj
+++ metadata-db-app/src/migrations/033_replace_tags_namespace_and_value_with_tag_key.clj
@@ -34,7 +34,7 @@
   "Migrates the database down from version 33."
   []
   (println "migrations.033-replace-tags-namespace-and-value-with-tag-key down...")
-  (println "NOTE: category field and original native-id cannot be recoverd")
+  (println "NOTE: category field and original native-id cannot be recovered")
   (doseq [result (h/query "SELECT * from cmr_tags")]
     (let [{:keys [id metadata]} result
           metadata (-> metadata


minor refactoring

minor refactoring

--- src/ring_curl/clj_http.clj
+++ src/ring_curl/clj_http.clj
@@ -20,6 +20,6 @@
   "Converts the given clj-http request to a ring request by calling some of the default clj-http middleware."
   [request]
   (reduce (fn [request middleware-fn]
-            ((middleware-fn (fn [x] x)) request))
+            ((middleware-fn identity) request))
           request
           middleware))


Add missing argument.

Add missing argument.

The alternate arity is four, not three.

--- src/afterglow/controllers/ableton_push_2.clj
+++ src/afterglow/controllers/ableton_push_2.clj
@@ -105,7 +105,7 @@
   was received during startup when we are gathering LED palette
   entries, so we should use them to record any palette response."
   ([controller msg]
-   (sysex-received controller msg nil))
+   (sysex-received controller msg nil nil))
   ([controller msg gather-timestamp gather-promise]
    (if (= (vec (take 5 (:data msg))) [0x00 0x21 0x1d (:device-id controller) 0x01])
      (let [data (map int (butlast (drop 5 (:data msg))))


define view as components

define view as components

--- src/cljs/reagent_phonecat_tutorial/core.cljs
+++ src/cljs/reagent_phonecat_tutorial/core.cljs
@@ -9,20 +9,39 @@
   [& [name]]
   (print "Hello," (or name "World") "!"))

-(def static-content "Some sample, statically defined DOM content."
-     [:ul#phones-list
-      [:li.phone-item
-       [:span "Nexus S"]
-       [:p "Fast just got faster with Nexus S"]]
-      [:li {:class "phone-item"}
-       [:span "Motorola XOOM™ with Wi-Fi"]
-       [:p "The Next, Next Generation tablet."]]
-      ])
+;; --------------------------------------------
+;; Application data
+
+(def hardcoded-phones-data [{:name "Nexus S"
+                             :description "Fast just got faster with Nexus S"}
+                            {:name "Motorola XOOM™ with Wi-Fi"
+                             :description "The Next, Next Generation tablet."}])
+
+;; --------------------------------------------
+;; View components
+
+(declare ;; here we declare our components to define their in an order that feels natural.
+  <phones-list>
+    <phone-item>)
+
+(defn <phones-list> "An unordered list of phones"
+  [phones-list]
+  [:div.container-fluid
+   [:ul
+    (for [phone phones-list]
+      ^{:key (:name phone)} [<phone-item> phone]
+      )]])
+
+(defn <phone-item> "An phone item component"
+  [{:keys [name description] :as phone}]
+  [:li.phone-item
+   [:span name]
+   [:p description]])

 (defn mount-root "Creates the application view and injects ('mounts') it into the root element."
   []
   (rg/render
-    static-content
+    [<phones-list> hardcoded-phones-data]
     (.getElementById js/document "app")))

 (defn init! []


parinfer formatting

parinfer formatting

--- src-cljs/cuttle/config.cljs
+++ src-cljs/cuttle/config.cljs
@@ -10,7 +10,7 @@

 (def config-file-path (str js/__dirname "/config.json"))

-(def default-config {:log-compiler-output false })
+(def default-config {:log-compiler-output false})

 (def config
   (if (file-exists? config-file-path)


remove the html macro

remove the html macro

--- src-cljs/frontend/utils.clj
+++ src-cljs/frontend/utils.clj
@@ -1,5 +1,4 @@
-(ns frontend.utils
-  (:require [sablono.core :as html]))
+(ns frontend.utils)

 (defmacro inspect
   "prints the expression '<name> is <value>', and returns the value"
@@ -51,26 +50,3 @@
        (~'display-name [~'_] ~(str name))
        om.core/IRender
        (~'render [~'_] ~@body))))
-
-(defmacro html [body]
-  `(if-not (:render-colors? initial-query-map)
-     (html/html ~body)
-     (let [body# ~body]
-       (try
-         (let [[tag# & rest#] body#
-               attrs# (if (map? (first rest#))
-                        (first rest#)
-                        {})
-               rest# (if (map? (first rest#))
-                       (rest rest#)
-                       rest#)]
-           (html/html (vec (concat [tag# (assoc-in attrs# [:style :border] (str "5px solid rgb("
-                                                                                (rand-int 255)
-                                                                                ","
-                                                                                (rand-int 255)
-                                                                                ","
-                                                                                (rand-int 255)
-                                                                                ")"))]
-                                   rest#))))
-         (catch :default e#
-           (html/html body#))))))


Drop the line that says users can drop admin scope

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -903,7 +903,7 @@
                   [:div.authorization
                    (if-not (user-model/public-key-scope? user)
                      (list
-                      [:p "In order to do so, you'll need to grant authorization from GitHub to the \"admin:public_key\" scope. This will allow us to add a new authorized public key to your GitHub account. (Feel free to drop this additional scope after we've added the key!)"]
+                      [:p "In order to do so, you'll need to grant authorization from GitHub to the \"admin:public_key\" scope. This will allow us to add a new authorized public key to your GitHub account."]
                       [:a.btn.ghu-authorize
                        {:href (gh-utils/auth-url :scope ["admin:public_key" "user:email" "repo"])
                         :title "Grant admin:public_key authorization so that we can add a new SSH key to your GitHub account"}


don't reload server component by default

--- src/clj/matthiasn/systems_toolbox_sente/server.clj
+++ src/clj/matthiasn/systems_toolbox_sente/server.clj
@@ -120,6 +120,7 @@
     (merge {:cmp-id           cmp-id
             :state-fn         (sente-comp-fn cfg-map)
             :opts             {:watch                 :connected-uids
+                               :reload-cmp            false
                                :snapshots-on-firehose false
                                :validate-in           false
                                :validate-out          false


(SERVER-2479) Remove job_id from schema

(SERVER-2479) Remove job_id from schema

--- src/clj/puppetlabs/services/master/master_core.clj
+++ src/clj/puppetlabs/services/master/master_core.clj
@@ -726,7 +726,6 @@
                                            (schema/required-key "catalog") schema/Bool}
       (schema/optional-key "trusted_facts") {(schema/required-key "values") {schema/Str schema/Any}}
       (schema/optional-key "facts") {(schema/required-key "values") {schema/Str schema/Any}}
-      (schema/optional-key "job_id") schema/Int
       (schema/optional-key "transaction_uuid") schema/Str
       (schema/optional-key "environment") schema/Str
       (schema/optional-key "options") {(schema/optional-key "capture_logs") schema/Bool}


Remove lower-case operation on collection and attribute names

--- src/main/clojure/pdok/featured/processor.clj
+++ src/main/clojure/pdok/featured/processor.clj
@@ -350,15 +350,8 @@
   (let [kmap (into {} (map #(vector %1 (change-key %1)) (keys src-map)))]
      (clojure.set/rename-keys src-map kmap)))

-(defn lower-case [feature]
-  (let [attributes-lower-case (rename-keys (:attributes feature) clojure.string/lower-case)
-        feature-lower-case (assoc feature :attributes attributes-lower-case)]
-    (cond-> feature-lower-case
-            ((complement str/blank?) (:collection feature-lower-case))
-            (update-in [:collection] str/lower-case))))
-
 (defn pre-process [processor feature]
-  (let [prepped ((comp lower-case collect-attributes) feature)]
+  (let [prepped (collect-attributes feature)]
     (flatten processor prepped)))

 (defn- append-feature [persistence feature]


add keep alive message

add keep alive message

--- src/cljs/wombats_web_client/socket_dispatcher.cljs
+++ src/cljs/wombats_web_client/socket_dispatcher.cljs
@@ -32,8 +32,13 @@
    (fn []
      (let [socket (-> js/window .-gameSocket)
            ready-state (.-readyState socket)]
-       (when-not (= ready-state 1)
-         (init-ws-connection)))) 2000))
+
+       (if-not (= ready-state 1)
+         (init-ws-connection)
+         (ws/send-message
+          :keep-alive
+          {:msg "Whether you're a brother or whether you're a mother, you're stayin' alive, stayin' alive"}))))
+   5000))

 ;; Starts the socket polling process
 (socket-polling)


Ditto

Ditto

--- src/clojure/clojurewerkz/cassaforte/conversion.clj
+++ src/clojure/clojurewerkz/cassaforte/conversion.clj
@@ -1,3 +1,12 @@
+;; Copyright (c) 2012-2014 Michael S. Klishin, Alex Petrov, and the ClojureWerkz Team
+;;
+;; The use and distribution terms for this software are covered by the
+;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
+;; which can be found in the file epl-v10.html at the root of this distribution.
+;; By using this software in any fashion, you are agreeing to be bound by
+;; the terms of this license.
+;; You must not remove this notice, or any other, from this software.
+
 (ns clojurewerkz.cassaforte.conversion
   (:import [com.datastax.driver.core ResultSet Host Row ColumnDefinitions ColumnDefinitions
             ColumnDefinitions$Definition]


Changing collection cache interval to every 15 minutes.

--- src/cmr/search/services/acls/collections_cache.clj
+++ src/cmr/search/services/acls/collections_cache.clj
@@ -96,4 +96,5 @@

 (def refresh-collections-cache-for-granule-acls-job
   {:job-type RefreshCollectionsCacheForGranuleAclsJob
-   :interval 3600})+   ;; 15 minutes
+   :interval (* 15 60)})


Add comment to Optimizer extend-protocol

Add comment clarifying why only some of the Optimizer protocol methods
are implemented for clojure.lang.IFn.

--- cortex/src/cortex/optimize/optimizers.clj
+++ cortex/src/cortex/optimize/optimizers.clj
@@ -11,6 +11,8 @@
                (assoc state :step
                       (this gradient)))
      :state {}})
+  ;; This turns the Optimizer into a map, so we don't need to
+  ;; implement any of the other methods.

   clojure.lang.IPersistentMap
   (initialize [this param-count]


Pass another param to the stakeholder-update-render funciton to know if the user has read access.

--- src/open_company/api/stakeholder_updates.clj
+++ src/open_company/api/stakeholder_updates.clj
@@ -31,7 +31,7 @@
   (let [company-slug (:company-slug update)
         company-url (company-rep/url company-slug)]
     (common/location-response ["companies" company-slug "updates" (:slug update)]
-      (su-rep/render-stakeholder-update company-url update true) su-rep/media-type)))
+      (su-rep/render-stakeholder-update company-url update true true) su-rep/media-type)))

 ;; ----- Actions -----

@@ -97,6 +97,8 @@
       :get (fn [ctx] (su-rep/render-stakeholder-update
                         (company-rep/url company-slug)
                         (:stakeholder-update ctx)
+                        (or (common/allow-public conn company-slug ctx) ; allow for all for public companies
+                            (common/allow-org-members conn company-slug ctx)) ; protect the ObscURLs of private ones
                         (common/allow-org-members conn company-slug ctx)))})
   :handle-not-acceptable (fn [_] (common/only-accept 406 su-rep/media-type))
   :handle-unsupported-media-type (fn [_] (common/only-accept 415 su-rep/media-type))


Fix HATEOAS section link.

Fix HATEOAS section link.

--- src/open_company/representations/company.clj
+++ src/open_company/representations/company.clj
@@ -12,7 +12,7 @@
 (defun url
   ([slug :guard string?] (str "/companies/" (name slug)))
   ([company :guard map?] (url (name (:slug company))))
-  ([company :section-list] (str (url company) "/sections/new"))
+  ([company :section-list] (str (url company) "/section/new"))
   ([company updated-at] (str (url company) "?as-of=" updated-at)))

 (defn- self-link [company]


~(defn create-index-fn): move lexicon out of scope of return value for speed

--- src/babel/italiano/lab.cljc
+++ src/babel/italiano/lab.cljc
@@ -364,21 +364,21 @@
    [:synsem :sem :pred]])

 (defn create-index-fn [verb-set grammar]
-  (fn [spec]
-    (let [lexicon
-          (into {}
-                (for [[k vals] (:lexicon model)]
-                  (let [filtered-vals
-                        (filter
-                         (fn [v]
-                           (or
-                            (and (= :verb (u/get-in v [:synsem :cat]))
-                                 (contains? verb-set
-                                            (u/get-in v [:italiano :italiano])))
-                            (verbcoach-pronouns v)))
-                         vals)]
-                    (if (not (empty? filtered-vals))
-                      [k filtered-vals]))))]
+  (let [lexicon
+        (into {}
+              (for [[k vals] (:lexicon model)]
+                (let [filtered-vals
+                      (filter
+                       (fn [v]
+                         (or
+                          (and (= :verb (u/get-in v [:synsem :cat]))
+                               (contains? verb-set
+                                          (u/get-in v [:italiano :italiano])))
+                          (verbcoach-pronouns v)))
+                       vals)]
+                  (if (not (empty? filtered-vals))
+                    [k filtered-vals]))))]
+    (fn [spec]
       (lookup-spec spec (create-indices lexicon verbcoach-index-paths)
                    verbcoach-index-paths))))


Add download-page.

Add download-page.

--- src/beebster_clj/routes.clj
+++ src/beebster_clj/routes.clj
@@ -12,7 +12,8 @@
   (GET "/search" [] (about-page))
   (GET "/categories" [category] (category-page category))
   (POST "/results" [searchvalue] (result-page searchvalue))
-  (GET "/info" [index] (info-page index)))
+  (GET "/info" [index] (info-page index))
+  (ANY "/download" [index mode] (download-page index mode)))

 (def app


good so far

good so far

--- src/bluebell/utils/core.clj
+++ src/bluebell/utils/core.clj
@@ -289,24 +289,8 @@
         expr (access expr children)]
     (visit state expr)))

-(defn visit-only-unique-wrap [state]
-  {:visited {}
-   :wrapped state})
-
-(defn visit-only-unique [stateful-visitor]
-  (fn [state expr]
-    (let [v (:visited state)]
-      (if (contains? v expr)
-        (get v expr)
-        (let [[next-state output]
-              (stateful-visitor (:wrapped state) expr)]
-          [{:visited (assoc v expr output)
-            :wrapped next-state}])))))
-
 (defn process-config [cfg]
   (merge default-traverse-cfg cfg))
-
-(println "Traverse unique....")

 (defn traverse-postorder-with-state
   ([expr cfg]


added endpoint and cors header for headers

--- src/org/zalando/stups/friboo/system/http.clj
+++ src/org/zalando/stups/friboo/system/http.clj
@@ -23,7 +23,8 @@
             [ring.util.response :as r]
             [org.zalando.stups.friboo.ring :as ring]
             [clojure.data.json :as json])
-  (:import (clojure.lang ExceptionInfo)))
+  (:import (clojure.lang ExceptionInfo)
+           (org.apache.http.protocol HTTP)))

 (defn flatten-parameters
   "According to the swagger spec, parameter names are only unique with their type. This one assumes that parameter names
@@ -48,6 +49,13 @@
       ; TODO add user information, noop currently
       {}
       (handler request))))
+
+(defn- add-cors-allow-headers
+  "Adds Access-Control-Allow-Headers header for common headers you might need."
+  [handler]
+  (fn [request]
+    (let [response (handler request)]
+      (r/header response "Access-Control-Allow-Headers" "Origin, X-Requested-With, Content-Type, Accept, Authorization"))))

 (def default-error
   (json/write-str
@@ -79,12 +87,22 @@
         (log/error e "Undefined exception during request execution: %s" (str e))
         (format-undefined-error e)))))

+(defn health-endpoint
+  "Adds a /.well-known/health endpoint for load balancer tests."
+  [handler]
+  (fn [request]
+    (if (= (:uri request) "/.well-known/health")
+      (-> (r/response "{\"health\": true}")
+          (ring/content-type-json)
+          (r/status 200))
+      (handler request))))
+
 (defn start-component
   "Starts the http component."
   [component definition mapper-fn]
   (if (:handler component)
     (do
-      (log/debug "Skipping start of HTTP; already running.")
+      (log/debug "Skipping start of HTTP ; already running.")
       component)

     (do
@@ -94,7 +112,9 @@
             handler (-> (s1st/swagger-context ::s1st/yaml-cp definition)
                         (s1st/swagger-ring add-ip-log-context)
                         (s1st/swagger-ring exceptions-to-json)
+                        (s1st/swagger-ring health-endpoint)
                         (s1st/swagger-ring wrap-params)
+                        (s1st/swagger-ring add-cors-allow-headers)
                         (s1st/swagger-mapper :cors-origin (:cors-origin configuration))
                         (s1st/swagger-discovery)
                         (s1st/swagger-parser)


Modify migrations markup adding source.

Modify migrations markup adding source.

--- src/cadence/views/admin.clj
+++ src/cadence/views/admin.clj
@@ -10,44 +10,44 @@

 (defhtml migration-row
   "Convert a modified migration map to a table row."
-  [{:keys [id doc applied?]}]
-  [:tr.migration {:id (str "migration-" id)}
-   [:td.date (h (str (time-format/unparse
-                         (:rfc822 time-format/formatters)
-                         (time-coerce/from-long
-                           (.getTime (ObjectId. id))))))]
-   [:td.id [:code (h id)]]
-   [:td.doc [:p (h doc)]]
-   (let [badge-class (if applied? "label-success" "")
-         badge-icon (if applied? "icon-ok-sign" "icon-remove-sign")
-         badge-text (if applied? "Applied" "Not Applied")
-         button-class (if applied? "btn-inverse" "btn-primary")
-         button-text (if applied? "Rollback" "Apply")]
-     (html
-       [:td.applied [:span {:class (str "label " badge-class)}
-                     [:i {:class (str "icon-white " badge-icon)}]
-                     (str " " badge-text)]]
+  [{:keys [id doc applied? source]}]
+  (let [badge-class (if applied? "label-success" "")
+        badge-icon (if applied? "icon-ok-sign" "icon-remove-sign")
+        badge-text (if applied? "Applied" "Not Applied")
+        button-class (if applied? "btn-inverse" "btn-primary")
+        button-text (if applied? "Rollback" "Apply")
+        {:keys [up down]}
+        (into {} (for [[k source-form] source]
+                   [k (common/format-source-code source-form)]))]
+    [:div.migration {:id (str "migration-" id)}
+     [:div.meta.row-fluid
+      [:div.date.span4 (h (str (time-format/unparse
+                                 (:rfc822 time-format/formatters)
+                                 (time-coerce/from-long
+                                   (.getTime (ObjectId. id))))))]
+      [:div.id.span4 [:code (h id)]]
+      [:div.doc.span4 [:p (h doc)]]
+      ]

-       [:td.controls [:button {:data-object-id id
-                               :class (str "btn " button-class)}
-                      button-text]]))])
+     [:div.source.row-fluid
+      [:div.span5 [:pre [:code (h up)]]]
+      [:div.span5 [:pre [:code (h down)]]]
+      [:div.span2
+       [:div.controls
+        [:button {:data-object-id id :class (str "btn " button-class)}
+         button-text]]
+       [:div.applied
+        [:span {:class (str "label " badge-class)}
+         [:i {:class (str "icon-white " badge-icon)}] (str " " badge-text)]]]]]))

 (defn migrations
   "A nice place to view migrations."
   [request]
   (common/layout
     [:h2 "Migrations"]
-    [:table#migrations.table.table-striped.table-bordered
-     [:thead
-      [:tr
-       [:th.date "Timestamp"]
-       [:th.id "ObjectId"]
-       [:th.doc "Description"]
-       [:th.applied "Applied?"]
-       [:th.controls]]]
-     [:tbody
-      (require :reload 'cadence.migrations)
-      (map migration-row (migration/list-migrations))]]))
+    [:div#migrations
+     (require :reload 'cadence.migrations)
+     (map migration-row (migration/list-migrations))]))

 (defn post-migrations
   "A nice place to view migrations."


using fail fast functions in quotas

using fail fast functions in quotas

--- src/celestial/users_api.clj
+++ src/celestial/users_api.clj
@@ -44,7 +44,7 @@

 (defroutes- quotas {:path "/quota" :description "User quota managment"}
   (GET- "/quota/:name" [^:string name] {:nickname "getQuota" :summary "Get users quota"}
-        (success (p/get-quota name)))
+        (success (p/get-quota! name)))

   (POST- "/quota/" [& ^:quota quota] {:nickname "addQuota" :summary "Adds a user quota"}
          (p/add-quota quota)
@@ -55,5 +55,5 @@
         (success {:msg "quota updated"}))

   (DELETE- "/quota/:name" [^:string name] {:nickname "deleteQuota" :summary "Deleted users quota"}
-           (p/delete-quota name)
+           (p/delete-quota! name)
            (success {:msg "quota deleted"})))


TODO: need to correctly handle ;; case

TODO: need to correctly handle ;; case

--- src/clj/cljs/source_map.clj
+++ src/clj/cljs/source_map.clj
@@ -71,14 +71,17 @@
          (if lines
            (let [line (first lines)
                  [result relseg]
-                 (let [segs (seq (string/split line #","))]
-                   (loop [segs segs relseg relseg result result]
-                     (if segs
-                       (let [seg (first segs)
-                             nrelseg (seg-combine (base64-vlq/decode seg) relseg)]
-                         (recur (next segs) nrelseg
-                           (update-result result (seg->map nrelseg source-map) gline)))
-                       [result relseg])))]
+                 (if (string? blank? line)
+                   ;; TODO: correctly handle ;; case
+                   [result relseg]
+                   (let [segs (seq (string/split line #","))]
+                     (loop [segs segs relseg relseg result result]
+                       (if segs
+                         (let [seg (first segs)
+                               nrelseg (seg-combine (base64-vlq/decode seg) relseg)]
+                           (recur (next segs) nrelseg
+                             (update-result result (seg->map nrelseg source-map) gline)))
+                         [result relseg]))))]
              (recur (inc gline) (next lines) (assoc relseg 0 0) result))
            result)))))


Use :deprecated on deprecated functions

Use :deprecated on deprecated functions

Closes #29.

--- src/clj/datasplash/core.clj
+++ src/clj/datasplash/core.clj
@@ -1292,15 +1292,15 @@
           ""
           base-schema text-writer-schema)
    :added "0.1.0"
-   :obsolete "0.2.0"}
+   :deprecated "0.2.0"}
   ([encoder f mapping to options ^PCollection pcoll]
    (let [opts (assoc options :label "write-edn-file-by" :coder nil)
          ptrans (write-text-file-by-transform encoder f mapping to opts)]
      (apply-transform pcoll ptrans named-schema opts)))
   ([encoder f mapping to pcoll] (write-file-by encoder f  mapping to {} pcoll)))

-(def ^{:obsolete "0.2.0"} write-edn-file-by (partial write-file-by write-edn-file))
-(def ^{:obsolete "0.2.0"} write-text-file-by (partial write-file-by write-text-file))
+(def ^{:deprecated "0.2.0"} write-edn-file-by (partial write-file-by write-edn-file))
+(def ^{:deprecated "0.2.0"} write-text-file-by (partial write-file-by write-text-file))

 ;;;;;;;;;;;
 ;; Joins ;;


json.izing /stats endpoint

json.izing /stats endpoint

--- src/clj/hface/ui/routes.clj
+++ src/clj/hface/ui/routes.clj
@@ -7,6 +7,7 @@
             [compojure.route :refer [not-found resources]]
             [ring.middleware.defaults :refer [site-defaults wrap-defaults]]
             [selmer.parser :refer [render-file]]
+            [cheshire.core :refer [generate-string]]
             [environ.core :refer [env]]
             [prone.middleware :refer [wrap-exceptions]]))

@@ -14,8 +15,8 @@
   (when-not @collecting?
     (let [interval (or (env :refresh-interval) 4)]
       (info "[hface]: scheduling cluster stats collector to run every " interval " seconds")
-      ;; (if (env :dev?)
-      ;;   (doall (cluster-of 1)))                                      ;; in dev mode start a one node cluster
+      (if (env :dev?)
+        (doall (cluster-of 1)))                                      ;; in dev mode start a one node cluster
       (collect-stats interval)
       (reset! collecting? true))))

@@ -27,7 +28,7 @@
            (render-file "templates/index.html" {:dev (env :dev?)}))

       (GET "/cluster-stats" [] (to-transit @stats))
-      (GET "/stats" [] @stats)
+      (GET "/stats" [] (generate-string @stats))
       (resources "/")
       (not-found "Not Found"))))


page pdf fix: use only image tag in table cell

--- src/clj/salava/page/pdf.clj
+++ src/clj/salava/page/pdf.clj
@@ -279,8 +279,9 @@
                                                                           [:cell " "])]]
                                                                    [:table {:border false :widths [1 3] :keep-together? false}
                                                                       [[:cell
-                                                                         [:paragraph.generic
-                                                                          [:chunk [:image {:width 100 :height 120} (str data-dir "/" profile_picture)]]]]
+                                                                        [:image {:width 100 :height 120} (str data-dir "/" profile_picture)]
+                                                                        #_[:paragraph.generic
+                                                                           [:chunk [:image {:width 100 :height 120} (str data-dir "/" profile_picture)]]]]
                                                                        (if (or (not (empty? profile)) (enabled-field? "about" fields) (enabled-field? "name" fields))
                                                                         [:cell
                                                                            [:table


Fix update import with korma and clojure 1.8

--- src/clj/schedule/web/db.clj
+++ src/clj/schedule/web/db.clj
@@ -1,7 +1,7 @@
 (ns schedule.web.db
-  (:use [korma.db]
-        [korma.core]))
+  (:require [korma.db :as db]
+            [korma.core :as core]))

 ;(defdb db (sqlite3 {:db "resources/db/korma.db"}))

-(defentity conventions)
+(core/defentity conventions)


Changed New and Visited to icons.

Changed New and Visited to icons.

--- src/cljs/bookmarx/home.cljs
+++ src/cljs/bookmarx/home.cljs
@@ -59,9 +59,9 @@
            [:span.bookmark_link-icon-rating {:aria-hidden "true"
                                              :key (str id "-rating" i "-key")}]))
        (when (and created  (> (.getTime (parse-datomic-date created)) week-ago-ticks))
-         [:span.label.label-success "New"])
+         [:span.glyphicon.glyphicon-baby-formula {:style {:color "Green"}}])
        (when (and last-visited (> (.getTime (parse-datomic-date last-visited)) week-ago-ticks))
-         [:span.label.label-info "Visited"])]
+         [:span.glyphicon.glyphicon-plane {:style {:color "Blue"}}])]
       (let [{:keys [bookmark/_parent open?]} (session/get id)]
         [:div.bookmark_children {:key (str id "-key")}
          [:span {:class (str "bookmark_arrow" (when (not open?) "-collapsed"))


fix error in append-query-string

fix error in append-query-string

--- src/cljs/clj_money/api.cljs
+++ src/cljs/clj_money/api.cljs
@@ -21,6 +21,7 @@
 (defn- append-query-string
   [path criteria]
   (if (empty? criteria)
+    path
     (str path "?" (map->query-string criteria))))

 (defn get-resources
@@ -33,7 +34,11 @@
          (if (= 200 (:status response))
            (success-fn (:body response))
            (do
-             (.log js/console "Unable to get the resources from the service" (:body response))
+             (.log js/console
+                   "Unable to get the resource(s) at "
+                   path
+                   " from the service: "
+                   (:body response))
              (error-fn (-> response :body :message))))))))

 (defn create-resource


Only get current date once

Only get current date once

--- src/cljs/kindness/game.cljs
+++ src/cljs/kindness/game.cljs
@@ -522,15 +522,15 @@

 (defn lasers-zomg!
   [delta]
-  (doseq [entity (find-entities-by-component :weaponised)]
-    (let [weaponised (utils/find-component :weaponised entity)
-          laser (:laser weaponised)
-          interval (:every laser)
-          last-time (:last laser)
-          now (js/Date.)]
-      (when (or (nil? last-time)
-                (>= (.getTime now) (+ (.getTime last-time) interval)))
-        (generate-laser now entity)))))
+  (let [now (js/Date.)]
+   (doseq [entity (find-entities-by-component :weaponised)]
+     (let [weaponised (utils/find-component :weaponised entity)
+           laser (:laser weaponised)
+           interval (:every laser)
+           last-time (:last laser)]
+       (when (or (nil? last-time)
+                 (>= (.getTime now) (+ (.getTime last-time) interval)))
+         (generate-laser now entity))))))

 (defn check-win-condition
   []


ui: make get-requests close channel on error to make sure polling doesn't block forever if one request fails

--- src/cljs/lambdacd/ajax.cljs
+++ src/cljs/lambdacd/ajax.cljs
@@ -8,8 +8,10 @@
     (ac/GET url {:handler (fn [response]
                               (async/put! ch response)
                               (async/close! ch))
-                   :keywords? true
-                   :response-format :json})
+                 :error-handler (fn [response]
+                                  (async/close! ch))
+                 :keywords? true
+                 :response-format :json})
     ch))

 (defn POST [url data handler]


Show total count in client side

Show total count in client side

--- src/cljs/subman/search.cljs
+++ src/cljs/subman/search.cljs
@@ -36,7 +36,7 @@

 (defn result-list
   "Search result list"
-  [{:keys [query items counter]}]
+  [{:keys [query items counter total-count]}]
   (cond
    (> (count @items) 0) [:div.container.col-xs-12
                          [:div.search-result-list.list-group (map result-line @items)]]
@@ -50,26 +50,43 @@
                                [:a {:href "http://www.podnapisi.net/"
                                     :target "_blank"} "podnapisi.net"]
                                "."]
+                              [:p "Total indexed subtitles count: " @total-count]
                               [:a {:href "https://github.com/nvbn/subman"
                                    :target "_blank"}
                                [:i.fa.fa-github] " github"]]
    :else [:div.container.col-xs-12.info-box
           [:h2 "Nothing found for \"" @query "\""]]))

+(defn watch-to-query
+  "Watch to search query"
+  [query results counter]
+  (add-watch query :search-request
+             (fn [key ref old-value new-value]
+               (let [current (swap! counter inc)]
+                 (go (let [url (str "/api/search/?query=" new-value)
+                           response (<! (http/get url))]
+                       (when (= current @counter)
+                         (reset! results (read-string (:body response))))))))))
+
+(defn update-total-count
+  "Update total count value"
+  [total-count] (go (->> (http/get "/api/count/")
+                         <!
+                         :body
+                         read-string
+                         (reset! total-count))))
+
 (defn search-page
   "Search page view"
   [] (let [query (atom "")
            results (atom [])
-           counter (atom 0)]
-       (add-watch query :search-request
-                  (fn [key ref old-value new-value]
-                    (let [current (swap! counter inc)]
-                      (go (let [url (str "/api/search/?query=" new-value)
-                                response (<! (http/get url))]
-                            (when (= current @counter)
-                              (reset! results (read-string (:body response)))))))))
+           counter (atom 0)
+           total-count (atom 0)]
+       (watch-to-query query results counter)
+       (update-total-count total-count)
        (init-history query)
        [:div [search-box {:value query}]
         [result-list {:items results
                       :query query
-                      :counter counter}]]))
+                      :counter counter
+                      :total-count total-count}]]))


Fixed Windows dev env

Fixed Windows dev env

--- src/cljs/zest/searcher.cljs
+++ src/cljs/zest/searcher.cljs
@@ -15,9 +15,13 @@
                          (zest.core/get-binary-path "searcher")
                          (array path)
                          (js-obj
-                           "env" (js-obj
-                                   "PATH"
-                                   (.dirname jspath (.dirname jspath (.-__dirname js/window))))))]
+                           "env"
+                           (js-obj
+                             "PATH"
+                             (str
+                               (.dirname jspath (.dirname jspath (.-__dirname js/window)))
+                               (.-delimiter jspath)
+                               (.-PATH (.-env (.-process js/window)))))))]
     (reset! cur-searchers (assoc @cur-searchers path searcher))
     (reset! cur-searchers-lines (assoc @cur-searchers-lines path ch))
     (.on


Hide hover coordinates when on mobile

Hide hover coordinates when on mobile

--- src/cljs/zetawar/views.cljs
+++ src/cljs/zetawar/views.cljs
@@ -273,7 +273,7 @@

 (defn status-info [{:as view-ctx :keys [conn translate]}]
   (let [[hover-q hover-r] @(subs/hover-hex conn)]
-    [:p
+    [:p.hidden-xs.hidden-sm
      (translate :hover-tile-location)
      (if hover-q
        (str hover-q ", " hover-r)


Tweak hardocded resilience

Tweak hardocded resilience

--- src/clojush/meta_errors.clj
+++ src/clojush/meta_errors.clj
@@ -163,12 +163,12 @@
     (throw
      (Exception.
       ":print-history must be true for :resilience"))
-    (let [hist (take 10 (:history ind))]
+    (let [hist (take 20 (:history ind))]
       (if (< (count hist) 2)
         0
         (if (> (/ (count (distinct hist))
                   (count hist))
-               9/10)
+               3/4)
           0
           1)))))


added devcon to the list of public chats

--- src/status_im/ui/screens/discover/views.cljs
+++ src/status_im/ui/screens/discover/views.cljs
@@ -117,7 +117,11 @@
    {:name  "All about Ethereum"
     :topic "ethereum"
     :count 32
-    :color "#778CDC"}])
+    :color "#778CDC"}
+   {:name  "Devcon"
+    :topic "devcon"
+    :count 47
+    :color "#77DCC6"}])

 (defn navigate-to-public-chat [topic]
   (re-frame/dispatch [:create-new-public-chat topic]))


Rename :type to :name

Rename :type to :name

--- src/spec/cljc/mikron/compiler/core_spec_macro.cljc
+++ src/spec/cljc/mikron/compiler/core_spec_macro.cljc
@@ -10,10 +10,10 @@
     [options & fields]
     `(s/and (s/or ~@(when (empty? fields)
                       [:simple `(s/and keyword? (s/conformer vector))])
-                  :complex (s/and (s/cat :type    keyword?
+                  :complex (s/and (s/cat :name    keyword?
                                          :options (s/? (s/nilable (s/keys :opt-un ~options)))
                                          ~@fields)
-                                  (s/conformer (juxt :type
+                                  (s/conformer (juxt :name
                                                      #(or (:options %) {})
                                                      ~@(take-nth 2 fields)))))
             (s/conformer second))))


fix message sent state for audio and emoji messages (#13459)

--- src/status_im/ui/screens/chat/message/message.cljs
+++ src/status_im/ui/screens/chat/message/message.cljs
@@ -520,40 +520,41 @@
       [react/text-class {:style (style/status-text)}]
       (-> content :parsed-text peek :children))]]])

-(defmethod ->message constants/content-type-emoji
-  [{:keys [content current-public-key outgoing public? pinned in-popover? message-pin-enabled] :as message} {:keys [on-long-press modal]
-                                                                                :as   reaction-picker}]
-  (let [response-to (:response-to content)
-        show-timestamp? (reagent/atom false)]
-    (fn [] [message-content-wrapper message
-            [react/touchable-highlight (when-not modal
-                                         {:disabled      in-popover?
-                                          :on-press      (fn []
-                                                           (react/dismiss-keyboard!)
-                                                           (reset! show-timestamp? true))
-                                          :delay-long-press 100
-                                          :on-long-press (fn []
-                                                           (on-long-press
-                                                            (concat
-                                                             [{:on-press #(re-frame/dispatch [:chat.ui/reply-to-message message])
-                                                               :id       :reply
-                                                               :label    (i18n/label :t/message-reply)}
-                                                              {:on-press #(react/copy-to-clipboard (get content :text))
-                                                               :id       :copy
-                                                               :label    (i18n/label :t/sharing-copy-to-clipboard)}]
-                                                             (when message-pin-enabled [{:on-press #(pin-message message)
-                                                                                :label    (if pinned (i18n/label :t/unpin) (i18n/label :t/pin))}]))))})
-             [react/view (style/message-view-wrapper outgoing)
-              [message-timestamp message show-timestamp?]
-              [react/view (style/message-view message)
-               [react/view {:style (style/message-view-content)}
-                [react/view {:style (style/style-message-text outgoing)}
-                 (when (and (seq response-to) (:quoted-message message))
-                   [quoted-message response-to (:quoted-message message) outgoing current-public-key public? pinned])
-                 [react/text {:style (style/emoji-message message)}
-                  (:text content)]]
-                [message-status message]]]]]
-            reaction-picker])))
+(defmethod ->message constants/content-type-emoji []
+  (let [show-timestamp? (reagent/atom false)]
+    (fn [{:keys [content current-public-key outgoing public? pinned in-popover? message-pin-enabled] :as message}
+         {:keys [on-long-press modal]
+          :as   reaction-picker}]
+      (let [response-to (:response-to content)]
+        [message-content-wrapper message
+         [react/touchable-highlight (when-not modal
+                                      {:disabled      in-popover?
+                                       :on-press      (fn []
+                                                        (react/dismiss-keyboard!)
+                                                        (reset! show-timestamp? true))
+                                       :delay-long-press 100
+                                       :on-long-press (fn []
+                                                        (on-long-press
+                                                         (concat
+                                                          [{:on-press #(re-frame/dispatch [:chat.ui/reply-to-message message])
+                                                            :id       :reply
+                                                            :label    (i18n/label :t/message-reply)}
+                                                           {:on-press #(react/copy-to-clipboard (get content :text))
+                                                            :id       :copy
+                                                            :label    (i18n/label :t/sharing-copy-to-clipboard)}]
+                                                          (when message-pin-enabled [{:on-press #(pin-message message)
+                                                                                :label    (if pinned (i18n/label :t/unpin) (i18n/label :t/pin))}]))))})
+          [react/view (style/message-view-wrapper outgoing)
+           [message-timestamp message show-timestamp?]
+           [react/view (style/message-view message)
+            [react/view {:style (style/message-view-content)}
+             [react/view {:style (style/style-message-text outgoing)}
+              (when (and (seq response-to) (:quoted-message message))
+                [quoted-message response-to (:quoted-message message) outgoing current-public-key public? pinned])
+              [react/text {:style (style/emoji-message message)}
+               (:text content)]]
+             [message-status message]]]]]
+         reaction-picker]))))

 (defmethod ->message constants/content-type-sticker
   [{:keys [content from outgoing in-popover?]
@@ -607,28 +608,28 @@
                                    :id       :delete}]))))}]
    reaction-picker])

-(defmethod ->message constants/content-type-audio
-  [{:keys [outgoing] :as message}
-   {:keys [on-long-press modal]
-    :as   reaction-picker}]
+(defmethod ->message constants/content-type-audio []
   (let [show-timestamp? (reagent/atom false)]
-    (fn [] [message-content-wrapper message
-            [react/touchable-highlight
-             (when-not modal
-               {:on-long-press
-                (fn [] (on-long-press (if (and outgoing config/delete-message-enabled?)
-                                        [{:on-press #(re-frame/dispatch [:chat.ui/soft-delete-message message])
-                                          :label    (i18n/label :t/delete)
-                                          :id       :delete}]
-                                        [])))
-                :on-press (fn []
-                            (reset! show-timestamp? true))})
-             [react/view (style/message-view-wrapper (:outgoing message))
-              [message-timestamp message show-timestamp?]
-              [react/view {:style (style/message-view message) :accessibility-label :audio-message}
-               [react/view {:style (style/message-view-content)}
-                [message.audio/message-content message] [message-status message]]]]]
-            reaction-picker])))
+    (fn [{:keys [outgoing] :as message}
+         {:keys [on-long-press modal]
+          :as   reaction-picker}]
+      [message-content-wrapper message
+       [react/touchable-highlight
+        (when-not modal
+          {:on-long-press
+           (fn [] (on-long-press (if (and outgoing config/delete-message-enabled?)
+                                   [{:on-press #(re-frame/dispatch [:chat.ui/soft-delete-message message])
+                                     :label    (i18n/label :t/delete)
+                                     :id       :delete}]
+                                   [])))
+           :on-press (fn []
+                       (reset! show-timestamp? true))})
+        [react/view (style/message-view-wrapper (:outgoing message))
+         [message-timestamp message show-timestamp?]
+         [react/view {:style (style/message-view message) :accessibility-label :audio-message}
+          [react/view {:style (style/message-view-content)}
+           [message.audio/message-content message] [message-status message]]]]]
+       reaction-picker])))

 (defn contact-request-status-pending []
   [react/view {:style {:flex-direction :row}}


replace the current register view with a form asking for username and the password twice

--- src-cljs/bitfondue/core.cljs
+++ src-cljs/bitfondue/core.cljs
@@ -88,11 +88,27 @@
      [:input.form-control {:type "password" :id "passwordInput" :placeholder "Password"}]]
     [:button.btn.btn-primary {:type "submit"} "Login"]]])

+(def register-form
+  [:div.col-md-offset-3.col-md-6
+   [:h1 "Register"]
+   [:br]
+   [:form
+    [:fieldset.form-group
+     [:label {:for "usernameInput"} "Username"]
+     [:input.form-control {:type "email" :id "usernameInput" :placeholder "Your username please."}]]
+    [:fieldset.form-group
+     [:label {:for "passwordInput"} "Password"]
+     [:input.form-control {:type "password" :id "passwordInput" :placeholder "Password"}]]
+    [:fieldset.form-group
+     [:label {:for "passwordInputRepeat"} "Password"]
+     [:input.form-control {:type "password" :id "passwordInputRepeat" :placeholder "Password again"}]]
+    [:button.btn.btn-primary {:type "submit"} "Login"]]])
+
 (defn login []
   [layout [:div.row login-form]])

 (defn register []
-  [layout [:h1 "Register"]])
+  [layout [:div.row register-form]])

 (defn not-found []
   [layout [:h1 "404 - Page not found"]])


styling

styling

--- rn-app/src/cljs/meo/ui/settings/health.cljs
+++ rn-app/src/cljs/meo/ui/settings/health.cljs
@@ -6,30 +6,49 @@
             [re-frame.core :refer [subscribe]]
             [cljs.tools.reader.edn :as edn]))

+(defn start-watching [])
+
 (defn import-item [click label icon-name]
   (let [theme (subscribe [:active-theme])]
     (fn [click label icon-name]
       (let [item-bg (get-in c/colors [:text-bg @theme])
             text-color (get-in c/colors [:text @theme])]
-        [touchable-opacity {:on-press click
-                            :style    {:margin-top       3
-                                       :padding          16
-                                       :width            "100%"
-                                       :background-color item-bg
-                                       :justify-content  "flex-start"
-                                       :align-items      "center"
-                                       :height           50
-                                       :flex-direction   "row"}}
-         [view {:style {:width      44
-                        :text-align :center}}
-          [icon {:name  icon-name
+        [view {:style {:margin-top       3
+                       :width            "100%"
+                       :background-color item-bg
+                       :justify-content  "space-between"
+                       :align-items      "center"
+                       :flex-direction   "row"}}
+         [touchable-opacity {:on-press click
+                             :style    {:text-align       :left
+                                        :display          :flex
+                                        :flex-direction   :row
+                                        :margin-top       3
+                                        :padding          16
+                                        :background-color item-bg
+                                        :justify-content  "start"
+                                        :align-items      :center
+                                        :height           50}}
+          [view {:style {:width      44
+                         :text-align :center}}
+           [icon {:name  icon-name
+                  :size  20
+                  :style {:color      text-color
+                          :text-align :center}}]]
+          [text {:style {:color       text-color
+                         :font-size   20
+                         :margin-left 20}}
+           label]]
+         [touchable-opacity {:on-press click
+                             :style    {:width       80
+                                        :height      50
+                                        :display     :flex
+                                        :align-items :center}}
+          [icon {:name  "refresh"
                  :size  20
                  :style {:color      text-color
-                         :text-align :center}}]]
-         [text {:style {:color       text-color
-                        :font-size   20
-                        :margin-left 20}}
-          label]]))))
+                         :text-align :center
+                         :padding    16}}]]]))))

 (defn health-settings [local put-fn]
   (let [weight-fn (fn [n] #(put-fn [:healthkit/weight {:n n}]))


Update tools-deps to 1.11.1.1113

Update tools-deps to 1.11.1.1113