Adding Coyote onset detector ugen to exceptions which can take ar ugens

--- src/overtone/sc/machinery/ugen/specs.clj
+++ src/overtone/sc/machinery/ugen/specs.clj
@@ -182,6 +182,9 @@
                       (= :kr (:rate-name bad-input)))
                  ;; Special case Amplitude ugen which may have ar ugens plugged into it
                  (and (= "Amplitude" (:name ugen))
+                      (= :ar (:rate-name bad-input)))
+                 ;; Special case Coyote ugen which may have ar ugens plugged into it
+                 (and (= "Coyote" (:name ugen))
                       (= :ar (:rate-name bad-input)))
                  ;; Special case Pitch ugen which may have ar ugens plugged into it
                  (and (= "Pitch" (:name ugen))


refactored fuzzy matches in preparation for Clojure 1.8

--- src/chat/client/views/new_message.cljs
+++ src/chat/client/views/new_message.cljs
@@ -14,12 +14,16 @@
 (defn tee [x]
   (println x) x)

+
 (defn fuzzy-matches?
-  [s m]
+  [s m] ; string query
   ; TODO: make this fuzzier? something like interleave with .* & re-match?
-  (letfn [(normalize [s]
-            (-> (.toLowerCase s) (string/replace #"\s" "")))]
-    (not= -1 (.indexOf (normalize s) (normalize m)))))
+  (let [normalize (fn [s]
+                     (-> (.toLowerCase s)
+                         (string/replace #"\s" "")))
+        includes? (fn [string sub]
+                    (not= -1 (.indexOf string sub)))]
+    (includes? (normalize s) (normalize m))))

 (defn simple-matches?
   [m s]


Paragraph in hiccup form

Paragraph in hiccup form

--- src/clj/com/hypirion/subtex/hiccup.clj
+++ src/clj/com/hypirion/subtex/hiccup.clj
@@ -1,6 +1,7 @@
 (ns com.hypirion.subtex.hiccup
   (:require [com.hypirion.rexf :as rexf])
-  (:import (java.util ArrayList)))
+  (:import (com.hypirion.rexf ReducerFactory Reducer)
+           (java.util ArrayList)))

 (defn vectorize-invoke
   [name vect]
@@ -24,6 +25,8 @@
 (def sub    (vectorize-invoke "\\textsubscript" :sub))
 (def sup    (vectorize-invoke "\\textsuperscript" :sup))

+;; hrule, footnote, texttt (?)
+
 (def common-invokes
   (comp h1 h2 h3 h4 strong em sub sup))

@@ -32,7 +35,7 @@
     (vreset! subrf ::none)
     val))

-(defn none? [val] ;; inline
+(defn none? [val] ;; todo: inline
   (identical? ::none val))

 (def item-to-li
@@ -92,3 +95,30 @@
                                      (identical? (first %) :li))
                                (:value input))])
           (rf res input)))))))
+
+(def ^:private text-value
+  (rexf/stateless-xf
+   (fn [rf]
+     (fn
+       ([] (rf))
+       ([res] (rf res))
+       ([res input]
+        (cond (identical? :text (:type input)) (rf res (:value input))
+              (identical? :para-end (:type input)) res
+              :else (rf res input)))))))
+
+(defn paragraphiphy
+  [rf]
+  (reify ReducerFactory
+    (init [_]
+      (let [rf' (rexf/init rf)
+            reinit-rf (text-value rf)]
+        (reify clojure.lang.IFn
+          (invoke [_] (rf'))
+          (invoke [_ res] (rf' res))
+          (invoke [_ res input]
+            (cond (identical? :text (:type input)) (rf res [:p (:value input)])
+                  (identical? :para-end (:type input)) res
+                  :else (rf res input)))
+          Reducer
+          (reinit [_] (rexf/init reinit-rf)))))))


add album image and link to album on now-playing view

--- src/cljs/cljspazzer/client/player.cljs
+++ src/cljs/cljspazzer/client/player.cljs
@@ -126,12 +126,15 @@
             title (t "title_canonical")
             track-num (t "track")
             year (t "year")
-            artist-nav (utils/format "#/artist/%s" (utils/encode artist))
+            artist-nav (utils/format "#/artists/%s" (utils/encode artist))
             album-nav (utils/format "%s/albums/%s" artist-nav (utils/encode album))

             album-image (albums/mk-album-image artist t)
             artist-image (artists/mk-artist-image artist true)
             track-heading (utils/format "%s - %s (%s)" artist title year)]
-        (html [:div
-               (if (not (nil? artist))
-                 [:h1 track-heading])])))))
+        (html (if (not (nil? artist))
+                [:div
+                 [:a {:href album-nav}
+                  [:img {:src album-image}]]
+                 [:span track-heading]
+               ]))))))


Add bubbles images around the invitation company logo.


if :boot-stem1 exists, use it to create stem

--- src/babel/espanol/morphology/verbs.clj
+++ src/babel/espanol/morphology/verbs.clj
@@ -402,7 +402,10 @@
                        (throw (Exception. (str "Can't regex-find on non-string: " infinitive " from word: " word)))))
         er-type (re-find #"er$" infinitive)
         ir-type (re-find #"ir$" infinitive)
-        stem (string/replace infinitive #"[iae]r$" "")
+        stem (cond (get-in word [:boot-stem1]) ;; if there is a :boot-stem1, use that..
+                   (get-in word [:boot-stem1])
+                   true ;; otherwise, pattern-match on the infinitive.
+                   (string/replace infinitive #"[iae]r$" ""))
         last-stem-char-is-i (re-find #"ir$" infinitive)
         last-stem-char-is-e (re-find #"er$" infinitive)
         is-care-or-gare? (re-find #"[cg]ar$" infinitive)


[fix] add missing account schema in base schemas

Signed-off-by: Eric Dvorsak <96f164ad4d9b2b0dacf8ebee2bb1eeb3aa69adf1@status.im>

--- src/status_im/data_store/realm/schemas/base/core.cljs
+++ src/status_im/data_store/realm/schemas/base/core.cljs
@@ -44,7 +44,8 @@

 (def v12 [network/v1
           bootnode/v4
-          extension/v12])
+          extension/v12
+          account/v12])

 (def v13 [network/v1
           bootnode/v4


Formatting cleanup in tests.

Formatting cleanup in tests.

--- test/themis/core_test.clj
+++ test/themis/core_test.clj
@@ -10,7 +10,6 @@
                       (fn [_payload value opts]
                         (when (not= value "Alice")
                           {:error ":name not Alice"}))]]]
-
     (testing "Alice's name should be Alice."
       (is (= (core/validation alice alice-rules) {[:name] nil})))
     (testing "Bob's name should not be Alice."
@@ -21,11 +20,13 @@
   (let [paul {:name {:first "Paul", :last "deGrandis"}
               :has-pet true
               :pets ["walter"]}
-        paul-rules [[[:name :first] [[presence {:response {:text "First name is not there"}}]
+        paul-rules [[[:name :first]
+                     [[presence {:response {:text "First name is not there"}}]
                                      (fn [t-map data-point opt-map](Thread/sleep 500)(and (= data-point "Paul")
                                                                                {:a 1 :b 2}))]]
-                    [[:pets 0] [(from-predicate preds/longer-than? 20 "Too short; Needs to be longer than 20")]]]
-        paul-expected-validation {[:name :first]  '(nil  {:a 1, :b 2}), [:pets 0] "Too short; Needs to be longer than 20"}]
+                    [[:pets 0]
+                     [(from-predicate preds/longer-than? 20 "Too short; Needs to be longer than 20")]]]
+        paul-expected-validation {[:name :first] '(nil  {:a 1, :b 2}), [:pets 0] "Too short; Needs to be longer than 20"}]
     (testing "Does validation work on paul-rules?"
       (is (= (core/validation paul paul-rules)
              paul-expected-validation)))


Remove obsolete test assertions

Remove obsolete test assertions

--- test-cljs/frontend/components/test_documentation.cljs
+++ test-cljs/frontend/components/test_documentation.cljs
@@ -48,11 +48,6 @@
   (let [test-doc (:continuous-deployment-with-heroku test-docs)
         test-node (goog.dom/htmlToDocumentFragment "

")]
     (om/root documentation/docs-subpage test-doc {:target test-node})
-    (is (= "Continuous Deployment with Heroku"
-           (-> test-node
-               (sel1 "h1")
-               utils/text))
-        "Title renders")
     (is (re-find #"Last Updated"
                  (-> test-node
                      (sel1 "p")
@@ -73,12 +68,6 @@
   (let [test-doc (:troubleshooting-ruby test-docs)
         om-component (om/build documentation/docs-subpage test-doc)
         rendered-component (test-utils/render-into-document om-component)]
-    (is (= "Troubleshooting Ruby"
-           (-> rendered-component
-               om/get-node
-               (sel1 "h1")
-               utils/text))
-        "Title renders")
     (is (= "Do you need the latest version of Bundler?"
            (-> rendered-component
                om/get-node
@@ -124,11 +113,6 @@
         version-str "Git version: {{ versions.git }}"
         versions-str "Ruby versions:\n {{versions.ruby_versions | code-list}}\n"
         api-str "Recent builds: \n {{ api_data.recent_builds | api-endpoint }}\n"]
-    (is (= "Hey There!"  (-> markdown-str
-                             md->node
-                             (sel1 "h1")
-                             utils/text))
-        "Markdown renders")
     (is (= asset-path (-> asset-str
                           md->node
                           (sel1 "img")


Initial work on investigation action data migration

--- src/ctia/task/migration/migrations.clj
+++ src/ctia/task/migration/migrations.clj
@@ -2,7 +2,8 @@
   (:require [clj-momo.lib.clj-time
              [coerce :as time-coerce]
              [core :as time-core]]
-            [clojure.set :as set]))
+            [clojure.set :as set]
+            [cheshire.core :as json]))

 (def add-groups
   "set a document group to [\"tenzin\"] if unset"
@@ -149,6 +150,85 @@
                (update :incident_time simplify-incident-time))
            doc))))

+;; Add new investigation fields
+
+(defn transient-id? [id]
+  (and (string? id)
+       (re-find #"\Atransient" (str id))))
+
+(defn object-id [doc]
+  (let [id (get doc :id)]
+    (when (not (transient-id? id))
+      id)))
+
+(defn read-actions [investigation]
+  (let [actions (get investigation :actions)]
+    (if (string? actions)
+      (json/parse-string actions true)
+      [])))
+
+(def empty-action-data
+  {:object_ids #{}
+   :investigated_observables #{}
+   :targets #{}})
+
+(defn merge-action-data
+  ([] empty-action-data)
+  ([m] m)
+  ([m1 m2]
+   (merge m1 {:object_ids (into (get m1 :object_ids)
+                                (get m2 :object_ids))
+              :investigated_observables (into (get m1 :investigated_observables)
+                                              (get m2 :investigated_observables))
+              :targets (into (get m1 :targets)
+                             (get m2 :targets))})))
+
+(defmulti derive-action-data
+  (fn [action]
+    (get action :type))
+  :default ::default)
+
+(defmethod derive-action-data ::default [_]
+  empty-action-data)
+
+(defmethod derive-action-data "collect" [action]
+  (let [investigated-observables (into #{}
+                                       (map (fn [{:keys [type value]}]
+                                              (str type ":" value)))
+                                       (:result action))]
+    (assoc empty-action-data :investigated_observables investigated-observables)))
+
+(defmethod derive-action-data "investigate" [action]
+  (let [data (get-in action [:result :data])]
+    (transduce
+     (comp (map :data)
+           (mapcat vals)
+           (mapcat :docs))
+     (fn
+       ([result] result)
+       ([result doc]
+        (let [result (if-some [object-id (object-id doc)]
+                       (update result :object_ids conj object-id)
+                       result)
+              result (update result :targets into (get doc :targets))]
+          result)))
+     {:object_ids #{}
+      :investigated_observables []
+      :targets #{}}
+     data)))
+
+(defn migrate-action-data [investigation]
+  (transduce (map derive-action-data)
+             merge-action-data
+             (merge investigation empty-action-data)
+             (read-actions investigation)))
+
+(def migrate-action-data
+  (map (fn [{entity-type :type :as doc}]
+         (if (= entity-type "investigation")
+           (migrate-action-data doc)
+           doc))))
+
 (def available-migrations
   {:identity identity
    :__test (map #(assoc % :groups ["migration-test"]))


Provide a diff message when a sub wasn't run

--- src/day8/re_frame/trace/view/subs.cljs
+++ src/day8/re_frame/trace/view/subs.cljs
@@ -152,7 +152,8 @@

 (def no-prev-value-msg [:p {:style {:font-style "italic"}} "No previous value exists to diff"])
 (def unchanged-value-msg [:p {:style {:font-style "italic"}} "Subscription value is unchanged"])
-(def not-run-msg [rc/label :style {:font-style "italic"} :label "Subscription not run, so no value produced."])
+(def sub-not-run-msg [:p {:style {:font-style "italic"}} "Subscription not run, so no diff is available"])
+(def not-run-yet-msg [rc/label :style {:font-style "italic"} :label "Subscription not run yet, so no value is available"])

 (defn pod [{:keys [id layer path open? diff?] :as pod-info}]
   (let [render-diff?    (and open? diff?)
@@ -182,7 +183,7 @@
                                                [components/simple-render
                                                 main-value
                                                 ["sub-path" path]]
-                                               not-run-msg
+                                               not-run-yet-msg
                                                )]]))]
                             [animated/component
                              (animated/v-box-options {:enter-animation "accordionVertical"
@@ -190,6 +191,7 @@
                                                       :duration        animation-duration})
                              (when render-diff?
                                (let [diffable?        (and value? previous-value?)
+                                     not-run?         (= (:order pod-info) [:sub/not-run])
                                      previous-value   (:previous-value pod-info)
                                      value            (:value pod-info)
                                      unchanged-value? (get-in pod-info [:sub/traits :unchanged?] false)
@@ -210,6 +212,7 @@
                                               :style {:overflow-x "auto"
                                                       :overflow-y "hidden"}
                                               :children [(cond
+                                                           not-run? sub-not-run-msg
                                                            unchanged-value? unchanged-value-msg
                                                            diffable? [components/simple-render
                                                                       diff-before
@@ -230,6 +233,7 @@
                                               :style {:overflow-x "auto"
                                                       :overflow-y "hidden"}
                                               :children [(cond
+                                                           not-run? sub-not-run-msg
                                                            unchanged-value? unchanged-value-msg
                                                            diffable? [components/simple-render
                                                                       diff-after


use different database for tests

use different database for tests

--- test/server/daveconservatoire/server/test_shared.cljs
+++ test/server/daveconservatoire/server/test_shared.cljs
@@ -7,5 +7,5 @@
      :connection {:host     "localhost"
                   :user     "root"
                   :password "root"
-                  :database "dcsite"
+                  :database "dcsite-pre"
                   :port     8889}}))


Update views.cljs

Update views.cljs

Signed-off-by: Churikova Tetiana <df59d4ef10565572befc1f25db27f19bd387b29a@gmail.com>

--- src/status_im/ui/screens/pairing/views.cljs
+++ src/status_im/ui/screens/pairing/views.cljs
@@ -151,7 +151,7 @@

 (defn info-section []
   [react/view {:style styles/info-section}
-   [react/touchable-highlight {:on-press #(.openURL ^js react/linking "https://status.im/tutorials/pairing.html")}
+   [react/touchable-highlight {:on-press #(.openURL ^js react/linking "https://status.im/user_guides/pairing_devices.html")}
     [react/text {:style styles/info-section-text} (i18n/label :t/learn-more)]]])

 (defn installations-list [installations]


Add some tests for bigint/bigdec

Add some tests for bigint/bigdec


formatted

formatted

--- src/taggie_server/routes/user_routes.clj
+++ src/taggie_server/routes/user_routes.clj
@@ -1,18 +1,18 @@
 (ns taggie-server.routes.user-routes
-	(:use compojure.core)
-	(:require
-		[liberator.core :as liberator]
-		[taggie-server.models.user :as user]))
+    (:use compojure.core)
+    (:require
+        [liberator.core :as liberator]
+        [taggie-server.models.user :as user]))

 (defn- register-user [ctx]
-	(let [new-user (get-in ctx [:request :params])]
+    (let [new-user (get-in ctx [:request :params])]
         {:user (user/save new-user)}))

 (liberator/defresource register-user-resource
-	:available-media-types ["application/json"]
-	:allowed-methods [:post]
-	:post! register-user
-	:handle-created (fn [ctx] (get-in ctx [:user])))
+    :available-media-types ["application/json"]
+    :allowed-methods [:post]
+    :post! register-user
+    :handle-created (fn [ctx] (get-in ctx [:user])))

 (defroutes user-routes
-	(POST "/user" [] register-user-resource))
+    (POST "/user" [] register-user-resource))


Added defservice macro to make gen-class integration easier

--- lib/compojure/http/http.clj
+++ lib/compojure/http/http.clj
@@ -268,12 +268,12 @@

 ;;;; Servlet creation ;;;;

-(defn- http-service
+(defn http-service
   "Represents the service method called by a HttpServlet."
-  [object request response handlers]
+  [#^HttpServlet this request response handlers]
   (.setCharacterEncoding response "UTF-8")
   (apply-http-handler handlers
-                      (.getServletContext object)
+                      (.getServletContext this)
                       request
                       response))
 (defn servlet
@@ -303,3 +303,11 @@
     `(do (defonce ~name
            (proxy [HttpServlet] []))
          (update-servlet ~name ~doc ~@handlers))))
+
+(defmacro defservice
+  "Defines a 'MyClass-service' method suitable for being called by a
+  HttpServlet class created by genclass."
+  [cname & handlers]
+  `(defn ~(symbol (str cname "-service"))
+   ~'[this request response]
+     (http-service ~'this ~'request ~'response (list ~@handlers))))


Added more comments to http.clj, serve-file now defaults to 'index.*' for directories

--- lib/compojure/http/http.clj
+++ lib/compojure/http/http.clj
@@ -1,4 +1,30 @@
-;; HTTP handler library for Compojure
+;; compojure.http
+;;
+;; Compojure library for constructing HTTP servlet proxy objects.
+;;
+;; Here's a small taste of the syntax:
+;;
+;;   (defservlet example
+;;     "An example servlet that contains a bit of everything."
+;;     (GET "/"
+;;       "Hello World")
+;;     (GET "/:name"
+;;       (str "Hello " (route :name)))
+;;     (GET "/image"
+;;       (file "public/image.png"))
+;;     (GET "/error"
+;;       [500 "Error 500"])
+;;     (POST "/mesg"
+;;       (redirect-to "/"))
+;;     (GET "/header"
+;;       [{"X-Fortune" "Be prepared!"}
+;;        "Custom X-Header"])
+;;     (PUT "/:var"
+;;       (dosync
+;;         (commute session assoc :var (route :var)))
+;;     (ANY "/*"
+;;       (page-not-found))
+
 (ns compojure.http
   (:use (compojure control
                    file-utils
@@ -185,15 +211,27 @@
   ([]         (page-not-found "public/404.html"))
   ([filename] [404 (file filename)]))

+(defn- find-index-file
+  "Search the directory for index.*"
+  [dir]
+  (first
+    (filter
+     #(re-matches #"index\\..*" (.toLowerCase (.getName %)))
+      (.listFiles dir))))
+
 (defn serve-file
-  "Attempts to serve up a static file from a directory. Nil is returned if the
-  file does not exist."
+  "Attempts to serve up a static file from a directory, which defaults to
+  './public'. Nil is returned if the file does not exist. If the file is a
+  directory, the function looks for a file in the directory called 'index.*'."
   ([path]
     (serve-file "public" path))
   ([root path]
-    (let [static-file (file root path)]
-      (if (.isFile static-file)
-        static-file))))
+    (let [filepath (file root path)]
+      (cond
+        (.isFile filepath)
+          filepath
+        (.isDirectory filepath)
+          (find-index-file filepath)))))

 ;;;; Servlet creation ;;;;

@@ -209,7 +247,7 @@
                           response))))

 (defmacro defservlet
-  "Shortcut for (def name (servlet handlers))"
+  "Shortcut for (def name doc? (servlet handlers))"
   [name doc & handlers]
   (if (string? doc)
     `(def


Add benchmark to compare to vary-meta

Add benchmark to compare to vary-meta

--- scripts/benchmarks.clj
+++ scripts/benchmarks.clj
@@ -219,3 +219,9 @@
     300000
     (vector (meta data))
     (select META data)))
+
+(let [data (with-meta {:x 1} {:my :metadata})]
+  (run-benchmark "vary metadata"
+    300000
+    (vary-meta data assoc :y 2)
+    (setval [META :y] 2 data)))


move through metadata nodes when upgrading artifacts (closes #67).

--- src/leiningen/ancient/artifact/zip.clj
+++ src/leiningen/ancient/artifact/zip.clj
@@ -27,18 +27,33 @@

 ;; ## Upgrade

+(defn- move-through-meta
+  [zloc]
+  (if (and zloc (#{:meta :meta*} (z/tag zloc)))
+    (recur (some-> zloc z/down z/right))
+    zloc))
+
+(defn- move-up-through-meta
+  [zloc]
+  (let [zloc (z/up zloc)]
+    (if (and zloc (#{:meta :meta*} (z/tag zloc)))
+      (recur zloc)
+      zloc)))
+
 (defn- move-to-index
   [zloc p]
-  (nth
-    (->> (iterate z/right zloc)
-         (remove #(= (z/tag %) :uneval)))
-    p))
+  (move-through-meta
+    (nth
+      (->> (iterate z/right zloc)
+           (remove #(= (z/tag %) :uneval)))
+      p)))

 (defn- move-to-value
   [zloc p]
-  (when-let [floc (z/find-value zloc p)]
-    (when-let [floc (z/right floc)]
-      floc)))
+  (some-> zloc
+          (z/find-value p)
+          (z/right)
+          (move-through-meta)))

 (defn- move-to-value-or-index
   "Move within a zipper. A keyword prompts descend into a map, a number moves
@@ -59,12 +74,14 @@
   [loc path new-version-string]
   {:pre [(integer? (last path))]}
   (or
-    (when-let [vloc (some-> (move-path loc path) z/down)]
+    (when-let [vloc (some-> (move-path loc path)
+                            z/down)]
       (-> (->> (if-let [sloc (z/right vloc)]
                  (z/replace sloc new-version-string)
                  (z/insert-right vloc new-version-string))
-               (iterate z/up))
-          (nth (inc (count path)))
+               (z/up)
+               (iterate move-up-through-meta))
+          (nth (count path))
           z/down))
     loc))


Fix exception on `lein figwheel` (#17)

Fix exception on `lein figwheel` (#17)

Exception Unmatched delimiter: ]

--- src/leiningen/new/devcards/project.clj
+++ src/leiningen/new/devcards/project.clj
@@ -18,7 +18,7 @@
                  [cljsjs/react-dom-server "15.0.2-0"]]

                  #_[org.omcljs/om "0.9.0"]
-                 #_[reagent "0.5.1"]]
+                 #_[reagent "0.5.1"]

   :plugins [[lein-figwheel "0.5.3-1"]
             [lein-cljsbuild "1.1.3" :exclusions [org.clojure/clojure]]]


Refactor

Refactor

--- backend/src/akvo/lumen/endpoint/collection.clj
+++ backend/src/akvo/lumen/endpoint/collection.clj
@@ -10,15 +10,13 @@
             [integrant.core :as ig]))

 (defn all [auth-service tenant-conn]
-  (let [collections (collection/all tenant-conn (:auth-collections-set auth-service))]
-    (log/error :collections collections)
-    (lib/ok collections)))
+  (lib/ok (collection/all tenant-conn (:auth-collections-set auth-service))))

 (defn routes [{:keys [tenant-manager] :as opts}]
   ["/collections"
    ["" {:get {:handler (fn [{tenant :tenant
                              auth-service :auth-service}]
-                       (all auth-service (p/connection tenant-manager tenant)))}
+                         (all auth-service (p/connection tenant-manager tenant)))}
         :post {:responses {200 {}}
              :parameters {:body map?}
              :handler (fn [{tenant :tenant


Remove unnecessary let

Remove unnecessary let

--- modules/reitit-core/src/reitit/core.cljc
+++ modules/reitit-core/src/reitit/core.cljc
@@ -378,9 +378,8 @@
        (route-names [_]
          names)
        (match-by-path [_ path]
-         (let [slashed-path (ensure-slash path)]
-           (or (match-by-path static-router path)
-               (match-by-path wildcard-router path))))
+         (or (match-by-path static-router path)
+             (match-by-path wildcard-router path)))
        (match-by-name [_ name]
          (or (match-by-name static-router name)
              (match-by-name wildcard-router name)))


Polish code

Polish code

--- modules/reitit-ring/src/reitit/ring.cljc
+++ modules/reitit-ring/src/reitit/ring.cljc
@@ -122,19 +122,18 @@
   "
   ([] (redirect-trailing-slash-handler {:method :both}))
   ([{:keys [method]}]
-   (let [redirect-handler (fn redirect-handler [request]
-                            (let [uri (:uri request)
-                                  status (if (= (:request-method request) :get) 301 308)
-                                  maybe-redirect (fn maybe-redirect [path]
-                                                   (if (r/match-by-path (::r/router request) path)
-                                                     {:status status
-                                                      :headers {"Location" path}
-                                                      :body ""}))]
-                              (if (str/ends-with? uri "/")
-                                (if (not= method :add)
-                                  (maybe-redirect (subs uri 0 (-> uri count dec))))
-                                (if (not= method :strip)
-                                  (maybe-redirect (str uri "/"))))))]
+   (letfn [(maybe-redirect [request path]
+             (if (r/match-by-path (::r/router request) path)
+               {:status (if (= (:request-method request) :get) 301 308)
+                :headers {"Location" path}
+                :body ""}))
+           (redirect-handler [request]
+             (let [uri (:uri request)]
+               (if (str/ends-with? uri "/")
+                 (if (not= method :add)
+                   (maybe-redirect request (subs uri 0 (-> uri count dec))))
+                 (if (not= method :strip)
+                   (maybe-redirect request (str uri "/"))))))]
      (fn
        ([request]
         (redirect-handler request))


Small fixes.

Small fixes.

--- examples/pingpong.clj
+++ examples/pingpong.clj
@@ -23,7 +23,7 @@
       (when i
         (>! out i)
         (recur (<! in))))
-    ;; Note that we pass through the supervisor peer and new channels
+    ;; Note that we pass through the supervisor, peer and new channels
     [S peer [new-in new-out]]))

 ;; this is useful to track messages, so each peer should have a unique id
@@ -37,6 +37,7 @@
                               ;; we could also pick the transit middleware
                               #_transit))

+;; we need to start the peer to open the socket
 (<?? S (peer/start server))


feat: capture the URL of images that fail

ImageIO fails sometimes but standard IMageIO exceptions don't have a
description of their inputs

--- src/net/reborg/applenews_api/image.clj
+++ src/net/reborg/applenews_api/image.clj
@@ -38,13 +38,17 @@

 (defn ^bytes adjust-size [url]
   (letfn [(f [is os]
-            (let [image (ImageIO/read is)
-                  width (.getWidth image)
-                  height (.getHeight image)]
-              (-> (if (and (resize-thumbnail?) (or (< width 600) (< height 400)))
-                    (Scalr/resize image org.imgscalr.Scalr$Mode/AUTOMATIC (thumbnail-resize-width) (thumbnail-resize-height) (make-array BufferedImageOp 0))
-                    image)
-                  (ImageIO/write (extension url) os)
-                  ; (ImageIO/write (extension url) (FileOutputStream. "resized-700-420.jpg"))
-                  )))]
+            (try (let [image (ImageIO/read is)
+                       width (.getWidth image)
+                       height (.getHeight image)]
+                   (-> (if (and (resize-thumbnail?) (or (< width 600) (< height 400)))
+                         (Scalr/resize image org.imgscalr.Scalr$Mode/AUTOMATIC (thumbnail-resize-width) (thumbnail-resize-height) (make-array BufferedImageOp 0))
+                         image)
+                       (ImageIO/write (extension url) os)
+                       ; (ImageIO/write (extension url) (FileOutputStream. "resized-700-420.jpg"))
+                       ))
+                 (catch Exception e
+                   (throw (ex-info "Failed adjusting size"
+                                   {:url url :in ::adjust-size}
+                                   e)))))]
     (bbytes/with-url url f)))


remove debug code

remove debug code

--- frontend/components/build_head.cljs
+++ frontend/components/build_head.cljs
@@ -201,7 +201,7 @@
                [:th "Started"]
                [:td (om/build common/updating-duration {:start (:start_time build)} {:opts {:formatter datetime/time-ago}}) " ago"]]
               [:tr
-               [:th "Hello"]
+               [:th "Trigger"]
                [:td (build-model/why-in-words build)]
                [:th "Duration"]
                [:td (if (build-model/running? build)


implement defonce macro

implement defonce macro

--- src/clj/cljs/core.clj
+++ src/clj/cljs/core.clj
@@ -58,6 +58,10 @@
   memfn
   when when-first when-let when-not while
   cond-> cond->> as-> some-> some->>])
+
+(defmacro defonce [x init]
+  `(when-not (exists? ~x)
+     (def ~x ~init)))

 (defmacro ^{:private true} assert-args [fnname & pairs]
   `(do (when-not ~(first pairs)


use the last column segment, appears to be more accurate

--- src/clj/cljs/repl.clj
+++ src/clj/cljs/repl.clj
@@ -176,7 +176,7 @@
            ;; source maps are 0 indexed for columns
            ;; multiple segments may exist at column
            ;; just take first
-           (first
+           (last
              (if-let [mapping (get columns (dec column))]
                mapping
                (second (first columns))))


allow excplicit user headers to override default derived headers

--- src/clj_http/core.clj
+++ src/clj_http/core.clj
@@ -35,14 +35,14 @@
                          :put    (HttpPut. http-url)
                          :post   (HttpPost. http-url)
                          :delete (HttpDelete. http-url))]
-        (doseq [[header-n header-v] headers]
-          (.addHeader http-req header-n header-v))
         (if (and content-type character-encoding)
           (.addHeader http-req "Content-Type"
                       (str content-type "; charset=" character-encoding)))
         (if (and content-type (not character-encoding))
           (.addHeader http-req "Content-Type" content-type))
         (.addHeader http-req "Connection" "close")
+        (doseq [[header-n header-v] headers]
+          (.addHeader http-req header-n header-v))
         (if body
           (let [http-body (ByteArrayEntity. body)]
             (.setEntity #^HttpEntityEnclosingRequest http-req http-body)))


clojar version should at least be non-whitespace

--- src/clojars/maven.clj
+++ src/clojars/maven.clj
@@ -49,7 +49,7 @@
 (defn snapshot-pom-file [{:keys [jar_name version] :as jar}]
   (let [metadata-file (io/file (directory-for jar) "maven-metadata.xml")
         snapshot (snapshot-version metadata-file)
-        filename (format "%s-%s-%s.pom" jar_name (re-find #".*(?=-SNAPSHOT$)" version) snapshot)]
+        filename (format "%s-%s-%s.pom" jar_name (re-find #"\S+(?=-SNAPSHOT$)" version) snapshot)]
     (io/file (directory-for jar) filename)))

 (defn jar-to-pom-map [{:keys [jar_name version] :as jar}]


CMR-2482: Updated comment.

CMR-2482: Updated comment.

--- system-int-test/test/cmr/system_int_test/search/cleanup_all_revisions_test.clj
+++ system-int-test/test/cmr/system_int_test/search/cleanup_all_revisions_test.clj
@@ -17,9 +17,10 @@
 (use-fixtures :each (ingest/reset-fixture {"provguid1" "PROV1"
                                            "provguid2" "PROV2"}))

-;; TODO: force deleted metadata-db collection cannot be deleted correctly in elasticsearch right now,
-;; as we can't reliably figure out what the transaction-id indexer used to populate the elasticsearch
-;; index _version. We would have to pass the transaction-id as part of the event message.
+;; This test is commented out due to CMR-2500.
+;; Force deleted metadata-db collection cannot be deleted correctly in elasticsearch right now,
+;; as we can't reliably figure out what the transaction-id indexer used to populate the
+;; elasticsearch index _version.
 #_(deftest cleanup-all-revisions-test
   (let [umm-c (dc/collection {:entry-title "coll1"})
         coll1s (doall (for [n (range 12)]


CMR-1199: Added tests to ensure that successful validations don't get xml or json response bodies

--- system-int-test/test/cmr/system_int_test/ingest/collection_validation_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/collection_validation_test.clj
@@ -27,6 +27,19 @@
       (is (= [400 ["Line 1 - cvc-complex-type.2.3: Element 'Collection' cannot have character [children], because the type's content type is element-only."
                    "Line 1 - cvc-complex-type.2.4.b: The content of element 'Collection' is not complete. One of '{ShortName}' is expected."]]
              [status errors])))))
+
+;; Verify that successful validation requests do not get an xml or json response body
+(deftest successful-validation-with-accept-header-test
+  (testing "json"
+    (let [concept (dc/collection-concept {})
+          response-map (select-keys (ingest/validate-concept concept {:accept-format :json :raw? true})
+                                   [:status :body])]
+      (is (= {:status 200 :body ""} response-map))))
+  (testing "xml"
+    (let [concept (dc/collection-concept {})
+          response-map (select-keys (ingest/validate-concept concept {:accept-format :json :raw? true})
+                                   [:status :body])]
+      (is (= {:status 200 :body ""} response-map)))))

 (defn polygon
   "Creates a single ring polygon with the given ordinates. Points must be in counter clockwise order."


resolve conflict

resolve conflict

--- bake/bake/test.clj
+++ bake/bake/test.clj
@@ -43,15 +43,7 @@
   (test/with-test-out
     (print-results m)))

-<<<<<<< HEAD
-(defmethod clojure.test/report :fn-summary [m]
-  (clojure.test/with-test-out
-    (print-results m)))
-
-(defmethod clojure.test/report :begin-auto [m])
-=======
 (defmethod test/report :begin-auto [m])
->>>>>>> fix bugs in test

 (defmethod test/report :summary-auto [m]
   (test/with-test-out


remove failing test

remove failing test

--- ssclj/jar/src/test/clojure/com/sixsq/slipstream/ssclj/filter/parser_test.clj
+++ ssclj/jar/src/test/clojure/com/sixsq/slipstream/ssclj/filter/parser_test.clj
@@ -3,8 +3,6 @@
     [com.sixsq.slipstream.ssclj.filter.parser :refer :all]
     [instaparse.core :as insta]
     [clojure.test :refer [deftest is are]]))
-
-(is (= 1 2))

 (deftest check-valid-double-quote-strings
   (let [parse (insta/parser grammar-url :start :DoubleQuoteString)]


CMR-2379 Fix a missing field in DIF-9 in umm-lib

--- umm-lib/src/cmr/umm/dif10/collection.clj
+++ umm-lib/src/cmr/umm/dif10/collection.clj
@@ -22,7 +22,8 @@
             [cmr.umm.dif10.collection.personnel :as personnel]
             [cmr.umm.dif10.collection.product-specific-attribute :as psa]
             [cmr.umm.dif10.collection.metadata-association :as ma]
-            [cmr.umm.dif.collection.extended-metadata :as em])
+            [cmr.umm.dif.collection.extended-metadata :as em]
+            [cmr.umm-spec.util :as u :refer [with-default]])
   (:import cmr.umm.collection.UmmCollection))

 (defn- xml-elem->Product
@@ -96,6 +97,16 @@
    :xmlns:xsi "http://www.w3.org/2001/XMLSchema-instance"
    :xsi:schemaLocation "http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/ http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/dif_v10.2.xsd"})

+(def product-levels
+  "The set of values that DIF 10 defines for Processing levels as enumerations in its schema"
+  #{u/not-provided "0" "1" "1A" "1B" "1T" "2" "2G" "2P" "3" "4" "NA"})
+
+(defn- dif10-product-level-id
+  "Returns the given product-level-id in DIF10 format."
+  [product-level-id]
+  (when product-level-id
+    (product-levels (str/replace product-level-id #"Level " ""))))
+
 (extend-protocol dif10-core/UmmToDif10Xml
   UmmCollection
   (umm->dif10-xml
@@ -141,6 +152,8 @@
                                (x/element :Data_Creation {} "1970-01-01T00:00:00")
                                (x/element :Data_Last_Revision {} "1970-01-01T00:00:00"))
                     (psa/generate-product-specific-attributes product-specific-attributes)
+                    (when-let [processing-level-id (-> collection :product :processing-level-id)]
+                      (x/element :Product_Level_Id {} (dif10-product-level-id processing-level-id)))
                     (when collection-data-type
                       (x/element :Collection_Data_Type {} collection-data-type))
                     (when access-value


remove duplicate the (#457)

remove duplicate the (#457)

--- exercises/concept/tracks-on-tracks-on-tracks/src/tracks_on_tracks_on_tracks.clj
+++ exercises/concept/tracks-on-tracks-on-tracks/src/tracks_on_tracks_on_tracks.clj
@@ -16,7 +16,7 @@
   )

 (defn remove-language
-  "Removes the the first language added to the list."
+  "Removes the first language added to the list."
   [lang-list]
   )


(maint) Remove content-length warning

(maint) Remove content-length warning

We sometimes don't get the length header now, with gzip compression from
puppetserver.

--- src/puppetlabs/puppetdb/middleware.clj
+++ src/puppetlabs/puppetdb/middleware.clj
@@ -274,11 +274,6 @@
             (when (and command version)
               (cmd/create-metrics-for-command! command version)
               (update! (cmd/cmd-metric command version :size) length-in-bytes))))
-        (when-not length-in-bytes
-          (log/warn (str
-                     (trs "No content length found for POST.")
-                     " "
-                     (trs "POST bodies that are too large could cause memory-related failures."))))

         (if (and length-in-bytes
                  reject-large-commands?


lein-release plugin: bumped version from 0.2.0 to 0.2.1-SNAPSHOT for next development cycle

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

   :description "Material design components in re-view"


Fix leftover after #10073 changes

Fix leftover after #10073 changes

--- src/status_im/ui/screens/intro/db.cljs
+++ src/status_im/ui/screens/intro/db.cljs
@@ -10,7 +10,6 @@
 (spec/def :intro-wizard/back-action keyword?)
 (spec/def :intro-wizard/weak-password? boolean?)
 (spec/def :intro-wizard/forward-action keyword?)
-(spec/def :intro-wizard/first-time-setup? boolean?)
 (spec/def :intro-wizard/step (spec/nilable keyword?))
 (spec/def :intro-wizard/root-key :multiaccounts/generated-multiaccount)
 (spec/def :intro-wizard/passphrase string?)
@@ -24,7 +23,6 @@
                       :intro-wizard/back-action
                       :intro-wizard/weak-password?
                       :intro-wizard/forward-action
-                      :intro-wizard/first-time-setup?
                       :intro-wizard/step]
              :opt-un [:intro-wizard/selected-id
                       :intro-wizard/selected-storage-type?


[lein] Fix slamhound

[lein] Fix slamhound

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -7,7 +7,6 @@
                   ; Code quality
                   [lein-kibit                        "0.1.3"]
                   [lein-bikeshed                     "0.4.1"]
-                  [slamhound                         "1.5.5"]
                   [jonase/eastwood                   "0.2.3"]

                   [lein-pprint                       "1.1.2"]
@@ -15,5 +14,9 @@
                   [cider/cider-nrepl                 "0.14.0"]
                   [venantius/ultra                   "0.5.1"]
                   [venantius/yagni                   "0.1.4"]]
+
+        :dependencies [; Code quality
+                       [slamhound                    "1.5.5"]]
+
         :aliases {"slamhound" ["run" "-m" "slam.hound"]}
         :signing {:gpg-key "E5B26621"}}}


Upgrade `cider-nrepl` to just-released "0.8.0"

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -1,3 +1,3 @@
 {:user {:plugins [[lein-try "0.4.1"]
                   [lein-pprint "1.1.1"]
-                  [cider/cider-nrepl "0.7.0"]]}}
+                  [cider/cider-nrepl "0.8.0"]]}}


Update lein plugins

Update lein plugins

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -5,7 +5,7 @@
     [lein-cljfmt "0.5.6"]
     [lein-pprint "1.1.2"]
     [lein-assoc "0.1.0"]
-    [lein-cloverage "1.0.7"]
+    [lein-cloverage "1.0.9"]
     [venantius/ultra "0.5.0"]
     [jonase/eastwood "0.2.3" :exclusions [org.clojure/clojure]]
     [lein-expectations "0.0.8"]


update profiles

update profiles

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -1,12 +1,13 @@
 {:user
- {:repl-options {:init (set! *print-length* 100)}
+ {:repl-options {:init (do (set! *print-length* 100)
+                           (require '[com.brunobonacci.repl-driven-dev-tools]))}
   :jvm-opts ["-server" "-Dfile.encoding=UTF-8"]
-  :dependencies [[com.brunobonacci/where "0.5.5"]
-                 [cider/cider-nrepl "0.25.4"]]
+  :dependencies [[com.brunobonacci/repl-driven-dev-tools "0.38.0"]]
+

   :plugins
-  [[lein-auto "0.1.3"]
-   [refactor-nrepl "2.5.1"]]
+  [[lein-auto "0.1.3"]]
+

   :aliases
   {"clean-clojure"
@@ -35,19 +36,19 @@
   [[jonase/eastwood "0.3.10"] ;; code smells / linting
    [lein-kibit      "0.1.6"]  ;; check idiomatic clojure
    [lein-ancient    "0.6.15"] ;; check/update dependencies
-   [lein-cloverage  "1.2.0"]  ;; code coverage
+   [lein-cloverage  "1.2.2"]  ;; code coverage
    [lein-nvd        "1.4.1"]  ;; security scan
    [venantius/yagni "0.1.4"]  ;; dead code elimination
    [lein-bikeshed   "0.5.1"]  ;; check code smells
-   [lein-checkall   "0.1.1"]  ;; like lein check, kibit, eastwood bikeshed
+   [lein-checkall   "0.1.1"] ;; like lein check, kibit, eastwood bikeshed
    ]}

  :tools
  {:plugins
-  [[lein-binplus "0.6.4"]    ;; build executable jars
-   [lein-ancient "0.6.15"]   ;; check/update dependencies
-   [lein-shell   "0.5.0"]    ;; run shell commands
-   [lein-cljfmt  "0.6.8"]    ;; source code formatting
+  [[lein-binplus "0.6.4"]  ;; build executable jars
+   [lein-ancient "0.6.15"] ;; check/update dependencies
+   [lein-shell   "0.5.0"]  ;; run shell commands
+   [lein-cljfmt  "0.6.8"]  ;; source code formatting
    #_[samsara/lein-template "0.1.0-SNAPSHOT"]
    ]

@@ -58,8 +59,8 @@
  :tools2
  {:plugins
   [[com.livingsocial/lein-dependency-check "1.0.2"] ;; security scan
-   [lein-instant-cheatsheet "2.2.2"]   ;; create checksheets for your projects
-   [org.timmc/nephila "0.3.0"]         ;; namespace dep graph
+   [lein-instant-cheatsheet "2.2.2"] ;; create checksheets for your projects
+   [org.timmc/nephila "0.3.0"]       ;; namespace dep graph
    ]
   }


[SD CS] Allow table aliases in `ltree-match`

--- src/vip/data_processor/db/postgres.clj
+++ src/vip/data_processor/db/postgres.clj
@@ -50,11 +50,15 @@
     (db.util/make-entities "3.0" results-db db.util/import-entity-names)))

 (defn ltree-match
-  "Helper function for generating WHERE clases using ~"
+  "Helper function for generating WHERE clases using ~. Accepts a keyword as a
+  table alias, or a korma entity"
   [table column path]
-  (korma/raw (str (korma.sql.engine/table-alias table)
-                  "." (name column)
-                  " ~ '" path "'")))
+  (let [tablename (if (keyword? table)
+                    (name table)
+                    (korma.sql.engine/table-alias table))]
+    (korma/raw (str tablename
+                    "." (name column)
+                    " ~ '" path "'"))))

 (defn start-run [ctx]
   (let [results (korma/insert results


Removed killed_uniq notification Meudsa, already handled by achievements

--- src/demogorgon/nh.clj
+++ src/demogorgon/nh.clj
@@ -314,7 +314,9 @@
                                  "")
                                (:genocided_monster data))

-    :killed_uniq (str (:player data) " killed " (:killed_uniq data) " after " (:turns data) " turns.")
+    :killed_uniq (if (= (:killed_uniq data) "Medusa")
+                   nil
+                   (str (:player data) " killed " (:killed_uniq data) " after " (:turns data) " turns."))

     :killed_shopkeeper (str (:player data) " killed the shopkeeper "
                             (:killed_shopkeeper data) " after " (:turns data) " turns")


Change identification of the name of a dungeon branch.

The identification has been changed to use the deathdname property. This way
unknown dungeon branches will at least be correctly identified in the future
without the need of relying on a fixed order of dungen branch names.

--- src/demogorgon/nh.clj
+++ src/demogorgon/nh.clj
@@ -51,18 +51,12 @@
       "neu" "neutral"
       "una" "evil"})

+; Hash of special named dungeon branches
 (def zonemap
-     ["in The Dungeons of Doom"
-      "in Gehennom"
-      "in The Gnomish Mines"
-      "in The Quest"
-      "in Sokoban"
-      "in Town"
-      "in Fort Ludios"
-      "in the Black Market"
-      "in Vlad's Tower"
-      "on The Elemental Planes"
-      "in the Advent Calendar"])
+     ; only map those dungeon branches that need special treatment
+     {"One-eyed Sam's Market" "in the Black Market"
+      "The Elemental Planes" "on the Elemental Planes"
+      "Advent Calendar" "in the Advent Calendar"})

 (def achievements
      ["obtained the Bell of Opening"
@@ -97,14 +91,11 @@
     "us"
     "eu"))

-(defn zone [zonenum]
-  (let [i (if (isa? (class zonenum) String)
-            (Integer/parseInt zonenum)
-            zonenum)]
-    (if (>= i (count zonemap))
-      "in an unknown zone"
-      (nth zonemap i))))
-
+; return zonename with correct location preposition
+(defn zone [zonename]
+  (get zonemap zonename
+    (str "in " zonename)))
+
 (defn role [role]
   (get roles (.toLowerCase role) role))

@@ -292,7 +283,7 @@
                         (if (.startsWith (:death data) "ascended")
                           (str " " (:death data) " to demigod-hood.")
                           (format ", left this world %s on level %s, %s."
-                                  (zone (:deathdnum data))
+                                  (zone (:deathdname data))
                                   (:deathlev data)
                                   (:death data)))
                         (possessive-gender (:gender data))


Revert "Adding alternate entrypoint for run"

--- src/frontend/core.clj
+++ src/frontend/core.clj
@@ -3,7 +3,6 @@
             [compojure.core :refer (defroutes GET ANY)]
             [compojure.handler :refer (site)]
             [compojure.route]
-            [figwheel-sidecar.repl-api :as fig.repl]
             [frontend.less :as less]
             [frontend.util.docs :as doc-utils]
             [frontend.proxy :as proxy]
@@ -135,7 +134,4 @@
   []
   (println "Starting less compiler.")
   (less/init)
-  (println "Starting figwheel.")
-  (fig.repl/start-figwheel!)
-  (println "Starting the server.")
   (start-server))


whoopsies

whoopsies

--- server/src/gratefulplace/controllers/likes.clj
+++ server/src/gratefulplace/controllers/likes.clj
@@ -32,7 +32,7 @@
   :available-media-types ["application/json"]
   :authorized? (fn [_]
                  (if-let [like (find-like (clean-params params auth))]
-                   {:record {:id (:db/id like)}}))
+                   {:record (:db/id like)}))
   :exists? exists-in-ctx?
   :delete! (fn [ctx]
-             (db/retract-entity (get-in ctx [:record :id]))))+             (db/retract-entity (:record ctx))))


WIP - Evolution du bot CSB en Clojure avec l'objectif d'améliorer le classement en ligue argent

--- clojure/codingame/competition/coders-strike-back/src/coders_strike_back/core.clj
+++ clojure/codingame/competition/coders-strike-back/src/coders_strike_back/core.clj
@@ -30,13 +30,34 @@
 (defn after [val1 val2] (if (> (- val2 val1) 0) true false))
 (defn before [val1 val2] (if (< (- val2 val1) 0) true false))

+(def max-shield-usage (atom 3))
+(def last-shield-usage (atom 0))
+(def boost-used? (atom false))
+(def game-loop-counter (atom 0))
+(def last-boost-value (atom "0"))
+
 ;;Compute a boost value between 0 and 100
 (defn compute-boost [next-checkpoint-distance next-checkpoint-angle]
   (cond
-    (> (Math/abs next-checkpoint-angle) 90) "0"
-    (and (< next-checkpoint-distance 1000) (> (Math/abs next-checkpoint-angle) 30)) "0"
-    (and (< next-checkpoint-distance 1200) (> (Math/abs next-checkpoint-angle) 30)) "20"
-    (and (< next-checkpoint-distance 1500) (> (Math/abs next-checkpoint-angle) 30)) "40"
+    (>= (Math/abs next-checkpoint-angle) 90) "0"
+    (< next-checkpoint-distance 600) "0"
+    (> (Math/abs next-checkpoint-angle) 72) "20"
+    (> (Math/abs next-checkpoint-angle) 54) "40"
+    (> (Math/abs next-checkpoint-angle) 36) "80"
+    (> (Math/abs next-checkpoint-angle) 18) "100"
+    (<= (Math/abs next-checkpoint-angle) 18) "100"
+    ;(and (< next-checkpoint-distance 1000) (> (Math/abs next-checkpoint-angle) 30)) "0"
+    ;(and (< next-checkpoint-distance 1200) (> (Math/abs next-checkpoint-angle) 30)) "20"
+    ;(and (< next-checkpoint-distance 1500) (> (Math/abs next-checkpoint-angle) 30)) "40"
+    ;(and (< next-checkpoint-distance 2000) (> (Math/abs next-checkpoint-angle) 30)) "40"
+    ;(and (> next-checkpoint-distance 2000) (> (Math/abs next-checkpoint-angle) 60)) "20"
+    ;(and (> next-checkpoint-distance 2000) (> (Math/abs next-checkpoint-angle) 45)) "40"
+    ;(> (Math/abs next-checkpoint-angle) 60) "60"
+    ;(< next-checkpoint-distance 1000) "20"
+    ;(and (> next-checkpoint-distance 2000) (> (Math/abs next-checkpoint-angle) 30)) "60"
+    ;(and (> next-checkpoint-distance 2000) (> (Math/abs next-checkpoint-angle) 15)) "80"
+    ;(and (> next-checkpoint-distance 2000) (> (Math/abs next-checkpoint-angle) 45)) "80"
+    ;(and (> next-checkpoint-distance 2000) (> (Math/abs next-checkpoint-angle) 30)) "90"
     ;(< next-checkpoint-distance 799) "0"
     ;(< 800 next-checkpoint-distance 1000) "20"
     ;(< 1001 next-checkpoint-distance 1200) "40"
@@ -48,18 +69,23 @@
     ; (> next-checkpoint-distance 4000) "100"
     true "100"))

-(def max-shield-usage (atom 3))
-(def last-shield-usage (atom 0))
-(def boost-used? (atom false))
-(def game-loop-counter (atom 0))
+(defn- use-boost? [next-checkpoint-distance next-checkpoint-angle boost-used? game-loop-counter last-shield-usage last-boost-value]
+  (and
+    (not @boost-used?)
+    (> @game-loop-counter 3)
+    (< (Math/abs next-checkpoint-angle) 10)
+    (> next-checkpoint-distance 4000)
+    (and (not (= @last-boost-value "SHIELD")) (not (= @last-boost-value "BOOST")) (= @last-shield-usage 0)(= (Integer/parseInt @last-boost-value) 100))))
+
+(defn- use-shield? [x y opponent-x opponent-y boost-used? game-loop-counter max-shield-usage last-shield-usage last-boost-value]
+  (and (= @last-shield-usage 0) (> @game-loop-counter 10) (> @max-shield-usage 0) (< (distance opponent-x opponent-y x y) 700)))

 ;;Compute BOOST, SHIELD or boost value between 0 and 100
-(defn compute-action [next-checkpoint-x next-checkpoint-y next-checkpoint-distance next-checkpoint-angle x y opponent-x opponent-y boost-used? game-loop-counter]
+(defn compute-action [next-checkpoint-x next-checkpoint-y next-checkpoint-distance next-checkpoint-angle x y opponent-x opponent-y boost-used? game-loop-counter max-shield-usage last-shield-usage last-boost-value]
   (cond
-    (and (not @boost-used?) (> @game-loop-counter 3) (< (Math/abs next-checkpoint-angle) 10) (> next-checkpoint-distance 4000)) (do (reset! boost-used? true) "BOOST")
-    (and (= @last-shield-usage 0) (> @game-loop-counter 10) (> @max-shield-usage 0) (< (distance opponent-x opponent-y x y) 1000)) (do (reset! last-shield-usage 3) (swap! max-shield-usage dec-atom) "SHIELD")
+    (use-boost? next-checkpoint-distance next-checkpoint-angle boost-used? game-loop-counter last-shield-usage last-boost-value) (do (reset! boost-used? true) "BOOST")
+    (use-shield? x y opponent-x opponent-y boost-used? game-loop-counter max-shield-usage last-shield-usage last-boost-value) (do (reset! last-shield-usage 3) (swap! max-shield-usage dec-atom) "SHIELD")
     true (compute-boost next-checkpoint-distance next-checkpoint-angle)))
-

 (defn -main [& args]
   (while true
@@ -74,24 +100,27 @@
       ; nextCheckpointAngle: angle between your pod orientation and the direction of the next checkpoint

       (swap! game-loop-counter inc-atom)
-      (if (> @last-shield-usage 0) (swap! last-shield-usage dec-atom))
+      (if (> @last-shield-usage 0)
+        (swap! last-shield-usage dec-atom))

       ; (binding [*out* *err*]
       ;   (println "Debug messages..."))
-      ; (binding [*out* *err*]
-      ;   (println (str "Has the boost been used ? : " @boost-used?))
-      ;   (println (str "Next check point distance coordinates : (" nextCheckpointX "," nextCheckpointY ")"))
-      ;   (println (str "Given next check point distance : " nextCheckpointDist))
-      ;   (println (str "Calculated next check point distance : " (distance x y nextCheckpointX nextCheckpointY)))
-      ;   (println (str "Pod angle with checkpoint : " nextCheckpointAngle))
-      ;   (println (str "Calculated Pod angle with checkpoint : " (angle-between-2-points x y nextCheckpointX nextCheckpointY)))
-      ;   (println (str "Pod Position : (" x "," y ")"))
-      ;   (println (str "Opponent pod Position : (" opponentX "," opponentY ")"))
-      ;   (println (str "Opponent distance : " opponent-distance))
-      ;   (println (str "Calculated Pod angle with opponent : " (angle-between-2-points x y opponentX opponentY)))
-      ;   (println (str "Max Shield Usage : " @max-shield-usage))
-      ;   (println (str "Last Shield Usage : " @last-shield-usage))
-      ;   (println (str "Game loop counter : " @game-loop-counter))))
+      ;(binding [*out* *err*]
+      ;  (println (str "Has the boost been used ? : " @boost-used?))
+      ;  (println (str "Next check point distance coordinates : (" nextCheckpointX "," nextCheckpointY ")"))
+      ;  (println (str "Given next check point distance : " nextCheckpointDist))
+      ;  (println (str "Calculated next check point distance : " (distance x y nextCheckpointX nextCheckpointY)))
+      ;  (println (str "Pod angle with checkpoint : " nextCheckpointAngle))
+      ;  (println (str "Calculated Pod angle with checkpoint : " (angle-between-2-points x y nextCheckpointX nextCheckpointY)))
+      ;  (println (str "Pod Position : (" x "," y ")"))
+      ;  (println (str "Opponent pod Position : (" opponentX "," opponentY ")"))
+      ;  (println (str "Opponent distance : " opponent-distance))
+      ;  (println (str "Calculated Pod angle with opponent : " (angle-between-2-points x y opponentX opponentY)))
+      ;  (println (str "Max Shield Usage : " @max-shield-usage))
+      ;  (println (str "Last Shield Usage : " @last-shield-usage))
+      ;  (println (str "Game loop counter : " @game-loop-counter))
+      ;  (println (str "Last boost value : " @last-boost-value)))
+

       ; You have to output the target position
@@ -101,10 +130,15 @@
       (print " ")
       (print nextCheckpointY)
       (print " ")
-      (print (compute-action
-               nextCheckpointX nextCheckpointY
-               nextCheckpointDist nextCheckpointAngle
-               x y
-               opponentX opponentY
-               boost-used? game-loop-counter)))
-    (println "")))
+      (reset! last-boost-value (compute-action
+                                 nextCheckpointX nextCheckpointY
+                                 nextCheckpointDist nextCheckpointAngle
+                                 x y
+                                 opponentX opponentY
+                                 boost-used?
+                                 game-loop-counter
+                                 max-shield-usage
+                                 last-shield-usage
+                                 last-boost-value))
+      (print @last-boost-value))
+    (println "")))


CMR-5397: remove buffered reader with string.

jruby eval complains sometimes when using BufferedReader. Replacing with load <bootstrap-path> seems to resolve the issue.


Fix source test

Fix source test

--- test/asciinema/player/source_test.cljs
+++ test/asciinema/player/source_test.cljs
@@ -5,8 +5,8 @@

 (deftest initialize-asciicast-test
   (testing "pre v1 format"
-    (let [asciicast [[1.0 {:lines {0 [["foo" {}] ["bar" {}]] 1 [["foobar" {}]]}}]
-                     [2.0 {:lines {0 [["baz" {}] ["qux" {}]] 1 [["quuuux" {}]]}}]]
+    (let [asciicast [[1.0 {:lines {:0 [["foo" {}] ["bar" {}]] :1 [["foobar" {}]]}}]
+                     [2.0 {:lines {:0 [["baz" {}] ["qux" {}]] :1 [["quuuux" {}]]}}]]
           asciicast (s/initialize-asciicast asciicast)]
       (is (= (select-keys asciicast [:width :height :duration])
              {:width 6 :height 2 :duration 3.0}))))


Add recursive test for the visitor

Add recursive test for the visitor

* https://gist.github.com/shafeeq/c2ded8e71579a26e44c2191536e01c0d

--- test/cljc/spec_tools/visitor_test.cljc
+++ test/cljc/spec_tools/visitor_test.cljc
@@ -1,8 +1,7 @@
 (ns spec-tools.visitor-test
   (:require [clojure.test :refer [deftest is]]
             [clojure.spec :as s]
-            [spec-tools.visitor :refer [visit]]
-            [clojure.set :as set]))
+            [spec-tools.visitor :refer [visit]]))

 (s/def ::str string?)
 (s/def ::int integer?)
@@ -14,3 +13,21 @@
   (is (= (visit #{1 2 3} collect) [:spec-tools.visitor/set 1 3 2]))
   (is (= (visit ::map collect)
          '[clojure.spec/keys [clojure.core/string?] [clojure.core/integer?]])))
+
+(s/def ::age number?)
+(s/def ::first-name string?)
+(s/def ::last-name string?)
+(s/def ::name (s/keys :req-un [::first-name ::last-name]))
+(s/def ::user (s/keys :req-un [::name ::age]))
+
+; https://gist.github.com/shafeeq/c2ded8e71579a26e44c2191536e01c0d
+(deftest recursive-visit
+  (let [specs (atom {})
+        collect (fn [_ spec _]
+                  (swap! specs assoc spec (s/form (s/get-spec spec))))]
+    (is (= (visit ::user collect)
+           {::age (s/form ::age)
+            ::first-name (s/form ::first-name)
+            ::last-name (s/form ::last-name)
+            ::name (s/form ::name)
+            ::user (s/form ::user)}))))


Call effects end function even when interrupting.

Ensure that the end function is called no matter how the effect ends, to
give effects a chance to clean up state beyond merely being garbage
collected.

--- src/afterglow/show.clj
+++ src/afterglow/show.clj
@@ -595,6 +595,38 @@
   (add-midi-control-metronome-mapping midi-device-name channel control-number metronome
                                       #(rhythm/metro-phrase-start % (rhythm/metro-phrase %))))

+(defn find-effect-internal
+  "Looks up the specified effect keyword in list of active effects.
+  Returns a map of the effect metadata, with the effect itself under
+  the key `:effect`. If the effect is in the process of ending, the
+  keyword `:ending` will have a `true` value."
+  {:doc/format :markdown}
+  [key show]
+  {:pre [(some? show) (some? key)]}
+  (when-let [index (get (:indices @(:active-effects *show*)) (keyword key))]
+    (assoc (get (:meta @(:active-effects *show*)) index)
+           :effect (get (:effects @(:active-effects *show*)) index)
+           :ending ((:ending @(:active-effects *show*)) (keyword key)))))
+
+(defn find-effect
+  "Looks up the specified effect keyword in list of active effects
+  for [[*show*]]. Returns a map of the effect metadata, with the
+  effect itself under the key `:effect`. If the effect is in the
+  process of ending, the keyword `:ending` will have a `true` value."
+  {:doc/format :markdown}
+  [key]
+  (find-effect-internal key *show*))
+
+(defn- warn-ending-effect
+  "If an effect is about to be removed from the set of active effects,
+  make sure that its end function has been called, in case it needs to
+  do any cleanup beyond simply being garbage collected."
+  [key show]
+  (let [found (find-effect-internal key show)
+        effect (:effect found)]
+    (when (and found (not (:ending found)))
+      (fx/end effect show (rhythm/metro-snapshot (:metronome show))))))
+
 (defn- vec-remove
   "Remove the element at the specified index from the collection."
   [coll pos]
@@ -609,13 +641,13 @@
 (defn- remove-effect-internal
   "Helper function which removes the effect with the specified key
   from the priority list structure maintained for the show."
-  [fns key]
-  (if-let [index (get (:indices fns) key)]
-    {:effects (vec-remove (:effects fns) index)
-     :indices (remove-key (:indices fns) key index)
-     :meta (vec-remove (:meta fns) index)
-     :ending (disj (:ending fns) key)}
-    fns))
+  [active-effects key]
+  (if-let [index (get (:indices active-effects) key)]
+    {:effects (vec-remove (:effects active-effects) index)
+     :indices (remove-key (:indices active-effects) key index)
+     :meta (vec-remove (:meta active-effects) index)
+     :ending (disj (:ending active-effects) key)}
+    active-effects))

 (defn- find-insertion-index
   "Determines where in the priority list an effect with the specified
@@ -648,8 +680,8 @@
   "Helper function which adds an effect with a specified key and priority to the priority
   list structure maintained for the show, replacing any existing effect with the same key.
   Tracks the effect instance id, cue-grid source, and variable binding map as metadata."
-  [fns key f priority id from-cue x y var-map]
-  (let [base (remove-effect-internal fns key)
+  [active-effects key f priority id from-cue x y var-map]
+  (let [base (remove-effect-internal active-effects key)
         index (find-insertion-index (:meta base) priority)]
     {:effects (vec-insert (:effects base) index f)
      :indices (insert-key (:indices base) key index)
@@ -680,29 +712,13 @@
   `:var-map` is used to supply a map of variable bindings associated
   with the cue, also for use by interfaces which support them."
   {:doc/format :markdown}
-  [key f & {:keys [priority from-cue x y var-map] :or {priority 0}}]
-  {:pre [(some? *show*) (some? key) (instance? Effect f) (integer? priority)]}
-  (let [id (swap! (:next-id *show*) inc)]
-    (swap! (:active-effects *show*) #(add-effect-internal % (keyword key) f priority id from-cue x y var-map))
+  [key effect & {:keys [priority from-cue x y var-map] :or {priority 0}}]
+  {:pre [(some? *show*) (some? key) (instance? Effect effect) (integer? priority)]}
+  (let [key (keyword key)
+        id (swap! (:next-id *show*) inc)]
+    (warn-ending-effect key *show*)
+    (swap! (:active-effects *show*) #(add-effect-internal % key effect priority id from-cue x y var-map))
     id))
-
-(defn- vec-remove
-  "Remove the element at the specified index from the collection."
-  [coll pos]
-  (vec (concat (subvec coll 0 pos) (subvec coll (inc pos)))))
-
-(defn find-effect
-  "Looks up the specified effect keyword in list of active effects
-  for [[*show*]]. Returns a map of the effect metadata, with the
-  effect itself under the key `:effect`. If the effect is in the
-  process of ending, the keyword `:ending` will have a `true` value."
-  {:doc/format :markdown}
-  [key]
-  {:pre [(some? *show*) (some? key)]}
-  (when-let [index (get (:indices @(:active-effects *show*)) (keyword key))]
-    (assoc (get (:meta @(:active-effects *show*)) index)
-           :effect (get (:effects @(:active-effects *show*)) index)
-           :ending ((:ending @(:active-effects *show*)) (keyword key)))))

 (defn- clean-cue-temporary-variables
   "Removes any temporary variables which were introduced for an effect
@@ -723,17 +739,17 @@
   {:doc/format :markdown}
   [key & {:keys [force when-id]}]
   {:pre [(some? *show*) (some? key)]}
-  (let [found (find-effect key)
-        effect (:effect found)
-        key (keyword key)]
+  (let [key (keyword key)
+        found (find-effect key)
+        effect (:effect found)]
     ;; Make sure the effect is actually running, and if the caller cares, is the right instance
     (when (and effect (or (nil? when-id) (= (:id found) when-id)))
       ;; See if it should be forcibly or gently ended
-      (if (or force ((:ending @(:active-effects *show*)) key)
-              (fx/end effect *show* (rhythm/metro-snapshot (:metronome *show*))))
-        (do  ; Actually ended
+      (if (or force (:ending found) (fx/end effect *show* (rhythm/metro-snapshot (:metronome *show*))))
+        (do  ; Actually ended (perhaps by force)
           (when (every? #(% found) [:cue :x :y])
             (controllers/activate-cue! (:cue-grid *show*) (:x found) (:y found) nil))
+          (when force (warn-ending-effect key *show*))
           (swap! (:active-effects *show*) #(remove-effect-internal % key))
           (clean-cue-temporary-variables (:variables found)))
         (do  ; Starting to end gracefully


Fix precondition placement.

Fix precondition placement.

--- src/afterglow/show.clj
+++ src/afterglow/show.clj
@@ -134,8 +134,8 @@
   effects, in the form of the fraction of the available refresh
   interval that was used calculating and sending the last several
   frames."
+  []
   {:pre [(some? *show*)]}
-  []
   (/ (:recent-average @(:statistics *show*) 0) (:refresh-interval *show*)))

 (defn- response-handler


Positive and negative tests for function read-queue-info-from-jenkins-negative

--- test/emender_jenkins/rest_api_test.clj
+++ test/emender_jenkins/rest_api_test.clj
@@ -746,3 +746,25 @@
                      :command "currently_building_jobs"
                      :message "Can not read Jenkins view"}))))))

+(def jobs-in-queue-jenkins-response
+    (str "{\"_class\":\"hudson.model.Queue\","
+          "\"items\":["
+             "{\"_class\":\"hudson.model.Queue$BlockedItem\",\"task\":{\"_class\":\"hudson.model.FreeStyleProject\",\"name\":\"test-Example_Documentation-1.0-Guide-en-US (preview)\"}}"
+             "{\"_class\":\"hudson.model.Queue$BlockedItem\",\"task\":{\"_class\":\"hudson.model.FreeStyleProject\",\"name\":\"test-Example_Documentation-1.0-Guide-en-US (stage)  \"}}"
+         "]}"))
+
+(deftest test-read-queue-info-from-jenkins
+    "Check the function emender-jenkins.rest-api/read-queue-info-from-jenkins."
+    (testing "the function emender-jenkins.rest-api/read-queue-info-from-jenkins."
+    (with-redefs [jenkins-api/get-command (fn [url] jobs-in-queue-jenkins-response)]
+        (is (= (read-queue-info-from-jenkins "url")
+             [{"_class" "hudson.model.Queue$BlockedItem" "task" {"_class" "hudson.model.FreeStyleProject" "name" "test-Example_Documentation-1.0-Guide-en-US (preview)"}}
+              {"_class" "hudson.model.Queue$BlockedItem" "task" {"_class" "hudson.model.FreeStyleProject" "name" "test-Example_Documentation-1.0-Guide-en-US (stage)  "}}]
+    )))))
+
+(deftest test-read-queue-info-from-jenkins-negative
+    "Check the function emender-jenkins.rest-api/read-queue-info-from-jenkins."
+    (testing "the function emender-jenkins.rest-api/read-queue-info-from-jenkins."
+    (with-redefs [jenkins-api/get-command (fn [url] nil)]
+        (is (= (read-queue-info-from-jenkins "url") nil)))))
+


One more test for a corner case

One more test for a corner case

--- test/freecoin/journey/transactions.clj
+++ test/freecoin/journey/transactions.clj
@@ -264,3 +264,26 @@
              (k/visit (routes/absolute-path :get-all-transactions))

              (kc/selector-matches-count [:select :option] (+ 4 (kh/recall memory :existing-tags))))))
+
+(facts "A user tried to make a transaction to a user who's account is not yet activated"
+       (fact "The right error is returned"
+             (let [memory (atom {})]
+         (-> (k/session test-app)
+
+             (sign-up "recipient")
+             (kh/remember memory :recipient-email kh/state-on-account-page->email)
+
+             (sign-up "sender")
+             (activate-account (jh/get-activation-id stores-m sender-email) sender-email)
+             (sign-in "sender")
+             (kh/remember memory :sender-email kh/state-on-account-page->email)
+
+             ;; required form fields
+             (k/visit (routes/absolute-path :get-transaction-form))
+             (kc/check-and-fill-in ks/transaction-form--recipient "recipient")
+             (kc/check-and-fill-in ks/transaction-form--amount "10.0")
+             (kc/check-and-press ks/transaction-form--submit)
+
+             (kc/check-and-follow-redirect "back to form")
+             (kc/check-page-is :get-transaction-form [ks/transaction-form--submit])
+             (kc/selector-includes-content [ks/transaction-form--error-message] "Recipient: Not found")))))


Remove duplicate function

Remove duplicate function

--- src-cljs/frontend/components/builds_table.cljs
+++ src-cljs/frontend/components/builds_table.cljs
@@ -123,14 +123,6 @@
                     "badge-text")}
      wording]))

-(defn build-status-badge-wording [build]
-  (let [wording       (build-model/status-words build)
-        too-long?     (> (count wording) 10)]
-    [:div {:class (if too-long?
-                    "badge-text small-text"
-                    "badge-text")}
-     wording]))
-
 (defn build-status-badge [build]
   [:div.recent-status-badge {:class (build-model/status-class build)}
    (om/build svg {:class "badge-icon"


"Pay for organizations" -> "Save"

"Pay for organizations" -> "Save"

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -727,7 +727,7 @@
                                                                             :vcs-type org-vcs_type
                                                                             :selected-piggieback-orgs selected-piggieback-orgs}])
                    :kind :primary}
-                  "Pay for organizations")]]]])]])))))
+                  "Save")]]]])]])))))

 (defn transfer-organizations-list [[{:keys [vcs_type]} :as users-and-orgs] selected-transfer-org owner]
   ;; split user-orgs from orgs and grab the first (and only) user-org


add another pre-compiled spec->bolt set to grammar

--- src/babel/francais/grammar.cljc
+++ src/babel/francais/grammar.cljc
@@ -563,7 +563,9 @@
       (merge retval
              {:generate-fn (fn [spec]
                              (generate/generate spec retval))
-              :bolts {{:depth 3
+              :bolts {
+
+                      {:depth 3
                        :synsem {:subcat []
                                 :cat :verb
                                 :sem {:tense :present
@@ -575,7 +577,23 @@
                                                  :sem {:tense :present
                                                        :reflexive true
                                                        :aspect :perfect}}}
-                                       0 3)}}))))
+                                       0 3)
+
+                      {:depth 2
+                       :synsem {:subcat []
+                                :cat :verb
+                                :sem {:tense :present
+                                      :reflexive true
+                                      :aspect :simple}}}
+                      (lightning-bolts retval
+                                       {:synsem {:subcat ()
+                                                 :cat :verb
+                                                 :sem {:tense :present
+                                                       :reflexive true
+                                                       :aspect :simple}}}
+                                       0 2)}}))))
+
+
 (defn parse [surface]
   (parse/parse surface
                (:lexicon medium)


Add peer leave generative test

Add peer leave generative test

--- test/onyx/log/generative_peer_join.clj
+++ test/onyx/log/generative_peer_join.clj
@@ -226,3 +226,23 @@
    (is (= (map count (vals (get (:allocations replica) job-1-id))) [2 2 2]))
    (is (= (map count (vals (get (:allocations replica) job-2-id))) [2 2 2]))
    (is (= (map count (vals (get (:allocations replica) job-3-id))) []))))
+
+
+(deftest peer-leave
+  (checking
+    "Checking balanced allocation causes peers to be evenly split"
+    1000
+    [{:keys [replica log peer-choices]}
+     (log-gen/apply-entries-gen
+       (gen/return
+         {:replica {:job-scheduler :onyx.job-scheduler/balanced
+                    :messaging {:onyx.messaging/impl :dummy-messenger}}
+          :message-id 0
+          :entries
+          (-> (log-gen/generate-join-entries (log-gen/generate-peer-ids 4))
+              (assoc :leave-anytime [{:fn :leave-cluster
+                                      :args {:id :p1}
+                                      :immediate? true}]))
+          :log []
+          :peer-choices []}))]
+    (= 3 (count (:peers replica)))))


Set max pending in test

Set max pending in test

--- test/onyx/plugin/bench_plugin_test.clj
+++ test/onyx/plugin/bench_plugin_test.clj
@@ -51,6 +51,7 @@
 (def retry-counter (atom 0))

 (defn my-inc [{:keys [n] :as segment}]
+  ;(Thread/sleep 10)
   (assoc segment :n (inc n)))

 (def catalog
@@ -58,6 +59,7 @@
     :onyx/ident :generator
     :onyx/type :input
     :onyx/medium :generator
+    :onyx/max-pending 50000
     :onyx/batch-timeout batch-timeout
     :onyx/batch-size batch-size}


(PDB-5484) meta-test: remove unused response binding

--- test/puppetlabs/puppetdb/meta_test.clj
+++ test/puppetlabs/puppetdb/meta_test.clj
@@ -77,11 +77,11 @@

       (testing "shouldn't log HTTP errors hitting update server at INFO"
         (with-log-output logz
-          (let [response (-> (get-request (str endpoint "/version/latest"))
-                             (with-meta-app
-                               {:update-server "http://known.invalid.domain"}
-                               {:scf-read-db *db*}))
-                log-levels-emitted (set (map second @logz))]
+          (-> (get-request (str endpoint "/version/latest"))
+              (with-meta-app
+                {:update-server "http://known.invalid.domain"}
+                {:scf-read-db *db*}))
+          (let [log-levels-emitted (set (map second @logz))]
             (is (nil? (log-levels-emitted :info)))))))))

 (deftest update-server-http-errors-not-logged-as-info
@@ -89,11 +89,11 @@
     (testing "doesn't log update server HTTP errors at INFO"
       (with-test-db
         (with-log-output logz
-          (let [response (-> (get-request (str endpoint "/version/latest"))
-                             (with-meta-app
-                               {:update-server "http://known.invalid.domain"}
-                               {:scf-read-db *db*}))
-                log-levels-emitted (set (map second @logz))]
+          (-> (get-request (str endpoint "/version/latest"))
+              (with-meta-app
+                {:update-server "http://known.invalid.domain"}
+                {:scf-read-db *db*}))
+          (let [log-levels-emitted (set (map second @logz))]
             (is (nil? (log-levels-emitted :info)))))))))

 (deftest server-time-response


Make ping/pong display reconnect time properly & clear error

--- src/braid/core/client/sync.cljs
+++ src/braid/core/client/sync.cljs
@@ -82,8 +82,11 @@
         [:braid.client/ping]
         5000
         (fn [reply]
-          (when-not (sente/cb-success? reply)
-            (dispatch [:core/websocket-disconnected])))))))
+          (if-not (sente/cb-success? reply)
+            (let [reconnect-time (+ 10000 (.valueOf (js/Date.)))]
+              (dispatch [:core/websocket-disconnected])
+              (dispatch [:core/websocket-update-next-reconnect reconnect-time]))
+            (dispatch [:core/websocket-connected])))))))

 (defn stop-router! [] (when-let [stop-f @router_] (stop-f)))


fix last open at for edge case

fix last open at for edge case

--- src/chat/server/db.clj
+++ src/chat/server/db.clj
@@ -385,7 +385,7 @@
                               (filter (fn [m] (= (m :user-id) user-id)))
                               (map :created-at)
                               (map (fn [t] (.getTime t))))]
-  (assoc thread :last-open-at (apply max (concat user-hides-at user-messages-at)))))
+  (assoc thread :last-open-at (apply max (concat [0] user-hides-at user-messages-at)))))

 (defn get-open-threads-for-user
   [user-id]


formatting

formatting

--- src/chat/client/dispatcher.cljs
+++ src/chat/client/dispatcher.cljs
@@ -50,14 +50,15 @@

 (defmethod dispatch! :new-message [_ data]
   (when-not (string/blank? (data :content))
-    (let [message (schema/make-message {:user-id (get-in @store/app-state [:session :user-id])
-                                        :content (identify-mentions (data :content))
-                                        :thread-id (data :thread-id)
-
-                                        :mentioned-tag-ids (concat (data :mentioned-tag-ids)
-                                                                   (extract-tag-ids (data :content)))
-                                        :mentioned-user-ids (concat (data :mentioned-user-ids)
-                                                                    (extract-user-ids (data :content)))})]
+    (let [message (schema/make-message
+                    {:user-id (get-in @store/app-state [:session :user-id])
+                     :content (identify-mentions (data :content))
+                     :thread-id (data :thread-id)
+
+                     :mentioned-tag-ids (concat (data :mentioned-tag-ids)
+                                                (extract-tag-ids (data :content)))
+                     :mentioned-user-ids (concat (data :mentioned-user-ids)
+                                                 (extract-user-ids (data :content)))})]
       (store/add-message! message)
       (sync/chsk-send! [:chat/new-message message]))))


Turns out I already had this function in cassidy.shon


remove unused functions

remove unused functions

--- src/clj/ceres/core.clj
+++ src/clj/ceres/core.clj
@@ -8,7 +8,7 @@
             [org.httpkit.server :refer [with-channel on-close on-receive run-server send!]]
             [net.cgrand.enlive-html :refer [deftemplate set-attr append html substitute content]]
             [ceres.collector :refer [store] :as collector]
-            [ceres.curator :refer [get-recent-articles get-articles-count get-news-diffusion get-news-frequencies month-distribution] :as curator]
+            [ceres.curator :refer [get-recent-articles get-articles-count get-news-diffusion get-news-frequencies] :as curator]
             [ceres.executor :refer [start-executor]]
             [gezwitscher.core :refer [start-filter-stream]]
             [clojure.java.io :as io]


Add partial implementation of Pheromones

Might as well toss in a partial for Pheromones to address #299. It isn't the whole enchilada since the CSS doesn't allow for a card that hosts both recurring credits *and* counters right now, but at least players can have a visual aid for tracking how many credits can be used in a turn.

--- src/clj/game/cards.clj
+++ src/clj/game/cards.clj
@@ -1857,6 +1857,10 @@
                          :label "Remove 1 counter from a hosted card" :cost [:credit 1])]
       :events {:runner-turn-begins remove-counter}})

+   "Pheromones"
+   {:events
+    {:successful-run {:req (req (= target :hq)) :effect (effect (add-prop card :counter 1))}}}
+
    "Philotic Entanglement"
    {:msg (msg "do " (count (:scored runner)) " net damage")
     :effect (effect (damage :net (count (:scored runner)) {:card card}))}


* src/clj/cljs/compiler.clj: missing emitln


Switch to gists

Switch to gists

--- src/clj/inky/entry.clj
+++ src/clj/inky/entry.clj
@@ -9,7 +9,7 @@
          keyword-params
          reload]
         [ring.middleware.session.cookie :only (cookie-store)]
-        [ring.util.response :only (response content-type)])
+        [ring.util.response :only (response content-type redirect)])
   (:require [ring.adapter.jetty :as jetty]
             [ring.util.response :as resp]
             [aleph.http :as ah]
@@ -390,47 +390,56 @@
                                            (finally (remove-in-progress hash)))))
                                      (render-compiling))))))

-  (GET "/s/:sketch-id" [sketch-id]
+  (GET "/:login/:gist-id" [login gist-id]
     (fn [r]
-      (let [sketch-url (str "/s/" sketch-id "/sketch")
-            {:keys [ns doc source url created]}
-            (->> (slurp (str "http://f.inky.cc/" sketch-id "/meta.edn"))
-                 edn/read-string)]
-        ($layout
-          {:body-class :sketch-page
-           :content
-           [:body
-            [:div.wrapper
-             [:section
-              [:h1 ns]
-              [:p (format-doc doc)]]
-             [:section
-              [:iframe {:src sketch-url}]
-              [:div.controls
-               [:a {:href sketch-url} "full-screen"]]]
-             [:section
-              [:pre {:class "brush: clojure"}
-               (when source
-                 (-> source
-                     (str/replace #">" ">")
-                     (str/replace #"<" "<")))]]
-             [:section.sketch-meta
-              "Created at "
-              (or created "donno")
-              " from "
-              (if url
-                [:a {:href url} (squeeze 60 url)]
-                " we have no idea")
-              "."]
-             [:script {:type "text/javascript"}
-              (str
-                (slurp "syntaxhighlighterclj.js") ";"
-                "SyntaxHighlighter.defaults.toolbar=false;"
-                "SyntaxHighlighter.defaults.gutter=true;"
-                "SyntaxHighlighter.all();")]]]}))))
-  (GET "/s/:sketch-id/sketch" [sketch-id]
+      (let [recompile? (-> r :params :recompile)]
+        (cond
+          (compiling? gist-id) (render-compiling)
+          (and (in-s3? gist-id)
+               (not recompile?)) (render-compiled gist-id)
+          :else (do
+                  (add-in-progress gist-id)
+                  (let [url (-> r :params :url)
+                        source (gist-source gist-id)
+                        hash gist-id
+                        dir (str "/tmp/inky/" hash)
+                        source-dir (str "/tmp/inky/" hash)
+                        filename (str source-dir "/code.cljs")]
+                    (future
+                      (time
+                        (try
+                          (println "Compiling" hash url dir)
+                          (when (.exists (java.io.File. dir))
+                            (sh/sh "rm" "-rf" dir))
+                          (.mkdirs (java.io.File. dir))
+                          (spit filename source)
+                          (compile-cljs hash filename)
+                          (s3/upload-file
+                            (str dir "/code.js")
+                            (str hash "/code.js"))
+                          (s3/put-string
+                            (str hash "/meta.edn")
+                            (pr-str (assoc (parse-meta source)
+                                      :source source
+                                      :url url
+                                      :created (System/currentTimeMillis))))
+                          (s3/put-string
+                            (str hash "/code.html")
+                            (render-compiled hash)
+                            {:content-type "text/html;charset=utf-8"})
+                          #_(s3/upload-hash hash (str "/tmp/inky/" hash))
+                          (println "done compiling" hash)
+                          (catch Exception e
+                            (println e)
+                            (.printStackTrace e))
+                          (finally (remove-in-progress hash)))))
+                    (if recompile?
+                      (redirect (str "/" login "/" gist-id))
+                      (render-compiling))))))))
+
+  (GET "/:login/:gist-id/sketch" [login gist-id]
     (fn [r]
-      (render-compiled sketch-id)))
+      (render-compiled gist-id)))

   (GET "/show-compiling" [] (render-compiling)))


Use more values from the config.

Use more values from the config.

--- src/clj/freestuffly/scraper.clj
+++ src/clj/freestuffly/scraper.clj
@@ -12,9 +12,9 @@

 (defn- interesting-keywords-regex [] (re-pattern (str "(?i)" (string/join "|" (interesting-keywords)))))

-(def ^:private freecycle-group "southwark-freecycle")
+(def ^:private freecycle-group (:group config))

-(def ^:private freecycle-results-per-page 100)
+(def ^:private freecycle-results-per-page (:per_page config))

 (defn- interesting-finds
   [results]


Removed cards.clj

Removed cards.clj

--- src/clj/test/cards.clj
+++ src/clj/test/cards.clj
@@ -1,13 +0,0 @@
-(in-ns 'test.core)
-(load "cards-agendas")
-(load "cards-assets")
-(load "cards-events")
-(load "cards-hardware")
-(load "cards-ice")
-(load "cards-icebreakers")
-(load "cards-identities")
-(load "cards-operations")
-(load "cards-programs")
-(load "cards-resources")
-(load "cards-upgrades")
-(load "games-scenarios")


Tweak Nerve Agent and Medium interaction with Crisium Grid.

--- src/clj/game/cards-programs.clj
+++ src/clj/game/cards-programs.clj
@@ -228,17 +228,17 @@

    "Medium"
    {:events
-    {:successful-run
-     {:req (req (= target :rd))
-      :effect (effect (add-prop card :counter 1)
-                      (access-bonus (max 0 (dec (get-virus-counters state side (get-card state card))))))}}}
+    {:successful-run {:req (req (= target :rd))
+                      :effect (effect (add-prop card :counter 1))}
+     :pre-access {:req (req (= target :rd))
+                  :effect (effect (access-bonus (max 0 (dec (get-virus-counters state side (get-card state card))))))}}}

    "Nerve Agent"
    {:events
-    {:successful-run
-     {:req (req (= target :hq))
-      :effect (effect (add-prop card :counter 1)
-                      (access-bonus (max 0 (dec (get-virus-counters state side (get-card state card))))))}}}
+    {:successful-run {:req (req (= target :hq))
+                      :effect (effect (add-prop card :counter 1))}
+     :pre-access {:req (req (= target :hq))
+                  :effect (effect (access-bonus (max 0 (dec (get-virus-counters state side (get-card state card))))))}}}

    "Net Shield"
    {:prevent {:damage [:net]}


Add by-id to utils

Add by-id to utils

--- src/cljs/d4/utils.cljs
+++ src/cljs/d4/utils.cljs
@@ -12,6 +12,11 @@
   (.floor js/Math (+ (* (.random js/Math) 100) 1)))

+(defn by-id
+  [elem-id]
+  (.getElementById js/document elem-id))
+
+
 (defn tc
   "Helper function to test brepl connection"
   []


fix Pawn bug, check if Bishop is hosted on ice

--- src/clj/game/cards-programs.clj
+++ src/clj/game/cards-programs.clj
@@ -21,7 +21,7 @@
    "Bishop"
    {:abilities [{:cost [:click 1]
                  :effect (req (let [b (get-card state card)
-                                    hosted? (:host b)
+                                    hosted? (= (:type (:host b)) "ICE")
                                     remote? (is-remote? (second (:zone (:host b))))]
                                 (resolve-ability state side
                                  {:prompt (msg "Host Bishop on a piece of ICE protecting "


Fix extra plugin namespaces

Fix extra plugin namespaces

--- src/clj/salava/core/handler.clj
+++ src/clj/salava/core/handler.clj
@@ -16,7 +16,7 @@

 (defn get-route-def [ctx plugin]
   (try+
-    (let [sym (symbol (str "salava." (plugin-str plugin) ".routes/route-def"))]
+    (let [sym (symbol (str "salava." (clojure.string/replace (plugin-str plugin) #"/" ".") ".routes/route-def"))]
       (require (symbol (namespace sym)) :reload)
       ((resolve sym) ctx))
     (catch Object _


RR: do not include google maps

RR: do not include google maps

--- src/cljs/ona/dataview/base.cljs
+++ src/cljs/ona/dataview/base.cljs
@@ -177,7 +177,7 @@
                        :username username
                        :auth-token auth-token
                        :map-config {:mapbox-tiles ona-mapbox-tiles
-                                    :include-google-maps? true}
+                                    :include-google-maps? false}
                        :flat-form form
                        :view-type :ona-zebra}]
      (hatti-shared/update-app-data! hatti-shared/app-state data :rerank? true)


Bug fix for update diffing.

Bug fix for update diffing.

--- src/clojure/freactive/core.cljc
+++ src/clojure/freactive/core.cljc
@@ -285,7 +285,7 @@
                       (.notifyChangeWatches this [[change-key new-val]])))))))
           (cond
             has-change-watches
-            (let [old-keys (coll-keyset old-state)
+            (let [old-keys (set (coll-keyset old-state))
                   new-keys (coll-keyset state)
                   changes
                   (loop [[key & more] new-keys
@@ -920,7 +920,7 @@
                  (inc idx)
                  idx)))))
        (onUpdates [this updates]
-         (println "updates" updates)
+         ;; (println "updates" updates)
          (doseq [[k v :as update] updates]
            (if-let [cur-idx (.rankOf this k)]
              (if (or (= (count update) 1) (not (filter update)))


Factor out the search input used in the welcome splash and the header

--- src/clojure/staircase/views.clj
+++ src/clojure/staircase/views.clj
@@ -69,17 +69,18 @@

      ]]])

+(def search-input
+  [:div.input-group
+   {:ng-controller "QuickSearchController"}
+   [:input.form-control {:ng-model "searchTerm" :placeholder "enter a search term"}] ;; TODO: Definitely make placeholders injectable.
+   [:span.input-group-btn
+    [:button.btn.btn-primary
+     {:type "submit" :ng-click "startQuickSearchHistory(searchTerm)"}
+     "Search "
+     [:i.fa.fa-search]]]])
+
 (defn search-form []
-  [:form.navbar-form.navbar-left
-   {:ng-controller "QuickSearchController"
-    :role "search"
-    :ng-submit "startQuickSearchHistory(searchTerm)"}
-   [:div.input-group
-    [:input.form-control {:ng-model "searchTerm" :placeholder "eve"}] ;; TODO: Definitely make placeholders injectable.
-    [:span.input-group-btn
-     [:button.btn.btn-default {:type "submit"}
-      "Search "
-      [:i.fa.fa-search]]]]])
+  [:form.navbar-form.navbar-left {:role "search"} search-input])

 (defn nav-list []
   [:ul.nav.navbar-nav.navbar-right {:ng-controller "AuthController"}
@@ -168,6 +169,7 @@
        "This is the data-flow interface for intermine data-warehouses.
        If this is your first time here, maybe you might like to read more about
        the intermine system " (link-to "/about" "here") "."]
+
       [:p
        "Below you will find a number of "
        [:strong "different tools"]
@@ -176,11 +178,8 @@
        be linked in turn to a sequence of composable actions. The easiest way to get
        started is to enter a search term:"
        [:div.row
-        [:form.search-form.col-sm-6.col-sm-offset-3
-          [:div.input-group
-          [:input.form-control {:placeholder "enter a search term"}]
-          [:span.input-group-btn
-            [:button.btn.btn-primary "search"]]]]]]
+        [:form.search-form.col-sm-6.col-sm-offset-3 search-input]]]
+
       [:p
        [:strong "You do not need to be logged in"]
        " to use this site - all the site's functionality is


added schema validation for events

added schema validation for events

--- src-cljs/frontend/analytics/core.cljs
+++ src-cljs/frontend/analytics/core.cljs
@@ -81,6 +81,11 @@
     :project-followed
     :project-unfollowed})

+(def SupportedEvents
+  (apply s/enum
+         (concat supported-click-and-impression-events
+                 supported-controller-events)))
+
 (defn- add-properties-to-track-from-state [current-state]
   "Get a map of the mutable properties we want to track out of the
   state. Also add a timestamp."
@@ -126,28 +131,17 @@

 (defmulti track (fn [data]
                   (when (frontend.config/analytics-enabled?)
-                    (cond
-                      (or (supported-click-and-impression-events (:event-type data))
-                          (supported-controller-events (:event-type data)))
-                      :event
-
-                      :else
-                      (:event-type data)))))
-
-(defmethod track :default [data]
-  (when (frontend.config/analytics-enabled?)
-    (merror-unsupported-event (:event-type data))))
+                    (:event-type data))))

 (defn- supplement-tracking-properties [{:keys [properties owner current-state]}]
   (if owner
     (supplement-tracking-properties-from-owner properties owner)
     (supplement-tracking-properties-from-state properties current-state)))

-(s/defmethod track :event [event-data :- AnalyticsEvent]
-  (let [{:keys [event-type properties owner current-state]} event-data]
+(s/defmethod track :default [{:keys [event-type :- SupportedEvents properties owner current-state]} :as event-data :- AnalyticsEvent]
     (segment/track-event event-type (supplement-tracking-properties {:properties properties
                                                                      :owner owner
-                                                                     :current-state current-state}))))
+                                                                     :current-state current-state})))

 (s/defmethod track :external-click [event-data :- ExternalClickEvent]
   (let [{:keys [event properties owner current-state]} event-data]


main sidebar: only specify css-width if width is given.

--- src-cljs/pepa/components/sidebar.cljs
+++ src-cljs/pepa/components/sidebar.cljs
@@ -128,7 +128,7 @@
       om/IRenderState
       (render-state [_ {:keys [width positions]}]
         (html
-         [:#sidebar {:style {:width (str width "px")}}
+         [:#sidebar {:style (when width {:width width})}
           (om/build resize-draggable nil {:init-state {:positions positions}})
           (om/build logo/xeyes nil)