Fix piggieback parent link

Fix piggieback parent link

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -211,23 +211,23 @@
       (when (pm/osx? plan)
         (-> plan :osx :template :name)))))

-(defn parent-plan-name [plan]
-  [:em (:org_name plan)])
-
-(defn plans-piggieback-plan-notification [plan current-org-name current-org-vcs-type]
+(defn plans-piggieback-plan-notification [{{parent-name :name
+                                            parent-vcs-type :vcs_type} :org
+                                           :as plan}
+                                          current-org-name]
   [:div.row-fluid
    [:div.offset1.span10
     [:div.alert.alert-success
      [:p
-      "This organization is covered under " (parent-plan-name plan) "'s plan which has " (piggieback-plan-wording plan)]
+      "This organization is covered under " [:em parent-name] "'s plan which has " (piggieback-plan-wording plan)]
      [:p
-      "If you're an admin in the " (parent-plan-name plan)
+      "If you're an admin in the " parent-name
       " organization, then you can change plan settings from the "
-      [:a {:href (routes/v1-org-settings-path {:org (:org_name plan)
-                                               :vcs_type current-org-vcs-type})}
-       (:org_name plan) " plan page"] "."]
+      [:a {:href (routes/v1-org-settings-path {:org parent-name
+                                               :vcs_type parent-vcs-type})}
+       parent-name " plan page"] "."]
      [:p
-      "You can create a separate plan for " [:em current-org-name] " when you're no longer covered by " (parent-plan-name plan) "."]]]])
+      "You can create a separate plan for " [:em current-org-name] " when you're no longer covered by " [:em parent-name] "."]]]])

 (defn plural-multiples [num word]
   (if (> num 1)


(maint) Fix docstring

(maint) Fix docstring

--- src/puppetlabs/pcp/broker/core.clj
+++ src/puppetlabs/pcp/broker/core.clj
@@ -602,7 +602,7 @@
 ;;

 (defn- on-connect!
-  "OnMessage WebSocket event handler. Close the WebSocket connection if the
+  "OnOpen WebSocket event handler. Close the WebSocket connection if the
    Broker service is not running or if the client common name is not obtainalbe
    from its cert. Otherwise set the idle timeout of the WebSocket connection
    to 15 min."


IMMUTANT-568: no concurrent exec option

IMMUTANT-568: no concurrent exec option

--- scheduling/src/immutant/scheduling.clj
+++ scheduling/src/immutant/scheduling.clj
@@ -182,5 +182,11 @@
   "If true (the default), only one instance of a given job name will
    run in a cluster. See [[schedule]].")

+(defoption ^{:arglists '([boolean] [m boolean])} allow-concurrent-exec?
+  "If true (the default), the job is allowed to run concurrently.
+   If false it will be forced to run sequentially on one machine.
+   To disallow concurrent execution cluster wide make sure to also
+   set `(singleton true)`. See [[singleton]].")
+
 (defoption ^{:arglists '([str] [m str])} id
   "Takes a String or keyword to use as the unique id for the job. See [[schedule]].")


add "l'" -> "il" rule

add "l'" -> "il" rule

--- src/babel/italiano/morphology/determiners.cljc
+++ src/babel/italiano/morphology/determiners.cljc
@@ -13,4 +13,11 @@
     :u {:synsem {:cat :det
                  :agr {:number :sing
                        :gender :fem}}}}
+
+   {:p [#"^l$" "il"] ;; "l'" -> "il"
+    :u {:synsem {:cat :det
+                 :agr {:number :sing
+                       :gender :masc}}}}
+
+
    ])


Fixed MathJax render on mount

Fixed MathJax render on mount

fixes #104

--- src/clj/pinkgorilla/worksheet/free_output.cljs
+++ src/clj/pinkgorilla/worksheet/free_output.cljs
@@ -12,27 +12,26 @@
   (let [prev-uuid (uuid/uuid-string (uuid/make-random-uuid))
         prev-div-kw (keyword (str "div#" prev-uuid))
         segment (subscribe [:segment-query seg-id])
-        is-active (subscribe [:is-active-query seg-id])]
+        is-active (subscribe [:is-active-query seg-id])
+        init-fn (partial init-cm!
+                         seg-id
+                         (get-in content [:type])
+                         editor-options)]
     (reagent/create-class
-     {:component-did-mount  (fn [this]
-                              (when active
+     {:display-name         "free-output"
+      :component-did-mount  (fn [this]
+                              (if active
                                 (do
-                                  ((partial init-cm!
-                                            seg-id
-                                            (get-in content [:type])
-                                            editor-options) this)
-                                  (focus-active-segment this true))))
-      :display-name         "free-output"
+                                  (init-fn this)
+                                  (focus-active-segment this true))
+                                (queue-mathjax-rendering (name seg-id))))
       :component-did-update (fn [this]
                               (if @is-active
                                 (do
                                   (let [text-area (-> (reagent/dom-node this)
                                                       (sel1 :textarea))]
                                     (when-not (= "none" (.. text-area -style -display))
-                                      ((partial init-cm!
-                                                seg-id
-                                                (get-in content [:type])
-                                                editor-options) this)))
+                                      (init-fn this)))
                                   (focus-active-segment this true))
                                 (queue-mathjax-rendering prev-uuid)
                                 #_(let [el (gdom/getElement prev-uuid)])))


Update board.cljs

Update board.cljs

--- src/cljs/back_channeling/components/board.cljs
+++ src/cljs/back_channeling/components/board.cljs
@@ -394,7 +394,7 @@
           :style {:margin-top "66px"
                   :width "874px"
                   :background-color "#ffffff"
-                  :z-index 1}})
+                  :z-index "1"}})
         (for [tab tabs]
           [:a.item (merge {:on-click (fn [_]
                                (set! (.-href js/location)


Update hello-world version to the latest release.

--- examples/hello-world/project.clj
+++ examples/hello-world/project.clj
@@ -1,7 +1,7 @@
-(defproject hello-world "0.20.0-SNAPSHOT"
+(defproject hello-world "0.20.0"
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.9.0"]
-                 [uncomplicate/neanderthal "0.20.0-SNAPSHOT"]]
+                 [uncomplicate/neanderthal "0.20.0"]]
   :exclusions [[org.jcuda/jcuda-natives :classifier "apple-x86_64"]
                [org.jcuda/jcublas-natives :classifier "apple-x86_64"]])


[#1450] Hide big chunk of data on `print`

--- backend/src/akvo/lumen/postgres.clj
+++ backend/src/akvo/lumen/postgres.clj
@@ -83,6 +83,14 @@

 (defrecord Geopoint [wkt-string])

+(defmethod clojure.core/print-method Geopoint
+     [system ^java.io.Writer writer]
+  (.write writer "#<Geopoint>"))
+
+(defmethod clojure.core/print-method Geoshape
+     [system ^java.io.Writer writer]
+     (.write writer "#<Geoshape>"))
+
 (extend-protocol p/CoerceToSql
   java.lang.String
   (coerce [value] value)


don't accidentally unsub from a doc

don't accidentally unsub from a doc

--- src-cljs/frontend/controllers/navigation.cljs
+++ src-cljs/frontend/controllers/navigation.cljs
@@ -91,7 +91,8 @@
   (let [sente-state (:sente current-state)
         doc-id (:document/id current-state)]
     (when-let [prev-doc-id (:document/id previous-state)]
-      (sente/send-msg (:sente current-state) [:frontend/unsubscribe {:document-id prev-doc-id}]))
+      (when (not= prev-doc-id doc-id)
+        (sente/send-msg (:sente current-state) [:frontend/unsubscribe {:document-id prev-doc-id}])))
     (sente/subscribe-to-document sente-state doc-id)
     ;; TODO: probably only need one listener key here, and can write a fn replace-listener
     (d/unlisten! (:db previous-state) (:db-listener-key previous-state))


Fix text scraping

Fix text scraping

Scraped text was joined into one text without white spaces between
sentences. This caused some streets to be saved incorrectly. For example
"NOVI SADSvetozara Miletica".

--- src/servisne_info/scrape/ns_rs.clj
+++ src/servisne_info/scrape/ns_rs.clj
@@ -17,9 +17,9 @@
 ; Public

 (defn info-page-content [html]
-  (apply str
-         (map s/trim
-              (en/select html [:div#content en/text-node]))))
+  (s/join ""
+          (map s/trim
+               (en/select html [:div#content en/text-node]))))

 (defn info-page [html]
   {:title (info-page-title html)


speed reasonable when js minified and without dev or logging (cljs not optimised yet)

--- src/shared/gesture_responders.cljs
+++ src/shared/gesture_responders.cljs
@@ -26,8 +26,8 @@
     (let [y0 (aget gesture-state "y0")
           y1 (aget gesture-state "moveY")
           ]
-      ;(prn "y0 = " y0 " y1 = " y1 " factor = " (clamp [1 10] (inc (/ (- y0 y1) (- y0 400)))) " scale = " @(:scale state))
-      (reset! (:scale state) (clamp [1 10] (* @(:scale0 state) (inc (/ (- y0 y1) (- y0 400)))))))))
+      ;(prn "y0 = " y0 " y1 = " y1 " factor = " (clamp [1 10] (inc (/ (- y0 y1) (- y0 700)))) " scale = " @(:scale state))
+      (reset! (:scale state) (clamp [1 10] (* @(:scale0 state) (inc (/ (- y0 y1) (- 700 y0)))))))))

 ;;;
 ;; The pan responder mixin is a Rum mixin based on https://facebook.github.io/react-native/docs/panresponder.html.


Allow input to trigger event after a delay

Signed-off-by: Julien Eluard <c768e13f1ba4c3ebed2909a1fc1e4b50bb021a2f@gmail.com>

--- src/status_im/extensions/core.cljs
+++ src/status_im/extensions/core.cljs
@@ -301,13 +301,26 @@
   [button/secondary-button (merge {:disabled? (or (when (contains? m :enabled) (or (nil? enabled) (false? enabled))) disabled)}
                                   (when on-click {:on-press #(re-frame/dispatch (on-click {}))})) label])

-(defn input [{:keys [keyboard-type style on-change placeholder placeholder-text-color]}]
+(defn on-input-change-text [on-change value]
+  (re-frame/dispatch (on-change {:value value})))
+
+(defn- on-input-change-text-delay [current on-change value delay]
+  ;; If an input change handler has been already scheduled cancel it.
+  (when-let [id @current]
+    (js/clearTimeout id))
+  (reset! current (js/setTimeout #(on-input-change-text on-change value) delay)))
+
+(defn input [{:keys [keyboard-type style on-change change-delay placeholder placeholder-text-color]}]
   [react/text-input (merge {:placeholder placeholder}
                            (when placeholder-text-color {:placeholder-text-color placeholder-text-color})
                            (when style {:style style})
                            (when keyboard-type {:keyboard-type keyboard-type})
                            (when on-change
-                             {:on-change-text #(re-frame/dispatch (on-change {:value %}))}))])
+                             {:on-change-text
+                              (if change-delay
+                                (let [current (atom nil)]
+                                  #(on-input-change-text-delay current on-change % change-delay))
+                                #(on-input-change-text on-change %))}))])

 (defn touchable-opacity [{:keys [style on-press]} & children]
   (into [react/touchable-opacity (merge (when on-press {:on-press #(re-frame/dispatch (on-press {}))})
@@ -369,7 +382,7 @@
                 'touchable-opacity  {:value touchable-opacity :properties {:on-press :event}}
                 'icon               {:value icon :properties {:key :keyword :color :any}}
                 'image              {:value image :properties {:uri :string :source :numeric}}
-                'input              {:value input :properties {:on-change :event :placeholder :string :keyboard-type :keyword :placeholder-text-color :any}}
+                'input              {:value input :properties {:on-change :event :change-delay :number :placeholder :string :keyboard-type :keyword :placeholder-text-color :any}}
                 'button             {:value button :properties {:enabled :boolean :disabled :boolean :on-click :event}}
                 'link               {:value link :properties {:uri :string}}
                 'list               {:value list :properties {:data :vector :item-view :view :key? :keyword}}


State Clapping Music directly, without bothering with canon.

--- src/african_polyphony_and_polyrhythm/talk.clj
+++ src/african_polyphony_and_polyrhythm/talk.clj
@@ -1,7 +1,6 @@
 (ns african-polyphony-and-polyrhythm.talk
   (:require [overtone.live :refer :all :exclude [stop scale]]
             [leipzig.melody :refer :all]
-            [leipzig.canon :refer [canon]]
             [leipzig.scale :refer [scale high low from]]
             [leipzig.live :as live]
             [leipzig.live :refer [stop]]))
@@ -128,19 +127,23 @@
 ; Clapping Music ;
 ;;;;;;;;;;;;;;;;;;

-(defn clapping-music []
-  (let [ostinato #(rand-variations [%])
-        african-bell-pattern (rhythm [1/8 1/8 1/4 1/8 1/4 1/4 1/8 1/4])]
-    (->> african-bell-pattern ostinato (all :part :mother)
-         (canon #(->> % (take 32) (then (rhythm [1/8])) ostinato (all :part :child))))))
+(defn clapping-music
+  "Steve Reich's 'Clapping Music'"
+  []
+  (let [african-bell-pattern (rhythm [1/8 1/8 1/4 1/8 1/4 1/4 1/8 1/4])
+        ostinato #(rand-variations [%])]
+    (with
+      (->> african-bell-pattern
+           ostinato
+           (all :part :mother))
+      (->> african-bell-pattern
+           (times 4)
+           (then (rhythm [1/8]))
+           ostinato
+           (all :part :child)))))

 (comment
   (live/play (clapping-music)))
-
-
-
-
-


Don't generate screen contents eagerly - speeds up seeking

--- src/asciinema/player/format/asciicast_v1.cljs
+++ src/asciinema/player/format/asciicast_v1.cljs
@@ -25,18 +25,12 @@
 (defn- vt-cursor [vt]
   (-> vt :screen screen/cursor))

-(defn- vt->map [vt]
-  {:lines (vt-lines vt)
-   :cursor (vt-cursor vt)})
-
 (defn build-v1-frames [{:keys [stdout width height]}]
   (let [vt (vt/make-vt width height)]
     (->> stdout
          frames/to-absolute-time
          (frames/at-hz 30 #(.concat %1 %2))
-         (reductions reduce-vt [0 vt])
-         (frames/map-frame-data vt->map)
-         frames/skip-duplicates)))
+         (reductions reduce-vt [0 vt]))))

 (s/defn initialize-asciicast
   [asciicast :- AsciicastV1]


Fix definition of context? for new defrecord classes

--- src/main/clojure/com/stuartsierra/lazytest.clj
+++ src/main/clojure/com/stuartsierra/lazytest.clj
@@ -51,7 +51,7 @@
 (defrecord Context [parents before after])

 (defn context? [x]
-  (isa? (type x) ::Context))
+  (isa? (type x) Context))

 (defn- open-context
   "Opens context c, and all its parents, unless it is already active."


Add type hints to avoid reflection

Add type hints to avoid reflection

This is especially important in `input-stream-to-byte-array`, where the
previous code invoked reflection once per character in the input stream.
The hint in `do-decode` is really just to eliminate the only other
reflection call in the namespace so that it can be run with
`*warn-on-reflection*` without any warnings.

--- src/clj/puppetlabs/trapperkeeper/rpc/wire.clj
+++ src/clj/puppetlabs/trapperkeeper/rpc/wire.clj
@@ -2,14 +2,15 @@
   (:require [clojure.java.io :as io]
             [cognitect.transit :as transit]
             [ring.util.response :refer [response header]])
-  (:import [java.io ByteArrayInputStream ByteArrayOutputStream]))
+  (:import [java.io ByteArrayInputStream ByteArrayOutputStream InputStream]))

-(defn input-stream-to-byte-array [stream]
-  (let [byte-vector (loop [s stream bv []]
-                      (let [next-byte (.read s)]
+(defn input-stream-to-byte-array
+  [^InputStream stream]
+  (let [byte-vector (loop [bv []]
+                      (let [next-byte (.read stream)]
                         (if (= -1 next-byte)
                           bv
-                          (recur s (conj bv next-byte)))))]
+                          (recur (conj bv next-byte)))))]
     (byte-array byte-vector)))

 (defprotocol RPCSerialization
@@ -30,7 +31,7 @@
 (defn do-decode [data & [wire-format]]
   (let [wire-format (or wire-format :msgpack)
         in (ByteArrayInputStream. (if (instance? java.lang.String data)
-                                    (.getBytes data)
+                                    (.getBytes ^String data)
                                     (input-stream-to-byte-array data)))
         reader (transit/reader in wire-format)]
     (transit/read reader)))


fix: indentation

fix: indentation

--- src/cljs/expense_tracker/transaction/add.cljs
+++ src/cljs/expense_tracker/transaction/add.cljs
@@ -64,32 +64,32 @@
                                       conj (atom (new-trans to-from))))
             (datepicker [e] (.datepicker (jq/$ "#trans-date")))
             (snn [e] (let [date (let [d (u/trim-empty? app-state
-                                                      (.-value (u/by-id "trans-date"))
-                                                      :date)
-                                     dt (u/jq->long d)]
-                                 (if (= dt "Invalid date") d dt))
-                          desc (u/trim-empty? app-state (.-value (u/by-id "trans-desc")) :desc)]
-                      (cond (or (zero? (:to @app-state))
-                                (zero? (:from @app-state))
-                                (not (amt-equal)))
-                            (u/alert "Amounts in both \"to\" and \"from\"
+                                                       (.-value (u/by-id "trans-date"))
+                                                       :date)
+                                      dt (u/jq->long d)]
+                                  (if (= dt "Invalid date") d dt))
+                           desc (u/trim-empty? app-state (.-value (u/by-id "trans-desc")) :desc)]
+                       (cond (or (zero? (:to @app-state))
+                                 (zero? (:from @app-state))
+                                 (not (amt-equal)))
+                             (u/alert "Amounts in both \"to\" and \"from\"
 accounts should be the same,
 and not-equal-to ZERO")
-                            (= date "")
-                            (u/alert "Date field cannot be empty!")
-                            (let [accs (mapv #(:acc @%) (:trans @app-state))]
-                              (not (= accs (into [] (into #{} accs)))))
-                            (u/alert "The same account cannot appear
+                             (= date "")
+                             (u/alert "Date field cannot be empty!")
+                             (let [accs (mapv #(:acc @%) (:trans @app-state))]
+                               (not (= accs (into [] (into #{} accs)))))
+                             (u/alert "The same account cannot appear
 more than once in a transaction!")
-                            :else
-                            (do #_(println @g/transactions)
-                                (swap! g/transactions conj
-                                       (conj @app-state {:id (count @g/transactions)
-                                                         :date date
-                                                         :desc desc}))
-                                #_(println @g/transactions)
-                                (update-accounts (:trans @app-state))
-                                (reset! app-state (new-state))))))
+                             :else
+                             (do #_(println @g/transactions)
+                                 (swap! g/transactions conj
+                                        (conj @app-state {:id (count @g/transactions)
+                                                          :date date
+                                                          :desc desc}))
+                                 #_(println @g/transactions)
+                                 (update-accounts (:trans @app-state))
+                                 (reset! app-state (new-state))))))
             (snd [e] (when (snn e) (reset! g/app-page {:page :home})))]
       [:div [:datalist {:id "acc-names"}
              (for [an (au/accs->names @g/accounts)]


show times for last 7 days

show times for last 7 days

--- src/cljs/iwaswhere_web/ui/entry/briefing.cljs
+++ src/cljs/iwaswhere_web/ui/entry/briefing.cljs
@@ -51,7 +51,7 @@
            [:hr]
            [horizontal-bar stories :story-name time-by-story y-scale]
            (for [[story v] (:time-by-story day-stats)]
-             (let [story-name (or (:story-name (get stories story)) "No story")]
+             (let [story-name (or (:story-name (get stories story)) "none")]
                ^{:key story}
                [:div
                 [:span.legend
@@ -60,7 +60,7 @@
            [:hr]
            [horizontal-bar books :book-name time-by-book y-scale]
            (for [[book v] (:time-by-book day-stats)]
-             (let [book-name (or (:book-name (get books book)) "No book")]
+             (let [book-name (or (:book-name (get books book)) "none")]
                ^{:key book}
                [:div
                 [:span.legend
@@ -87,7 +87,8 @@
                   updated (assoc-in entry [:briefing :time-allocation book] s)]
               (put-fn [:entry/update-local updated]))))]
     (fn briefing-render [entry put-fn edit-mode?]
-      (let [{:keys [pomodoro-stats activity-stats task-stats wordcount-stats
+      (let [books @books
+            {:keys [pomodoro-stats activity-stats task-stats wordcount-stats
                     daily-summary-stats media-stats]} @chart-data
             day (-> entry :briefing :day)
             day-stats (get pomodoro-stats day)
@@ -101,7 +102,13 @@
                                      remaining (- allocation actual)]
                                  [k remaining]))
             remaining-times (filter #(pos? (second %))
-                                    (map remaining-mapper time-allocation))]
+                                    (map remaining-mapper time-allocation))
+            last-7-days (->> pomodoro-stats
+                             (map (fn [[k v]] [k (:time-by-book v)]))
+                             (sort-by first)
+                             (take-last 7)
+                             (map second)
+                             (apply merge-with +))]
         (when (contains? (:tags entry) "#briefing")
           [:form.briefing-details
            [:fieldset
@@ -123,15 +130,15 @@
                [:strong (:word-count word-stats)] " words written."])
             (when day-stats [time-by-stories-list day-stats])
             [:hr]
-            [:div [horizontal-bar @books :book-name time-allocation 0.0045]]
-            [:div [horizontal-bar @books :book-name remaining-times 0.0045]]
+            [:div [horizontal-bar books :book-name time-allocation 0.0045]]
+            [:div [horizontal-bar books :book-name remaining-times 0.0045]]
             [:div
              "Total planned: "
              [:strong
               (u/duration-string
                 (apply + (map second (-> entry :briefing :time-allocation))))]]
             [:div.story-time
-             (for [[k v] @books]
+             (for [[k v] books]
                (let [allocation (get-in entry [:briefing :time-allocation k] 0)
                      actual (get-in (:time-by-book day-stats) [k] 0)
                      remaining (- allocation actual)]
@@ -149,4 +156,17 @@
                        (when allocation
                          [:span.allocated (u/duration-string allocation)]))
                      (when (pos? remaining)
-                       [:span (u/duration-string remaining)])])]))]]])))))
+                       [:span (u/duration-string remaining)])])]))]
+            [:hr]
+            [:div [horizontal-bar books :book-name last-7-days 0.001]]
+            [:div
+             "Past seven days: "
+             [:strong (u/duration-string (apply + (map second last-7-days)))]]
+            [:div.story-time
+             (for [[book v] last-7-days]
+               (let [book-name (or (:book-name (get books book)) "none")]
+                 ^{:key book}
+                 [:div
+                  [:span.legend
+                   {:style {:background-color (cc/item-color book-name)}}]
+                  [:strong.name book-name] (u/duration-string v)]))]]])))))


refactor color code funcs

refactor color code funcs

--- src/com/billpiel/mem_tracer/string_output.clj
+++ src/com/billpiel/mem_tracer/string_output.clj
@@ -20,17 +20,35 @@
                                                            :class-delimiter [:cyan]
                                                            :class-name      [:cyan]}}))

+
 (defn color-code
-  [n]
-  (str "\033[1;3"
-       (nth [1 3 2 6 4 5] (mod n 6))
+  [& {:keys [fg bg bold]}]
+  (str "\033["
+       (->> [(when (#{true 1} bold)
+               1)
+             (when fg
+               (+ 30 (mod fg 10)))
+             (when bg
+               (+ 40 (mod bg 10)))]
+            (remove nil?)
+            (clojure.string/join ";"))
        "m"))

-(defn background-color-code
+(println (color-code :bold 1 :bg 1) "hi" (color-code))
+
+
+(defn fg-color-code
   [n]
-  (str "\033[4" (mod n 7) "m"))
+  (color-code :fg (nth [1 3 2 6 4 5]
+                       (mod n 6))))

-(def reset-color-code "\033[m")
+(defn bg-color-code
+  [n]
+  (str "\033[4" (mod n 10) "m"))
+
+(println  (apply str (mapcat #(list (background-color-code %) "hi ") (range 0 20) )))
+
+(def reset-color-code (color-code))

 (defn header-indent
   [depth]


speculatively load stripe checkout

speculatively load stripe checkout

--- src-cljs/frontend/components/plan.cljs
+++ src-cljs/frontend/components/plan.cljs
@@ -10,6 +10,7 @@
             [frontend.models.plan :as plan-model]
             [frontend.models.team :as team-model]
             [frontend.sente :as sente]
+            [frontend.stripe :as stripe]
             [frontend.urls :as urls]
             [frontend.utils :as utils]
             [frontend.utils.date :refer (date->bucket)]
@@ -333,10 +334,13 @@

 (defn start [{:keys [plan team-uuid]} owner]
   (reify
-    om/IRender
-    (render [_]
-      (let [{:keys [cast! db]} (om/get-shared owner)
-            ]
+    om/IDidMount
+    (did-mount [_]
+      (when-not (:plan/paid? plan)
+        (stripe/load-checkout)))
+    om/IRender
+    (render [_]
+      (let [{:keys [cast! db]} (om/get-shared owner)]
         (html
          [:div.menu-view
           [:div.divider.make]


Add button to select statement

Add button to select statement

--- src/discuss/components/search/statements.cljs
+++ src/discuss/components/search/statements.cljs
@@ -7,6 +7,7 @@
             [goog.crypt.base64 :as b64]
             [ajax.core :refer [GET]]
             [discuss.specs :as specs]
+            [discuss.translations :refer [translate] :rename {translate t}]
             [discuss.utils.views :as vlib]
             [discuss.parser :as parser]
             [discuss.utils.common :as lib]
@@ -39,9 +40,19 @@
   (let [{:keys [author content aggregate-id]} data]
     (when-not (empty? content)
       (html [:div.bs-callout.bs-callout-info
-             [:span.badge.pull-right aggregate-id]
-             [:p (vlib/safe-html content)]
-             [:p (str "Author: " author)]]))))
+             [:div.row
+              [:div.col-sm-8
+               [:p (vlib/safe-html content)]
+               [:p [:span.btn.btn-sm.btn-primary
+                    {:on-click #(.log js/console "foo")}
+                    (t :search :reuse)]]]
+              [:div.col-sm-4
+               [:div.text-right
+                [:span.label.label-default
+                 (str (t :search :origin) ": " aggregate-id)]
+                [:br]
+                [:span.label.label-default
+                 (str (t :search :author) ": " author)]]]]]))))

 (defui Result
   Object
@@ -77,7 +88,6 @@
   (html [:div
          [:form
           [:div.form-group
-           [:label "Search for Statements"]
            [:input.form-control {:type "text"
                                  :on-change #(search (.. % -target -value))}]]]]))

@@ -89,6 +99,3 @@
 (defn search-query-now
   "Create form to select issue and place the search."
   [_ _] (reify om/IRender (render [_] search-for-statement)))
-
-;; -----------------------------------------------------------------------------
-;; om.now


Add om.now views for search functions

Add om.now views for search functions

--- src/discuss/components/search/statements.cljs
+++ src/discuss/components/search/statements.cljs
@@ -1,13 +1,16 @@
 (ns discuss.components.search.statements
   (:require [sablono.core :as html :refer-macros [html]]
-            [om.next :as om :refer-macros [defui]]
+            [om.core :as om]
+            [om.next :as nom :refer-macros [defui]]
             [clojure.walk :refer [keywordize-keys]]
             [cljs.spec.alpha :as s]
             [goog.crypt.base64 :as b64]
             [ajax.core :refer [GET]]
             [discuss.specs :as specs]
             [discuss.utils.views :as vlib]
-            [discuss.parser :as parser]))
+            [discuss.parser :as parser]
+            [discuss.utils.common :as lib]
+            [om.dom :as dom]))

 (defn- search-results
   "Handler which is called with the results from ElasticSearch. Extract statements
@@ -16,7 +19,8 @@
   (let [results (-> response keywordize-keys :hits :hits)
         data (mapv :_source results)
         statements (filter (partial s/valid? ::specs/statement) data)]
-    (om/transact! parser/reconciler `[(search/results {:results ~statements})])))
+    (lib/update-state-item! :search :results (fn [_] statements))
+    (nom/transact! parser/reconciler `[(search/results {:results ~statements})])))

 (defn search
   "Make a GET request and search in ElasticSearch for the requested data."
@@ -26,33 +30,62 @@
         :headers {"Authorization" (str "Basic " (b64/encodeString "elastic:changeme"))}
         :params {:q (str query "*")}}))

+;; -----------------------------------------------------------------------------
+
+(defn result-html [data]
+  (let [{:keys [author content aggregate-id]} data]
+    (when-not (empty? content)
+      (html [:div.bs-callout.bs-callout-info
+             [:span.badge.pull-right aggregate-id]
+             [:p (vlib/safe-html content)]
+             [:p (str "Author: " author)]]))))
+
 (defui Result
   Object
   (render [this]
-          (let [{:keys [author content aggregate-id]} (om/props this)]
-            (when-not (empty? content)
-              (html [:div.bs-callout.bs-callout-info
-                     [:span.badge.pull-right aggregate-id]
-                     [:p (vlib/safe-html content)]
-                     [:p (str "Author: " author)]])))))
-(def ^:private result (om/factory Result))
+          (result-html (nom/props this))))
+(def ^:private result (nom/factory Result))
+
+(defn- result-now
+  "Show one result of the search engine."
+  [data _owner] (reify om/IRender (render [_] (result-html data))))

 (defui ^:once Results
-  static om/IQuery
+  static nom/IQuery
   (query [this] [:search/results])
   Object
   (render [this]
-          (let [{:keys [search/results]} (om/props this)]
+          (let [{:keys [search/results]} (nom/props this)]
             (html [:div.results (map #(result (merge {:keyfn :id} %)) results)]))))
-(def results (om/factory Results))
+(def results (nom/factory Results))
+
+(defn results-now
+  "Show results from the search."
+  []
+  (reify om/IRender
+    (render [_]
+      (let [results (get-in @lib/app-state [:search :results])]
+        (apply dom/div nil
+               (map #(om/build result-now % (lib/unique-key-dict)) results))))))
+
+;; -----------------------------------------------------------------------------
+
+(def search-for-statement
+  (html [:div
+         [:form
+          [:div.form-group
+           [:label "Search for Statements"]
+           [:input.form-control {:type "text"
+                                 :on-change #(search (.. % -target -value))}]]]]))

 (defui ^:once SearchQuery
   Object
-  (render [this]
-          (html [:div
-                 [:form
-                  [:div.form-group
-                   [:label "Search for Statements"]
-                   [:input.form-control {:type "text"
-                                         :on-change #(search (.. % -target -value))}]]]])))
-(def search-query (om/factory SearchQuery))
+  (render [this] search-for-statement))
+(def search-query (nom/factory SearchQuery))
+
+(defn search-query-now
+  "Create form to select issue and place the search."
+  [_ _] (reify om/IRender (render [_] search-for-statement)))
+
+;; -----------------------------------------------------------------------------
+;; om.now


Zap debug output

Zap debug output

--- src/active/clojure/test_condition.cljc
+++ src/active/clojure/test_condition.cljc
@@ -7,39 +7,21 @@
 #?(:clj
 (defmethod ct/assert-expr 'raised? [?msg ?form]
   (let [[_raised? ?condition-predicate ?expr] ?form]
-    (binding [*out* *err*]
-      (prn       `(c/guard [con#
-                 (~?condition-predicate con#)
-                 (ct/do-report {:type :pass :message ~?msg
-                                :expected ~?condition-predicate})
-
-
-                 :else
-                 (ct/do-report {:type :fail
-                                :message "invalid condition"
-                                :expected (list ~?condition-predicate con#)
-                                :actual (list 'not (list ~?condition-predicate con#))})]
-
-                (let [val# ~?expr]
-                  (ct/do-report {:type :fail
-                                 :message "condition expected"
-                                 :expected ~?condition-predicate
-                                 :actual val#})))))
-      `(c/guard [con#
-                 (~?condition-predicate con#)
-                 (ct/do-report {:type :pass :message ~?msg
-                                :expected ~?condition-predicate})
-
-
-                 :else
-                 (ct/do-report {:type :fail
-                                :message "invalid condition"
-                                :expected (list ~?condition-predicate con#)
-                                :actual (list 'not (list ~?condition-predicate con#))})]
-
-                (let [val# ~?expr]
-                  (ct/do-report {:type :fail
-                                 :message "condition expected"
-                                 :expected ~?condition-predicate
-                                 :actual val#}))))))
+    `(c/guard [con#
+               (~?condition-predicate con#)
+               (ct/do-report {:type :pass :message ~?msg
+                              :expected ~?condition-predicate})
+
+
+               :else
+               (ct/do-report {:type :fail
+                              :message "invalid condition"
+                              :expected (list ~?condition-predicate con#)
+                              :actual (list 'not (list ~?condition-predicate con#))})]
+
+              (let [val# ~?expr]
+                (ct/do-report {:type :fail
+                               :message "condition expected"
+                               :expected ~?condition-predicate
+                               :actual val#}))))))


Refactor member.clj

Refactor member.clj

--- src/clj/rumahsewa141/routes/member.clj
+++ src/clj/rumahsewa141/routes/member.clj
@@ -7,49 +7,47 @@
             [rumahsewa141.views :refer [history-view]]
             [buddy.hashers :as hashers]))

-(defn do-update-user [{{id :id} :identity {:keys [nickname phone_no]} :params}]
-  (if-let [_ (db/update-user!
-              {:id id
-               :nickname nickname
-               :phone_no phone_no})]
-    (layout/render "success.html"
-                   {:title "Done!"
-                    :description "You have updated your info."})))
+(defn do-update-user [{{id :id}                    :identity
+                       {:keys [nickname phone_no]} :params}]
+  (when-let [_ (db/update-user! {:id id
+                                 :nickname nickname
+                                 :phone_no phone_no})]
+    (layout/render "success.html" {:title "Done!"
+                                   :description "You have updated your info."})))

-(defn incorrect-password? [username password]
-  (if-let [user (db/get-user {:username username})]
+(defn- wrong-password? [username password]
+  (when-let [user (db/get-user {:username username})]
     (not (hashers/check password (get user :password)))))

-(defn change-password [{{:keys [id username]} :identity
+(defn- update-password [id new]
+  (when-let [_ (db/change-password! {:id id
+                                     :password (hashers/encrypt new)})]
+    (layout/render "success.html" {:title "Success!"
+                                   :description "Password changed."})))
+
+(defn change-password [{{:keys [id username]}     :identity
                         {:keys [old new confirm]} :params}]
   (cond
-    (not= new confirm) (layout/render "error_message.html"
-                                      {:description
-                                       "Wrong password confirmation."})
-    (incorrect-password? username old) (layout/render "error_message.html"
-                                                      {:description
-                                                       "Wrong password."})
-    :else (when-let [_ (db/change-password!
-                        {:id id
-                         :password (hashers/encrypt new)})]
-            (layout/render "success.html"
-                           {:title "Success!"
-                            :description "Password changed."}))))
+    (not= new confirm) (layout/render "error_message.html" {:description "Wrong password confirmation."})
+    (wrong-password? username old) (layout/render "error_message.html" {:description "Wrong password."})
+    :else (update-password id new)))

-(defn user-bills [{{id :id} :identity}]
+(defn- user-bills [{{id :id} :identity}]
   #(db/get-user-bills {:user_id id}))

-(defn user-info [{{username :username} :identity}]
+(defn- user-info [{{username :username} :identity}]
   #(db/get-user {:username username}))

-(defn transactions-count [{{id :id} :identity}]
+(defn- transactions-count [{{id :id} :identity}]
   #(db/get-transactions-count-by-user {:user_id id}))

-(defn latest-transactions [{{id :id} :identity}]
+(defn- latest-transactions [{{id :id} :identity}]
   #(db/get-latest-transactions-by-user (merge % {:user_id id})))

-(defn member-page [section get-content-fn
-                   {{:keys [username admin]} :identity} & [subsection]]
+(defn member-page [section
+                   get-content-fn
+                   {{:keys [username admin]} :identity}
+                   & [subsection]]
   (if (true? admin)
     (redirect "/admin")
     (layout/render "member.html" (merge {:username username
@@ -68,9 +66,7 @@
        (member-page "history" (history-view (Long/parseLong page)
                                             (transactions-count req)
                                             (latest-transactions req)) req))
-  (GET "/member/settings/profile" req (settings-page "profile"
-                                                     req
-                                                     (user-info req)))
+  (GET "/member/settings/profile" req (settings-page "profile" req (user-info req)))
   (GET "/member/settings/account" req (settings-page "account" req))
   (POST "/settings/profile" req (do-update-user req))
   (POST "/settings/account" req (change-password req)))


Close the event chan on sending the close signal

--- src/cljs/hacker_agent/hacker-base.cljs
+++ src/cljs/hacker_agent/hacker-base.cljs
@@ -68,7 +68,8 @@
                                (js->clj (.val snapshot))]))]
      (.on fbref (clojure.core/name event) handle-event)
      (go (<! close-chan)
-         (.off fbref (clojure.core/name event) handle-event))
+         (.off fbref (clojure.core/name event) handle-event)
+         (close! event-chan))
      event-chan)))

 (defn- id->fb-chan


more easing functions

more easing functions

--- src/cljs/infinitelives/utils/ease.cljs
+++ src/cljs/infinitelives/utils/ease.cljs
@@ -14,10 +14,10 @@

 (def linear-f identity)

-(defn- quad-in-f [t]
+(defn quad-in-f [t]
   (* t t))

-(defn- quad-out-f
+(defn quad-out-f
   "v = -(x-1)^2 + 1
   =>   v = -x^2 + 2x
   =>   v = x * (2-x)"
@@ -25,10 +25,46 @@
   [t]
   (* t (- 2 t)))

-(defn- quad-in-out-f [t]
+(defn quad-in-out-f [t]
   (if (< t 0.5)
     (* 2 t t)
     (+ -1 (* t (- 4 (* 2 t))))))
+
+(defn sine-in-f [t]
+  (- 1 (Math/cos (* t Math/PI 0.5))))
+
+(defn sine-out-f [t]
+  (Math/sin (* t Math/PI 0.5)))
+
+(defn sine-in-out-f [t]
+  (* -0.5 (- (Math/cos (* Math/PI t)) 1)))
+
+(defn cubic-in-f [t]
+  (* t t t))
+
+(defn cubic-out-f [t]
+  (let [t1 (- t 1)]
+    (+ 1 (* t1 t1 t1))))
+
+(defn cubic-in-out-f [t]
+  (if (< t 0.5)
+    (* 4 t t t)
+    (let [2t (* 2 t)
+          2t-2 (- 2t 2)])
+    (+ 1 (* (- t 1) 2t-2 2t-2))))
+
+(defn quart-in-f [t]
+  (* t t t t))
+
+(defn quart-out-f [t]
+  (let [t1 (- t 1)]
+    (- 1 (* t1 t1 t1 t1))))
+
+(defn quart-in-out-f [t]
+  (if (< t 0.5)
+    (* 8 t t t t)
+    (let [t1 (- t 1)]
+      (- 1 (* 8 t1 t1 t1 t1)))))

 (defn- make-ease-fn [func]
   (fn [t b c d]


+TODO

+TODO

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -458,6 +458,9 @@
      :index (create-index grammar (flatten (vals lexicon)) head-principle)}))

 (def medium
+  ;; TODO: remove parse-lexicon.
+  ;; Should not need a separate parse-lexicon here: for debugging,
+  ;; instead add to the lexicon and entry like "_" (as with english/lexicon.clj).
   (let [parse-lexicon
         (into {}
               (for [[k v] lexicon]


gender not needed to be specified for pronouns

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -218,7 +218,8 @@
       (filter-vals
       #(or (not (and (= :noun (get-in % [:synsem :cat]))
                      (= :none (get-in % [:synsem :agr :gender] :none))
-                     (= false (get-in % [:synsem :propernoun] false))))
+                     (= false (get-in % [:synsem :propernoun] false))
+                     (= false (get-in % [:synsem :pronoun] false))))
            (and (log/warn (str "ignoring lexical entry with :cat=:noun but no gender specified: " %))
                 false)))


Gut the server ns

Gut the server ns

--- src/clj/comic_reader/server.clj
+++ src/clj/comic_reader/server.clj
@@ -1,74 +1,34 @@
 (ns comic-reader.server
   (:gen-class)
-  (:require [comic-reader.sites.protocol :refer :all]
-            [comic-reader.sites :refer [sites]]
-            [comic-reader.scrape :as scrape]
-            [comic-reader.util :refer [safe-read-string]]
-            [ring.util.response :as response]
-            [ring.middleware.params :refer [wrap-params]]
+  (:require [compojure.core :as c]
+            [compojure.route :as route]
+            [environ.core :refer [env]]
+            [hiccup.page :as page]
+            [ring.adapter.jetty :refer [run-jetty]]
             [ring.middleware.edn :refer [wrap-edn-params]]
-            [compojure.core  :as c]
-            [compojure.route :as route]
-            [hiccup.page :as hp]
-            [environ.core :refer [env]]
-            [ring.adapter.jetty :refer [run-jetty]]))
+            [ring.middleware.params :refer [wrap-params]]))

 (defn edn-response [data & [status]]
   {:status (or status 200)
    :headers {"Content-Type" "application/edn"}
    :body (pr-str data)})

-(defn gen-error-data [request & {:as others}]
-  (-> request
-      (select-keys [:uri
-                    :request-method
-                    :params])
-      (merge others)))
-
-(defn get-comics-list [{{:keys [site]} :params
-                        :as request}]
-  )
-
-(defn get-comic-chapter [site comic chapter]
-  )
-
-(defn get-following-pages [site comic chapter-map page]
-  )
-
-(defn get-comic-pages [{{:keys [site comic chapter page]} :params
-                        :as request}]
-  (let [site (keyword site)
-        chapter (safe-read-string chapter)
-        page    (safe-read-string page)
-        add-location (fn [idx comic-info]
-                       (assoc comic-info
-                              :chapter chapter
-                              :page (+ page idx)))
-        chapter-map (get-comic-chapter site comic chapter)
-        page-list (get-following-pages site comic
-                                       chapter-map
-                                       page)]
-    (if-let [comic-pages (map-indexed add-location
-                                      page-list)]
-      (edn-response comic-pages)
-      (edn-response (gen-error-data request) 404))))
-
 (c/defroutes routes
-  (c/GET "/" [] (hp/html5
+  (c/GET "/" [] (page/html5
                  [:head
-                  (hp/include-css "css/normalize.css"
-                                  "css/foundation.min.css"
-                                  "css/app.css")
-                  (hp/include-js "js/vendor/modernizr.js")]
+                  (page/include-css "css/normalize.css"
+                                    "css/foundation.min.css"
+                                    "css/app.css")
+                  (page/include-js "js/vendor/modernizr.js")]
                  [:body
                   [:div.row
                    [:div#app.small-12.columns]]
                   [:input#history_state {:type "hidden"}]
-                  (hp/include-js "js/vendor/jquery.js"
-                                 "js/vendor/fastclick.js"
-                                 "js/foundation.min.js"
-                                 "js/compiled/main.js")]))
-  (c/GET "/blank" [] "")
+                  (page/include-js "js/vendor/jquery.js"
+                                   "js/vendor/fastclick.js"
+                                   "js/foundation.min.js"
+                                   "js/compiled/main.js")]))
+
   (c/context "/api/v1" []
     (c/GET "/sites" []
       (edn-response


Modify defcheckers.

Modify defcheckers.

--- src/clj/sally/checkers/core.clj
+++ src/clj/sally/checkers/core.clj
@@ -1,15 +1,40 @@
-(ns sally.checkers.core)
+(ns sally.checkers.core
+  (:require (clojure [string :as s]
+                     [test :refer [are with-test]])))
+
+
+(with-test
+  (defn- sym-to-var-form [sym]
+    (list 'var
+          (symbol (if (.contains (str sym) "/")
+                    sym
+                    (str sym "/check")))))
+  (are [in out] (= (second (sym-to-var-form in)) out)
+       'keeps.var/here 'keeps.var/here
+       'adds.check.to.me 'adds.check.to.me/check))
+
+(with-test
+  (defn- ns-sym-from-sym [sym]
+    (symbol (first (s/split (str sym) #"/"))))
+  (are [in out] (= (ns-sym-from-sym in) out)
+       'hey/there 'hey
+       'some.cool.ns/func 'some.cool.ns))

 (defmacro defcheckers [& checkers]
-  (let [checkers (for [sym checkers] (list 'var sym))]
-    `(def ~'checkers ~(vec checkers))))
+  (let [checker-namespaces (into '() (set (map ns-sym-from-sym checkers)))
+        checker-vars (map sym-to-var-form checkers)]
+    `(defn ~'load-checkers [& {:keys [~'reload] :or {~'reload true}}]
+       (doseq [~'checker-ns '~checker-namespaces]
+         (if ~'reload
+           (require :reload ~'checker-ns)
+           (require ~'checker-ns)))
+       ~(vec checker-vars))))

-(defcheckers)
-
-(defn- invoke-on [v]
-  (fn [f]
-    (f v)))
+(defcheckers
+  sally.checkers.kibit)

 (defn check
-  ([exprs checkers] (map (invoke-on exprs) checkers))
-  ([exprs] (check exprs checkers)))
+  ([checkable checkers]
+   (into {} (for [checker checkers]
+              [checker (checker checkable)])))
+  ([checkable] (check checkable (load-checkers))))


Remove session spec that breaks in CLJS

Remove session spec that breaks in CLJS

--- src/cljc/precept/spec/lang.cljc
+++ src/cljc/precept/spec/lang.cljc
@@ -79,5 +79,5 @@
         :tuple-3 ::tuple-3
         :tuple-4 ::tuple-4))

-(s/def ::session #(= % (type clara.rules.engine/ISession)))
+;(s/def ::session #(= % (type clara.rules.engine/ISession)))


Fix send notifications logging format

Fix send notifications logging format

--- src/servisne_info/tasks/send_notifications.clj
+++ src/servisne_info/tasks/send_notifications.clj
@@ -10,7 +10,7 @@
   (let [streets (join " " (:streets user))
         news (repo/search-news streets)
         unsent-news (filter #(nil? (:sent %)) news)]
-    (println (str "Finding news for user, user=" (:email user) "news_count=" (count unsent-news)))
+    (println (str "Finding news for user, user=" (:email user) " news_count=" (count unsent-news)))
     [user unsent-news]))

 (defn find-news-for-users [users]


removes deleted file

removes deleted file

--- cljs/components/query-response.cljs
+++ cljs/components/query-response.cljs
@@ -1,18 +0,0 @@
-(ns components.queryresponse
-  (:require [antares.core :as antares]))
-
-(def query-response
-  (antares/stateful-component
-   {:ident :query-response
-
-    :render (fn [data]
-              [:div.query-response
-               [:table.ui.table.segment
-                [:thead]
-                [:tbody
-                 (for [row (data :response)]
-                   [:tr
-                    (for [column row]
-                      [:td column])])]]])
-
-    :style []}))


[#10658] "connection is secure" tooltip is not aligned with URL field

Signed-off-by: Andrey Shovkoplyas <b713972e59b8e606e23253c4a13e948139fea4d1@gmail.com>

--- src/status_im/ui/components/tooltip/views.cljs
+++ src/status_im/ui/components/tooltip/views.cljs
@@ -26,9 +26,9 @@
                                                :color color)]]]))

 (views/defview bottom-tooltip-info [label on-close]
-  (views/letsubs [bottom-anim-value (animation/create-value 150)
+  (views/letsubs [bottom-anim-value (animation/create-value 75)
                   opacity-value     (animation/create-value 0)]
-    {:component-did-mount (animations/animate-tooltip 150 bottom-anim-value opacity-value 10)}
+    {:component-did-mount (animations/animate-tooltip 75 bottom-anim-value opacity-value 10)}
     [react/view styles/bottom-tooltip-container
      [react/animated-view {:style (styles/tooltip-animated bottom-anim-value opacity-value)}
       [vector-icons/icon :icons/tooltip-tip (assoc


CMR-1297 Removes println debugging

CMR-1297 Removes println debugging

--- search-app/src/cmr/search/api/routes.clj
+++ search-app/src/cmr/search/api/routes.clj
@@ -260,7 +260,6 @@
         ;; In this case, the Echo-Token header is used in the GET request.
         (OPTIONS "/" req options-response)
         (GET "/" {params :params headers :headers context :request-context}
-             (println "Got query for concept" path-w-extension)
           (find-concept-by-cmr-concept-id context path-w-extension params headers)))

       ;; Find concepts


CMR-3409: Removed whitespace.

CMR-3409: Removed whitespace.

--- search-app/src/cmr/search/api/routes.clj
+++ search-app/src/cmr/search/api/routes.clj
@@ -315,7 +315,7 @@
   (let [relative-root-url (get-in system [:public-conf :relative-root-url])]
     (routes
       (context relative-root-url []
-
+
         ;; Add routes for tagging
         tags-api/tag-api-routes


Added comments on the :data-table format for mvc

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

--- src/conexp/io/many_valued_contexts.clj
+++ src/conexp/io/many_valued_contexts.clj
@@ -47,7 +47,18 @@
         (illegal-argument "File " file " does not contain a many-valued context."))
       (apply make-mv-context mv-ctx))))

-;; Format Data Table
+
+;; Data Table Format
+
+;; Note the following restrictions:
+;;   - we need at least one object and at least two attributes (to
+;;     reliably determine the file type)
+;;   - the first line must contain of the attributes in the correct order
+;;   - if the subsequent lines have the same number of entries as the
+;;     first, the resulting mv-context will have the line number as
+;;     objects,
+;;   - if the subsequent lines have one more element as the first, the first
+;;     entry will be the object for that line

 (add-mv-context-input-format :data-table
                              (fn [rdr]


add test for completing a working reconciliation

--- test/clj_money/models/reconciliations_test.clj
+++ test/clj_money/models/reconciliations_test.clj
@@ -337,6 +337,22 @@
     (is (empty? (validation/error-messages result)) "The item has no validation errors")
     (is (= 1499M (:balance retrieved)) "The retrieved value has the correct balance after update")))

+(deftest attempt-to-complete-a-working-reconciliation-that-is-not-balanced
+  (let [context (serialization/realize storage-spec
+                                       working-reconciliation-context)
+        checking (-> context :accounts first)
+        reconciliation (-> context :reconciliations last)
+        updated (-> reconciliation
+                    (assoc :status :completed)
+                    (update-in [:item-ids] #(conj % (->> context
+                                                         :transactions
+                                                         (mapcat :items)
+                                                         (filter (fn [i] (= (:id checking) (:account-id i))))
+                                                         last
+                                                         :id))))
+        result (reconciliations/update storage-spec updated)]
+    (is (validation/has-error? result :balance))))
+

 ; Test the completion of a working reconciliation
 ; Test that a completed reconciliation cannot be updated


Minor change in usageError function to avoid repeating code.

--- src/app/core.clj
+++ src/app/core.clj
@@ -18,7 +18,9 @@
   "Linter, interactive and query mode are self exclusive")

 (defn usageError [banner opts msg]
-  (println (str "Incorrect usage: " msg))
+  (if (clojure.string/blank? msg)
+    (println (str "Incorrect usage"))
+    (println (str "Incorrect usage: " msg)))
   (when (:errors opts)
     (doseq [e (:errors opts)]
       (println " * " e)))
@@ -73,15 +75,7 @@
       (name2operation (:query opts))
       (nil? (:errors opts)))
     (run opts)
-    ;; The following code block is very similar to the usageError function.
-    ;; Try to call that method to avoid repeating code.
-    (do
-      (println "Incorrect usage")
-      (when (:errors opts)
-        (doseq [e (:errors opts)]
-          (println " * " e)))
-      (println banner)
-      (System/exit 1))))
+    (usageError banner opts "")))

 (defn -main
   [& args]


Minor cleanup

Minor cleanup

--- src/app/core.clj
+++ src/app/core.clj
@@ -145,15 +145,6 @@
           ]
       (.trim (str/join parts)))))

-      ;; (str/join
-      ;;   (interpose
-      ;;     "\n" ; separate each fragment with a newline
-      ;;     (map (fn [tag]
-      ;;            (if (= ASTNode/TEXT_ELEMENT (.getNodeType tag))
-      ;;              (.trim (.getText tag))
-      ;;              (str tag))) ; I guess just toString it?
-      ;;          sections))))))
-
 (defn- extract-javadoc-internal
   "Expects an ITypeBinding and a fn
   to extract the node. This is mostly a convenience


make tls deployment error tests explicit (flaky) (#1469)

--- waiter/integration/waiter/deployment_errors_test.clj
+++ waiter/integration/waiter/deployment_errors_test.clj
@@ -99,7 +99,9 @@
         service-id
         (assert-deployment-error response :cannot-connect)))))

-(deftest ^:parallel ^:integration-slow test-tls-error
+;; Marked explicit because it's flaky in non-test environments.
+;; Grace period and other params may need to be adjusted to fix.
+(deftest ^:parallel ^:integration-slow ^:explicit test-tls-error
   (testing-using-waiter-url
     (let [headers {:x-waiter-name (rand-name)
                    ; wrong backend-proto
@@ -114,7 +116,9 @@
         service-id
         (assert-deployment-error response :tls-error)))))

-(deftest ^:parallel ^:integration-slow test-bad-socket
+;; Marked explicit because it's flaky in non-test environments.
+;; Grace period and other params may need to be adjusted to fix.
+(deftest ^:parallel ^:integration-slow ^:explicit test-bad-socket
   (testing-using-waiter-url
     (let [headers {:x-waiter-name (rand-name)
                    ; wrong backend-proto


Add a test for using two data fields within a data processing function.

--- test/dsbdp/test/data_processing_dsl_tests.clj
+++ test/dsbdp/test/data_processing_dsl_tests.clj
@@ -22,6 +22,11 @@
                8 0 16 0 0 4 -25 -26                                  ; 8 byte UDP header
                97 98 99 100])))                                      ; 4 byte data "abcd"

+
+
+;;;
+;;; Tests for byte array input and various output types.
+;;;
 (deftest byte-array-to-java-map-test
   (let [expected {"udpSrc" 2048, "udpDst" 4096}
         dsl-expression {:output-type :java-map
@@ -60,6 +65,11 @@
         result (data-processing-fn byte-array-test-data 0)]
     (is (= expected result))))

+
+
+;;;
+;;; Tests for more complex data processing definitions/functions.
+;;;
 (deftest byte-array-to-java-map-with-additional-operation-test
   (let [expected {"udpSrc" 1024, "udpDst" 2048}
         dsl-expression {:output-type :java-map
@@ -80,3 +90,12 @@
     (is (= java.util.HashMap (type result)))
     (is (= expected result))))

+(deftest byte-array-to-java-map-with-additional-operation-and-two-data-values-test
+  (let [expected {"quotient" 2}
+        dsl-expression {:output-type :java-map
+                        :rules [['quotient '(/ (int16 52) (int16 50))]]}
+        data-processing-fn (create-data-processing-fn dsl-expression)
+        result (data-processing-fn byte-array-test-data 0)]
+    (is (= java.util.HashMap (type result)))
+    (is (= expected result))))
+


Refactor hello packet round-trip test

Refactor hello packet round-trip test

Make its [de]serialization match the same generation pattern that I got
to work for the Initiate/Vouch packet. The fun part about this approach
is that it worked fine on my first attempt.

--- test/frereth_cp/shared/serialization_test.clj
+++ test/frereth_cp/shared/serialization_test.clj
@@ -22,14 +22,87 @@
   [n]
   (gen/fmap byte-array (gen/vector (gen/choose -128 127) n)))

+(defn check-round-trip
+  [spec template src]
+  ;; And then check all the parts
+  (is (s/valid? spec src))
+  (let [serialized (serial/compose template src)
+        rhs (serial/decompose template serialized)]
+    (doseq [k (keys rhs)]
+      ;; This was a point of confusion for me, because the associated value
+      ;; coming out of data/diff is a vector.
+      ;; It's OK: decompose is producing byte arrays as expected.
+      (is ((complement vector?) (k rhs)) (str "Decomposed a vector under " k)))
+    (if (= src rhs)
+      ;; Round-tripped correctly. We're good.
+      ;; Sadly, this doesn't happen.
+      true
+      ;; This is messy enough that it's worth taking some
+      ;; effort to see what really went wrong.
+      (let [delta (data/diff src rhs)
+            only-in-src (first delta)]
+        ;; I'm getting nils in the vouch wrapper here.
+        ;; Q: How?
+        ;; A: data/diff is recursive. Elements that match
+        ;; in the byte arrays being compared show up as nil.
+        (is (not only-in-src) "Things only in source")
+
+        (is (not (second delta)) "Things only in deserialized")
+
+        ;; Things that are in both
+        (let [real-delta (nth delta 2)
+              matched (= src real-delta)]
+          (or matched  ; Happy path. If this were true, the first (= src rhs) check would have passed
+              (let [src-keys (set (keys src))
+                    dst-keys (set (keys real-delta))]
+                (is (= src-keys dst-keys))
+                (let [comparison
+                      (map (fn [k]
+                             (let [expected (k src)
+                                   actual (k real-delta)
+                                   eql-len (= (count expected) (count actual))
+                                   eql-contents (= (vec expected) (vec actual))]
+                               (is eql-len
+                                   (str "array lengths under " k))
+                               (is eql-contents
+                                   (str "values under " k))
+                               (and eql-len eql-contents)))
+                           src-keys)]
+                  ;; Needs to return boolean-y
+                  (every? identity comparison)))))))))
+
+(defn validate-keys
+  [src]
+  (dorun (map (fn [[spec o]]
+                (when-not (s/valid? spec o)
+                  (println o "is not a valid" spec)
+                  ;; This just failed. Want to get an explanation for that failure
+                  (is (not (s/explain-data spec o))
+                      (str "Expected: " spec
+                           "\nActual:\n"
+                           (if (bytes? o)
+                             {::payload (vec o)
+                              ::length (count o)}
+                             o)))))
+              src)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;; Generators
+
+(def gen-key #_(fixed-length-byte-array-generator K/key-length)
+  (lo-gen/->Generator (fn [_ _]
+                        (rose/make-rose (utils/random-secure-bytes K/key-length) []))))
+
+(def gen-xtn (fixed-length-byte-array-generator K/extension-length))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;; Properties

 (def can-round-trip-initiate-packet
   (props/for-all [prefix (gen/return K/cookie-header)
-                  srvr-xtn (fixed-length-byte-array-generator K/extension-length)
-                  clnt-xtn (fixed-length-byte-array-generator K/extension-length)
-                  clnt-short-pk (fixed-length-byte-array-generator K/client-key-length)
+                  srvr-xtn gen-xtn
+                  clnt-xtn gen-xtn
+                  clnt-short-pk gen-key
                   cookie (fixed-length-byte-array-generator K/server-cookie-length)
                   outer-i-nonce (fixed-length-byte-array-generator K/client-nonce-suffix-length)
                   vouch-wrapper (gen/fmap byte-array
@@ -61,246 +134,38 @@
                             ::K/clnt-short-pk clnt-short-pk
                             ::K/cookie cookie
                             ::K/outer-i-nonce outer-i-nonce
-                            ::K/vouch-wrapper vouch-wrapper}
-                       key-validation (map (fn [[spec o]]
-                                             (when-not (s/valid? spec o)
-                                               (println o "is not a valid" spec)
-                                               ;; This just failed. Want to get an explanation for that failure
-                                               (is (not (s/explain-data spec o))
-                                                   (str "Expected: " spec
-                                                        "\nActual:\n"
-                                                        (if (bytes? o)
-                                                          {::payload (vec o)
-                                                           ::length (count o)}
-                                                          o)))))
-                                           src)]
-                   ;; Verify each individual field by realizing that lazy seq
-                   (dorun key-validation)
+                            ::K/vouch-wrapper vouch-wrapper}]
+                   (validate-keys src)
+                   (check-round-trip ::K/initiate-packet-spec template src ))))

-                   ;; And then check all the parts
-                   (is (s/valid? ::K/initiate-packet-spec src))
-                   (let [serialized (serial/compose template src)]
-                     (let [rhs (serial/decompose template serialized)]
-                       (doseq [k (keys rhs)]
-                         ;; This was a point of confusion for me, because the associated value
-                         ;; coming out of data/diff is a vector.
-                         ;; It's OK: decompose is producing byte arrays as expected.
-                         (is ((complement vector?) (k rhs)) (str "Decomposed a vector under " k)))
-                       (if (= src rhs)
-                         (do
-                           (println "Rainbows an unicorns")
-                           true)  ; Round-tripped correctly. We're good.
-                         ;; This is messy enough that it's worth taking some
-                         ;; effort to see what really went wrong.
-                         (let [delta (data/diff src rhs)
-                               only-in-src (first delta)]
-                           (println "You didn't expect it to be that easy, did you?")
-                           ;; I'm getting nils in the vouch wrapper here.
-                           ;; Q: How?
-                           ;; A: data/diff is recursive. Elements that match
-                           ;; in the byte arrays being compared show up as nil.
-                           (is (not only-in-src) "Things only in source")
-
-                           (is (not (second delta)) "Things only in deserialized")
-
-                           ;; Things that are in both
-                           (let [real-delta (nth delta 2)
-                                 matched (= src real-delta)]
-                             (or matched  ; Happy path
-                               (let [src-keys (set (keys src))
-                                     dst-keys (set (keys real-delta))]
-                                 (is (= src-keys dst-keys))
-                                 (let [comparison
-                                       (map (fn [k]
-                                              (let [expected (k src)
-                                                    actual (k real-delta)
-                                                    eql-len (= (count expected) (count actual))
-                                                    eql-contents (= (vec expected) (vec actual))]
-                                                (is eql-len
-                                                    (str "array lengths under " k))
-                                                (is eql-contents
-                                                    (str "values under " k))
-                                                (and eql-len eql-contents)))
-                                            src-keys)]
-                                   ;; Needs to return boolean-y
-                                   (every? identity comparison))))))))))))
+(def can-round-trip-hello-packet
+  (props/for-all
+   [hello-prefix (gen/return K/hello-header)
+    srvr-xtn gen-xtn
+    clnt-xtn gen-xtn
+    clnt-short-pk gen-key
+    zeros (gen/return (byte-array (take K/zero-box-length (repeat 0))))
+    client-nonce-suffix (fixed-length-byte-array-generator K/client-nonce-suffix-length)
+    crypto-box (fixed-length-byte-array-generator K/hello-crypto-box-length)]
+   (let [hello {::K/hello-prefix hello-prefix
+                ::K/srvr-xtn srvr-xtn
+                ::K/clnt-xtn clnt-xtn
+                ::K/clnt-short-pk clnt-short-pk
+                ::K/zeros zeros
+                ::K/client-nonce-suffix client-nonce-suffix
+                ::K/crypto-box crypto-box}]
+     (validate-keys hello))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;; Tests

-(defspec initiate-round-trip 10  ;; The "run test this many times" parameter doesn't seem to work as advertised.
+(defspec initiate-round-trip 10
   can-round-trip-initiate-packet)

-(comment
-  (time (initiate-round-trip 10))
+(defspec hello-round-trip 10
+  can-round-trip-initiate-packet)

-  (let [outcome
-        (quick-check 1 can-round-trip-initiate-packet
-                     #_[:reporter-fn (fn [m]
-                                       (println "Outcome:" m))])]
-    #_(:result :result-data :seed :failing-size :num-tests :fail :shrunk)
-    (keys outcome)
-    ;; The big thing here seems to be that :result is false
-    (select-keys outcome [:result :failing-size]))

-  ;; test.check is claiming that this all zeros sample is a failure. But it isn't giving me any hints about
-  ;; the actual problem.
-  (let [prefix K/cookie-header
-        srvr-xtn (byte-array K/extension-length)
-        clnt-xtn (byte-array K/extension-length)
-        clnt-short-pk (byte-array K/client-key-length)
-        cookie (byte-array K/server-cookie-length)
-        outer-i-nonce (byte-array K/client-nonce-suffix-length)
-        ;; 384 bytes
-        vouch-wrapper (byte-array  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
-        vouch-wrapper-length (count vouch-wrapper)
-        template (assoc-in K/initiate-packet-dscr
-                           [::K/vouch-wrapper ::K/length]
-                           vouch-wrapper-length)
-        src {::K/prefix prefix
-             ::K/srvr-xtn srvr-xtn
-             ::K/clnt-xtn clnt-xtn
-             ::K/clnt-short-pk clnt-short-pk
-             ::K/cookie cookie
-             ::K/outer-i-nonce outer-i-nonce
-             ::K/vouch-wrapper vouch-wrapper}
-        src' (reduce-kv (fn [acc k v]
-                          (assoc acc k (vec v)))
-                        {}
-                        src)
-        serialized (serial/compose template src)
-        deserialized (serial/decompose template serialized)
-        dsrlzd (reduce-kv (fn [acc k v]
-                            (assoc acc k (vec v)))
-                          {}
-                          deserialized)]
-    (when (not= src' dsrlzd)
-      (let [changes (reduce (fn [acc k]
-                              (let [expected (k src')
-                                    actual (k dsrlzd)]
-                                (if (= expected actual)
-                                  acc
-                                  (assoc-in (assoc-in acc [::expected k] expected)
-                                            [::actual k] actual))))
-                            {}
-                            (keys src))]
-        (throw (ex-info "Round trip failure" changes)))))
-
-  (let [lhs {:a [1 2 3 4]
-             :b [5 6 7 8]}
-        rhs {:a [1 2 4 5]
-             :b [5 6 9 8]}]
-    (data/diff lhs rhs))
-  (let [gend
-        (gen/sample
-         (gen/fmap byte-array
-                   (gen/fmap (fn [x]
-                               (let [n (count x)
-                                     extra (mod n 16)]
-                                 (if (= 0 extra)
-                                   x
-                                   (if (> n 16)
-                                     (drop extra x)
-                                     (take 16 (cycle x))))))
-                             (gen/vector (gen/such-that (complement nil?) (gen/choose -128 127))
-                                         (+ K/minimum-vouch-length
-                                            K/min-vouch-message-length)
-                                         (+ K/max-vouch-message-length
-                                            K/minimum-vouch-length))))
-         50)]
-    (doseq [bs gend]
-      (println ".")
-      (doseq [b bs]
-        (when (nil? b)
-          (throw (ex-info "nil snuck in" bs))))))
-
-  (let [gend (gen/sample (gen/vector (gen/bytes) 16 640))]
-    (map count gend))
-
-  (let [gend (gen/sample (gen/fmap (fn [xs]
-                                     (println (vec xs))
-                                     (byte-array xs))
-                                   (gen/fmap (fn [x]
-                                               (assert (every? (complement nil?) x))
-                                               ;; Make sure length is an even multiple of 16
-                                               (let [n (count x)
-                                                     extra (mod n 16)]
-                                                 (println "Coping with" extra "extra bytes out of" n)
-                                                 (if (= 0 extra)
-                                                   x
-                                                   (if (> n 16)
-                                                     (drop extra x)
-                                                     (take 16 (cycle x))))))
-                                             (gen/vector (gen/choose -128 127)
-                                                         (+ K/minimum-vouch-length
-                                                            K/min-vouch-message-length)
-                                                         (+ K/max-vouch-message-length
-                                                            K/minimum-vouch-length)))) 20)]
-    #_(map vec gend)
-    (map count gend))
-
-  (map count (gen/sample (gen/bytes 16 640)))
-  )
-
-(deftest hello-round-trip
-  ;; FIXME: The code for generating a specific byte array needs to
-  ;; be moved somewhere generally useful
-  (let [hellos (gen/sample (s/gen
-                            ::K/hello-spec
-                            {::K/hello-prefix #(gen/return K/hello-header)
-                             ::specs/extension (partial fixed-length-byte-array-generator K/extension-length)
-                             ;; It seems like the next line is the way this
-                             ;; should be handled, but the previous one seems
-                             ;; to work more often.
-                             ;; Sadly, neither approach seems to actually work with any consistency.
-                             #_[::K/clnt-xtn #(gen/vector lo-gen/byte K/extension-length)]
-                             ::K/clnt-short-pk #(lo-gen/->Generator (fn [_ _]
-                                                                      (rose/make-rose (utils/random-secure-bytes K/key-length) [])))
-                             ::K/zeros #(gen/return (byte-array (take K/zero-box-length (repeat 0))))
-                             ::K/client-nonce-suffix (partial fixed-length-byte-array-generator K/client-nonce-suffix-length)
-                             ::K/crypto-box (partial fixed-length-byte-array-generator K/hello-crypto-box-length)}))
-        buffers (map (partial serial/compose K/hello-packet-dscr) hellos)
-        ;; FIXME: Make this go back away
-        serialized (map (fn [buffer]
-                          (let [dst (byte-array (.readableBytes buffer))]
-                            (.readBytes buffer dst)
-                            dst))
-                        buffers)]
-    ;; each hello is a map of field names to byte arrays
-    ;; decompose returns a similar map, but the values are ByteBuf instances.
-    ;; Which seems wrong.
-    ;; However, even if it round-tripped seamlessly (and, realistically, it needs to),
-    ;; I couldn't get a decent comparison using plain =
-    (let [a (first hellos)
-          ;; Sometimes I get an error about trying to read past the end
-          ;; of the buffer.
-          ;; FIXME: Why?
-          b (serial/decompose K/hello-packet-dscr (first buffers))]
-      (println "First raw: " a
-               "\nFirst decomposed: " b))
-    (dorun (map #(is (= %1 (serial/decompose K/hello-packet-dscr %2)))
-                hellos
-                ;; decompose does expect a ByteBuf
-                #_serialized
-                buffers))
-    (comment
-      (println (count (first serialized))))))
 (comment
   (hello-round-trip)
   )


Add test for lens comparability/equality

--- test/active/clojure/lens_test.cljc
+++ test/active/clojure/lens_test.cljc
@@ -351,6 +351,41 @@
                                    #"arity"
                                    (apply (lens/member :a) []))))))

-(deftest lens-composition-equality
-  (is (= (lens/>> (lens/pos 3) lens/nel-head)
-         (lens/>> (lens/pos 3) lens/nel-head))))
+(defrecord Comparer [shmup])
+
+(deftest lens-comparison
+  (let [items [:foo
+               identity
+               #(identity %)
+               #(identity %) ;; this is not equal to the line above
+               #{1 2 3}
+               {:a 1 :b 2}
+               nil
+               5
+               "peter"
+               (->Comparer :shmup)]
+        combinators [lens/>> lens/++ lens/**]]
+    (doall
+     (for [item-1 items
+           item-2 items
+           combinator combinators]
+       (testing "Equality of lenses without args behaves as expected:"
+         (let [gen-lens-1 #(lens/lens item-1 item-1)
+               gen-lens-2 #(lens/lens item-2 item-2)]
+           (if (= item-1 item-2)
+             (do
+               (testing "Lenses constructed from equal values are equal"
+                 (is (= (gen-lens-1)
+                        (gen-lens-2)))
+                 (testing "Compositions of equal lenses are equal"
+                   ;; Combined lenses are internally represented as lenses with args
+                   (is (= (combinator lens/nel-head (gen-lens-2))
+                          (combinator lens/nel-head (gen-lens-1)))))))
+             (do
+               (testing "Lenses constructed from unequal values are unequal"
+                 (is (not= (gen-lens-1)
+                           (gen-lens-2)))
+                 (testing "Compositions of unequal lenses cannot be equal"
+                   ;; = lenses with args where only the args differ
+                   (is (not= (combinator lens/nel-tail (gen-lens-2))
+                             (combinator lens/nel-tail (gen-lens-1))))))))))))))


Revert "Merge pull request #122 from circleci/use-om2"

This reverts commit 4a910376e25a973c364d40d015016f5a5c30e4ff, reversing
changes made to a30a9df9a6ef61b40129df76dc944b4d57a833da.

--- src-cljs/frontend/components/header.cljs
+++ src-cljs/frontend/components/header.cljs
@@ -92,6 +92,9 @@
               [:a {:on-click #(raise! owner [:set-user-session-setting {:setting :use-local-assets
                                                                         :value (not use-local-assets)}])}
                "local assets " (if use-local-assets "off " "on ")])
+            [:a {:on-click #(raise! owner [:set-user-session-setting {:setting :use-om
+                                                                      :value false}])}
+             "om off "]
             (let [current-build-id (get user-session-settings :om_build_id "dev")]
               (for [build-id (remove (partial = current-build-id) ["dev" "whitespace" "production"])]
                 [:a.menu-item


decl fix

decl fix

--- src/clj/rksm/cloxp_cljs/ns/internals.clj
+++ src/clj/rksm/cloxp_cljs/ns/internals.clj
@@ -10,7 +10,7 @@
             [clojure.java.io :as io])
   (:import (java.io LineNumberReader PushbackReader File)))

-(declare namespace-info analyzed-data-of-def analyze-cljs-ns!)
+(declare ensure-ns-analyzed! analyzed-data-of-def analyze-cljs-ns!)

 (defonce cljs-env (atom {}))

@@ -25,7 +25,7 @@
       (if-not (some-> e
                 :compiler-env deref
                 :cljs.analyzer/namespaces (get 'cljs.core))
-        (namespace-info 'cljs.core (fm/find-file-for-ns-on-cp 'cljs.core)))
+        (ensure-ns-analyzed! 'cljs.core))
       e)))

@@ -103,11 +103,12 @@
   [sym & [file]]
   (let [ns-name (symbol (namespace sym))
         name (symbol (name sym))]
-    (if-not (some-> (ensure-default-cljs-env) ; in case ns data isn't there yet...
-              :compiler-env deref
-              :cljs.analyzer/namespaces
-              (get ns-name))
-      (namespace-info ns-name file))
+
+    (if-not (get-in ; in case ns data isn't there yet...
+                    @(:compiler-env (ensure-default-cljs-env))
+                    [:cljs.analyzer/namespaces ns-name])
+      (ensure-ns-analyzed! ns-name))
+
     (some-> (ensure-default-cljs-env)
       :compiler-env deref
       :cljs.analyzer/namespaces (get ns-name)


Add three-way-reproductive-divergence-diversifying? and three-way-symbolic-reproductive-divergence-diversifying?

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -1453,6 +1453,19 @@
     (assoc ind :diversifying
       (not= c-made-by c2-made-by))))

+(defn three-way-symbolic-reproductive-divergence-diversifying?
+  [ind argmap]
+  (let [symbolic #(filter (comp not number?) %)
+        g (:genome ind)
+        c (produce-child-genome-by-autoconstruction g g argmap)
+        c2 (produce-child-genome-by-autoconstruction g g argmap)
+        c3 (produce-child-genome-by-autoconstruction g g argmap)
+        c-made-by (symbolic (flatten (:made-by (meta c))))
+        c2-made-by (symbolic (flatten (:made-by (meta c2))))
+        c3-made-by (symbolic (flatten (:made-by (meta c3))))]
+    (assoc ind :diversifying
+      (not= c-made-by c2-made-by c3-made-by))))
+
 (defn reproductive-divergence-diversifying?
   [ind argmap]
   (let [g (:genome ind)
@@ -1462,6 +1475,18 @@
         c2-made-by (flatten (:made-by (meta c2)))]
     (assoc ind :diversifying
       (not= c-made-by c2-made-by))))
+
+(defn three-way-reproductive-divergence-diversifying?
+  [ind argmap]
+  (let [g (:genome ind)
+        c (produce-child-genome-by-autoconstruction g g argmap)
+        c2 (produce-child-genome-by-autoconstruction g g argmap)
+        c3 (produce-child-genome-by-autoconstruction g g argmap)
+        c-made-by (flatten (:made-by (meta c)))
+        c2-made-by (flatten (:made-by (meta c2)))
+        c3-made-by (flatten (:made-by (meta c3)))]
+    (assoc ind :diversifying
+      (not= c-made-by c2-made-by c3-made-by))))

 (defn reproductive-change-changes-differently-diversifying?
   [ind argmap]


(PDB-2537) test indexes! idempotency on alternative schemas

This tests a fix that was rolled up from stable. The tests weren't rolled up
because we handle test databases differently between branches.

--- test/puppetlabs/puppetdb/scf/migrate_test.clj
+++ test/puppetlabs/puppetdb/scf/migrate_test.clj
@@ -272,21 +272,29 @@

 (deftest migration-in-different-schema
   (jdbc/with-db-connection *db*
-    (clear-db-for-testing!)
-    (jdbc/with-db-connection (tdb/db-admin-config)
-      (let [db (tdb/subname->validated-db-name (:subname *db*))
-            user (get-in tdb/test-env [:user :name])]
-        (assert (tdb/valid-sql-id? db))
-        (jdbc/do-commands (format "grant create on database %s to %s"
-                                  db (get-in tdb/test-env [:user :name])))))
-    (jdbc/do-commands
-     ;; Cleaned up in clear-db-for-testing!
-     "CREATE SCHEMA pdbtestschema"
-     "SET SCHEMA 'pdbtestschema'")
-    (let [tables (sutils/sql-current-connection-table-names)]
+    (let [db-config {:database *db*}
+          test-db-name (tdb/subname->validated-db-name (:subname *db*))]
+      (clear-db-for-testing!)
+      (jdbc/with-db-connection (tdb/db-admin-config)
+        (let [db (tdb/subname->validated-db-name (:subname *db*))
+              user (get-in tdb/test-env [:user :name])]
+          (assert (tdb/valid-sql-id? db))
+          (jdbc/do-commands
+            (format "grant create on database %s to %s"
+                    db (get-in tdb/test-env [:user :name])))))
+      (jdbc/do-commands
+        "CREATE SCHEMA pdbtestschema"
+        "SET SCHEMA 'pdbtestschema'")
+      (jdbc/with-db-connection (tdb/db-admin-config test-db-name)
+        (jdbc/do-commands
+          "DROP EXTENSION pg_trgm"
+          "CREATE EXTENSION pg_trgm WITH SCHEMA pdbtestschema"))
+
       ;; Currently sql-current-connection-table-names only looks in public.
       (is (empty? (sutils/sql-current-connection-table-names)))
-      (migrate! *db*))))
+      (migrate! *db*)
+      (indexes! db-config)
+      (indexes! db-config))))

 (deftest test-hash-field-not-nullable
   (jdbc/with-db-connection *db*


Test to make sure format is taken into account when calculating thumbnail path

--- test/vignette/media_types_test.clj
+++ test/vignette/media_types_test.clj
@@ -43,6 +43,7 @@

 (def zone-original-map (assoc original-map :options {:zone "temp"}))

+(def format-archive-map (assoc archive-map :options {:format "webp"}))

 (def timeline-file "bbe457792492f1b89f21a45aa6ca6088.jpg")
 (def timeline-map {:wikia "television"
@@ -67,6 +68,7 @@
 (facts :thumbnail-path
        (thumbnail-path archive-map) => "images/thumb/archive/a/ab/12345!boat.jpg/200px-300px-thumbnail-boat.jpg"
        (thumbnail-path latest-map) => "images/thumb/a/ab/boat.jpg/200px-300px-thumbnail-boat.jpg"
+       (thumbnail-path format-archive-map) => "images/thumb/archive/a/ab/12345!boat.jpg/200px-300px-thumbnail[format=webp]-boat.jpg"
        (fully-qualified-original-path latest-map) => "bucket/images/a/ab/boat.jpg"
        (fully-qualified-original-path archive-map) => "bucket/images/archive/a/ab/12345!boat.jpg")


fetch commits and pulls

fetch commits and pulls

--- src/hu/ssh/github_changelog.clj
+++ src/hu/ssh/github_changelog.clj
@@ -1,18 +1,20 @@
 (ns hu.ssh.github-changelog
   (:require
     [environ.core :refer [env]]
-    [tentacles.core :as core]
+    [tentacles.core :refer [with-defaults]]
     [tentacles.repos :as repos]
     [tentacles.pulls :as pulls]
     [clj-semver.core :as semver]))

-(defn- repo
-  "Gets the repository from its name"
-  ([name] (repo "pro" name))
-  ([org repo] [org repo]))
+(def ^:dynamic *user* "raszi")
+(def ^:dynamic *repo* "changelog-test")

-(defn- parse-semver
-  "Parse semantic versions with or without 'v' predicate from the tags"
+(defmacro with-repo [new-user new-repo & body]
+  `(binding [*user* ~new-user *repo* ~new-repo]
+     ~@body))
+
+(defn- extract-semver
+  "Extracts semantic versions with or without 'v' predicate from the tags"
   [tag]
   (let [version (:name tag)
         parse #(try (semver/parse %)
@@ -23,26 +25,47 @@
         version))))

 (defn- map-semver
-  "Map semver to the tag"
+  "Maps semver to the tag"
   [tags]
-  (map #(assoc % :version (parse-semver %)) tags))
+  (map #(assoc % :version (extract-semver %)) tags))

 (defn- fetch-version-tags
   "Fetch the version tags in the correct order"
-  [user repo]
-  (let [sort-fn #(semver/older? (:version %1) (:version %2))]
-    (->> (repos/tags user repo)
+  []
+  (let [sort-fn #(semver/newer? (:version %1) (:version %2))]
+    (->> (repos/tags *user* *repo*)
          map-semver
          (filter :version)
          (sort sort-fn))))

+(defn- fetch-commits
+  "Fetches commits for a tag"
+  [tag]
+  (let [sha (get-in tag [:commit :sha])]
+    (repos/commits *user* *repo* {:sha sha})))
+
+(defn- fetch-pulls
+  "Fetches the pull-requests"
+  []
+  (pulls/pulls *user* *repo* {:state "closed"}))
+
+(defn- map-commits
+  "Maps commits into tags"
+  [tags]
+  (map #(assoc % :commits (fetch-commits %)) tags))
+
+(defn- map-pulls
+  "Maps pull-pull-requests to tags"
+  [tags]
+  (let [pulls (fetch-pulls)]
+       tags))
+
 (defn changelog
   "Fetches the changelog"
-  [user repo]
-  (let [tags (delay (fetch-version-tags user repo))
-        pulls (delay (pulls/pulls user repo {:state "closed"}))
-        commits (delay (repos/commits user repo))]
-    (println (first @tags))))
+  []
+  (->> (fetch-version-tags)
+       map-commits
+       map-pulls))

-(core/with-defaults {:oauth-token (env :github-token) :all_pages true}
-                    (changelog "raszi" "node-tmp"))
+(with-defaults {:oauth-token (env :github-token) :all_pages true}
+                    (with-repo "raszi" "changelog-test" (println (changelog))))


minor docs reformat

minor docs reformat

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -329,9 +329,9 @@
 (deftask render
   "Render pages.

-   If permalink is set for the file, it is used as the filepath else. If permalink
-   ends in slash, index.html is used as filename. If permalink is not set, the
-   original filename is used with file extension set to html."
+   If permalink is set for the file, it is used as the filepath.
+   If permalink ends in slash, index.html is used as filename.
+   If permalink is not set, the original filename is used with file extension set to html."
   [o out-dir  OUTDIR   str  "the output directory"
    f filterer FILTER   code "filter function"
    r renderer RENDERER sym  "page renderer(fully qualified symbol which resolves to a function)"]


Amend `markdown` docstring to note it writes HTML files

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -180,7 +180,8 @@

    This task will look for files ending with `md` or `markdown`
    and add a `:parsed` key to their metadata containing the
-   HTML resulting from processing markdown file's content"
+   HTML resulting from processing markdown file's content. Also
+   writes an HTML file that contains the same content as `:parsed`"
   [m meta    META edn "metadata to set on each entry; keys here will be overridden by metadata in each file"
    o options OPTS edn "options to be passed to the markdown parser"]
   (let [pod     (create-pod markdown-deps)


preconfigure ports on a js timeout

preconfigure ports on a js timeout

--- src/main/clojure/gpio/core.cljc
+++ src/main/clojure/gpio/core.cljc
@@ -120,6 +120,17 @@
   Closeable
   (close! [_]
     (unexport! port)))
+
+(defn- preconfigure [gpio-port opts]
+  (let [{:keys [direction active-low? initial-value]} opts]
+    (try
+      (cond-> gpio-port
+        direction (set-direction! direction)
+        active-low? (set-active-low! active-low?)
+        initial-value (write-value! initial-value))
+      (catch #?(:clj Exception :cljs :default) e
+        (close! gpio-port)
+        (throw e)))))

 (defn open-port
   "Opens a port from which values may be read or written.
@@ -136,22 +147,19 @@
           Overrides the default formatter"
   [port & opts]
   (export! port)
-  (let [{:keys [digital-result-format from-raw-fn direction active-low? initial-value]
+  (let [{:keys [digital-result-format from-raw-fn]
          :or {digital-result-format :keyword}} opts
         formatter (or from-raw-fn
                       (partial format-raw-digital digital-result-format))
         filename (value-file port)
         gpio-port (BasicGpioPort. port filename formatter)]
     ; Need to wait for the direction file to be available
-    #?(:clj (Thread/sleep 100))
-    (try
-      (cond-> gpio-port
-        direction (set-direction! direction)
-        active-low? (set-active-low! active-low?)
-        initial-value (write-value! initial-value))
-      (catch #?(:clj Exception :cljs :default) e
-        (close! gpio-port)
-        (throw e)))))
+    #?(:clj (do
+              (Thread/sleep 100)
+              (preconfigure gpio-port opts))
+       :cljs (do
+               (js/setTimeout #(preconfigure gpio-port opts) 100)
+               gpio-port))))

 (defn- tap-and-wrap-chan [mult-ch out-ch]
   (a/tap mult-ch out-ch)
@@ -217,7 +225,8 @@
         mult-ch (a/mult read-ch)
         poller (poll/watch-port gpio-port timeout #(a/put! read-ch (read-value gpio-port))) ]

-    (when edge (do-set-edge! port edge))
+    #?(:clj (when edge (do-set-edge! port edge))
+       :cljs (js/setTimeout #(when edge (do-set-edge! port edge)) 100))

     ; Serialize the write loop
     (go (loop []


Include default value in Settings dox

Include default value in Settings dox

--- src/metabase/models/setting.clj
+++ src/metabase/models/setting.clj
@@ -142,9 +142,8 @@
        (format "You can also set its value with the env var `MB_%s`.\n"
                (s/upper-case (s/replace (name symb) #"-" "_")))
        "Clear its value by calling\n\n"
-       (format "    (%s nil)" symb)
-       (when default-value
-         (format "\n\nIts default value is `%s`." default-value))))
+       (format "    (%s nil)\n\n" symb)
+       (format "Its default value is `%s`." default-value)))

 (defmacro defsetting
   "Defines a new `Setting` that will be added to the DB at some point in the future.


:bug: Fix bug on uploading image.

:bug: Fix bug on uploading image.

--- backend/src/uxbox/services/mutations/images.clj
+++ backend/src/uxbox/services/mutations/images.clj
@@ -99,7 +99,7 @@
   [{:keys [name path] :as upload}]
   (let [filename (fs/name name)
         storage media/images-storage]
-    (-> (ds/save storage filename path)
+    (-> (ds/save storage filename (fs/path path))
         (su/handle-on-context))))

 (def sql:create-image


Comment out test code.

Comment out test code.

--- src/haystack/create_index.clj
+++ src/haystack/create_index.clj
@@ -38,7 +38,7 @@
         syns (map (fn [[main & others]] (map #(string/join #"," [main %]) others)) groups)]
     (flatten syns)))

-(synonyms)
+;; (synonyms)

 (def ecommerce-mapping-types
   (let [;; analyzers


DB interface: read-components-for-chapter and add-new-component

--- src/hurvinek/db_interface.clj
+++ src/hurvinek/db_interface.clj
@@ -194,6 +194,27 @@
             (println e)
             nil)))

+(defn read-components-for-chapter
+    [chapter-id]
+    (try
+        (jdbc/query db-spec/hurvinek-db
+                        ["select components.name from components, groups, chapters
+                           where groups.chapter      = chapters.id
+                             and components.group_id = groups.id
+                             and chapters.id=?
+                           order by components.name" chapter-id])))
+
+(defn add-new-component
+    [component-name group-id]
+    (try
+        (jdbc/insert! db-spec/hurvinek-db
+                        :components {:name component-name
+                                     :group_id group-id})
+            nil ; return value
+        (catch Exception e
+            (println e)
+            e)))
+
 (defn delete-component
     [component-id]
     (try


add 2-parallel-step to reveal parallel step view bug

--- backend/test/lambdaui/testpipeline/simple_pipeline.clj
+++ backend/test/lambdaui/testpipeline/simple_pipeline.clj
@@ -39,19 +39,18 @@
   {:status (swap! lastStatus swapStatus)})

 (def pipeline-structure
-  `( a-lot-output
+  `(a-lot-output
      (step/alias "i have substeps"
-            (run successfullStep
-                 successfullStep
-                 (step/alias "i have more substeps"
-                        (run a-lot-output
-                             different-status))
-                 a-lot-output)
-            )
-     (in-parallel
-       (step/alias "double-long" (run long-running-task-20s long-running-task-20s))
-       long-running-task-20s
-       long-running-task-20s
-       )
-     long-running-task-20s
-     ))
+                 (run successfullStep
+                      successfullStep
+                      (step/alias "i have more substeps"
+                                  (run a-lot-output
+                                       different-status))
+                      a-lot-output)
+                 )
+     (step/alias "2-parallel-step" (in-parallel a-lot-output a-lot-output))
+     (step/alias "3-parallel-steps" (in-parallel
+                                      (step/alias "double-long" (run long-running-task-20s long-running-task-20s))
+                                      long-running-task-20s
+                                      long-running-task-20s
+                                      long-running-task-20s))))


[#1028] use false? to determine if we should autodetect

--- backend/src/akvo/lumen/import/csv.clj
+++ backend/src/akvo/lumen/import/csv.clj
@@ -106,7 +106,5 @@
   [spec {:keys [file-upload-path]}]
   (let [path (get-path spec file-upload-path)
         headers? (boolean (get spec "hasColumnHeaders"))
-        guess-types? (if-some [guess-types? (get spec "guessColumnTypes")]
-                       guess-types?
-                       true)]
+        guess-types? (-> (get spec "guessColumnTypes") not false?)]
     (csv-importer path headers? guess-types?)))