CMR-203: Added tests for sorting by relevance.

--- test/cmr/system_int_test/search/collection_keyword_search_test.clj
+++ test/cmr/system_int_test/search/collection_keyword_search_test.clj
@@ -21,15 +21,13 @@
                                  :term "Term1"
                                  :variable-level-1 "Level1-1"
                                  :variable-level-2 "Level1-2"
-                                 :variable-level-3 "Level1-3"
-                                 :detailed-variable "Detail1"})
+                                 :variable-level-3 "Level1-3"})
         sk2 (dc/science-keyword {:category "Hurricane"
-                                 :topic "Popular"
+                                 :topic "Laser platform_SnA"
                                  :term "Extreme"
                                  :variable-level-1 "Level2-1"
                                  :variable-level-2 "Level2-2"
-                                 :variable-level-3 "Level2-3"
-                                 :detailed-variable "UNIVERSAL"})
+                                 :variable-level-3 "Level2-3"})
         tdcs1 (dc/two-d "XYZ")
         coll1 (d/ingest "CMR_PROV1" (dc/collection {}))
         coll2 (d/ingest "CMR_PROV1" (dc/collection {:entry-title "ABC!XYZ"}))
@@ -43,7 +41,8 @@
         coll10 (d/ingest "CMR_PROV2" (dc/collection {:spatial-keywords ["in out"]}))
         coll11 (d/ingest "CMR_PROV2" (dc/collection {:platforms [p1 p2]}))
         coll12 (d/ingest "CMR_PROV2" (dc/collection {:product-specific-attributes [psa1 psa2 psa3 psa4]}))
-        coll13 (d/ingest "CMR_PROV2" (dc/collection {:two-d-coordinate-systems [tdcs1]}))]
+        coll13 (d/ingest "CMR_PROV2" (dc/collection {:two-d-coordinate-systems [tdcs1]}))
+        coll14 (d/ingest "CMR_PROV2" (dc/collection {:long-name "platform_SnA laser"}))]

     (index/refresh-elastic-index)

@@ -52,19 +51,24 @@
            "ABC" [coll2 coll5]
            "XYZ" [coll2 coll13]
            "place" [coll6]
-           "Laser" [coll5 coll7]
+           "Laser" [coll5 coll7 coll9 coll14]
            "ABC place Hurricane" [coll2 coll5 coll6 coll9]
            "BLAH" []))
-    (testing "search by spatial keywords using wildcard *."
+    (testing "search by keywords using wildcard *."
       (are [keyword-str items] (d/refs-match? items (search/find-refs :collection {:keyword keyword-str}))
            "A*C" [coll2 coll5]
            "XY*" [coll2 coll13]
-           "*aser" [coll5 coll7]
+           "*aser" [coll5 coll7 coll9 coll14]
            "ABC p*ce Hurricane" [coll2 coll5 coll6 coll9]))
-
-    (testing "search by spatial keywords using wildcard ?."
+    (testing "search by keywords using wildcard ?."
       (are [keyword-str items] (d/refs-match? items (search/find-refs :collection {:keyword keyword-str}))
            "A?C" [coll2 coll5]
            "XY?" [coll2 coll13]
-           "?aser" [coll5 coll7]
-           "ABC ?lace Hurricane" [coll2 coll5 coll6 coll9]))))+           "?aser" [coll5 coll7 coll9 coll14]
+           "ABC ?lace Hurricane" [coll2 coll5 coll6 coll9]))
+    (testing "sorted search by keywords."
+      (are [keyword-str items] (d/refs-match-order? items (search/find-refs :collection {:keyword keyword-str}))
+           "Laser platform_SnA" [coll14 coll11 coll9 coll5 coll7]
+           "La?er platform_SnA" [coll14 coll11 coll9 coll5 coll7]
+           "L*er platfor*_SnA" [coll14 coll11 coll9 coll5 coll7]
+           "L?s* plat?o*_SnA" [coll14 coll11 coll9 coll5 coll7]))))


cleanup core.clj

cleanup core.clj

--- src/instantetymonline/core.clj
+++ src/instantetymonline/core.clj
@@ -7,14 +7,10 @@
 (defn fetch-url [url]
   (html/html-resource (java.net.URL. url)))

-;; TODO: Add back verb/noun info.
-;; TODO: Keep "Ellis Island" (right now it's turned into "Ellis").
 (defn etym-words [hnodes]
   (let [raw (map html/text (html/select hnodes [:dt :a]))
         text (remove empty? raw)]
-    text
-    #_(map #(first (clojure.string/split % #" "))
-         text)))
+    text))

 ;; TODO: Use links with cross-references from here.
 (defn etym-links [hnodes]


Fixup b5e5dfb Fix the Accept header test description string

[ci skip]

--- test/unit/puppetlabs/services/legacy_routes/legacy_routes_core_test.clj
+++ test/unit/puppetlabs/services/legacy_routes/legacy_routes_core_test.clj
@@ -117,7 +117,7 @@

 (deftest test-v3-header-munging
   (testing "(SERVER-548) Header munging"
-    (testing "Accept: raw is munged to Accept: binary for all paths"
+    (testing "Accept: header is translated for use with the master-handler"
       (doseq [[path methods] accept-header-test-data
               [method examples] methods
               [example expected] examples


Changed identical? check to = check in ReactiveElement animate method.

--- src-cljs/freactive/dom.cljs
+++ src-cljs/freactive/dom.cljs
@@ -13,7 +13,7 @@
 Can be used to define custom conversions to DOM nodes or text for things such as numbers
 or dates; or can be used to define containers for DOM elements themselves."
   (-get-dom-image [x]
-    "Should return either virtual DOM (a vector or string) or an actual DOM node.
+    "Should return either virtual DOM (a vector or string) or an actual DOM node."))
 "))

 (extend-protocol IDOMImage
@@ -667,7 +667,7 @@
                 (let [new-elem (get-new-elem)
                       cur (.-cur-element state)
                       node-state (get-element-state cur)]
-                  (when-not (identical? (get-dom-image cur) (get-dom-image new-elem))
+                  (when-not (= (get-dom-image cur) (get-dom-image new-elem))
                     (if-let [hide (get-state-attr node-state ":node/on-detaching")]
                       (hide cur
                             (fn []


better test-rollbar

better test-rollbar

--- src-cljs/frontend/core.cljs
+++ src-cljs/frontend/core.cljs
@@ -332,6 +332,6 @@
   (clj->js @debug-state))

 (defn ^:export test-rollbar []
-  (swallow-errors (throw "This is an exception")))
+  (swallow-errors (throw (js/Error. "This is an exception"))))

 (defonce startup (setup!))


fix panning on windows

fix panning on windows

Windows adds repeat even on transition from keydown to keyup

--- src-cljs/frontend/core.cljs
+++ src-cljs/frontend/core.cljs
@@ -68,7 +68,7 @@
                   (= "true" (.. event -target -contentEditable)))
       (when (contains? suppressed-key-combos key-set)
         (.preventDefault event))
-      (when-not (.-repeat event)
+      (when-not (and (.-repeat event) (= "keydown" (.-type event)))
         (cast! :key-state-changed [{:key-set key-set
                                     :code (.-which event)
                                     :depressed? (= direction :down)}])))))


Protect against corrupt builds using a stamp and clean system

fixed #413

--- sidecar/src/figwheel_sidecar/build_middleware/stamp_and_clean.clj
+++ sidecar/src/figwheel_sidecar/build_middleware/stamp_and_clean.clj
@@ -3,22 +3,24 @@
    [figwheel-sidecar.utils :as utils]
    [clojure.java.io :as io]))

-;; some minimal protection against corrupt builds
-;; this is really only intended to run once at the start
-;; of an autobuild session but its fast enough to run every time
+;; Minimal protection against corrupt builds
+
+;; While minimal this will prevent plenty of headaches caused by
+;; corrupted build :output-dir directories
+
+;; This is a temporary solution until the ClojureScript compiler supports
+;; something like a :signature key

 (def user-dir-hash  (.hashCode (System/getProperty "user.dir")))

+;; could hash all jar file names??
 (def classpath-hash (.hashCode (System/getProperty "java.class.path")))

 (defn stamp-file [build-config]
-  (io/file
-   (System/getProperty "java.io.tmpdir")
-   (str
-    (hash
-     {:build-id  (.hashCode (str (:id build-config)))
-      :root-path user-dir-hash})
-    ".txt")))
+  (io/file (or (System/getProperty "user.dir")
+               (io/file "."))
+           (or (-> build-config :build-options :output-dir) "out")
+           ".figwheel-compile-stamp"))

 ;; this provides a simple map and stable order for hashing
 (defn options-that-affect-build-cache [build-config]
@@ -38,22 +40,22 @@
        (.hashCode)
        str))

-#_(count (into #{}  (take 100000 (repeatedly #(current-stamp-signature t)))))
-
 (defn stamp! [build-config]
-  (println "Stamping!")
-  (println "Stamp file" (stamp-file build-config))
-  (println "Stamp" (current-stamp-signature build-config))
-  (spit (stamp-file build-config)
-        (current-stamp-signature build-config)))
+  #_(println "Stamping!")
+  #_(println "Stamp file" (stamp-file build-config))
+  #_(println "Stamp" (current-stamp-signature build-config))
+  (let [sfile (stamp-file build-config)]
+    (.mkdirs (.getParentFile sfile))
+    (spit sfile
+          (current-stamp-signature build-config))))

 (defn stamp-value [build-state]
   (let [sf (stamp-file build-state)]
     (when (.exists sf) (slurp sf))))

 (defn stamp-matches? [build-config]
-  (println "Current Stamp " (current-stamp-signature build-config))
-  (println "Previous Stamp" (stamp-value build-config))
+  #_(println "Current Stamp " (current-stamp-signature build-config))
+  #_(println "Previous Stamp" (stamp-value build-config))
   (= (current-stamp-signature build-config)
      (stamp-value build-config)))


use list-entries-by-board so you don't hit the limit used in list-entries-by-org.

--- src/oc/storage/util/search.clj
+++ src/oc/storage/util/search.clj
@@ -48,11 +48,11 @@
   (let [now (db-common/current-timestamp)]
     (doseq [org (org-res/list-orgs conn [:team-id])]
       (let [boards (board-res/list-boards-by-org conn (:uuid org) [:access])
-            allowed-boards (vec (map :uuid boards))
-            entries (entry-res/list-entries-by-org conn (:uuid org) :desc now :before allowed-boards)]
-        (doseq [entry entries]
-          (let [board (first (filter #(= (:uuid %) (:board-uuid entry)) boards))]
-            (send-trigger! (->trigger "entry" entry org board))))))))
+            allowed-boards (vec (map :uuid boards))]
+        (doseq [board boards]
+          (let [entries (entry-res/list-entries-by-board conn (:uuid board))]
+            (doseq [entry entries]
+              (send-trigger! (->trigger "entry" entry org board)))))))))

 ;; ----- CLI -----


Catch errors when booting up the pipeline.

--- src/onyx/peer/virtual_peer.clj
+++ src/onyx/peer/virtual_peer.clj
@@ -1,7 +1,7 @@
 (ns ^:no-doc onyx.peer.virtual-peer
   (:require [clojure.core.async :refer [chan mult tap alts!! >!! <!! close!]]
             [com.stuartsierra.component :as component]
-            [taoensso.timbre :as timbre]
+            [taoensso.timbre :refer [warn] :as timbre]
             [dire.core :as dire]
             [onyx.extensions :as extensions]
             [onyx.peer.task-lifecycle-extensions :as l-ext]
@@ -11,33 +11,37 @@
   (try
     (l-ext/close-lifecycle-resources* (:pipeline-data pipeline))
     (catch Exception e
-      (timbre/warn e))))
+      (warn e))))

 (defn payload-loop [id sync queue payload-ch shutdown-ch status-ch dead-ch pulse opts]
-  (let [complete-ch (chan 1)
-        err-ch (chan 1)]
-    (loop [pipeline nil]
-      (when-let [[v ch] (alts!! [shutdown-ch err-ch complete-ch payload-ch] :priority true)]
-        (when (and (not (nil? pipeline)) (not= ch err-ch))
-          (component/stop pipeline))
+  (try
+    (let [complete-ch (chan 1)
+          err-ch (chan 1)]
+      (loop [pipeline nil]
+        (when-let [[v ch] (alts!! [shutdown-ch err-ch complete-ch payload-ch] :priority true)]
+          (when (and (not (nil? pipeline)) (not= ch err-ch))
+            (component/stop pipeline))

-        (cond (nil? v) (extensions/delete sync (:node pulse))
-              (= ch complete-ch) (recur nil)
-              (= ch shutdown-ch) (recur nil)
-              (= ch err-ch) (force-close-pipeline! pipeline)
-              (= ch payload-ch)
-              (let [payload-node (:path v)
-                    payload (extensions/read-node sync payload-node)
-                    status-ch (chan 1)]
+          (cond (nil? v) (extensions/delete sync (:node pulse))
+                (= ch complete-ch) (recur nil)
+                (= ch shutdown-ch) (recur nil)
+                (= ch err-ch) (force-close-pipeline! pipeline)
+                (= ch payload-ch)
+                (let [payload-node (:path v)
+                      payload (extensions/read-node sync payload-node)
+                      status-ch (chan 1)]

-                (extensions/on-change sync (:node/status (:nodes payload)) #(>!! status-ch %))
-                (extensions/touch-node sync (:node/ack (:nodes payload)))
+                  (extensions/on-change sync (:node/status (:nodes payload)) #(>!! status-ch %))
+                  (extensions/touch-node sync (:node/ack (:nodes payload)))

-                (<!! status-ch)
+                  (<!! status-ch)

-                (let [new-pipeline (task-lifecycle id payload sync queue payload-ch complete-ch err-ch opts)]
-                  (recur (component/start new-pipeline)))))))
-    (>!! dead-ch true)))
+                  (let [new-pipeline (task-lifecycle id payload sync queue payload-ch complete-ch err-ch opts)]
+                    (recur (component/start new-pipeline))))))))
+    (catch Exception e
+      (warn e))
+    (finally
+     (>!! dead-ch true))))

 (defrecord VirtualPeer [opts]
   component/Lifecycle


Make particle-effect delta customizable

Make particle-effect delta customizable

--- src/play_clj/core_graphics.clj
+++ src/play_clj/core_graphics.clj
@@ -227,12 +227,13 @@
     (.draw object batch x y width height)))

 (defmethod draw-entity! :particle-effect
-  [^SpriteBatch batch {:keys [^ParticleEffect object x y]}]
+  [^SpriteBatch batch {:keys [^ParticleEffect object x y delta-time]}]
   (assert object)
   (let [x (float (or x 0))
-        y (float (or y 0))]
+        y (float (or y 0))
+        delta-time (float (or delta-time (graphics! :get-delta-time)))]
     (.setPosition object x y)
-    (.draw object batch (graphics! :get-delta-time))))
+    (.draw object batch delta-time)))

 (defmethod draw-entity! :actor
   [^SpriteBatch batch {:keys [^Actor object] :as entity}]


we have a new datamodel

we have a new datamodel

--- src/survey/core.clj
+++ src/survey/core.clj
@@ -54,6 +54,16 @@
                    [:groupwork :int :null true]
                    [:birth :int :null true]
                    [:sent :bigint :null true]
+                   [:important :int :null true]
+                   [:toomany :int :null true]
+                   [:helps_me :int :null true]
+                   [:trouble :int :null true]
+                   [:support :int :null true]
+                   [:conflicts :int :null true]
+                   [:solve_conflicts :int :null true]
+                   [:fair :int :null true]
+                   [:improving :int :null true]
+                   [:nps :int :null true]
                    ]))

 ; recommended: one change per changeset


first pass at representing ALL deltas

first pass at representing ALL deltas

--- src/tile_game/coordinates.cljc
+++ src/tile_game/coordinates.cljc
@@ -15,9 +15,12 @@
 (defn add [[x y] [dx dy]]
   [(+ x dx) (+ y dy)])

+(s/def ::coord-delta #{-1 0 1})
+(s/def ::delta (s/tuple ::coord-delta ::coord-delta))
 (s/def ::coordinate (s/and int? pos?))
 (s/def ::point (s/tuple ::coordinate ::coordinate))
-(comment (gen/sample (s/gen ::point)))
+(comment (gen/sample (s/gen ::point))
+         (gen/sample (s/gen ::delta)))
 (defn adjacent-to
   "Lists adjacent coordinates in clockwise order"
   [p]


Adds rename-document to persistence

Adds rename-document to persistence

--- src/wordsmith/persistence.cljs
+++ src/wordsmith/persistence.cljs
@@ -19,6 +19,11 @@
   (let [k (generate-key title)]
     (.removeItem js/localStorage k)))

+(defn rename-document [old-title new-title]
+  (let [value (get-document old-title)]
+    (set-document new-title value)
+    (remove-document old-title)))
+
 (defn get-all-titles []
   (let [ks (.keys js/Object js/localStorage)
         filtered (filter #(= (.substring % 0 prefix-length) prefix) ks)]


add rule: ([:sem :aspect] = :perfect AND [:sem :tense] = :past) => [:infl] = :past

--- src/babel/english/grammar.cljc
+++ src/babel/english/grammar.cljc
@@ -71,7 +71,13 @@
              {:synsem {:cat :verb
                        :sem {:aspect :progressive
                              :tense :past}
-                       :infl :imperfect}}))]
+                       :infl :imperfect}})
+            (apply-default-if
+             verb-default?
+             {:synsem {:cat :verb
+                       :sem {:aspect :perfect
+                             :tense :past}
+                       :infl :past}}))]
     (log/debug (str "English: do-defaults (post) on tree: " (fo result)))
     result))


+"yourself" with grammar symbols

+"yourself" with grammar symbols

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -2371,6 +2371,30 @@
                     :pred :tu}
               :subcat '()}}]

+   "yourself (♀)"
+   {:synsem {:cat :noun
+             :pronoun true
+             :case :acc
+             :reflexive true
+             :agr {:person :2nd
+                   :number :sing
+                   :gender :fem}
+             :sem {:human true
+                   :pred :tu}
+             :subcat '()}}
+
+   "yourself (♂)"
+   {:synsem {:cat :noun
+             :pronoun true
+             :case :acc
+             :reflexive true
+             :agr {:person :2nd
+                   :number :sing
+                   :gender :masc}
+             :sem {:human true
+                   :pred :tu}
+             :subcat '()}}
+
    "yourselves"
    [{:synsem {:cat :noun
               :pronoun true


added note to hit past tense

added note to hit past tense

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -949,7 +949,8 @@
                     :sem {:of {:pred :lui}}
                     :def :possessive}}]

-   "hit" {:english {:past "hit"}
+   "hit"{:english {:past {:english "hit"
+                     :note "past tense"}}
           :synsem {:cat :verb
                    :sem {:pred :hit}}}
    "hold"


+aimer

+aimer

--- src/babel/francais/lexicon.clj
+++ src/babel/francais/lexicon.clj
@@ -22,6 +22,10 @@

    "aider" {:synsem {:cat :verb
                      :sem {:pred :aiutare}}}
+
+   "aimer" {:synsem {:cat :verb
+                     :sem {:pred :amare
+                           :subj {:human true}}}}

    "aller" {:français {:essere true
                        :future-stem "ir"


Emit event only when scraped some links

Emit event only when scraped some links

--- src/servisne_info/tasks/scrape.clj
+++ src/servisne_info/tasks/scrape.clj
@@ -32,4 +32,5 @@
 (def scrape-task
   (deftask "scrape"
     (let [saved-links-count (save-links)]
-      (event/record "Scraping new links" {:count saved-links-count}))))
+      (if (> saved-links-count 0)
+        (event/record "Scraping new links" {:count saved-links-count})))))


Test test-job-does-not-exist-response

Test test-job-does-not-exist-response

--- test/emender_jenkins/rest_api_test.clj
+++ test/emender_jenkins/rest_api_test.clj
@@ -282,3 +282,12 @@
             {:status "error" :command "command" :message nil}       (create-bad-request-response "command" nil)
             {:status "error" :command nil       :message nil}       (create-bad-request-response nil nil))))

+(deftest test-job-does-not-exist-response
+    "Check the function emender-jenkins.rest-api/job-does-not-exist-response."
+    (testing "the function emender-jenkins.rest-api/job-does-not-exist-response."
+        (are [x y] (= x y)
+            {:status "error" :jobName "jobName" :command "create_job" :message "Job does not exist"} (job-does-not-exist-response "jobName" :create-job)
+            {:status "error" :jobName "jobName" :command nil          :message "Job does not exist"} (job-does-not-exist-response "jobName" nil)
+            {:status "error" :jobName nil       :command "create_job" :message "Job does not exist"} (job-does-not-exist-response nil :create-job)
+            {:status "error" :jobName nil       :command nil          :message "Job does not exist"} (job-does-not-exist-response nil nil))))
+


Made your Title Better.

Made your Title Better.

--- src/benjaminwarfield/views.clj
+++ src/benjaminwarfield/views.clj
@@ -4,7 +4,7 @@
 (defn index-view []
 	(html5
 		[:head
-		  [:title "Benjamin Warfield Smith"]
+		  [:title "Benjamin Warfield Smith is a BADASS!"]
 		  (include-css "/stylesheets/base.css")]
 		[:body
 		  [:div {:class "container"}


Remove an apparently stray debugging prn that was causing tests to fail.

--- test/flatland/useful/dispatch_test.clj
+++ test/flatland/useful/dispatch_test.clj
@@ -11,8 +11,7 @@

 (deftest test-imported-functions
   (let [fn-name 'flatland.useful.dispatch-test/rename-keys
-        dispatch (dispatcher (constantly fn-name))]
-    (prn (dispatch {:a 1} {:a :b}))
+        dispatch (dispatcher (constantly fn-name))]
     (is (thrown? Exception (dispatch {:a 1} {:a :b})))))

 (deftest test-dispatch


Research Grant copy update

Research Grant copy update

--- src/clj/game/cards-agendas.clj
+++ src/clj/game/cards-agendas.clj
@@ -305,7 +305,7 @@

    "Research Grant"
    {:req (req (not (empty? (filter #(= (:title %) "Research Grant") (all-installed state :corp)))))
-    :prompt "Choose to score another installed copy of Research Grant2 (optional)"
+    :prompt "Choose to score another installed copy of Research Grant (optional)"
     :choices {:req #(= (:title %) "Research Grant")}
     :effect (effect (score (assoc target :advance-counter (:advancementcost target))))
     :msg (msg "score another copy of Research Grant")


Sunshine, lollipops and rainbows

Sunshine, lollipops and rainbows

--- src/clj/mokkameister/train.clj
+++ src/clj/mokkameister/train.clj
@@ -48,4 +48,5 @@
    "Det er kaffi å få på kjøken!"
    "KEEP CALM THE COFFEE IS READY!"
    "M-m-m-m-m-microdosing! :syringe::syringe::syringe::exclamation:"
-   "PLEASE PROCEED IN ORDERLY FASHION TO RECEIVE COFFEE :syringe:"))
+   "PLEASE PROCEED IN ORDERLY FASHION TO RECEIVE COFFEE :syringe:"
+   ":steam_locomotive::sun_with_face::lollipop::sun_with_face::lollipop::sun_with_face::lollipop::sun_with_face::rainbow:"))


Use clj-http connection pool

Use clj-http connection pool

--- src/clj/salava/badge/parse.clj
+++ src/clj/salava/badge/parse.clj
@@ -6,6 +6,7 @@
             [clojure.data.json :as json]
             [clojure.pprint :refer [pprint]]
             [clojure.xml :as xml]
+            [clj-http.client :as clj-http]
             [net.cgrand.enlive-html :as html]
             [salava.core.util :as u]
             [salava.core.http :as http]
@@ -531,25 +532,25 @@
   ([user assertion initial]
    (verify-assertion (:assertion_url initial) assertion)
    (let [now (u/now)]
-     (-> initial
-         (assoc :id nil
-                :user_id (:id user)
-                :email   (recipient (:emails user) assertion)
-                :status "pending"
-                :visibility "private"
-                :show_recipient_name 0
-                :rating nil
-                :ctime now
-                :mtime now
-                :deleted 0
-                :revoked 0
-                :issuer_verified 0
-                :show_evidence 0
-                :last_checked nil
-                :old_id nil)
-         (badge-content assertion)
-         valid-badge
-         ))))
+     (clj-http/with-connection-pool {:timeout 10 :threads 4 :insecure? false :default-per-route 10}
+       (-> initial
+           (assoc :id nil
+                  :user_id (:id user)
+                  :email   (recipient (:emails user) assertion)
+                  :status "pending"
+                  :visibility "private"
+                  :show_recipient_name 0
+                  :rating nil
+                  :ctime now
+                  :mtime now
+                  :deleted 0
+                  :revoked 0
+                  :issuer_verified 0
+                  :show_evidence 0
+                  :last_checked nil
+                  :old_id nil)
+           (badge-content assertion)
+           valid-badge)))))

 ;;;


remove debug output

remove debug output

--- src/clj/traveler/templates.clj
+++ src/clj/traveler/templates.clj
@@ -44,9 +44,6 @@
 (defn nav-side
   "Generate the sidebar"
   [request]
-  (prn (:helmsman request))
-  (prn (h-nav/id->uri-path request :traveler/dashboard))
-  (prn (h-uri/relative-uri-str request (h-nav/id->uri-path request :traveler/dashboard)))
   (timber/main-menu
    [{:menu-name "Dashboard"
      :menu-url  (t-utils/id-uri request :traveler/dashboard)}


Extract common automaton's state transition function.

--- src/cljs/beatha/automaton.cljs
+++ src/cljs/beatha/automaton.cljs
@@ -43,6 +43,19 @@
               [(rem x width) (rem y height)]))
           (neighbours coords))))

+(defn- transition
+  [this grid tfn]
+  (let [{:keys [width height cells]} grid]
+    (->>
+     (range height)
+     (mapcat
+      (fn [y] (map (fn [x] (tfn this width height cells x y)) (range width))))
+     (remove #(let [[cell] (vals %)] (nil? cell)))
+     (remove #(let [[cell] (vals %)] (= (:state cell) :dead)))
+     (reduce merge {})
+     (assoc grid :cells))))
+
+
 (def default-automata
   (reify
     AutomatonSpecification
@@ -64,32 +77,23 @@
       [_ state]
       ({:dead :alive :alive :dead} state))
     (next-grid [this grid]
-      (let [{:keys [width height cells]} grid]
-        (->> (mapcat
-               (fn [y]
-                 (map
-                  (fn [x]
-                    (let [get-cell (fn [coords]
-                                     (get cells coords (default-cell this)))
-                          n (->> (neighbours width height [x y])
-                                 (map get-cell)
-                                 (filter #(= (:state %) :alive))
-                                 count)
-                          cell (get-cell [x y])
-                          alive? (= (:state cell) :alive)]
-                      {[x y]
-                       (cond
-                        (and alive? (< n 2))              {:state :dead}
-                        (and alive? (or (= n 2) (= n 3))) {:state :alive}
-                        (and alive? (> n 3))              {:state :dead}
-                        (and (not alive?) (= n 3))        {:state :alive}
-                        :else                             cell)}))
-                  (range width)))
-               (range height))
-             (remove #(let [[cell] (vals %)] (nil? cell)))
-             (remove #(let [[cell] (vals %)] (= (:state cell) :dead)))
-             (reduce merge {})
-             (assoc grid :cells))))
+      (transition
+       this grid
+       (fn [this width height cells x y]
+         (let [get-cell (fn [coords] (get cells coords (default-cell this)))
+               n (->> (neighbours width height [x y])
+                      (map get-cell)
+                      (filter #(= (:state %) :alive))
+                      count)
+               cell (get-cell [x y])
+               alive? (= (:state cell) :alive)]
+           {[x y]
+            (cond
+             (and alive? (< n 2))              {:state :dead}
+             (and alive? (or (= n 2) (= n 3))) {:state :alive}
+             (and alive? (> n 3))              {:state :dead}
+             (and (not alive?) (= n 3))        {:state :alive}
+             :else                             cell)}))))

     InformationChannelsSpecification
     (process-info-channel [this ic])
@@ -105,79 +109,68 @@
       [_ state]
       ({:dead :a :a :b :b :dead} state))
     (next-grid [this grid]
-      (let [{:keys [width height cells]} grid]
-        (->> (mapcat
-               (fn [y]
-                 (map
-                  (fn [x]
-                    (let [get-cell (fn [coords]
-                                     (get cells coords (default-cell this)))
-                          n-states (->> (neighbours width height [x y])
-                                       (map (comp :state get-cell))
-                                       (interleave [:top-left :left
-                                                    :bottom-left :top
-                                                    :bottom :top-right
-                                                    :right :bottom-right])
+      (transition
+       this grid
+       (fn [this width height cells x y]
+         (let [get-cell (fn [coords] (get cells coords (default-cell this)))
+               n-states (->> (neighbours width height [x y])
+                             (map (comp :state get-cell))
+                             (interleave [:top-left :left :bottom-left
+                                          :top :bottom :top-right
+                                          :right :bottom-right])
                                        (apply hash-map))
-                          {:keys [top-left top top-right left right
-                                  bottom-left bottom bottom-right]} n-states
-                          cell (get-cell [x y])
-                          s (:state cell)
-                          letter? #{:a :b}
-                          dead? #(= :dead %)
-                          alive-only
-                          (fn [dir pred]
-                            (and (pred (dir n-states))
-                                 (every? dead? (vals (dissoc n-states dir)))))
+               {:keys [top-left top top-right left right
+                       bottom-left bottom bottom-right]} n-states
+               cell (get-cell [x y])
+               s (:state cell)
+               letter? #{:a :b}
+               dead? #(= :dead %)
+               alive-only
+               (fn [dir pred]
+                 (and (pred (dir n-states))
+                      (every? dead? (vals (dissoc n-states dir)))))

-                          between-l-r
-                          (fn [left-states right-states]
-                            (and (left-states (:left n-states))
-                                 (right-states (:right n-states))))]
-                      {[x y]
-                       {:state
-                        (cond
-                         (and (dead? s) (alive-only :right letter?))    :lc
-                         (and (dead? s) (alive-only :left letter?))     :rc
-                         (and (dead? s)
-                              (or (alive-only :right #{:lc})
-                                  (alive-only :left #{:rc})))           :x
-                         (and (= :lc s)
-                              (between-l-r #{:x :a :b :dead} letter?))  right
-                         (and (= :rc s)
-                              (between-l-r letter? #{:x :a :b :dead}))  left
-                         (and (letter? s) (between-l-r #{:lc} letter?)) :lc
-                         (and (letter? s) (between-l-r letter? #{:rc})) :rc
-                         (between-l-r #{:lc} #{:rc})                    :f
-                         (or (and (= :lc s) (= :rc right))
-                             (and (= :lc left) (= :rc s)))              :m
-                         (and (dead? s) (= :m top))                     :n
-                         (and (dead? s) (letter? top) (= :n right))     :n
-                         (and (dead? s) (letter? top)
-                              (#{:n :a :b} left))                       top
-                         (and (= :n s) (letter? right))                 right
-                         (and (letter? s) (= :n left))                  :n
-                         (and (letter? s) (= :x left) (= s bottom))     :x
-                         (and (letter? s) (= :x left)
-                              (letter? bottom) (not (= s bottom)))      :f
-                         (and (= :m s) (= :x left))                     :s
-                         :else                                          s)}}))
-                  (range width)))
-               (range height))
-             (remove #(let [[cell] (vals %)] (nil? cell)))
-             (remove #(let [[cell] (vals %)] (= (:state cell) :dead)))
-             (reduce merge {})
-             (assoc grid :cells))))
+               between-l-r
+               (fn [left-states right-states]
+                 (and (left-states (:left n-states))
+                      (right-states (:right n-states))))]
+           {[x y]
+            {:state
+             (cond
+              (and (dead? s) (alive-only :right letter?))    :lc
+              (and (dead? s) (alive-only :left letter?))     :rc
+              (and (dead? s)
+                   (or (alive-only :right #{:lc})
+                       (alive-only :left #{:rc})))           :x
+              (and (= :lc s)
+                   (between-l-r #{:x :a :b :dead} letter?))  right
+              (and (= :rc s)
+                   (between-l-r letter? #{:x :a :b :dead}))  left
+              (and (letter? s) (between-l-r #{:lc} letter?)) :lc
+              (and (letter? s) (between-l-r letter? #{:rc})) :rc
+              (between-l-r #{:lc} #{:rc})                    :f
+              (or (and (= :lc s) (= :rc right))
+                  (and (= :lc left) (= :rc s)))              :m
+              (and (dead? s) (= :m top))                     :n
+              (and (dead? s) (letter? top) (= :n right))     :n
+              (and (dead? s) (letter? top)
+                   (#{:n :a :b} left))                       top
+              (and (= :n s) (letter? right))                 right
+              (and (letter? s) (= :n left))                  :n
+              (and (letter? s) (= :x left) (= s bottom))     :x
+              (and (letter? s) (= :x left)
+                   (letter? bottom) (not (= s bottom)))      :f
+              (and (= :m s) (= :x left))                     :s
+              :else                                          s)}}))))

     InformationChannelsSpecification
     (process-info-channel [this ic])
     (fill-output-info-channel [this grid oc]
-      (put! oc
-            (->> grid
-                 :cells
-                 vals
-                 (group-by :state)
-                 (#(select-keys % [:s :f]))
-                 (map (fn [[k v]] [k (count v)]))
-                 (into {})
-                 (merge {:s 0 :f 0}))))))
+      (put! oc (->> grid
+                    :cells
+                    vals
+                    (group-by :state)
+                    (#(select-keys % [:s :f]))
+                    (map (fn [[k v]] [k (count v)]))
+                    (into {})
+                    (merge {:s 0 :f 0}))))))


Implements elementary undo on 'z' keyup

Implements elementary undo on 'z' keyup

--- src/cljs/chess/components.cljs
+++ src/cljs/chess/components.cljs
@@ -33,6 +33,8 @@
     (display-name [_]
       "square")))

+
+
 (defn board [{:keys [game hist] :as app-state} owner]
   (reify
     om/IInitState
@@ -53,10 +55,11 @@
     om/IDidMount
     (did-mount [_]
       (let [action-chan (om/get-state owner :action-chan)]
+        (.addEventListener js/window "keyup" #(put! action-chan {:type :keyup
+                                                                 :key (.-keyCode %)}))
         (go-loop []
                  (let [message (<! action-chan)
                        message-type (message :type)]
-                   (println message-type)
                    (condp = message-type
                      :click (let [new-selection (message :square)
                                   old-selection (om/get-state owner :selected)]
@@ -65,10 +68,20 @@
                                   (om/transact! app-state
                                                 (fn [{:keys [game hist]}]
                                                   {:game (move game old-selection new-selection)
-                                                   :hist (vec (conj (seq hist) game))}))
+                                                   :hist (vec (cons game hist))}))
                                   (om/set-state! owner :selected nil))
                                 (if (in (deref game) new-selection)
-                                  (om/set-state! owner :selected new-selection))))))
+                                  (om/set-state! owner :selected new-selection))))
+                     :keyup (if (= 90 (message :key))
+                              (do
+                                (om/transact! app-state
+                                              (fn [{hist :hist :as state}]
+                                                (if-not (empty? hist)
+                                                  {:game (first hist)
+                                                   :hist (rest hist)}
+                                                  state)))
+
+                                (om/set-state! owner :selected nil)))))
                  (recur))))
     om/IDisplayName
     (display-name [_]


waves -> oscillators

waves -> oscillators

--- src/clojure2d/extra/glitch.clj
+++ src/clojure2d/extra/glitch.clj
@@ -22,7 +22,7 @@
   ([n]
    (let [f (fn []
              (let [r (r/irand 4)]
-               {:wave (rand-nth s/waves)
+               {:wave (rand-nth s/oscillators)
                 :freq (freqs r)
                 :amp (amps r)
                 :phase (r/drand)}))]


Fix timers.rest-test after task change

Fix timers.rest-test after task change

Co-authored-by: Samrat Man Singh <de71a275ed207d9c2083ebfa9af5dcdfa3ea2b88@nilenso.com>

--- test/time_tracker/timers/rest_test.clj
+++ test/time_tracker/timers/rest_test.clj
@@ -6,7 +6,7 @@
             [time-tracker.db :as db]
             [time-tracker.timers.db :as timers-db]
             [time-tracker.projects.test-helpers :as projects-helpers]
-            [time-tracker.test-helpers :as helpers]
+            [time-tracker.test-helpers :refer [populate-db] :as helpers]
             [time-tracker.util :as util]))

 (use-fixtures :once fixtures/init! fixtures/migrate-test-db fixtures/serve-app)
@@ -17,35 +17,35 @@
   (s/join [(helpers/settings :api-root) "timers/"]))

 (deftest list-all-owned-timers-test
-  (let [gen-projects   (projects-helpers/populate-data! {"gid1" ["foo"]
-                                                         "gid2" ["goo"]})
+  (let [task-id1 (first (:task-ids (populate-db "gid1")))
+        task-id2 (first (:task-ids (populate-db "gid2")))
         url            (timers-api)
         current-time   (util/current-epoch-seconds)
         seconds-in-day (* 60 60 24)
         timer1         (timers-db/create! (db/connection)
-                                          (get gen-projects "foo")
+                                          task-id1
                                           "gid1"
                                           current-time
                                           "")
         timer2         (timers-db/create! (db/connection)
-                                          (get gen-projects "foo")
+                                          task-id1
                                           "gid1"
                                           current-time
                                           "")
         timer3         (timers-db/create! (db/connection)
-                                          (get gen-projects "goo")
+                                          task-id2
                                           "gid2"
                                           current-time
                                           "")
         ;; Create a timer yesterday.
         timer4         (timers-db/create! (db/connection)
-                                          (get gen-projects "foo")
+                                          task-id1
                                           "gid1"
                                           (- current-time seconds-in-day)
                                           "")
         ;; Create a timer in the future.
         timer5         (timers-db/create! (db/connection)
-                                          (get gen-projects "foo")
+                                          task-id1
                                           "gid1"
                                           (+ current-time seconds-in-day)
                                           "")]


Touch ups to ES mapping

Touch ups to ES mapping

Include the IDs, titles, and descriptions in the _all field.  Do not
analyze IDs, but analyze titles and description.

--- src/ctia/stores/es/mapping.clj
+++ src/ctia/stores/es/mapping.clj
@@ -1,47 +1,67 @@
 (ns ctia.stores.es.mapping)

+;; This provides a reasonable default mapping for all of our entities.
+;; It aschews nested objects since they are performance risks, and
+;; restricts the _all to a minimal set.
+
+
 (def ts {:type "date" :format "date_time"})
+
 (def string {:type "string" :index "not_analyzed"})
+(def all_string {:type "string"
+                 :index "not_analyzed"
+                 :include_in_all true})
+
+(def text {:type "string"})
+(def all_text {:type "string" :copy_to "_all"})

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

-(def valid-time
+(def nested-valid-time
   {:type "nested"
    :properties
    {:start_time ts
     :end_time ts}})

+(def valid-time
+  {:properties
+   {:start_time ts
+    :end_time ts}})
+
 (def attack-pattern
-  {:type "nested"
-   :properties
-   {:description string
+  {:properties
+   {:description text
     :capec_id string}})

 (def malware-instance
-  {:type "nested"
-   :properties
-   {:description string
+  {:properties
+   {:description text
     :malware_type string}})

 (def observable
-  {:type "nested"
+  {:type "object"
    :properties
    {:type string
-    :value string}})
+    :value all_string}})
+
+(def nested-observable
+  {:type "nested"
+   :include_in_all true
+   :properties
+   {:type string
+    :value all_string}})

 (def behavior
-  {:type "nested"
-   :properties
+  {:properties
    {:attack_patterns attack-pattern
     :malware_type malware-instance}})

 (def tool
-  {:type "nested"
-   :properties
-   {:description string
+  {:properties
+   {:description text
     :type string
     :references string
     :vendor string
@@ -49,94 +69,78 @@
     :service_pack string}})

 (def infrastructure
-  {:type "nested"
-   :properties
-   {:description string
+  {:properties
+   {:description text
     :type string}})

 (def related-identities
-  {:type "nested"
-   :properties (assoc related
-                      :identity_id string)})
+  {:properties (assoc related
+                      :identity_id all_string)})

 (def related-actors
-  {:type "nested"
-   :properties (assoc related
-                      :actor_id string)})
+  {:properties (assoc related
+                      :actor_id all_string)})

 (def tg-identity
-  {:type "nested"
-   :properties
-   {:description string
+  {:properties
+   {:description text
     :related_identities related-identities}})

 (def victim-targeting
-  {:type "nested"
-   :properties
+  {:properties
    {:identity tg-identity
     :targeted_systems string
     :targeted_information string
     :targeted_observables observable}})

 (def resource
-  {:type "nested"
-   :properties
+  {:properties
    {:tools tool
     :infrastructure infrastructure
     :providers identity}})

 (def activity
-  {:type "nested"
-   :properties
+  {:properties
    {:date_time ts
-    :description string}})
+    :description text}})

 (def related-indicators
-  {:type "nested"
-   :properties
+  {:properties
    (assoc related
-          :indicator_id string)})
+          :indicator_id all_string)})

 (def related-judgements
-  {:type "nested"
-   :properties
+  {:properties
    (assoc related
-          :judgement_id string)})
+          :judgement_id all_string)})

 (def related-coas
-  {:type "nested"
-   :properties
+  {:properties
    (assoc related
-          :COA_id string)})
+          :coa_id all_string)})

 (def related-campaigns
-  {:type "nested"
-   :properties
+  {:properties
    (assoc related
-          :campaign_id string)})
+          :campaign_id all_string)})

 (def related-exploit-targets
-  {:type "nested"
-   :properties (assoc related
-                      :exploit_target_id string)})
+  {:properties (assoc related
+                      :exploit_target_id all_string)})
 (def related-ttps
-  {:type "nested"
-   :properties (assoc related
-                      :ttp_id string)})
+  {:properties (assoc related
+                      :ttp_id all_string)})

 (def related-incidents
-  {:type "nested"
-   :properties (assoc related
-                      :incident_id string)})
+  {:properties (assoc related
+                      :incident_id all_string)})

 (def related-sightings
-  {:type "nested"
-   :properties (assoc related
-                      :sighting_id string)})
+  {:properties (assoc related
+                      :sighting_id all_string)})

 (def specifications
-  {:type "nested"
-   :properties
+  {:properties
    {:judgements string
     :required_judgements related-judgements
     :query string
@@ -146,8 +150,7 @@
     :open_IOC string}})

 (def incident-time
-  {:type "nested"
-   :properties
+  {:properties
    {:first_malicious_action ts
     :initial_compromise ts
     :first_data_exfiltration ts
@@ -160,25 +163,22 @@

 (def non-public-data-compromised
-  {:type "nested"
-   :properties
+  {:properties
    {:security_compromise string
     :data_encrypted {:type "boolean"}}})

 (def property-affected
-  {:type "nested"
-   :properties
+  {:properties
    {:property string
-    :description_of_effect string
+    :description_of_effect text
     :type_of_availability_loss string
     :duration_of_availability_loss string
     :non_public_data_compromised non-public-data-compromised}})

 (def affected-asset
-  {:type "nested"
-   :properties
+  {:properties
    {:type string
-    :description string
+    :description text
     :ownership_class string
     :management_class string
     :location_class string
@@ -186,37 +186,32 @@
     :identifying_observables observable}})

 (def direct-impact-summary
-  {:type "nested"
-   :properties
+  {:properties
    {:asset_losses string
     :business_mission_distruption string
     :response_and_recovery_costs string}})

 (def indirect-impact-summary
-  {:type "nested"
-   :properties
+  {:properties
    {:loss_of_competitive_advantage string
     :brand_and_market_damage string
     :increased_operating_costs string
     :local_and_regulatory_costs string}})

 (def loss-estimation
-  {:type "nested"
-   :properties
+  {:properties
    {:amount {:type "long"}
     :iso_currency_code string}})

 (def total-loss-estimation
-  {:type "nested"
-   :properties
+  {:properties
    {:initial_reported_total_loss_estimation loss-estimation
     :actual_total_loss_estimation loss-estimation
     :impact_qualification string
     :effects string}})

 (def impact-assessment
-  {:type "nested"
-   :properties
+  {:properties
    {:direct_impact_summary direct-impact-summary
     :indirect_impact_summary indirect-impact-summary
     :total_loss_estimation total-loss-estimation
@@ -224,8 +219,7 @@
     :effects string}})

 (def contributor
-  {:type "nested"
-   :properties
+  {:properties
    {:role string
     :name string
     :email string
@@ -235,26 +229,23 @@
     :contribution_location string}})

 (def coa-requested
-  {:type "nested"
-   :properties
+  {:properties
    {:time ts
     :contributors contributor
-    :COA string}})
+    :coa_id all_string}})

 (def history
-  {:type "nested"
-   :properties
+  {:properties
    {:action_entry coa-requested
     :journal_entry string}})

 (def vulnerability
-  {:type "nested"
-   :properties
+  {:properties
    {:title string
-    :description string
+    :description text
     :is_known {:type "boolean"}
     :is_public_acknowledged {:type "boolean"}
-    :short_description string
+    :short_description text
     :cve_id string
     :osvdb_id string
     :source string
@@ -264,30 +255,30 @@
     :references string}})

 (def weakness
-  {:type "nested"
-   :properties
-   {:description string
+  {:properties
+   {:description text
     :cwe_id string}})

 (def configuration
-  {:type "nested"
-   :description string
-   :short_description string
-   :cce_id string})
+  {:properties
+   {:description text
+    :short_description text
+    :cce_id string}})

 (def sighting
-  {:type "nested"
-   :properties
+  {:properties
    {:timestamp ts
     :source string
     :reference string
     :confidence string
-    :description string
+    :description all_text
     :related_judgements related-judgements}})

 (def judgement-mapping
   {"judgement"
-   {:properties
+   {:dynamic false
+    :include_in_all false
+    :properties
     {:id string
      :type string
      :observable observable
@@ -308,7 +299,9 @@

 (def feedback-mapping
   {"feedback"
-   {:properties
+   {:dynamic false
+    :include_in_all false
+    :properties
     {:id string
      :type string
      :judgement string
@@ -321,16 +314,17 @@

 (def indicator-mapping
   {"indicator"
-   {:properties
+   {:dynamic false
+    :include_in_all false
+    :properties
     {:id string
      :type string
-     :title string
-     :alternate_ids string
+     :title all_text
+     :description all_text
+     :alternate_ids all_string
      :version string
      :negate {:type "boolean"}
      :indicator_type string
-     :observable observable
-     :judgements related-judgements
      :composite_indicator_expression {:type "nested"
                                       :properties
                                       {:operator string
@@ -353,8 +347,12 @@

 (def ttp-mapping
   {"ttp"
-   {:properties
-    {:id string
+   {:dynamic false
+    :include_in_all false
+    :properties
+    {:id all_string
+     :title all_text
+     :description all_text
      :type string
      :valid_time valid-time
      :version string
@@ -374,8 +372,12 @@

 (def actor-mapping
   {"actor"
-   {:properties
-    {:id string
+   {:dynamic false
+    :include_in_all false
+    :properties
+    {:id all_string
+     :title all_text
+     :description all_text
      :type string
      :valid_time valid-time
      :actor_type string
@@ -395,11 +397,15 @@

 (def campaign-mapping
   {"campagin"
-   {:properties
-    {:id string
-     :type string
-     :valid_time valid-time
-     :names string
+   {:dynamic false
+    :include_in_all false
+    :properties
+    {:id all_string
+     :type string
+     :title all_text
+     :description all_text
+     :valid_time valid-time
+     :names all_string
      :intended_effect string
      :status string
      :related_TTPs related-ttps
@@ -417,9 +423,13 @@

 (def coa-mapping
   {"coa"
-   {:properties
-    {:id string
-     :type string
+   {:dynamic false
+    :include_in_all false
+    :properties
+    {:id all_string
+     :type string
+     :title all_text
+     :description all_text
      :valid_time valid-time
      :stage string
      :coa_type string
@@ -435,9 +445,13 @@

 (def incident-mapping
   {"incident"
-   {:properties
-    {:id string
-     :type string
+   {:dynamic false
+    :include_in_all false
+    :properties
+    {:id all_string
+     :type string
+     :title all_text
+     :description all_text
      :valid_time valid-time
      :confidence string
      :status string
@@ -453,8 +467,8 @@
      :source string
      :security_compromise string
      :discovery_method string
-     :COA_requested coa-requested
-     :COA_taken coa-requested
+     :coa_requested coa-requested
+     :coa_taken coa-requested
      :contact string
      :history history
      :related_indicators related-indicators
@@ -469,9 +483,13 @@

 (def exploit-target-mapping
   {"exploit-target"
-   {:properties
-    {:id string
-     :type string
+   {:dynamic false
+    :include_in_all false
+    :properties
+    {:id all_string
+     :type string
+     :title all_text
+     :description all_text
      :valid_time valid-time
      :version string
      :vulnerability vulnerability
@@ -486,7 +504,9 @@

 (def identity-mapping
   {"identity"
-   {:properties
+   {:dynamic false
+    :include_in_all false
+    :properties
     {:id string
      :role string
      :capabilities string
@@ -494,14 +514,18 @@

 (def sighting-mapping
   {"sighting"
-   {:properties
-    {:id string
-     :type string
+   {:dynamic false
+    :include_in_all false
+    :properties
+    {:id all_string
+     :type string
+     :description all_text
      :timestamp ts
      :source string
      :reference string
      :confidence string
-     :related-judgements related-judgements
+     :related_judgements related-judgements
+     :related_observables observable
      :owner string
      :created ts
      :modified ts}}})


feat(minify): 3 add multimethod for new type of config

--- src/asset_minifier/core.clj
+++ src/asset_minifier/core.clj
@@ -9,6 +9,7 @@
            java.io.File
            org.apache.commons.io.IOUtils
            java.util.logging.Level
+           java.util.Map
            java.nio.charset.Charset
            clojure.lang.Sequential
            [com.google.javascript.jscomp
@@ -171,17 +172,35 @@
       (minify-html-asset asset target opts))
     (compression-details assets (aggregate target html))))

-(defn minify
-  "assets are specified using a map where the key is the output file and the value is the asset paths, eg:
+(def asset-type-minifier {:html minify-html
+                          :css minify-css
+                          :js minify-js})
+
+(defmulti minify
+  "assers are specified using a vector of configs
+  [[:html {:source \"dev/resource/html\" :target \"dev/minified/html\"}]
+   [:css {:source \"dev/resources/css\" :target \"dev/minified/css/styles.min.css\"}]
+   [:js {:source [\"dev/res/js1\", \"dev/res/js2\"] :target \"dev/minified/js/script.min.js\"}]]
+
+  or specified using a map where the key is the output file and the value is the asset paths, eg:
   {\"site.min.css\" \"dev/resources/css\"
   \"site.min.js\" \"dev/resources/js/site.js\"
   \"vendor.min.js\" [\"dev/resources/vendor1/js\"
   \"dev/resources/vendor2/js\"]}"
-  [assets & [opts]]
+  class)
+
+(defmethod minify Sequential [config]
+  (println config)
+  (doseq [[asset-type opts] config]
+    (println asset-type opts)
+    (let [minify-fn (get asset-type-minifier asset-type)]
+      (minify-fn (:source opts) (:target opts) (:opts opts)))))
+
+(defmethod minify Map [assets & [opts]]
   (into {}
-        (for [[target path] assets]
-          [[path target]
-           (cond
-             (.endsWith target js)  (minify-js path target opts)
-             (.endsWith target css) (minify-css path target opts)
-             :else (throw (ex-info "unrecognized target" target)))])))
+    (for [[target path] assets]
+      [[path target]
+       (cond
+         (.endsWith target js)  (minify-js path target opts)
+         (.endsWith target css) (minify-css path target opts)
+         :else (throw (ex-info "unrecognized target" target)))])))


(TK-374) Remove obsolete SSL ciphers

(TK-374) Remove obsolete SSL ciphers

--- src/puppetlabs/trapperkeeper/services/webserver/jetty9_config.clj
+++ src/puppetlabs/trapperkeeper/services/webserver/jetty9_config.clj
@@ -66,11 +66,7 @@
    "TLS_RSA_WITH_AES_256_CBC_SHA256"
    "TLS_RSA_WITH_AES_256_CBC_SHA"
    "TLS_RSA_WITH_AES_128_CBC_SHA256"
-   "TLS_RSA_WITH_AES_128_CBC_SHA"
-
-   "SSL_RSA_WITH_RC4_128_SHA"
-   "SSL_RSA_WITH_3DES_EDE_CBC_SHA"
-   "SSL_RSA_WITH_RC4_128_MD5"])
+   "TLS_RSA_WITH_AES_128_CBC_SHA"])
 (def default-protocols ["TLSv1" "TLSv1.1" "TLSv1.2"])
 (def default-client-auth :need)


Add stack printing

Add stack printing

--- src/aurora/interpreter.cljs
+++ src/aurora/interpreter.cljs
@@ -158,7 +158,7 @@
         program (into {} (for [pipe example] [(:id pipe) pipe]))]
     (try
       [(run-pipe program (get program "root") inputs stack) (aget stack 0)]
-      (catch :default e [e stack]))))
+      (catch :default e [e (aget stack 0)]))))

 (run-example example-a [1 4 2])

@@ -172,3 +172,23 @@
 (run-example example-c [1])
 (run-example example-c [7])
 (run-example example-c [10])
+
+(.join (make-array 10) " ")
+
+(defn print-stack
+  ([frame]
+   (print-stack 0 frame))
+  ([indent frame]
+   (println (.join (make-array indent) " ") "=>" (.-id frame) (.-vars frame))
+   (doseq [call (.-calls frame)]
+     (print-stack (+ indent 2) call))
+   (when (js* "(~{} in ~{})" "result" frame) ; seriously?
+     (println (.join (make-array indent) " ") "<=" (.-id frame) (.-result frame)))))
+
+(defn print-example [example inputs]
+  (let [[result stack] (run-example example inputs)]
+    (print-stack stack)
+    (println result)))
+
+(run-example example-b [1 "foo"])
+


Use macros for hash ns

Use macros for hash ns

--- src/caesium/crypto/hash.clj
+++ src/caesium/crypto/hash.clj
@@ -1,22 +1,5 @@
 (ns caesium.crypto.hash
-  (:require [caesium.binding :refer [sodium]]))
+  (:require [caesium.binding :refer [sodium defconsts defbindings]]))

-(def ^:private sha256-bytes
-  (.crypto_hash_sha256_bytes sodium))
-
-(defn sha256
-  "Computes the SHA-256 digest of the given message with `crypto_hash_sha256`."
-  [^bytes msg]
-  (let [buf (byte-array sha256-bytes)]
-    (.crypto_hash_sha256 sodium buf msg (alength msg))
-    buf))
-
-(def ^:private sha512-bytes
-  (.crypto_hash_sha512_bytes sodium))
-
-(defn sha512
-  "Computes the SHA-512 digest of the given message with `crypto_hash_sha512`."
-  [^bytes msg]
-  (let [buf (byte-array sha512-bytes)]
-    (.crypto_hash_sha512 sodium buf msg (alength msg))
-    buf))
+(defconsts [sha256-bytes sha512-bytes])
+(defbindings [sha256 sha512])


Temporarily disabled redirection of benchmark results. And did it right this time.

--- src/validation_benchmark/bench.clj
+++ src/validation_benchmark/bench.clj
@@ -27,14 +27,14 @@

 (defn quick [f]
-  ;; (stdout->tmpfile "criterium"
-  ;;                  (summarize (criterium/quick-benchmark* f nil)))
-  (summarize (criterium/quick-benchmark* f nil)))
+  (stdout->tmpfile "criterium"
+                   (summarize (criterium/quick-benchmark* f nil))))

 (defn real [f]
-  (stdout->tmpfile "criterium"
-                   (summarize (criterium/benchmark* f nil))))
+  ;; (stdout->tmpfile "criterium"
+  ;;                  (summarize (criterium/benchmark* f nil)))
+  (summarize (criterium/benchmark* f nil)))

 (defn summarize [results]


Change path store channel size

Change path store channel size

--- src/whisper2cyanite/path_store.clj
+++ src/whisper2cyanite/path_store.clj
@@ -13,7 +13,7 @@
   (exist? [this tenant path])
   (shutdown [this]))

-(def ^:const default-es-channel-size 30000)
+(def ^:const default-es-channel-size 10000)
 (def ^:const default-es-index "cyanite_paths")
 (def ^:const es-def-type "path")


Remove extra canvas object

Remove extra canvas object

--- src/clj/cljs_game/views.clj
+++ src/clj/cljs_game/views.clj
@@ -28,7 +28,6 @@
     [:body
      [:h1 (str "Home" (when is-debug (str " (Debug): " is-debug)))]
      [:p "CLJS webapp game thing."]
-     [:canvas {:id "front-buffer"}]
      footer-bar]
     [:script
      "document.onreadystatechange = function () {


Initial characters lower-cased when comparing and merging data into the board

--- src/cljs/db_quiz/model.cljs
+++ src/cljs/db_quiz/model.cljs
@@ -8,7 +8,7 @@
             [db-quiz.normalize :as normalize]
             [cljs-http.client :as http]
             [cljs.core.async :refer [<! >! chan]]
-            [clojure.string :refer [replace split]]
+            [clojure.string :refer [lower-case replace split]]
             [reagent-modals.modals :as reagent-modals]))

 ; ----- Public functions -----
@@ -96,7 +96,7 @@
   [board data]
   (letfn [(field-by-initial [initial]
             (first (filter (fn [[k {:keys [text] :as v}]]
-                             (= text initial))
+                             (= (lower-case text) (lower-case initial)))
                            board)))]
     (into {}
       (map (fn [{:keys [abbreviation] :as result}]


Do not attempt to load invalid URLs of Google Spreadsheets

--- src/cljs/db_quiz/model.cljs
+++ src/cljs/db_quiz/model.cljs
@@ -67,11 +67,9 @@

 (defn load-gdocs-items
   "Load items from Google Spreadsheet's worksheet."
-  [spreadsheet-url]
+  [spreadsheet-id]
   (let [worksheet-id "od6" ; FIXME: Is this value universally valid?
-        spreadsheet-id (spreadsheet-url-to-id spreadsheet-url)
-        url (str "https://spreadsheets.google.com/feeds/list/"
-                 spreadsheet-id "/" worksheet-id "/public/full")
+        url (str "https://spreadsheets.google.com/feeds/list/" spreadsheet-id "/" worksheet-id "/public/full")
         transform-row (fn [{{label :$t} :gsx$label
                            {description :$t} :gsx$description}]
                         (when (and label description)
@@ -81,16 +79,14 @@
         raw-results-chan (wrap-load (http/jsonp url {:query-params {:alt "json-in-script"}})
                                 (chan 1 (map (comp (partial map transform-row) :entry :feed :body))))
         results-chan (chan)]
-    (if spreadsheet-id
-      (go (let [results (<! raw-results-chan)
-                    results-count (count results)]
-                (cond (< results-count number-of-fields)
-                        (reagent-modals/modal! (modals/invalid-spreadsheet-rows results-count))
-                      (every? nil? results)
-                        (reagent-modals/modal! (modals/invalid-spreadsheet-columns))
-                      :else (>! results-chan (take number-of-fields (shuffle results))))
-                results-chan))
-      (reagent-modals/modal! (modals/invalid-google-spreadsheet-url spreadsheet-url)))))
+    (go (let [results (<! raw-results-chan)
+              results-count (count results)]
+          (cond (< results-count number-of-fields)
+                (reagent-modals/modal! (modals/invalid-spreadsheet-rows results-count))
+                (every? nil? results)
+                (reagent-modals/modal! (modals/invalid-spreadsheet-columns))
+                :else (>! results-chan (take number-of-fields (shuffle results))))
+          results-chan))))

 (defmulti merge-board-with-data
   "Merge data with questions into the initialized board."
@@ -160,7 +156,10 @@

 (defmethod load-board-data :gdrive
   [board callback]
-  (let [spreadsheet-url (get-in @app-state [:options :doc])]
-    (go (let [results (<! (load-gdocs-items spreadsheet-url))]
-          (swap! app-state #(assoc % :board (merge-board-with-data board results)))
-          (callback)))))
+  (let [spreadsheet-url (get-in @app-state [:options :doc])
+        spreadsheet-id (spreadsheet-url-to-id spreadsheet-url)]
+    (if spreadsheet-id
+      (go (let [results (<! (load-gdocs-items spreadsheet-id))]
+            (swap! app-state #(assoc % :board (merge-board-with-data board results)))
+            (callback)))
+      (reagent-modals/modal! (modals/invalid-google-spreadsheet-url spreadsheet-url)))))


correct logic for getting previously present names

--- src/cljs_api_gen/result.clj
+++ src/cljs_api_gen/result.clj
@@ -76,8 +76,10 @@
         prev-version (get-in prev-result [:versions :cljs])

         ;; get symbol names
-        prev-names (->> (remove :removed prev-items)
-                        keys set)
+        prev-names (->> (vals prev-items)
+                        (remove :removed)
+                        (map :full-name)
+                        set)
         curr-names (-> items keys set)
         all-names (set (into prev-names curr-names))
         [removed? added? stayed?] (diff prev-names curr-names)


Don't memoize the incidence relation by default

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

--- src/conexp/fca/contexts.clj
+++ src/conexp/fca/contexts.clj
@@ -137,8 +137,8 @@
     (illegal-argument "Objects and attributes should not be given as a map."))
   (Formal-Context. (to-set objects)
                    (to-set attributes)
-                   (memoize (fn [[g m]]
-                              (incidence g m)))))
+                   (fn [[g m]]
+                     (incidence g m))))

 (defmethod make-context :default [obj att inz]
   (illegal-argument "The arguments " obj ", " att " and " inz " are not valid for a formal context."))


CMR-4323 (#176)

CMR-4323 (#176)

* CMR-4323 updates dbmigration

* CMR-4323 updates dbmigration

* CMR-4323 update migration

--- metadata-db-app/src/migrations/057_regenerate_collection_identifiers.clj
+++ metadata-db-app/src/migrations/057_regenerate_collection_identifiers.clj
@@ -16,9 +16,10 @@
                        providers/dbresult->provider)
           t (h/get-provider-collection-tablename provider)]
       (for [entry-title entry-titles
-            :let [result (j/query (config/db) [(format "select distinct concept_id from metadata_db.%s where entry_title = ?" t)
-                                               entry-title])]]
-        (:concept_id (first result))))))
+            :let [result (j/query (config/db) [(format "select distinct concept_id, entry_title from metadata_db.%s where entry_title = ?" t)
+                                               entry-title])]
+            :when (not (nil? entry-title))]
+        (first result)))))

 (defn- get-entry-titles
   "For a given provider and concept-ids in collection-identifier, returns list of collection entry-titles"
@@ -28,9 +29,10 @@
                        providers/dbresult->provider)
           t (h/get-provider-collection-tablename provider)]
       (for [concept-id concept-ids
-            :let [result (j/query (config/db) [(format "select distinct entry_title from metadata_db.%s where concept_id = ?" t)
-                                               concept-id])]]
-        (:entry_title (first result))))))
+            :let [result (j/query (config/db) [(format "select distinct concept_id, entry_title from metadata_db.%s where concept_id = ?" t)
+                                               concept-id])]
+            :when (not (nil? concept-id))]
+        (first result)))))

 (defn up
   "Migrates the database up to version 57."
@@ -44,21 +46,17 @@
                        (util/gzip-blob->string)
                        (edn/read-string))
           {{:keys [collection-identifier collection-applicable granule-applicable provider-id]} :catalog-item-identity} metadata
-          concept-ids (if (or collection-applicable granule-applicable)
-                        (get-concept-ids provider-id collection-identifier)
-                        nil)
-          entry-titles (if (or collection-applicable granule-applicable)
-                        (get-entry-titles provider-id collection-identifier)
-                        nil)
+          collections-by-entry-titles (when (or collection-applicable granule-applicable)
+                                        (get-concept-ids provider-id collection-identifier))
+          collections-by-concept-ids (when (or collection-applicable granule-applicable)
+                                       (get-entry-titles provider-id collection-identifier))
+          collections (distinct (remove nil? (concat collections-by-entry-titles collections-by-concept-ids)))
           metadata (if deleted
                      metadata
-                     (if (seq concept-ids)
-                       (assoc-in metadata [:catalog-item-identity :collection-identifier :concept-ids] concept-ids)
-                       metadata))
-          metadata (if deleted
-                     metadata
-                     (if (seq entry-titles)
-                       (assoc-in metadata [:catalog-item-identity :collection-identifier :entry-titles] entry-titles)
+                     (if (seq collections)
+                       (-> metadata
+                           (assoc-in [:catalog-item-identity :collection-identifier :concept-ids] (map :concept_id collections))
+                           (assoc-in [:catalog-item-identity :collection-identifier :entry-titles] (map :entry_title collections)))
                        metadata))
           metadata (-> metadata
                        pr-str


[scamp] refactor 'handle-new-subscription to use '*get-envelope-id*

--- modules/scamp/src/scamp/core.clj
+++ modules/scamp/src/scamp/core.clj
@@ -211,7 +211,7 @@
           node-id
           :forwarded-subscription
           subscription
-          (get-envelope-id)])
+          (*get-envelope-id*)])
        downstream+))))

 (s/defn do-probability :- s/Bool


added auto trigger for diff output

added auto trigger for diff output

--- examples/todo/dev/cljs/user.cljs
+++ examples/todo/dev/cljs/user.cljs
@@ -40,21 +40,21 @@
   nsteps of history ago."
   ([nsteps] (diff nsteps 0))
   ([nsteps nsteps-end]
-    (if (< (count @todo.core/undo-history) nsteps)
-      (cljs.pprint/pprint "Not enough history")
-      (let [old-state (get-in (nth @todo.core/undo-history (dec nsteps)) @current-focus)
-            end-state (if (= 0 nsteps-end)
-                            (get-in @todo.core/app-state @current-focus)
-                            (get-in (nth @todo.core/undo-history (dec nsteps-end)) @current-focus)
-                            )
-            ]
-        (cljs.pprint/pprint (differ/diff old-state end-state))
-        )
-      ))
-
+   (if (< (count @todo.core/undo-history) nsteps)
+     (cljs.pprint/pprint "Not enough history")
+     (let [old-state (get-in (nth @todo.core/undo-history (dec nsteps)) @current-focus)
+           end-state (if (= 0 nsteps-end)
+                       (get-in @todo.core/app-state @current-focus)
+                       (get-in (nth @todo.core/undo-history (dec nsteps-end)) @current-focus)
+                       )
+           ]
+       (if (not= old-state end-state)
+         (cljs.pprint/pprint (differ/diff old-state end-state)))
+       )
+     ))
   )

-(defn evolution
+(defn evolution
   "Show the evolution of the app-state between a and b steps ago."
   [a b]
   (assert (> a b) "'a' must be more steps than 'b'")
@@ -63,3 +63,12 @@
     (diff n (dec n))
     )
   )
+
+(defn auto-trigger!
+  "Turn on/off auto-printing of changes if the focused state changes"
+  [turn-on]
+  (if turn-on
+    (add-watch todo.core/app-state ::auto-trigger (fn [_ _ old-state new-state] (diff 1)))
+    (remove-watch todo.core/app-state ::auto-trigger)
+    ))
+


Move update-mongo, to get build start times

--- src/circle/backend/build/run.clj
+++ src/circle/backend/build/run.clj
@@ -33,6 +33,7 @@
 (defn do-build* [build]
   (throw-if (-> @build :start-time) "refusing to run started build")
   (start* build)
+  (build/update-mongo build)
   (doseq [act (-> @build :actions)]
     (when (-> @build :continue?)
       (let [current-act-results-count (count (-> @build :action-results))]
@@ -59,7 +60,6 @@
   (infof "starting build: %s" (build/build-name b))
   (try
     (build/with-build-log b
-      (build/update-mongo b)
       (do-build* b)
       (email/notify-build-results b))
     b


Use ordered vectors for collection serializers.

--- src/clj/carbonite/serializer.clj
+++ src/clj/carbonite/serializer.clj
@@ -192,9 +192,10 @@
     [MapEntry (clojure-coll-serializer registry [])]]

    ;; list/seq collections
-   (zipmap [Cons PersistentList$EmptyList PersistentList LazySeq IteratorSeq ArraySeq]
-           (repeat (clojure-seq-serializer registry list)))
-
+   (map #(vector % (clojure-seq-serializer registry list))
+        [Cons PersistentList$EmptyList PersistentList
+         LazySeq IteratorSeq ArraySeq])
+
    ;; other seqs
    [[StringSeq stringseq-serializer]]


Personal workshop improvement

Personal workshop improvement

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -330,7 +330,9 @@
                          (add-prop state side target :counter -1)))}]
      {:abilities [{:label "Host a program or piece of hardware" :cost [:click 1]
                    :prompt "Choose a card to host on Personal Workshop"
-                   :choices (req (filter #(#{"Program" "Hardware"} (:type %)) (:hand runner)))
+                   :choices {:req #(and (#{"Program" "Hardware"} (:type %))
+                                        (= (:zone %) [:hand])
+                                        (= (:side %) "Runner"))}
                    :effect (effect (host card (assoc target :counter (:cost target))))
                    :msg (msg "host " (:title target) "")}
                   (assoc remove-counter


cleanup dead code

cleanup dead code

--- src/clj/lambdacd/steps/shell.clj
+++ src/clj/lambdacd/steps/shell.clj
@@ -3,8 +3,6 @@
             [clojure.java.io :as io]
             [clojure.string :as string]
             [me.raynes.conch.low-level :as sh]
-            [clojure.core.async :as async]
-            [lambdacd.internal.execution :as execution]
             [lambdacd.util :as utils]
             [lambdacd.util :as util])
   (:import (java.util UUID)
@@ -47,8 +45,7 @@
     (support/printed-output printer)))

 (defn- execte-shell-command [cwd shell-script ctx env]
-  (let [result-ch (:result-channel ctx)
-        x (sh/proc "bash" "-e" shell-script
+  (let [x (sh/proc "bash" "-e" shell-script
                    :dir cwd
                    :env env
                    :redirect-err true)


Remove unnecessary services

Remove unnecessary services

--- src/clj/mdr2/routes/services.clj
+++ src/clj/mdr2/routes/services.clj
@@ -215,26 +215,4 @@
                                 (ok productions)
                                 (bad-request productions)))
                             (bad-request {:status-text "Not a valid Vubis export"
-                                          :errors errors}))))}}]]
-
-   ["/files"
-    {:swagger {:tags ["files"]}}
-
-    ["/upload"
-     {:post {:summary "upload a file"
-             :parameters {:multipart {:file multipart/temp-file-part}}
-             :responses {200 {:body {:name string?, :size int?}}}
-             :handler (fn [{{{:keys [file]} :multipart} :parameters}]
-                        {:status 200
-                         :body {:name (:filename file)
-                                :size (:size file)}})}}]
-
-    ["/download"
-     {:get {:summary "downloads a file"
-            :swagger {:produces ["image/png"]}
-            :handler (fn [_]
-                       {:status 200
-                        :headers {"Content-Type" "image/png"}
-                        :body (-> "public/img/warning_clojure.png"
-                                  (io/resource)
-                                  (io/input-stream))})}}]]])
+                                          :errors errors}))))}}]]])


Removed bilinear scaling

Removed bilinear scaling

Ugghh!

--- src/cljs/cloj/render/canvas.cljs
+++ src/cljs/cloj/render/canvas.cljs
@@ -13,60 +13,69 @@
   (get-element [_])
   (get-ctx-2d [_]))

+
+(defn set-smoothing [ctx v]
+  (doto ctx
+        (aset "mozImageSmoothingEnabled"     v)
+        (aset "webkitImageSmoothingEnabled"  v)
+        (aset "msImageSmoothingEnabled"      v)
+        (aset "imageSmoothingEnabled"        v)))
+
 (defn canvas [canvas-id {:keys [x y] :as dims}]
   (let [canvas-el (hipo/create [:canvas ^:attrs {:id canvas-id :width x :height y}])
         ctx (.getContext canvas-el "2d")]
-    (reify
-      IHTMLCanvas
-      (get-element [_] canvas-el)
-      (get-ctx-2d [_]  ctx)
+    (do
+      (set-smoothing ctx false)
+      (reify
+        IHTMLCanvas
+        (get-element [_] canvas-el)
+        (get-ctx-2d  [_] ctx)

-      rp/ITransformable
-      (matrix! [this [a c e b d f]]
-        (do
-          (.setTransform ctx a b c d e f))
-        this)
+        rp/ITransformable
+        (matrix! [this [a c e b d f]]
+          (do
+            (.setTransform ctx a b c d e f))
+          this)

-      (identity! [this]
-        (do
-          (.resetTransform ctx))
-        this)
+        (identity! [this]
+          (do
+            (.resetTransform ctx))
+          this)

-      (translate! [this [ {:keys [x y]}]]
-        (do
-          (.translate ctx x y))
-        this)
+        (translate! [this [ {:keys [x y]}]]
+          (do
+            (.translate ctx x y))
+          this)

-      (scale! [this [ {:keys [x y] } ]]
-        (do
-          (.scale ctx x y))
-        this)
+        (scale! [this [ {:keys [x y] } ]]
+          (do
+            (.scale ctx x y))
+          this)

-      (rotate! [this v]
-        (do
-          (.rotate ctx v))
-        this)
+        (rotate! [this v]
+          (do
+            (.rotate ctx v))
+          this)

-      rp/IRenderBackend
+        rp/IRenderBackend
+        (spr-scaled! [this spr {x :x y :y} {w :x h :y}]
+          (do
+            (let [[sx sy sw sh] (rman/dims spr)
+                  spr-img (rman/img spr) ]
+              (.drawImage ctx spr-img sx sy sw sh x y w h)))
+          this)

-      (spr-scaled! [this spr {x :x y :y} {w :x h :y}]
-        (do
-          (let [[sx sy sw sh] (rman/dims spr)
-                spr-img (rman/img spr) ]
-            (.drawImage ctx spr-img sx sy sw sh x y w h)))
-        this)
+        (spr! [this spr pos]
+          (let [[sx sy sw sh] (rman/dims spr)]
+            (rp/spr-scaled! this spr pos (v2 sw sh) )))

-      (spr! [this spr pos]
-        (let [[sx sy sw sh] (rman/dims spr)]
-          (rp/spr-scaled! this spr pos (v2 sw sh) )))
+        (clear! [this col]
+          (rp/box! this (v2 0 0) dims col))

-      (clear! [this col]
-        (rp/box! this (v2 0 0) dims col))
-
-      (box! [this {x :x y :y} {w :x h :y} col]
-        (do
-          (let [col-str (rgb-str col)]
-            (set! (.-fillStyle ctx) col-str)
-            (.fillRect ctx x y w h)))))  )
+        (box! [this {x :x y :y} {w :x h :y} col]
+          (do
+            (let [col-str (rgb-str col)]
+              (set! (.-fillStyle ctx) col-str)
+              (.fillRect ctx x y w h))))))  )

   )


Set the default spelling to new

Set the default spelling to new

--- src/cljs/hyphen_keeper/core.cljs
+++ src/cljs/hyphen_keeper/core.cljs
@@ -10,7 +10,7 @@
   (reagent/atom
    {:hyphenations []
     :search ""
-    :spelling 0}))
+    :spelling 1}))

 (def search (reagent/cursor app-state [:search]))
 (def spelling (reagent/cursor app-state [:spelling]))


To be rebased:

To be rebased:

Other computer has unpushed refactor of event handling for keypresses, but
I haven't access right now, and need to work on this stuff. So in this branch
I'm doing *something* to pass keypress events to a fn along with updated zipper,
and future commits in this branch will be about actually using that data to
call the actions in the huet namespace.

--- src/cljs/reframe_test/views.cljs
+++ src/cljs/reframe_test/views.cljs
@@ -9,23 +9,29 @@
     (fn []
       [:div "Zipper: " (str @zipper)])))

-(defn on-keypress [keypress]
-  (println (char (.-keyCode keypress))))
+(defn on-keypress [something keypress]
+  (let [_ (println "type " (type (.-keyCode keypress)))
+        keychar (char (.-keyCode keypress))]
+    (println "keychar " keychar)
+    (println "something " something)
+    (println "str keypress " (str keypress))
+    ;(println (h/act-on keychar))
+    ))

 (defn main-panel    ;; the top level of our app
   []
   ; This works but violates re-frame:   :/
   (.addEventListener js/document "keypress" on-keypress)
-  (let [name (subscribe [:name])]
+  (let [name (subscribe [:name])
+        zipper (subscribe [:zipper])]
     (fn []
-      [:div
-       [text-zipper]
-       [:div
-        [:button {:class "button-class"
-                  :on-click #(dispatch [:append-node])}
-         "append"
-         ]]])))
-
+      (let [_ (.addEventListener js/document
+                                 "keypress"
+                                 (partial on-keypress @zipper))]
+        [:div [text-zipper]
+         [:div [:button {:class "button-class"
+                         :on-click #(dispatch [:append-node])}
+                "append" ]]]))))

 (defn reframe_test-app
   []


Factor our sort, use on apps and tokens

Factor our sort, use on apps and tokens

--- src/com/okl/tokenmgr/handler.clj
+++ src/com/okl/tokenmgr/handler.clj
@@ -31,6 +31,14 @@
     :sys-error  {:status 500
                  :body (str "Error: " (:message status))}))

+(defn- sort-data [sort-col sort-dir data]
+  (let [sort-dir (or sort-dir "asc")
+        sort-col (or sort-col "name")
+        sorted-data (sort-by #(get % (keyword sort-col)) data)]
+    (if (= "asc" sort-dir)
+      sorted-data
+      (reverse sorted-data))))
+
 (defroutes app-routes
   (GET "/" []
     (page ""))
@@ -38,22 +46,18 @@
     (page ""))
   (GET "/application/:app" [app]
     (page app))
-  (GET "/api/applications/" []
-    (get-apps ""))
-  (GET "/api/applications/:app" [app]
-    (get-apps app))
+  (GET "/api/applications/" [sort-col sort-dir]
+    (sort-data sort-col sort-dir (get-apps "")))
+  (GET "/api/applications/:app" [app sort-col sort-dir]
+    (sort-data sort-col sort-dir (get-apps app)))
   (GET "/api/tokens/:app" [app sort-col sort-dir]
-    (let [tokens (denormalize-tokens (get-tokens (url-decode app)))
-          sort-dir (or sort-dir "asc")
-          sort-col (or sort-col "name")
-          sorted-data (sort-by #(get % (keyword sort-col)) tokens)]
-      (if (= "asc" sort-dir)
-        sorted-data
-        (reverse sorted-data))))
+    (sort-data sort-col
+               sort-dir
+               (denormalize-tokens (get-tokens (url-decode app)))))
   (GET "/api/tokens/" [sort-dir sort-col]
-    (let [tokens (denormalize-tokens (get-tokens ""))]
-      (println "Sorting by " sort-col)
-      (sort-by (symbol sort-col) tokens)))
+    (sort-data sort-col
+               sort-dir
+               (denormalize-tokens (get-tokens ""))))
   (DELETE "/api/applications/:delimited-app" [delimited-app]
     (try
       (let [app (str/replace delimited-app (delimiter) "/")]


Use newly created helper functions for references

--- src/discuss/references.cljs
+++ src/discuss/references.cljs
@@ -13,7 +13,7 @@
   [response]
   (let [res (com/success-handler response)]))

-(defn get-reference-details
+(defn query-reference-details
   "Show usages of the provided reference."
   [reference-id]
   (let [url (str (:base config/api) (get-in config/api [:get :reference-usages]) "/" reference-id)]
@@ -22,11 +22,13 @@

 ;;;; Interaction with integrated references
 (defn click-reference
-  "When clicking on a reference directly in the text, make AJAX request with the url to the discussion
-   and show the sidebar to start the discussion."
+  "When clicking on a reference directly in the text, interact with the user to give her the choice of what
+   her next steps might be."
   [ref]
   #_(com/ajax-get url)
   (lib/change-view! :reference-dialog)
+  (lib/save-selected-reference! ref)
+  (println (lib/selected-reference))
   (sidebar/show)
   (lib/update-state-item! :layout :reference (fn [_] (:text ref))))

@@ -39,7 +41,8 @@
   (reify om/IRender
     (render [_]
       (dom/div #js {:className "text-center"}
-               (dom/button #js {:className "btn btn-primary"}
+               (dom/button #js {:className "btn btn-primary"
+                                :onClick   #(query-reference-details 4)}
                            "Find usages of this reference")
                " "
                (dom/button #js {:className "btn btn-primary"}


Solving 3.22, 3.23

Solving 3.22, 3.23

--- src/fpinscala/datastructures.clj
+++ src/fpinscala/datastructures.clj
@@ -1,4 +1,5 @@
-(ns fpinscala.datastructures)
+(ns fpinscala.datastructures
+  (:use clojure.test))

 (defn append [xs ys]
   (if (nil? xs)
@@ -274,7 +275,7 @@
                                     acc))))))               ;WHOA! :)
 ;my solution is more general though, allowing transforming function not to
 ;return list - this function is heavily "cludged" to accomodate solution to 3.21 and
-;to keep ... "generality"... clap! clap! clap! :)
+;to keep ... "generality"... clap! clap! clap! :) (ironical self-criticsm)

 ;fpins - strictly assumes transforming function returns list thus it is simpler
 (defn flat-map-fpins [xs f]
@@ -293,3 +294,42 @@
   (flat-map-fpins xs #(if (f %) (list %) nil)))
 ;-----------------------------------------------------------------------

+;3.22
+;mine
+(with-test
+  (defn add-lists [xs ys]
+    (letfn [(go [xs ys acc]
+                (if (or (empty? xs) (empty? ys))
+                  (list* acc)
+                  (recur (next xs) (next ys) (conj acc (+ (first xs) (first ys))))))]
+      (go xs ys [])))
+  (is (= '(5 7 9) (add-lists '(1 2 3) '(4 5 6)))))
+;fpins
+(with-test
+  (defn add-lists-fpins [xs ys]
+    (if (or (nil? xs) (nil? ys))
+      nil
+      (let [[h1 & t1] xs [h2 & t2] ys]
+        (cons (+ h1 h2) (add-lists-fpins t1 t2)))))
+  (is (= '(5 7 9) (add-lists-fpins '(1 2 3) '(4 5 6)))))
+;-----------------------------------------------------------------------
+
+;3.23
+;mine
+(with-test
+  (defn zip-with [xs ys f]
+    (letfn [(go [xs ys acc]
+                (if (or (empty? xs) (empty? ys))
+                  (list* acc)
+                  (recur (next xs) (next ys) (conj acc (f (first xs) (first ys))))))]
+      (go xs ys [])))
+  (is (= '(-3 -3 -3) (zip-with '(1 2 3) '(4 5 6) -))))
+;fpins
+;fpins
+(with-test
+  (defn zip-with-fpins [xs ys f]
+    (if (or (nil? xs) (nil? ys))
+      nil
+      (let [[h1 & t1] xs [h2 & t2] ys]
+        (cons (f h1 h2) (zip-with-fpins t1 t2 f)))))
+  (is (= '(4 10 18) (zip-with-fpins '(1 2 3) '(4 5 6) *))))


rename choose -> pick

rename choose -> pick

--- src/dokkaa_builder/apps.clj
+++ src/dokkaa_builder/apps.clj
@@ -12,7 +12,7 @@
 (defn- generate-host-port [host]
   (+ 10000 (rand-int 1000)))

-(defn- choose-backends
+(defn- pick-backends
   "Randomly choose docker backend"
   []
   (let [cli (docker/make-client "127.0.0.1:4243")]
@@ -31,7 +31,7 @@
   (get-in @apps [(keyword app-name) :instances 0 :id]))

 (defn create [app-name user image & {:keys [tag command port]}]
-  (let [backends (choose-backends)
+  (let [backends (pick-backends)
         front-url (default-frontend-url app-name)
         old-isntances (get-in @apps [(keyword app-name) :instances])
         new-instances (vec (for [{cli :client host-port :port} backends]
@@ -69,7 +69,7 @@
       (container/remove cli id))))

 (defn logs [app-name user]
-  (let [{cli :client} (first (choose-backends))
+  (let [{cli :client} (first (pick-backends))
         resp (container/logs cli (app->id app-name user) :stdout true :stderr true)]
     (map #(str (name (:stream-type %))
                ": "


select-one record

select-one record

--- src/er_cassandra/record.clj
+++ src/er_cassandra/record.clj
@@ -2,6 +2,7 @@
   (:require
    [plumbing.core :refer :all]
    [qbits.alia.manifold :as aliam]
+   [manifold.deferred :as d]
    [qbits.hayt :as h]
    [clj-uuid :as uuid]))

@@ -48,6 +49,13 @@
        (h/select table
                  (h/where key-clause)))))))

+(defn select-one
+  ([session table key record-or-key-value]
+   (select-one session table key record-or-key-value {}))
+  ([session table key record-or-key-value opts]
+   (d/chain (select session table key record-or-key-value opts)
+            first)))
+
 (defn upsert
   "upsert a single record"
   ([session table key record]


PLD: use full image for thumb, but resized via thumbor

--- src/hatti/views/photos.cljs
+++ src/hatti/views/photos.cljs
@@ -122,18 +122,17 @@
             result
             (map-indexed
              (fn [j attachment]
-               (let [download-url (get attachment constants/download-url)
-                     thumb (or (get attachment constants/small-download-url)
-                               download-url)
-                     thumb-resized (resize-image (make-url thumb)
-                                                 thumb-width-px
-                                                 thumb-width-px)]
+               (let [download-url (make-url (get attachment
+                                                 constants/download-url))
+                     thumbnail (resize-image download-url
+                                             thumb-width-px
+                                             thumb-width-px)]
                  {:src (resize-image (make-url download-url)
                                      width-px
                                      width-px)
-                  :original-src (make-url download-url)
-                  :msrc thumb-resized
-                  :thumb thumb-resized
+                  :original-src download-url
+                  :msrc thumbnail
+                  :thumb thumbnail
                   :title (format "%s/%s | Submission %s"
                                  (+ photo-index j) total rank)
                   :date (get datum constants/_submission_time)


ADSR is an initialism, so should be upper-case.

--- src/klangmeister/ui/content.cljs
+++ src/klangmeister/ui/content.cljs
@@ -38,7 +38,7 @@
            (percussive 0.001 0.4)
            (gain 0.1))"]
    :sustain
-   ["Many instruments can sustain a note over a period of time. To achive that, we use an adsr envelope instead of a percussive one. As well as an initial attack and decay, an adsr envelope holds the sound at a sustain level before dying away over the release."
+   ["Many instruments can sustain a note over a period of time. To achive that, we use an ADSR envelope instead of a percussive one. As well as an initial attack and decay, an ADSR envelope holds the sound at a sustain level before dying away over the release."
     "(connect-> (add (square 440) (triangle 442))
            (low-pass 600)
            (adsr 0.001 0.4 0.5 0.1) ; What happens when you change the numbers?


simpler switchboard syntax in TwitterClient

--- Clojure-Websockets/TwitterClient/src/clj/birdwatch_tc/main.clj
+++ Clojure-Websockets/TwitterClient/src/clj/birdwatch_tc/main.clj
@@ -4,7 +4,7 @@
    [birdwatch-tc.persistence.persistence :as pc]
    [birdwatch-tc.percolator.percolator :as perc-cmp]
    [birdwatch-tc.interop.interop :as iop-cmp]
-   [birdwatch-tc.twitterclient.twitterclient :as twitterclient]
+   [birdwatch-tc.twitterclient.twitterclient :as tc]
    [matthiasn.systems-toolbox.switchboard :as sb]
    [matthiasn.systems-toolbox.scheduler :as sched]
    [clojure.edn :as edn]
@@ -15,30 +15,19 @@

 (defn start
   []
-  (let [switchboard (sb/component)]
+  (let [switchboard (sb/component :switchboard)]
     (sb/send-mult-cmd
       switchboard
-      [[:cmd/wire-comp (twitterclient/component :tc-cmp conf)]
-       [:cmd/wire-comp (sched/component :scheduler-cmp)]              ; Scheduler component for task orchestration
-       [:cmd/wire-comp (pc/component :persistence-cmp conf)]
-       [:cmd/wire-comp (iop-cmp/component :interop-cmp conf)]
-       [:cmd/wire-comp (perc-cmp/component :percolator-cmp conf)]
+      [[:cmd/wire-comp (tc/component        :tc-cmp conf)]
+       [:cmd/wire-comp (sched/component     :scheduler-cmp)]              ; Scheduler component for task orchestration
+       [:cmd/wire-comp (pc/component        :persistence-cmp conf)]
+       [:cmd/wire-comp (iop-cmp/component   :interop-cmp conf)]
+       [:cmd/wire-comp (perc-cmp/component  :percolator-cmp conf)]

-       [:cmd/sub-comp
-        [[:tc-cmp :tweet/new]]            ;    »───»───»──╢   :persistence-cmp subscribes to new tweets.
-        :persistence-cmp]                 ; <= «═══«═══«══╝
-
-       [:cmd/sub-comp
-        [[:tc-cmp :tweet/new]]            ;    »───»───»──╢   :percolator-cmp subscribes to new tweets.
-        :percolator-cmp]                  ; <= «═══«═══«══╝
-
-       [:cmd/sub-comp
-        [[:percolator-cmp :perc/matches]] ;    »───»───»──╢   :interop-cmp subscribes to new percolation messages
-        :interop-cmp]                     ; <= «═══«═══«══╝   so that it can relay them over Redis Pub/Sub.
-
-       [:cmd/sub-comp
-        [[:scheduler-cmp :schedule/t-conn-alive?]] ;    »───»───»──╢   :scheduler-cmp subscribes to command messages that
-        :tc-cmp]                                   ; <= «═══«═══«══╝   trigger the creation of a new schedule.
+       [:cmd/sub-comp     :tc-cmp          :persistence-cmp  :tweet/new]
+       [:cmd/sub-comp     :tc-cmp          :percolator-cmp   :tweet/new]
+       [:cmd/sub-comp     :percolator-cmp  :interop-cmp      :perc/matches]
+       [:cmd/sub-comp     :scheduler-cmp   :tc-cmp           :schedule/t-conn-alive?]

        [:cmd/send-to
         [:scheduler-cmp


add quotes

add quotes

--- frontend/components/language_landing.cljs
+++ frontend/components/language_landing.cljs
@@ -33,18 +33,18 @@
                                     :title "Inference That Just Works"
                                     :icon (utils/cdn-path "/img/outer/languages/book-icon.svg")}]
                         :docs-link "/docs/language-ruby-on-rails"
-                        :testimonials [{:text "Nullam id dolor id nibh ultricies vehicula ut id elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere erat a ante venenatis."
+                        :testimonials [{:text "The speed is really impressive, the rspec suite alone takes 6 minutes to run on my Macbook Air, but only 2 minutes on Circle."
+                                        :img "/img/outer/languages/olivier.jpg"
+                                        :author "Olivier Melcher"
+                                        :title "Developer @PasswordBox"}
+                                       {:text "CircleCI lets us be more agile and ship product faster. We can focus on delivering value to our customers, not maintaining Continuous Integration and Delivery infrastructure."
                                         :img "/assets/img/outer/stories/john.jpg"
-                                        :author "Kevin Rose"
-                                        :title "Entrepneur @Google"}
-                                       {:text "Nullam id dolor id nibh ultricies vehicula ut id elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere erat a ante venenatis."
-                                        :img "/assets/img/outer/stories/john.jpg"
-                                        :author "Clark Kent"
-                                        :title "superman"}
-                                       {:text "Nullam id dolor id nibh ultricies vehicula ut id elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere erat a ante venenatis."
-                                        :img "/assets/img/outer/stories/john.jpg"
-                                        :author "Bruce Wayne"
-                                        :title "Batman"}]}})
+                                        :author "John Duff"
+                                        :title "Director of Engineering @Shopify"}
+                                       {:text "CircleCI was super simple to set up and we started reaping the benefits immediately. It lets us ship code quickly and confidently. CircleCI's customer support is outstanding. We get quick, thorough answers to all our questions."
+                                        :img "/img/outer/languages/aaron.jpg"
+                                        :author "Aaron Suggs"
+                                        :title "Operations Engineer @Kickstarter"}]}})

 (defn language-landing [app owner]
   (reify


cleanup

cleanup

--- Clojure-Websockets/MainApp/src/cljs/birdwatch/charts/wordcount_chart.cljs
+++ Clojure-Websockets/MainApp/src/cljs/birdwatch/charts/wordcount_chart.cljs
@@ -58,13 +58,6 @@
       (swap! ratio-trends assoc-in [text]
              (get (reg/linear-regression (take 1000 (get @ratio-items text))) 1)))))

-(defn init-component
-  "Initializes word chart component. Takes put-fn as the function that can be called when some message
-   needs to be sent back to the switchboard. Returns a function that handles incoming messages."
-  [n put-fn]
-  (r/render-component [wordcount-barchart put-fn] wc-elem)
-  (fn [[_ state]] (update-words (wc/get-words2 state n))))
-
 (defn make-state
   "Return clean initial component state atom."
   [put-fn]


Removes unused code.

Removes unused code.

--- bootstrap-app/src/cmr/bootstrap/data/db_synchronization.clj
+++ bootstrap-app/src/cmr/bootstrap/data/db_synchronization.clj
@@ -138,20 +138,6 @@
   (let [sql "select concept_id, revision_id from sync_work where id >= ? and id < ?"
         stmt [sql start-index (+ start-index n)]]
     (query-for-concept-rev-id-pairs (:db system) stmt)))
-
-
-;; TODO remove this if it is unused?
-(defn- in-clause
-  "Generates a sql in clause string. If there are more than the max values to put in the in clause
-  it creates multiple an ORs them together."
-  [field num-values]
-  (let [num-full (int (/ num-values 1000))
-        num-in-partial (mod num-values 1000)
-        make-in #(str field " in (" (str/join "," (repeat % "?")) ")" )
-        full-in (make-in 1000)
-        full-ins (repeat num-full full-in)
-        partial-ins (when (> num-in-partial 0) [(make-in num-in-partial)])]
-    (str/join " or " (concat full-ins partial-ins))))

 (defn- get-latest-concept-id-revision-ids
   "Finds the revision ids for the given concept ids in metadata db. Returns tuples of concept id and


get-api-command and other minor fixes in the server module

--- src/emender_service/server.clj
+++ src/emender_service/server.clj
@@ -42,12 +42,18 @@
     []
     (.. java.net.InetAddress getLocalHost getHostName))

+(defn get-api-command
+    [request uri]
+    (if uri
+        (re-find #"/[^/]*" (subs uri (count (config/get-api-prefix request))))))
+
 (defn api-call-handler
     [request uri method]
-    (condp = [method (subs uri (count (config/get-api-prefix request)))]
+    (condp = [method (get-api-command request uri)]
         [:get  "/info"]         (rest-api/info-handler request (get-hostname))
-        [:post "/job-started"]  (rest-api/job-started-handler request)
+        [:post "/job-started"]  (rest-api/job-started-handler  request)
         [:post "/job-finished"] (rest-api/job-finished-handler request)
+        [:post "/job-results"]  (rest-api/job-results-handler  request)
                                 (rest-api/unknown-call-handler uri method)))

 (defn non-api-call-handler


Fix pre condition spec in parsers.core.

Fix pre condition spec in parsers.core.

--- src/incise/parsers/core.clj
+++ src/incise/parsers/core.clj
@@ -45,7 +45,7 @@
   "Turn the given file into a Parseable using the constructor registered to its
    extension."
   [^File file]
-  {:pre (contains? @parsers (extension file))}
+  {:pre [(contains? @parsers (extension file))]}
   ^Parse ((@parsers (extension file)) file))

 (defn valid-parse?
@@ -59,7 +59,7 @@
 (defn Parse->html
   "Turn a given parse into an html file."
   [^Parse parse]
-  {:pre (valid-parse? parse)}
+  {:pre [(valid-parse? parse)]}
   (.incise parse))

 (def source->html