whoops. unbalanced parentheses.

whoops. unbalanced parentheses.

--- scraper/src/scraper/core.clj
+++ scraper/src/scraper/core.clj
@@ -35,7 +35,7 @@

 (defn get-content [html-tree x]
       (let [[tag-element attributes-element content-element & rest-of-content] html-tree]
-        (cons content-element rest-of-content))
+        (cons content-element rest-of-content)))

 (defn get-attribute [html-tree x]
       (let [[tag-element attributes-element content-element] html-tree]


Added support for OpenShift. Needs testing.

--- src/notes/paas.clj
+++ src/notes/paas.clj
@@ -3,24 +3,41 @@
    [clojure.java.io :as io]
    [clojure.data.json :as json]))

+(defn db-name "/notes")
+
 (defn localhost-uri [uid pwd]
-   (str "mongodb://" uid ":" pwd "@localhost:27017/notes"))
+  (str "mongodb://" uid ":" pwd "@localhost:27017" db-name))
+
+;-- dotCloud

 (defn is-dotcloud? []
   (-> (io/file "/home/dotcloud/environment.json") .exists))

 (defn dotcloud-uri [uid pwd]
+  "Get dotCloud MongoDB URI. User 'uid' with password 'pwd' must exist
+  for database 'notes'"
   (let [env-file "/home/dotcloud/environment.json"
         env (with-open [f (io/reader env-file)] (json/read f))
         mongo-host (get env "DOTCLOUD_MONGO_MONGODB_HOST")
         mongo-port (get env "DOTCLOUD_MONGO_MONGODB_PORT")]
-    (str "mongodb://" uid ":" pwd "@" mongo-host ":" mongo-port "/notes")))
+    (str "mongodb://" uid ":" pwd "@" mongo-host ":" mongo-port db-name)))
+
+;-- OpenShift

 (defn is-open-shift? []
   (System/getenv "OPENSHIFT_APP_UUID"))

+(defn open-shift-uri [uid pwd]
+  "Get OpenShift MongoDB URI. 'uid' and 'pwd' are ignored, instead uses
+  OpenShift provided admin credentials for zero conf deployment."
+  (str (System/getenv "OPENSHIFT_MONGODB_DB_URL") db-name))
+
 (defn mongo-connection-uri [uid pwd]
-  (cond :else (localhost-uri uid pwd)))
+  "Try to figure out runtime environment and resolve associated MongoDB
+  connection URI. Defaults to localhost and standard port"
+  (cond (is-dotcloud?) (dotcloud-uri uid pwd)
+        (is-open-shift?) (open-shift-uri uid pwd)
+        :else (localhost-uri uid pwd)))

 ;;Roadmap:
 ;localhost


Remove session key from Spec. It may not be a keyword.

--- src/onyx/spec.cljc
+++ src/onyx/spec.cljc
@@ -204,8 +204,6 @@
 (s/def :window/id keyword?)

 (s/def :window/task keyword?)
-
-(s/def :window/session-key keyword?)

 (s/def :window/init any?)


group-k always at least 3

group-k always at least 3

--- src/polismath/conversation.clj
+++ src/polismath/conversation.clj
@@ -14,8 +14,6 @@
 (defn choose-group-k [base-clusters]
   (let [len (count base-clusters)]
                   (cond
-                   (< len 3) 1
-                   (< len 5) 2
                    (< len 99) 3
                    :else 4
                   )))


Use when rather than if

Use when rather than if

In this situation, only a keyword should be split on '>'; the other possibilities (string, symbol, native element) are not subject
to splitting into nested tags.

--- src/reagent/impl/template.cljs
+++ src/reagent/impl/template.cljs
@@ -261,7 +261,7 @@
                (assert (valid-tag? tag)
                        (str "Invalid Hiccup form: "
                             (pr-str v) (comp/comp-name)))
-               (if (keyword? tag)
+               (when (keyword? tag)
                  (-> tag
                      name
                      (string/split #">")


added channels and handlers for preview

added channels and handlers for preview

--- src/reagent_search/search.cljs
+++ src/reagent_search/search.cljs
@@ -8,20 +8,24 @@
             [reagent-search.solr :as solr]
             [reagent-search.wiki :as wiki]))

+(enable-console-print!)
+
 ;;; preview panel
 (defn- handle-preview-item
   "gets summary preview for selected item from wiki"
   [chan-preview ref-title ref-content]
-  )
+  (go-loop
+   []
+   (let [term (<! chan-preview)]
+     (reset! ref-title term))
+   (recur)))

 ;; pass in publish que
 (defn- preview-component
   "renders preview panel"
-  [pub-q chan-log]
+  [chan-preview chan-log]
   (let [title (atom "my title here") #_(atom nil)
-        content (atom "my content here") #_(atom nil)
-        chan-preview (chan 1)
-        #_(sub pub-q 1 chan-preview)]
+        content (atom "my content here") #_(atom nil)]
     (handle-preview-item chan-preview title content)
     (fn []
       (if-not (nil? @title)
@@ -33,8 +37,8 @@
 ;;; autocomplete panel
 (defn- autocomplete-item
   "renders a single autocomplete item in list"
-  [chan-selecteditems chan-focus item focus-item]
-  [:li
+  [chan-selecteditems chan-current-suggestion item focus-item]
+  [:li {:on-focus #(put! chan-current-suggestion item)}
    [:a {
         :href ""
         :on-click #(put! chan-selecteditems item)}
@@ -45,7 +49,7 @@
   1. logging selected item
   2. resetting the text input value
   3. removing the autocomplete panel
-  4. logs the selected component"
+  4. opens the wiki page for selected item in a new tab "
   [chan-selecteditems ref-items ref-textvalue chan-log]
   (go-loop
    []
@@ -78,7 +82,7 @@
   "renders the autocomplete component given a list of items to display
   and a selected item channel
   the number of items rendered is limited to size items"
-  [size itemsref textvalue chan-selecteditems chan-focus chan-log]
+  [size itemsref textvalue chan-selecteditems chan-focus chan-current-suggestion chan-log]
   (let [ref-focus-item (atom -1)]
     (handle-autocompleteitemselected chan-selecteditems itemsref textvalue chan-log)
     (handle-autocomplete-focus chan-focus itemsref ref-focus-item)
@@ -90,7 +94,7 @@
            [:ul.dropdown-menu
             {:role "menu"}
             (for [item (take size @itemsref)]
-              ^{:key (utils/uuid)} [autocomplete-item chan-selecteditems chan-focus item ref-focus-item])]])
+              ^{:key (utils/uuid)} [autocomplete-item chan-selecteditems chan-current-suggestion item ref-focus-item])]])
         [:div.close]))))

 ;;; search input box and component
@@ -153,7 +157,8 @@
 (defn search-component
   "renders the search input box"
   [props]
-  (let [chan-query (chan) ;; sampled text term that is used for ajax wiki API calls
+  (let [chan-current-suggestion (chan 1)
+        chan-query (chan) ;; sampled text term that is used for ajax wiki API calls
         chan-textvalue (chan) ;; channel to hold text value from input box
         chan-keys (chan) ;; channel to store individual keys to respond to keys like return and tab
         chan-sampler (chan (sliding-buffer 1)) ;; channel used to hold current value of text; since this buffer is of size 1, only the most recent value is stored in this channel
@@ -176,9 +181,9 @@
           :on-change #(put! chan-textvalue (-> % .-target .-value))
           :on-key-up #(put! chan-keys (-> % .-which))}]
         [:span.input-group-addon.glyphicon.glyphicon-search]
-        [autocomplete-component (:autocomplete-size props) autocomplete-items textvalue chan-selecteditems chan-focus chan-log]]
+        [autocomplete-component (:autocomplete-size props) autocomplete-items textvalue chan-selecteditems chan-focus chan-current-suggestion chan-log]]
        [:div.top-space200
-        [preview-component nil chan-log]]])))
+        [preview-component chan-current-suggestion chan-log]]])))

 ;; how to model behavior of search results?
 ;; typeahead component sends search query message to search-query channel


Update email address

Update email address

--- src/sinusoides/views/main.cljs
+++ src/sinusoides/views/main.cljs
@@ -1,4 +1,4 @@
-;; Copyright (c) 2011-2016 Juan Pedro Bolivar Puente <raskolnikov@gnu.org>
+;; Copyright (c) 2011-2017 Juan Pedro Bolivar Puente <raskolnikov@gnu.org>
 ;;
 ;; This file is part of Sinusoid.es.
 ;;
@@ -85,7 +85,7 @@

      [:div.fingerprint.links
       [:a {:href (str "mailto:"
-                      (s/reverse "gro.ung@vokinloksar"))}
+                      (s/reverse "se.diosunis@epnauj"))}
        "CE3E CB30 6F40 3D98 DB2E" [:br]
        "B65C 529B A962 690A 70B1"]]]


Add react key metadata to messages list

Add react key metadata to messages list

--- src/status_im/chat/screen.cljs
+++ src/status_im/chat/screen.cljs
@@ -77,9 +77,10 @@
   (letsubs [messages           [:get-current-chat-messages]
             current-public-key [:get-current-public-key]]
     [list/flat-list {:data                      messages
-                     :render-fn                 #(message-row {:group-chat         group-chat
-                                                               :current-public-key current-public-key
-                                                               :row                %1})
+                     :render-fn                 (fn [{:keys [message-id] :as message}]
+                                                  ^{:key message-id} [message-row {:group-chat         group-chat
+                                                                                :current-public-key current-public-key
+                                                                                :row                message}])
                      :inverted                  true
                      :onEndReached              #(re-frame/dispatch [:load-more-messages])
                      :enableEmptySections       true


fixes #8877

fixes #8877

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

--- src/status_im/wallet/core.cljs
+++ src/status_im/wallet/core.cljs
@@ -155,13 +155,11 @@
         (reduce (fn [acc [address balances]]
                   (let [pos-balances
                         (reduce (fn [acc [token-address token-balance]]
-                                  (if (pos? token-balance)
-                                    (let [token-symbol (get tokens (name token-address))]
-                                      (if (or (empty? assets)
-                                              (assets token-symbol))
-                                        (assoc acc token-symbol token-balance)
-                                        acc))
-                                    acc))
+                                  (let [token-symbol (get tokens (name token-address))]
+                                    (if (or (and (empty? assets) (pos? token-balance))
+                                            (and (seq assets) (assets token-symbol)))
+                                      (assoc acc token-symbol token-balance)
+                                      acc)))
                                 {}
                                 balances)]
                     (if (not-empty pos-balances)


modified gradient-forward-polar, gradient-aft-polar, and theta switch functions to pass testing

--- src/hydrofoil/model.clj
+++ src/hydrofoil/model.clj
@@ -95,7 +95,7 @@
   (let [position-camber (individual :corrected-position-camber)
         max-camber (individual :corrected-max-camber)]
     (* (/ max-camber (Math/pow position-camber 2))
-       (+ (* (-1) 1) (* 2 position-camber) (* 1 (Math/cos theta-not))))))
+       (+ -1 (* 2 position-camber) (* 1 (Math/cos theta-not))))))

 (defn gradient-aft-polar-function
   "takes a theta-not and gives a y coordinate. This is used in the coefficient-of-lift calculations.
@@ -104,13 +104,13 @@
   (let [position-camber (individual :corrected-position-camber)
         max-camber (individual :corrected-max-camber)]
     (* (/ max-camber (Math/pow (- position-camber 1) 2))
-       (+ (* (-1) 1) (* 2 position-camber) (* 1 (Math/cos theta-not))))))
+       (+ (* -1 1) (* 2 position-camber) (* 1 (Math/cos theta-not))))))

 (defn theta-switch
   "The angle at which the coefficient-of-lift calculation will switch from one integration to another
   arccos(1 - 2P)"
   [individual]
-  (let [position-camber :corrected-position-camber]
+  (let [position-camber (individual :corrected-position-camber)]
     (Math/acos (- 1 (* 2 position-camber)))))


all ITimeShift fns for LocalDate and YearMonth

--- src/tick/core.cljc
+++ src/tick/core.cljc
@@ -775,6 +775,8 @@
   LocalDate
   (forward-number [t n] (.plusDays t n))
   (backward-number [t n] (.minusDays t n))
+  (forward-duration [t d] (.plus t d))
+  (backward-duration [t d] (.minus t d))
   LocalTime
   (forward-duration [t d] (.plus t d))
   (backward-duration [t d] (.plus t d))
@@ -793,6 +795,8 @@
   YearMonth
   (forward-number [t n] (.plusMonths t n))
   (backward-number [t n] (.plusMonths t n))
+  (forward-duration [t d] (.plus t d))
+  (backward-duration [t d] (.minus t d))
   Clock
   (forward-duration [clk d] (. Clock offset clk d))
   (backward-duration [clk d] (. Clock offset clk (negated d))))


add another precondition

add another precondition

--- src/kmp_search/core.clj
+++ src/kmp_search/core.clj
@@ -42,7 +42,9 @@
   ([matcher bytes]
      (search-bytes matcher bytes (alength bytes)))
   ([matcher ^bytes bytes ^long limit]
-     {:pre [(isa? byte-array-class (class bytes))]}
+     {:pre [(every? #(contains? matcher %) [:pattern :length :border :state])
+            (isa? byte-array-class (class bytes))
+            (<= limit (alength bytes))]}
      (let [{:keys [^bytes pattern ^long length ^longs border state]} matcher
            [offset i j] state
            [i j] (loop [^long i i ^long j j]


Make lein test! able to handle nses

Make lein test! able to handle nses

--- src/leiningen/test!.clj
+++ src/leiningen/test!.clj
@@ -7,5 +7,5 @@

 (defn test!
   "Run a project's tests after cleaning and fetching dependencies."
-  [project]
-  (test (doto project clean deps)))
+  [project & nses]
+  (apply test (doto project clean deps) nses))


CMR-7048 removed email from oracle search query

--- metadata-db-app/src/cmr/metadata_db/data/oracle/search.clj
+++ metadata-db-app/src/cmr/metadata_db/data/oracle/search.clj
@@ -35,7 +35,7 @@
    :humanizer (into common-columns [:user_id])
    :subscription (into common-columns
                        [:provider_id :subscription_name :subscriber_id
-                        :email_address :collection_concept_id :user_id
+                        :collection_concept_id :user_id
                         :normalized_query])
    :variable (into common-columns [:provider_id :variable_name :measurement :user_id :fingerprint])
    :variable-association (into common-columns


minor cleanup

minor cleanup

--- cljs/src/main/plastic/cogs/editor/render/core.cljs
+++ cljs/src/main/plastic/cogs/editor/render/core.cljs
@@ -4,8 +4,6 @@
                    [reagent.ratom :refer [reaction]])
   (:require [reagent.core :as reagent]
             [plastic.frame.core :refer [register-sub subscribe]]
-            [plastic.util.dom-shim]
-            [plastic.onion.api :refer [$]]
             [plastic.cogs.editor.render.headers :refer [headers-wrapper-component]]
             [plastic.cogs.editor.render.docs :refer [docs-component]]
             [plastic.cogs.editor.render.code :refer [code-box-component]]
@@ -13,8 +11,7 @@
             [plastic.cogs.editor.render.selections :refer [form-selections-overlay-component]]
             [plastic.cogs.editor.render.debug :refer [parser-debug-component text-input-debug-component text-output-debug-component render-tree-debug-component selections-debug-overlay-component]]
             [plastic.cogs.editor.render.utils :refer [dangerously-set-html classv]]
-            [plastic.cogs.editor.render.dom :as dom]
-            [plastic.util.helpers :as helpers]))
+            [plastic.cogs.editor.render.dom :as dom]))

 (declare unified-rendering-component)

@@ -22,7 +19,7 @@
   (let [sanitized-node-id (or node-id -1)
         selection-subscription (subscribe [:editor-selection-node editor-id sanitized-node-id])]
     (fn [render-tree]
-      (log "R! render-tree-component" sanitized-node-id)
+      (log "R! render-tree" sanitized-node-id)
       (let [{:keys [id tag children selectable?]} render-tree]
         [:div {:data-qnid id
                :class     (classv
@@ -36,7 +33,7 @@
 (defn unified-rendering-component []
   (fn [editor-id form-id render-tree]
     (let [{:keys [id tag]} render-tree]
-      (log "R! unified-rendering-component" id)
+      (log "R! unified-rendering" id)
       [:div.unified {:data-qnid id}
        (condp = tag
          :tree [(render-tree-component editor-id form-id id) render-tree]
@@ -47,7 +44,7 @@

 (defn form-skelet-component []
   (fn [editor-id form-id render-tree]
-    (log "R! form-skelet-component" form-id)
+    (log "R! form-skelet" form-id)
     [:div.form-skelet
      [unified-rendering-component editor-id form-id render-tree]]))

@@ -74,8 +71,7 @@
          [:td
           [:div.form.noselect
            {:data-qnid id
-            :class     (classv
-                         (if focused? "focused"))
+            :class     (if focused? "focused")
             :on-click  (partial handle-form-click form)}
            [form-skelet-component editor-id form-id render-tree]]
           (if @render-tree-debug-visible


Fix dispatch function with two arguments

--- cimi/src/com/sixsq/slipstream/ssclj/resources/connector.clj
+++ cimi/src/com/sixsq/slipstream/ssclj/resources/connector.clj
@@ -158,7 +158,7 @@
         sr/json-response)))

 (defmulti set-subtype-ops
-          :cloudServiceType)
+          (fn [resource _] (:cloudServiceType resource)))

 (defmethod set-subtype-ops :default
   [resource request]


more robust video setup

more robust video setup

--- src/cellf/core.cljs
+++ src/cellf/core.cljs
@@ -320,14 +320,21 @@
    (media/get-media)
    (fn [{:keys [status data]}]
      (if (= status :success)
-       (let [video  (.createElement js/document "video")
-             canvas (.createElement js/document "canvas")
-             e-key  "oncanplaythrough"]
+       (let [video       (.createElement js/document "video")
+             canvas      (.createElement js/document "canvas")
+             e-key       "oncanplay"]
          (doto canvas
            (aset "width"  capture-size)
            (aset "height" capture-size))
          (doto video
-           (aset "autoplay" "autoplay")
+           (.setAttribute "autoplay" "")
+           (.setAttribute "playsinline" "")
+           (.setAttribute "muted" "")
+           (aset "style" "position" "absolute")
+           (aset "style" "top" "0")
+           (aset "style" "left" "0")
+           (aset "style" "pointerEvents" "none")
+           (aset "style" "opacity" "0")
            (aset
             e-key
             (fn []
@@ -354,7 +361,8 @@
                   :media-error nil})
                 (js/setTimeout start! 100)
                 (.setItem js/localStorage ls-key "1"))))
-           (aset "srcObject" data)))
+           (aset "srcObject" data))
+         (.appendChild (.-body js/document) video))
        (do
          (swap! app-state assoc :media-error data :previous-grant? false)
          (.clear js/localStorage))))))


fixed mastersign.geometry/area

fixed mastersign.geometry/area

--- src/mastersign/geom.clj
+++ src/mastersign/geom.clj
@@ -25,11 +25,13 @@
          (+ (.y r) (/ (.height r) 2.0))))

 (defn area
-  [& shapes]
-  (let [a (Area.)]
+  ([] (Area.))
+  ([s] (Area. s))
+  ([s & shapes]
+  (let [a (Area. s)]
     (doseq [s shapes]
-      (.add a s))
-    a))
+      (.add a (Area. s))
+    a))))

 (defn translate-point
   [p x y]


commenting

commenting

--- dada-core/src/test/clojure/org/dada/core/test_JoinModel.clj
+++ dada-core/src/test/clojure/org/dada/core/test_JoinModel.clj
@@ -240,12 +240,16 @@
 				       :jules (RHSEntry. jules-0 [#{0} #{}])}]
 				     nil [(Update. old-datum new-datum)] nil])))

+  ;; getData
   ;; TODO: should be able to compare two Data instances...
   (let [data (.getData join-model)]
     (is (= (.getExtant data) [[0 4 txn-1 jane-0 jules-0 usd-0]]))
     (is (= (.getExtinct data) [])))

+  ;; find
   (is (= (.find join-model 0) [0 4 txn-1 jane-0 jules-0 usd-0]))
   (is (= (.find join-model 1) nil))

+  ;; deletion
+
   )


Use the same default as Ruby example

Use the same default as Ruby example

--- clojure/src/rabbitmq/tutorials/emit_log_direct.clj
+++ clojure/src/rabbitmq/tutorials/emit_log_direct.clj
@@ -11,9 +11,10 @@
   [severity & args]
   (with-open [conn (lc/connect)]
     (let [ch      (lch/open conn)
-          payload (if (empty? args)
-                    "Hello, world!"
-                    (s/join " " args))]
+          severity (or severity "info")
+          payload  (if (empty? args)
+                     "Hello, world!"
+                     (s/join " " args))]
       (le/direct ch x :durable false :auto-delete false)
       (lb/publish ch x severity payload)
       (println (format " [x] Sent %s" payload)))))


simplify

simplify

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@9479 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- plugins/SlideExplorer2/src/slide_explorer/view.clj
+++ plugins/SlideExplorer2/src/slide_explorer/view.clj
@@ -358,13 +358,9 @@
     (def pnl panel)
     (.add (.getContentPane frame) panel)
     (setup-fullscreen frame)
-    (handle-drags panel screen-state)
-    (handle-arrow-pan panel screen-state)
-    (handle-wheel panel screen-state)
-    (handle-resize panel screen-state)
-    (handle-zoom frame screen-state)
-    (handle-dive frame screen-state)
-    (watch-keys frame screen-state)
+    ((juxt handle-drags handle-arrow-pan handle-wheel handle-resize)
+      panel screen-state)
+    ((juxt handle-zoom handle-dive watch-keys) frame screen-state)
     (repaint-on-change panel screen-state)
     (repaint-on-change panel available-tiles)
     (handle-pointing panel mouse-position)


Remove delay on bad logins. See issue #417.

--- src/clojars/web.clj
+++ src/clojars/web.clj
@@ -93,28 +93,14 @@
                [:h1 "Page not found"]
                [:p "Thundering typhoons!  I think we lost it.  Sorry!"]]))))))

-(defn bad-attempt [attempts user]
-  (let [failures (or (attempts user) 0)]
-    (Thread/sleep (* failures failures)))
-  (update-in attempts [user] (fnil inc 0)))
-
 (defn user-credentials [db username]
   (when-let [user (db/find-user db username)]
     (when-not (empty? (:password user))
       (rename-keys user {:user :username}))))

 (defn credential-fn [db]
-  (let [attempts (atom {})]
     (fn [{:keys [username] :as auth-map}]
-      (if-let [auth-result (creds/bcrypt-credential-fn
-                             (partial user-credentials db)
-                             auth-map)]
-        (do
-          (swap! attempts dissoc username)
-          auth-result)
-        (do
-          (swap! attempts bad-attempt username)
-          nil)))))
+      (creds/bcrypt-credential-fn (partial user-credentials db) auth-map)))

 (defn clojars-app [storage db reporter stats search mailer]
   (routes


Seems to have good chunk function that does not eat memory for large inputs... (?)

--- src/clj_simple_chart/ssb/data/sal_av_petroleumsprodukt_11174.clj
+++ src/clj_simple_chart/ssb/data/sal_av_petroleumsprodukt_11174.clj
@@ -60,6 +60,27 @@
               (when (= (count indexes) n)
                 items)))))

+(defn- cc-inner
+  [rows accum n]
+  {:pre [(vector? accum)]}
+  (cond (empty? rows) (if (= n (count accum)) [accum] [])
+        (= n (count accum)) (lazy-seq (cons accum
+                                            (cc-inner (rest rows)
+                                                      (conj (vec (drop 1 accum)) (first rows))
+                                                      n)))
+        :else (recur (rest rows)
+                     (conj accum (first rows))
+                     n)))
+
+(defn cc [rows n]
+  {:pre [(pos-int? n)
+         (not (map? rows))]}
+  (cc-inner rows [] n))
+
+(test/is (= '([:a] [:b] [:c] [:d] [:e]) (cc [:a :b :c :d :e] 1)))
+(test/is (= '([:a :b] [:b :c] [:c :d] [:d :e]) (cc [:a :b :c :d :e] 2)))
+(test/is (= '([:a :b :c] [:b :c :d] [:c :d :e]) (cc [:a :b :c :d :e] 3)))
+
 (test/is (= '((:a) (:b) (:c) (:d) (:e)) (chunks [:a :b :c :d :e] 1)))
 (test/is (= '((:a :b) (:b :c) (:c :d) (:d :e)) (chunks [:a :b :c :d :e] 2)))
 (test/is (= '((:a :b :c) (:b :c :d) (:c :d :e)) (chunks [:a :b :c :d :e] 3)))


RS | #0 | Remove wrap-ssl WIP

RS | #0 | Remove wrap-ssl WIP

--- src/objective8/core.clj
+++ src/objective8/core.clj
@@ -100,11 +100,7 @@
       wrap-flash
       (wrap-session {:cookie-attrs {:http-only true}})
       (wrap-xss-protection true {:mode :block})
-      (wrap-frame-options :sameorigin)
-
-      (#(if (config/get-var "ENABLE_HTTPS_ONLY")
-          (wrap-ssl-redirect %)
-          %))))
+      (wrap-frame-options :sameorigin)))

 (defonce server (atom nil))
 (defonce scheduler (atom nil))


new function kategorie-data

new function kategorie-data

--- src/paulkrake/score.clj
+++ src/paulkrake/score.clj
@@ -1,5 +1,6 @@
 (ns paulkrake.score
-  (:require [paulkrake.glicko2 :as g]
+  (:require [paulkrake.datacenter :as dc]
+            [paulkrake.glicko2 :as g]
             [incanter.distributions :as d]))

 (def start-rating-data {:abwehr {:rating 1500.0
@@ -136,3 +137,19 @@
         (apply concat x)
         (d/mean x)
         (double x)))
+
+(defn kategorie-data
+  ([spieltage kategorie kategorie-to-score-fn]
+     (let [vereine (as-> spieltage x
+                         (map first x)
+                         (set x)
+                         (map (fn [s]
+                                (vereine (dc/data s 1 kategorie))) x)
+                         (apply concat x)
+                         (set x))]
+       (reduce (fn [a [saison i]]
+                 (new-rating a
+                               (dc/data saison i kategorie)
+                               kategorie-to-score-fn))
+               (initial-rating-data vereine)
+               spieltage))))


Fix billing info copy to reflect content (#1665)

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -881,7 +881,7 @@
                        (om/build table/table
                                  {:rows [card]
                                   :key-fn (constantly "card")
-                                  :columns [{:header "Name on credit card"
+                                  :columns [{:header "Card holder email"
                                              :cell-fn #(:name % "N/A")}
                                             {:header "Card type"
                                              :cell-fn #(:type % "N/A")}


CMR-680: Added additional tests.

CMR-680: Added additional tests.

--- test/cmr/system_int_test/search/granule_search_format_test.clj
+++ test/cmr/system_int_test/search/granule_search_format_test.clj
@@ -87,17 +87,17 @@
                                 {:format-as-ext? true}))))

     (testing "Retrieving results in a format specified as a comma separated list"
-      (are [search expected]
+      (are [format-str]
            (d/refs-match?
-             expected
+             [g1-echo]
              (search/parse-reference-response
                (search/find-concepts-in-format
-                 "text/html,application/xhtml+xml, application/xml;q=0.9,*/*;q=0.8"
+                 format-str
                  :granule
-                 search)))
-           {} all-granules
-           {:granule-ur "g1"} [g1-echo]
-           {:granule-ur "g3"} [g1-smap]))
+                 {:granule-ur "g1"})))
+           "text/html,application/xhtml+xml, application/xml;q=0.9,*/*;q=0.8"
+           "text/html, application/xhtml+xml, application/xml;q=0.9,*/*;q=0.8"
+           "*/*; q=0.5, application/xml"))

     (testing "invalid format"
       (is (= {:errors ["The mime type [application/echo11+xml] is not supported."],


Update content.cljs

Update content.cljs

--- src/prais2/content.cljs
+++ src/prais2/content.cljs
@@ -327,7 +327,7 @@
                     :body [:div
                            [:p "Heart disease in children covers a wide range of disorders, from relatively minor to more serious conditions. This affects a child's chances of survival, as do other factors such as age, weight and other health problems."]

-                           [:p "Some hospitals specialise in certain conditions that are particularly complicated, meaning they tend to operate on children with a lower chance of survival. It would therefore be unfair to expect all hospitals to have the same survival rates each year. Hospitals also treat different children each year, so we expect any hospital’s survival rate to vary from year to year."]
+                           [:p "Some hospitals specialise in certain conditions that are particularly complicated, meaning they tend to operate on children with a lower chance of survival. It would therefore be unfair to expect all hospitals to have the same survival rates and it is not valid to simply compare hospitals' survival rates. Each hospital will also treat different children from year to year, so we expect any hospital’s survival rate to vary from year to year."]

                            [:p "The predicted range (dark blue bar) is where we expect the hospital’s survival rate to be 19 times out of 20."]

@@ -338,7 +338,7 @@
                     }

                    {:title "Why does the width of the predicted range differ between hospitals?"
-                    :short-answer "Chance factors have a bigger influence on the survival rate for hospitals that do fewer operations, and so the predicted range is wider for hospitals that do fewer operations."
+                    :short-answer "If a hospital does fewer operations, chance factors have a bigger influence on its overall survival rate. This is why the predicted range is wider for hospitals that do fewer operations."
                     :glossary [:survival-rate]
                     :body [:div
                            [:p "The predicted range (dark blue bar) for each hospital shows the range where we expect to see the observed survival rate 19 times out of 20 if the hospital is performing as predicted by the formula.  regardless of how many operations it did or what children it treated. When a hospital does fewer operations, chance factors have a bigger influence on the overall outcome, and so it has a wider predicted range than a hospital that does many operations. "]]


formatting

formatting

--- src/chat/server/sync.clj
+++ src/chat/server/sync.clj
@@ -97,25 +97,24 @@
     (every?
       true?
       (concat
-        [(or
-           (boolean (db/user-can-see-thread? user-id (?data :thread-id)))
+        [(or (boolean (db/user-can-see-thread? user-id (?data :thread-id)))
              (do (timbre/warnf "User %s attempted to add message to disallowed thread %s"
                                user-id (?data :thread-id))
-               false))]
+                 false))]
         (map
           (fn [tag-id]
             (or (boolean (db/user-in-tag-group? user-id tag-id))
-                            (do
-                              (timbre/warnf "User %s attempted to add a disallowed tag %s" user-id
-                                            tag-id)
-                              false)))
+                (do
+                  (timbre/warnf "User %s attempted to add a disallowed tag %s" user-id
+                                tag-id)
+                  false)))
           (?data :mentioned-tag-ids))
         (map
           (fn [mentioned-id]
             (or (boolean (db/user-visible-to-user? user-id mentioned-id))
                 (do (timbre/warnf "User %s attempted to mention disallowed user %s"
                                   user-id mentioned-id)
-                                false)))
+                    false)))
           (?data :mentioned-user-ids))))))


Use put-chars! instead of set-bg!

Use put-chars! instead of set-bg!

--- src/examples/fx.clj
+++ src/examples/fx.clj
@@ -7,8 +7,7 @@
             [clojure.core.async :as async :refer [go-loop]]
             clojure.string
             [taoensso.timbre :as log])
-  (:import (zaffre.terminal Terminal)
-           (zaffre.font CP437Font TTFFont)))
+  (:import (zaffre.terminal Terminal)))

 (defn hsv->rgb [h s v]
   (let [c (* v s)
@@ -32,7 +31,7 @@
   (let [l (norm v)]
     (map #(/ % l) v)))

-(def font (CP437Font. "http://dwarffortresswiki.org/images/b/be/Pastiche_8x8.png" :green 2 false))
+(def font (zfont/scale (zfont/cp-437 "http://dwarffortresswiki.org/images/b/be/Pastiche_8x8.png" :green false) 2))

 (defn -main [& _]
   (zgl/create-terminal
@@ -81,19 +80,17 @@
             (zutil/put-string terminal :text 12 0 (str key-in))
             ; fx (note the only characters we're drawing if full-cell boxes
             (doseq [y (range 16)]
-              (zutil/put-string terminal :dark 0 y (clojure.string/join (repeat 16 " ")))
-              (zutil/put-string terminal :light 0 y (clojure.string/join (repeat 16 " "))))
-            (zat/set-bg! terminal :light 8 8 [32 32 16])
-            (doseq [x (range 16)
-                    y (range 16)]
-                (zat/set-bg! terminal :dark x y [32, 32, 128])
-                (let [rlx (- lx x) ;; vector from x, y to lx, ly
-                      rly (- ly y)
-                      rlz 3
-                      rl  [rlx rly rlz]
-                      d   (norm rl) ; distance from [x y] to light
-                      i (min 1.0 (/ (* 8.5 (dot (unit [0 0 1]) (unit rl))) (* d d)))]
-                  (zat/set-bg! terminal :light x y (mapv (partial * i) [255 255 128]))))))
+              (zutil/put-string terminal :dark 0 y (clojure.string/join (repeat 16 " ")) [255 255 255] [32 32 128]))
+            (zat/put-chars! terminal :light
+              (for [x (range 16)
+                    y (range 16)
+                    :let [rlx (- lx x) ;; vector from x, y to lx, ly
+                          rly (- ly y)
+                          rlz 3
+                          rl  [rlx rly rlz]
+                          d   (norm rl) ; distance from [x y] to light
+                          i (* 255 (min 1.0 (/ (* 8.5 (dot (unit [0 0 1]) (unit rl))) (* d d))))]]
+                {:c \  :fg [0 0 0] :bg [255 255 128 i] :x x :y y :blend-mode :normal}))))
         ;; get key presses in fg thread
         (zevents/add-event-listener terminal :keypress
           (fn [new-key]


whitespace fixes clojure-mode 2.1.1

whitespace fixes clojure-mode 2.1.1

--- test/clj_http/test/cookies.clj
+++ test/clj_http/test/cookies.clj
@@ -16,25 +16,25 @@

 (deftest test-compact-map
   (are [map expected]
-       (is (= expected (compact-map map)))
-       {:a nil :b 2 :c 3 :d nil}
-       {:b 2 :c 3}
-       {:comment nil :domain "example.com" :path "/" :ports [80 8080] :value 1}
-       {:domain "example.com" :path "/" :ports [80 8080] :value 1}))
+    (is (= expected (compact-map map)))
+    {:a nil :b 2 :c 3 :d nil}
+    {:b 2 :c 3}
+    {:comment nil :domain "example.com" :path "/" :ports [80 8080] :value 1}
+    {:domain "example.com" :path "/" :ports [80 8080] :value 1}))

 (deftest test-decode-cookie
   (are [set-cookie-str expected]
-       (is (= expected (decode-cookie set-cookie-str)))
-       nil nil
-       "" nil
-       "example-cookie=example-value;Path=/"
-       ["example-cookie"
-        {:discard true :path "/" :secure false
-         :value "example-value" :version 0}]
-       "example-cookie=example-value;Domain=.example.com;Path=/"
-       ["example-cookie"
-        {:discard true :domain ".example.com" :secure false :path "/"
-         :value "example-value" :version 0}]))
+    (is (= expected (decode-cookie set-cookie-str)))
+    nil nil
+    "" nil
+    "example-cookie=example-value;Path=/"
+    ["example-cookie"
+     {:discard true :path "/" :secure false
+      :value "example-value" :version 0}]
+    "example-cookie=example-value;Domain=.example.com;Path=/"
+    ["example-cookie"
+     {:discard true :domain ".example.com" :secure false :path "/"
+      :value "example-value" :version 0}]))

 (deftest test-decode-cookies-with-seq
   (let [cookies (decode-cookies [(str "ring-session=" session)])]
@@ -61,53 +61,53 @@

 (deftest test-decode-cookie-header
   (are [response expected]
-       (is (= expected (decode-cookie-header response)))
-       {:headers {"set-cookie" "a=1"}}
-       {:cookies {"a" {:discard true :path "/" :secure false
-                       :value "1" :version 0}} :headers {}}
-       {:headers {"set-cookie"
-                  (str "ring-session=" session ";Path=/")}}
-       {:cookies {"ring-session"
-                  {:discard true :path "/" :secure false
-                   :value session :version 0}} :headers {}}))
+    (is (= expected (decode-cookie-header response)))
+    {:headers {"set-cookie" "a=1"}}
+    {:cookies {"a" {:discard true :path "/" :secure false
+                    :value "1" :version 0}} :headers {}}
+    {:headers {"set-cookie"
+               (str "ring-session=" session ";Path=/")}}
+    {:cookies {"ring-session"
+               {:discard true :path "/" :secure false
+                :value session :version 0}} :headers {}}))

 (deftest test-encode-cookie
   (are [cookie expected]
-       (is (= expected (encode-cookie cookie)))
-       [:a {:value "b"}] "a=b"
-       ["a" {:value "b"}] "a=b"
-       ["example-cookie"
-        {:domain ".example.com" :path "/" :value "example-value"}]
-       "example-cookie=example-value"
-       ["ring-session" {:value session}]
-       (str "ring-session=" session)))
+    (is (= expected (encode-cookie cookie)))
+    [:a {:value "b"}] "a=b"
+    ["a" {:value "b"}] "a=b"
+    ["example-cookie"
+     {:domain ".example.com" :path "/" :value "example-value"}]
+    "example-cookie=example-value"
+    ["ring-session" {:value session}]
+    (str "ring-session=" session)))

 (deftest test-encode-cookies
   (are [cookie expected]
-       (is (= expected (encode-cookies cookie)))
-       {:a {:value "b"} :c {:value "d"} :e {:value "f"}}
-       "a=b;c=d;e=f"
-       {"a" {:value "b"} "c" {:value "d"} "e" {:value "f"}}
-       "a=b;c=d;e=f"
-       {"example-cookie"
-        {:domain ".example.com" :path "/" :value "example-value"}}
-       "example-cookie=example-value"
-       {"example-cookie"
-        {:domain ".example.com" :path "/" :value "example-value"
-         :discard true :version 0}}
-       "example-cookie=example-value"
-       {"ring-session" {:value session}}
-       (str "ring-session=" session)))
+    (is (= expected (encode-cookies cookie)))
+    {:a {:value "b"} :c {:value "d"} :e {:value "f"}}
+    "a=b;c=d;e=f"
+    {"a" {:value "b"} "c" {:value "d"} "e" {:value "f"}}
+    "a=b;c=d;e=f"
+    {"example-cookie"
+     {:domain ".example.com" :path "/" :value "example-value"}}
+    "example-cookie=example-value"
+    {"example-cookie"
+     {:domain ".example.com" :path "/" :value "example-value"
+      :discard true :version 0}}
+    "example-cookie=example-value"
+    {"ring-session" {:value session}}
+    (str "ring-session=" session)))

 (deftest test-encode-cookie-header
   (are [request expected]
-       (is (= expected (encode-cookie-header request)))
-       {:cookies {"a" {:value "1"}}}
-       {:headers {"Cookie" "a=1"}}
-       {:cookies
-        {"example-cookie" {:domain ".example.com" :path "/"
-                           :value "example-value"}}}
-       {:headers {"Cookie" "example-cookie=example-value"}}))
+    (is (= expected (encode-cookie-header request)))
+    {:cookies {"a" {:value "1"}}}
+    {:headers {"Cookie" "a=1"}}
+    {:cookies
+     {"example-cookie" {:domain ".example.com" :path "/"
+                        :value "example-value"}}}
+    {:headers {"Cookie" "example-cookie=example-value"}}))

 (deftest test-to-basic-client-cookie-with-simple-cookie
   (let [cookie (to-basic-client-cookie


Logging: dump full stacktraces.

Logging: dump full stacktraces.

--- src/reimann/logging.clj
+++ src/reimann/logging.clj
@@ -17,7 +17,7 @@
 (defn set-level [logger level]
   (. (Logger/getLogger logger) (setLevel level)))

-(def reimann-layout (EnhancedPatternLayout. "%p [%d] %t - %c - %m%n"))
+(def reimann-layout (EnhancedPatternLayout. "%p [%d] %t - %c - %m%n%throwable%n"))

 (defn init
   ([] (init {}))


Changed the way we wait for async tests

Changed the way we wait for async tests

--- test/dragonmark/core_test.cljx
+++ test/dragonmark/core_test.cljx
@@ -109,6 +109,9 @@
         b-root-proxy (dc/remote-root a-transport)
         a-root-proxy (dc/remote-root b-transport)
         res (atom nil)
+
+        #+clj wait-obj #+clj ""
+
         ]
     (dc/gofor
      [_ (inc b-root-proxy)]
@@ -117,8 +120,11 @@
      :error (reset! res &err))

     #+clj
+    (add-watch res :none (fn [_ _ _ _] (locking wait-obj (.notifyAll wait-obj))))
+
+    #+clj
     (do
-      (Thread/sleep 100)
+      (locking wait-obj (.wait wait-obj))
       (is (= 1 @res))
       (is (= @res @b-info))
       )


CLJS-851: simplify :none script inclusion if :main supplied

--- src/clj/cljs/closure.clj
+++ src/clj/cljs/closure.clj
@@ -770,6 +770,13 @@
 (defn output-deps-file [opts sources]
   (output-one-file opts (deps-file opts sources)))

+(defn output-main-file [opts]
+  (let [output-dir (util/output-directory opts)]
+    (output-one-file opts
+      (str "document.write('<script src=\"" output-dir "/goog/base.js\"></script>');"
+           "document.write('<script src=\"" output-dir "/cljs_deps.js\"></script>');"
+           "document.write('<script>goog.require(\"" (comp/munge (:main opts)) "\");</script>');"))))
+
 (defn ^String rel-output-path
   "Given an IJavaScript which is either in memory, in a jar file,
   or is a foreign lib, return the path relative to the output
@@ -858,11 +865,21 @@
    The deps file for the current project will include third-party
    libraries."
   [opts & sources]
-  (let [disk-sources (map #(source-on-disk opts %) sources)
-        goog-deps    (io/file (util/output-directory opts) "goog/deps.js")]
+  (let [disk-sources (remove #(= (:group %) :goog)
+                       (map #(source-on-disk opts %) sources))
+        goog-deps    (io/file (util/output-directory opts) "goog/deps.js")
+        main         (:main opts)]
     (util/mkdirs goog-deps)
     (spit goog-deps (slurp (io/resource "goog/deps.js")))
-    (output-deps-file opts (remove #(= (:group %) :goog) disk-sources))))
+    (if (and main (not= (:target opts) :nodejs))
+      (do
+        (output-deps-file
+          (assoc opts :output-to
+            (str (util/output-directory opts)
+                 File/separator "cljs_deps.js"))
+          disk-sources)
+        (output-main-file opts))
+      (output-deps-file opts disk-sources))))

 (comment


Forgot to remove TODO

Forgot to remove TODO

--- src/clj_spotify/core.clj
+++ src/clj_spotify/core.clj
@@ -45,7 +45,6 @@
     )))

 ;TODO - better doc string
-;TODO - rename to def-def-spotify-api-call
 ;TODO - Maybe change everything to be sent through request body?
 (defmacro def-spotify-api-call
   "Creates a function f with doc-string d that calls the http-verb verb for url url."


Change find-by to return a set

Change find-by to return a set

--- src/cljc/seria/util.cljc
+++ src/cljc/seria/util.cljc
@@ -41,12 +41,15 @@
                 (mapcat (fn [[a b]] [[a b] [b a]]))
                 (into {}))}))

-(defn find-by [f form]
+(defn find-by* [f form]
   (concat (if (f form) [form] [])
           (if (or (sequential? form)
                   (map? form))
-            (mapcat (partial find-by f) form)
+            (mapcat (partial find-by* f) form)
             [])))
+
+(defn find-by [f form]
+  (set (find-by* f form)))

 ;; Code generation


lazy-seq atoms need doall

lazy-seq atoms need doall

--- src/cljs/darts/core.cljs
+++ src/cljs/darts/core.cljs
@@ -50,19 +50,20 @@
     [:a {:href "#/new-player"} "New player"]
     [:h3 "Select two players"]
     [:ul
-     (map (fn [{:keys [name]}]
-            ^{:key name}
-            [:li [:input {:type "checkbox"
-                          :disabled (and (= (count @selected-players)
-                                            2)
-                                         (not (@selected-players name)))
+     (doall
+      (map (fn [{:keys [name]}]
+             ^{:key name}
+             [:li [:input {:type "checkbox"
+                           :disabled (and (= (count @selected-players)
+                                             2)
+                                          (not (@selected-players name)))

-                          :on-click (fn []
-                                      (if (@selected-players name)
-                                        (swap! selected-players difference #{name})
-                                        (swap! selected-players conj name)))}
-                  name]])
-          (parse-json @players))]]])
+                           :on-click (fn []
+                                       (if (@selected-players name)
+                                         (swap! selected-players difference #{name})
+                                         (swap! selected-players conj name)))}
+                   name]])
+           (parse-json @players)))]]])

 (defn redirect-to [path]
   (set! js/window.location.href path))


Context should be expression

Context should be expression

--- src/cljs_mancy/core.cljs
+++ src/cljs_mancy/core.cljs
@@ -23,6 +23,7 @@
               :analyze-deps true
               :static-fns false
               :def-emits-var true
+              :context :expr
               :ns 'cljs.user
             }))


Experiment with meta-errors

Experiment with meta-errors

--- src/clojush/evaluate.clj
+++ src/clojush/evaluate.clj
@@ -1262,9 +1262,16 @@
                        (sequence-similarity child1-genome child2-genome)))
                 1.0)
               (= cat :favoritism)
-              (if (and (:parent1-genome ind) (:parent2-genome ind))
+              #_(if (and (:parent1-genome ind) (:parent2-genome ind))
                 (math/abs (- (sequence-similarity (:genome ind) (:parent1-genome ind))
                              (sequence-similarity (:genome ind) (:parent2-genome ind))))
+                1.0)
+              (if (and (:parent1-genome ind)
+                       (:parent2-genome ind)
+                       (not= (:parent1-genome ind) (:parent2-genome ind)))
+                (/ (math/abs (- (sequence-similarity (:genome ind) (:parent1-genome ind))
+                                (sequence-similarity (:genome ind) (:parent2-genome ind))))
+                   (- 1 (sequence-similarity (:parent1-genome ind) (:parent2-genome ind))))
                 1.0)
               ;
               (= cat :autoconstruction-blindness)


Experiment with meta-errors

Experiment with meta-errors

--- src/clojush/evaluate.clj
+++ src/clojush/evaluate.clj
@@ -981,7 +981,7 @@
                          (= e p1e) 3
                          :else 2)))
                 (vec (repeat (count (:errors ind)) 2)))
-              #_(if (:parent1-errors ind)
+              (if (:parent1-errors ind)
                 (vec (for [[e p1e] (mapv #(vector %1 %2)
                                          (:errors ind)
                                          (:parent1-errors ind))]
@@ -1030,7 +1030,7 @@
                          (some #{e} [p1e p2e]) 3
                          :else 4)))
                 (vec (repeat (count (:errors ind)) 4)))
-              (if (and (:parent1-errors ind)
+              #_(if (and (:parent1-errors ind)
                        (:parent2-errors ind))
                 (vec (for [[e p1e p2e] (mapv #(vector %1 %2 %3)
                                              (:errors ind)


Document that calling logging/init multiple times is OK

--- src/riemann/logging.clj
+++ src/riemann/logging.clj
@@ -41,7 +41,8 @@
   (EnhancedPatternLayout. "%p [%d] %t - %c - %m%n%throwable%n"))

 (defn init
-  "Initialize log4j. You will probably call this from the config file. Options:
+  "Initialize log4j. You will probably call this from the config file. You can
+  call init more than once; its changes are destructive. Options:

   :file   The file to log to. If omitted, logs to console only."
   [& { :keys [file] }]


Test read-meta over all of clojure 1.6

Test read-meta over all of clojure 1.6

--- test/grimoire/api/web_test.clj
+++ test/grimoire/api/web_test.clj
@@ -71,3 +71,20 @@
     (let [defs (->> ?res result (map t/thing->name) set)]
       (doseq [d ["for" "def" "let" "catch"]]
         (is (defs d))))))
+
+(deftest read-meta-test
+  (let [plat (-> (t/->Group "org.clojure")
+                 (t/->Artifact "clojure")
+                 (t/->Version "1.6.0")
+                 (t/->Platform "clj"))
+        ?nss (api/list-namespaces test-config plat)]
+    (is (succeed? ?nss))
+
+    (doseq [ns (result ?nss)]
+      (is (t/namespace? ns))
+      (is (succeed? (api/read-meta test-config ns)))
+
+      (let [?defs (api/list-defs test-config ns)]
+        (is (succeed? ?defs))
+        (doseq [d (result ?defs)]
+          (is (succeed? (api/read-meta test-config d))))))))


get rid of unused sente method

get rid of unused sente method

--- src-cljs/frontend/sente.cljs
+++ src-cljs/frontend/sente.cljs
@@ -60,9 +60,6 @@
   (swap! app-state subs/remove-subscriber (:client-id data)))

 (defmethod handle-message :frontend/mouse-move [app-state message data]
-  (swap! app-state subs/maybe-add-subscriber-data (:client-id data) data))
-
-(defmethod handle-message :frontend/update-cust [app-state message data]
   (swap! app-state subs/maybe-add-subscriber-data (:client-id data) data))

 (defmethod handle-message :frontend/db-entities [app-state message data]


minor

minor

--- src-cljs/temp_calc/core.cljs
+++ src-cljs/temp_calc/core.cljs
@@ -108,7 +108,7 @@
   (.show ($ "#startLoggingBtn"))
   (.hide ($ "#stopLoggingBtn")))

-(defn- add-events!
+(defn- add-dom-events!
   "Add event handlers on DOM elements using jQuery."
   []
   ;; text elements
@@ -132,7 +132,9 @@
 (defn- init!
   "Initialize the app."
   []
-  (add-events!)
+  (add-dom-events!)
+
+  ;; trigger an initial state change
   (swap! current-temps identity))

 ;; run init! when the body loads


refactored validate method for "fake", in prep for adding feature

--- src/midje/error_handling/semi_sweet_errors.clj
+++ src/midje/error_handling/semi_sweet_errors.clj
@@ -8,14 +8,15 @@
     [midje.ideas.metaconstants :only [metaconstant-symbol?]]
     [midje.ideas.arrow-symbols :only [=contains=>]]))

-(defmethod validate "fake" [form]
-  (cond (not (list? (second form)))
-        (user-error-report-form
-          form
-          "The left-hand-side of a prerequisite must look like a function call."
-          (cl-format nil "`~S` doesn't." (second form)))
-        :else
-        (rest form)))
+(defmethod validate "fake" [[_fake_ & fake-form :as form]]
+  (let [funcall (first fake-form)]
+    (cond (not (list? funcall))
+          (user-error-report-form
+            form
+            "The left-hand-side of a prerequisite must look like a function call."
+            (cl-format nil "`~S` doesn't." funcall))
+          :else
+          fake-form)))

 (defmethod validate "data-fake" [[header metaconstant arrow hash & remainder :as form]]
   (cond (not (metaconstant-symbol? metaconstant))


Comment.

Comment.

--- src/oc/storage/representations/media_types.clj
+++ src/oc/storage/representations/media_types.clj
@@ -27,4 +27,5 @@
 (def reaction-media-type "application/vnd.open-company.reaction.v1+json")
 (def reaction-collection-media-type "application/vnd.collection+vnd.open-company.reaction+json;version=1")

+;; Reminder media types
 (def reminders-list-media-type "application/vnd.collection+vnd.open-company.reminder+json;version=1")


add color to normal text

add color to normal text

--- sidecar/src/figwheel_sidecar/config_check/ansi.clj
+++ sidecar/src/figwheel_sidecar/config_check/ansi.clj
@@ -34,6 +34,8 @@
    :bg-256     48
    :bg-reset   49})

+(def ^:dynamic *enable-color* true)
+
 (defn esc
   "Returns an ANSI escope string which will apply the given collection of SGR
   codes."
@@ -53,12 +55,15 @@
   [string & codes]
   (str (esc codes) string (escape :none)))

+(defn color-text [text & args]
+  (if *enable-color*
+    (apply sgr text args)
+    text))
+
 (defn strip
   "Removes color codes from the given string."
   [string]
   (str/replace string #"\u001b\[[0-9;]*[mK]" ""))
-
-(def ^:dynamic *enable-color* true)

 (defmacro without-color [& body]
   `(binding [*enable-color* false]


add authenticate function

add authenticate function

--- src/joiner/user.clj
+++ src/joiner/user.clj
@@ -44,6 +44,10 @@
   (with-db (authenticated-database *users-db*)
            (get-document (str "org.couchdb.user:" username))))

+(defn authenticate [username, password]
+  (let [user (get-user username)]
+    (if user
+      (= (:password_sha user) (sha1 password (:salt user))))))

 (defn set-password [username, password]
   "Set new password for user"


use hadoop-util 0.3.0

use hadoop-util 0.3.0

--- elephantdb-core/project.clj
+++ elephantdb-core/project.clj
@@ -9,7 +9,7 @@
                  [org.yaml/snakeyaml "1.9"]
                  [commons-io "1.4"]
                  [jackknife "0.1.2"]
-                 [hadoop-util "0.2.9"]
+                 [hadoop-util "0.3.0"]
                  [metrics-clojure "1.0.1"]
                  [elephantdb/elephantdb-thrift "0.4.3-SNAPSHOT"
                   :exclusions [org.slf4j/slf4j-api]]]


Found a way to make this regression test correct.

--- test/useful/datatypes_test.clj
+++ test/useful/datatypes_test.clj
@@ -12,7 +12,7 @@

 (defrecord Implementor [x]
   Inline
-  (foo [this] "x"))
+  (foo [this] (bar this)))

 (extend-type Implementor
   Dynamic
@@ -38,6 +38,6 @@
         (assoc-record ^Test (do (swap! times-evaled inc) r) :a :x :b :y :c :z)
         (is (= 1 @times-evaled))))

-    (testing "Works with implemented protocols"
+    (testing "Works calling implemented protocols"
       (let [r (Implementor. 1)]
         (assoc-record r :x 5)))))


Add Trusty beta to experimental settings page

The actual visibility of flag is controlled by LD.

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -4,6 +4,7 @@
             [frontend.analytics :as analytics]
             [clojure.string :as string]
             [frontend.models.build :as build-model]
+            [frontend.models.feature :as feature]
             [frontend.models.plan :as plan-model]
             [frontend.models.project :as project-model]
             [frontend.models.user :as user-model]
@@ -376,6 +377,14 @@
                                    "If this option is selected, then CircleCI will run builds for this project "
                                    "on Mac OSX rather than Linux. Select this if you have an iOS application "
                                    "that you want to build using CircleCI."]})
+
+           (when (feature/enabled? :enable-trusty-setting)
+             (describe-flag {:flag :trusty-beta
+                             :title "Ubuntu 14.04 Trusty container"
+                             :blurb [:p
+                                     "Select this option to run builds in our Ubuntu 14.04 (Trusty) container."
+                                     "This container is currently in beta."
+                                     "Our default container is Ubuntu 12.04 (Precise)."]}))
             ]]])))))

 (defn dependencies [project-data owner]


Specify that webhook config is 1.0

Specify that webhook config is 1.0

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -1077,7 +1077,7 @@
       [:legend "Webhooks"]
       [:div.doc
        [:p
-        "CircleCI also supports webhooks, which run at the end of a build. They can be configured in your "
+        "The CircleCI 1.0 platform also supports webhooks, which run at the end of a build. They can be configured in your "
         [:a {:href "https://circleci.com/docs/configuration#notify" :target "_blank"}
          "circle.yml file"]
         "."]]]])))


update clj client to be compliant with session

--- jar-placement-lib/src/sixsq/slipstream/placement/cimi_util.clj
+++ jar-placement-lib/src/sixsq/slipstream/placement/cimi_util.clj
@@ -27,8 +27,9 @@
 (defn update-context
   []
   (log/info "updating cimi server token for user" @cimi-username)
-  (let [context (sync/instance @cimi-cloud-entry-point @url-login @url-logout)]
-    (cimi/login context {:username @cimi-username
+  (let [context (sync/instance @cimi-cloud-entry-point)]
+    (cimi/login context {:href "session-template/internal"
+                         :username @cimi-username
                          :password @cimi-password})
     (reset! cached-cimi-context {:context   context
                                  :timestamp (System/currentTimeMillis)})))


CMR-3058: Added documentation to docstring.

--- metadata-db-app/src/cmr/metadata_db/data/oracle/sql_helper.clj
+++ metadata-db-app/src/cmr/metadata_db/data/oracle/sql_helper.clj
@@ -10,7 +10,19 @@
   (:import cmr.oracle.connection.OracleStore))

 (defn find-params->sql-clause
-  "Converts a parameter map for finding concept types into a sql clause for inclusion in a query."
+  "Converts a parameter map for finding concept types into a sql clause for inclusion in a query. The type
+  of value determines the nature of the clause. If the value for a parameter is sequential then a clause
+  using 'in' is generated. If the value is a map then it must contain two keys, :comparator which specifies
+  what comparision operation to use, e.g. `> or `<, and :value which specifies the value for comparision.
+  Any other value type results in a simple 'equals' clause.
+
+  Examples:
+             {:provider-id \"PROV1\"}               =>   `(= :provider-id \"PROV1\")
+
+             {:provider-id [\"PROV1\", \"PROV2\"]}  =>   `(in :provider-id [\"PROV1\" \"PROV2\"])
+
+             {:revision-id {:comparator `>, :value \"2000-01-01T10:00:00Z\"}} =>
+                    `(> :revision-id \"2000-01-01T10:00:00Z\")"
   [params]
   ;; Validate parameter names as a sanity check to prevent sql injection
   (let [valid-param-name #"^[a-zA-Z][a-zA-Z0-9_\-]*$"]


(SERVER-1320) modification of indentation in response to review

--- test/integration/puppetlabs/services/certificate_authority/certificate_authority_int_test.clj
+++ test/integration/puppetlabs/services/certificate_authority/certificate_authority_int_test.clj
@@ -185,9 +185,8 @@
           csr (ssl-utils/generate-certificate-request key-pair
                                                       subjectDN
                                                       ca-ext)]
-          (fs/mkdir req-dir)
-          (ssl-utils/obj->pem! csr (str req-dir
-                                        "/test_cert_ca_true.pem"))
+      (fs/mkdir req-dir)
+      (ssl-utils/obj->pem! csr (str req-dir "/test_cert_ca_true.pem"))
       (bootstrap/with-puppetserver-running
         app
         {:jruby-puppet {:master-conf-dir master-conf-dir}}


fix test

fix test

--- test/clj_money/models/reconciliations_test.clj
+++ test/clj_money/models/reconciliations_test.clj
@@ -402,8 +402,8 @@
                                                          :transactions
                                                          (mapcat :items)
                                                          (filter (fn [i] (= (:id checking) (:account-id i))))
-                                                         last
-                                                         (juxt :id :transaction-date)))))
+                                                         (map (juxt :id :transaction-date))
+                                                         last))))
         result (reconciliations/update storage-spec updated)]
     (is (validation/has-error? result :balance))))


(PE-5670) Add resource-types endpoint

(PE-5670) Add resource-types endpoint

This commit adds the resource_types endpoint to our whitelist
of endpoints that we pass through to the Ruby Puppet code.

I've tested locally, but if we think we need additional
testing we can add some in a follow-up PR.

--- src/clj/puppetlabs/services/master/master_core.clj
+++ src/clj/puppetlabs/services/master/master_core.clj
@@ -39,6 +39,8 @@
     (compojure/PUT "/report/*" request
                    (request-handler environment request))
     (compojure/GET "/resource_type/*" request
+                   (request-handler environment request))
+    (compojure/GET "/resource_types/*" request
                    (request-handler environment request))))

 (defn root-routes


(SERVER-269) Added ticket numbers for TODO

This commit adds some related JIRA ticket numbers for the TODO which
would remove the conversion in the Puppet Server Compojure Ring handler
for all file_bucket/file requests to a Content-Type of
application/octet-stream.

--- src/clj/puppetlabs/services/master/master_core.clj
+++ src/clj/puppetlabs/services/master/master_core.clj
@@ -41,7 +41,9 @@
     ;; the actual payload is "binary".  Coercing this to
     ;; "application/octet-stream" for now as this is synonymous with "binary".
     ;; This should be removed when/if Puppet agents start using an appropriate
-    ;; Content-Type to describe the input payload.
+    ;; Content-Type to describe the input payload - see PUP-3812 for the core
+    ;; Puppet work and SERVER-294 for the related Puppet Server work that
+    ;; would be done.
     (compojure/PUT "/file_bucket_file/*" request
                    (request-handler (assoc request
                                            :content-type


Thinking about implementing get-analog-bits in simulator

--- src/clj_bots/pin_ctrl_simulator/implementation.clj
+++ src/clj_bots/pin_ctrl_simulator/implementation.clj
@@ -82,6 +82,9 @@
     (assert (= (current-pin-mode board pin-n) :ain)
             "Only :ain pins have raw values")
     (get @pin-state pin-n))
+
+  pcp/PAnalogPin
+  (get

   pcp/PWriteablePin
   (write-value! [board pin-n val]


add debug macro

add debug macro

--- logging-macro-demo/src/logging_macro_demo/core.clj
+++ logging-macro-demo/src/logging_macro_demo/core.clj
@@ -24,6 +24,36 @@
   [pred coll]
   (keep-indexed #(when (pred %2) %1) coll))

+(defmacro my-debug
+  "Call with function definition and this will add logging to the start and end."
+  [arg]
+  (let [param-index (first (indices vector? arg))
+        first-half (take (inc param-index) arg)
+        body (drop (inc param-index) arg)
+        func-name (second arg)
+        params (nth arg param-index)
+        new-print-arg-statement `(println (str "(" '~func-name " " ~params ")"))
+        last-statement (take-last 1 body)
+        body-remainder (drop-last 1 body)
+        print-last-statement `(println (str '~func-name " result: " ~(first last-statement)))
+        new-function (concat first-half
+                             (list new-print-args-statement)
+                             body-remainder
+                             (list print-last-statement)
+                             last-statement)]
+    `(do
+       (println "param-index: " ~param-index)
+       (println "first-half: " ~first-half)
+       (println "body: " '~func-name)
+       (println "func-name: " '~func-name)
+       (println "params: " '~params)
+       (println "new-print-statement: " '~new-print-args-statement)
+       (println "last-statement: " (first '~last-statement))
+       (println "body-remainder: " ~body-remainder)
+       (println "print-last-statement: " '~print-last-statement)
+       (println "new-functoin: " '~new-function)
+       (eval '~new-function))))
+
 (defn -main
   "I don't do a whole lot ... yet."
   [& args]


Reindent re-frame example code

Reindent re-frame example code

--- examples/frontend-re-frame/src/cljs/frontend_re_frame/core.cljs
+++ examples/frontend-re-frame/src/cljs/frontend_re_frame/core.cljs
@@ -9,32 +9,27 @@

 ;;; Events ;;;

-(re-frame/reg-event-db
- ::initialize-db
- (fn [db _]
-   (if db
-     db
-     {:current-route nil})))
+(re-frame/reg-event-db ::initialize-db
+  (fn [db _]
+    (if db
+      db
+      {:current-route nil})))

-(re-frame/reg-event-fx
- ::navigate
- (fn [db [_ & route]]
-   ;; See `navigate` effect in routes.cljs
-   {::navigate! route}))
+(re-frame/reg-event-fx ::navigate
+  (fn [db [_ & route]]
+    {::navigate! route}))

-(re-frame/reg-event-db
- ::navigated
- (fn [db [_ new-match]]
-   (let [old-match   (:current-route db)
-         controllers (rfc/apply-controllers (:controllers old-match) new-match)]
-     (assoc db :current-route (assoc new-match :controllers controllers)))))
+(re-frame/reg-event-db ::navigated
+  (fn [db [_ new-match]]
+    (let [old-match   (:current-route db)
+          controllers (rfc/apply-controllers (:controllers old-match) new-match)]
+      (assoc db :current-route (assoc new-match :controllers controllers)))))

 ;;; Subscriptions ;;;

-(re-frame/reg-sub
- ::current-route
- (fn [db]
-   (:current-route db)))
+(re-frame/reg-sub ::current-route
+  (fn [db]
+    (:current-route db)))

 ;;; Views ;;;

@@ -57,10 +52,10 @@
 ;;; Effects ;;;

 ;; Triggering navigation from events.
-(re-frame/reg-fx
- ::navigate!
- (fn [route]
-   (apply rfe/push-state route)))
+
+(re-frame/reg-fx ::navigate!
+  (fn [route]
+    (apply rfe/push-state route)))

 ;;; Routes ;;;

@@ -106,15 +101,15 @@

 (def router
   (rf/router
-   routes
-   {:data {:coercion rss/coercion}}))
+    routes
+    {:data {:coercion rss/coercion}}))

 (defn init-routes! []
   (js/console.log "initializing routes")
   (rfe/start!
-   router
-   on-navigate
-   {:use-fragment true}))
+    router
+    on-navigate
+    {:use-fragment true}))

 (defn nav [{:keys [router current-route]}]
   [:ul


Refactors

Refactors

--- src/expound/paths.cljc
+++ src/expound/paths.cljc
@@ -51,7 +51,7 @@

 (declare in-with-kps*)

-(defn in-with-kps-maps-are-seqs [form val in in']
+(defn in-with-kps-maps-as-seqs [form val in in']
   (let [[k & rst] in
         [idx & rst2] rst]
     (cond
@@ -68,28 +68,38 @@

       ;; detect a `:in` path that points to a key/value pair in a coll-of spec
       (and (map? form)
-           (int? k)
-           (< k (count (seq form)))
-           #_(= val (nth (seq form) k))
-           #_(empty? rst))
+           (nat-int? k)
+           (< k (count (seq form))))
       (in-with-kps* (nth (seq form) k) val rst (conj in' (->KeyValuePathSegment k)))

       (and (map? form)
-           (int? k)
+           (nat-int? k)
            (int? idx)
-           (or
-            (= val (nth (nth (seq form) k) idx))
-            (= val (list (nth (nth (seq form) k) idx))))
-           #_(empty? rst))
+           (< k (count (seq form)))
+           (< idx (count (nth (seq form) k))))
       (in-with-kps* (nth (nth (seq form) k) idx) val rst2 (conj in' (->KeyValuePathSegment k) idx))

-      (associative? form)
-      (in-with-kps* (get form k ::not-found) val rst (conj in' k))
+      :else
+      ::not-found)))

-      (int? k)
-      (in-with-kps* (nth form k ::not-found) val rst (conj in' k)))))
+(defn in-with-kps-ints-are-keys [form val in in']
+  (if (= form ::not-found)
+    form
+    (let [[k & rst] in]
+      (cond
+        (empty? in)
+        in'

-(defn in-with-kps-default [form val in in']
+        (associative? form)
+        (in-with-kps* (get form k ::not-found) val rst (conj in' k))
+
+        (int? k)
+        (in-with-kps* (nth form k ::not-found) val rst (conj in' k))
+
+        :else
+        ::not-found))))
+
+(defn in-with-kps-ints-are-key-value-indicators [form val in in']
   (if (= form ::not-found)
     form
     (let [[k & rst] in
@@ -101,66 +111,40 @@
         ;; detect a `:in` path that points at a key in a map-of spec
         (and (map? form)
              (= 0 idx)
-             (or
-              ;; TODO - this seemed attractive, but doesn't fork for nested map
-
-              (= val k)
-              (not (and (associative? (get form k ::not-found))
-                        (contains? (get form k ::not-found) idx)))))
+             (not (and (associative? (get form k ::not-found))
+                       (contains? (get form k ::not-found) idx))))
         (conj in' (->KeyPathSegment k))

         ;; detect a `:in` path that points at a value in a map-of spec
         (and (map? form)
              (= 1 idx)
-             ;; TODO - at some point, I wanted to check for the value
-             ;; here, but that can't actually work, since the value
-             ;; might be nested more deeply
-
-             (or
-              (= val (get form k ::not-found))
-              (not (and (associative? (get form k ::not-found))
-                        (contains? (get form k ::not-found) idx)))))
+             (not (and (associative? (get form k ::not-found))
+                       (contains? (get form k ::not-found) idx))))
         (in-with-kps* (get form k ::not-found) val rst2 (conj in' k))

-        ;; detect a `:in` path that points to a key/value pair in a coll-of spec
-        (and (map? form)
-             (int? k)
-             (< k (count (seq form)))
-             (= val (nth (seq form) k))
-             #_(empty? rst))
-        (in-with-kps* (nth (seq form) k) val rst (conj in' (->KeyValuePathSegment k)))
-
-        (and (map? form)
-             (int? k)
-             (int? idx)
-             (or
-              (= val (nth (nth (seq form) k) idx))
-              (= val (list (nth (nth (seq form) k) idx))))
-             #_(empty? rst))
-        (in-with-kps* (nth (nth (seq form) k) idx) val rst2 (conj in' (->KeyValuePathSegment k) idx))
-
-        (associative? form)
-        (in-with-kps* (get form k ::not-found) val rst (conj in' k))
-
-        (int? k)
-        (in-with-kps* (nth form k ::not-found) val rst (conj in' k))))))
+        :else
+        ::not-found))))

 (defn in-with-kps* [form val in in']
-  ;; TODO cache results to not do this twice
-  (if (not= ::not-found (in-with-kps-default form val in in'))
-    (in-with-kps-default form val in in')
-    (if (not= ::not-found (in-with-kps-maps-are-seqs form val in in'))
-      (in-with-kps-maps-are-seqs form val in in')
-      ::not-found)))
+  (let [br1 (in-with-kps-ints-are-key-value-indicators form val in in')]
+    (if (not= ::not-found br1)
+      br1
+      (let [br2 (in-with-kps-maps-as-seqs form val in in')]
+        (if (not= ::not-found br2)
+          br2
+          (let [br3 (in-with-kps-ints-are-keys form val in in')]
+            (if (not= ::not-found br3)
+              br3
+              ::not-found)))))))

 (defn in-with-kps [form val in in']
-  ;; TODO cache results to not do this twice
-  (if (= ::not-found (in-with-kps* form val in in'))
-    (throw (ex-info "Can't convert path" {:form form
-                                          :val val
-                                          :in in
-                                          :in' in'}))
-    (in-with-kps* form val in in')))
+  (let [res (in-with-kps* form val in in')]
+    (if (= ::not-found res)
+      (throw (ex-info "Can't convert path" {:form form
+                                            :val val
+                                            :in in
+                                            :in' in'}))
+      res)))

 (defn compare-path-segment [x y]
   (cond


Don't try to set ns in repl-server form.


fix to weekly list

fix to weekly list


Remove weird surplus width after sidebar animation


CMR-7923: Testing FreeAndOpenData translation amoung different formats. (#1466)

Co-authored-by: siwei xu <6532de1a8b5e90ff3cadd14b3ab551515d3f3d37@raytheon.com>

--- umm-spec-lib/src/cmr/umm_spec/test/umm_record_sanitizer.clj
+++ umm-spec-lib/src/cmr/umm_spec/test/umm_record_sanitizer.clj
@@ -301,10 +301,6 @@
       ;; so here we just replace the generated value to eng to make it through the validation.
       (set-if-exist :DataLanguage "eng")
       (set-if-exist :CollectionProgress "COMPLETE")
-      ;; CMR-7779 will be adding the translations of FreeAndOpenData among different formats.
-      ;; For now, we will remove it from UseConstraints. When CMR-7779 is done, the line below
-      ;; should be removed.
-      (update-in [:UseConstraints] dissoc :FreeAndOpenData)
       ;; Figure out if we can define this in the schema
       sanitize-science-keywords
       (sanitize-umm-record-urls :collection)


fixed multipliers

fixed multipliers

--- Assets/game/board.clj
+++ Assets/game/board.clj
@@ -48,19 +48,19 @@

 (defn update-trick-ui []
   (try
-  (let [tricklist (apply str (map (comp #(str % "\n") first) @TRICK-STREAK))
-        multiplier-color (cond
-                          (< @game.data/trick-multiplier 6) "white"
-                          (< @game.data/trick-multiplier 15) "orange"
-                          (< @game.data/trick-multiplier 20) "purple"
-                          (< @game.data/trick-multiplier 30) "magenta"
-                          :else "red")]
-    (text! (the tricks) tricklist)
-    (text! (the tricks-bg) tricklist)
-    (text! (the score) (str @game.data/skater-name ": "
-                        @game.data/trick-score " <color=\"" multiplier-color
-                        "\">x" @game.data/trick-multiplier "</color>")))
-  (catch Exception e (log e))))
+   (let [tricklist (apply str (map (comp #(str % "\n") first) @TRICK-STREAK))
+         multiplier-color (cond
+                           (< @game.data/trick-multiplier 6) "white"
+                           (< @game.data/trick-multiplier 15) "orange"
+                           (< @game.data/trick-multiplier 20) "purple"
+                           (< @game.data/trick-multiplier 30) "magenta"
+                           :else "red")]
+     (text! (the tricks) tricklist)
+     (text! (the tricks-bg) tricklist)
+     (text! (the score) (str @game.data/skater-name ": "
+                         @game.data/trick-score " <color=\"" multiplier-color
+                         "\">x" @game.data/trick-multiplier "</color>")))
+   (catch Exception e (log e))))

 (defn message [s]
   (destroy (the message))
@@ -82,14 +82,15 @@
            (not (zero? z)))
     (swap! TRICK-STREAK #(conj % [(trick [x y z]) (trick-score [x y z])]))
     (let [multiplier (cond
-                      (< 3 (count @TRICK-STREAK)) 1
-                      (< 6 (count @TRICK-STREAK)) 2
-                      (< 10 (count @TRICK-STREAK)) 3
-                      (< 15 (count @TRICK-STREAK)) 4
-                      (< 20 (count @TRICK-STREAK)) 5
-                      (< 30 (count @TRICK-STREAK)) 6
-                      (< 40 (count @TRICK-STREAK)) 7)]
+                      (< (count @TRICK-STREAK) 3) 1
+                      (< (count @TRICK-STREAK) 6) 2
+                      (< (count @TRICK-STREAK) 10) 3
+                      (< (count @TRICK-STREAK) 15) 4
+                      (< (count @TRICK-STREAK) 20) 5
+                      (< (count @TRICK-STREAK) 30) 6
+                      (< (count @TRICK-STREAK) 40) 7)]
      (reset! game.data/trick-multiplier multiplier)
+     (log (str "multiplier: " @game.data/trick-multiplier))
      (reset! game.data/trick-score (+ @game.data/trick-score (* multiplier (trick-score [x y z]))))
      (update-trick-ui)
      (game.ui/tween-rect-scale (the score) (v3 1.2 1.2 1) 0.2)))))
@@ -177,11 +178,11 @@

     (text! (the debug) ""
       #_(str :steerage "   " @steerage "\n"
-        :forward-speed "  " forward-speed "\n"
-        :max-turn "  " max-turn "\n"
-        :in-air "  " @IN-AIR "\n"
-        :touching "  " @TOUCHING "\n"
-        :angular-vel "  " (.angularVelocity body) "\n") )
+         :forward-speed "  " forward-speed "\n"
+         :max-turn "  " max-turn "\n"
+         :in-air "  " @IN-AIR "\n"
+         :touching "  " @TOUCHING "\n"
+         :angular-vel "  " (.angularVelocity body) "\n"))

     (update-state! o :total-euler
           #(v3+ % (delta-euler (state o :rotation) rotation)))


Implement split on conjunctions

Implement split on conjunctions

--- src/formlogic/parser.clj
+++ src/formlogic/parser.clj
@@ -238,20 +238,39 @@
          (recur (-> formula zip/down zip/right zip/right) atoms-with-literal)))
      (zip/root loc))))

-(defn extract-quantifiers
-  ([tree] (extract-quantifiers (zip/vector-zip tree) [:append-here]))
+(defn- strip-quantified-formula
+  ([quantified-formula-loc]
+   (if (quantified-formula? quantified-formula-loc)
+     (-> quantified-formula-loc
+         zip/down
+         zip/right
+         zip/right
+         ;; Now we're at formula contents.
+         zip/remove
+         ;; Removing puts us at previous depth-first node.
+         zip/up
+         zip/up
+         zip/up)
+     ;; Do nothing.
+     quantified-formula-loc))
+  ([quantified-formula-loc replacement]
+   (if (quantified-formula? quantified-formula-loc)
+     (-> quantified-formula-loc
+         zip/down
+         zip/right
+         zip/right
+         ;; Now we're at formula contents.
+         (zip/edit (constantly replacement))
+         zip/up)
+     ;; Do nothing.
+     quantified-formula-loc)))
+
+(defn pull-quantifiers-up
+  ([tree] (pull-quantifiers-up (zip/vector-zip tree) [:append-here]))
   ([loc root]
    (if-let [formula (next-quantified-formula loc :FOREACH)]
      (let [modified-formula (-> formula
-                                zip/down
-                                zip/right
-                                zip/right
-                                ;; Now we're at formula contents.
-                                zip/remove
-                                ;; Removing puts us at previous depth-first node.
-                                zip/up
-                                zip/up
-                                zip/up
+                                strip-quantified-formula
                                 ;; Now we're at formula root. Leave a marker.
                                 (zip/append-child [:append-here])
                                 zip/node)
@@ -300,6 +319,94 @@
       result
       (recur result))))

+(defn skip-quantifiers
+  "Skips quantifiers at beginning of loc, returning loc at first non-quantified
+  formula."
+  [loc]
+  (if (quantified-formula? loc)
+    (recur (-> loc zip/down zip/right zip/right))
+    ;; We're done.
+    loc))
+
+(defn extract-quantifiers
+  "Extracts quantifiers at beginning of loc, returning loc at start of quantifier
+  formula. Also replaces contents with replacement."
+  [loc replacement]
+  (if-let [previous-loc (zip/up (skip-quantifiers loc))]
+    (zip/root (strip-quantified-formula previous-loc replacement))
+    []))
+
+(defn filter-quantifiers
+  "Returns quantifiers tree without quantifiers that do not bind any literals
+  in formula."
+  [loc formula]
+  (letfn [(extract-literals [loc literals-in-loc]
+            (if (zip/end? loc)
+              literals-in-loc
+              (if (nonterm? (zip/node loc) :LITERAL)
+                (recur (zip/next loc) (conj literals-in-loc (-> loc
+                                                                zip/down
+                                                                zip/right
+                                                                zip/node)))
+                (recur (zip/next loc) literals-in-loc))))
+          (remove-quantifiers [loc literals-in-formula]
+            (if-let [next-quantifier (next-quantified-formula loc :FOREACH)]
+              (let [bound-literal (-extract-bound-literal next-quantifier)
+                    modified-loc (if (not (contains? literals-in-formula bound-literal))
+                                   ;; Redundant quantifier, replace quantified
+                                   ;; formula with contents.
+                                   (zip/edit next-quantifier
+                                             (constantly (-> next-quantifier
+                                                             zip/down
+                                                             zip/right
+                                                             zip/right
+                                                             ;; Now we are at formula contents.
+                                                             zip/node)))
+                                   (-> next-quantifier zip/down zip/right zip/right))]
+                (recur modified-loc literals-in-formula))
+              ;; There are no more quantifiers.
+              (zip/root loc)))]
+    ;; First extract literals used in formula, then remove all quantifiers that
+    ;; do not bind those literals from the loc
+    (remove-quantifiers loc (extract-literals (zip/vector-zip formula) #{}))))
+
+(defn collect-conjunction-terms
+  "Returns a vector of formulas which are operands to conjunctions, starting at
+  loc."
+  [loc]
+  (let [node (zip/node loc)]
+  (if (or (zip/end? loc) (nonterm? node :Conjunction))
+    (let [[_ lhs rhs] node
+          ;; Collect non-conjunction operands.
+          terms (reduce #(conj %1 %2)
+                        []
+                        (filter #(not (nonterm? % :Conjunction)) [lhs rhs]))]
+      ;; Descend into children.
+      (concat terms
+              (collect-conjunction-terms (-> loc zip/down zip/right))
+              (collect-conjunction-terms (-> loc zip/down zip/right zip/right))))
+    ;; Not a conjunction.
+    [])))
+
+(defn split-on-conjunctions
+  [tree]
+  (let [loc (zip/vector-zip tree)
+        quantifiers (extract-quantifiers loc [:append-here])
+        after-quantifiers (skip-quantifiers loc)
+        ;; If there are no terms, just return the top formula.
+        terms (first (filter (complement empty?)
+                             [(collect-conjunction-terms after-quantifiers)
+                              [(zip/node after-quantifiers)]]))]
+    (if (empty? quantifiers)
+      terms
+      ;; Filter out redundant quantifiers.
+      (map #(filter-quantifiers
+              ;; Create a new zipper by appending formula to quantifiers.
+              (zip/vector-zip (insta/transform
+                                {:append-here (constantly %)}
+                                quantifiers))
+              %) terms))))
+
 (defn wff->cnf
   "Converts a well-formed formula in string form to conjuctive-normal-form in
   tree form."
@@ -310,5 +417,8 @@
       transform-negations
       transform-existential-quantifiers
       transform-universal-quantifiers
-      extract-quantifiers
-      descend-disjunctions))
+      pull-quantifiers-up
+      descend-disjunctions
+      split-on-conjunctions
+      ;; From this point on we have a vector of formulas.
+      ))


Removes superflous function.

Removes superflous function.

--- src/active/clojure/match.clj
+++ src/active/clojure/match.clj
@@ -657,19 +657,11 @@
         binding (key-exists-with-binding-clause-binding clause)]
     `[~(symbol binding) (get-in ~message [~(convert-path-element key)])]))

-(defn key-exists-without-binding-clause->rhs-match
-  [message clause]
-  `[])
-
 (defn path-exists-with-binding-clause->rhs-match
   [message clause]
   (let [key         (path-exists-with-binding-clause-path clause)
         binding     (path-exists-with-binding-clause-binding clause)]
     `[~(symbol binding) (get-in ~message ~(mapv convert-path-element key))]))
-
-(defn path-exists-without-binding-clause->rhs-match
-  [message clause]
-  `[])

 (defn key-matches-with-binding-clause->rhs-match
   [message clause]
@@ -678,20 +670,12 @@
         binding     (key-matches-with-binding-clause-binding clause)]
     `[~(symbol binding) (get-in ~message [~(convert-path-element key)] ~match-value)]))

-(defn key-matches-without-binding-clause->rhs-match
-  [message clause]
-  `[])
-
 (defn path-matches-with-binding-clause->rhs-match
   [message clause]
   (let [path        (path-matches-with-binding-clause-path clause)
         match-value (matcher-default-value (path-matches-with-binding-clause-matcher clause))
         binding     (path-matches-with-binding-clause-binding clause)]
     `[~(symbol binding) (get-in ~message ~(mapv convert-path-element path) ~match-value)]))
-
-(defn path-matches-without-binding-clause->rhs-match
-  [message clause]
-  `[])

 (defn matcher->value
   "Takes a `matcher` and returns the value/s it matches on.
@@ -816,25 +800,25 @@
     (conj bindings (key-exists-with-binding-clause->rhs-match message clause))

     (key-exists-without-binding-clause? clause)
-    (conj bindings (key-exists-without-binding-clause->rhs-match message clause))
+    (conj bindings `[])

     (path-exists-with-binding-clause? clause)
     (conj bindings (path-exists-with-binding-clause->rhs-match message clause))

     (path-exists-without-binding-clause? clause)
-    (conj bindings (path-exists-without-binding-clause->rhs-match message clause))
+    (conj bindings `[])

     (key-matches-with-binding-clause? clause)
     (conj bindings (key-matches-with-binding-clause->rhs-match message clause))

     (key-matches-without-binding-clause? clause)
-    (conj bindings (key-matches-without-binding-clause->rhs-match message clause))
+    (conj bindings `[])

     (path-matches-with-binding-clause? clause)
     (conj bindings (path-matches-with-binding-clause->rhs-match message clause))

     (path-matches-without-binding-clause? clause)
-    (conj bindings (path-matches-without-binding-clause->rhs-match message clause))
+    (conj bindings `[])

     (optional-clause? clause)
     (clause->rhs message bindings (optional-clause-clause clause))))


For videos, show the play icon and a link to the video in single submission info.

Signed-off-by: Njagi Mwaniki <b6a4ba60ad861b9c9afb6daea7294be4be68f44c@urbanslug.com>

--- src/hatti/ona/forms.cljs
+++ src/hatti/ona/forms.cljs
@@ -189,7 +189,9 @@
                                      %s </a>" image fname)
                              (nil? thumb) answer
                              :else [:a {:href image :target "_blank"}
-                                    [:img {:width "80px" :src thumb}]]))
+                                    (if (image? field)
+                                      [:img {:width "80px" :src thumb}]
+                                      [:span [:i.fa.fa-play] "  " fname])]))
      (osm? field) (when answer
                     (let [kw->name name ; aliasing before overriding name
                           {:keys [name type osm-id]} answer


remove some duplication

remove some duplication

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/aurora/runtime/core.cljs
+++ src/aurora/runtime/core.cljs
@@ -242,15 +242,16 @@
                                    ]
                       :rules [
                               [(rule {:name "todo" :id id :text text :order order}
-                                     {:name "todo-done" :id id :done? "false"}
-                                     (+s (hiccup
-                                           [:input {:id (str "todo-checkbox" id) :event-key "todo-checkbox" :entity id :checked "" :events ["onChange"] :type "checkbox"}]))
+                                     (+s (hiccup
+                                           [:input {:id (str "todo-checkbox" id)
+                                                    :event-key "todo-checkbox"
+                                                    :entity id
+                                                    :events ["onChange"]
+                                                    :type "checkbox"}]))
                                      (+ {:name :ui/child :id (str "todo" id) :child (str "todo-checkbox" id) :pos -1}))
                                (rule {:name "todo" :id id :text text :order order}
                                      {:name "todo-done" :id id :done? "true"}
-                                     (+s (hiccup
-                                           [:input {:id (str "todo-checkbox" id) :event-key "todo-checkbox" :entity id :checked "checked" :events ["onChange"] :type "checkbox"}]))
-                                     (+ {:name :ui/child :id (str "todo" id) :child (str "todo-checkbox" id) :pos -1}))]
+                                     (+ {:name :ui/attr :id id :attr "checked" :value "checked"})) ]
                               [(rule {:name "todo" :id id :text text :order order}
                                      {:name "todo-editing" :id id :editing? "false"}
                                      (+s (hiccup


s/unifyc/unify/

s/unifyc/unify/

--- src/babel/english/writer.clj
+++ src/babel/english/writer.clj
@@ -12,7 +12,7 @@
                    fill-language-by-spec
                    process write-lexicon reload]])
 (require '[clojure.tools.logging :as log])
-(require '[dag_unify.core :refer (fail? get-in strip-refs unifyc)])
+(require '[dag_unify.core :refer (fail? get-in strip-refs unify)])

 (defn rewrite-lexicon []
   (write-lexicon "en" @lexicon))
@@ -32,7 +32,7 @@
         ;; {:synsem {:sem {:pred :arrive}}}

         spec (if root
-               (unifyc spec
+               (unify spec
                       (language-to-root-spec source-language-short-name root))
                spec)

@@ -150,21 +150,21 @@
                    (let [root-form (get-in verb [:english :english])]
                      (log/debug (str "generating from root-form:" root-form))
                      (.size (map (fn [tense]
-                                   (let [spec (unifyc {:root {:english {:english root-form}}}
+                                   (let [spec (unify {:root {:english {:english root-form}}}
                                                      tense)]
                                      (.size
                                       (map (fn [gender]
-                                             (let [spec (unifyc spec
+                                             (let [spec (unify spec
                                                                {:comp {:synsem {:agr gender}}})]
                                                (log/trace (str "generating from gender: " gender))
                                                (.size
                                                 (map (fn [person]
-                                                       (let [spec (unifyc spec
+                                                       (let [spec (unify spec
                                                                          {:comp {:synsem {:agr {:person person}}}})]
                                                          (log/trace (str "generating from person: " person))
                                                          (.size
                                                           (map (fn [number]
-                                                                 (let [spec (unifyc spec
+                                                                 (let [spec (unify spec
                                                                                {:comp {:synsem {:agr {:number number}}}})]
                                                                    (write-one spec)))
                                                                [:sing :plur]))))


fix rook premove

fix rook premove

--- src/chessground/premove.cljs
+++ src/chessground/premove.cljs
@@ -25,7 +25,7 @@
 (defn- queen [p1 p2] (or (bishop p1 p2) (rook p1 p2)))

 (defn- rook-files-of [ch color]
-  (map (comp common/file->pos first first)
+  (map #(->> % first first (aget common/file-numbers))
        (filter (fn [[k p]] (and (= (:role p) "rook")
                                 (= (:color p) color))) ch)))


Add an impl of cljs.repl/IPrintStackTrace printing original files

Worth a try seeing if this is useful... previously files in output
directory were referenced.

--- Clojure/src/ambly/repl/jsc.clj
+++ Clojure/src/ambly/repl/jsc.clj
@@ -187,6 +187,11 @@
   repl/IParseStacktrace
   (-parse-stacktrace [this stacktrace error opts]
     (raw-stacktrace->canonical-stacktrace stacktrace opts))
+  cljs.repl/IPrintStacktrace
+  (-print-stacktrace [repl-env stacktrace error build-options]
+    (doseq [{:keys [function file url line column]}
+            (cljs.repl/mapped-stacktrace stacktrace build-options)]
+      (println "\t" (str function " (" (str (or url file)) ":" line ":" column ")"))))
   repl/IJavaScriptEnv
   (-setup [this opts]
     (setup this opts))


client-sha no longer a param to bing/translate!

--- src/tranjlator/bing.clj
+++ src/tranjlator/bing.clj
@@ -101,38 +101,33 @@
     res)) ; datomic lookups won't have a status key -- return res

 (defn translate!
-  ([text from to text-sha db]
-     (translate! (access-token) text from to text-sha db))
-  ([access-token text from to text-sha db]
+  ([text from to db]
+     (translate! (access-token) text from to db))
+  ([access-token text from to db]
      (log/info "entering translate!")
-     (let [result-chan (chan 1)]
+     (let [result-chan (chan 1)
+           sha (sha-bytes text)]
        (go
-         (when (not= text-sha (-> text sha-bytes bin->hex))
-           (log/warn "Mismatch between client SHA and our computed SHA for text."
-                     {:text text
-                      :client-sha text-sha
-                      :server-sha (-> text sha-bytes bin->hex)}))
-         (let [text-sha (hex->bin text-sha)]
-           (if-let [[trans org-sha trans-sha :as resp] (<! (db-lookup-translation (:conn db) text-sha from to))]
-             (do (log/info "Datomic translation:" resp)
-                 (>! result-chan  resp))
-             (do
-               (log/info "Querying Microsoft translation service..")
-               (http/get "http://api.microsofttranslator.com/v2/Http.svc/Translate"
-                         {:headers {"Authorization" (str "Bearer " (if (extends? impl/ReadPort (type access-token))
-                                                                     (:token (<! access-token))
-                                                                     access-token))}
-                          :query-params {:text text
-                                         :from (name from)
-                                         :to   (name to)}}
-                         #(let [trans (parse-translation %)
-                                trans-sha (sha-bytes trans)
-                                _ (log/info "Bing translation:" [trans trans-sha])
-                                tx-data (translation-tx text text-sha from to trans trans-sha)]
-                            (when trans
-                              (log/info "transacting:" tx-data)
-                              @(d/transact (:conn db)  tx-data))
-                            (a/put! result-chan [trans text-sha trans-sha])))))))
+         (if-let [[trans org-sha trans-sha :as resp] (<! (db-lookup-translation (:conn db) sha from to))]
+           (do (log/info "Datomic translation:" resp)
+               (>! result-chan  resp))
+           (do
+             (log/info "Querying Microsoft translation service..")
+             (http/get "http://api.microsofttranslator.com/v2/Http.svc/Translate"
+                       {:headers {"Authorization" (str "Bearer " (if (extends? impl/ReadPort (type access-token))
+                                                                   (:token (<! access-token))
+                                                                   access-token))}
+                        :query-params {:text text
+                                       :from (name from)
+                                       :to   (name to)}}
+                       #(let [trans (parse-translation %)
+                              trans-sha (sha-bytes trans)
+                              _ (log/info "Bing translation:" [trans trans-sha])
+                              tx-data (translation-tx text sha from to trans trans-sha)]
+                          (when trans
+                            (log/info "transacting:" tx-data)
+                            @(d/transact (:conn db)  tx-data))
+                          (a/put! result-chan [trans sha trans-sha]))))))
        result-chan)))

@@ -152,7 +147,6 @@
                                                                         (:content msg)
                                                                         (keyword (:language msg))
                                                                         (:language this)
-                                                                        (:content-sha msg)
                                                                         db))]
                          (>! out-chan (->translation language
                                                      trans


Correctly refer to regex type in CLJS.

Correctly refer to regex type in CLJS.

Before it thought the type was com.rpl.specter/RegExp - but it's
actually js/RegExp.

--- src/clj/com/rpl/specter.cljc
+++ src/clj/com/rpl/specter.cljc
@@ -1170,7 +1170,7 @@
   ImplicitNav
   (implicit-nav [this] (pred this)))

-(extend-type #?(:clj java.util.regex.Pattern :cljs RegExp)
+(extend-type #?(:clj java.util.regex.Pattern :cljs js/RegExp)
   ImplicitNav
   (implicit-nav [this] (n/regex* this)))


Remove unused reference to session-hierarchy state

--- src/cljc/precept/schema.cljc
+++ src/cljc/precept/schema.cljc
@@ -96,7 +96,6 @@
     (swap! h derive :one-to-many :all)
     (swap! h derive :unique-value :one-to-one)
     (swap! h derive :unique-identity :one-to-one)
-    (reset! state/session-hierarchy h)
     @h))

 (defn init!


Updated about text.

Updated about text.

--- src/cljs/bookmarx/about.cljs
+++ src/cljs/bookmarx/about.cljs
@@ -16,8 +16,7 @@
     [:div "On the front-end it is using " [:a {:href "https://reagent-project.github.io/"} "Reagent"]
     ", which is a ClojureScript wrapper for the "
     [:a {:href "https://facebook.github.io/react/"} "React"] " user interface framework. The user interface style is the ubiquitous " [:a {:href "http://getbootstrap.com"} "Bootstrap"]
-    " framework. On the back-end it is using " [:a {:href "http://www.datomic.com"} "Datomic"]
-    ", backed by a " [:a {:href "http://www.mysql.com"} "MySql"] " database, for persistence."]
+    " framework. On the back-end it is using " [:a {:href "https://redis.io"} "Redis"] " for persistence."]
    [:p]
    [:div "The icons in this application are from " [:a {:href "http://glyphicons.com"} "Gylphicons"] " which are part of the Bootstrap framework."]
    [:p]


comment

comment

--- src/cljs/triboard/ai/ai.cljs
+++ src/cljs/triboard/ai/ai.cljs
@@ -31,6 +31,8 @@
   (into {}
     (map (fn [point] [point (compute-cell-strength board point)]))
     cst/all-positions))
+
+;; TODO - Simplify the code to have a score function (compute the score, and look at your best choice)

 (defn- move-strength
   "Compute the strength of a move, based on the converted cells"