fix for infobox being too tall (#745)

fix for infobox being too tall (#745)

--- src/cljs/main/broadfcui/page/workspace/data/copy_data_entities.cljs
+++ src/cljs/main/broadfcui/page/workspace/data/copy_data_entities.cljs
@@ -97,28 +97,31 @@
                        import-type "s in, the source workspace."
                        (common/render-info-box
                         {:position "top"
-                         :text [:span {}
-                                [:div {:style {:paddingBottom "1rem"}}
-                                 "Every entity (participant, sample, etc.) has an ID. Multiple
-                                 entities cannot share the same ID, they must be unique."]
-                                [:div {:style {:paddingBottom "1rem"}}
-                                 "Entities can be linked by their ID. For example, a sample can be
-                                  linked to a participant."]
-                                [:div {:style {:paddingBottom "1rem"}}
-                                 "If you import a sample that is linked to a participant, that
-                                 participant will also be imported. However, if the imported
-                                 participant (\"source participant\") has the same ID as an existing
-                                 participant in the workspace (\"destination participant\"), the
-                                 import cannot finish. Since two entities cannot have the same ID,
-                                 this would cause a conflict."]
-                                [:div {:style {:paddingBottom "1rem"}}
-                                 "Re-linking allows the sample to link to the participant that was
-                                 already in the workspace (\"destination participant\")."]
-                                [:div {:style {:paddingBottom "1rem"}}
-                                 "Keep in mind that there may be differences between the \"source
-                                 participant\" and the \"destination participant\", so you may want
-                                 to confirm that they are actually the same."]
-                                [:div {} "All other attributes of the source will be imported normally."]]})]])]
+                         :text [comps/ScrollFader
+                                {:outer-style {:margin "-1rem"}
+                                 :inner-style {:maxHeight 300 :padding "1rem"}
+                                 :content [:div {}
+                                           [:div {:style {:paddingBottom "1rem"}}
+                                            "Every entity (participant, sample, etc.) has an ID. Multiple
+                                            entities cannot share the same ID, they must be unique."]
+                                           [:div {:style {:paddingBottom "1rem"}}
+                                            "Entities can be linked by their ID. For example, a sample can be
+                                             linked to a participant."]
+                                           [:div {:style {:paddingBottom "1rem"}}
+                                            "If you import a sample that is linked to a participant, that
+                                            participant will also be imported. However, if the imported
+                                            participant (\"source participant\") has the same ID as an existing
+                                            participant in the workspace (\"destination participant\"), the
+                                            import cannot finish. Since two entities cannot have the same ID,
+                                            this would cause a conflict."]
+                                           [:div {:style {:paddingBottom "1rem"}}
+                                            "Re-linking allows the sample to link to the participant that was
+                                            already in the workspace (\"destination participant\")."]
+                                           [:div {:style {:paddingBottom "1rem"}}
+                                            "Keep in mind that there may be differences between the \"source
+                                            participant\" and the \"destination participant\", so you may want
+                                            to confirm that they are actually the same."]
+                                           [:div {} "All other attributes of the source will be imported normally."]]}]})]])]
          :show-cancel? (not-empty soft-conflicts)
          :ok-button (if (not-empty soft-conflicts)
                       {:text "Re-link"


docstring: a word

docstring: a word

--- src/blx/sortable/matcher.clj
+++ src/blx/sortable/matcher.clj
@@ -26,8 +26,8 @@
       (when-let [field (accessor item)]
         (matcher result-of-prev-matcher field))

-  until either a step returns a falsy result or all steps have been run, at
-  which point the final result will be returned."
+  until either a step's matcher returns a falsy result or all steps have been run,
+  at which point the final result will be returned."
   (:require [blx.sortable.util :refer [update*]]))

 (defn match


Refactor widgets

Refactor widgets

--- src/cljs/decktouch/core.cljs
+++ src/cljs/decktouch/core.cljs
@@ -67,18 +67,27 @@
     [:div (str sorted-mana-symbol-counts)]))

 (defn card-counter [cards]
-  [:h3 (count cards) " cards"])
+  [:h3 [:p.text-right (count cards) " cards"]])

 (defn home-page []
   [:div.container-fluid
-   [:div.row
-   [:div.col-md-offset-3.col-md-3
-     [:br] [:br] [:br] [:br] [:br]
-     [:div [card-input/component card-data/card-list]
-           [card-counter @card-data/card-list]
-           [mana-cost-widget @card-data/card-list]]
-     [:div [card-list @card-data/card-list]]
-     [:div [:a {:href "#/about"} "go to about page"]]]]])
+    [:br] [:br] [:br] [:br] [:br]
+      [:div.row
+        [:div.col-md-offset-4.col-md-6
+          [card-input/component card-data/card-list]]]
+      [:div.row
+        [:div.col-md-offset-2.col-md-2
+          [:div.row
+                    [card-counter @card-data/card-list]]
+          [:div.row
+                    [mana-cost-widget @card-data/card-list]
+                    [:br]]
+          [:div.row
+                    [:p.text-right "XX Spells"]
+                    [:p.text-right "YY Creatures"]
+                    [:p.text-right "ZZ Lands"]]]
+        [:div.row [card-list @card-data/card-list]]
+        [:div ]]])

 (defn about-page []
   [:div [:h2 "About decktouch"]


Add a github link to navbar

Add a github link to navbar

--- src/cljs/decktouch/core.cljs
+++ src/cljs/decktouch/core.cljs
@@ -41,7 +41,11 @@
       "Decktouch"]
     [:div#navbar.collapse.navbar-collapse
       [:ul.nav.navbar-nav
-        [:li [:a {:href "#/about"} "go to about page"]]]]])
+        ;[:li [:a {:href "#/about"} "go to about page"]]
+        [:li [:p.navbar-text.navbar-right
+               [:a.navbar-link {:href "https://github.com/Pance/decktouch"
+                                :target "_blank"}
+                 "Decktouch on Github"]]]]]])

 (defn current-page []
   [:div


Display pending ideas differently

Display pending ideas differently

--- src/cljs/geoforms/forms.cljs
+++ src/cljs/geoforms/forms.cljs
@@ -209,11 +209,12 @@
 (defn district-ideas-component [d ideas]
   [:div {:key d}
    [:p [:strong d]]
-   (for [{:keys [id title]} ideas]
+   (for [{:keys [id title pending?]} ideas]
      [:div.checkbox {:key id
                      :on-change #(let [supported? (-> % .-target .-checked)]
                                    (db/set-idea-support! id supported?))}
-      [:label [:input {:type :checkbox :id id}] title]])
+      [:label [:input {:type :checkbox :id id}]
+       [:span {:style {:color (if pending? :green)}} title]]])
    (when (not= d @db/selected-district)
      [:a.btn.btn-xs.btn-success
       {:on-click #(reset! db/selected-district d)}


refactor the ai

refactor the ai

--- src/cljs/triboard/ai/ai.cljs
+++ src/cljs/triboard/ai/ai.cljs
@@ -1,6 +1,7 @@
 (ns triboard.ai.ai
   (:require
     [triboard.ai.scores :as scores]
+    [triboard.logic.board :as board]
     [triboard.logic.constants :as cst]
     [triboard.logic.move :as move]
     [triboard.logic.turn :as turn]
@@ -12,113 +13,49 @@
 ;; Private
 ;; -----------------------------------------

+(defn- to-ai-input
+  [turn player]
+  {:player player
+   :other-players (remove #{player} cst/players)
+   :cell-weights (scores/get-weights-by-cell (turn/get-board turn))
+   })
+
 (defn- score-move
   "Compute the strength of a move, based on the converted cells"
-  [weights-by-cell player [point conversions]]
+  [{:keys [player cell-weights]} [point conversions]]
   {:pre [(move/conversions? conversions)]}
   (reduce
-    #(scores/update-score-diff weights-by-cell %1 %2)
+    #(scores/update-score-diff cell-weights %1 %2)
     scores/null-score-diff
     (conj conversions
       (move/empty-cell-conversion player point))
     ))

 (defn- get-worst-possible-score-for
-  [weights-by-cell turn player other-players]
+  [{:keys [player other-players] :as ai-input} turn]
   (let [all-adverse-moves (mapcat #(turn/get-moves-of turn %) other-players)
-        all-possible-scores (map #(score-move weights-by-cell player %) all-adverse-moves)]
-    (scores/min-delta-for player all-possible-scores)))
+        all-possible-scores (map #(score-move ai-input %) all-adverse-moves)]
+    (scores/min-delta-for player all-possible-scores)
+    ))

 (defn- move-best-outcome
-  [weights-by-cell player others turn [coord converted :as move]]
+  [ai-input turn [coord converted :as move]]
   (let [new-turn (turn/play-move turn coord)
-        move-diff (get (score-move weights-by-cell player move) player)
-        next-diff (get-worst-possible-score-for weights-by-cell new-turn player others)]
+        move-diff (get (score-move ai-input move) (:player ai-input))
+        next-diff (get-worst-possible-score-for ai-input new-turn)]
     (+ move-diff next-diff)))

 ;; -----------------------------------------
 ;; Public API
 ;; -----------------------------------------
-
 (defn best-move
   "[SIMPLISTIC] Return the best move for a player based on:
    * The immediate gain
    * The worse immediate lost afterwards"
-  {:pre [(player? player)]}
+  {:pre [(player? player)] :post [(board/coord? %)]}
   [turn player]
-  (let [weights-by-cell (scores/get-weights-by-cell (turn/get-board turn))
-        others (remove #{player} cst/players)]
+  (let [ai-input (to-ai-input turn player)]
     (first
-      (utils/fast-max-key
-        #(move-best-outcome weights-by-cell player others turn %)
-        (turn/get-moves-of turn player)
-        ))
-    ))
-
-#_(
-    (ns triboard.ai.ai
-      (:require
-        [triboard.ai.scores :as scores]
-        [triboard.logic.board :as board]
-        [triboard.logic.constants :as cst]
-        [triboard.logic.move :as move]
-        [triboard.logic.turn :as turn]
-        [triboard.utils :as utils]
-        ))
-
-
-    ;; -----------------------------------------
-    ;; Private
-    ;; -----------------------------------------
-
-    (defn- to-ai-input
-      [turn player]
-      {:player player
-       :other-players (remove #{player cst/players})
-       :cell-weights (scores/get-weights-by-cell (turn/get-board turn))
-       })
-
-    (defn- score-move
-      "Compute the strength of a move, based on the converted cells"
-      [{:keys [player cell-weights]} [point conversions]]
-      {:pre [(move/conversions? conversions)]}
-      (reduce
-        #(scores/update-score-diff cell-weights %1 %2)
-        scores/null-score-diff
-        (conj conversions
-          (move/empty-cell-conversion player point))
-        ))
-
-    (defn- get-worst-possible-score-for
-      [{:keys [player other-players] :as ai-input} turn]
-      (let [all-adverse-moves (mapcat #(turn/get-moves-of turn %) other-players)
-            all-possible-scores (map #(score-move ai-input %) all-adverse-moves)]
-        (scores/min-delta-for player all-possible-scores)
-        ))
-
-    (defn- move-best-outcome
-      [ai-input turn [coord converted :as move]]
-      (let [new-turn (turn/play-move turn coord)
-            move-diff (get (score-move ai-input move) (:player ai-input))
-            next-diff (get-worst-possible-score-for ai-input new-turn)]
-        (+ move-diff next-diff)))
-
-
-    ;; -----------------------------------------
-    ;; Public API
-    ;; -----------------------------------------
-
-    (defn best-move
-      "[SIMPLISTIC] Return the best move for a player based on:
-       * The immediate gain
-       * The worse immediate lost afterwards"
-      {:pre [(player? player)] :post [(board/coord? %)]}
-      [turn player]
-      (let [ai-input (to-ai-input turn player)]
-        (first
-          (utils/fast-max-key #(move-best-outcome ai-input turn %) (turn/get-moves-of turn player))
-          )))
-
-    )
-
+      (utils/fast-max-key #(move-best-outcome ai-input turn %) (turn/get-moves-of turn player))
+      )))


Save people and filters to local storage and only change atom when people downloaded successfully

--- src/cljs/uberblick/core.cljs
+++ src/cljs/uberblick/core.cljs
@@ -11,7 +11,7 @@
             [secretary.core :as secretary :include-macros true]
             [clojure.walk :as walk]
             [cljs.pprint :as pprint]
-
+            [alandipert.storage-atom :refer [local-storage]]
             [cljs.tools.reader :refer [read-string]]
             [cljs.js :refer [empty-state eval js-eval]])
   (:require-macros [cljs.core.async.macros :refer [go go-loop]])
@@ -20,10 +20,8 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; State

-(defonce people-atom (atom []))
-(defonce filters (atom [
-             "(startsWith? :KeyscanStatus \"In\")"
-                        ]))
+(defonce people-atom (local-storage (atom []) :people))
+(defonce filters (local-storage (atom ["(startsWith? :KeyscanStatus \"In\")"]) :filters))

 (def all-profile-keys '(:IsObjectivesAdmin :LaborCategoryID :FirstName :LaborRoleID :OversightPercent :WorkTeamID :BusinessUnitName :MobileNumber :PhotoFileName :IsCandidateAdmin :CanCommunicateClient :UserSystemID :Email :CreatedDate :BillingTargetHoursPerYear :Title :MobileNumberCountryCode :IsClient :IsScheduleConfirmationRulesEnforced :LastName :IsScheduleAdmin :UserName :Extension :TimeZoneName :HomeNumber :IsNotAPerson :UserID :KeyscanUpdated :HasDirectReports :IsAdmin :BusinessUnitID :CountryID :CompanyBusinessUnitID :TimeZoneID :PhotoPath :Name :Roles :CompanyBusinessUnitName :IsWeeklyReviewAdmin :Enabled :TagName :Supervisors :KeyscanStatus :OutOfOfficeReason :Status))
 ; (take! (genome/<get-all-active-klickster-profiles) (fn [profiles] (->> (apply merge profiles ) keys prn)))
@@ -42,12 +40,16 @@

 (defn set-people-to-all-active-klicksters [atm interval]
   (go-loop []
-    (reset! atm (<! (genome/<get-all-active-klickster-profiles)))
-    (println "Downloaded" (count @atm) "Klicksters")
+    (let [people (<! (genome/<get-all-active-klickster-profiles))]
+      (when (> (count people) 0)
+        (do
+          (reset! atm people)
+          (println "Downloaded" (count @atm) "Klicksters"))))
     (<! (timeout interval))
     (recur)))

 (set-people-to-all-active-klicksters people-atom (* 5 60 1000))
+

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; filter macro test
@@ -110,13 +112,6 @@
               ((fn [expr] (prn expr) expr))
               (eval-str ,,,))))

-
-
-;; Todo:
-;; partition-by :KeyscanStatus. Then display and add filters.
-;; add a <users-details test data set monday morning
-;; partition the users by 200
-
 (defn filter-people [people]
   (let [all-the-people (try
                          (if-not (empty? @filters)
@@ -179,7 +174,7 @@

 (defn Floor [title users]
   [:div
-   [:h3 title]
+   [:h3 title " (" (str (count users)) ")"]
    [:hr]
    [:div {:style {:display :flex
                   :flex-direction :row


Export everything to javascript that might be useful.

--- src/cljs_bach/synthesis.cljs
+++ src/cljs_bach/synthesis.cljs
@@ -7,7 +7,7 @@
     (js/window.AudioContext.)
     (js/window.webkitAudioContext.)))

-(defn current-time
+(defn ^:export current-time
   "Return the current time as recorded by the audio context."
   [context]
   (.-currentTime context))
@@ -30,12 +30,12 @@

 ; Plumbing

-(defn run-with
+(defn ^:export run-with
   "Convert a synth (actually a reader fn) into a concrete subgraph by supplying context and timing."
   [synth context at duration]
   (synth context at duration))

-(defn destination
+(defn ^:export destination
   "The destination of the audio context i.e. the speakers."
   [context at duration]
   (sink (.-destination context)))
@@ -46,7 +46,7 @@
     (.setValueAtTime param input at)
     (-> input (run-with context at duration) :output (.connect param))))

-(defn gain
+(defn ^:export gain
   "Multiply the signal by level."
   [level]
   (fn [context at duration]
@@ -54,7 +54,7 @@
       (doto (.createGain context)
         (-> .-gain (plug level context at duration))))))

-(def pass-through
+(def ^:export pass-through
   "Pass the signal through unaltered."
   (gain 1.0))

@@ -78,7 +78,7 @@
   [attack decay sustain hold release]
   (envelope [attack 1.0] [decay sustain] [hold sustain] [release 0]))

-(defn adsr
+(defn ^:export adsr
   "A four-stage envelope."
   [attack decay sustain release]
   (fn [context at duration]
@@ -87,7 +87,7 @@
           node (adshr attack decay sustain hold release)]
       (-> node (run-with context at duration)))))

-(defn percussive
+(defn ^:export percussive
   "A simple envelope."
   [attack decay]
   (envelope [attack 1.0] [decay 0.0]))
@@ -113,7 +113,7 @@
     upstream-synth
     downstream-synth))

-(defn connect->
+(defn ^:export connect->
   "Connect synths in series."
   [& nodes]
   (reduce connect nodes))
@@ -127,7 +127,7 @@
       (.connect (:output upstream) (:input graph))))
   (subgraph (:input upstream) (:output downstream)))

-(defn add
+(defn ^:export add
   "Add together synths by connecting them all to the same upstream and downstream gains."
   [& synths]
     (apply update-graph join pass-through pass-through synths))
@@ -156,12 +156,12 @@
         (-> .-buffer (set! (buffer generate-bit! context (+ duration 1.0))))
         (.start at)))))

-(def white-noise
+(def ^:export white-noise
   "Random noise."
   (let [white (fn [_] (-> (js/Math.random) (* 2.0) (- 1.0)))]
     (noise white)))

-(defn constant
+(defn ^:export constant
   "Make a constant value by creating noise with a fixed value."
   [x]
   (noise (constantly x)))
@@ -180,10 +180,10 @@
         (.start at)
         (.stop (+ at duration 1.0)))))) ; Give a bit extra for the release

-(def sine (partial oscillator "sine"))
-(def sawtooth (partial oscillator "sawtooth"))
-(def square (partial oscillator "square"))
-(def triangle (partial oscillator "triangle"))
+(def ^:export sine (partial oscillator "sine"))
+(def ^:export sawtooth (partial oscillator "sawtooth"))
+(def ^:export square (partial oscillator "square"))
+(def ^:export triangle (partial oscillator "triangle"))

 ; Filters
@@ -201,13 +201,13 @@
          (-> .-Q (plug q context at duration))
          (-> .-type (set! type)))))))

-(def low-pass (partial biquad-filter "lowpass"))
-(def high-pass (partial biquad-filter "highpass"))
+(def ^:export low-pass (partial biquad-filter "lowpass"))
+(def ^:export high-pass (partial biquad-filter "highpass"))

 ; Effects

-(defn stereo-panner
+(defn ^:export stereo-panner
   "Pan the signal left (-1) or right (1)."
   [pan]
   (fn [context at duration]
@@ -215,7 +215,7 @@
       (doto (.createStereoPanner context)
         (-> .-pan (plug pan context at duration))))))

-(defn delay-line
+(defn ^:export delay-line
   "Delay the signal."
   [seconds]
   (fn [context at duration]
@@ -232,7 +232,7 @@
       (doto (.createConvolver context)
         (-> .-buffer (set! (buffer generate-bit! context (+ duration 1.0))))))))

-(def reverb
+(def ^:export reverb
   "Crude reverb."
   (let [duration 5
         decay 3
@@ -243,7 +243,7 @@
                                (Math/pow (- 1 (/ i length)) decay)))]
     (convolver logarithmic-decay)))

-(defn enhance
+(defn ^:export enhance
   "Mix the original signal with one with the effect applied."
   [effect level]
   (add pass-through (connect-> effect (gain level))))


Problem added - "Power Set"

Problem added - "Power Set"

--- src/foreclojure/data_set.clj
+++ src/foreclojure/data_set.clj
@@ -965,9 +965,21 @@
             :tests ["(let [divides #{[8 4] [9 3] [4 2] [27 9]}]\n  (= (__ divides) #{[4 2] [8 4] [8 2] [9 3] [27 9] [27 3]}))"
                     "(let [more-legs\n      #{[\"cat\" \"man\"] [\"man\" \"snake\"] [\"spider\" \"cat\"]}]\n  (= (__ more-legs)\n     #{[\"cat\" \"man\"] [\"cat\" \"snake\"] [\"man\" \"snake\"]\n       [\"spider\" \"cat\"] [\"spider\" \"man\"] [\"spider\" \"snake\"]}))"
                     "(let [progeny\n      #{[\"father\" \"son\"] [\"uncle\" \"cousin\"] [\"son\" \"grandson\"]}]\n  (= (__ progeny)\n     #{[\"father\" \"son\"] [\"father\" \"grandson\"]\n       [\"uncle\" \"cousin\"] [\"son\" \"grandson\"]}))"]})
-
-      (insert! :problems
+
+(insert! :problems
           {:_id 85
+           :title "Power Set"
+           :times-solved 0
+           :description "Write a function which generates the power set of a given set.  The power set of a set x is the set of all subsets of x, including the empty set and x itself."
+           :approved true
+           :tags ["hard" "set-theory"]
+           :tests ["(= (__ #{1 :a}) #{#{1 :a} #{:a} #{} #{1}})"
+                   "(= (__ #{}) #{#{}})"
+                   "(= (__ #{1 2 3})\n   #{#{} #{1} #{2} #{3} #{1 2} #{1 3} #{2 3} #{1 2 3}})"
+                   "(= (count (__ (into #{} (range 10)))) 1024)"]})
+
+      (insert! :problems
+          {:_id 86
            :title "Create an Equation"
            :times-solved 0
            :description "Write a function which takes three or more integers.  Using these integers, your function should generate clojure code representing an equation.  The following rules for the equation must be satisfied:\n\n    1. All integers must be used once and only once.\n    2. The order of the integers must be maintained when reading the equation left-to-right.\n    3. The only functions you may use are +, *, or =.\n    4. The equation must use the minimum number of parentheses.\n    5. If no satisfying equation exists, return nil."
@@ -983,19 +995,6 @@
 		   "(= (__ 3 4 5 6) nil)"
 		   "(= (__ 1 2 10 100 2001) '(= (+ 1 (* 2 10 100)) 2001)"
 		   "(= (__ 1 2 10 100 1300) '(= (* (+ 1 2 10) 100) 1300)"]})
-
-
-      (insert! :problems
-           {:_id 86
-            :title "Power Set"
-            :times-solved 0
-            :description "A power set is the set of all subsets of a given set. Given a list, produce a set of sublists while preserving the order of elements."
-            :approved true
-            :tags ["hard" "seqs"]
-            :tests ["(= (__ '(1 :a)) '#{(1 :a) (:a) () (1)})"
-                    "(= (__ '()) '#{()})"
-                    "(= (__ '(1 2 3)) '#{() (1) (2) (3) (1 2) (1 3) (2 3) (1 2 3)})"
-                    "(= (count (__ (range 10))) 1024)"]})

       ))


fixing whitespace in logging message

fixing whitespace in logging message

--- src/clj/elephantdb/shard.clj
+++ src/clj/elephantdb/shard.clj
@@ -12,7 +12,7 @@

 (defn compute-host-to-shards [domain hosts numshards replication]
-  (log-message "host to shards" domain hosts numshards replication)
+  (log-message "host to shards " domain hosts numshards replication)
   (when (> replication (count hosts))
     (throw (IllegalArgumentException. "Replication greater than number of servers")))
   (let [shards (repeat-seq replication (range numshards))


Note on chunk-value.

Note on chunk-value.

--- src/clj/forma/source/hdf.clj
+++ src/clj/forma/source/hdf.clj
@@ -4,9 +4,7 @@
 ;; fact.
 ;;
 ;; The overall goal here is to process a MODIS HDF4 archive into
-;; tuples of the form
-;;
-;;     [?dataset ?spatial-res ?temporal-res ?tilestring ?date ?chunkid ?chunk-pix]
+;; a forma.schema/chunk-value.
 ;;
 ;; If every dataset can be coerced into this form, it becomes trivial
 ;; to match tuples up and combine them in various ways.


ensure that response is kebab-case

ensure that response is kebab-case

--- src/clj_docker/container.clj
+++ src/clj_docker/container.clj
@@ -4,13 +4,14 @@
             [cheshire.core :as json]
             [camel-snake-kebab :refer[->kebab-case ->CamelCase]]))

-(defn create-container [cli name & {:keys [host-config]}]
-  (client/post cli "/containers/create"
-               (merge {:content-type :json
-                       :query-params {:name name}
-                       :as :json}
-                      (when host-config
-                        {:body (json/generate-string (map-keys ->CamelCase host-config))}))))
+(defn create-container [cli & {:keys [name host-config]}]
+  (map-keys ->kebab-case
+            (client/post cli "/containers/create"
+                         (merge {:content-type :json
+                                 :query-params {:name name}
+                                 :as :json}
+                                (when host-config
+                                  {:body (json/generate-string (map-keys ->CamelCase host-config))})))))

 (defn start
   ([cli container] (start cli container {}))


Refactor filter and removing cards by type into it's own function

--- src/cljs/decktouch/core.cljs
+++ src/cljs/decktouch/core.cljs
@@ -22,6 +22,9 @@
   (filter (fn [card] (let [c (js->clj card)]
                        (is-card-of-type? c type))) cards))

+(defn remove-cards-by-type [cards type]
+  (filter #(not (is-card-of-type? % type)) cards))
+
 (defn card-type-list [cards type]
   (let [filtered-cards-by-type (filter-cards-by-type cards type)]
     (if (not-empty filtered-cards-by-type)
@@ -44,7 +47,7 @@
         [card-type-list cards "Planeswalker"]
         [card-type-list cards "Instant"]
         [card-type-list cards "Sorcery"]
-        (let [noncreature-cards (filter #(not (is-card-of-type? % "Creature")) cards)]
+        (let [noncreature-cards (remove-cards-by-type cards "Creature")]
           [card-type-list noncreature-cards "Enchantment" {:not "Creature"}])
         [card-type-list cards "Artifact"]]]))


chat channels change

chat channels change

--- src/cljs/netrunner/chat.cljs
+++ src/cljs/netrunner/chat.cljs
@@ -7,7 +7,7 @@
             [netrunner.ajax :refer [GET]]))

 (def app-state
-  (atom {:channels {:general [] :francais [] :deutsch [] :espanol [] :america [] :europe [] :asia []}}))
+  (atom {:channels {:general [] :america [] :europe [] :asia-pacific [] :francais []}}))

 (def chat-channel (chan))
 (def chat-socket (.connect js/io (str js/iourl "/chat")))


touchscreen help clarification

touchscreen help clarification

--- src/cljs/netrunner/help.cljs
+++ src/cljs/netrunner/help.cljs
@@ -136,8 +136,9 @@
                               [:li "a " [:span.legal "tournament legal"] " deck"]
                               [:li "enough time reserved for a full game and no distractions"]]]
                             [:p "Games with players not able or willing to follow above recommendations are propably better suited to the Casual room."
-                             "Some examples could be learning the game, learning the site's interface, testing a completely new and crazy deck idea, "
-                             "testing future spoilers, playing at work and likely to have to quit on short notice, etc."])}
+                             "Some examples would be: learning the game, learning the site's interface, testing a completely new and crazy deck idea, "
+                             "testing future spoilers, playing on a touchscreen, playing at work and likely to have to quit on short notice, etc. "
+                             "All of these circumstances may cause needless frustration of players expecting to play a game in a competitive setting."])}

             )}
     {:id "cards"


alternate players

alternate players

--- src/cljs/tictactoe/core.cljs
+++ src/cljs/tictactoe/core.cljs
@@ -3,10 +3,16 @@

 (enable-console-print!)

+
+;; Constants
+
 (def board-size 3)

 (def cell-state?
   #{:cell/empty :cell/cross :cell/circle})
+
+
+;; Game logic

 (defn init-board
   []
@@ -17,8 +23,30 @@
       )))

 (defonce app-state
-  (atom {:board (init-board)}))
+  (atom {:board (init-board)
+         :player :cell/cross}))

+(defn play-move
+  [board player x y]
+  (assoc board [x y] player))
+
+(defn next-player
+  [current]
+  (if (= current :cell/cross) :cell/circle :cell/cross))
+
+(defn on-move
+  [app-state x y]
+  (-> app-state
+    (update-in [:board] play-move (:player app-state) x y)
+    (update-in [:player] next-player)
+    ))
+
+(defn on-move-event
+  [x y]
+  (swap! app-state on-move x y))
+
+
+;; Rendering

 (defmulti render-cell
   "Draw a rectangle cell on the screen"
@@ -30,7 +58,7 @@
    {:x (+ 0.05 x) :width 0.9
     :y (+ 0.05 y) :height 0.9
     :fill "lightgrey"
-    :on-click #(println "titi")}
+    :on-click #(on-move-event x y)}
    ])

 (defmethod render-cell :cell/circle
@@ -76,6 +104,9 @@
        ))
    ])

+
+;; Plug to reagent
+
 (reagent/render
   [tictactoe]
   (js/document.getElementById "app"))


ideas

ideas

--- src/cljs/triboard/ai/ai.cljs
+++ src/cljs/triboard/ai/ai.cljs
@@ -52,6 +52,7 @@
 ;; Attempts minimax
 ;; -----------------------------------------

+;; TODO - How to add the custom scoring?
 (defn leaf-score
   [ai game]
   (:scores (game/current-turn game)))


store fix

store fix

--- src/cljs/triboard/store.cljs
+++ src/cljs/triboard/store.cljs
@@ -32,7 +32,7 @@
   (reaction
     (if (and (:help @app-state) (not @ai-player?))
       #(contains? (turn/transitions @current-turn) %)
-      {})))
+      (constantly false))))

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


fix bug introduced in previous commit

fix bug introduced in previous commit

--- src/clojure/duratom/core.clj
+++ src/clojure/duratom/core.clj
@@ -416,12 +416,15 @@
     (if (some? storage-init)
       ;; found stuff - sync it before adding the commit watch
       (send-off ag (fn [& _]
-                     (deliver safe-to-add-watch? true)
+                     (future ;; make sure state has changed before adding commit watch
+                       (while (nil? @ag)
+                         (Thread/sleep 5))
+                       (deliver safe-to-add-watch? true))
                      storage-init))
       ;; empty storage - trigger first commit
       (do (deliver safe-to-add-watch? true)
           (send-off @final-agent (constantly (ut/->init init)))))
-    (and @safe-to-add-watch?
+    (and @safe-to-add-watch? ;; wait for storage syncing
          @final-agent)))

 (defmulti duragent


use default-sqlite-rw

use default-sqlite-rw

--- src/clojure/duratom/core.clj
+++ src/clojure/duratom/core.clj
@@ -520,7 +520,7 @@
 (defmethod duratom :sqlite-db
   [_ & {:keys [db-config table-name row-id init lock rw]
         :or {lock (ReentrantLock.)
-             rw default-postgres-rw}}]
+             rw default-sqlite-rw}}]
   (sqlite-atom db-config table-name row-id lock init rw))

 (defmethod duratom :aws-s3
@@ -619,7 +619,7 @@
 (defmethod duragent :postgres-db
   [_ & {:keys [db-config table-name row-id init lock rw meta]
         :or {lock (ReentrantLock.)
-             rw default-postgres-rw}}]
+             rw default-sqlite-rw}}]
   (let [make-backend (partial storage/->PGSQLBackend
                               db-config
                               (if (ut/postgres-table-exists? db-config table-name)


Updated for connection pooling changes.

Updated for connection pooling changes.

--- src/cmr/bootstrap/system.clj
+++ src/cmr/bootstrap/system.clj
@@ -29,7 +29,7 @@
 (defn create-system
   "Returns a new instance of the whole application."
   []
-  (let [metadata-db (-> (mdb-system/create-system)
+  (let [metadata-db (-> (mdb-system/create-system "metadata-db-in-bootstrap-pool")
                         (dissoc :log :web)
                         (assoc :skip-background-jobs true))
         indexer (-> (idx-system/create-system)
@@ -57,7 +57,7 @@
              :collection-index-channel (chan 100)

              :catalog-rest-user (mdb-config/catalog-rest-db-username)
-             :db (oracle/create-db (mdb-config/db-spec))
+             :db (oracle/create-db (mdb-config/db-spec "bootstrap-pool"))
              :web (web/create-web-server (transmit-config/bootstrap-port) routes/make-api)
              :zipkin (context/zipkin-config "bootstrap" false)}]
     (transmit-config/system-with-connections sys [:metadata-db])))


Add SchemaUnwrapper protocol, which reveals an "inner" schema

--- src/io/aviso/rook/schema.clj
+++ src/io/aviso/rook/schema.clj
@@ -2,7 +2,8 @@
   "Some small enhancements to Prismatic Schema that are valuable to, or needed by, the Swagger support."
   {:added "0.1.27"}
   (:require [schema.core :as s]
-            [schema.macros :as macros]))
+            [schema.macros :as macros])
+  (:import [schema.core Maybe EnumSchema]))

 (defmacro schema
   "Creates a named schema, which includes metadata as per [[defschema]]. This is useful for one-off
@@ -27,6 +28,12 @@
   ([name docstring form]
    `(def ~name ~docstring (schema ~name ~docstring ~form))))

+(defprotocol SchemaUnwrapper
+  "A protocol for 'unwrapping' a Schema, to extract a nested Schema."
+
+  (unwrap-schema [this]
+    "Returns the nested schema where appropriate, or throws an exception when a nested schema is not available."))
+
 (defrecord IsInstance [^Class expected-class]
   s/Schema

@@ -37,7 +44,21 @@
         (macros/validation-error this x (list 'instance? expected-class x)))))

   (explain [_]
-    (list 'instance? expected-class)))
+    (list 'instance? expected-class))
+
+  SchemaUnwrapper
+
+  (unwrap-schema [_] expected-class))
+
+(extend-protocol SchemaUnwrapper
+
+  Maybe
+  (unwrap-schema [this]
+    (.schema this))
+
+  EnumSchema
+  (unwrap-schema [this]
+    (.vs this)))

 (defn with-description
   "Adds a :description key to the metadata of the schema.


Updating for line-string refactoring.

Updating for line-string refactoring.

--- src/cmr/search/results_handlers/atom_spatial_results_handler.clj
+++ src/cmr/search/results_handlers/atom_spatial_results_handler.clj
@@ -5,7 +5,7 @@
             [cmr.spatial.point :as p]
             [cmr.spatial.mbr :as m]
             [cmr.spatial.geodetic-ring :as gr]
-            [cmr.spatial.line :as l]
+            [cmr.spatial.line-string :as l]
             [clojure.string :as str]))

 (defn- points-map->points-str
@@ -34,7 +34,7 @@
     (x/element :georss:point {} (shape->string point)))

-  cmr.spatial.line.Line
+  cmr.spatial.line_string.LineString
   (shape->string
     [line]
     (points-map->points-str line))
@@ -94,7 +94,7 @@
         points (map shape->string (get shapes-by-type cmr.spatial.point.Point))
         boxes (map shape->string (get shapes-by-type cmr.spatial.mbr.Mbr))
         polygons (map polygon->json (get shapes-by-type cmr.spatial.polygon.Polygon))
-        lines (map shape->string (get shapes-by-type cmr.spatial.line.Line))
+        lines (map shape->string (get shapes-by-type cmr.spatial.line_string.LineString))
         spatial {:points points
                  :boxes boxes
                  :polygons polygons


example

example

--- src/simple/replicate.clj
+++ src/simple/replicate.clj
@@ -5,3 +5,5 @@

 (doseq [x (list-replicate 3 [1 2 3])]
   (println x))
+
+; (mapcat (partial repeat 2)  [2])


All types in. BUT: they are not types, but type-likes. Hmm.

--- src/spec_tools/core.cljc
+++ src/spec_tools/core.cljc
@@ -1,5 +1,10 @@
 (ns spec-tools.core
-  (:refer-clojure :exclude [type string? integer? int? double? keyword? boolean? uuid? inst?])
+  (:refer-clojure :exclude [type any? some?
+                            number? integer? int? pos-int? neg-int? nat-int? float? double?
+                            boolean? string? ident? simple-ident? qualified-ident?
+                            keyword? simple-keyword? qualified-keyword? symbol? simple-symbol? qualified-symbol?
+                            uuid? uri? bigdec? inst? seqable? indexed? map? vector? list? seq? char? set?
+                            nil? false? true? zero? rational? coll? empty? associative? sequential? ratio? bytes?])
   #?(:cljs (:require-macros [spec-tools.core :refer [type]]))
   (:require
     [clojure.spec :as s]
@@ -119,9 +124,10 @@
 (defprotocol TypeLike
   (type-like [this]))

-(declare ->Type)
-
-(defrecord Type [form pred gfn info]
+(defn- extra-type-map [t]
+  (dissoc t :form :pred :gfn))
+
+(defrecord Type [form pred gfn]
   #?@(:clj
       [s/Specize
        (specize* [s] s)
@@ -143,8 +149,12 @@
   (gen* [_ _ _ _] (if gfn
                     (gfn)
                     (gen/gen-for-pred pred)))
-  (with-gen* [_ gfn] (->Type form pred gfn info))
-  (describe* [_] `(spec-tools.core/type ~form ~info))
+  (with-gen* [this gfn] (assoc this :gfn gfn))
+  (describe* [this]
+    (let [info (extra-type-map this)]
+      (if (seq info)
+        `(spec-tools.core/type ~form ~info)
+        `(spec-tools.core/type ~form))))
   IFn
   #?(:clj  (invoke [_ x] (pred x))
      :cljs (-invoke [_ x] (pred x)))
@@ -158,17 +168,16 @@
      (.write w (str "#Type"
                     (merge
                       {:pred (:form t)}
-                      (if-let [info (:info t)]
-                        {:info info}))))))
+                      (extra-type-map t))))))

 (defmacro type
   ([pred]
-  `(->Type '~(or (->> pred #?(:clj resolve, :cljs (resolve &env)) ->sym) pred) ~pred nil nil))
+   `(map->Type {:form '~(or (->> pred #?(:clj resolve, :cljs (resolve &env)) ->sym) pred), :pred ~pred}))
   ([pred info]
-   `(->Type '~(or (->> pred #?(:clj resolve, :cljs (resolve &env)) ->sym) pred) ~pred nil ~info)))
+   `(map->Type (merge ~info {:form '~(or (->> pred #?(:clj resolve, :cljs (resolve &env)) ->sym) pred), :pred ~pred}))))

 (defn with-info [^Type t info]
-  (map->Type (assoc t :info info)))
+  (assoc t :info info))

 (defn info [^Type t]
   (:info t))
@@ -177,11 +186,93 @@
 ;; concrete types
 ;;

-(def string? (type clojure.core/integer?))
+(def any? (type clojure.core/any?))
+(def some? (type clojure.core/some?))
+(def number? (type clojure.core/number?))
 (def integer? (type clojure.core/integer?))
 (def int? (type clojure.core/int?))
+(def pos-int? (type clojure.core/pos-int?))
+(def neg-int? (type clojure.core/neg-int?))
+(def nat-int? (type clojure.core/nat-int?))
+(def float? (type clojure.core/float?))
 (def double? (type double-like?))
+(def boolean? (type clojure.core/boolean?))
+(def string? (type clojure.core/string?))
+(def ident? (type clojure.core/ident?))
+(def simple-ident? (type clojure.core/simple-ident?))
+(def qualified-ident? (type clojure.core/qualified-ident?))
 (def keyword? (type clojure.core/keyword?))
-(def boolean? (type clojure.core/boolean?))
+(def simple-keyword? (type clojure.core/simple-keyword?))
+(def qualified-keyword? (type clojure.core/qualified-keyword?))
+(def symbol? (type clojure.core/symbol?))
+(def simple-symbol? (type clojure.core/simple-symbol?))
+(def qualified-symbol? (type clojure.core/qualified-symbol?))
 (def uuid? (type clojure.core/uuid?))
+(def uri? (type clojure.core/uri?))
+(def bigdec? (type clojure.core/bigdec?))
 (def inst? (type clojure.core/inst?))
+(def seqable? (type clojure.core/seqable?))
+(def indexed? (type clojure.core/indexed?))
+(def map? (type clojure.core/map?))
+(def vector? (type clojure.core/vector?))
+(def list? (type clojure.core/list?))
+(def seq? (type clojure.core/seq?))
+(def char? (type clojure.core/char?))
+(def set? (type clojure.core/set?))
+(def nil? (type clojure.core/nil?))
+(def false? (type clojure.core/false?))
+(def true? (type clojure.core/true?))
+(def zero? (type clojure.core/zero?))
+(def rational? (type clojure.core/rational?))
+(def coll? (type clojure.core/coll?))
+(def empty? (type clojure.core/empty?))
+(def associative? (type clojure.core/associative?))
+(def sequential? (type clojure.core/sequential?))
+(def ratio? (type clojure.core/ratio?))
+(def bytes? (type clojure.core/bytes?))
+
+(comment
+  #{any?
+    some?
+    number?
+    integer?
+    int?
+    pos-int?
+    neg-int?
+    nat-int?
+    float?
+    double?
+    boolean?
+    string?
+    ident?
+    simple-ident?
+    qualified-ident?
+    keyword?
+    simple-keyword?
+    qualified-keyword?
+    symbol?
+    simple-symbol?
+    qualified-symbol?
+    uuid?
+    uri?
+    bigdec?
+    inst?
+    seqable?
+    indexed?
+    map?
+    vector?
+    list?
+    seq?
+    char?
+    set?
+    nil?
+    false?
+    true?
+    zero?
+    rational?
+    coll?
+    empty?
+    associative?
+    sequential?
+    ratio?
+    bytes?})


audit log file format

audit log file format

--- src/org/zalando/stups/friboo/system/http.clj
+++ src/org/zalando/stups/friboo/system/http.clj
@@ -213,6 +213,7 @@
                                 (assoc :logged-on (t/now))
                                 (dissoc :swagger)
                                 (dissoc :configuration)
+                                (dissoc :body)
                                 (dissoc-in [:tokeninfo "access_token"]))]
               (add-logs audit-logs [audit-log])
               response)))))
@@ -220,9 +221,16 @@
       (log/info "Not logging modifying requests.")
       next-handler)))

-(def audit-logs-file-format)
-
 (def default-audit-flush-millis (* 5 60 1000))
+
+(def audit-logs-file-formatter
+  "yyyy/MM/dd/{app-id}/{app-version}/{instance-id}/modifying-requests-hh-mm-ss.log
+  e.g. 2015/06/15/kio/b2/i123456/modifying-requests-08-31-52.log"
+  (let [app-id (or (System/getenv "APPLICATION_ID") "unknown-app")
+        app-version (or (System/getenv "APPLICATION_VERSION") "unknown-version")
+        instance-id (or (System/getenv "INSTANCE_ID") "unknown-instance")
+        format-string (format "yyyy/MM/dd/'%s/%s/%s/modifying-requests'-HH-mm-ss'.log'" app-id app-version instance-id)]
+    (tf/formatter format-string t/utc)))

 (defn store-audit-logs!
   "Stores the audit logs in an S3 bucket."
@@ -233,7 +241,7 @@
         (let [file-content (string/join "\n" (map json/write-str previous-logs))
               file-stream (-> file-content (.getBytes "UTF-8") (ByteArrayInputStream.))
               content-length (count file-content)
-              file-name (str (t/now))]
+              file-name (tf/unparse audit-logs-file-formatter (t/now))]
           (s3/put-object :bucket-name bucket
                          :key file-name
                          :input-stream file-stream
@@ -242,14 +250,14 @@
           (add-logs audit-logs previous-logs)
           (log/warn "Could not store audit logs because of %s." (str t)))))))

-(defn schedule-audit-log-flusher [bucket audit-logs configuration]
+(defn schedule-audit-log-flusher! [bucket audit-logs configuration]
   (when bucket
     (let [flush-interval (or (:audit-flush-millis configuration) default-audit-flush-millis)
           pool (at/mk-pool :cpu-count 1)]
       (at/every flush-interval #(store-audit-logs! audit-logs bucket) pool :initial-delay flush-interval)
       pool)))

-(defn stop-audit-log-flusher [bucket audit-logs pool]
+(defn stop-audit-log-flusher! [bucket audit-logs pool]
   (when bucket
     (dosync
       (at/stop-and-reset-pool! pool :strategy :kill)
@@ -307,7 +315,7 @@
                             :hystrix-httpd        (run-hystrix-jetty (merge configuration {:join? false
                                                                                :port  7979}))
                             :handler              handler
-                            :audit-log-flush-pool (schedule-audit-log-flusher audit-logs-bucket audit-logs configuration)}))))))
+                            :audit-log-flush-pool (schedule-audit-log-flusher! audit-logs-bucket audit-logs configuration)}))))))

 (defn stop-component
   "Stops the http component."
@@ -322,7 +330,7 @@
       (when-not (:no-listen? (:configuration component))
         (.stop (:httpd component))
         (.stop (:hystrix-httpd component))
-        (stop-audit-log-flusher (:audit-logs-bucket component) (:audit-logs component) (:audit-log-flush-pool component)))
+        (stop-audit-log-flusher! (:audit-logs-bucket component) (:audit-logs component) (:audit-log-flush-pool component)))
       (merge component {:httpd                nil
                         :hystrix-httpd        nil
                         :handler              nil


(PDB-5161) engine/required-by-projections: rely on parse-field

--- src/puppetlabs/puppetdb/query_eng/engine.clj
+++ src/puppetlabs/puppetdb/query_eng/engine.clj
@@ -3089,10 +3089,7 @@
                           (remove (comp :query-only? val))
                           keys)))
         ;; Now we need just the base name, i.e. facts.kernel -> facts
-        basename #(let [path-or-field (parse/dotted-query->path %)]
-                    (if (coll? path-or-field)
-                      (first path-or-field)
-                      path-or-field))
+        basename #(-> % parse/parse-field first :name)
         required-joins (map #(get-in proj-info [% :join-deps])
                             (map basename fields))]
     (when (some nil? required-joins)


Implemented placing pieces using HTML links

--- src/tic_tac_toe/core.clj
+++ src/tic_tac_toe/core.clj
@@ -7,6 +7,7 @@
             [hiccup.core :as hiccup]
             [hiccup.form :as form]
             [hiccup.element :as element]
+            [ring.util.response :as resp]
 ))

 (def picture-map {:e "empty.png" :x "cross.png" :o "nought.png"})
@@ -53,14 +54,6 @@
     (println (apply str row))))

-(defn get-board [board]
-  (let [rows (partition 3 board)]
-    (hiccup/html [:center
-                  [:table {:border "1px solid black"}
-                  (for [row rows]
-                    [:tr (for [cell row]
-                       [:td (element/image (cell picture-map))])])]
-                 (form/form-to [:post "/post"] (form/submit-button "asdf" ))])))

 (defn zip [rest]
@@ -107,9 +100,31 @@

+;;
+;; Web stuff below this point!
+;;
+
+(defn get-board [board]
+  (let [rows (partition 3 board)]
+    (hiccup/html [:center
+                  [:table {:border "1px solid black"}
+                   (for [[row-number row] (map-indexed vector rows)]
+                     [:tr
+                      (for [[column-number cell] (map-indexed vector row)]
+                       [:td
+                        [:a {:href (str "/place-piece/" (+  column-number (* row-number 3)) )}
+                         (element/image (cell picture-map))]])])]
+                 (form/form-to [:post "/post"] (form/submit-button "asdf" ))])))
+
+(defn get-board-atom []
+  (get-board @board))
+

 (defroutes app-routes
-  (GET "/" [] (get-board board-o-wins))
+  (GET "/" [] (get-board-atom))
+  (GET "/place-piece/:pos" [pos] (do
+                                   (swap! board place-piece :x (Integer/parseInt pos))
+                                   (resp/redirect "/")))
   (POST "/post" [] (get-board board-draw ))
   (route/resources "/")
   (route/not-found "
Page not found
"))
@@ -131,3 +146,9 @@
   ([port]
      (make-server (Integer/parseInt port))))

+(comment
+  (def server (make-server))
+  (.stop server)
+  (swap! board place-piece :x 0)
+  (swap! board place-piece :o 4)
+)


Expanded element processing to avoid some front end errors

* Remove notelabel spans
* Removing any onclick attributes if an element has a style, since that
  comes from TVTropes and not our system
* If we receive a style attribute that is a string, parse it into a map
  as is expected.

Part of https://app.asana.com/0/29043151838323/34643529327805

--- src-cljs/tropology/core.cljs
+++ src-cljs/tropology/core.cljs
@@ -1,7 +1,7 @@
 (ns tropology.core
   (:require [ajax.core :refer [GET POST PUT]]
             [reagent.core :as reagent :refer [atom]]
-            [clojure.string :refer [lower-case]]
+            [clojure.string :refer [lower-case split trim]]
             [reagent-forms.core :refer [bind-fields]]
             [re-frame.core :as re-frame]
             [tropology.graph :as graph]
@@ -90,7 +90,7 @@
 (re-frame/register-handler
   :remove-like
   (fn [app-state [_ article-ref]]
-    (.log js/console (str "Removing " article-ref))
+    #_ (.log js/console (str "Removing " article-ref))
     (assoc-in app-state [:article-data :like-list] (remove #(= article-ref (:ref %)) (get-in app-state [:article-data :like-list])))
     ))

@@ -161,27 +161,60 @@
     (into [] (map #(replace-link-for-dispatch % extra-params) element))
     element))

-(defn process-ul [element _]
+(defn process-ul [element]
   (if (= :ul (first element))
     (into [:ul] (add-key-meta (rest element)))
     element))

-
-(def element-processor (apply comp [process-a process-ul]))
-
-(defn process-element [processor element extra-params]
+(defn process-span [element]
+  (if (= :span (first element))
+    (let [attrs (second element)
+          tail  (nthrest element 2)]
+      (cond
+        (= "notelabel" (:class attrs)) nil
+        (map? attrs) (into [:span (dissoc attrs :id :onclick)] tail)
+        :else element
+        ))
+    element))
+
+
+(defn process-style [element]
+  (let [head  (first element)
+        attrs (second element)
+        tail  (nthrest element 2)
+        style (:style attrs)]
+    (if (and (not-empty style)
+             (string? style))
+      (into [head
+             (assoc attrs :style (->> (split style #"\;")
+                                      (map #(split % #"\:"))
+                                      (into {}))
+                          :onclick nil)]
+            tail)
+      element)
+    ))
+
+
+
+(defn process-element [processor element]
   "Receives an element as a hiccup structure. If it's a link, then the link
    is replaced for an action dispatch; for a :ul, it adds a key as meta to all
    the nested elements; otherwise we return the same structure."
   (if (vector? element)
-    (processor element extra-params)
+    (processor element)
     element
     ))

 (defn process-trope
   "Receives the hiccup data for a trope and processes it before display"
   [coll extra-params]
-  (clojure.walk/prewalk #(process-element element-processor % extra-params) coll))
+  (let [element-processor (comp #(process-a % extra-params)
+                                process-ul
+                                process-style
+                                process-span)]
+    (clojure.walk/prewalk #(process-element element-processor %) coll)
+    )
+  )

 ;


Add missing license header on stream.common ns.

--- src/futura/stream/common.clj
+++ src/futura/stream/common.clj
@@ -1,3 +1,27 @@
+;; Copyright (c) 2015 Andrey Antukh <niwi@niwi.nz>
+;; All rights reserved.
+;;
+;; Redistribution and use in source and binary forms, with or without
+;; modification, are permitted provided that the following conditions
+;; are met:
+;;
+;; 1. Redistributions of source code must retain the above copyright
+;;    notice, this list of conditions and the following disclaimer.
+;; 2. Redistributions in binary form must reproduce the above copyright
+;;    notice, this list of conditions and the following disclaimer in the
+;;    documentation and/or other materials provided with the distribution.
+;;
+;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+;; OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+;; IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+;; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+;; NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+;; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+;; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+;; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
 (ns futura.stream.common
   "Defines a common subset of functions and hepers that
   works with all kind of subscription objects."


Add more functions to math ns.

Add more functions to math ns.

--- src/uxbox/util/math.cljs
+++ src/uxbox/util/math.cljs
@@ -25,6 +25,16 @@
   "Negate the number"
   [^number v]
   (- v))
+
+(defn sqrt
+  "Returns the square root of a number."
+  [v]
+  (js/Math.sqrt v))
+
+(defn pow
+  "Returns the base to the exponent power."
+  [b e]
+  (js/Math.pow b e))

 (defn floor
   "Returns the largest integer less than or


Minor cleaning.

Minor cleaning.

--- src/active/clojure/match.clj
+++ src/active/clojure/match.clj
@@ -522,36 +522,26 @@
         (case match
           :key-exists-without-binding
           (if (optional? mode)
-            (let [k (make-key (:key body))]
+            [{} `[]]
+            (let [[mode body] body
+                  k (make-key (if (flat? mode) body (:key body)))]
+              [`{~k ~'_} `[]]))
+
+          :key-exists-with-binding
+          (let [k (make-key (:key body))
+                b (make-binding (:binding body))]
+            (if (optional? mode)
               [{}
-               `[]])
-            (let [[mode body] body
-                  mflat?      (flat? mode)
-                  k           (make-key (if mflat? body (:key body)))]
-              [`{~k ~'_}
-               `[]]))
-
-          :key-exists-with-binding
-          (if (optional? mode)
-            (let [k (make-key (:key body))
-                  b (make-binding (:binding body))]
-              [{}
-               `[~(symbol b) (get-in ~message [~k])]])
-            (let [k (make-key (:key body))
-                  b (make-binding (:binding body))]
+               `[~(symbol b) (get-in ~message [~k])]]
               [`{~k ~(symbol b)}
                `[~(symbol b) (get-in ~message [~k])]]))

           :path-exists-without-binding
           (if (optional? mode)
-            (let [path (mapv make-key (:path body))]
-              [{}
-               `[]])
+            [{} `[]]
             (let [[mode body] body
-                  mflat?      (flat? mode)
-                  path        (mapv make-key (if mflat? body (:path body)))]
-              [`{~path ~'_}
-               `[]]))
+                  path (mapv make-key (if (flat? mode) body (:path body)))]
+              [`{~path ~'_} `[]]))

           :path-exists-with-binding
           (let [path     (mapv make-key (:path body))


compact code

compact code

--- src/anycljs/shared/json.cljs
+++ src/anycljs/shared/json.cljs
@@ -1,11 +1,6 @@
 (ns shared.json
-  (:import
-   [goog.net XhrIo]
-   [goog Uri]))
+  (:require
+   [goog.net.XhrIo :as xhr]))

 (defn fetch-json [uri cb]
-  (.send XhrIo (Uri. uri)
-         (fn [e]
-           (let [xhr (.-target e)
-                 res (.getResponseJson xhr)]
-             (cb (js->clj res))))))
+  (xhr/send uri (fn [e] (-> e .-target .getResponseJson js->clj cb))))


Don't need to pprint new field/table name lists

--- src/metabase/driver/sync.clj
+++ src/metabase/driver/sync.clj
@@ -66,7 +66,7 @@
           (let [existing-table-names (set (keys table-name->id))
                 new-table-names      (set/difference active-table-names existing-table-names)]
             (when (seq new-table-names)
-              (log/info (u/format-color 'blue "Found new tables: %s" (u/pprint-to-str new-table-names)))
+              (log/info (u/format-color 'blue "Found new tables: %s" new-table-names))
               (doseq [new-table-name new-table-names]
                 (ins Table :db_id (:id database), :active true, :name new-table-name)))))

@@ -197,7 +197,7 @@
       (let [existing-field-names (set (keys existing-field-name->field))
             new-field-names      (set/difference (set (keys active-column-names->type)) existing-field-names)]
         (when (seq new-field-names)
-          (log/info (u/format-color 'blue "Found new fields for table '%s': %s" (:name table) (u/pprint-to-str new-field-names))))
+          (log/info (u/format-color 'blue "Found new fields for table '%s': %s" (:name table) new-field-names)))
         (doseq [[active-field-name active-field-type] active-column-names->type]
           ;; If Field doesn't exist create it
           (if-not (contains? existing-field-names active-field-name)


Fix duplicate tables for MongoDB after doing manual sync #1633

--- src/metabase/driver/sync.clj
+++ src/metabase/driver/sync.clj
@@ -78,6 +78,7 @@
   (sync-database-active-tables! driver (for [table (sel :many Table, :db_id (:id database) :active true)]
                                          ;; replace default delays with ones that reuse database (and don't require a DB call)
                                          (assoc table :db (delay database)))))
+

 (defn- -sync-database! [driver database]
   (let [active-tables      (driver/active-tables driver database)


remove digit check, get a NPE if field doesn't exist

--- src/navigator/validation.clj
+++ src/navigator/validation.clj
@@ -14,7 +14,6 @@
   [task]
   (validate task
             [:task/id-sk        present? "must be present"]
-            [:task/id-sk        digits?  "must consist of digits"]
             [:task/id-sk-origin present? "must be present"]
             [:task/name         present? "must be present"]
             [:task/version      present? "must be present"]
@@ -24,7 +23,6 @@
   [comp]
   (validate comp
             [:comp/id-sk       present? "must be present"]
-            [:comp/id-sk       digits?  "must consist of digits"]
             [:comp/name        present? "must be present"]
             [:comp/description present? "must be present"]
             [:comp/version     present? "must be present"]
@@ -49,7 +47,6 @@
   [perf-asmt]
   (validate perf-asmt
             [:perf-asmt/id-sk                    present? "must be present"]
-            [:perf-asmt/id-sk                    digits?  "must consist of digits"]
             [:perf-asmt/id-sk-origin             present? "must be present"]
             [:perf-asmt/name                     present? "must be present"]
             [:perf-asmt/version                  present? "must be present"]


Add curve trimming functions

Add curve trimming functions

--- src/clj/genartlib/curves.clj
+++ src/clj/genartlib/curves.clj
@@ -1,7 +1,7 @@
 (ns genartlib.curves
   (:require
-    [genartlib.algebra :refer [interpolate point-dist]]
-    [genartlib.util :refer [enumerate]]))
+    [genartlib.algebra :refer [interpolate point-dist lines-intersection-point]]
+    [genartlib.util :refer [enumerate w h]]))

 (defn ^:private single-chaikin-step
   [points tightness]
@@ -174,3 +174,97 @@
                                min-tolerated-dist)
           (drop 1 (line-simplification (drop max-index points)
                                        min-tolerated-dist)))))))
+(defn ^:private in-bounds?
+  [[x y]]
+  (and (>= x 0)
+       (< x (w))
+       (>= y 0)
+       (< y (h))))
+
+(defn trim-curve-to-bounds
+  "Returns a seq of sub-curves that are entirely within the bounds of the image"
+  [points]
+  (let [border-lines [[[0 0] [(w) 0]]
+                      [[(w) 0] [(w) (h)]]
+                      [[(w) (h)] [0 (h)]]
+                      [[0 (h)] [0 0]]]]
+    (loop [points (rest points)
+           segments []
+           current-segment (if (in-bounds? (first points)) [(first points)] [])
+           was-in-bounds? (in-bounds? (first points))
+           prev-point (first points)]
+
+      (if (empty? points)
+        (let [final-segments (conj segments current-segment)]
+          (vec
+            (filter
+              #(>= (count %) 2)
+              final-segments)))
+
+        (let [next-point (first points)
+              next-in-bounds? (in-bounds? next-point)]
+
+          (cond
+            ; still in bounds
+            (and was-in-bounds? next-in-bounds?)
+            (recur (rest points) segments (concat current-segment [next-point]) true next-point)
+
+            ; still out of bounds
+            (and (not was-in-bounds?) (not next-in-bounds?))
+            (recur (rest points) segments current-segment false next-point)
+
+            ; entering the bounds
+            (and (not was-in-bounds?) next-in-bounds?)
+            (let [inter (some
+                          (fn [[p1 p2]]
+                            (lines-intersection-point
+                              prev-point next-point
+                              p1 p2))
+                          border-lines)]
+              (recur (rest points) segments [inter next-point] true next-point))
+
+            ; leaving the bounds
+            (and was-in-bounds? (not next-in-bounds?))
+            (let [inter (some
+                          (fn [[p1 p2]]
+                            (lines-intersection-point
+                              prev-point next-point
+                              p1 p2))
+                          border-lines)]
+              (recur (rest points) (conj segments (concat current-segment [inter])) [] false next-point))))))))
+
+(defn trim-curve-start
+  "Removes the specified length from the start of a curve. If the specified length
+   is longer than the entire curve length, an empty vector is returned."
+  [points trim-length]
+  (if (<= (count points) 1)
+    []
+    (loop [remaining-points (rest points)
+           current-length 0
+           prev-point (first points)]
+
+      (if (empty? remaining-points)
+        []
+
+        (let [new-point (first remaining-points)
+              new-dist (point-dist prev-point new-point)
+              new-length (+ current-length new-dist)]
+          (if (< new-length trim-length)
+            (recur (rest remaining-points) new-length new-point)
+
+            ; we need to split
+            (let [dist-needed (- trim-length current-length)
+                  t (/ dist-needed new-dist)
+                  x (interpolate (first prev-point) (first new-point) t)
+                  y (interpolate (second prev-point) (second new-point) t)]
+
+              (concat [[x y]] remaining-points))))))))
+
+(defn trim-curve-end
+  "Removes the specified length from the end of a curve. If the specified length
+   is longer than the entire curve length, an empty vector is returned."
+  [points trim-length]
+  (-> points
+      (reverse)
+      (trim-curve-start trim-length)
+      (reverse)))


Favour (vec) over (into []).

Favour (vec) over (into []).

--- src/clj_ravendb/requests.clj
+++ src/clj_ravendb/requests.clj
@@ -20,9 +20,8 @@
   to the indexes endpoint in order to query an index."
   [{:keys [address replications]} qry]
   (let [request-url (str "/indexes/" (qry :index) "?query=")
-        criteria (clojure.string/join " AND " (into []
-                                                    (for [[k v] (dissoc qry :index)]
-                                                      (str (name k) ":" v))))]
+        criteria (clojure.string/join " AND " (vec (for [[k v] (dissoc qry :index)]
+                                                     (str (name k) ":" v))))]
     {:urls (all-urls address replications (str request-url criteria))}))

 (defn bulk-operations


Formatting and whitespace fixes.

Formatting and whitespace fixes.

--- src/clj_ravendb/requests.clj
+++ src/clj_ravendb/requests.clj
@@ -12,10 +12,8 @@
   "Generates a map that represents a http request
   to the queries endpoint in order to load documents"
   [{:keys [address replications]} document-ids]
-  {
-   :urls (all-urls address replications "/Queries")
-   :body (json/write-str document-ids)
-   })
+  {:urls (all-urls address replications "/Queries")
+   :body (json/write-str document-ids)})

 (defn query-index
   "Generates a map that represents a http request
@@ -25,49 +23,39 @@
         criteria (clojure.string/join " AND " (into []
                                                     (for [[k v] (dissoc qry :index)]
                                                       (str (name k) ":" v))))]
-    {
-     :urls (all-urls address replications (str request-url criteria))
-     }))
+    {:urls (all-urls address replications (str request-url criteria))}))

 (defn bulk-operations
   "Generates a map that represents a http request
   to the bulk_docs endpoint in order run document operations."
   [{:keys [address replications]} operations]
   (let [request-url (str address "/bulk_docs")]
-    {
-     :urls (all-urls address replications "/bulk_docs")
-     :body (json/write-str operations)
-     }))
+    {:urls (all-urls address replications "/bulk_docs")
+     :body (json/write-str operations)}))

 (defn put-document
   "Generates a map that represents a http request
   to the bulk_docs endpoint in order put a document."
   [client key document]
-  (bulk-operations client [{
-                            :Method "PUT"
+  (bulk-operations client [{:Method "PUT"
                             :Key key
                             :Document document
-                            :Metadata { }
-                            }]))
+                            :Metadata { }}]))

 (defn put-index
   "Generates a map that represents a http request
   to the indexes endpoint in order to put an index."
   [{:keys [address]} {:keys [name alias where select]}]
   (let [request-url (str address "/indexes/" name)]
-    {
-     :url request-url
-     :body (json/write-str {:Map (str
+    {:url request-url
+     :body (json/write-str {:Map (str
                                    "from " alias " in docs"
                                    " where " where
-                                   " select " select)})
-     }))
+                                   " select " select)})}))

 (defn load-replications
   "Generates a map that represents a http request
   to the replication endpoint in order to find replication endpoints."
   [url]
   (let [request-url (str url "/docs/Raven/Replication/Destinations")]
-    {
-     :url request-url
-     }))+    {:url request-url}))


Remove bloodhound ns reference

Remove bloodhound ns reference

--- src/cljs/decktouch/core.cljs
+++ src/cljs/decktouch/core.cljs
@@ -5,7 +5,6 @@
               [goog.events :as events]
               [goog.history.EventType :as EventType]
               [decktouch.card-data :as card-data]
-              [decktouch.bloodhound :as bloodhound]
               [decktouch.card-input :as card-input])
     (:import goog.History))


Display cofirmation message for idea creation

Closes #19

--- src/cljs/geoforms/forms.cljs
+++ src/cljs/geoforms/forms.cljs
@@ -12,7 +12,8 @@
     :added-ideas        nil
     :added-user         nil
     :completed?         false
-    :pending-ideas      []}))
+    :pending-ideas      []
+    :show-idea-confirm? false}))

 (def user-defaults
   {:person {:alert-ideas?     true
@@ -66,6 +67,12 @@

 (defn queue-idea! [idea]
   (swap! app-state update :pending-ideas #(conj % idea)))
+
+(defn confirm-idea-msg! [_]
+  (swap! app-state assoc :show-confirm-idea? true)
+  (js/setTimeout
+   #(swap! app-state assoc :show-confirm-idea? false)
+   5000))

 (defn submit-ideas! []
   (loop []
@@ -261,9 +268,9 @@
     (idea-template)
     idea-form
     #_ (fn [k v _] (prn k v _))]
-   [:button.btn.btn-default
+   [:button.btn.btn-primary
     {:on-click #(when (validate-idea! idea-form)
-                  (-> @idea-form normalize-idea queue-idea!))}
+                  (-> @idea-form normalize-idea queue-idea! confirm-idea-msg!))}
     (snippet :add-idea)]])

 (defn signature-component []
@@ -323,7 +330,16 @@
   [:div
    [:h3 (snippet :h-add)]
    [:div.well
-    [add-idea-component]]
+    [add-idea-component]
+    [:alert]
+    (when (:show-confirm-idea? @app-state)
+      [:div [:br]
+       [:div.row
+        [:div.col-md-1]
+        [:div.col-md-10
+         [:div.alert.alert-success
+          {:field :alert, :style {:margin-bottom 0}}
+          [:div (snippet :new-ideas-saved-once-signed)]]]]])]
    [:hr]])

 (defn step-4 []


end of game handled

end of game handled

--- src/cljs/tictactoe/core.cljs
+++ src/cljs/tictactoe/core.cljs
@@ -48,25 +48,32 @@
     :cell/cross :cell/circle
     :cell/circle :cell/cross))

-(defn find-winning-line
-  "Indicates whether the move is move that made the player win"
+(defn winning-line?
+  [board line]
+  (let [owners (utils/get-all board line)]
+    (and
+      (not-any? #{:cell/empty} owners)
+      (= 1 (count (set owners)))
+      )))
+
+(defn game-over?
   [board]
-  (first
-    (for [line lines
-          :let [players (into #{} (utils/get-all board line))]
-          :when (= 1 (count players))
-          :when (not-any? #{:cell/empty} players)]
-      line)))
+  (some #(winning-line? board %) lines))
+
+(defn valid-move?
+  [board x y]
+  (and
+    (not (game-over? board))
+    (= :cell/empty (get board [x y]))
+    ))

 (defn on-move
   "Convert the cell to current player, switch player, look at win conditions"
   [game-state x y]
-  (let [{:keys [board player] :as current} (peek game-state)
-        new-board (convert-cell board player x y)]
+  (let [current (peek game-state)]
     (conj game-state
       (-> current
-        (assoc :board new-board)
-        (assoc :winner (find-winning-line new-board))
+        (update :board convert-cell (:player current) x y)
         (update :player next-player)
         ))))

@@ -91,11 +98,9 @@

 (defn render-board-cell
   [board x y]
-  (let [cell-state (get board [x y])]
-    (cell/render-cell cell-state x y
-      (if (= :cell/empty cell-state)
-        {:on-click #(on-move-event x y)} {}))
-    ))
+  (cell/render-cell (get board [x y]) x y
+    (if (valid-move? board x y)
+      {:on-click #(on-move-event x y)} {})))

 (defn render-board
   [board]


Give the responsibility of constructing an audio-context to CLJS Bach, because it's needed to use the lib.

--- src/cljs_bach/synthesis.cljs
+++ src/cljs_bach/synthesis.cljs
@@ -1,4 +1,11 @@
 (ns cljs-bach.synthesis)
+
+(defn audio-context
+  "Construct an audio context in a way that works even if it's prefixed."
+  []
+  (if js/window.AudioContext. ; Some browsers e.g. Safari don't use the unprefixed version yet.
+    (js/window.AudioContext.)
+    (js/window.webkitAudioContext.)))

 ; Definitions


Actually use the helper we defined.

Actually use the helper we defined.

--- src/clojure/parkour/avro.clj
+++ src/clojure/parkour/avro.clj
@@ -26,7 +26,7 @@
 all tuples from the resulting `reduce`able."
   [f]
   (fn [context]
-    (let [output (mr/wrap-sink AvroKey AvroValue context)]
+    (let [output (wrap-sink context)]
       (->> context w/unwrap f (mr/sink output)))))

 (defn ^:private set-data-model


Ensure that params is redefined after applying level conditions.

--- src/cmr/opendap/ous/core.clj
+++ src/cmr/opendap/ous/core.clj
@@ -113,6 +113,12 @@
           (log/error "Some problematic urls:" (vec urls))
           (apply errors/collect urls))
         (map #(str % "." (:format params) query-string) urls)))))
+
+(defn apply-level-conditions
+  ""
+  [coll params]
+  (let [level (collection/extract-processing-level coll)]
+    params))

 (defn apply-bounding-conditions
   "There are several variable and bounding scenarios we need to consider:
@@ -212,6 +218,7 @@
         coll (collection/extract-metadata coll-promise)
         data-files (map granule/extract-datafile-link granules)
         service-ids (collection/extract-service-ids coll)
+        params (apply-level-conditions coll params)
         vars (apply-bounding-conditions search-endpoint user-token coll params)
         errs (errors/collect granules coll vars)]
     (when errs
@@ -224,7 +231,7 @@
     ;;     for their indices in OPeNDAP
     ;;
     ;; XXX This is being tracked in CMR-4982
-    [coll data-files service-ids vars errs]))
+    [coll params data-files service-ids vars errs]))

 (defn stage3
   [coll search-endpoint user-token bounding-box service-ids vars]
@@ -271,12 +278,12 @@
                                                      user-token
                                                      raw-params)
         ;; Stage 2
-        [coll data-files service-ids vars s2-errs] (stage2
-                                                    search-endpoint
-                                                    user-token
-                                                    params
-                                                    coll
-                                                    granules)
+        [coll params data-files service-ids vars s2-errs] (stage2
+                                                           search-endpoint
+                                                           user-token
+                                                           params
+                                                           coll
+                                                           granules)
         ;; Stage 3
         [services bounding-info s3-errs] (stage3
                                           coll


Made lattice-editor to have minimum size of 0

to allow arbitrary resizing.

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

--- src/conexp/graphics/draw.clj
+++ src/conexp/graphics/draw.clj
@@ -429,7 +429,8 @@
 	(.add canvas-panel BorderLayout/CENTER)
 	(.add (JScrollPane. buttons JScrollPane/VERTICAL_SCROLLBAR_ALWAYS
 			    JScrollPane/HORIZONTAL_SCROLLBAR_NEVER)
-	      BorderLayout/WEST))
+	      BorderLayout/WEST)
+	(.setMinimumSize (Dimension. 0 0)))

       main-panel))


Add newline, supposedly for readability

Add newline, supposedly for readability

--- src/foreclojure/problems.clj
+++ src/foreclojure/problems.clj
@@ -36,7 +36,8 @@
                         [:guid (str "http://4clojure.com/problem/" (:_id v))]
                         [:title (:title v)]
                         [:description (:description v)]]))
-          () (get-recent-problems n)))
+          ()
+          (get-recent-problems n)))

 (defn mark-completed [id code & [user]]
   (let [user (or user (session/session-get :user))


Update example code in samples/repl

Update example code in samples/repl

--- samples/repl/src/repl/test.cljs
+++ samples/repl/src/repl/test.cljs
@@ -7,8 +7,7 @@
 ;; You must not remove this notice, or any other, from this software.

 (ns repl.test
-  (:require [clojure.browser.repl :as repl]
-            [clojure.browser.dom  :as dom]))
+  (:require [clojure.browser.repl :as repl]))

 (repl/connect "http://localhost:9000/repl")

@@ -35,32 +34,28 @@

   ;; Evaluate some basic forms
   (+ 1 1)
-  ;; TODO: Chrome has a problem with keywords
   {:a :b}
   "hello"
   (reduce + [1 2 3 4 5])
   (js/alert "Hello World!")

-  ;; Can only load files that depend on what is already avaialble.
   (load-file "clojure/string.cljs")
   (clojure.string/reverse "Hello")

-  ;; TODO: This is not being done automatically as it is in rhino.
-  (ns cljs.user)
   (defn sum [coll] (reduce + coll))
   (sum [2 2 2 2])

   ;; Create dom elements.
-  ;; This require only works because we have already compiled
-  ;; 'clojure.browser.dom when the project was built.
   (ns dom.testing (:require [clojure.browser.dom :as dom]))
   (dom/append (dom/get-element "content")
               (dom/element "Hello World!"))

-  ;; TODO: This will not work unless you have already required what it
-  ;; depends on. You may think that just copying all of goog to 'out'
-  ;; will solve the problem but it may not in every case. What if this
-  ;; depends on another cljs file which has not been compiled?
-  (load-file "clojure/browser/dom.cljs")
+  ;; Load something we haven't used yet
+  (ns test.crypt
+    (:require [goog.crypt :as c]))
+  (c/stringToByteArray "ClojureScript")
+
+  (load-namespace 'goog.date.Date)
+  (goog.date.Date.)

   )


Decativate test-condition-test tests.

Decativate test-condition-test tests.

... as these are tests of the test-suite mechanism, and are meant fail.

This kept confusing even Mike.

--- test/active/clojure/test_condition_test.cljc
+++ test/active/clojure/test_condition_test.cljc
@@ -5,6 +5,11 @@
             #?(:clj [clojure.test :refer :all])
             #?(:cljs [cljs.test])
             [active.clojure.condition :as c]))
+
+;; deactivate the tests here, as they are intended to fail
+;; uncomment if you want to run them
+(defn test-ns-hook []
+  )

 (deftest is-test
   (is


Add support of snippets.lights_camera.camera tests.

--- test/cljx/snippets/lights_camera/camera.cljx
+++ test/cljx/snippets/lights_camera/camera.cljx
@@ -5,7 +5,6 @@
   #+cljs
   (:use-macros [quil.snippet :only [defsnippet]]))

-#+clj
 (defsnippet begin-camera-end-camera-camera {:renderer :p3d}
   (q/background 255)
   (q/begin-camera)
@@ -27,7 +26,6 @@
   (q/stroke 0 0 255) ; blue - Z axis
   (q/line 0 0 0 0 0 100))

-#+clj
 (defsnippet camera {:renderer :p3d}
   (q/background 255)
   (q/camera 200 200 200 0 0 0 0 0 -1)
@@ -43,7 +41,6 @@
   (q/stroke 0 0 255) ; blue - Z axis
   (q/line 0 0 0 0 0 100))

-#+clj
 (defsnippet frustum {:renderer :p3d}
   (q/background 255)
   (q/camera 200 200 200 0 0 0 0 0 -1)
@@ -60,7 +57,6 @@
   (q/stroke 0 0 255) ; blue - Z axis
   (q/line 0 0 0 0 0 100))

-#+clj
 (defsnippet ortho {:renderer :p2d}
   (let [ortho-params [[] [0 300 0 300] [0 300 0 300 0 170]]
         pos [[0 0] [250 0] [127 250]]]
@@ -74,7 +70,6 @@
           (q/box 100))
         (apply q/image gr (nth pos ind))))))

-#+clj
 (defsnippet perspective {:renderer :p2d}
   (let [perspective-params [[] [(/ q/PI 2) 0.5 50 300]]
         pos [[0 0] [250 0] [127 250]]]
@@ -88,10 +83,8 @@
           (q/box 100))
         (apply q/image gr (nth pos ind))))))

-#+clj
 (defsnippet print-camera {:renderer :p3d}
   (q/print-camera))

-#+clj
 (defsnippet print-projection {:renderer :p3d}
   (q/print-projection))


Fix one last test

Fix one last test

--- test/clojurewerkz/cassaforte/schema_test.clj
+++ test/clojurewerkz/cassaforte/schema_test.clj
@@ -75,7 +75,7 @@
   (changes-from-to
    #(alter-table :peopletmp
                  (rename-column :naome :name))
-   #(:key_aliases (describe-table "new_cql_keyspace" "people"))
+   #(:key_aliases (describe-table "new_cql_keyspace" "peopletmp"))
    "[\"naome\"]"
    "[\"name\"]"))


CMR-1391: Consolidated method definitions using doseq

--- search-app/src/cmr/search/results_handlers/metadata_results_handler.clj
+++ search-app/src/cmr/search/results_handlers/metadata_results_handler.clj
@@ -16,45 +16,17 @@
             [cmr.common.util :as u]
             [cmr.common.log :refer (debug info warn error)]))

-(defmethod elastic-search-index/concept-type+result-format->fields [:granule :echo10]
-  [concept-type query]
-  [])
+(def result-formats
+  "Supported search result formats by concept-types"
+  {:granule [:echo10 :iso19115 :iso-smap :native]
+   :collection [:echo10 :dif :dif10 :iso19115 :iso-smap :native]})

-(defmethod elastic-search-index/concept-type+result-format->fields [:collection :echo10]
-  [concept-type query]
-  [])
-
-(defmethod elastic-search-index/concept-type+result-format->fields [:collection :dif]
-  [concept-type query]
-  [])
-
-(defmethod elastic-search-index/concept-type+result-format->fields [:collection :dif10]
-  [concept-type query]
-  [])
-
-(defmethod elastic-search-index/concept-type+result-format->fields [:collection :iso19115]
-  [concept-type query]
-  [])
-
-(defmethod elastic-search-index/concept-type+result-format->fields [:granule :iso19115]
-  [concept-type result-format]
-  [])
-
-(defmethod elastic-search-index/concept-type+result-format->fields [:collection :iso-smap]
-  [concept-type result-format]
-  [])
-
-(defmethod elastic-search-index/concept-type+result-format->fields [:granule :iso-smap]
-  [concept-type result-format]
-  [])
-
-(defmethod elastic-search-index/concept-type+result-format->fields [:collection :native]
-  [concept-type result-format]
-  [])
-
-(defmethod elastic-search-index/concept-type+result-format->fields [:granule :native]
-  [concept-type result-format]
-  [])
+;; define functions to return fields for each concept type
+(doseq [concept-type [:collection :granule]
+        format (concept-type result-formats)]
+  (defmethod elastic-search-index/concept-type+result-format->fields [concept-type format]
+    [concept-type result-format]
+    []))

 (def concept-type->name-key
   "A map of the concept type to the key to use to extract the reference name field."
@@ -72,47 +44,14 @@
     (debug "Transformer metadata request time was" req-time "ms.")
     (results/map->Results {:hits hits :items items :result-format (:result-format query)})))

-(defmethod elastic-results/elastic-results->query-results :echo10
-  [context query elastic-results]
-  (elastic-results->query-metadata-results context query elastic-results))

-(defmethod elastic-results/elastic-results->query-results :dif
-  [context query elastic-results]
-  (elastic-results->query-metadata-results context query elastic-results))
-
-(defmethod elastic-results/elastic-results->query-results :dif10
-  [context query elastic-results]
-  (elastic-results->query-metadata-results context query elastic-results))
-
-(defmethod elastic-results/elastic-results->query-results :iso19115
-  [context query elastic-results]
-  (elastic-results->query-metadata-results context query elastic-results))
-
-(defmethod elastic-results/elastic-results->query-results :iso-smap
-  [context query elastic-results]
-  (elastic-results->query-metadata-results context query elastic-results))
-
-(defmethod elastic-results/elastic-results->query-results :native
-  [context query elastic-results]
-  (elastic-results->query-metadata-results context query elastic-results))
-
-(defmethod gcrf/query-results->concept-ids :echo10
-  [results]
-  (->> results
-       :items
-       (map :concept-id)))
-
-(defmethod gcrf/query-results->concept-ids :dif
-  [results]
-  (->> results
-       :items
-       (map :concept-id)))
-
-(defmethod gcrf/query-results->concept-ids :dif10
-  [results]
-  (->> results
-       :items
-       (map :concept-id)))
+;; Define transormations methods from query results to concept-ids
+(doseq [format [:echo10 :dif :dif10]]
+  (defmethod gcrf/query-results->concept-ids format
+    [results]
+    (->> results
+        :items
+        (map :concept-id))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Search results handling
@@ -202,26 +141,14 @@
       (cx/pretty-print-xml response)
       response)))

-(defmethod qs/search-results->response :echo10
-  [context query results]
-  (search-results->metadata-response context query results))

-(defmethod qs/search-results->response :dif
-  [context query results]
-  (search-results->metadata-response context query results))
+(doseq [format (:collection result-formats)]
+  ;; define transformations from elastic results to query results for each format
+  (defmethod elastic-results/elastic-results->query-results format
+    [context query elastic-results]
+    (elastic-results->query-metadata-results context query elastic-results))

-(defmethod qs/search-results->response :dif10
-  [context query results]
-  (search-results->metadata-response context query results))
-
-(defmethod qs/search-results->response :iso19115
-  [context query results]
-  (search-results->metadata-response context query results))
-
-(defmethod qs/search-results->response :iso-smap
-  [context query results]
-  (search-results->metadata-response context query results))
-
-(defmethod qs/search-results->response :native
-  [context query results]
-  (search-results->metadata-response context query results))
+  ;; define tranformations from search results to response for each format
+  (defmethod qs/search-results->response format
+    [context query results]
+    (search-results->metadata-response context query results)))


[cover] adding more test cases for user input

--- cover-page/test/cljs/cover_page/components/contact_form_test.cljs
+++ cover-page/test/cljs/cover_page/components/contact_form_test.cljs
@@ -4,11 +4,18 @@
             [cljs.test :refer-macros [deftest testing is]]))

 (deftest send-message-test
-  (let [fake-label #(% {:email-form-error-empty-message "no message"
-                        :email-form-error-empty-address "no email"
+  (let [message-found #(boolean (some #{%1} %2))
+        fake-label #(% {:email-form-error-empty-address "no email"
+                        :email-form-error-empty-message "no message"
                         :email-form-error-wrong-address "wrong email format"})]
     (testing "Input Validator"
       (binding [label fake-label]
-        (is (= ["no message"] (f/validate-input "user@email.com" nil)))
-        (is (= ["no message"] (f/validate-input "user@email.com" "")))
-        (is (= nil            (f/validate-input "user@email.com" "a message")))))))
+        (is (message-found "no message"         (f/validate-input "user@email.com" "")))
+        (is (message-found "no message"         (f/validate-input "user@email.com" nil)))
+        (is (message-found "no email"           (f/validate-input ""               "a message")))
+        (is (message-found "no email"           (f/validate-input nil              "a message")))
+        (is (message-found "wrong email format" (f/validate-input "user"           "a message")))
+        (is (message-found "wrong email format" (f/validate-input "user@email"     "a message")))
+        (is (message-found "wrong email format" (f/validate-input "@email.com"     "a message")))
+        (is (message-found "wrong email format" (f/validate-input "useremail.com"  "a message")))
+        (is (empty?                             (f/validate-input "user@email.com" "a message")))))))


Made bindings in read-wiki general

Made bindings in read-wiki general

i.e. set them to nil.

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

--- stuff/code/read-wiki.clj
+++ stuff/code/read-wiki.clj
@@ -92,10 +92,10 @@

 ;;;

-(defvar *wikipedia-properties* "/users/lat/borch/wikiprops.nt"
+(defvar ^{:dynamic true} *wikipedia-properties* nil
   "File containing the properties as defined by dbpedia")

-(defvar *wikipedia-instances* "/users/lat/borch/wikiinstances.nt"
+(defvar ^{:dynamic true} *wikipedia-instances* nil
   "File containing the instances as defined by dbpedia")

 (defn- read-wiki [roles]


Version 0.0.9

Version 0.0.9

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject day8.re-frame/async-flow-fx "0.0.9-SNAPSHOT"
+(defproject day8.re-frame/async-flow-fx "0.0.9"
   :description  "A re-frame effects handler for coordinating the kind of async control flow which often happens on app startup."
   :url          "https://github.com/Day8/re-frame-async-flow-fx.git"
   :license      {:name "MIT"}


Fix dependencies

Fix dependencies

--- project.clj
+++ project.clj
@@ -23,7 +23,7 @@
                            [alandipert/storage-atom "1.2.3"]
                            [secretary "1.2.1"]
                            [sablono "0.2.22"]
-                           [prismatic/om-tools "0.3.3"]
+                           [prismatic/om-tools "0.3.3" :exclusions [org.clojure/clojure]]
                            [com.cognitect/transit-clj "0.8.259"]
                            [com.cognitect/transit-cljs "0.8.188"]
                            [ring-transit "0.1.2"]


Next development iteration

Next development iteration

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject lein-droid/lein-droid "0.2.0-preview1"
+(defproject lein-droid/lein-droid "0.2.0-SNAPSHOT"
   :description "Plugin for easy Clojure/Android development and deployment"
   :url "https://github.com/clojure-android/lein-droid"
   :license {:name "Eclipse Public License"


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

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject prismatic/fnhouse "0.2.1"
+(defproject prismatic/fnhouse "0.2.2-SNAPSHOT"
   :description "Transform lightly-annotated functions into a full-fledged web service"
   :license {:name "Eclipse Public License - v 1.0"
             :url "http://www.eclipse.org/legal/epl-v10.html"


Bump deps

Bump deps

--- project.clj
+++ project.clj
@@ -4,8 +4,8 @@
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.7.0-alpha4"]
-                 [org.clojure-grimoire/lib-grimoire "0.8.0-SNAPSHOT"]
-                 [me.arrdem/detritus "0.2.2-SNAPSHOT"]
+                 [org.clojure-grimoire/lib-grimoire "0.8.1"]
+                 [me.arrdem/detritus "0.2.2"]
                  [org.clojure/tools.namespace "0.2.7"]]
   :aliases {"grim" ["run" "-m" "grimoire.doc"
                     ,,:project/groupid


Update Clojure and Leipzig.

Update Clojure and Leipzig.

--- project.clj
+++ project.clj
@@ -1,7 +1,7 @@
 (defproject kolmogorov-music "0.1.0-SNAPSHOT"
-  :dependencies [[org.clojure/clojure "1.5.1"]
+  :dependencies [[org.clojure/clojure "1.7.0"]
                  [overtone "0.9.1"]
-                 [leipzig "0.9.0"]]
+                 [leipzig "0.10.0"]]
   :profiles {:dev
              {:plugins [[lein-midje "3.1.3"]]
               :dependencies [[midje "1.6.3"]]}})


Version 0.1.1

Version 0.1.1

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject twigs "0.1.1-SNAPSHOT"
+(defproject twigs "0.1.1"
   :description "A nicer way to use firebase in Clojure[Script]"
   :url "https://github.com/mrmcc3/twigs"
   :license {:name "MIT"}


Use server JVM as some platforms don't have client support

Resolves #68

--- project.clj
+++ project.clj
@@ -16,6 +16,7 @@
   :source-paths ["src/clj"]
   :java-source-paths ["src/java"]
   :javac-options ["-Xlint:unchecked"]
+  :jvm-opts ["-server"]
   :dependencies [[clj-time "0.11.0"]
                  [circleci/clj-yaml "0.5.4"]
                  [com.draines/postal "1.11.3"


Version 0.3.3

Version 0.3.3

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject info.sunng/papaline "0.3.3-SNAPSHOT"
+(defproject info.sunng/papaline "0.3.3"
   :description "Clojure concurrent pipeline on core.async"
   :url "http://github.com/sunng87/papaline"
   :license {:name "Eclipse Public License"