Remove function

Remove function

--- src-cljs/frontend/components/aside.cljs
+++ src-cljs/frontend/components/aside.cljs
@@ -390,10 +390,6 @@
         (om/build branch-activity-list app {:opts {:login (:login opts)
                                                    :scrollbar-width (om/get-state owner :scrollbar-width)}})]))))

-(defn nav-icon
-  [icon-name]
-  [:i.material-icons icon-name])
-
 (defn aside-nav [app owner]
   (reify
     om/IDisplayName (display-name [_] "Aside Nav")
@@ -419,35 +415,35 @@
                             :data-trigger "hover"
                             :title "Builds"
                             :href "/"}
-             (nav-icon "storage")
+             [:i.material-icons "storage"]
              [:div.nav-label "Builds"]]

             [:a.aside-item {:data-placement "right"
                             :data-trigger "hover"
                             :title "Insights"
                             :href "/build-insights"}
-             (nav-icon "assessment")
+             [:i.material-icons "assessment"]
              [:div.nav-label "Insights"]]

             [:a.aside-item {:href "/add-projects",
                             :data-placement "right"
                             :data-trigger "hover"
                             :title "Add Projects"}
-             (nav-icon "library_add")
+             [:i.material-icons "library_add"]
              [:div.nav-label "Add Projects"]]

             [:a.aside-item {:href "/invite-teammates",
                             :data-placement "right"
                             :data-trigger "hover"
                             :title "Add Teammates"}
-              (nav-icon "group_add")
+              [:i.material-icons "group_add"]
               [:div.nav-label "Team"]]

             [:a.aside-item {:data-placement "right"
                                    :data-trigger "hover"
                                    :title "Account Settings"
                                    :href "/account"}
-              (nav-icon "settings")
+              [:i.material-icons "settings"]
               [:div.nav-label "Account Settings"]]

             [:hr]
@@ -456,7 +452,7 @@
                             :data-placement "right"
                             :data-trigger "hover"
                             :href "/docs"}
-              (nav-icon "description")
+              [:i.material-icons "description"]
               [:div.nav-label "Docs"]]

             [:a.aside-item (merge (common/contact-support-a-info owner)
@@ -464,7 +460,7 @@
                                   :data-placement "right"
                                   :data-trigger "hover"
                                   :data-bind "tooltip: {title: 'Support', placement: 'right', trigger: 'hover'}"})
-              (nav-icon "chat")
+              [:i.material-icons "chat"]
               [:div.nav-label "Support"]]

             [:a.aside-item {:data-placement "right"
@@ -473,7 +469,7 @@
                             :href "/changelog"
                             :class (when (changelog-updated-since? (:last_viewed_changelog user))
                                     "unread")}
-              (nav-icon "receipt")
+              [:i.material-icons "receipt"]
               [:div.nav-label "Changelog"]]

             [:hr]
@@ -483,14 +479,14 @@
                               :data-trigger "hover"
                               :title "Admin"
                               :href "/admin"}
-                (nav-icon "build")
+                [:i.material-icons "build"]
                 [:div.nav-label "Admin"]])

             [:a.aside-item.push-to-bottom {:data-placement "right"
                                            :data-trigger "hover"
                                            :title "Logout"
                                            :href "/logout"}
-              (nav-icon "power_settings_new")
+              [:i.material-icons "power_settings_new"]
               [:div.nav-label "Logout"]]])))))

 (defn aside [app owner]


restore pod aot

restore pod aot

--- boot/pod/project.clj
+++ boot/pod/project.clj
@@ -5,6 +5,7 @@
                (.getProperty "version")))

 (defproject boot/pod version
+  :aot            [#"^(?!boot\.repl-server).*$"]
   :jar-exclusions [#"^clojure/core/"]
   :description    "Boot pod module–this is included with all pods."
   :url            "https://github.com/boot-clj/boot"


Do a little cleanup in template.cljs

Do a little cleanup in template.cljs

--- src/reagent/impl/template.cljs
+++ src/reagent/impl/template.cljs
@@ -18,15 +18,15 @@

 ;;; Common utilities

-(defn named? [x]
+(defn ^boolean named? [x]
   (or (keyword? x)
       (symbol? x)))

-(defn hiccup-tag? [x]
+(defn ^boolean hiccup-tag? [x]
   (or (named? x)
       (string? x)))

-(defn valid-tag? [x]
+(defn ^boolean valid-tag? [x]
   (or (hiccup-tag? x)
       (ifn? x)
       (instance? NativeWrapper x)))
@@ -39,7 +39,7 @@
                          :charset "charSet"})

 (defn obj-get [o k]
-  (when (.hasOwnProperty o k)
+  (when (true? (.hasOwnProperty o k))
     (aget o k)))

 (defn cached-prop-name [k]
@@ -95,7 +95,7 @@
 ;; See: https://html.spec.whatwg.org/multipage/forms.html#do-not-apply
 (def these-inputs-have-selection-api #{"text" "textarea" "password" "search" "tel" "url"})

-(defn has-selection-api?
+(defn ^boolean has-selection-api?
   [input-type]
   (contains? these-inputs-have-selection-api input-type))

@@ -160,7 +160,7 @@
         (.! :onChange #(input-handle-change this on-change %))))
     (.! this :cljsInputValue nil)))

-(defn input-component? [x]
+(defn ^boolean input-component? [x]
   (or (identical? x "input")
       (identical? x "textarea")))

@@ -188,13 +188,13 @@

 (defn parse-tag [hiccup-tag]
   (let [[tag id class] (->> hiccup-tag name (re-matches re-tag) next)
-        class' (when class
-                 (string/replace class #"\." " "))]
+        class (when-not (nil? class)
+                (string/replace class #"\." " "))]
     (assert tag (str "Invalid tag: '" hiccup-tag "'"
                      (comp/comp-name)))
     #js{:name tag
         :id id
-        :className class'}))
+        :className class}))

 (defn fn-to-class [f]
   (assert (ifn? f) (str "Expected a function, not " (pr-str f)))
@@ -320,7 +320,7 @@
               (expand-seq-dev x ctx)
               (ratom/capture-derefed #(expand-seq-dev x ctx)
                                      ctx))]
-    (when (ratom/captured ctx)
+    (when-not (nil? (ratom/captured ctx))
       (warn "Reactive deref not supported in lazy seq, "
             "it should be wrapped in doall"
             (comp/comp-name) ". Value:\n" (pr-str x)))


Refactoring how to handle file problems.

--- src/ahnentafel/gedcom/reading/lexer.clj
+++ src/ahnentafel/gedcom/reading/lexer.clj
@@ -3,6 +3,7 @@

 (defn read-file-lines [file]
   "Read all the lines of the file. Returns NIL if file does not exist."
-  (when (.exists (as-file file))
+  (try
     (with-open [rdr (reader file)]
-      (doall (line-seq rdr)))))
+      (doall (line-seq rdr)))
+    (catch Exception e nil)))


Cleanup code

Cleanup code

--- src/ziad/pos.clj
+++ src/ziad/pos.clj
@@ -160,10 +160,8 @@
    a list of tokens with the highest entropy/probability
    based on the model."
   [sent model]
-  (let [words (-> sent
-                  common/partition-words)
-        final (->> (time (pos-optimized words model))
-                   rest
-                   (map spell-check)
-                   (map grammar-check))]
-    final))
+  (let [words (common/partition-words sent)]
+    (->> (time (pos-optimized words model))
+         rest
+         (map spell-check)
+         (map grammar-check))))


database

database

--- src-clj/test/database/core.clj
+++ src-clj/test/database/core.clj
@@ -152,7 +152,11 @@
   (if-not (database/object-tbl-exists? db)
     (database/object-tbl-create! db))

-  (let [])
+  (let [obj1 {:name "map2" :type "OBJECT"}
+        ouuid1 (database/object-insert! db obj1)
+        obj1 (assoc obj1 :uuid ouuid1)
+
+        prop1 ])

   (database/db-remove-database! db))


Сохранение состояния объекта как diff

Сохранение состояния объекта как diff

--- radiolamp-6P3/src/r6p3/core.clj
+++ radiolamp-6P3/src/r6p3/core.clj
@@ -2,9 +2,11 @@

   (:use clojure.pprint)

+
   (:import [org.imgscalr Scalr])

-  (:require [korma.db :as kdb]
+  (:require [clojure.data :as clojure-data]
+            [korma.db :as kdb]
             [korma.core :as kc]

             [clj-time.core :as tco]
@@ -629,13 +631,7 @@
      (cheshire-c/parse-string (str v) keywordize?))
    row))

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

 (defn check-row [is-error-fn? message row]
@@ -648,6 +644,33 @@
     row))

 (defn print-row [row] (println "print=> " row) row)
+
+
+
+;;------------------------------------------------------------------------------
+;; BEGIN: entity json state
+;; tag: <entity json state>
+;; description: Состояние сущности в cljs-json
+;;------------------------------------------------------------------------------
+
+
+(defn entity-state-to-json [row]
+  (cheshire-c/generate-string row))
+
+(defn entity-state-from-json [text]
+  (cheshire-c/parse-string (str text) true))
+
+
+(defn entity-states-diff [new-row old-row prep-fn]
+  (clojure-data/diff (prep-fn new-row) (prep-fn old-row)))
+
+(defn entity-states-diff-to-json [new-row old-row prep-fn]
+  (cheshire-c/generate-string (entity-states-diff new-row old-row prep-fn)))
+
+
+;; END entity json state
+;;..............................................................................
+

 ;; END Entity utilites
 ;;..................................................................................................


bump cljs

bump cljs

--- example/project.clj
+++ example/project.clj
@@ -7,7 +7,7 @@
   :min-lein-version "2.7.1"

   :dependencies [[org.clojure/clojure "1.8.0"]
-                 [org.clojure/clojurescript "1.9.671"]
+                 [org.clojure/clojurescript "1.9.908"]
                  [rum "0.10.8"]
                  [reagent "0.7.0"]
                  [org.omcljs/om "1.0.0-beta1"]]


Fix bad try/finally

Fix bad try/finally

--- resources/leiningen/new/onyx_app/sample_job_test.clj
+++ resources/leiningen/new/onyx_app/sample_job_test.clj
@@ -20,9 +20,9 @@
   (let [dev-env (component/start (onyx-dev-env 4))]
     (try
       (let [{:keys [write-lines]} (submit-job/submit-job dev-env)]
-        (is (= 16 (count write-lines)))))
+        (is (= 16 (count write-lines))))
       (finally
-        (component/stop dev-env)))))
+        (component/stop dev-env))))))

 (deftest test-sample-prod-job
   (let [dev-env (component/start (onyx-dev-env 4))]


improve key parsing

improve key parsing

--- src/cljc/clj_money/x_platform/util.cljc
+++ src/cljc/clj_money/x_platform/util.cljc
@@ -47,26 +47,17 @@
                         (map #(update-in % [1] prepare-value))
                         (map #(string/join "=" %)))))

-(defmulti ^:private parse-key-segment
-  (fn [segment]
-    (cond
-      (re-find #"\[.+\]" segment) :keyword
-      (re-find #"\[\]" segment) :index
-      :else :default)))
+(def ^:private key-pattern
+  #"(?:(^[^\[\]]+)|(?:^\[([^\]]+)\])|(^\[\]))(.*)")

-(defmethod ^:private parse-key-segment :keyword
-  [segment]
-  (-> segment
-      (string/replace #"\[|\]" "")
-      keyword))
-
-(defmethod ^:private parse-key-segment :index
-  [segment]
-  ::index)
-
-(defmethod ^:private parse-key-segment :default
-  [segment]
-  (keyword segment))
+(defn- key-segments
+  [k]
+  (let [[f r] (->> (re-find key-pattern k)
+                   rest
+                   (filter identity))]
+    (if r
+      (cons f (key-segments r))
+      f)))

 (defn- parse-key
   "Takes a query string key like user[first-name] and
@@ -74,12 +65,11 @@
   for use with assoc-in
   (like [:user :first-name])"
   [k]
-  ; I couldn't make the lookbehind work, so we have to parse
-  ; the square brackets out in a separate step
-  (->> (re-find #"([^\[\]]+)(\[[^\]]*\])*" k)
-       rest              ; this first position holds the entire match
-       (filter identity)
-       (map parse-key-segment)))
+  (->> (key-segments k)
+       (map keyword)
+       (map #(if (= % (keyword "[]"))
+               ::index
+               %))))

 (defn- assoc-in-x
   "Like assoc-in except that it creates a vector (instead of a map) for a


lex.clj: add maps for toks and rules

lex.clj: add maps for toks and rules

--- src/clojure/org/mobileink/antlr/lex.clj
+++ src/clojure/org/mobileink/antlr/lex.clj
@@ -22,7 +22,50 @@
 ;; ANTLR Lexer Javadoc:
 ;; http://www.antlr.org/api/Java-master/org/antlr/v4/runtime/Lexer.html

-(def ^:dynamic *lexrules* (atom {}))
+(def ^:dynamic *tokmap* (atom nil))
+(def ^:dynamic *rulemap* (atom nil))
+
+(defn- settoks [^String grammar]
+  (let [lexname (str grammar "Lexer")
+        lxr (eval `(new ~(Class/forName lexname) nil))
+        toks (.getTokenNames lxr)
+        tokmap (.getTokenTypeMap lxr)]
+    (doall (map #(do
+                   (swap!  *tokmap* assoc (.getValue %) (.getKey %))
+                   ;;(println %)
+                   )
+                tokmap))
+    ;; (doseq [[k v] (sort @*tokmap*)]
+    ;;   (println k ": " v))
+    nil))
+
+(defn tokmap [^String grammar]
+  (if (nil? @*tokmap*)
+    (println (format "tokmap for %s not set; run lex-string to set it" grammar))
+    (doseq [[k v] (sort @*tokmap*)]
+      (println k ": " v))))
+
+(defn- setrules [^String grammar]
+  (let [lexname (str grammar "Lexer")
+        lxr (eval `(new ~(Class/forName lexname) nil))
+        rules (.getRuleNames lxr)
+        rulemap (.getRuleIndexMap lxr)]
+    ;;(doall (map (fn [[k v] %] (println k)) rulemap))
+    (doall (map #(do
+                   (swap!  *rulemap* assoc (+ 1 (.getValue %)) (.getKey %))
+                   ;(println (+ 1(.getValue %)) (.getKey %))
+                   )
+                rulemap))
+    nil))
+
+(defn rule [^long i]
+  (@*rulemap* i))
+
+(defn rulemap [^String grammar]
+  (if (nil? @*rulemap*)
+    (println (format "rulemap for %s not set; run lex-string to set it" grammar))
+    (doseq [[k v] (sort @*rulemap*)]
+      (println k ": " v))))

 (defn lex-file
   [^String grammar ;; e.g. "org.mobileink.antlr.sym"
@@ -56,20 +99,24 @@
         devnull (.setInputStream lxr strinput)
         tokens (CommonTokenStream. lxr)

-        parsername (str grammar "Parser")
+        ;; parsername (str grammar "Parser")

-        foo (macroexpand `(new ~(Class/forName parsername)
-                               (CommonTokenStream.
-                                (new ~(Class/forName lexname)
-                                     (ANTLRInputStream. ~the-string)))))
+        ;; foo (macroexpand `(new ~(Class/forName parsername)
+        ;;                        (CommonTokenStream.
+        ;;                         (new ~(Class/forName lexname)
+        ;;                              (ANTLRInputStream. ~the-string)))))

-        parser (eval foo) ;;`(new ~(Class/forName parsername) #=tokens))
+        ;; parser (eval foo) ;;`(new ~(Class/forName parsername) #=tokens))

-        tree (do ;;(println "getting tree")
-               (.id_kw parser)) ; method name = start rule in grammar
+        ;; tree (do ;;(println "getting tree")
+        ;;        (.id_kw parser)) ; method name = start rule in grammar
         ]

     (do
+      (if (nil? @*tokmap*)
+        (settoks grammar))
+      (if (nil? @*rulemap*)
+        (setrules grammar))
       (.fill tokens)
       (let
           [seqtoks (iterator-seq (.iterator (.getTokens tokens)))]
@@ -78,28 +125,10 @@
                         (print (format "%s  %s %s\n"
                                        (.toString tok)
                                        (.getType tok)
-                                       (@*lexrules* (.getType tok)))))
+                                       (get @*tokmap* (.getType tok)))))
                       seqtoks))
-          (println (.toStringTree tree))
+          ;; (println (.toStringTree tree))
           ;;(println (.getText tree))
           ))))
   nil)

-(defn setrules [^String grammar]
-  (let [lexname (str grammar "Lexer")
-        lxr (eval `(new ~(Class/forName lexname) nil))
-        rules (.getRuleNames lxr)
-        rulemap (.getRuleIndexMap lxr)]
-    (println rulemap)
-    ;;(doall (map (fn [[k v] %] (println k)) rulemap))
-    (doall (map #(do
-                   (swap!  *lexrules* assoc (+ 1 (.getValue %)) (.getKey %))
-                   ;(println (+ 1(.getValue %)) (.getKey %))
-                   )
-                rulemap))
-    (doseq [[k v] (sort @*lexrules*)]
-      (println k ": " v))
-    nil))
-
-(defn rule [^long i]
-  (@*lexrules* i))


Fixing some errors in the testing code

Fixing some errors in the testing code

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

--- src/conexp/contrib/tests/algorithms.clj
+++ src/conexp/contrib/tests/algorithms.clj
@@ -55,17 +55,17 @@
   (dotimes [_ test-runs]
     (is (zero? (count (canonical-base (cm/random-context 20 0.7)
                                       #{(cm/make-implication #{} (cm/set-of-range 20))})))))
-  (is (let [ctx (make-context-from-matrix 5 5
-                                          [0 0 1 0 1
-                                           0 1 1 0 0
-                                           0 0 1 0 1
-                                           0 0 1 1 1
-                                           0 0 1 0 1]),
-            bgk #{(impl ==> 2)}]
+  (is (let [ctx (cm/make-context-from-matrix 5 5
+                                             [0 0 1 0 1
+                                              0 1 1 0 0
+                                              0 0 1 0 1
+                                              0 0 1 1 1
+                                              0 0 1 0 1]),
+            bgk #{(cm/impl ==> 2)}]
         (= (set (canonical-base ctx bgk))
-           #{(impl 0 2 ==> 1 3 4)
-             (impl 2 3 ==> 4)
-             (impl 1 2 4 ==> 0 3)}))))
+           #{(cm/impl 0 2 ==> 1 3 4)
+             (cm/impl 2 3 ==> 4)
+             (cm/impl 1 2 4 ==> 0 3)}))))

 ;;;


Update cards

Update cards

--- src/devcards/discuss/devcards/core.cljs
+++ src/devcards/discuss/devcards/core.cljs
@@ -2,19 +2,29 @@
   (:require [devcards.core :as dc :refer-macros [defcard deftest]]
             [cljs.test :refer-macros [is async]]
             [om.dom :as dom]
+            [discuss.core :as core]
             [discuss.extensions]
-            [discuss.debug :as debug]
             [discuss.lib :as lib]
             [discuss.views :as views]))

 (enable-console-print!)

 (defcard main
-         "## Main discuss Component"
-         (dc/om-root views/main-view) lib/app-state)
+         "#### Main discuss Component"
+         (dc/om-root views/main-view)
+         lib/app-state
+         {:history true})

-(defcard debug
-         (dc/om-root debug/debug-view) lib/app-state)
+
+(defcard control-buttons
+         ""
+         (dom/button #js {:className "btn btn-info"
+                          :onClick   core/main}
+                     (dom/i #js {:className "fa fa-fort-awesome"})))
+
+#_(defcard debug
+         (dc/om-root debug/debug-view)
+         lib/app-state)

 (defcard global-state
          @lib/app-state)


CMR-4247 - Updated variable assoc'n params to point to the table's column name.

--- metadata-db-app/src/cmr/metadata_db/data/oracle/concepts/variable.clj
+++ metadata-db-app/src/cmr/metadata_db/data/oracle/concepts/variable.clj
@@ -30,9 +30,13 @@
   "Returns the latest revisions of the variable associations for the given variable."
   [db variable-tombstone]
   (concepts/find-latest-concepts db
-                                 {:provider-id (:provider-id variable-tombstone)}
+                                 {:provider-id "CMR"}
                                  {:concept-type :variable-association
-                                  :native-id (:native-id variable-tombstone)}))
+                                  ;; :variable name below refers to the table column
+                                  ;; named VARIABLE_NAME that holds the native-id
+                                  ;; value ... this comment will need to be updated
+                                  ;; once we move to using variable concept id.
+                                  :variable-name (:native-id variable-tombstone)}))

 (defn cascade-delete-variable-associations
   "Save tombstones for all the variable associations for the given variable."


Make things even more idiomatic

Make things even more idiomatic

Sadly two things got mixed up in this commit:

1. Replacing `(map ...)` by `(for ...)` when it improves syntax.

2. Better decoupling `do-view` and `do-detail-view` using `track` and
other Reagent niceties.

--- src/sinusoides/components.cljs
+++ src/sinusoides/components.cljs
@@ -46,31 +46,47 @@
      [:a {:href (routes/main)} [:div#sinusoid.imglink [:div] [:div]]]
      [:div#am-block [:p " I " [:br] " am " [:br] " not " [:br]]]
      [:div#profiles.links
-      (map (fn [{name :name url :url}]
-             ^{:key name}
-             [:div {:id name} [:a {:href url} "not this"]])
-        @am)]]))
+      (for [{name :name url :url} @am]
+        ^{:key name}
+        [:div {:id name} [:a {:href url} "not this"]])]]))

-(defn do-detail-view [do [idx p] entries]
-  [:div#do-detail.links
-   [:a#img {:href (str "/static/screens/" ((:imgs p) 1))
-            :style {:background-image
-                    (str "url(/static/screens/" ((:imgs p) 1) ")")}}]
-   [:div#body
-    [:div#content
-     [:div#header (:name p)]
-     [:div#desc {:dangerouslySetInnerHTML
-                 {:__html (md->html (:desc p))}}]
-     (map (fn [link] [:a.link {:href (:href link)} (:name link)]) (:link p))]
+(defn do-detail-view [entries entry]
+  (letfn
+      [(nav-arrow! [diff]
+         (when-let [[idx _] @entry]
+           (when-let [next (get-in @entries [(+ idx diff) :slug])]
+             (routes/nav! (routes/do- {:id next})))))

-    [:div#footer
-     (if-let [id (get-in entries [(- idx 1) :slug])]
-       [:a.prev.enabled {:href (routes/do- {:id id})}]
-       [:div.prev.disabled])
-     (if-let [id (get-in entries [(+ idx 1) :slug])]
-       [:a.next.enabled {:href (routes/do- {:id id})}]
-       [:div.next.disabled])
-     [:a.close {:href (routes/do)}]]]])
+       (handle-key [event]
+         (case (.-keyCode event)
+           37 (nav-arrow! -1)
+           39 (nav-arrow! +1)
+           27 (routes/nav! (routes/do))
+           nil))]
+
+    (r/with-let [listener (events/listen js/document "keydown" handle-key)]
+      (let [[idx p] @entry]
+        [:div#do-detail.links
+         [:a#img {:href (str "/static/screens/" ((:imgs p) 1))
+                  :style {:background-image
+                          (str "url(/static/screens/" ((:imgs p) 1) ")")}}]
+         [:div#body
+          [:div#content
+           [:div#header (:name p)]
+           [:div#desc {:dangerouslySetInnerHTML
+                       {:__html (md->html (:desc p))}}]
+           (for [link (:link p)]
+             ^{:key link}
+             [:a.link {:href (:href link)} (:name link)])]
+          [:div#footer
+           (if-let [id (get-in @entries [(- idx 1) :slug])]
+             [:a.prev.enabled {:href (routes/do- {:id id})}]
+             [:div.prev.disabled])
+           (if-let [id (get-in @entries [(+ idx 1) :slug])]
+             [:a.next.enabled {:href (routes/do- {:id id})}]
+             [:div.next.disabled])
+           [:a.close {:href (routes/do)}]]]])
+      (finally (events/unlistenByKey listener)))))

 (defn do-view- [do entries]
   [:div#do-page
@@ -94,33 +110,29 @@
    [:div#language-links
     [:a.cv {:href "/static/files/resume-en.pdf"} "Résumé"]
     (doall
-      (map
-        (fn [lang]
-          ^{:key lang}
-          [:div.filter
-           {:class (if (contains? (get-in @do [:filter :languages]) lang)
-                     "on"
-                     "off")
-            :on-click
-            (fn [] (swap! do update-in [:filter :languages]
-                     #(util/togglej % lang)))}
-           lang])
-        (:languages @do)))
-
+      (for [lang (:languages @do)]
+        ^{:key lang}
+        [:div.filter
+         {:class (if (contains? (get-in @do [:filter :languages]) lang)
+                   "on"
+                   "off")
+          :on-click
+          (fn [] (swap! do update-in [:filter :languages]
+                   #(util/togglej % lang)))}
+         lang]))
     (when-not (empty? (get-in @do [:filter :languages]))
       [:div.filter.clearf
        {:on-click (fn [] (swap! do assoc-in [:filter :languages] #{}))}
        "Clear"])]

    [:div.programs
-    (map (fn [p]
-           ^{:key p}
-           [:a {:href (routes/do- {:id (:slug p)})
-                :style {:background-image
-                        (str "url(\"/static/screens/" ((:imgs p) 0) "\")")}}
-            [:div]
-            [:span (:name p)]])
-      entries)]])
+    (for [p @entries]
+      ^{:key p}
+      [:a {:href (routes/do- {:id (:slug p)})
+           :style {:background-image
+                   (str "url(\"/static/screens/" ((:imgs p) 0) "\")")}}
+       [:div]
+       [:span (:name p)]])]])

 (defn do-view [do]
   (letfn
@@ -131,39 +143,24 @@
                   (:entries @do)))))

        (find-entry [entries id]
-         (first (filter #(= id (:slug (% 1)))
-                  (map-indexed vector entries))))
-
-       (nav-arrow! [diff]
-         (when-let [id (:detail @do)]
-           (let [entries (filter-entries)]
-             (when-let [[idx _] (find-entry entries id)]
-               (when-let [next (get-in entries [(+ idx diff) :slug])]
-                 (routes/nav! (routes/do- {:id next})))))))
-
-       (key-listener [event]
-         (case (.-keyCode event)
-           37 (nav-arrow! -1)
-           39 (nav-arrow! +1)
-           27 (routes/nav! (routes/do))
-           nil))
+         (when id
+           (first (filter #(= id (:slug (% 1)))
+                    (map-indexed vector entries)))))

        (fetch-data []
          (go (let [entries   (map #(assoc % :slug (util/to-slug (:name %)))
-                                         (:body  (<! (http/get "/data/do.json"))))
+                               (:body  (<! (http/get "/data/do.json"))))
                    languages (apply sorted-set (map :lang entries))]
                (swap! do assoc-in [:entries] entries)
                (swap! do assoc-in [:languages] languages))))]

-    (r/with-let [_ (fetch-data)
-                 _ (events/listen js/document "keydown" key-listener)]
-      (let [entries (filter-entries)]
-        (if-let [id (:detail @do)]
-          (when-let [p (find-entry entries id)]
-            [do-detail-view @do p entries])
-          [do-view- do entries]))
-      (finally
-        (events/unlisten js/document "keydown" key-listener)))))
+    (fetch-data)
+    (r/with-let [entries (r/track filter-entries)
+                 detail  (r/track #(:detail @do))
+                 entry   (r/track #(find-entry @entries @detail))]
+      (if @entry
+        [do-detail-view entries entry]
+        [do-view- do entries]))))

 (defn root-view [app]
   [:div.sinusoides


Fix warning: "Reactive deref not supported in lazy seq"

--- src/sinusoides/components.cljs
+++ src/sinusoides/components.cljs
@@ -92,17 +92,18 @@

    [:div#language-links
     [:a.cv {:href "/static/files/resume-en.pdf"} "Résumé"]
-    (map
-      (fn [lang]
-        [:div.filter
-         {:class (if (contains? (get-in @do [:filter :languages]) lang)
-                   "on"
-                   "off")
-          :on-click
-          (fn [] (swap! do update-in [:filter :languages]
-                   #(util/togglej % lang)))}
-         lang])
-      (:languages @do))
+    (doall
+      (map
+        (fn [lang]
+          [:div.filter
+           {:class (if (contains? (get-in @do [:filter :languages]) lang)
+                     "on"
+                     "off")
+            :on-click
+            (fn [] (swap! do update-in [:filter :languages]
+                     #(util/togglej % lang)))}
+           lang])
+        (:languages @do)))

     (when-not (empty? (get-in @do [:filter :languages]))
       [:div.filter.clearf


Better messages for configuration errors.

--- src/active/clojure/config.cljc
+++ src/active/clojure/config.cljc
@@ -429,11 +429,8 @@
              nil)]
     (if (range-error? val)
       (c/error `setting-default-value
-               "setting is missing in configuration map"
-               (range-error-path val)
-               (range-error-value val)
-               (range-description (range-error-range val))
-               (range-error-range val))
+               (str "setting " (vec (range-error-path val)) " is missing in configuration map")
+               val)
       val)))

 (define-record-type
@@ -596,7 +593,7 @@
                               (merge-config-objects-sans-profiles (section-schema section) (conj (vec path) key) (or val1 {}) (or val2 {})))
                        (next all-keys))
                 (c/error `merge-config-objects-sans-profiles
-                         "unknown path in config"
+                         (str "unknown path " (vec (conj path key)) " in config")
                          (conj path key) (if (contains? c1 key) val1 val2) nil (if (contains? c1 key) c1 c2)))))
           c)))

@@ -743,13 +740,17 @@
   (let [res (normalize&check-config-object schema profile-names config-object)]
     (if (range-error? res)
       (c/error `make-configuration
-               "range error in configuration map"
-               (range-error-path res)
-               (range-error-value res)
-               (if-let [r (range-error-range res)]
-                 (range-description r)
-                 "<no range>")
-               (range-error-range res))
+               (str "range error at path "
+                    (vec (range-error-path res))
+                    " in configuration map: "
+                    "value "
+                    (range-error-value res)
+                    " should be in range "
+                    (if-let [r (range-error-range res)]
+                      (range-description r)
+                      "<no range>")
+                    " but isn't")
+               res)
       (really-make-configuration res schema))))

 (defn diff-configuration-objects
@@ -818,10 +819,10 @@
                     cf (get cf (section-key sec) ::section-not-found)]
                 (case cf
                   ::section-not-found
-                  (c/assertion-violation `access-section
-                                         "section not found"
-                                         (map section-key sections) config)
-
+                  (let [path (map section-key sections)]
+                    (c/assertion-violation `access-section
+                                           (str "section " (vec path) " not found")
+                                           path config))
                   (letfn [(schemarec [schema cf]
                             (cond
                               (map-schema? schema)
@@ -844,9 +845,11 @@
                   (fn [cf]
                     (let [val (get cf (setting-key setting) ::setting-not-found)]
                       (if (= val ::setting-not-found)
-                        (c/assertion-violation `access
-                                               "setting not found"
-                                               (setting-key setting) (map section-key sections) setting config)
+                        (let [path (map section-key sections)]
+                          (c/assertion-violation `access
+                                                 (str "setting " (setting-key setting)
+                                                      " not found at path " (vec path))
+                                                 path setting config))
                         val)))))

 (defn section-subconfig


Addressed review comments.

Addressed review comments.

--- src/cmr/metadata_db/services/concept_validations.clj
+++ src/cmr/metadata_db/services/concept_validations.clj
@@ -47,11 +47,7 @@
 (defn nil-extra-fields-validation
   "Validates that among the extra fields, only delete-time and version-id can sometimes be nil."
   [concept]
-  (let [not-nil-extra-fields (dissoc (:extra-fields concept) :delete-time)
-        not-nil-extra-fields (if (= "application/echo10+xml" (:format concept))
-                               not-nil-extra-fields
-                               (dissoc not-nil-extra-fields :version-id))]
-    (nil-fields-validation not-nil-extra-fields)))
+  (nil-fields-validation (apply dissoc (:extra-fields concept) [:delete-time :version-id])))

 (defn concept-id-validation
   [concept]


bump karma output-feature-set default

bump karma output-feature-set default

and properly add polyfills

--- src/main/shadow/build/targets/karma.clj
+++ src/main/shadow/build/targets/karma.clj
@@ -38,7 +38,11 @@
         (build-api/with-js-options {:js-provider :shadow})
         (cond->
           js-options
-          (build-api/with-js-options js-options))
+          (build-api/with-js-options js-options)
+
+          (not (get-in config [:compiler-options :output-feature-set]))
+          (build-api/with-compiler-options {:output-feature-set :es8}))
+
         (build-api/configure-modules {:test {:entries []
                                              :output-name (.getName output-to)}})

@@ -78,7 +82,10 @@

   (let [prepend
         (str "var shadow$provide = {};\n"
+             "var $jscomp = {};\n"
              (output/closure-defines-and-base state)
+             (when (seq polyfill-js)
+               (str "\n" polyfill-js "\n"))
              "goog.global[\"$CLJS\"] = goog.global;\n")

         out


Don't break browser's cmd-left/right and cmd-1..9

--- src/asciinema/player/view.cljs
+++ src/asciinema/player/view.cljs
@@ -233,29 +233,34 @@
 (defn player-class-name [theme-name]
   (str "asciinema-theme-" theme-name))

+(defn has-modifiers? [dom-event]
+  (some #(aget dom-event %) ["altKey" "shiftKey" "metaKey" "ctrlKey"]))
+
 (defn key-press->message [dom-event]
-  (case (.-key dom-event)
-    " " (m/->TogglePlay)
-    "f" :toggle-fullscreen
-    "0" (m/->Seek 0.0)
-    "1" (m/->Seek 0.1)
-    "2" (m/->Seek 0.2)
-    "3" (m/->Seek 0.3)
-    "4" (m/->Seek 0.4)
-    "5" (m/->Seek 0.5)
-    "6" (m/->Seek 0.6)
-    "7" (m/->Seek 0.7)
-    "8" (m/->Seek 0.8)
-    "9" (m/->Seek 0.9)
-    ">" (m/->SpeedUp)
-    "<" (m/->SpeedDown)
-    nil))
+  (when-not (has-modifiers? dom-event)
+    (case (.-key dom-event)
+      " " (m/->TogglePlay)
+      "f" :toggle-fullscreen
+      "0" (m/->Seek 0.0)
+      "1" (m/->Seek 0.1)
+      "2" (m/->Seek 0.2)
+      "3" (m/->Seek 0.3)
+      "4" (m/->Seek 0.4)
+      "5" (m/->Seek 0.5)
+      "6" (m/->Seek 0.6)
+      "7" (m/->Seek 0.7)
+      "8" (m/->Seek 0.8)
+      "9" (m/->Seek 0.9)
+      ">" (m/->SpeedUp)
+      "<" (m/->SpeedDown)
+      nil)))

 (defn key-down->message [dom-event]
-  (case (.-which dom-event)
-    37 (m/->Rewind)
-    39 (m/->FastForward)
-    nil))
+  (when-not (has-modifiers? dom-event)
+    (case (.-which dom-event)
+      37 (m/->Rewind)
+      39 (m/->FastForward)
+      nil)))

 (defn handle-key-press [dom-event]
   (when-let [msg (key-press->message dom-event)]


correct test for commodities import

correct test for commodities import

--- test/clj_money/import_test.clj
+++ test/clj_money/import_test.clj
@@ -216,5 +216,9 @@
         imp (-> context :imports first)
         result (import-data storage-spec imp (fn [progress]))
         entity (first (entities/select storage-spec (:id user)))
-        lots (lots/search storage-spec {:entity-id (:id entity)})]
+        account (->> (:id entity)
+                     (accounts/select-by-entity-id storage-spec)
+                     (filter #(= "401k" (:name %)))
+                     first)
+        lots (lots/search storage-spec {:account-id (:id account)})]
     (is (= expected-lots lots) "The correct lots are present after import")))


+se blesser

+se blesser

--- src/babel/francais/lexicon.clj
+++ src/babel/francais/lexicon.clj
@@ -303,24 +303,7 @@
      [(merge shared-part-of-faire
              {:synsem {:pred :do}})
       (merge shared-part-of-faire
-             {:synsem {:pred :make}})
-      (merge shared-part-of-faire
-             (let [subject-semantics (ref {:human true})
-                  subject-agr (ref :top)]
-               {:synsem {:cat :verb
-                         :essere true
-                         :sem {:pred :hurt-oneself
-                               :reflexive true
-                               :subj subject-semantics
-                               :obj subject-semantics}
-                         :subcat {:1 {:agr subject-agr
-                                      :sem subject-semantics}
-                                  :2 {:agr subject-agr
-                                      :pronoun true
-                                      :reflexive true
-                                      :sem subject-semantics}
-                                  :3 {:cat :adverb
-                                      :sem {:pred :bad}}}}}))])
+             {:synsem {:pred :make}})])

    "former" {:synsem {:cat :verb
                      :sem {:pred :form}}}
@@ -501,22 +484,7 @@
   "répondre" {:synsem {:cat :verb
                        :sem {:pred :answer}}}

-;  "s'amuser" (let [subject-semantics (ref {:human true})
-;                    subject-agr (ref :top)]
-;                {:synsem {:cat :verb
-;                          :essere true
-;                          :sem {:pred :have-fun
-;                                :reflexive true
-;                                :subj subject-semantics
-;                                :obj subject-semantics}
-;                          :subcat {:1 {:agr subject-agr
-;                                       :sem subject-semantics}
-;                                   :2 {:agr subject-agr
-;                                       :pronoun true
-;                                       :reflexive true
-;                                       :sem subject-semantics}}}})
-
-  "s'amuser" (let [subject-semantics (ref {:human true})
+  "se amuser" (let [subject-semantics (ref {:human true})
                     subject-agr (ref :top)]
                 {:synsem {:cat :verb
                           :essere true
@@ -547,7 +515,24 @@
                                        :pronoun true
                                        :reflexive true
                                        :sem subject-semantics}}}})
-
+
+   "se blesser" (let [subject-semantics (ref {:human true})
+                      subject-agr (ref :top)]
+                  {:synsem {:cat :verb
+                            :essere true
+                            :sem {:pred :hurt-oneself
+                                  :reflexive true
+                                  :subj subject-semantics
+                                  :obj subject-semantics}
+                            :subcat {:1 {:agr subject-agr
+                                         :sem subject-semantics}
+                                     :2 {:agr subject-agr
+                                         :pronoun true
+                                         :reflexive true
+                                         :sem subject-semantics}
+                                     :3 {:cat :adverb
+                                         :sem {:pred :bad}}}}})
+
   "se endormir" (let [subject-semantics (ref {:human true})
                     subject-agr (ref :top)]
                 {:synsem {:cat :verb


sort ‘apprendre’

sort ‘apprendre’

--- src/babel/francais/lexicon.clj
+++ src/babel/francais/lexicon.clj
@@ -17,6 +17,9 @@
    "anoncier" {:synsem {:cat :verb
                         :sem {:pred :announce}}}

+   ;;  CONJUGATES LIKE TENIR
+   "apprendre" {:synsem {:cat :verb
+                         :sem {:pred :imparare}}}
    "elle"
    {:synsem {:cat :noun
              :pronoun true
@@ -109,10 +112,6 @@
               :sem {:human true
                     :pred :voi}
              :subcat '()}}
-
-;;  CONJUGATES LIKE TENIR
-  "apprendre" {:synsem {:cat :verb
-                        :sem {:pred :imparare}}}

   "profiter (de)" {:synsem {:cat :verb
                             :sem {:pred :take-advantage-of}}}


remove duplicate

remove duplicate

--- src/babel/francais/lexicon.clj
+++ src/babel/francais/lexicon.clj
@@ -135,33 +135,30 @@

    "diviser" {:synsem {:cat :verb
                       :sem {:pred :divide}}}
-
-   "ecouter" {:synsem {:cat :verb
-                       :sem {:pred :listen}}}
-
+
+   "croire" {:synsem {:cat :verb
+                      :sem {:pred :believe}}}
+
+   "décider" {:synsem {:cat :verb
+                       :sem {:pred :decide}}}
+
+   "désirer" {:synsem {:cat :verb
+                       :sem {:pred :desire}}}
+
+   "donner" {:synsem {:cat :verb
+                      :sem {:pred :give}}}
+
+   "dormir" {:synsem {:cat :verb
+                      :sem {:pred :sleep}}}
+
+   "echapper" {:synsem {:cat :verb
+                        :sem {:pred :escape}}}
+
+   "écouter" {:synsem {:cat :verb
+                       :sem {:pred :listen-to}}}
+
    "effacer" {:synsem {:cat :verb
                        :sem {:pred :erase}}}
-
-   "croire" {:synsem {:cat :verb
-                      :sem {:pred :believe}}}
-
-   "décider" {:synsem {:cat :verb
-                       :sem {:pred :decide}}}
-
-   "désirer" {:synsem {:cat :verb
-                       :sem {:pred :desire}}}
-
-   "donner" {:synsem {:cat :verb
-                      :sem {:pred :give}}}
-
-   "dormir" {:synsem {:cat :verb
-                      :sem {:pred :sleep}}}
-
-   "echapper" {:synsem {:cat :verb
-                        :sem {:pred :escape}}}
-
-   "écouter" {:synsem {:cat :verb
-                      :sem {:pred :listen-to}}}
    "elle"
    [{:synsem {:cat :noun
              :pronoun true


Add support for Half Point Unit in litedocx.unit package

--- src/bakyeono/litedocx/unit.clj
+++ src/bakyeono/litedocx/unit.clj
@@ -23,6 +23,7 @@
    :emu      914400
    :feet     12
    :ft       12
+   :half-pt  144
    :in.      1
    :inch     1
    :km       0.0000254


fix syntax error in smb-fs

fix syntax error in smb-fs

--- src/brainbot/nozzle/smb_fs.clj
+++ src/brainbot/nozzle/smb_fs.clj
@@ -3,7 +3,7 @@
    [clojure.string :as string])
   (:require [brainbot.nozzle.extract :refer [convert]])
   (:require [brainbot.nozzle.vfs :as vfs]
-            [brainbot.nozzle.inihelper :as inihelper]))
+            [brainbot.nozzle.inihelper :as inihelper]
             [brainbot.nozzle.misc :as misc])
   (:import [jcifs.smb SmbFile NtlmPasswordAuthentication SID ACE]))


take code to be a little lispier :heart_eyes_cat:

--- src/metabase/driver/query_processor.clj
+++ src/metabase/driver/query_processor.clj
@@ -170,7 +170,7 @@
   [results]
   {:pre [(map? results)
          (sequential? (:rows results))]}
-  (assoc results :rows (take max-result-rows (:rows results))))
+  (update-in results [:rows] (partial take max-result-rows)))

 ;; ### ADD-ROW-COUNT-AND-STATUS


make wait-for-git a bit more robust

make wait-for-git a bit more robust

--- src/clj/lambdacd/steps/git.clj
+++ src/clj/lambdacd/steps/git.clj
@@ -48,7 +48,7 @@
 (defn- persist-last-seen-revision [wait-for-result ctx]
   (let [current-revision (:revision wait-for-result)]
     (async/>!! (:result-channel ctx) [:_git-last-seen-revision current-revision]) ; by sending it through the result-channel, we can be pretty sure users don't overwrite it
-    wait-for-result))
+    (assoc wait-for-result :_git-last-seen-revision current-revision)))

 (defn wait-for-git
   "step that waits for the head of a branch to change"


check if gdpr is disabled

check if gdpr is disabled

--- src/clj/salava/user/routes.clj
+++ src/clj/salava/user/routes.clj
@@ -5,7 +5,7 @@
             [ring.util.io :as io]
             [salava.core.layout :as layout]
             [schema.core :as s]
-            [salava.core.util :refer [get-base-path]]
+            [salava.core.util :refer [get-base-path get-plugins]]
             [salava.user.schemas :as schemas]
             [salava.user.db :as u]
             [salava.mail.email-notifications :as en]
@@ -58,9 +58,10 @@
                    :body [login-content schemas/LoginUser]
                    :summary "User logs in"
                    (let [{:keys [email password]} login-content
-                         accepted-terms? (u/accepted-terms? ctx email)
+                         gdpr-disabled? (first (mapcat #(get-in ctx [:config % :disable-gdpr] []) (get-plugins ctx)))
+                         accepted-terms? (if gdpr-disabled? false (:status (u/accepted-terms? ctx email)))
                          login-status (-> (u/login-user ctx email password)
-                                          (assoc :terms (:status accepted-terms?)))]
+                                          (assoc :terms accepted-terms?))]
                      (if (= "success" (:status login-status))
                        (u/finalize-login ctx (ok login-status) (:id login-status) (get-in req [:session :pending :user-badge-id]) false)
                        (ok login-status))))
@@ -72,7 +73,7 @@
                   :summary "Get languages"
                   (if (private? ctx)
                     (forbidden)
-                    (assoc-in (ok {:languages (get-in ctx [:config :core :languages])}) [:session :seen-terms] true)))
+                  (assoc-in (ok {:languages (get-in ctx [:config :core :languages])}) [:session :seen-terms] true)))

              (POST "/register" req
                    ;:return
@@ -86,7 +87,8 @@
                    (let [{:keys [email first_name last_name country language password password_verify accept_terms]} form-content
                          save (u/register-user ctx email first_name last_name country language password password_verify)
                          user-id (u/get-user-by-email ctx email)
-                         update-accept-term (u/insert-user-terms ctx (:id user-id) accept_terms)]
+                         gdpr-disabled? (first (mapcat #(get-in ctx [:config % :disable-gdpr] []) (get-plugins ctx)))
+                         update-accept-term (if gdpr-disabled? {:status "success" :input "disabled"} (u/insert-user-terms ctx (:id user-id) accept_terms))]

                      (if (= "error" (:status save))
                        ;return error status from save
@@ -94,14 +96,14 @@
                        (if (not (private? ctx))
                          ;(ok save)
                          (let [login-status (u/login-user ctx email password)]
-                           (if (and (= "success" (:status login-status)) (= "success" (:status update-accept-term)) (= "accepted" (:input update-accept-term)))
+                           (if (and (= "success" (:status login-status)) (= "success" (:status update-accept-term)) (or (= "accepted" (:input update-accept-term)) (= "disabled" (:input update-accept-term))))
                              (u/finalize-login ctx (ok login-status) (:id login-status) (get-in req [:session :pending :user-badge-id]) true)
                              (ok login-status)))
                          (cond
                            (not (right-token? ctx (:token form-content)))        (forbidden)
                            (not (in-email-whitelist? ctx (:email form-content))) (ok {:status "error" :message "user/Invalidemail"})
                            :else                                                 (let [ login-status  (u/login-user ctx email password)]
-                                                                                (if (and (= "success" (:status login-status)) (= "success" (:status update-accept-term)) (= "accepted" (:input update-accept-term)))
+                                                                                (if (and (= "success" (:status login-status)) (= "success" (:status update-accept-term)) (or (= "accepted" (:input update-accept-term)) (= "disabled" (:input update-accept-term))))
                                                                                (u/set-session ctx (ok login-status) (:id login-status))
                                                                                (ok login-status))))))))


Prevent editing form autosubmit

Prevent editing form autosubmit

Now item data from bookmarklet can be saved

--- src/cljs/modern_cljs/core.cljs
+++ src/cljs/modern_cljs/core.cljs
@@ -13,7 +13,7 @@
 ;

 (def ^:const PAGESIZE 10)
-(def ^:const DB "/data.json")
+(def ^:const DB "/data2.json")

 ;
 ; Mithril helpers
@@ -134,16 +134,22 @@
         referer (get data "referer" "")
         comment (get data "comment" "")
         time (get data "time" "")]
-    (m "form.pure-form" nil
+    (m "form.pure-form"
+       {:obsubmit (fn [e]
+           (.preventDefault e)
+           (println "Shouldn't be submitting")
+            false)}
        [(m "fieldset" nil
            [(text "title" title 35)
             (text "url" url 15)
             (text "referer" referer 15)
             (text "time" time 15)
             (text "comment" comment 50)
-            (m "button.pure-button.pure-button-primary"
-               {:onclick #(save)} "Update")
-            (m "button.pure-button" {:onclick #(clear)} "Clear")])])))
+            (m "button.pure-button.pure-button-primary[type=button]"
+               {:onclick #(save)}
+               "Update")
+            (m "button.pure-button[type=button]"
+               {:onclick #(clear)} "Clear")])])))

 (defn notes [data start]
   "Returns 10 items from data"
@@ -213,16 +219,21 @@

 (enable-console-print!)

+;; Routing mode
+(aset (.-route js/m) "mode" "hash")
+
+;; Dropbox OAuth process
 (js/setup_dropbox)

 (defn setup []
+  "Mount app"
   (do
-    (set! (.-mode (.-route js/m)) "hash")
     (.route js/m
             (.getElementById js/document "app")
             "/"
             (clj->js {"/" app}))))

+;; If authentication has been successful, mount app and use query params if any
 (if (and (not (nil? js/client)) (.isAuthenticated js/client))
   (do
     (setup)
@@ -231,9 +242,10 @@
                   "referer" (route_param "referer")}]
       (if (not(nil? params))
         (do (println "initial param was:" params)
-            (updatedb [:editing] params)
-            (.route js/m "/")))))
+            (.route js/m "/")
+            (updatedb [:editing] params)))))
   (println "No auth!"))

 ;; (require '[modern-cljs.core :as c] :reload)
 ;; alt cmd e -> search repl history
+;; (.route js/m "/")


Finish hot swap

Finish hot swap

--- src/clojure/nightcode/lein.clj
+++ src/clojure/nightcode/lein.clj
@@ -21,8 +21,18 @@
   (:gen-class))

 (def ^:const debug-port "7896")
+(defonce class-name (str *ns*))

 ; utilities
+
+(defn read-file
+  [path]
+  (let [length (.length (java.io/file path))]
+    (when (< length 500000)
+      (let [data-barray (byte-array length)]
+        (with-open [bis (java.io/input-stream path)]
+          (.read bis data-barray))
+        data-barray))))

 (defn get-project-clj-path
   [path]
@@ -49,6 +59,31 @@
     (binding [leiningen.new.templates/*dir* dir]
       (->> [file-name (render file-name data)]
            (leiningen.new.templates/->files data)))))
+
+(defn stale-java-classes
+  [dirs compile-path]
+  (for [dir dirs
+        source (filter #(-> % (.getName) (.endsWith ".java"))
+                       (file-seq (java.io/file dir)))
+        :let [rel-source (.substring (.getPath source) (inc (count dir)))
+              rel-compiled (.replaceFirst rel-source "\\.java$" ".class")
+              compiled (java.io/file compile-path rel-compiled)]
+        :when (>= (.lastModified source) (.lastModified compiled))]
+    (.getPath compiled)))
+
+(defn create-class-map
+  [classes paths]
+  (reduce (fn [class-map path]
+            (let [modified-path (clojure.string/replace path #"[/\\]" ".")
+                  class-symbol (-> #(.contains modified-path (.name %))
+                                   (filter classes)
+                                   first)]
+              (if class-symbol
+                (doto class-map
+                  (.put class-symbol (read-file path)))
+                class-map)))
+          (java.util.HashMap.)
+          paths))

 ; check project types

@@ -112,8 +147,6 @@
       (.join pump-out)
       (.join pump-err)
       (.waitFor @process))))
-
-(defonce class-name (str *ns*))

 (defn start-process-indirectly
   [process path & args]
@@ -201,11 +234,18 @@
                        .attachingConnectors
                        (filter #(= (.name (.transport %)) "dt_socket"))
                        first)]
-     (let [prm (.defaultArguments conn)]
+     (let [prm (.defaultArguments conn)
+           stale-classes (-> (:java-source-paths project-map)
+                             (stale-java-classes (:compile-path project-map))
+                             doall)]
        (.setValue (.get prm "port") debug-port)
        (.setValue (.get prm "hostname") "127.0.0.1")
        (when-let [vm (try (.attach conn prm) (catch Exception _))]
-         (leiningen.javac/javac project-map)))))
+         (leiningen.javac/javac project-map)
+         (->> stale-classes
+              (create-class-map (.allClasses vm))
+              (.redefineClasses vm))
+         (.dispose vm)))))

 ; high-level commands


working on the landing page

working on the landing page

--- src/com/podviaznikov/index.clj
+++ src/com/podviaznikov/index.clj
@@ -7,17 +7,33 @@
     [:head
       [:meta {:charset "utf-8"}]
       [:meta {:http-equiv "X-UA-Compatible" :content "IE=edge,chrome=1"}]
-      [:title "perun: composable static site generator build with Clojure and Boot"]
+      [:title "Anton Podviaznikov"]
       [:meta {:name "viewport" :content "width=device-width, initial-scale=1.0, user-scalable=no"}]
-      [:meta {:itemprop "author" :name "author" :content "hashobject (team@hashobject.com)"}]
-      [:link {:rel "icon" :type "image/png" :href "/favicon-32x32.png" :sizes "32x32"}]
-      [:link {:rel "icon" :type "image/png" :href "/favicon-96x96.png" :sizes "96x96"}]
-      [:link {:rel "icon" :type "image/png" :href "/favicon-16x16.png" :sizes "16x16"}]
+      [:meta {:itemprop "author" :name "author" :content "Anton Podviaznikov"}]
       (include-css "/tufte.css")
       ]
     [:body
-      [:div
+      [:header
         [:h1 "Anton Podviaznikov"]
-        [:p "Software engineer"]]
+        [:p "software engineer, traveller, citizen of the world"]]
+      [:section
+        [:h2 "Geography"]
+          [:ul
+            [:li "I was born in Germany"]
+            [:li "I grew up in post-Soviet Ukraine"]
+            [:li "I left Ukraine for Montenegro"]
+            [:li "I visited more than 20 countries"]
+            [:li "I live in San Francisco now"]]
+        ]
+        [:section
+          [:h2 "Work"]
+            [:ul
+              [:li "I worked in decently large outsourcing company in Ukraine"]
+              [:li "I worked in small product company in Montenegro"]
+              [:li "I was freelance developer for two periods"]
+              [:li "I was founding engineer at CircuitHub"]
+              [:li "I was first engineer at HumanAPI"]
+              [:li "Right now I work at Runnable"]]
+          ]

       ]))


Fix player info popup position

Fix player info popup position

--- src/robinson/ui/components/robinson.clj
+++ src/robinson/ui/components/robinson.clj
@@ -302,7 +302,7 @@
                                                                             :gray))
                                                 :background-color (rcolor/color->rgb :white)}} [
                                   [Highlight {} [(str (or (item :hotkey)
-                                                          \space))]]
+                                                          "space"))]]
                                   [:text {} [(format "%c%s%s %s %s"
                                                (if-let [hotkey (get item :hotkey)]
                                                  (if (contains? (set selected-hotkeys) hotkey)
@@ -940,7 +940,7 @@
         strength      (int (rp/get-player-attribute game-state :strength))
         dexterity     (rp/get-player-attribute game-state :dexterity)
         toughness     (rp/get-player-attribute game-state :toughness)]
-    (zc/csx [zcui/Popup {:style {:top 5}} [
+    (zc/csx [zcui/Popup {:style {:top -5}} [
         [:text {} [(format "Name:      %s" player-name)]]
         [:text {} [(format "Level:     %d (%d/%d)" level xp xp-next-level)]]
         [:text {} [""]]
@@ -1366,7 +1366,7 @@
         log-color        (rcolor/darken-rgb (rcolor/color->rgb (get message :color)) darken-factor)]
     (zc/csx
         [:view {} [
-          [:text {:style {:position :fixed :top -4 :left 0}} [
+          [:text {:style {:position :fixed :top 1 :left 0}} [
             (if msg-above?
               (zc/csx [:text {} [
                         [Highlight {} ["/"]]
@@ -1677,8 +1677,6 @@
                     first)
         r (mod (int (/ (System/currentTimeMillis) 4000)) (count values))
         n (first (nth values r))]
-    (log/info r)
-    (log/info n)
     (reset! tidbit-index n)
     (async/<! (async/timeout (rand-nth [1200 600])))
     (recur (update tidbit-freqs n inc))))


add unit test for PUT /api/org/:id

add unit test for PUT /api/org/:id

--- test/metabase/api/org_test.clj
+++ test/metabase/api/org_test.clj
@@ -137,6 +137,25 @@
   ((user->client :rasta) :get 404 "org/slug/ksdlfkjdkfd"))

+;; ## PUT /api/org/:id
+;; Test that we can update an Org
+(expect-let [orig-name (random-name)
+             upd-name (random-name)
+             {:keys [id slug inherits] :as org} (create-org orig-name)]
+  {:id id
+   :slug slug
+   :name upd-name
+   :description upd-name
+   :logo_url upd-name
+   :inherits false}
+  ;; we try setting `slug` & `inherits` which should both remain unmodified
+  ((user->client :crowberto) :put 200 (format "org/%d" id) {:slug upd-name
+                                                            :name upd-name
+                                                            :description upd-name
+                                                            :logo_url upd-name
+                                                            :inherits true}))
+
+
 ;; # MEMBERS ENDPOINTS

 ;; ## GET /api/org/:id/members


add a test for recorded progress

add a test for recorded progress

--- test/runbld/test/main_test.clj
+++ test/runbld/test/main_test.clj
@@ -1,7 +1,6 @@
 (ns runbld.test.main-test
   (:require [cheshire.core :as json]
             [clj-git.core :refer [git-branch git-clone git-log load-repo]]
-            [clj-http.client :as http]
             [clj-http.core :as http-core]
             [clojure.java.io :as jio]
             [clojure.test :refer :all]
@@ -372,3 +371,45 @@
           (is (thrown-with-msg? Exception #"oh noes"
                                 (store/get conn "index" "type" 1234)))
           (is (= 5 @call-count)))))))
+
+(deftest record-progress
+  (let [ready (promise)
+        proceed (promise)
+        done (promise)
+        res (atom nil)]
+    (with-redefs [main/send-email identity
+                  main/send-slack (fn [opts]
+                                    (deliver done true)
+                                    opts)
+                  main/wipe-workspace (fn [opts]
+                                        (reset! res opts)
+                                        (deliver ready true)
+                                        (is (deref proceed 6000 nil)
+                                            "Timed out waiting to proceed")
+                                        opts)]
+      (git/with-tmp-repo [d "tmp/git/record-progress-test-1"]
+        (let [args (conj
+                    ["-c" "test/config/main.yml"
+                     "-j" "elastic+foo+master"
+                     "-d" d]
+                    "test/success.bash")
+              opts (opts/parse-args args)]
+          (future (apply main/-main args))
+          (when (is (deref ready 4000 nil)
+                    "Timed out waiting on pipeline")
+            (testing "we've started, we should have a record"
+              (let [record (store/get (-> opts :es :conn)
+                                      (-> @res :store-result :addr :index)
+                                      (-> @res :store-result :addr :type)
+                                      (-> @res :store-result :addr :id))]
+                (is (= "elastic" (-> record :build :org)))
+                (is (nil? (-> record :process :exit-code)))))
+            (deliver proceed true)
+            (when (is (deref done 10000 nil)
+                      "Timed out waiting on pipeline to finish")
+              (let [record (store/get (-> opts :es :conn)
+                                      (-> @res :store-result :addr :index)
+                                      (-> @res :store-result :addr :type)
+                                      (-> @res :store-result :addr :id))]
+                (is (= "elastic" (-> record :build :org)))
+                (is (zero? (-> record :process :exit-code)))))))))))


Tests for sequence operations

Tests for sequence operations

--- test/clojure/lean_map/test.clj
+++ test/clojure/lean_map/test.clj
@@ -16,4 +16,8 @@

 (t/deftest transient-assoc-operations-with-hash-collisions
   (t/is (= :bar1 (-> lmu/empty transient (assoc! :key70327 :bar1 :key101439 :bar2) persistent! (get :key70327))))
-  (t/is (= :bar2 (-> lmu/empty transient (assoc! :key70327 :bar1 :key101439 :bar2) persistent! (get :key101439)))))+  (t/is (= :bar2 (-> lmu/empty transient (assoc! :key70327 :bar1 :key101439 :bar2) persistent! (get :key101439)))))
+
+(t/deftest seq-operations
+  (t/is (= false (-> lmu/empty (assoc :foo :bar) seq empty?)))
+  (t/is (= [:foo :bar] (-> lmu/empty (assoc :foo :bar) seq first))))


Removes explicit (run-tests) call in account_test.clj

--- test/expenses/account_test.clj
+++ test/expenses/account_test.clj
@@ -12,8 +12,8 @@
    (->FinancialRecord "06/02/2014" "2960-2" "Compra com Cartão - 31/05 23:11 RIA ROSARIO" "" "183473" "-15.75")])

 (deftest reader-can-read-extracts
-  (testing "read extract"
-    (is (> (count (read-extract "resources/account/extrato.csv")) 1))))
+  (testing "read extract"
+    (is (> (count (read-extract "resources/account/extrato.csv")) 1))))

 (deftest convert-vector-to-record
   (testing "vector read from file is converted to FinancialRecord"
@@ -32,5 +32,3 @@
     (is (zero? (income (transform-files fixtures-fs)))))
   (testing "it takes all files and spits the sum of debts"
     (is (= (debt (transform-files fixtures-fs)) 19.95))))
-
-(run-tests)


make the primary test database in-memory too

--- test/metabase/test/data/h2.clj
+++ test/metabase/test/data/h2.clj
@@ -25,20 +25,13 @@

 ;; ## DatabaseDefinition helper functions

-(defn- filename
-  "Return filename that should be used for connecting to H2 database defined by DATABASE-DEFINITION.
-   This does not include the `.mv.db` extension."
-  [^DatabaseDefinition database-definition]
-  (format "%s/target/%s" (System/getProperty "user.dir") (escaped-name database-definition)))
-
 (defn- connection-details
   "Return a Metabase `Database.details` for H2 database defined by DATABASE-DEFINITION."
   [^DatabaseDefinition {:keys [short-lived?], :as database-definition}]
-  {:db (format (if short-lived?
-                 ;; for so-called 'short-lived' (temp) DBs create them in-memory
-                 "mem:%s"
-                 "file:%s;AUTO_SERVER=TRUE;DB_CLOSE_DELAY=-1")
-        (filename database-definition))
+  {:db (str (format "mem:%s" (escaped-name database-definition))
+            ;; For non "short-lived" (temp) databases keep the connection open for the duration of unit tests
+            (when-not short-lived?
+              ";DB_CLOSE_DELAY=-1"))
    :short-lived? short-lived?})

 (defn- korma-connection-pool
@@ -88,9 +81,8 @@
     (connection-details database-definition))

   (drop-physical-db! [_ database-definition]
-    (let [file (io/file (format "%s.mv.db" (filename database-definition)))]
-      (when (.exists file)
-        (.delete file))))
+    ;; Nothing to do here - there are no physical dbs <3
+    )

   (create-physical-table! [this database-definition table-definition]
     (generic/create-physical-table! this database-definition (format-for-h2 table-definition)))


Move some test code to be logicaly ordered.

--- test/suricatta/extend_test.clj
+++ test/suricatta/extend_test.clj
@@ -107,14 +107,6 @@
         result1 (first result)]
     (is (= (:k result1) {:foo 1}))))

-(deftest extract-bind-values-test
-  (let [d (myjson {:foo 1})
-        q (-> (dsl/insert-into :table)
-              (dsl/insert-values {:data d}))
-        r (fmt/get-bind-values q)]
-    (is (= (count r) 1))
-    (is (= (.data d) (.data (first r))))))
-
 (deftest inserting-json-using-dsl-test
   (sc/execute *ctx* "create table t1 (k json)")

@@ -124,6 +116,14 @@

   (let [result (sc/fetch-one *ctx* ["select * from t1"])]
     (is (= (:k result) {:foo 1}))))
+
+(deftest extract-bind-values-test
+  (let [d (myjson {:foo 1})
+        q (-> (dsl/insert-into :table)
+              (dsl/insert-values {:data d}))
+        r (fmt/get-bind-values q)]
+    (is (= (count r) 1))
+    (is (= (.data d) (.data (first r))))))

 (deftest render-json-test
   (let [q (-> (dsl/insert-into :t1)


Reformatted htm_renderer_test.clj by zprint

--- test/zg/html_renderer_test.clj
+++ test/zg/html_renderer_test.clj
@@ -21,212 +21,218 @@
 ;

 (defn callable?
-    "Test if given function-name is bound to the real function."
-    [function-name]
-    (clojure.test/function? function-name))
+  "Test if given function-name is bound to the real function."
+  [function-name]
+  (clojure.test/function? function-name))

 ;
 ; Test for existence of several functions.
 ;

 (deftest test-render-html-header-existence
-    "Check that the zg.html-renderer/render-html-header definition exists."
-    (testing "if the zg.html-renderer/render-html-header definition exists."
-        (is (callable? 'zg.html-renderer/render-html-header))))
+  "Check that the zg.html-renderer/render-html-header definition exists."
+  (testing "if the zg.html-renderer/render-html-header definition exists."
+           (is (callable? 'zg.html-renderer/render-html-header))))

 (deftest test-render-html-footer-existence
-    "Check that the zg.html-renderer/render-html-footer definition exists."
-    (testing "if the zg.html-renderer/render-html-footer definition exists."
-        (is (callable? 'zg.html-renderer/render-html-footer))))
+  "Check that the zg.html-renderer/render-html-footer definition exists."
+  (testing "if the zg.html-renderer/render-html-footer definition exists."
+           (is (callable? 'zg.html-renderer/render-html-footer))))

 (deftest test-mode->str-existence
-    "Check that the zg.html-renderer/mode->str definition exists."
-    (testing "if the zg.html-renderer/mode->str definition exists."
-        (is (callable? 'zg.html-renderer/mode->str))))
+  "Check that the zg.html-renderer/mode->str definition exists."
+  (testing "if the zg.html-renderer/mode->str definition exists."
+           (is (callable? 'zg.html-renderer/mode->str))))

 (deftest test-search-href-existence
-    "Check that the zg.html-renderer/search-href definition exists."
-    (testing "if the zg.html-renderer/search-href definition exists."
-        (is (callable? 'zg.html-renderer/search-href))))
+  "Check that the zg.html-renderer/search-href definition exists."
+  (testing "if the zg.html-renderer/search-href definition exists."
+           (is (callable? 'zg.html-renderer/search-href))))

 (deftest test-render-search-field-existence
-    "Check that the zg.html-renderer/render-search-field definition exists."
-    (testing "if the zg.html-renderer/render-search-field definition exists."
-        (is (callable? 'zg.html-renderer/render-search-field))))
+  "Check that the zg.html-renderer/render-search-field definition exists."
+  (testing "if the zg.html-renderer/render-search-field definition exists."
+           (is (callable? 'zg.html-renderer/render-search-field))))

 (deftest test-render-name-field-existence
-    "Check that the zg.html-renderer/render-name-field definition exists."
-    (testing "if the zg.html-renderer/render-name-field definition exists."
-        (is (callable? 'zg.html-renderer/render-name-field))))
+  "Check that the zg.html-renderer/render-name-field definition exists."
+  (testing "if the zg.html-renderer/render-name-field definition exists."
+           (is (callable? 'zg.html-renderer/render-name-field))))

 (deftest test-tab-class-existence
-    "Check that the zg.html-renderer/tab-class definition exists."
-    (testing "if the zg.html-renderer/tab-class definition exists."
-        (is (callable? 'zg.html-renderer/tab-class))))
+  "Check that the zg.html-renderer/tab-class definition exists."
+  (testing "if the zg.html-renderer/tab-class definition exists."
+           (is (callable? 'zg.html-renderer/tab-class))))

 (deftest test-user-href-existence
-    "Check that the zg.html-renderer/user-href definition exists."
-    (testing "if the zg.html-renderer/user-href definition exists."
-        (is (callable? 'zg.html-renderer/user-href))))
+  "Check that the zg.html-renderer/user-href definition exists."
+  (testing "if the zg.html-renderer/user-href definition exists."
+           (is (callable? 'zg.html-renderer/user-href))))

 (deftest test-users-href-existence
-    "Check that the zg.html-renderer/users-href definition exists."
-    (testing "if the zg.html-renderer/users-href definition exists."
-        (is (callable? 'zg.html-renderer/users-href))))
+  "Check that the zg.html-renderer/users-href definition exists."
+  (testing "if the zg.html-renderer/users-href definition exists."
+           (is (callable? 'zg.html-renderer/users-href))))

 (deftest test-remember-me-href-existence
-    "Check that the zg.html-renderer/remember-me-href definition exists."
-    (testing "if the zg.html-renderer/remember-me-href definition exists."
-        (is (callable? 'zg.html-renderer/remember-me-href))))
+  "Check that the zg.html-renderer/remember-me-href definition exists."
+  (testing "if the zg.html-renderer/remember-me-href definition exists."
+           (is (callable? 'zg.html-renderer/remember-me-href))))

 (deftest test-render-navigation-bar-section-existence
-    "Check that the zg.html-renderer/render-navigation-bar-section definition exists."
-    (testing "if the zg.html-renderer/render-navigation-bar-section definition exists."
-        (is (callable? 'zg.html-renderer/render-navigation-bar-section))))
+  "Check that the zg.html-renderer/render-navigation-bar-section definition exists."
+  (testing
+    "if the zg.html-renderer/render-navigation-bar-section definition exists."
+    (is (callable? 'zg.html-renderer/render-navigation-bar-section))))

 (deftest test-render-error-page-existence
-    "Check that the zg.html-renderer/render-error-page definition exists."
-    (testing "if the zg.html-renderer/render-error-page definition exists."
-        (is (callable? 'zg.html-renderer/render-error-page))))
+  "Check that the zg.html-renderer/render-error-page definition exists."
+  (testing "if the zg.html-renderer/render-error-page definition exists."
+           (is (callable? 'zg.html-renderer/render-error-page))))

 (deftest test-render-front-page-existence
-    "Check that the zg.html-renderer/render-front-page definition exists."
-    (testing "if the zg.html-renderer/render-front-page definition exists."
-        (is (callable? 'zg.html-renderer/render-front-page))))
+  "Check that the zg.html-renderer/render-front-page definition exists."
+  (testing "if the zg.html-renderer/render-front-page definition exists."
+           (is (callable? 'zg.html-renderer/render-front-page))))

 (deftest test-render-users-existence
-    "Check that the zg.html-renderer/render-users definition exists."
-    (testing "if the zg.html-renderer/render-users definition exists."
-        (is (callable? 'zg.html-renderer/render-users))))
+  "Check that the zg.html-renderer/render-users definition exists."
+  (testing "if the zg.html-renderer/render-users definition exists."
+           (is (callable? 'zg.html-renderer/render-users))))

 (deftest test-render-user-info-existence
-    "Check that the zg.html-renderer/render-user-info definition exists."
-    (testing "if the zg.html-renderer/render-user-info definition exists."
-        (is (callable? 'zg.html-renderer/render-user-info))))
+  "Check that the zg.html-renderer/render-user-info definition exists."
+  (testing "if the zg.html-renderer/render-user-info definition exists."
+           (is (callable? 'zg.html-renderer/render-user-info))))

 ;
 ; Test for function behaviours
 ;

 (deftest test-render-html-header
-    "Checking the function zg.html-renderer/render-html-header."
-    (testing "the function zg.html-renderer/render-html-header."
-        (are [x y] (= (slurp x) y)
-            "test/expected/html_header1.html" (page/xhtml (render-html-header "" "" ""))
-            "test/expected/html_header2.html" (page/xhtml (render-html-header "" "" "title"))
-            "test/expected/html_header3.html" (page/xhtml (render-html-header "" "http://10.20.30.40/" ""))
-            "test/expected/html_header4.html" (page/xhtml (render-html-header "" "http://10.20.30.40/" "title"))
-            "test/expected/html_header5.html" (page/xhtml (render-html-header "word" "" ""))
-            "test/expected/html_header6.html" (page/xhtml (render-html-header "word" "" "title"))
-            "test/expected/html_header7.html" (page/xhtml (render-html-header "word" "http://10.20.30.40/" ""))
-            "test/expected/html_header8.html" (page/xhtml (render-html-header "word" "http://10.20.30.40/" "title")))))
+  "Checking the function zg.html-renderer/render-html-header."
+  (testing
+    "the function zg.html-renderer/render-html-header."
+    (are [x y] (= (slurp x) y)
+         "test/expected/html_header1.html" (page/xhtml (render-html-header "" "" ""))
+         "test/expected/html_header2.html" (page/xhtml (render-html-header "" "" "title"))
+         "test/expected/html_header3.html" (page/xhtml (render-html-header "" "http://10.20.30.40/" ""))
+         "test/expected/html_header4.html" (page/xhtml (render-html-header "" "http://10.20.30.40/" "title"))
+         "test/expected/html_header5.html" (page/xhtml (render-html-header "word" "" ""))
+         "test/expected/html_header6.html" (page/xhtml (render-html-header "word" "" "title"))
+         "test/expected/html_header7.html" (page/xhtml (render-html-header "word" "http://10.20.30.40/" ""))
+         "test/expected/html_header8.html" (page/xhtml (render-html-header "word" "http://10.20.30.40/" "title")))))

 (deftest test-render-html-footer
-    "Checking the function zg.html-renderer/render-html-footer."
-    (testing "the function zg.html-renderer/render-html-footer."
-        (is (= (slurp "test/expected/html_footer1.html") (page/xhtml (render-html-footer))))))
+  "Checking the function zg.html-renderer/render-html-footer."
+  (testing "the function zg.html-renderer/render-html-footer."
+           (is (= (slurp "test/expected/html_footer1.html")
+                  (page/xhtml (render-html-footer))))))

 (deftest test-mode->str
-    "Checking the function zg.html-renderer/mode->str."
-    (testing "the function zg.html-renderer/mode->str."
-        (are [x y] (= x (mode->str y))
-            "whitelist"    :whitelist
-            "blacklist"    :blacklist
-            "atomic-typos" :atomic-typos
-            "glossary"     :glossary
-            "whitelist"    :other
-            "whitelist"    nil)))
+  "Checking the function zg.html-renderer/mode->str."
+  (testing "the function zg.html-renderer/mode->str."
+           (are [x y] (= x (mode->str y))
+                "whitelist"    :whitelist
+                "blacklist"    :blacklist
+                "atomic-typos" :atomic-typos
+                "glossary"     :glossary
+                "whitelist"    :other
+                "whitelist"    nil)))

 (deftest test-render-search-href
-    "Checking the function zg.html-renderer/render-search-href."
-    (testing "the function zg.html-renderer/render-search-href."
-        (are [x y] (= (slurp x) y)
-            "test/expected/search-href1.html"  (search-href "" :whitelist)
-            "test/expected/search-href2.html"  (search-href "" :blacklist)
-            "test/expected/search-href3.html"  (search-href "/" :whitelist)
-            "test/expected/search-href4.html"  (search-href "/" :blacklist)
-            "test/expected/search-href5.html"  (search-href "http://10.20.30.40/" :whitelist)
-            "test/expected/search-href6.html"  (search-href "http://10.20.30.40/" :blacklist)
-            "test/expected/search-href7.html"  (search-href "http://10.20.30.40/zg/" :whitelist)
-            "test/expected/search-href8.html"  (search-href "http://10.20.30.40/zg/" :blacklist)
-            "test/expected/search-href9.html"  (search-href ""  :atomic-typos)
-            "test/expected/search-href10.html" (search-href "/" :atomic-typos)
-            "test/expected/search-href11.html" (search-href "http://10.20.30.40/" :atomic-typos)
-            "test/expected/search-href12.html" (search-href "http://10.20.30.40/zg/" :atomic-typos))))
+  "Checking the function zg.html-renderer/render-search-href."
+  (testing
+    "the function zg.html-renderer/render-search-href."
+    (are [x y] (= (slurp x) y)
+         "test/expected/search-href1.html"  (search-href "" :whitelist)
+         "test/expected/search-href2.html"  (search-href "" :blacklist)
+         "test/expected/search-href3.html"  (search-href "/" :whitelist)
+         "test/expected/search-href4.html"  (search-href "/" :blacklist)
+         "test/expected/search-href5.html"  (search-href "http://10.20.30.40/" :whitelist)
+         "test/expected/search-href6.html"  (search-href "http://10.20.30.40/" :blacklist)
+         "test/expected/search-href7.html"  (search-href "http://10.20.30.40/zg/" :whitelist)
+         "test/expected/search-href8.html"  (search-href "http://10.20.30.40/zg/" :blacklist)
+         "test/expected/search-href9.html"  (search-href ""  :atomic-typos)
+         "test/expected/search-href10.html" (search-href "/" :atomic-typos)
+         "test/expected/search-href11.html" (search-href "http://10.20.30.40/" :atomic-typos)
+         "test/expected/search-href12.html" (search-href "http://10.20.30.40/zg/" :atomic-typos))))

 (deftest test-render-search-field
-    "Checking the function zg.html-renderer/render-search-field."
-    (testing "the function zg.html-renderer/render-search-field."
-        (are [x y] (= (slurp x) y)
-            "test/expected/search-field1.html" (page/xhtml (render-search-field "word" "" :whitelist))
-            "test/expected/search-field2.html" (page/xhtml (render-search-field "word" "" :blacklist))
-            "test/expected/search-field3.html" (page/xhtml (render-search-field "word" "/" :whitelist))
-            "test/expected/search-field4.html" (page/xhtml (render-search-field "word" "/" :blacklist))
-            "test/expected/search-field5.html" (page/xhtml (render-search-field "word" "http://10.20.30.40/" :whitelist))
-            "test/expected/search-field6.html" (page/xhtml (render-search-field "word" "http://10.20.30.40/" :blacklist))
-            "test/expected/search-field7.html" (page/xhtml (render-search-field "word" "http://10.20.30.40/zg/" :whitelist))
-            "test/expected/search-field8.html" (page/xhtml (render-search-field "word" "http://10.20.30.40/zg/" :blacklist)))))
+  "Checking the function zg.html-renderer/render-search-field."
+  (testing
+    "the function zg.html-renderer/render-search-field."
+    (are [x y] (= (slurp x) y)
+         "test/expected/search-field1.html" (page/xhtml (render-search-field "word" "" :whitelist))
+         "test/expected/search-field2.html" (page/xhtml (render-search-field "word" "" :blacklist))
+         "test/expected/search-field3.html" (page/xhtml (render-search-field "word" "/" :whitelist))
+         "test/expected/search-field4.html" (page/xhtml (render-search-field "word" "/" :blacklist))
+         "test/expected/search-field5.html" (page/xhtml (render-search-field "word" "http://10.20.30.40/" :whitelist))
+         "test/expected/search-field6.html" (page/xhtml (render-search-field "word" "http://10.20.30.40/" :blacklist))
+         "test/expected/search-field7.html" (page/xhtml (render-search-field "word" "http://10.20.30.40/zg/" :whitelist))
+         "test/expected/search-field8.html" (page/xhtml (render-search-field "word" "http://10.20.30.40/zg/" :blacklist)))))

 (deftest test-render-name-field
-    "Checking the function zg.html-renderer/render-name-field."
-    (testing "the function zg.html-renderer/render-name-field."
-        (are [x y] (= (slurp x) y)
-            "test/expected/name-field1.html" (page/xhtml (render-name-field "user name" ""))
-            "test/expected/name-field3.html" (page/xhtml (render-name-field "user name" "/"))
-            "test/expected/name-field5.html" (page/xhtml (render-name-field "user name" "http://10.20.30.40/"))
-            "test/expected/name-field7.html" (page/xhtml (render-name-field "user name" "http://10.20.30.40/zg/")))))
+  "Checking the function zg.html-renderer/render-name-field."
+  (testing
+    "the function zg.html-renderer/render-name-field."
+    (are [x y] (= (slurp x) y)
+         "test/expected/name-field1.html" (page/xhtml (render-name-field "user name" ""))
+         "test/expected/name-field3.html" (page/xhtml (render-name-field "user name" "/"))
+         "test/expected/name-field5.html" (page/xhtml (render-name-field "user name" "http://10.20.30.40/"))
+         "test/expected/name-field7.html" (page/xhtml (render-name-field "user name" "http://10.20.30.40/zg/")))))

 (deftest test-tab-class
-    "Checking the function zg.html-renderer/tab-class."
-    (testing "the function zg.html-renderer/tab-class."
-        (are [x y] (= x y)
-            {:class "active"} (tab-class 1 1)
-            {:class "active"} (tab-class true true)
-            {:class "active"} (tab-class "word" "word")
-            nil               (tab-class 1 2)
-            nil               (tab-class true false)
-            nil               (tab-class "word" "world"))))
+  "Checking the function zg.html-renderer/tab-class."
+  (testing "the function zg.html-renderer/tab-class."
+           (are [x y] (= x y)
+                {:class "active"} (tab-class 1 1)
+                {:class "active"} (tab-class true true)
+                {:class "active"} (tab-class "word" "word")
+                nil               (tab-class 1 2)
+                nil               (tab-class true false)
+                nil               (tab-class "word" "world"))))

 (deftest test-user-href
-    "Checking the function zg.html-renderer/user-href."
-    (testing "the function zg.html-renderer/user-href."
-        (are [x y] (= x y)
-            [:a {:href "user-whitelist?name=username"} "username"] (user-href "username" :whitelist)
-            [:a {:href "user-blacklist?name=username"} "username"] (user-href "username" :blacklist)
-            [:a {:href "user-whitelist?name=other-user"} "other-user"] (user-href "other-user" :whitelist)
-            [:a {:href "user-blacklist?name=other-user"} "other-user"] (user-href "other-user" :blacklist))))
+  "Checking the function zg.html-renderer/user-href."
+  (testing "the function zg.html-renderer/user-href."
+           (are [x y] (= x y)
+                [:a {:href "user-whitelist?name=username"} "username"] (user-href "username" :whitelist)
+                [:a {:href "user-blacklist?name=username"} "username"] (user-href "username" :blacklist)
+                [:a {:href "user-whitelist?name=other-user"} "other-user"] (user-href "other-user" :whitelist)
+                [:a {:href "user-blacklist?name=other-user"} "other-user"] (user-href "other-user" :blacklist))))

 (deftest test-users-href
-    "Checking the function zg.html-renderer/users-href."
-    (testing "the function zg.html-renderer/users-href."
-        (are [x y] (= x y)
-            "url-prefix/users-whitelist"    (users-href "url-prefix/" :whitelist)
-            "url-prefix/users-blacklist"    (users-href "url-prefix/" :blacklist)
-            "url-prefix/users-atomic-typos" (users-href "url-prefix/" :atomic-typos)
-            "url-prefix/users-glossary"     (users-href "url-prefix/" :glossary)
-            nil                             (users-href "url-prefix/" :something-else))))
+  "Checking the function zg.html-renderer/users-href."
+  (testing "the function zg.html-renderer/users-href."
+           (are [x y] (= x y)
+                "url-prefix/users-whitelist"    (users-href "url-prefix/" :whitelist)
+                "url-prefix/users-blacklist"    (users-href "url-prefix/" :blacklist)
+                "url-prefix/users-atomic-typos" (users-href "url-prefix/" :atomic-typos)
+                "url-prefix/users-glossary"     (users-href "url-prefix/" :glossary)
+                nil                             (users-href "url-prefix/" :something-else))))

 (deftest test-remember-me-href
-    "Checking the function zg.html-renderer/remember-me-href."
-    (testing "the function zg.html-renderer/remember-me-href."
-        (are [x y] (= x y)
-            "url-prefix/whitelist"    (remember-me-href "url-prefix/" :whitelist)
-            "url-prefix/blacklist"    (remember-me-href "url-prefix/" :blacklist)
-            "url-prefix/atomic-typos" (remember-me-href "url-prefix/" :atomic-typos)
-            "url-prefix/glossary"     (remember-me-href "url-prefix/" :glossary)
-            nil                       (remember-me-href "url-prefix/" :something-else))))
-
+  "Checking the function zg.html-renderer/remember-me-href."
+  (testing "the function zg.html-renderer/remember-me-href."
+           (are [x y] (= x y)
+                "url-prefix/whitelist"    (remember-me-href "url-prefix/" :whitelist)
+                "url-prefix/blacklist"    (remember-me-href "url-prefix/" :blacklist)
+                "url-prefix/atomic-typos" (remember-me-href "url-prefix/" :atomic-typos)
+                "url-prefix/glossary"     (remember-me-href "url-prefix/" :glossary)
+                nil                       (remember-me-href "url-prefix/" :something-else))))
+


Cosmetics

Cosmetics

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

--- src/conexp/fca/exploration.clj
+++ src/conexp/fca/exploration.clj
@@ -92,8 +92,9 @@

   If you want to use automorphisms of the underlying context, you have to construct a
   special handler using the «make-handler» function. See the corresponding documentation
-  of «make-handler»."  [& {:keys [possible-context certain-context context
-  background-knowledge handler incomplete-counterexamples]}]
+  of «make-handler»."
+  [& {:keys [possible-context certain-context context
+             background-knowledge handler incomplete-counterexamples]}]
   ;; first check for arguments
   (assert (or (and (nil? context)
                    (not (nil? possible-context))


update piggieback to support latest jdk

update piggieback to support latest jdk

--- src/leiningen/new/chestnut.clj
+++ src/leiningen/new/chestnut.clj
@@ -39,7 +39,7 @@

 (def project-clj-dev-deps '[[figwheel "0.5.18"]
                             [figwheel-sidecar "0.5.18"]
-                            [cider/piggieback "0.3.10"]
+                            [cider/piggieback "0.4.0"]
                             [cider/cider-nrepl "0.18.0"]
                             [lein-doo "0.1.11"]
                             [reloaded.repl "0.2.4"]])


home...

home...

--- generateme/home.clj
+++ generateme/home.clj
@@ -11,19 +11,19 @@
   (:import [net.jafama FastMath]))

-(def p1 (p/load-pixels "generateme/aa/aa.jpg"))
+(def p1 (p/load-pixels "generateme/adrian/ares6.png"))

-(def p2 (p/load-pixels "generateme/graj/res_23B5869B_graj.jpg"))
+(def p2 (p/load-pixels "generateme/adrian/ares3.png"))

 (def p3 (p/load-pixels "generateme/ooo/ooo.jpg"))

-(def noise-overlay (o/make-noise 80 (.w p1) (.h p1)))
-(def spots-overlay (o/make-spots 80 [30 60 120 180] (.w p1) (.h p1)))
+(def noise-overlay (o/make-noise 30 (.w p1) (.h p1)))
+(def spots-overlay (o/make-spots 80 [20 30 60 120 180 200] (.w p1) (.h p1)))

 (def canvas (core/create-canvas (.w p1) (.h p1)))

-(def scale 0.9)
+(def scale 0.4)

 (def windows (core/show-window canvas "glitch" (* scale (.w p1)) (* scale (.h p1)) 10))

@@ -33,7 +33,7 @@
   (println b2)
   (p/set-canvas-pixels canvas (p/filter-channels p/equalize-filter false
                                                  (p/filter-channels p/normalize-filter false
-                                                                    (g/blend-machine p1 p4 b)))))
+                                                                    (g/blend-machine p4 p5 b)))))

 (quick-bench (p/filter-channels p/dilate-filter false p1))

@@ -47,7 +47,7 @@

 (core/close-session)

-(core/save-canvas canvas (core/next-filename "generateme/aa/res" ".jpg"))
+(core/save-canvas canvas (core/next-filename "generateme/adrian/res" ".png"))

 (p/set-canvas-pixels canvas p5)

@@ -63,11 +63,14 @@

 ;; slitscan

-(let [v1 (v/make-variation (rand-nth v/variation-list-not-random) 1.0 {})
-      v2 (v/make-variation (rand-nth v/variation-list-not-random) 1.0 {})
+(let [v1name (rand-nth v/variation-list-not-random)
+      v2name (rand-nth v/variation-list-not-random)
+      v1 (v/make-variation v1name 1.0 {})
+      v2 (v/make-variation v2name 1.0 {})
       f (comp v1 v2)]

   (binding [p/*pixels-edge* :wrap]
+    (println (str v2name " o " v1name))
     (p/set-canvas-pixels canvas (p/filter-channels (g/make-slitscan2-filter f 3.0)
                                                    (g/make-slitscan2-filter f 2.98)
                                                    (g/make-slitscan2-filter f 3.02) nil p5))))
@@ -75,18 +78,19 @@
 ;; full process without use of filter-channels
 (time (let [effect (make-effect :dj-eq {:lo (m/drand -20 20) :mid (m/drand -20 20) :hi (m/drand -20 20) :peak_bw 1.3 :shelf_slope 1.5 :rate (m/irand 4000 100000)})
             effect2 (make-effect :distort {:factor 1.0})
-            in (signal-from-pixels p1 {:layout :interleaved
-                                          :channels [0 1 2]
-                                          :bits 24
+            inluv (p/filter-colors c/to-HWB p5)
+            in (signal-from-pixels inluv {:layout :interleaved
+                                          :channels [0]
+                                          :bits 8
                                           :coding :none
-                                          :signed false})
-            res (apply-effect effect2 in)
-            resp (signal-to-pixels (p/clone-pixels p1) res {:channels [0 1 2]
+                                          :signed true})
+            res (apply-effect effect in)
+            resp (signal-to-pixels (p/clone-pixels p1) res {:channels [0]
                                                             :layout :interleaved
-                                                            :bits 24
+                                                            :bits 8
                                                             :coding :none
-                                                            :signed false})]
-        (p/set-canvas-pixels canvas (p/filter-channels p/normalize nil resp))))
+                                                            :signed true})]
+        (p/set-canvas-pixels canvas (p/filter-channels p/normalize nil (p/filter-colors c/from-HWB resp)))))

 ;; fold


don't load analyzer data for non-cljs files

--- src/main/shadow/bootstrap.cljs
+++ src/main/shadow/bootstrap.cljs
@@ -4,6 +4,7 @@
             [cljs.core.async :as async]
             [cljs.js :as cljs]
             [shadow.xhr :as xhr]
+            [shadow.js]
             [cognitect.transit :as transit]
             [cljs.env :as env]))

@@ -21,7 +22,7 @@
   (xhr/chan :GET path nil {:body-only true
                            :transform identity}))

-(defonce already-loaded-helper
+(defonce empty-result-helper
   (doto (async/chan)
     (async/close!)))

@@ -71,16 +72,11 @@

 (defn load-analyzer-data [ns]
   {:pre [(symbol? ns)]}
-  (let [{:keys [source-name] :as ns-info}
-        (get-ns-info ns)
-
-        ;; FIXME: full name should in info
-        req
-        (transit-load (str asset-path "/ana/" source-name ".ana.transit.json"))]
-
-    (go (when-some [x (<! req)]
-          (js/console.log "analyzer" ns ns-info x)
-          x))))
+  (let [{:keys [type source-name] :as ns-info} (get-ns-info ns)]
+    (js/console.log "analyzer" ns ns-info)
+    (if (not= :cljs type)
+      empty-result-helper
+      (transit-load (str asset-path "/ana/" source-name ".ana.transit.json")))))

 (defn load-macro-js [ns]
   {:pre [(symbol? ns)]}
@@ -131,13 +127,15 @@
   (let [ns
         (if macros
           (symbol (str name "$macros"))
-          name)]
+          name)
+
+        {:keys [type] :as ns-info}
+        (get-ns-info ns)]

     ;; FIXME: needs to ensure that deps are loaded first
     (go (let [ana (<! (load-analyzer-data ns))
               js (<! (load-js ns))]
           (js/console.log "boot/load" name macros ns ana (count js))
-          (when ana
-            (swap! cljs/*loaded* conj ns)
-            (cb {:lang :js :source js :cache ana})))
+          (swap! cljs/*loaded* conj ns)
+          (cb {:lang :js :source js :cache ana}))
         )))


port :fn-invoke-direct compiler option

port :fn-invoke-direct compiler option

no idea why this needs to be a binding

--- src/main/shadow/cljs/build.clj
+++ src/main/shadow/cljs/build.clj
@@ -934,11 +934,14 @@
   "given the compiler state and a cljs resource, compile it and return the updated resource
    should not touch global state"
   [{:keys [compiler-options source-map-comment] :as state} {:keys [name js-name input] :as rc}]
-  (let [{:keys [static-fns elide-asserts]}
+  (let [{:keys [static-fns elide-asserts fn-invoke-direct]}
         compiler-options]

     (binding [ana/*cljs-static-fns*
-              static-fns
+              (true? static-fns)
+
+              ana/*fn-invoke-direct*
+              (true? fn-invoke-direct)

               ana/*file-defs*
               (atom #{})
@@ -953,7 +956,7 @@
               ana/*cljs-warnings*

               *assert*
-              (not= elide-asserts true)]
+              (not (true? elide-asserts))]

       (let [source @input]
         (util/with-logged-time


added the wait, as a primitive form of backing-off;

--- src/mustached_hipster/core.clj
+++ src/mustached_hipster/core.clj
@@ -10,7 +10,7 @@

    (let [
       before (System/nanoTime)
-      elapsed #(* (- (System/nanoTime) before) 1e-9)
+      after #(System/nanoTime)
       grab-and-process (comp
          (partial map #(clojure.string/replace % #"\?.*" "\n"))
          (partial filter #(not= \# (first %)))
@@ -18,22 +18,31 @@
          :body
          http/get)]

-      (let
-         [playlist (grab-and-process m3u8)]
-         (println "successfully fetched the playlist in" (elapsed) "seconds")
+      (let [
+          playlist (grab-and-process m3u8)
+          elapsed (- (after) before)]
+
+         (println "successfully fetched the playlist in" (* elapsed 1e-9) "seconds")
          playlist)))

 (defn get-segment
    [seg-url]

-   (let
-      [filename (clojure.string/replace (clojure.string/trim-newline seg-url) #".*/" "")]
+   (let [
+      before (System/nanoTime)
+      after #(System/nanoTime)
+      filename (clojure.string/replace (clojure.string/trim-newline seg-url) #".*/" "")]

-      (with-open
-         [whandle (clojure.java.io/output-stream filename)]
+      (with-open [
+         whandle (clojure.java.io/output-stream filename)]

-         (.write whandle (:body (http/get seg-url {:as :byte-array})))
-         (println "successfully fetched" filename))))
+         (let [
+            elapsed (- (after) before)
+            millisec (long (* elapsed 1e-6))]
+
+            (.write whandle (:body (http/get seg-url {:as :byte-array})))
+            (println "successfully fetched" filename "in" millisec "ms (pausing for the same amount of time)")
+            (Thread/sleep millisec)))))

 (defn -main
    [url]


[#455] [Client] Fix Java version parsing (@aiba)

Recent Azul JDK builds identify themselves as e.g. 16-ea".
This change fixes parse-java-version to handle this string.

See https://www.azul.com/downloads/zulu-community/?version=java-16-ea&os=macos&package=jdk

--- src/org/httpkit/sni_client.clj
+++ src/org/httpkit/sni_client.clj
@@ -10,15 +10,23 @@
 (defn- parse-java-version
   "Ref. https://stackoverflow.com/a/2591122"
   [^String s]
-  (if (.startsWith s "1.") ; e.g. "1.6.0_23"
-    (Integer/parseInt (.substring s 2 3))
-    (let [dot-idx (.indexOf s ".")] ; e.g. "9.0.1"
-      (when (not= dot-idx -1)
-        (Integer/parseInt (.substring s 0 dot-idx))))))
+
+  (let [dot-idx (.indexOf s ".")    ; e.g. "1.6.0_23"
+        dash-idx (.indexOf s "-")]  ; e.g. "16-ea"
+    (cond
+      (.startsWith s "1.") ; e.g. "1.6.0_23"
+      (Integer/parseInt (.substring s 2 3))
+
+      (pos? dot-idx)
+      (Integer/parseInt (.substring s 0 dot-idx))
+
+      (pos? dash-idx)
+      (Integer/parseInt (.substring s 0 dash-idx)))))

 (comment
   (parse-java-version "1.6.0_23") ; 6
   (parse-java-version "9.0.1")    ; 9
+  (parse-java-version "16-ea")    ; 16
   )

 (def ^:private java-version_


Clean up tiled-map-layer

Clean up tiled-map-layer

--- src/play_clj/core_graphics.clj
+++ src/play_clj/core_graphics.clj
@@ -93,11 +93,11 @@
   ([screen layer]
     (if (isa? (type layer) MapLayer)
         layer
-        (let [^BatchTiledMapRenderer renderer (u/get-obj screen :renderer)
-              ^TiledMap m (.getMap renderer)]
-          (->> (.getLayers m)
-               (drop-while #(not= layer (.getName ^MapLayer %)))
-               first)))))
+        (->> ^BatchTiledMapRenderer (u/get-obj screen :renderer)
+             .getMap
+             .getLayers
+             (drop-while #(not= layer (.getName ^MapLayer %)))
+             first))))

 (defmacro tiled-map-layer
   "Returns a [TiledMapTileLayer](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/maps/tiled/TiledMapTileLayer.html)


drop reference to devtools from core

drop reference to devtools from core

--- src/sierpinski_sieve/core.cljs
+++ src/sierpinski_sieve/core.cljs
@@ -1,6 +1,5 @@
 (ns sierpinski-sieve.core
-  (:require [devtools.core :as devtools]
-            [reagent.core :as reagent :refer [atom]]
+  (:require [reagent.core :as reagent :refer [atom]]
             [sierpinski-sieve.blit :as blit])
   (:use-macros [sierpinski-sieve.macros :only [forloop]]))