Remove unnecessary whitespaces

Remove unnecessary whitespaces

--- src/bakyeono/litedocx/wpml.clj
+++ src/bakyeono/litedocx/wpml.clj
@@ -436,12 +436,12 @@
        (into
          [{:tag :w:tcW
            :attrs {:w:w width
-                   :w:type "dxa"}}]
+                   :w:type "dxa"}}]
          body))}]})

 (defn p
   "Returns XML tag node of paragraph.
-
+
   Parameters:
   - style: <string> style of paragraph
   - text: <string> text in paragraph"


Extract page-number link from link

Extract page-number link from link

--- src/clj/comic_reader/sites.clj
+++ src/clj/comic_reader/sites.clj
@@ -183,9 +183,9 @@
 ;; ############################################################

 (defn gen-extract-pages-list-normalize [base-url]
-  (util/html-fn {[name] :content}
-    (if-let [page-number (re-find (page-normalize-pattern)
-                                  name)]
+  (util/html-fn {[name] :content {:keys [value]} :attrs}
+    (let [page-number (re-find (page-normalize-pattern)
+                               value)]
       {:name name
        :url (format (page-normalize-format)
                     base-url


Extract method to simplify run-simulation implementation

--- src/clj_gatling/simulation.clj
+++ src/clj_gatling/simulation.clj
@@ -15,13 +15,15 @@
       {:result :requests})
     :id id :name (:name scenario)))

+(defn collect-result [cs]
+  (let [[result c] (async/alts!! cs)]
+    result))
+
 (defn run-simulation [scenario users]
   (let [cs (repeatedly users async/chan)
         ps (map vector (iterate inc 0) cs)]
     (doseq [[i c] ps] (go (>! c (run-scenario scenario i))))
-    (let [result (for [i (range users)]
-      (let [[v c] (async/alts!! cs)]
-        v))]
-      (println result)
+    (let [results (repeatedly users (partial collect-result cs))]
+      (dorun results) ;Lazy results must be evaluated before channels are closed
       (doseq [c cs] (async/close! c))
-      result)))
+      results)))


Correct condition for enabling syntax highlighting after merging try-doc-listbox2 changes to latest master

--- src/clj_ns_browser/browser.clj
+++ src/clj_ns_browser/browser.clj
@@ -15,6 +15,7 @@
             [clojure.java.shell]
             [clojure.java.io]
             [clojure.pprint]
+            [clojure.set :as set]
             [clojure.string :as str]
             [clj-info.doc2map :as d2m]
             [clj-ns-browser.inspector]
@@ -999,12 +1000,15 @@
     ;;
     ;; turn syntax-highlighting on/off - only on for Source
     (b/bind
-      (b/selection (id :doc-cbx))
+      (b/selection (id :doc-lb) {:multi? true})
       (b/transform (fn [o]
         (when (= (.getName (type (id :doc-ta))) "org.fife.ui.rsyntaxtextarea.RSyntaxTextArea")
-          (if (or (= "Source" o) (= "Examples" o) (= "Meta" o))
-            (config! (id :doc-ta) :syntax :clojure)
-            (config! (id :doc-ta) :syntax :none))))))
+          (let [selected-set (set o)]
+            (if (= selected-set
+                   (set/intersection selected-set
+                                     #{"Source" "Examples" "Meta"}))
+              (config! (id :doc-ta) :syntax :clojure)
+              (config! (id :doc-ta) :syntax :none)))))))
     ;;
     ;; bring up browser with url
     (b/bind


make touch events work with interactive layers

--- src-cljs/frontend/components/canvas.cljs
+++ src-cljs/frontend/components/canvas.cljs
@@ -283,6 +283,12 @@
                                                            :layer-eids selected-eids})

                                                    :else
+                                                   (cast! :canvas-aligned-to-layer-center
+                                                          {:ui-id (:layer/ui-target layer)
+                                                           :canvas-size (utils/canvas-size)})))
+                                 :onTouchStart (fn [event]
+                                                 (when (= (.-length (.-touches event)) 1)
+                                                   (utils/stop-event event)
                                                    (cast! :canvas-aligned-to-layer-center
                                                           {:ui-id (:layer/ui-target layer)
                                                            :canvas-size (utils/canvas-size)})))


Revert.

Revert.

--- src/cljs/beatha/automaton.cljs
+++ src/cljs/beatha/automaton.cljs
@@ -203,8 +203,7 @@
                         :corp-3 :worker-3 :corp-4 :worker-4}
         worker? #((into #{:worker} (vals company-worker)) %)
         company-of-worker (fn [s] (or ((set/map-invert company-worker) s) s))
-        worker-of-company (fn [s] (or (company-worker s) s))
-        test 1]
+        worker-of-company (fn [s] (or (company-worker s) s))]
     (reify
       AutomatonSpecification
       (default-cell [_] {:state :worker})


add icon for space key

add icon for space key


Fix transact to use val-atom.

Fix transact to use val-atom.

--- src/cljx/geschichte/stage.cljx
+++ src/cljx/geschichte/stage.cljx
@@ -312,8 +312,8 @@
                                           repo-meta
                                           branch))

-             {{new-val :val} :volatile}
-             (swap! stage assoc-in [:volatile :val user repo branch] branch-val)]
+             new-val
+             (swap! (get-in stage [:volatile :val-atom]) assoc-in [user repo branch] branch-val)]

         (info "new stage value after trans " [params trans-fn-code] ": \n" new-val)
         (put! val-ch new-val))))


Add some classes I accidentally removed, for webdriver tests.

--- src-cljs/frontend/components/header.cljs
+++ src-cljs/frontend/components/header.cljs
@@ -200,9 +200,9 @@
                [:li [:a {:href "/"} "Back to app"]]]
               [:ul.nav.navbar-nav.navbar-right
                [:li
-                [:a {:href (auth-url)
-                     :on-click #(raise! owner [:track-external-link-clicked {:path (auth-url) :event "login_click" :properties {:source "header log-in" :url js/window.location.pathname}}])
-                     :title "Log In with Github"}
+                [:a.login.login-link {:href (auth-url)
+                                      :on-click #(raise! owner [:track-external-link-clicked {:path (auth-url) :event "login_click" :properties {:source "header log-in" :url js/window.location.pathname}}])
+                                      :title "Log In with Github"}
                  "Log In"]]
                [:li
                 [:button.login-link.btn.btn-success {:href (auth-url)


Remove unnecessary require

Remove unnecessary require

--- src/clojure/nightcode/core.clj
+++ src/clojure/nightcode/core.clj
@@ -1,6 +1,5 @@
 (ns nightcode.core
   (:require [seesaw.core :as s]
-            [nightcode.builders :as builders]
             [nightcode.dialogs :as dialogs]
             [nightcode.editors :as editors]
             [nightcode.lein :as lein]


Updated routes for deployment.

Updated routes for deployment.

--- src/cmr/opendap/rest/route.clj
+++ src/cmr/opendap/rest/route.clj
@@ -17,7 +17,7 @@

 (defn ous
   [httpd-component]
-  [["/opendap/ous/collections" {
+  [["/ous/collections" {
     :post {
       :handler collection-handler/batch-generate
       ;; XXX protecting collections will be a little different than
@@ -28,7 +28,7 @@
       ;:permission #{...}
       }
     :options core-handler/ok}]
-   ["/opendap/ous/collection/:concept-id" {
+   ["/ous/collection/:concept-id" {
     :get {
       :handler collection-handler/generate-urls
       :permissions #{:read}}
@@ -44,7 +44,7 @@
 (defn static
   [httpd-component]
   (let [docroot (config/http-docroot httpd-component)]
-    [["/static/*" {
+    [["/site/*" {
       :get (core-handler/static-files docroot)}]]))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


fixed merge error

fixed merge error

--- src/complex/turtle/render.cljc
+++ src/complex/turtle/render.cljc
@@ -40,18 +40,12 @@

 (defn render-circle
   "assumes g-circle is not a line"
-  [g-circle color-scheme]
-  (assert (not (g/collinear? g-circle)))
-  (let [[z1 z2 z3] g-circle
-        [a1 a2 a3] (args z1 z2 z3)
+  [g-circle circle-style]
+  [(stroke-style (:edge circle-style))
+   (g/circumcircle g-circle)])

-        [p1 p2 p3] (mapv coords g-circle)
-        circle (g/circumcircle g-circle)
-        {:keys [center radius]} (second circle)
-
-        circ [(l-style :s1 color-scheme)
-              circle]]
-    (concat circ points)))
+(defn render-line
+  [])

 (defn render
   "transform generalized circle to


use sampled-piano inst included with Overtone rather than defining it from scratch

--- examples/extemp_piano.clj
+++ examples/extemp_piano.clj
@@ -1,6 +1,6 @@
 (ns examples.extemp-piano
   (:use [overtone.live]
-        [overtone.inst synth]))
+        [overtone.inst synth sampled-piano]))

 ;; This example has been translated from the Extempore code demonstrated in
 ;; http://vimeo.com/21956071 (found around the 10 minute mark)
@@ -23,30 +23,14 @@
 ;;                  (random '(2 7 10))
 ;;                  (random '(0 8))))))

-;;Piano samples downloaded from: http://blackhole12.newgrounds.com/news/post/92464
-(def piano-samples (load-samples "~/Desktop/samples/MIS_Stereo_Piano/Piano/*"))
-
-(defn matching-notes
-  [note]
-  (filter #(if-let [n (match-note (:name %))]
-             (= note (:midi-note n)))
-          piano-samples))
-
-(defn sampled-piano
-  ([note] (sampled-piano note 1))
-  ([note vol]
-     (if-let [sample (first (matching-notes note))]
-       (stereo-player sample :vol vol))))
-
 (def chord-prog
   [#{[2 :minor7] [7 :minor7] [10 :major7]}
    #{[0 :minor7] [8 :major7]}])

 (def beat-offsets [0 0.1 0.2 1/3  0.7 0.9])

-(def instrument sampled-piano)
 (def metro (metronome 20))
-;;(metro :bpm 10)
+;;(metro :bpm 30)

 (def root 40)
 (def max-range 35)
@@ -61,14 +45,13 @@
 (defn beat-loop
   [metro beat chord-idx]
   (let [[tonic chord-name] (choose (seq (nth chord-prog chord-idx)))
-        nxt-chord-idx     (mod (inc chord-idx) (count chord-prog))]
+        nxt-chord-idx      (mod (inc chord-idx) (count chord-prog))]
     (dorun
      (map (fn [note offset]
-            (at (metro (+ beat offset)) (instrument note)))
-          (rand-chord (+ root tonic) chord-name (count beat-offsets) (cosr beat range-variation  max-range range-period) )
+            (at (metro (+ beat offset)) (sampled-piano note 0.3)))
+          (rand-chord (+ root tonic) chord-name (count beat-offsets) (cosr beat range-variation  max-range range-period))
           beat-offsets))
     (apply-at (metro (inc beat)) #'beat-loop [metro (inc beat) nxt-chord-idx])))
-(stop)

 ;;start the music:
 (beat-loop metro (metro) 0)


Format generation

Format generation

--- lein-template/src/leiningen/new/modular.clj
+++ lein-template/src/leiningen/new/modular.clj
@@ -281,6 +281,7 @@
                 ;; we have a conflict - more than one dependency is trying to bind
                 (gbf #(into {} (gbf first %)))
                 (into {})
+                pprint with-out-str
                 )

                :co-dependencies
@@ -297,7 +298,8 @@
                 ;; there aren't multiple entries, if there are it means
                 ;; we have a conflict - more than one dependency is trying to bind
                 (gbf #(into {} (gbf first %)))
-                (into {}))
+                (into {})
+                pprint with-out-str)

                :files (concat (get-in manifest [:application-templates app-template :files] [])
                               (mapcat :files modules))}]


present subjunctive morph

present subjunctive morph

--- src/babel/italiano/morphology/verbs.cljc
+++ src/babel/italiano/morphology/verbs.cljc
@@ -1,5 +1,5 @@
 (ns babel.italiano.morphology.verbs
-  (:require
+  (:require
    [dag_unify.core :refer [unify]]))

 (defn group-by-two [remaining]
@@ -104,7 +104,7 @@
          #"(.*)ivano$"  "$1irsi"
          ]
      }
-
+
     ]))

 (def replace-patterns-future-tense
@@ -135,7 +135,7 @@
          #"(.*)gherò"   "$1gare" ;; piegherò -> piegare
          #"(.*)rrò"     "$1nere" ;; rimarrò -> rimanere
          ]}
-
+
     {:agr {:synsem {:subcat {:1 {:agr {:number :sing
                                        :person :2nd}}}}}
      :p [
@@ -321,7 +321,7 @@
           #"(.*)uti" "$1ersi"
           #"(.*)uti" "$1ire"
           ]}
-
+
      {:agr {:synsem {:essere false}}
       :p [
           #"(.*)ato" "$1are"
@@ -343,7 +343,7 @@
           #"(.*)uto" "$1ere"
           #"(.*)uto" "$1ersi"
           ]}
-
+
      ])))

 (def replace-patterns-present-tense
@@ -375,11 +375,11 @@
          #"(.*)i$"         "$1irsi" ;; diverti -> divertirsi
          #"(.*)ici$"       "$1ire" ;; dici -> dire
          #"(.*)hi$"        "$1are" ;; pieghi -> piegare
-         ]}
-
-    {:agr {:synsem {:subcat {:1 {:agr {:number :sing
-                                       :person :3rd}}}}}
-
+         ]}
+
+    {:agr {:synsem {:subcat {:1 {:agr {:number :sing
+                                       :person :3rd}}}}}
+
      :p [
          #"(.*)a$"         "$1are"
          #"(.*)e$"         "$1ere"
@@ -411,7 +411,7 @@
          #"(.*)([aei])te$" "$1$2re" ;; parlate -> parlare
          #"(.*)([aei])te$" "$1$2rsi" ;; chiamate -> chiamarsi
          ]}
-
+
     {:agr {:synsem {:subcat {:1 {:agr {:number :plur
                                        :person :3rd}}}}}
      :p [
@@ -453,7 +453,7 @@
          #"(.*)gherei"   "$1gare" ;; piegherei -> piegare
          #"(.*)rrei"     "$1nere" ;; rimarrei -> rimanere
          ]}
-
+
     {:agr {:synsem {:subcat {:1 {:agr {:number :sing
                                        :person :2nd}}}}}
      :p [
@@ -588,5 +588,87 @@
         replace-patterns-past-tense
         replace-patterns-present-tense)))

-
-
+;; here is my attempt to do present subjunctive - Franco
+
+(def replace-patterns-present-subjunctive
+  (expand-replace-patterns
+   {:synsem {:infl :present}}
+   [{:agr {:synsem {:subcat {:1 {:agr {:number :sing
+                                       :person :1st}}}}}
+     :p [
+         #"(.*)i$"         "$1are"
+         #"(.*)a$"         "$1ere"
+         #"(.*)isca$"      "$1ire"
+         #"(.*)a$"         "$1ire"
+         #"(.*)i$"         "$1arsi" ;; alzi -> alzarsi
+         #"(.*)a$"         "$1irsi" ;; diverta -> divertirso
+         #"(.*)ica$"       "$1ire" ;; dica -> dire
+         ]}
+    {:agr {:synsem {:subcat {:1 {:agr {:number :sing
+                                       :person :2nd}}}}}
+     :p [
+         #"(.*)i$"         "$1are" ;; lavi -> lavare
+         #"(.*)i$"         "$1iare" ;; studi -> studiare
+         #"(.*)i$"         "$1arsi" ;; lavi -> lavarsi
+         #"(.*)cci$"       "$1cciare" ;; abbracci -> abbracciare
+         #"(.*)a$"         "$1ere" ;;scriva -> scrivere
+         #"(.*)a$"         "$1ire" ;; senta -> sentire
+         #"(.*c)hi$"       "$1are" ;; cerchi -> cercare
+         #"(.*)i$"         "$1iarsi" ;; arrabbi -> arrabbiarsi
+         #"(.*)sca$"       "$1re" ;; finisca -> finire
+         #"(.*)a$"         "$1irsi" ;; diverta -> divertirsi
+         #"(.*)ica$"       "$1ire" ;; dica -> dire
+         #"(.*)hi$"        "$1are" ;; pieghi -> piegare
+         ]}
+
+    {:agr {:synsem {:subcat {:1 {:agr {:number :sing
+                                       :person :3rd}}}}}
+
+     :p [
+         #"(.*)i$"         "$1are"
+         #"(.*)a$"         "$1ere"
+         #"(.*)a$"         "$1ire"
+         #"(.*)i$"         "$1arsi" ;; prepari -> preperarsi
+         #"(.*)sca$"       "$1re" ;; finisca -> finire
+         #"(.*)ta$"        "$1tirsi" ;; diverta -> divertirsi
+         #"(.*)ica$"       "$1ire" ;; dica -> dire
+         ]}
+
+    {:agr {:synsem {:subcat {:1 {:agr {:number :plur
+                                       :person :1st}}}}}
+     :p [
+         #"(.*)iamo$"      "$1are"  ;; parliamo -> parlare
+         #"(.*)iamo$"      "$1iare" ;; mangiamo -> mangiare
+         #"(.*)iamo$"      "$1ere"
+         #"(.*)iamo$"      "$1ire"
+         #"(.*c)hiamo$"    "$1are" ;; sprechiamo -> sprecare
+         #"(.*)iamo$"      "$1iarsi" ;; arrabiamo -> arrabiarsi
+         #"(.*)iamo$"      "$1arsi" ;; chiamiamo -> chiamarsi
+         #"(.*)iamo$"      "$1irsi" ;; divertiamo -> divertirsi
+         #"(.*)ciamo$"     "$1re" ;; diciamo -> dire
+         #"(.*)hiamo$"     "$1are" ;; pieghiamo -> piegare
+         ]}
+
+    {:agr {:synsem {:subcat {:1 {:agr {:number :plur
+                                       :person :2nd}}}}}
+     :p [
+         #"(.*)iate$"  "$1are" ;; parliate -> parlare
+         #"(.*)iate$"  "$1ere" ;; scriviate -> scrivere
+         #"(.*)iate$"  "$1ire" ;; dormiate -> dormire
+         #"(.*)iate$"  "$1arsi" ;; chiamate -> chiamarsi
+         #"(.*)iate$"  "$1ersi" ;; mettiate -> metterrsi
+         #"(.*)iate$"  "$1irsi" ;; divertiate -> divertirsi
+         ]}
+
+    {:agr {:synsem {:subcat {:1 {:agr {:number :plur
+                                       :person :3rd}}}}}
+     :p [
+         #"(.*)ino$"       "$1are"
+         #"(.*)ano$"       "$1ere"
+         #"(.*)ano$"       "$1ire"
+         #"(.*)ino$"       "$1arsi" ;; alzino -> alzarsi
+         #"(.*)scano$"     "$1re" ;; finiscano -> finire
+         #"(.*)ano$"       "$1irsi" ;; divertano -> divertirsi
+         #"(.*)cano$"      "$1re" ;; dicano -> dire
+         #"(.*)ano$"       "$1irsi" ;; vestano -> vestirsi
+         ]}]))


using set-user

using set-user

--- src/celestial/persistency/migrations.clj
+++ src/celestial/persistency/migrations.clj
@@ -1,7 +1,7 @@
 (ns celestial.persistency.migrations
   "Celestial global migrations"
  (:require
-   [celestial.security :refer (current-user)]
+   [celestial.security :refer (set-user)]
    [puny.migrations :refer (migrate)]
    [celestial.persistency.systems :as s]
    [celestial.persistency :as p]))
@@ -19,6 +19,6 @@
 (defn setup-migrations
    "registers and runs migrations"
    []
-  (with-redefs [current-user (fn [] (p/get-user "admin"))]
+  (set-user (p/get-user "admin")
     (register-all)
     (migrate-all)))


dont need to intercept the response

dont need to intercept the response

--- src/clj/org/openforis/ceo/db/geodash.clj
+++ src/clj/org/openforis/ceo/db/geodash.clj
@@ -55,8 +55,8 @@
   (let [path (:path params)
         url  (if (str/includes? server-name "local")
                "https://ceodev.servirglobal.net"
-               "https://localhost")] ; TODO I cant get the gatway to run on my machine, test this on the server
-    (data-response (tc/json->clj (:body (client/post (str url ":8888/" path)
-                                                     {:body (tc/clj->json json-params)
-                                                      :content-type :json
-                                                      :accept :json}))))))
+               "https://localhost")]
+    (client/post (str url ":8888/" path)
+                 {:body (tc/clj->json json-params)
+                  :content-type :json
+                  :accept :json})))


Make functions private

Make functions private

--- src/clj/rumahsewa141/routes/register.clj
+++ src/clj/rumahsewa141/routes/register.clj
@@ -13,7 +13,7 @@
 (def default-value {:nickname ""
                     :phone_no ""})

-(defn register-user! [username password nickname phone_no]
+(defn- register-user! [username password nickname phone_no]
   (when-let [_ (db/create-user! (merge default-value {:username username
                                                       :password (hashers/encrypt password)
                                                       :nickname nickname
@@ -21,13 +21,13 @@
     (layout/render "success.html" {:title "Success!"
                                    :description "You have been registered."})))

-(defn valid-registration? [params]
+(defn- valid-registration? [params]
   (b/valid? params
             :username [v/required available-username]
             :password v/required
             :confirm v/required))

-(defn get-registration-error [params]
+(defn- get-registration-error [params]
   (apply str (:username (first (b/validate
                                 params
                                 :username [v/required available-username]
@@ -35,10 +35,10 @@
                                 :confirm v/required)))))

 (defn do-registration [{{:keys [username
-                             password
-                             confirm
-                             nickname
-                             phone_no] :as params} :params}]
+                                password
+                                confirm
+                                nickname
+                                phone_no] :as params} :params}]
   (if (valid-registration? params)
     (if (= password confirm)
       (register-user! username password nickname phone_no)


pass Component into websocket tunnel

pass Component into websocket tunnel

--- src/cljc/ow/starbuck/impl/websocket.cljc
+++ src/cljc/ow/starbuck/impl/websocket.cljc
@@ -17,11 +17,11 @@
            (sente/make-channel-socket! path
                                        {:wrap-recv-evs? false})))

-(defn- handle-inbound-sentemsg [{:keys [recv-fn] :as this} {:keys [id ?data] :as sentemsg}]
+(defn- handle-inbound-sentemsg [{:keys [recv-component] :as this} {:keys [id ?data] :as sentemsg}]
   (debug "got inbound message:" id ?data)
   ;;; TODO: add auth checking
   ;;; TODO: maybe add msg shaping
-  (recv-fn ?data))
+  (p/deliver recv-component ?data))

 (defn- start-inbound-msg-handler! [{:keys [senteobjs] :as this}]
   (let [ch-recv (:ch-recv senteobjs)]
@@ -42,10 +42,10 @@
         (do (debug "channel not open yet, delaying:" msg)
             (recur (a/<! (a/timeout 500))))))))

-(defrecord ComponentWebsocket [recv-fn    ;; server & client
-                               path       ;; client
-                               userid-fn  ;; server
-                               senteobjs  ;; start/stop
+(defrecord ComponentWebsocket [recv-component    ;; server & client
+                               path              ;; client
+                               userid-fn         ;; server
+                               senteobjs         ;; start/stop
                                ]

   p/Component
@@ -54,11 +54,11 @@
     (do-send this (update msg :ow.starbuck.routing/component pop))))

 ;;; TODO: implement client for server side (not via sente, see factum project):
-#?(:clj  (defn tunnel [recv-fn userid-fn]
-           (map->ComponentWebsocket {:recv-fn recv-fn
+#?(:clj  (defn tunnel [recv-component userid-fn]
+           (map->ComponentWebsocket {:recv-component recv-component
                                      :userid-fn userid-fn}))
-   :cljs (defn tunnel [recv-fn path]
-           (map->ComponentWebsocket {:recv-fn recv-fn
+   :cljs (defn tunnel [recv-component path]
+           (map->ComponentWebsocket {:recv-component recv-component
                                      :path path})))

 (defn start [this]


removed duplicate handler registrations

removed duplicate handler registrations

--- src/cljs/phonecat_re_frame/handlers.cljs
+++ src/cljs/phonecat_re_frame/handlers.cljs
@@ -39,20 +39,6 @@
     app-state))

 (re-frame/register-handler
-  :process-phone-detail-response
-  (fn
-    ;; store info for the specific phone-id in the db
-    [app-state [_ phone-id response]]
-    (assoc-in app-state [:phone-details (keyword phone-id)] response)))
-
-(re-frame/register-handler
-  :process-phone-detail-bad-response
-  (fn
-    [app-state [_ phone-id response]]
-    (println "Error getting phone detail for id: " phone-id)
-    app-state))
-
-(re-frame/register-handler
   :load-phone-detail
   (fn
     ;; fetch information for the phone with the given phone-id
@@ -77,18 +63,6 @@
     [app-state [_ [phone-id response]]]
     (println "Error getting phone detail for id: " phone-id)
     (println response)
-    app-state))
-
-(re-frame/register-handler
-  :load-phone-detail
-  (fn
-    ;; fetch information for the phone with the given phone-id
-    [app-state [_ phone-id]]
-    (ajax/GET (str "phones/" phone-id ".json")
-              {:handler #(re-frame/dispatch [:process-phone-detail-response phone-id %1])
-               :error-handler #(re-frame/dispatch [:process-phone-detail-bad-response phone-id %1])
-               :response-format :json
-               :keywords? true})
     app-state))

 (re-frame/register-handler


Made ULTRA pad shorter program with '(), which makes it work more equally for longer programs.

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -342,16 +342,22 @@
   (if (or (not (seq? p1))
           (not (seq? p2)))
     p1 ;; can't do if either program isn't a list
-    (remove-empties
-      (open-close-sequence-to-list
-        (balance
-          (linearly-mutate
-            (alternate (list-to-open-close-sequence p1)
-                       (list-to-open-close-sequence p2)
-                       alternation-rate
-                       alignment-deviation)
-            mutation-rate
-            atom-generators))))))
+    (let [p1 (if (>= (count p1) (count p2))
+               p1
+               (concat p1 (repeat (- (count p2) (count p1)) '())))
+          p2 (if (>= (count p2) (count p1))
+               p2
+               (concat p2 (repeat (- (count p1) (count p2)) '())))]
+      (remove-empties
+        (open-close-sequence-to-list
+          (balance
+            (linearly-mutate
+              (alternate (list-to-open-close-sequence p1)
+                         (list-to-open-close-sequence p2)
+                         alternation-rate
+                         alignment-deviation)
+              mutation-rate
+              atom-generators)))))))

 ;(let [p1 '(a (b c) (d ((e)) f))
 ;      p2 '((1 2 3) 4 ((5)) 6)]


CMR-339: Fixed field mappings.

CMR-339: Fixed field mappings.

--- src/cmr/search/data/query_to_elastic.clj
+++ src/cmr/search/data/query_to_elastic.clj
@@ -12,17 +12,13 @@
                 :provider :provider-id
                 :short_name :short-name
                 :version :version-id
-                :granule_ur :granule-ur
-                :collection_concept_id :collection-concept-id
                 :project :project-sn
                 :two_d_coordinate_system_name :two-d-coord-name}
    :granule {:entry_title :entry-title
              :provider :provider-id
-             :short_name :short-name
-             :version :version-id
              :granule_ur :granule-ur
              :collection_concept_id :collection-concept-id
-             :project :project-ref}})
+             :project :project-refs}})

 (defn query-field->elastic-field
   "Returns the elastic field name for the equivalent query field name."


Document or make private.

Document or make private.

--- src/fhofherr/simple/engine.clj
+++ src/fhofherr/simple/engine.clj
@@ -154,20 +154,31 @@
       (map->JobDescriptor)))

 (defn get-job-execution
+  "Obtain the job execution with id `exec-id` from the job descriptor
+  `job-desc`. Return `nil` if no execution with `exec-id` exists."
   [job-desc exec-id]
   (get @(:executions job-desc) exec-id))

 (defn get-last-execution
+  "Obtain the last executed job execution from `job-desc`. Return `nil`
+  if no job has been executed yet."
   [job-desc]
   (get-job-execution job-desc @(:executor job-desc)))

-(defn query-last-execution
+(defn- apply-to-last-execution
+  "Apply the function `f` to the last job execution of `job-desc`. Return
+  whatever `f` returns. If `job-desc` has no executions and `else` is given
+  return `else`. If `else` is not given and there are no job executions for
+  `job-desc` return `nil`."
   [job-desc f & [else]]
   (if-let [last-exec (get-last-execution job-desc)]
     (f last-exec)
     else))

-(defn- query-new-executions
+(defn- apply-to-new-executions
+  "Apply the function `f` to a vector of all of `job-desc`'s job executions
+  whose id is higher than the id of the last executed job execution. The vector
+  passed to `f` may be empty."
   [job-desc f]
   (let [execs @(:executions job-desc)
         start-id @(:executor job-desc)]
@@ -179,19 +190,19 @@
   StatusModel
   (created? [this] (and (empty? @(:executions this))
                         (< @(:executor this) 0)))
-  (queued? [this] (query-new-executions this #(some queued? %)))
-  (executing? [this] (query-new-executions this #(some executing? %)))
-  (successful? [this] (query-last-execution this successful?))
-  (failed? [this] (query-last-execution this failed?)))
-
-(defn update-job-execution!
+  (queued? [this] (apply-to-new-executions this #(some queued? %)))
+  (executing? [this] (apply-to-new-executions this #(some executing? %)))
+  (successful? [this] (apply-to-last-execution this successful?))
+  (failed? [this] (apply-to-last-execution this failed?)))
+
+(defn- update-job-execution!
   [job-desc exec-id f & args]
   (dosync
     (as-> (:executions job-desc) execs
       (alter execs update-in [exec-id] #(apply f % args))))
   job-desc)

-(defn update-context!
+(defn- update-context!
   [job-desc exec-id f & args]
   (update-job-execution! job-desc exec-id #(as-> (:context %) $
                                              (apply f $ args))))
@@ -241,6 +252,8 @@
     [exec-id exec]))

 (defn execute-job!
+  "Synchronously execute the job execution with id `exec-id`. See
+  [[schedule-job!]] for asynchronous job execution. "
   [job-desc exec-id]
   (letfn [(apply-job-fn [job-fn exec] (io! (job-fn (:context exec))))]
     (update-job-execution! job-desc exec-id mark-executing)


facts are getting collected.

facts are getting collected.

--- integration/dda/pallet/crate/dda_servertest_crate/instantiate_aws.clj
+++ integration/dda/pallet/crate/dda_servertest_crate/instantiate_aws.clj
@@ -31,7 +31,7 @@

 (defn integrated-group-spec [count]
   (merge
-    (domain/dda-servertest-crate-stack-configuration domain-config)
+    (domain/dda-servertest-group (domain/dda-servertest-crate-stack-configuration domain-config))
     (cloud-target/node-spec)
     {:count count}))

@@ -43,7 +43,7 @@

 (defn server-test
-  ([]
+  ([count]
    (operation/do-server-test (cloud-target/provider) (integrated-group-spec count)))
-  ([key-id key-passphrase]
-   (operation/do-server-test (cloud-target/provider) (integrated-group-spec count))))
+  ([key-id key-passphrase count]
+   (operation/do-server-test (cloud-target/provider key-id key-passphrase) (integrated-group-spec count))))


Take a different tack, seems to work.

Take a different tack, seems to work.

Needs quite a bit of cleanup work though. WIP.

--- src/gorilla_repl/websocket_transport.clj
+++ src/gorilla_repl/websocket_transport.clj
@@ -1,28 +1,27 @@
 (ns gorilla-repl.websocket-transport
   (:require [org.httpkit.server :as server]
+            [clojure.tools.nrepl :as nrepl]
             [clojure.tools.nrepl.server :as nrepl-server]
-            [clojure.tools.nrepl.transport :as transport]
             [cheshire.core :as json]))
+
+(defonce server (nrepl-server/start-server :port 7888))
+
+(defonce conn (nrepl/connect :port 7888))

 (defn send-json-over-ws
   [channel data]
-  (println "Sent:" data)
   (server/send! channel (json/generate-string data)))

-
-(def handler (nrepl-server/default-handler))
-
 (defn process-message
-  [transport data]
-  (println "Received:" data)
-  (let [parsed-message (json/parse-string data true)]
-    (nrepl-server/handle* parsed-message handler transport)))
-
+  [channel data]
+  (let [parsed-message (json/parse-string data true)
+        client (nrepl/client conn 1000)
+        replies (nrepl/message client parsed-message)]
+    (doall (map (partial send-json-over-ws channel) replies))))

 (defn ring-handler
   [request]
   (server/with-channel
     request
     channel
-    (let [transport (transport/fn-transport nil (partial send-json-over-ws channel))]
-      (server/on-receive channel (partial process-message transport)))))
+    (server/on-receive channel (partial process-message channel))))


Fix #13

Fix #13

--- src/leiningen/new/onyx_app.clj
+++ src/leiningen/new/onyx_app.clj
@@ -19,7 +19,7 @@
                 ["project.clj" (render "project.clj" data)]
                 ["Dockerfile" (render "Dockerfile" data)]

-                ["script/run-app.sh" (render "run-app.sh" data)]
+                [(str "script/run-" name ".sh") (render "run-app.sh" data)]
                 ["script/build.sh" (render "build.sh" data)]

                 ["env/dev/user.clj" (render "user.clj" data)]
@@ -56,7 +56,7 @@
                   ["project.clj" (render "project.clj" data)]
                   ["Dockerfile" (render "Dockerfile" data)]

-                  ["script/run-app.sh" (render "run-app.sh" data)]
+                  [(str "script/run-" name ".sh") (render "run-app.sh" data)]
                   ["script/build.sh" (render "build.sh" data)]

                   ["env/dev/user.clj" (render "user.clj" data)]


Only enable travis in init, and not in start

--- src/leiningen/pallet_release/release.clj
+++ src/leiningen/pallet_release/release.clj
@@ -81,9 +81,6 @@
   (lein/clean project)
   (lein/test project)
   (println)
-  (print "travis… ")
-  (travis/enable project)
-  (println)
   (git/release-start new-version)
   (update-release-notes old-version new-version)
   (lein/update-versions project old-version new-version)


show scanned

show scanned

--- src/cljs/meins/electron/renderer/ui/config/qr_scanner.cljs
+++ src/cljs/meins/electron/renderer/ui/config/qr_scanner.cljs
@@ -42,9 +42,9 @@
         (.then scan))
     (info "QR scanner did mount")))

-(defn qr [local _]
+(defn qr [cfg _]
   [:div
-   (if-let [s (:scanned @local)]
+   (if-let [s (:mobile @cfg)]
      [:div.scanned
       [:pre [:code (with-out-str (pp/pprint s))]]]
      [:video#qr-video])])
@@ -59,4 +59,4 @@
       {:component-did-mount    (partial did-mount local cfg)
        :component-will-unmount (partial will-unmount local)
        :display-name           "QR-Scanner"
-       :reagent-render         (partial qr local)})))
+       :reagent-render         (partial qr cfg)})))


don't save state unless it's changed

don't save state unless it's changed

--- src/cljs/org/broadinstitute/firecloud_ui/common/table.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/common/table.cljs
@@ -312,7 +312,8 @@
                   :display-rows clipped-rows
                   :no-data? (empty? clipped-rows))))))
    :component-did-mount
-   (fn [{:keys [this state]}]
+   (fn [{:keys [this state locals]}]
+     (swap! locals assoc :initial-state (select-keys @state [:column-meta :query-params :filter-group-index]))
      (react/call :refresh-rows this)
      (set! (.-onMouseMoveHandler this)
            (fn [e]
@@ -334,12 +335,13 @@
              (swap! state dissoc :dragging? :drag-column :mouse-x :saved-user-select-state)))
      (.addEventListener js/window "mouseup" (.-onMouseUpHandler this)))
    :component-did-update
-   (fn [{:keys [this prev-props props prev-state state]}]
+   (fn [{:keys [this prev-props props prev-state state locals]}]
      (when (or (not= (:data props) (:data prev-props))
                (not= (:query-params @state) (:query-params prev-state)))
        (react/call :refresh-rows this))
      (when (and (:state-key props)
-                (not (:dragging? @state)))
+                (not (:dragging? @state))
+                (not (= (select-keys @state [:column-meta :query-params :filter-group-index]) (:initial-state @locals))))
        (persistence/save {:key (:state-key props) :state state :only [:column-meta :query-params :filter-group-index]})))
    :component-will-unmount
    (fn [{:keys [this]}]


version upgrades

version upgrades

--- Clojure-Websockets/project.clj
+++ Clojure-Websockets/project.clj
@@ -5,7 +5,7 @@
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.6.0"]
                  [twitter-api "0.7.6"]
-                 [org.clojure/core.async "0.1.319.0-6b1aca-alpha"]
+                 [org.clojure/core.async "0.1.338.0-5c5012-alpha"]
                  [twitter-streaming-client "0.3.2"]
                  [clojurewerkz/elastisch "2.1.0-beta6"]
                  [org.clojure/tools.logging "0.3.0"]
@@ -16,7 +16,7 @@
                  [ring/ring-defaults "0.1.1"]
                  [clj-time "0.8.0"]
                  [pandect "0.3.4"]
-                 [org.clojure/clojurescript "0.0-2268"]
+                 [org.clojure/clojurescript "0.0-2322"]
                  [tailrecursion/cljs-priority-map "1.1.0"]
                  [org.clojure/data.priority-map "0.0.5"]
                  [om "0.7.1"]]
@@ -31,12 +31,11 @@
             [com.cemerick/clojurescript.test "0.3.1"]]

   :cljsbuild {:builds [{:id "dev"
-
                         :source-paths ["src/cljs"]
                         :compiler {:output-to "resources/public/js/build/birdwatch.js"
                                    :output-dir "resources/public/js/build/out"
-                                   :optimizations :none
-                                   :source-map true}}
+                                   :optimizations :simple
+                                   :source-map "resources/public/js/build/birdwatch.js"}}
                        {:id "release"
                         :source-paths ["src/cljs"]
                         :compiler {:output-to "resources/public/js/build/birdwatch-opt.js"


one tweak to data migration.

one tweak to data migration.

--- src/metabase/db/migrations.clj
+++ src/metabase/db/migrations.clj
@@ -210,9 +210,8 @@
                   (let [{raw-column-id :id} (db/ins RawColumn
                                               :raw_table_id  raw-table-id
                                               :name          column-name
-                                              :base_type     (:base_type field)
                                               :is_pk         (= :id (:special_type field))
-                                              :details       {}
+                                              :details       {:base-type (:base_type field)}
                                               :active        true)]
                     ;; update the Field and link it with the RawColumn
                     (k/update Field


add migration to fix any dashboard cards with NULL :row or :col values.

--- src/metabase/db/migrations.clj
+++ src/metabase/db/migrations.clj
@@ -124,6 +124,7 @@
                      :sizeY (when sizeY (* sizeY 4))})
       (k/where {:id id}))))

+
 ;; migrate data to new visibility_type column on field
 (defmigration migrate-field-visibility-type
   (when (< 0 (:cnt (first (k/select Field (k/aggregate (count :*) :cnt) (k/where (= :visibility_type "unset"))))))
@@ -149,3 +150,23 @@
       (k/set-fields {:visibility_type "normal"})
       (k/where      {:visibility_type "unset"
                      :active          true}))))
+
+
+;; deal with dashboard cards which have NULL `:row` or `:col` values
+(defmigration fix-dashboard-cards-without-positions
+  (let [bad-dashboards (k/select DashboardCard (k/fields [:dashboard_id]) (k/modifier "DISTINCT") (k/where (or (= :row nil) (= :col nil))))]
+    (when (not-empty bad-dashboards)
+      (log/info "Looks like we need to fix unpositioned cards in these dashboards:" (mapv :dashboard_id bad-dashboards))
+      ;; we are going to take the easy way out, which is to put bad-cards at the bottom of the dashboard
+      (doseq [{dash-to-fix :dashboard_id} bad-dashboards]
+        (let [max-row   (or (:row (first (k/select DashboardCard (k/aggregate (max :row) :row) (k/where {:dashboard_id dash-to-fix})))) 0)
+              max-size  (or (:size (first (k/select DashboardCard (k/aggregate (max :sizeY) :size) (k/where {:dashboard_id dash-to-fix, :row max-row})))) 0)
+              max-y     (+ max-row max-size)
+              bad-cards (k/select DashboardCard (k/fields :id :sizeY) (k/where {:dashboard_id dash-to-fix}) (k/where (or (= :row nil) (= :col nil))))]
+          (loop [[bad-card & rest] bad-cards
+                 row-target        max-y]
+            (k/update DashboardCard
+              (k/set-fields {:row row-target
+                             :col 0})
+              (k/where      {:id  (:id bad-card)}))
+            (when rest (recur rest (+ row-target (:sizeY bad-card))))))))))


Made basename private.

Made basename private.

--- src/midje/parsing/util/file_position.clj
+++ src/midje/parsing/util/file_position.clj
@@ -45,8 +45,7 @@

-;; TODO: Make private
-(defn basename [string]
+(defn- basename [string]
   (last (str/split string #"/")))

 ;; TODO: Make private.


Fix SQLite "last month" behavior edge case :scream_cat:

--- src/metabase/driver/sqlite.clj
+++ src/metabase/driver/sqlite.clj
@@ -37,13 +37,14 @@
 (defn- date
   "Apply truncation / extraction to a date field or value for SQLite.
    See also the [SQLite Date and Time Functions Reference](http://www.sqlite.org/lang_datefunc.html)."
-  [_ unit expr]
+  [unit expr]
   ;; Convert Timestamps to ISO 8601 strings before passing to SQLite, otherwise they don't seem to work correctly
   (let [v (if (instance? java.sql.Timestamp expr)
             (kx/literal (u/date->iso-8601 expr))
             expr)]
     (case unit
       :default         (->datetime v)
+      :second          (->datetime (strftime "%Y-%m-%d %H:%M:%S" v))
       :minute          (->datetime (strftime "%Y-%m-%d %H:%M" v))
       :minute-of-hour  (kx/->integer (strftime "%M" v))
       :hour            (->datetime (strftime "%Y-%m-%d %H:00" v))
@@ -78,26 +79,28 @@
                              3)
       :year            (kx/->integer (strftime "%Y" v)))))

-(def ^:private datetime (partial k/sqlfn* :DATETIME))
+(defn- date-interval [unit amount]
+  (let [[multiplier sqlite-unit] (case unit
+                                   :second  [1 "seconds"]
+                                   :minute  [1 "minutes"]
+                                   :hour    [1 "hours"]
+                                   :day     [1 "days"]
+                                   :week    [7 "days"]
+                                   :month   [1 "months"]
+                                   :quarter [3 "months"]
+                                   :year    [1 "years"])]
+    ;; Make a string like DATETIME(DATE('now', 'start of month'), '-1 month')
+    ;; The date bucketing will end up being done twice since `date` is called on the results of `date-interval` automatically. This shouldn't be a big deal because it's used for relative dates and only needs to be done once in a given query.
+    ;; It's important to call `date` on 'now' to apply bucketing *before* adding/subtracting dates to handle certain edge cases as discussed in issue #2275 (https://github.com/metabase/metabase/issues/2275).
+    ;; Basically, March 30th minus one month becomes Feb 30th in SQLite, which becomes March 2nd. DATE(DATETIME('2016-03-30', '-1 month'), 'start of month') is thus March 1st.
+    ;; The SQL we produce instead (for "last month") ends up looking something like: DATE(DATETIME(DATE('2015-03-30', 'start of month'), '-1 month'), 'start of month'). It's a little verbose, but gives us the correct answer (Feb 1st).
+    (->datetime (date unit (kx/literal "now"))
+                (kx/literal (format "%+d %s" (* amount multiplier) sqlite-unit)))))

-(defn- date-interval [_ unit amount]
-  (let [[multiplier unit] (case unit
-                            :second  [1 "seconds"]
-                            :minute  [1 "minutes"]
-                            :hour    [1 "hours"]
-                            :day     [1 "days"]
-                            :week    [7 "days"]
-                            :month   [1 "months"]
-                            :quarter [3 "months"]
-                            :year    [1 "years"])]
-    ;; Make a string like DATE('now', '+7 days')
-    (datetime (kx/literal "now")
-              (kx/literal (format "%+d %s" (* amount multiplier) unit)))))
-
-(defn- unix-timestamp->timestamp [_ expr seconds-or-milliseconds]
+(defn- unix-timestamp->timestamp [expr seconds-or-milliseconds]
   (case seconds-or-milliseconds
-    :seconds      (datetime expr (kx/literal "unixepoch"))
-    :milliseconds (recur nil (kx// expr 1000) :seconds)))
+    :seconds      (->datetime expr (kx/literal "unixepoch"))
+    :milliseconds (recur (kx// expr 1000) :seconds)))

 (defrecord SQLiteDriver []
   clojure.lang.Named
@@ -106,7 +109,7 @@
 (u/strict-extend SQLiteDriver
   driver/IDriver
   (merge (sql/IDriverSQLDefaultsMixin)
-         {:date-interval  date-interval
+         {:date-interval  (u/drop-first-arg date-interval)
           :details-fields (constantly [{:name         "db"
                                         :display-name "Filename"
                                         :placeholder  "/home/camsaul/toucan_sightings.sqlite 😋"
@@ -126,8 +129,8 @@
           :connection-details->spec  (fn [_ details]
                                        (kdb/sqlite3 details))
           :current-datetime-fn       (constantly (k/raw "DATETIME('now')"))
-          :date                      date
+          :date                      (u/drop-first-arg date)
           :string-length-fn          (constantly :LENGTH)
-          :unix-timestamp->timestamp unix-timestamp->timestamp}))
+          :unix-timestamp->timestamp (u/drop-first-arg unix-timestamp->timestamp)}))

 (driver/register-driver! :sqlite (SQLiteDriver.))


Cleanup code.

Cleanup code.

--- src/oc/storage/representations/topic.clj
+++ src/oc/storage/representations/topic.clj
@@ -11,8 +11,5 @@
 (defn topic-template-for-rendering
   "Add a create link to the provided topic template."
   [org-slug board-slug topic]
-  (println org-slug)
-  (println board-slug)
-  (println topic)
   (assoc topic :links [(hateoas/create-link (url org-slug board-slug topic) {:content-type mt/entry-media-type
                                                                              :accept mt/entry-media-type})]))


Revert "Fix flow conditions route IDs. Route no where when exception without handlers."

This reverts commit ac9122a6d0774e1c3723b696e2f01dfc3d53e61d.

--- src/onyx/flow_conditions/fc_routing.cljc
+++ src/onyx/flow_conditions/fc_routing.cljc
@@ -40,7 +40,7 @@
       (let [e (:exception (ex-data message))]
         (lc/handle-exception
          event :lifecycle/apply-fn e (:compiled-handle-exception-fn compiled)))
-      (->Route [] nil nil nil))
+      (->Route egress-ids nil nil nil))
     (if (exception? message)
       (if (seq compiled-ex-fcs)
         (choose-output-paths event compiled-ex-fcs result (:exception (ex-data message)) egress-ids)


cleaner

cleaner

--- cljs-admin/tourneybot_admin/core.cljs
+++ cljs-admin/tourneybot_admin/core.cljs
@@ -361,12 +361,11 @@
                                          games-for-this-round)
         num-games-in-this-round (count games-only-in-this-round)
         ;; are all the games in this swiss round finished?
-        num-games-finished (count (filter #(= (:status (second %)) final-status)
-                                          games-only-in-this-round))
+        num-games-finished (count (filter game-finished? (vals games-only-in-this-round)))
         all-finished? (= num-games-in-this-round num-games-finished)
         one-game-left? (= num-games-in-this-round (inc num-games-finished))
         final-game-in-this-round (when one-game-left?
-                                   (first (filter #(not= (:status (second %)) final-status)
+                                   (first (filter #(not (game-finished? (second %)))
                                                   games-only-in-this-round)))]
     [:div.swiss-panel-container
       (when prev-round-finished?


Remove use of memoize in DogstatsD sender.

--- src/onyx/metrics/dogstatsd.clj
+++ src/onyx/metrics/dogstatsd.clj
@@ -32,7 +32,7 @@
         (str kw-or-s))
       str->dogstatsd-str))

-(defn dogstatsd-metric-name*
+(defn dogstatsd-metric-name
   [{:keys [task-name window quantile metric]}]
   (str (kw-or-str->dogstatsd-str task-name) "."
        (when window
@@ -40,9 +40,6 @@
        (when quantile
          (str (quantile->str quantile) "_"))
        (kw-or-str->dogstatsd-str metric)))
-
-;; since we'll be calling this thousands of times, might aswell make it efficient
-(def dogstatsd-metric-name (memoize dogstatsd-metric-name*))

 (defn metric->dogstatsd-metric
   [{:keys [value tags] :as metric}]


Avoid stack overflow by avoiding concat's lazyness

--- src/onyx/peer/virtual_peer.clj
+++ src/onyx/peer/virtual_peer.clj
@@ -13,7 +13,7 @@
     (do
       (doseq [reaction (filter :immediate? reactions)]
         (clojure.core.async/>!! outbox-ch reaction))
-      (update-in state [:buffered-outbox] concat (remove :immediate? reactions)))
+      (update state :buffered-outbox into (remove :immediate? reactions)))
     (do
       (doseq [reaction reactions]
         (clojure.core.async/>!! outbox-ch reaction))
@@ -28,6 +28,7 @@
                            :replica replica-atom
                            :peer-replica-view peer-view-atom
                            :log log
+                           :buffered-outbox []
                            :messenger-buffer buffer
                            :messenger messenger
                            :monitoring monitoring


Clean up lifecycle resources.

Clean up lifecycle resources.

--- src/onyx/peer/virtual_peer.clj
+++ src/onyx/peer/virtual_peer.clj
@@ -4,7 +4,14 @@
             [taoensso.timbre :as timbre]
             [dire.core :as dire]
             [onyx.extensions :as extensions]
+            [onyx.peer.task-lifecycle-extensions :as l-ext]
             [onyx.peer.task-lifecycle :refer [task-lifecycle]]))
+
+(defn force-close-pipeline! [pipeline]
+  (try
+    (l-ext/close-lifecycle-resources* (:pipeline-data pipeline))
+    (catch Exception e
+      (timbre/warn e))))

 (defn payload-loop [id sync queue payload-ch shutdown-ch status-ch dead-ch pulse opts]
   (let [complete-ch (chan 1)
@@ -17,6 +24,7 @@
         (cond (nil? v) (extensions/delete sync (:node pulse))
               (= ch complete-ch) (recur nil)
               (= ch shutdown-ch) (recur nil)
+              (= ch err-ch) (force-close-pipeline! pipeline)
               (= ch payload-ch)
               (let [payload-node (:path v)
                     payload (extensions/read-node sync payload-node)


fix bug where all state using things are borked

I guess this is why people write tests, but whatever

--- src/shoutout.clj
+++ src/shoutout.clj
@@ -119,6 +119,7 @@
   "completely activate a feature for all users"
   [{storage :storage} feature-name]
   (update-in-storage
+    feature-name
     #(assoc %
             :percentage
             100)))
@@ -126,6 +127,7 @@
 (defn deactivate "completely turn off a feature for all users"
   [{storage :storage} feature-name]
   (update-in-storage
+    feature-name
     #(assoc %
             :percentage 0
             :groups #{}
@@ -136,6 +138,7 @@
   A group should just be a string"
   [{storage :storage} feature-name group]
   (update-in-storage
+    feature-name
     (fn [feature]
       (update-in feature
                 :groups
@@ -146,6 +149,7 @@
   A group is just a string"
   [{storage :storage} feature-name group]
   (update-in-storage
+    feature-name
     (fn [feature]
       (update-in feature
                  :groups
@@ -155,6 +159,7 @@
   "activate a feature for a particular user"
   [{storage :storage} feature-name user]
   (update-in-storage
+    feature-name
     (fn [feature]
       (update-in feature
                 :users
@@ -164,6 +169,7 @@
   "deactivate a feature for a particular user"
   [{storage :storage} feature-name user]
   (update-in-storage
+    feature-name
     (fn [feature]
       (update-in feature
                  :users
@@ -174,6 +180,7 @@
   percentages are out of 100"
   [{storage :storage} feature-name percent]
   (update-in-storage
+    feature-name
     (fn [feature]
       (assoc feature
              :percentage


Header row and better formatting when printing pipelines in plugin.

--- src/pipeline/grafter/pipeline/plugin.clj
+++ src/pipeline/grafter/pipeline/plugin.clj
@@ -15,10 +15,15 @@
 (defn collapse-whitespace [s]
   (string/replace s #"(\n| )+" " "))

+(def format-str "%-60s %-9s %-20s %s")
+
+(def header-row (String/format format-str (into-array Object ["Pipeline" "Type" "Arguments" "Description"])))
+
 (defn- format-pipeline [pipeline]
-  (let [pattern "%1$-60s %2$-30s %3$s"
+  (let [pattern format-str
         data (into-array Object
                          [(fully-qualified-name pipeline)
+                          (name (:type pipeline))
                           (if-let [args (:args pipeline)]
                             (string/join ", " args)
                             "???")
@@ -28,10 +33,10 @@
     (String/format pattern data)))

 (defn list-pipelines []
-  (map format-pipeline (all-pipelines-on-classpath)))
+  (cons header-row (map format-pipeline (all-pipelines-on-classpath))))

 (defn list-pipes []
-  (map format-pipeline (all-pipes-on-classpath)))
+  (cons header-row (map format-pipeline (all-pipes-on-classpath))))

 (defn list-grafts []
-  (map format-pipeline (all-grafts-on-classpath)))
+  (cons header-row (map format-pipeline (all-grafts-on-classpath))))


missing count broadcast

missing count broadcast

--- Clojure-Websockets/MainApp/src/clj/birdwatch/percolator/percolator.clj
+++ Clojure-Websockets/MainApp/src/clj/birdwatch/percolator/percolator.clj
@@ -42,7 +42,7 @@
   "Count the number of currently connected client (for display in UI)."
   [{:keys [cmp-state put-fn]}]
   (let [connected-uids (:connected-uids @cmp-state)]
-    (put-fn [:stats/users-count (count (:any connected-uids))])))
+    (put-fn (with-meta [:stats/users-count (count (:any connected-uids))] {:sente-uid :broadcast}))))

 (defn state-pub-handler
   "Handle incoming messages: process / add to application state."


Keep message list rendered while switching between tabs

--- src/status_im/ui/screens/chat/views.cljs
+++ src/status_im/ui/screens/chat/views.cljs
@@ -198,8 +198,7 @@
             my-public-key                      [:account/public-key]
             show-bottom-info?                  [:chats/current-chat-ui-prop :show-bottom-info?]
             show-message-options?              [:chats/current-chat-ui-prop :show-message-options?]
-            show-stickers?                     [:chats/current-chat-ui-prop :show-stickers?]
-            current-view                       [:get :view-id]]
+            show-stickers?                     [:chats/current-chat-ui-prop :show-stickers?]]
     ;; this scroll-view is a hack that allows us to use on-blur and on-focus on Android
     ;; more details here: https://github.com/facebook/react-native/issues/11071
     [react/scroll-view {:scroll-enabled               false
@@ -210,10 +209,8 @@
                   :on-layout (fn [e]
                                (re-frame/dispatch [:set :layout-height (-> e .-nativeEvent .-layout .-height)]))}
       [chat-toolbar public? modal?]
-      (if (or (= :chat current-view) modal?)
-        [messages-view-animation
-         [messages-view-wrapper modal?]]
-        [react/view style/message-view-preview])
+      [messages-view-animation
+       [messages-view-wrapper modal?]]
       (when (show-input-container? my-public-key current-chat)
         [input/container])
       (when show-stickers?


Revert previous change where add returns self, this is best left up to the implementation.

--- src/rdf-common/grafter/rdf.clj
+++ src/rdf-common/grafter/rdf.clj
@@ -60,17 +60,20 @@
   "Adds a sequence of statements to the specified datasink.  Supports
   all the same targets as add-statement.

-  Takes an optional string/URI to use as a graph."
+  Takes an optional string/URI to use as a graph.
+
+  Returns target."
   ([target triples]
-     (pr/add target triples))
+   (pr/add target triples))
+
   ([target graph triples]
-     (pr/add target graph triples))
+   (pr/add target graph triples))

   ([target graph format triple-stream]
-     (pr/add target graph format triple-stream))
+   (pr/add target graph format triple-stream))

   ([target graph base-uri format triple-stream]
-     (pr/add target graph base-uri format triple-stream)))
+   (pr/add target graph base-uri format triple-stream)))

 (defn statements
   "Attempts to coerce an arbitrary source of RDF statements into a


Correct typical units

Correct typical units

Previous commits used atypical units for injection rate and proppant
concentration.

This commit changes these units to more typical values.

--- src/test_utils/fracture_diagnostics.cljc
+++ src/test_utils/fracture_diagnostics.cljc
@@ -306,6 +306,7 @@
                    [:kPa :MPa] #(/ % 1000)
                    [:C :F] #(+ (* % 1.8) 32)
                    [:ft :m] #(/ (* % 30.48) 100)}]
+
     (converter [from to])))

 (defn typical-monitor-pressure [units]
@@ -347,20 +348,19 @@
         (repeatedly (fn [] (typical-surface-treating-pressure arg)))))

 (defn rand-injection-rate-unit []
-  (rand-nth [:bbl-per-min :bpm :l-per-s :cu-ft-per-s]))
+  (rand-nth [:bbl-per-min :bpm :m3-per-min :m3/min]))

 (defn typical-injection-rate
   ([]
-   (let [units (rand-injection-rate-unit)]
-     (typical-injection-rate units)))
-  ([units]
-   (cond (or (= units :bbl-per-min)
-             (= units :bpm))
+   (let [unit (rand-injection-rate-unit)]
+     [unit (typical-injection-rate unit)]))
+  ([unit]
+   (cond (or (= unit :bbl-per-min)
+             (= unit :bpm))
          (value-from-typical-range 75 100)
-         (= units :l-per-s)
-         (value-from-typical-range 198.75 265)
-         (= units :cu-ft-per-s)
-         (value-from-typical-range 7.05 9.4))))
+         (or (= unit :m3-per-min)
+             (= unit :m3/min))
+         (value-from-typical-range 11.92 15.9))))

 (defn injection-rate-seq [arg]
   (cond (int? arg)
@@ -369,16 +369,25 @@
         (keyword? arg)
         (repeatedly (fn [] (typical-injection-rate arg)))))

+(defn rand-proppant-concentration-unit []
+  (rand-nth [:lb-per-gal :lb/gal :kg-per-m3 :kg/m3]))
+
 (defn typical-proppant-concentration
   ([]
-   [:ppga (typical-proppant-concentration :ppga)])
-  ([units]
-   (cond (= units :ppga)
-         (value-from-typical-range 0.2 10))))
+   (let [unit (rand-proppant-concentration-unit)]
+     [unit (typical-proppant-concentration unit)]))
+  ([unit]
+   (cond (or (= unit :lb-per-gal)
+             (= unit :lb/gal))
+         (value-from-typical-range 0.2 10)
+         (or (= unit :kg-per-m3)
+             (= unit :kg/m3))
+         (let [conversion (/ 0.453592 0.00378541)]
+           (value-from-typical-range (* 0.2 conversion) (* 10 conversion))))))

 (defn proppant-concentration-seq [arg]
   (cond (int? arg)
-        (let [unit :ppga]
+        (let [unit (rand-proppant-concentration-unit)]
           [unit (take arg (proppant-concentration-seq unit))])
         (keyword? arg)
         (repeatedly (fn [] (typical-proppant-concentration arg)))))


Added messageId and timestamp to SSE event

--- src/trumpet_server/domain/trumpeteer.clj
+++ src/trumpet_server/domain/trumpeteer.clj
@@ -29,6 +29,9 @@

 (def default-max-distance 200)

+(defn- new-uuid [] (.toString (java.util.UUID/randomUUID)))
+(defn- time-now [] (System/currentTimeMillis))
+
 (defrecord Trumpeteer [id latitude longitude]
   Location Trumpet
   (distance-to [this other]
@@ -45,6 +48,6 @@
     (let [targets-without-this (filter #(not= (:id %) (:id this)) trumpetees)
           targets-with-distance (map #(assoc % :distance (distance-to this % :meters)) targets-without-this)
           targets-in-range (filter #(<= (:distance %) (or max-distance-meters default-max-distance)) targets-with-distance)
-          messages-to-broadcast (map #(into {} {:id (:id %) :message {:message trumpet :distanceFromSource (:distance %)}}) targets-in-range)]
+          messages-to-broadcast (map #(into {} {:id (:id %) :message {:message trumpet :distanceFromSource (:distance %) :messageId (new-uuid) :timestamp (time-now)}}) targets-in-range)]
       (doseq [message messages-to-broadcast]
         (broadcast-fn (:id message) (:message message))))))


Add Locality validations to v5 validations

--- src/vip/data_processor/validation/v5.clj
+++ src/vip/data_processor/validation/v5.clj
@@ -9,7 +9,8 @@
             [vip.data-processor.validation.v5.state :as state]
             [vip.data-processor.validation.v5.hours-open :as hours-open]
             [vip.data-processor.validation.v5.election-administration :as election-admin]
-            [vip.data-processor.validation.v5.election :as election]))
+            [vip.data-processor.validation.v5.election :as election]
+            [vip.data-processor.validation.v5.locality :as locality]))

 (def validations
   [candidate/validate-no-missing-ballot-names
@@ -35,4 +36,7 @@
    election-admin/validate-voter-service-type-format
    election/validate-one-election
    election/validate-date
-   election/validate-state-id])
+   election/validate-state-id
+   locality/validate-no-missing-names
+   locality/validate-no-missing-state-ids
+   locality/validate-types])


Add TODOs

Add TODOs

--- src/structural_typing/frob.clj
+++ src/structural_typing/frob.clj
@@ -27,6 +27,7 @@
         (sequential? v) (vec v)
         :else (vector v)))

+;; TODO: Soon defunct - see type-repo
 (defn nested-map->path-map
   "In single-argument form, converts a nested map into a flat one where the keys
    a vectors with a path representing the existing nested structure.
@@ -49,6 +50,7 @@

+;; TODO: Soon defunct - see type-repo
 (defn flatten-path-representation
   "Convert an atom into a vector of that sequential.
    Convert a sequential into a flattened vector.
@@ -83,5 +85,7 @@
            (let [extended (for [pp parent-paths] (conj pp (first v)))]
              (flatten-path-representation (vec extended) (rest v))))))

+;; TODO: Soon defunct - see type-repo
 (defn flatten-N-path-representations [v]
   (vec (mapcat flatten-path-representation v)))
+


test for trigrams flow

test for trigrams flow

--- test/corpusmaker/test_wikipedia_flow.clj
+++ test/corpusmaker/test_wikipedia_flow.clj
@@ -71,3 +71,29 @@
           (is (= "Anarchism\tis" (nth output-lines 1)))
           (is (= "Anarchism\ta" (nth output-lines 2)))
           (is (= "Anarchism\tpolitical" (nth output-lines 3))))))))
+
+
+(defn- more-than-one? [count] (> count 1))
+
+(deftest test-trigrams
+  (with-log-level :warn
+    (with-tmp-files [sink-path (temp-path "corpusmaker-test-sink")]
+      (let [flow
+            (c/flow
+              {"wikipedia" (ccw/wikipedia-tap *sample-dumpfile*)}
+              (c/lfs-tap (c/text-line ["trigram" "count"]) sink-path)
+              (->
+                (c/pipe "wikipedia")
+                (ccw/remove-redirect)
+                (ccw/parse-markup)
+                (ccw/trigrams)
+                (c/group-by "trigram")
+                (c/count "count")
+                (c/filter ["count"] #'more-than-one?)))]
+        (c/exec flow)
+        (let [output-lines (ds/read-lines (ju/file sink-path "part-00000"))]
+          (is (= 475 (.size output-lines)))
+          (is (= "6 per 1,000\t2" (nth output-lines 0)))
+          (is (= "a form of\t3" (nth output-lines 1)))
+          (is (= "a high level\t2" (nth output-lines 2)))
+          (is (= "a history of\t2" (nth output-lines 3))))))))


Fix name of path to post evaluation input to

--- src/todo_repl_webapp/views.clj
+++ src/todo_repl_webapp/views.clj
@@ -101,7 +101,7 @@
       [:h3 "Login"
        [:div.row
         (form/form-to
-                      [:post "/login"]
+                      [:post "login"]
                       (form/text-field {:class "form-control"}
                                                "username")
                       (form/password-field "password")


track signups on the username overlay

track signups on the username overlay

--- src-cljs/frontend/components/overlay.cljs
+++ src-cljs/frontend/components/overlay.cljs
@@ -143,6 +143,12 @@
             "Help your team communicate faster with each other by using custom names. "
             "Log in or sign up to change how your name appears in chat."]
            [:a.prompt-button {:href (auth/auth-url)
+                              :on-click #(do
+                                           (.preventDefault %)
+                                           (cast! :track-external-link-clicked
+                                                  {:path (auth/auth-url)
+                                                   :event "Signup Clicked"
+                                                   :properties {:source "username-overlay"}}))
                               :role "button"}
             "Sign Up"]]
           [:div.menu-footer


issues only on the bare subdomain

issues only on the bare subdomain

--- src-cljs/frontend/components/overlay.cljs
+++ src-cljs/frontend/components/overlay.cljs
@@ -121,7 +121,7 @@
                          :role "button"}
            (common/icon :docs)
            [:span "Documents"]]
-          [:a.vein.make {:href "/issues"
+          [:a.vein.make {:href (urls/absolute-url "/issues" :subdomain nil)
                          :role "button"}
            (common/icon :docs)
            [:span "Issues"]]


:pencil2: Fix typo in frontend

:pencil2: Fix typo in frontend

--- frontend/src/uxbox/main/locales/en.cljs
+++ frontend/src/uxbox/main/locales/en.cljs
@@ -75,7 +75,7 @@
    "errors.profile.update-password" "Error updating password, probably your old password is wrong."

    "errors.network" "Unable to connect to backend server."
-   "errors.generic" "Something work has happened."
+   "errors.generic" "Something wrong has happened."
    "errors.conflict" "Conflict on saving data, please refresh and try again."

    })


write complete bug-patches

write complete bug-patches

--- src/atom_finder/questions/bug_patches.clj
+++ src/atom_finder/questions/bug_patches.clj
@@ -86,7 +86,7 @@
        (map (fn [[common added removed]] [(merge common (:added-atoms added)) (merge common (:removed-atoms removed))]))
        transpose
        ((fn [[addeds removeds]]
-          (maps-to-csv "src/analysis/data/atoms-in-bugs_gcc_2018-01-11_added.csv_partial" (-> addeds first keys (concat (map :name atoms))) addeds)
-          (maps-to-csv "src/analysis/data/atoms-in-bugs_gcc_2018-01-11_removed.csv_partial" (-> removeds first keys (concat (map :name atoms))) removeds)
+          (maps-to-csv "src/analysis/data/atoms-in-bugs_gcc_2018-01-11_added.csv" (-> addeds first keys (concat (map :name atoms))) addeds)
+          (maps-to-csv "src/analysis/data/atoms-in-bugs_gcc_2018-01-11_removed.csv" (-> removeds first keys (concat (map :name atoms))) removeds)
                ))
        ))


just show the group's tags on the tags (channels) page

--- src/chat/client/views/pages/channels.cljs
+++ src/chat/client/views/pages/channels.cljs
@@ -28,52 +28,33 @@
                           (aset (.. e -target) "value" "")))
                       :placeholder "New Tag"}))))

-(defn group-tags-view [[group-id tags] owner opts]
-  (reify
-    om/IRender
-    (render [_]
-      (dom/div #js {:className "group"}
-        (dom/h2 #js {:className "name"}
-          (:name (store/id->group group-id)))
-        (om/build new-tag-view {:group-id group-id} {:opts opts})
-        (apply dom/div #js {:className "tags"}
-          (map (fn [tag]
-                 (dom/div #js {:className "tag-info"}
-                   (dom/span #js {:className "count threads-count"}
-                     (tag :threads-count))
-                   (dom/span #js {:className "count subscribers-count"}
-                     (tag :subscribers-count))
-                   (om/build tag-view tag)
-                   (subscribe-button tag)))
-              tags))))))
-
-(defn groups-view [grouped-tags owner opts]
-  (reify
-    om/IRender
-    (render [_]
-      (apply dom/div #js {:className "groups"}
-        (om/build-all group-tags-view grouped-tags {:opts opts})))))
-
 (defn channels-page-view [data owner]
   (reify
     om/IRender
     (render [_]
       (dom/div #js {:className "page channels"}
         (dom/div #js {:className "title"}
-          "Channels")
+          "Tags")

         (dom/div #js {:className "content"}
-          (let [groups-map (->> (keys (data :groups))
-                                (into {} (map (juxt identity (constantly nil))) ))
-                ; groups-map is just map of group-ids to nil, to be merged with
-                ; tags, so there is still an entry for groups without any tags
-                grouped-tags (->> (data :tags)
-                                  vals
-                                  (map (fn [tag]
-                                         (assoc tag :subscribed?
-                                           (store/is-subscribed-to-tag? (tag :id)))))
-                                  (sort-by :threads-count)
-                                  reverse
-                                  (group-by :group-id)
-                                  (merge groups-map))]
-            (om/build groups-view grouped-tags)))))))
+          (let [group-id (data :open-group-id)
+                tags (->> (data :tags)
+                          vals
+                          (filter (fn [t] (= group-id (t :group-id))))
+                          (sort-by :threads-count)
+                          reverse
+                          (map (fn [tag]
+                                 (assoc tag :subscribed?
+                                   (store/is-subscribed-to-tag? (tag :id))))))]
+            (dom/div nil
+              (om/build new-tag-view {:group-id group-id})
+              (apply dom/div #js {:className "tags"}
+                (map (fn [tag]
+                       (dom/div #js {:className "tag-info"}
+                         (dom/span #js {:className "count threads-count"}
+                           (tag :threads-count))
+                         (dom/span #js {:className "count subscribers-count"}
+                           (tag :subscribers-count))
+                         (om/build tag-view tag)
+                         (subscribe-button tag)))
+                     tags)))))))))


Closing the SSE channel on exception

Closing the SSE channel on exception

--- src/elefant_server/domain/sse_service.clj
+++ src/elefant_server/domain/sse_service.clj
@@ -11,11 +11,13 @@
 (defn broadcast-message! [trumpeteer-id message]
   {:pre [trumpeteer-id]}
   (log/info "Sending message" (:message message) "with id" (:id message) "to trumpeteer" trumpeteer-id)
-  (if-let [subscriber (@subscribers trumpeteer-id)]
+  (if-let [subscriber (@subscribers trumpeteer-id)
+           stream (:sse-stream subscriber)]
     (do (reset! (:last-accessed subscriber) (time/now))
         (try
-          (go (>! (:sse-stream subscriber) (with-meta message {:event-type "trumpet"})))
+          (go (>! stream (with-meta message {:event-type "trumpet"})))
           (catch Exception e (do
+                               (close! stream)
                                (log/warn "Couldn't send" (:message message) "with id" (:id message) "to trumpeteer" trumpeteer-id "because:\n" (.printStackTrace e) "\nWill remove subscriber.")
                                (swap! subscribers dissoc trumpeteer-id)))))
     (log/warn "Failed to send message with id" (:id message) "because trumpetee " trumpeteer-id " is not a subscriber.")))


Feature-flag Build Diagnostics.

Feature-flag Build Diagnostics.

Revert me to make Build Diagnostics public.

--- src-cljs/frontend/components/dashboard.cljs
+++ src-cljs/frontend/components/dashboard.cljs
@@ -7,6 +7,7 @@
             [frontend.components.project.common :as project-common]
             [frontend.models.plan :as plan-model]
             [frontend.models.project :as project-model]
+            [frontend.models.feature :as feature]
             [frontend.routes :as routes]
             [frontend.state :as state]
             [frontend.utils :as utils :include-macros true]
@@ -85,7 +86,8 @@

                :else
                [:div.dashboard
-                (when project
+                (when (and (feature/enabled? :build-diagnostics)
+                           project)
                   (om/build build-diagnostics {:data data :project project}))
                 (when (and plan (project-common/show-trial-notice? project plan))
                   [:div.container-fluid


Fix def-tuple-session test to reflect changes in last commit

--- test/clj/libx/macros_test.cljc
+++ test/clj/libx/macros_test.cljc
@@ -11,6 +11,7 @@
   (testing "Macroexpansion should be the same as equivalent
             arguments to defsession"
       (is (= (macroexpand `(defsession ~'foo
+                            'libx.impl.rules
                             'libx.macros-test
                             :fact-type-fn :a
                             :ancestors-fn (util/make-ancestors-fn)
@@ -22,6 +23,7 @@

   (testing "Allow overwrite defaults"
     (let [clara-session `(defsession ~'foo
+                           'libx.impl.rules
                            'libx.macros-test
                            :fact-type-fn ~'(fn [x] (or (:a x)
                                                      (:b x)))
@@ -39,10 +41,11 @@

   (testing "Expand schema opt to ancestors fn"
     (is (= (macroexpand `(defsession ~'foo
+                           'libx.impl.rules
                            'libx.macros-test
                            :fact-type-fn :a
-                           :ancestors-fn (util/make-ancestors-fn ~(schema/schema->hierarchy
-                                                                    libx.schema/libx-schema))
+                           :ancestors-fn (util/make-ancestors-fn (schema/schema->hierarchy
+                                                                    ~libx.schema/libx-schema))
                            :activation-group-fn (util/make-activation-group-fn ~core/default-group)
                            :activation-group-sort-fn (util/make-activation-group-sort-fn
                                                        ~core/groups


cleanup

cleanup

--- test/clojento/magento/t_db.clj
+++ test/clojento/magento/t_db.clj
@@ -107,20 +107,20 @@
             ; variant (child product)
             (get-product-data (:db @system) 3)  => (contains {:found true}))
       (fact "is-product"
-                   (get-product-data (:db @system) -1) => (contains {:is-product false})
-                   (get-product-data (:db @system) 1)  => (contains {:is-product true})
-                   (get-product-data (:db @system) 2)  => (contains {:is-product true})
-                   (get-product-data (:db @system) 3)  => (contains {:is-product false}))
+            (get-product-data (:db @system) -1) => (contains {:is-product false})
+            (get-product-data (:db @system) 1)  => (contains {:is-product true})
+            (get-product-data (:db @system) 2)  => (contains {:is-product true})
+            (get-product-data (:db @system) 3)  => (contains {:is-product false}))
       (fact "is-variant"
-                   (get-product-data (:db @system) -1) => (contains {:is-variant false})
-                   (get-product-data (:db @system) 1)  => (contains {:is-variant false})
-                   (get-product-data (:db @system) 2)  => (contains {:is-variant false})
-                   (get-product-data (:db @system) 3)  => (contains {:is-variant true}))
+            (get-product-data (:db @system) -1) => (contains {:is-variant false})
+            (get-product-data (:db @system) 1)  => (contains {:is-variant false})
+            (get-product-data (:db @system) 2)  => (contains {:is-variant false})
+            (get-product-data (:db @system) 3)  => (contains {:is-variant true}))
       (fact "product-id (id of the parent for variants)"
-                   (get-product-data (:db @system) -1) => (contains {:product-id nil})
-                   (get-product-data (:db @system) 1)  => (contains {:product-id 1})
-                   (get-product-data (:db @system) 2)  => (contains {:product-id 2})
-                   (get-product-data (:db @system) 3)  => (contains {:product-id 2}))
+            (get-product-data (:db @system) -1) => (contains {:product-id nil})
+            (get-product-data (:db @system) 1)  => (contains {:product-id 1})
+            (get-product-data (:db @system) 2)  => (contains {:product-id 2})
+            (get-product-data (:db @system) 3)  => (contains {:product-id 2})) ; product-id == parent-id
       (fact "has meta"
             (meta (get-product-data (:db @system) -1 :debug true)) =not=> nil?)
       (fact "meta contains total time"


Simplify ns-form, thanks to class!

Simplify ns-form, thanks to class!

--- test/spec_tools/core_test.cljc
+++ test/spec_tools/core_test.cljc
@@ -1,6 +1,5 @@
 (ns spec-tools.core-test
-  (:require #?(:clj [clojure.test :refer [deftest testing is]]
-               :cljs [cljs.test :as test :refer-macros [deftest testing is]])))
+  (:require [clojure.test :refer [deftest testing is]]))

 (deftest a-test
   (is (= 1 1)))


Fix shadowed test

Fix shadowed test

This prevented some of the tests from running.

--- test/superstring/core_test.clj
+++ test/superstring/core_test.clj
@@ -69,15 +69,16 @@
     (str/ends-with? (str s suffix ) (str/swap-case suffix) :ignore-case)))

 (defexamples ends-with?
-  nil (str/ends-with? "ß" "ss" :ignore-case)
-  nil (str/ends-with? "ß" "SS" :ignore-case)
-  "aß" (str/ends-with? "aß" "ß" :ignore-case))
+  (str/ends-with? "foobar" "foo") nil
+  (str/ends-with? "ß" "ss" :ignore-case) nil
+  (str/ends-with? "ß" "SS" :ignore-case) nil
+  (str/ends-with? "aß" "ß" :ignore-case) "aß")

 (defexamples starts-with?
-  nil (str/starts-with? "foo" "foobar")
-  nil (str/starts-with? "ß" "ss" :ignore-case)
-  nil (str/starts-with? "ß" "SS" :ignore-case)
-  "ßa" (str/starts-with? "ßa" "ß" :ignore-case))
+  (str/starts-with? "foo" "foobar") nil
+  (str/starts-with? "ß" "ss" :ignore-case) nil
+  (str/starts-with? "ß" "SS" :ignore-case) nil
+  (str/starts-with? "ßa" "ß" :ignore-case) "ßa")

 (defspec starts-with?-acts-like-startsWith 100
   (prop/for-all [s gen/string
@@ -115,10 +116,13 @@
       0)))

 (defspec swap-case-changes-case 100
-  (prop/for-all [s gen/string]
-    (let [cases1 (map case-to-int s)
-          cases2 (map case-to-int (str/swap-case s))]
-      (apply = 0 (map + cases1 cases2)))))
+  (prop/for-all [s string-without-german-b]
+    (let [count-uppers (partial reduce (fn [acc c] (if (str/upper-case? (str c))
+                                                     (inc acc) 0)) 0)
+          count-lowers (partial reduce (fn [acc c] (if (str/lower-case? (str c))
+                                                     (inc acc) 0)) 0)]
+      (and (= (count-uppers s) (count-lowers (str/swap-case s)))
+           (= (count-lowers s) (count-uppers (str/swap-case s)))))))

 (defexamples swap-case
   (str/swap-case "fOO" ) "Foo"
@@ -282,11 +286,9 @@
                  after gen/string]
     (str/contains? (str before needle after) needle :ignore-case)))

-(defexamples contains-all?
+(defexamples contains-all-test?
   (str/contains-all? "" []) ""
   (str/contains-all? "" [""]) ""
-  (str/contains-all? "" [nil]) nil
-  (str/contains-all? nil [""]) nil
   (str/contains-all? "12" ["1" "2"]) "12"
   (str/contains-all? "foo" ["fo" "o"]) "foo"
   (str/contains-all? "foobar" ["qux"]) nil
@@ -295,7 +297,7 @@
   (str/contains-all? "foobar" ["BAR" "Foo"] :ignore-case) "foobar"
   (str/contains-all? "Albert Åberg" ["åberg" "al"] :ignore-case)   "Albert Åberg")

-(defspec contains-all? 100
+(defspec contains-all-finds-generated-strings? 100
   (prop/for-all [s1 gen/string
                  s2 gen/string
                  s3 gen/string]


Don't re-open bottom sheet if now closing

Signed-off-by: Gheorghe Pinzaru <742a0a3885ab52ea1795e48e261ec4223e194612@gmail.com>

--- src/quo/components/bottom_sheet/view.cljs
+++ src/quo/components/bottom_sheet/view.cljs
@@ -157,10 +157,10 @@
      (fn []
        (when (and (> height min-height)
                   @visible)
-         (animated/block
-          [(animated/stop-clock clock)
-           (animated/set open-snap-point (* -1 sheet-height))
-           (animated/set manual-open 1)])))
+         (animated/cond* (animated/not* manual-close)
+                         [(animated/stop-clock clock)
+                          (animated/set open-snap-point (* -1 sheet-height))
+                          (animated/set manual-open 1)])))
      [height @visible])
     ;; NOTE(Ferossgp): Remove me when RNGH will suport modal
     (rn/use-back-handler


warning fix

warning fix

--- src/cljs/swarmpit/component/api_access.cljs
+++ src/cljs/swarmpit/component/api_access.cljs
@@ -101,8 +101,8 @@
                {:variant  "contained"
                 :disabled false
                 :onClick  generate-handler
-                :color    "primary"
-                (case state :none "Generate" "Regenerate")})
+                :color    "primary"}
+                (case state :none "Generate" "Regenerate"))
              (comp/button
                {:variant  "outlined"
                 :disabled (= :none state)


4clojure:: find equivalent classes using some neat idempotent predicate :)

--- src/clojure_learning/4clojure-exercises.clj
+++ src/clojure_learning/4clojure-exercises.clj
@@ -1666,6 +1666,7 @@
 ;; one-("(" ")" "(" ")" "(" ")"), two-("(" ")" "(" "(" ")" ")"),  last-("(" "(" "(" ")" ")" ")")

 ;; as we see the second need to produce also the reversed version -> final version:
+

 ;;;;;;;;;;;;;;;;;;;;;;
 ;; Split by Type
@@ -3689,37 +3690,82 @@
 ;; -> 28
 (defn calc [forms]
   (fn [bound-map]
-    (let [ops {'/ "/" '* "*" '+ "+" '- "-"}]
-    (letfn [(resolve-one
-              [bound-map [head & tail]]
-                 (when-not (nil? head)
-                   (cons (if (symbol? head)
-                           (if-let [func (get ops head)]
-                             (read-string func)
-                             (get bound-map head))
-                           head)
-                         (resolve-one bound-map tail))))]
-      (resolve-one bound-map forms)
-;;       (map #(resolve-one bound-map %) (list forms))
-      ))))
-
-(eval ((calc '(/ a b)) '{a 16 b 8}))
-((calc '(/ a b)) '{a 8 b 2}) ;; (/ 8 2)
-((calc '(* (+ a 2) (- 10 b))) '{a 16 b 8})
-
-(cons (first '(/ 2 3)) (cons 3 (cons 3 '()))) ;; (/ 3 3)
-(symbol? (first '(/ 2 3)))  ;; true
-(fn? (first '(/ 2 3)))   ;; false
-(symbol? (first '(a b))) ;; true
-
-(apply (resolve (first '(+ 1 1))) [8 3]) ;; 11
-(apply (ns-resolve *ns* (first '(+ 1 1))) [8 3]) ;; 11
-(symbol? (first '(/ 2))) ;; true
-(apply (ns-resolve *ns* (first '(/ 1 1))) [8 2])
-(fn? (ns-resolve *ns* (first '(/ 1 1))))
-(ns-resolve *ns* (first '(/ 1 1)))
-(symbol? (ns-resolve *ns* (first '(/ 1 1))))
-(fn? clojure.core//)
-(source eval)
-(list '(/ 1 2))
-(clojure.string/replace symbol? "avc" "as")
+    (let [ops {'/ / '* * '+ + '- -}]
+      (letfn [(rebind-and-apply
+                [m-vals [func & args]]
+                (apply
+                   (get ops func)
+                      (reduce
+                        (fn [acc el]
+                          (if (symbol? el)
+                            (conj acc (get m-vals el))
+                            (if (sequential? el)
+                              (conj acc (rebind-and-apply m-vals el))
+                              (conj acc el))))
+                        [] args)))]
+      (rebind-and-apply bound-map forms)))))
+
+;; in action:
+((calc '(/ a b)) '{a 8 b 2})              ;; 4
+((calc '(+ a b)) '{a 16 b 8})             ;; 24
+((calc '(* (+ a 2) (- 10 b))) '{a 3 b 4}) ;; 30
+
+(comment
+  (symbol? (first '(/ 2 3)))  ;; true
+  (fn? (first '(/ 2 3)))   ;; false
+  (symbol? (first '(a b))) ;; true
+  (apply (resolve (first '(+ 1 1))) [8 3]) ;; 11
+  (apply (ns-resolve *ns* (first '(+ 1 1))) [8 3]) ;; 11
+  (symbol? (first '(/ 2))) ;; true
+  (apply (first '(+ 1 1)) [8 3]) ;; 11
+  (fn? (first '(+ 1 1)))
+)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Equivalence Classes
+;; Difficulty:	Medium
+;; Topics:
+;; A function f defined on a domain D induces an equivalence relation on D, as follows:
+;; a is equivalent to b with respect to f, if and only if (f a) is equal to (f b).
+;; Write a function with arguments f and D that computes the equivalence classes of D with respect to f.
+;; (= (__ #(* % %) #{-2 -1 0 1 2})
+;;    #{#{0} #{1 -1} #{2 -2}})
+
+;; -2 * -2 = 2 * 2
+;; -1 * -1 = 1 * 1
+;;  0 * 0 = 0 * 0
+;; how i think of?
+;; map the fun over each set-el -> ({el val}...{}); then group-by func applied to each -> filter with [a b]
+(defn find-equivalent-classes
+  [func xset]
+   (map
+      (fn [x]
+        (assoc {} x (func x)))
+      xset))
+
+;; current computation yields:
+(find-equivalent-classes #(* % %) #{-2 -1 0 1 2})
+;; ({0 0} {1 1} {-2 4} {-1 1} {2 4})
+
+;; final version:: then group-by func + filter idempotent? + map...
+(defn find-equivalent-classes
+  [func xset]
+  (letfn [(idempotent? [f x] (= (f x) (f (f x))))]
+    (->> xset
+       (group-by func)
+       (filter (fn [map-entry]
+                 (let [k (first map-entry)
+                       v (second map-entry)]
+                   (or (< 1 (count v))
+                       (idempotent? func (first v))
+                       (idempotent? func (last v))))))
+       (map (comp set second))   ;; (#{0} #{1 -1} #{-2 2} #{-3 3})
+       set)))                    ;; last set is for making the 4clojure tests run, although we have the above val :(
+
+;; in application:
+(find-equivalent-classes #(* % %) #{-3 -2 9 -1 0 1 2 3 5}) ;; #{#{-3 3} #{1 -1} #{-2 2} #{0}}
+(find-equivalent-classes identity #{0 1 2 3 4})            ;; #{#{0} #{1} #{2} #{3} #{4}}
+(= (find-equivalent-classes identity #{0 1 2 3 4})
+   #{#{0} #{1} #{2} #{3} #{4}})                            ;; -> true
+
+


Updated test for function mode->str

Updated test for function mode->str

--- test/zg/html_renderer_test.clj
+++ test/zg/html_renderer_test.clj
@@ -147,6 +147,7 @@
             "whitelist"    :whitelist
             "blacklist"    :blacklist
             "atomic-typos" :atomic-typos
+            "glossary"     :glossary
             "whitelist"    :other
             "whitelist"    nil)))


Use env variable for number of bench messages

--- test/onyx/plugin/input_benchmark_test.clj
+++ test/onyx/plugin/input_benchmark_test.clj
@@ -37,8 +37,8 @@
 (defn decompress [x]
   (nip/thaw x decompress-opts))

-(def messages-per-partition 5000000)
-(def n-partitions 1)
+(def messages-per-partition (or (System/getenv "BENCH_MESSAGES") 50000))
+(def n-partitions 2)

 (defn print-message [segment]
   segment


:sparkles: Load only one canvas on fixtures.

--- backend/src/uxbox/fixtures.clj
+++ backend/src/uxbox/fixtures.clj
@@ -64,14 +64,7 @@
                                       :x1 200
                                       :y1 200
                                       :x2 1224
-                                      :y2 968}
-                                     {:id (mk-uuid "canvas" i 2)
-                                      :name "Canvas 2"
-                                      :type :canvas
-                                      :x1 1324
-                                      :y1 200
-                                      :x2 2348
-                                      :y2 968}]}
+                                      :y2 968}]
                      :metadata {:width 1024
                                 :height 768
                                 :layout "tablet"}


Add onClick handler for sample select.

Add onClick handler for sample select.

--- sonic-jam/src/sonic_jam/core.cljs
+++ sonic-jam/src/sonic_jam/core.cljs
@@ -206,6 +206,7 @@
           :sample (p (dom/span #js {:onClick #(transition {:state :init})} (str "{- " (:width state) " sample ... "))
                      (apply dom/select #js {:value (:sample state)
                                             :onChange #(handle-change % owner state :sample)
+                                            :onClick #(handle-change % owner state :sample)
                                             :onKeyDown #(when (= 13 (.-which %))
                                                           (commit))}
                             (map #(dom/option nil %) (om/observe owner (samples))))


Update server side morph-state definition

--- src-clj/cljs_workspace/server.clj
+++ src-clj/cljs_workspace/server.clj
@@ -23,27 +23,27 @@
 (def clients (atom {}))

 (def app-state
-   (atom {:url "/data"
+  (atom {:url "/data"
           :server/id 42
           :coll {:id 1
-                :text "Hi!"
-                :morph {:Position {:x 0 :y 42}}
-                :shape {:BorderWidth 5
+                :morph {:id 1 :Position {:x 0 :y 42}}
+                :shape {:id 1
+                        :BorderWidth 5
                         :BorderColor "rgb(0,0,0)"
                         :Fill "rgb(255,255,255)"
                         :Extent {:x 300 :y 300}}
                 :submorphs [{:id 2
-                             :morph {:id 2 :Position {:x 100 :y 100}}
+                             :morph {:Position {:x 100 :y 100} :isDraggable true}
                              :shape {:Fill "rgb(0,0,255)"
                                      :Extent {:x 42 :y 42}}
                              :submorphs []}
                              {:id 3
-                              :morph {:id 3 :Position {:x 100 :y 100}}
+                              :morph {:Position {:x 100 :y 100} :isDraggable true}
                               :shape {:Fill "rgb(250, 250, 0)"
                                       :ShapeClass "Ellipse"
                                       :Extent {:x 100 :y 100}}}
                               {:id 5
-                                :morph {:Position {:x 0 :y 0}}
+                                :morph {:Position {:x 0 :y 0} :isDraggable true}
                                 :shape {:Extent {:x 110 :y 40}
                                         :BorderColor "rgb(92,77, 11)"
                                         :BorderWidth 2
@@ -52,7 +52,8 @@
                                       {:id 4
                                        :morph {:MorphClass "Text"
                                                :Position {:x 10 :y 10}
-                                               :TextString "Hallo Welt!"}
+                                               :TextString "Hallo Welt!"
+                                               :isDraggable true}
                                        :shape {:ShapeClass "Text"
                                                :Extent {:x 100 :y 30}}}]}]}}))


Refactoring

Refactoring

--- src-cljs/githubcomments/core.cljs
+++ src-cljs/githubcomments/core.cljs
@@ -7,10 +7,16 @@

 (def repo ["Magnetic" "Platform-Guild"])

-(defn render-comment [repo comment]
+(defn rendered-comment [repo comment element]
   "Render the given comment in the context of the given repository."
   (go (let [response (async/<! (render-user-content-markdown (:body comment) repo))]
         (.log js/console (:body response)))))

-(go (let [response (async/<! (repo-comments repo))]
-      (dorun (map (partial render-comment repo) (:body response)))))
+(defn init []
+  (let [element (dom/getElement "github-comments")]
+    (go (let [response (async/<! (repo-comments repo))]
+          (dorun (map (partial rendered-comment repo) (:body response)))))
+
+    ))
+
+(init)


Removed unused code

Removed unused code

--- src/webapp/framework/client/coreclient.cljs
+++ src/webapp/framework/client/coreclient.cljs
@@ -434,13 +434,13 @@

-(log "df")
+(comment log "df")

 (defn from-server []
   (GET "http://127.0.0.1:3000/main.html")
 )

-(go
+(comment go
   (log (count (<! (from-server))))
   (log (count (<! (GET "http://127.0.0.1:3000/main.html"))))
  )


Update quest description

Update quest description

--- src/braid/client/quests/list.cljs
+++ src/braid/client/quests/list.cljs
@@ -5,7 +5,7 @@

    {:id :quest/conversation-new
     :name "Start a conversation"
-    :description "Conversations are the heart of Braid. Start one using the box in the bottom left corner."
+    :description "Conversations are the heart of Braid. Type in the box in the bottom left corner and hit [Enter]."
     :icon \uf0e6
     :goal 3
     :listener (fn [state [event args]]


create a document in elasticsearch in simple-import_file

--- src/brainbot/nozzle/esconnect.clj
+++ src/brainbot/nozzle/esconnect.clj
@@ -145,7 +145,16 @@

 (defn simple-import_file
   [fs es-index {directory :directory {relpath :relpath :as entry} :entry :as body} {publish :publish}]
-  (println "simple-import-file" fs directory relpath (keys body)))
+  (let [parent-id (make-id "" directory)
+        id (make-id "" directory relpath)]
+
+    (println "simple-import-file" fs id)
+
+    (esd/put es-index "doc"
+             id
+             {:parent parent-id
+              :lastmodified (get-in entry [:stat :mtime])})))
+

 (defn simple-update_directory


Implement The All-Seeing I

Implement The All-Seeing I

--- src/clj/game/cards-operations.clj
+++ src/clj/game/cards-operations.clj
@@ -385,6 +385,25 @@

    "Sweeps Week"
    {:effect (effect (gain :credit (count (:hand runner))))}
+
+   "The All-Seeing I"
+   (let [trash-all-resources {:player :runner
+                              :effect (req (doseq [resource (get-in runner [:rig :resource])]
+                                             (trash state side resource {:cause :ability-cost})))
+                              :msg (msg "trash all resources")}]
+       {:req (req tagged)
+        :effect (req (prn (not (zero? (:bad-publicity corp))))
+                 (resolve-ability
+                      state side
+                      (if (not (zero? (:bad-publicity corp))) ;; If corp's bad-pub is 0
+                        {:optional {:player :runner
+                                    :prompt "Remove 1 bad publicity from the corp to prevent all resources from being trashed?"
+                                    :yes-ability {:effect (effect (lose :corp :bad-publicity 1))
+                                                  :player :corp
+                                                  :msg (msg "lose 1 bad publicity, preventing all resources from being trashed")}
+                                    :no-ability trash-all-resources}}
+                        trash-all-resources)
+                      card targets))})

    "Traffic Accident"
    {:req (req (>= (:tag runner) 2)) :effect (effect (damage :meat 2 {:card card}))}


prevent bug if Corp clicks ice with no advancements after playing Commercialization

--- src/clj/game/cards-operations.clj
+++ src/clj/game/cards-operations.clj
@@ -155,8 +155,8 @@
    {:req (req tagged) :effect (effect (lose :runner :credit :all))}

    "Commercialization"
-   {:msg (msg "gain " (:advance-counter target) " [Credits]")
-    :choices {:req #(has? % :type "ICE")} :effect (effect (gain :credit (:advance-counter target)))}
+   {:msg (msg "gain " (or (:advance-counter target) 0) " [Credits]")
+    :choices {:req #(has? % :type "ICE")} :effect (effect (gain :credit (or (:advance-counter target) 0)))}

    "Corporate Shuffle"
    {:effect (effect (shuffle-into-deck :hand) (draw 5))}


fix profile pic

fix profile pic

--- src/cljs/salava/user/ui/data.cljs
+++ src/cljs/salava/user/ui/data.cljs
@@ -92,13 +92,15 @@
         fullname (str first_name " " last_name)
         site-url (session/get :site-url)
         ]
+    (dump user_followers)
+    (dump user_following)
     [:div {:id "cancel-account"}
      [:h1.uppercase-header (t :user/Mydata)]
      [:div
       [:p (str (t :user/Deleteinstruction)  (t :user/Todeletedata) " ") [:a {:href (path-for "/user/cancel")} (t :user/Removeaccount)]]
       ]

-     [:div.panel {:id "my-data"}
+     [:div.panel {:id "profile"}
       [m/modal-window]
       [:div.panel-body
        [:div {:id "page-buttons-share"}
@@ -115,9 +117,10 @@
           (t :badge/Export)]]]

        [:div.row
-        (when profile_picture [:div {:class "col-md-3 col-sm-3 col-xs-12"}
-                               [:div.profile-picture-wrapper
-                                [:img.profile-picture {:src (profile-picture profile_picture)
+        (when profile_picture [:div {:class "col-md-3 col-sm-3 col-xs-12 "}
+                               [:div {:class "profile-picture-wrapper"}
+                                [:img {:src (profile-picture profile_picture)
+                                                       :style {:max-width "150px"}
                                                        :alt fullname}]]])
         [:div {:class "col-md-9 col-sm-9 col-xs-12"}
          [:div.row
@@ -169,7 +172,7 @@
           [:div.col-xs-12 [:b (str (t :user/Emailnotifications) ": ")] (str email_notifications)]
           [:div.col-xs-12 [:b (str (t :user/Privateprofile) ": ")] (str private)]
           [:div.col-xs-12 [:b (str (t :user/Activated) ": ")] (str activated?)]
-          [:div.col-xs-12 [:b (str (t :user/Profilevisibility) ": ")] profile_visibility]]
+          [:div.col-xs-12 [:b (str (t :user/Profilevisibility) ": ")] profile_visibility]]]]

          [:div {:style {:margin-bottom "20px"}}
           [:h2 {:class "uppercase-header"} (str (t :badge/Badges) ": ")(count user_badges)]
@@ -265,7 +268,7 @@
                               status (:status f)]]
                     ^{:key f}[:div
                               [:div.col-xs-12 [:b (str (t :badge/Name) ": ")] [:a {:href "#" :on-click #(mo/open-modal [:user :profile] {:user-id (:user_id f)})} (str (:first_name f) " " (:last_name f) )]]
-                              [:div.col-xs-12 [:b (str (t :user/Status) ": ")] (:status f)]
+                              [:div.col-xs-12 {:style {:margin-bottom "20px"}} [:b (str (t :user/Status) ": ")] (:status f)]
                               ]
                     )
 ;;                 )
@@ -368,7 +371,7 @@

         ]]

-      ]]))
+     ))

 (defn init-data [user-id state]
   (ajax/GET


Improve undo

Improve undo

--- src/clojure/nightcode/editors.clj
+++ src/clojure/nightcode/editors.clj
@@ -317,7 +317,7 @@
         new-text (:text result)
         new-x (:x result)
         new-pos (row-col->index new-text old-line new-x)]
-    (.setText text-area new-text)
+    (.replaceRange text-area new-text 0 (count old-text))
     (.setCaretPosition text-area new-pos)))

 (defn init-parinfer!
@@ -332,9 +332,13 @@
     (.addKeyListener text-area
       (reify KeyListener
         (keyReleased [this e]
-          (when-not (contains? #{KeyEvent/VK_DOWN KeyEvent/VK_UP
-                                 KeyEvent/VK_RIGHT KeyEvent/VK_LEFT}
-                               (.getKeyCode e))
+          (when-not (or (contains? #{KeyEvent/VK_DOWN KeyEvent/VK_UP
+                                     KeyEvent/VK_RIGHT KeyEvent/VK_LEFT
+                                     KeyEvent/VK_SHIFT KeyEvent/VK_CONTROL
+                                     KeyEvent/VK_ALT KeyEvent/VK_META}
+                                   (.getKeyCode e))
+                        (.isControlDown e)
+                        (.isMetaDown e))
             (run-parinfer! text-area (= (.getKeyCode e) KeyEvent/VK_ENTER))))
         (keyTyped [this e] nil)
         (keyPressed [this e] nil))))