Reformatted server_test.clj by zprint

Reformatted server_test.clj by zprint

--- test/zg/server_test.clj
+++ test/zg/server_test.clj
@@ -19,256 +19,257 @@
 ;

 (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))

 ;
 ; Tests for various functions existence
 ;

 (deftest test-get-user-name-existence
-    "Check that the zg.server/get-user-name definition exists."
-    (testing "if the zg.server/get-user-name definition exists."
-        (is (callable? 'zg.server/get-user-name))))
+  "Check that the zg.server/get-user-name definition exists."
+  (testing "if the zg.server/get-user-name definition exists."
+           (is (callable? 'zg.server/get-user-name))))

 (deftest test-get-title-existence
-    "Check that the zg.server/get-title definition exists."
-    (testing "if the zg.server/get-title definition exists."
-        (is (callable? 'zg.server/get-title))))
+  "Check that the zg.server/get-title definition exists."
+  (testing "if the zg.server/get-title definition exists."
+           (is (callable? 'zg.server/get-title))))

 (deftest test-get-url-prefix-existence
-    "Check that the zg.server/get-url-prefix definition exists."
-    (testing "if the zg.server/get-url-prefix definition exists."
-        (is (callable? 'zg.server/get-url-prefix))))
+  "Check that the zg.server/get-url-prefix definition exists."
+  (testing "if the zg.server/get-url-prefix definition exists."
+           (is (callable? 'zg.server/get-url-prefix))))

 (deftest test-finish-processing-existence
-    "Check that the zg.server/finish-processing definition exists."
-    (testing "if the zg.server/finish-processing definition exists."
-        (is (callable? 'zg.server/finish-processing))))
+  "Check that the zg.server/finish-processing definition exists."
+  (testing "if the zg.server/finish-processing definition exists."
+           (is (callable? 'zg.server/finish-processing))))

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

 (deftest test-process-whitelist-existence
-    "Check that the zg.server/process-whitelist definition exists."
-    (testing "if the zg.server/process-whitelist definition exists."
-        (is (callable? 'zg.server/process-whitelist))))
+  "Check that the zg.server/process-whitelist definition exists."
+  (testing "if the zg.server/process-whitelist definition exists."
+           (is (callable? 'zg.server/process-whitelist))))

 (deftest test-process-blacklist-existence
-    "Check that the zg.server/process-blacklist definition exists."
-    (testing "if the zg.server/process-blacklist definition exists."
-        (is (callable? 'zg.server/process-blacklist))))
+  "Check that the zg.server/process-blacklist definition exists."
+  (testing "if the zg.server/process-blacklist definition exists."
+           (is (callable? 'zg.server/process-blacklist))))

 (deftest test-add-word-message-existence
-    "Check that the zg.server/add-word-message definition exists."
-    (testing "if the zg.server/add-word-message definition exists."
-        (is (callable? 'zg.server/add-word-message))))
+  "Check that the zg.server/add-word-message definition exists."
+  (testing "if the zg.server/add-word-message definition exists."
+           (is (callable? 'zg.server/add-word-message))))

 (deftest test-add-words-message-existence
-    "Check that the zg.server/add-words-message definition exists."
-    (testing "if the zg.server/add-words-message definition exists."
-        (is (callable? 'zg.server/add-words-message))))
+  "Check that the zg.server/add-words-message definition exists."
+  (testing "if the zg.server/add-words-message definition exists."
+           (is (callable? 'zg.server/add-words-message))))

 (deftest test-split-words-existence
-    "Check that the zg.server/split-words definition exists."
-    (testing "if the zg.server/split-words definition exists."
-        (is (callable? 'zg.server/split-words))))
+  "Check that the zg.server/split-words definition exists."
+  (testing "if the zg.server/split-words definition exists."
+           (is (callable? 'zg.server/split-words))))

 (deftest test-process-add-word-existence
-    "Check that the zg.server/process-add-word definition exists."
-    (testing "if the zg.server/process-add-word definition exists."
-        (is (callable? 'zg.server/process-add-word))))
+  "Check that the zg.server/process-add-word definition exists."
+  (testing "if the zg.server/process-add-word definition exists."
+           (is (callable? 'zg.server/process-add-word))))

 (deftest test-process-add-words-existence
-    "Check that the zg.server/process-add-words definition exists."
-    (testing "if the zg.server/process-add-words definition exists."
-        (is (callable? 'zg.server/process-add-words))))
+  "Check that the zg.server/process-add-words definition exists."
+  (testing "if the zg.server/process-add-words definition exists."
+           (is (callable? 'zg.server/process-add-words))))

 (deftest test-perform-operation-existence
-    "Check that the zg.server/perform-operation definition exists."
-    (testing "if the zg.server/perform-operation definition exists."
-        (is (callable? 'zg.server/perform-operation))))
+  "Check that the zg.server/perform-operation definition exists."
+  (testing "if the zg.server/perform-operation definition exists."
+           (is (callable? 'zg.server/perform-operation))))

 (deftest test-process-all-words-existence
-    "Check that the zg.server/process-all-words definition exists."
-    (testing "if the zg.server/process-all-words definition exists."
-        (is (callable? 'zg.server/process-all-words))))
+  "Check that the zg.server/process-all-words definition exists."
+  (testing "if the zg.server/process-all-words definition exists."
+           (is (callable? 'zg.server/process-all-words))))

 (deftest test-process-deleted-words-existence
-    "Check that the zg.server/process-deleted-words definition exists."
-    (testing "if the zg.server/process-deleted-words definition exists."
-        (is (callable? 'zg.server/process-deleted-words))))
+  "Check that the zg.server/process-deleted-words definition exists."
+  (testing "if the zg.server/process-deleted-words definition exists."
+           (is (callable? 'zg.server/process-deleted-words))))

 (deftest test-process-active-words-existence
-    "Check that the zg.server/process-active-words definition exists."
-    (testing "if the zg.server/process-active-words definition exists."
-        (is (callable? 'zg.server/process-active-words))))
+  "Check that the zg.server/process-active-words definition exists."
+  (testing "if the zg.server/process-active-words definition exists."
+           (is (callable? 'zg.server/process-active-words))))

 (deftest test-read-changes-statistic-existence
-    "Check that the zg.server/read-changes-statistic definition exists."
-    (testing "if the zg.server/read-changes-statistic definition exists."
-        (is (callable? 'zg.server/read-changes-statistic))))
+  "Check that the zg.server/read-changes-statistic definition exists."
+  (testing "if the zg.server/read-changes-statistic definition exists."
+           (is (callable? 'zg.server/read-changes-statistic))))

 (deftest test-read-changes-existence
-    "Check that the zg.server/read-changes definition exists."
-    (testing "if the zg.server/read-changes definition exists."
-        (is (callable? 'zg.server/read-changes))))
+  "Check that the zg.server/read-changes definition exists."
+  (testing "if the zg.server/read-changes definition exists."
+           (is (callable? 'zg.server/read-changes))))

 (deftest test-read-changes-for-user-existence
-    "Check that the zg.server/read-changes-for-user definition exists."
-    (testing "if the zg.server/read-changes-for-user definition exists."
-        (is (callable? 'zg.server/read-changes-for-user))))
+  "Check that the zg.server/read-changes-for-user definition exists."
+  (testing "if the zg.server/read-changes-for-user definition exists."
+           (is (callable? 'zg.server/read-changes-for-user))))

 (deftest test-process-user-list-existence
-    "Check that the zg.server/process-user-list definition exists."
-    (testing "if the zg.server/process-user-list definition exists."
-        (is (callable? 'zg.server/process-user-list))))
+  "Check that the zg.server/process-user-list definition exists."
+  (testing "if the zg.server/process-user-list definition exists."
+           (is (callable? 'zg.server/process-user-list))))

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

 (deftest test-words->json-existence
-    "Check that the zg.server/words->json definition exists."
-    (testing "if the zg.server/words->json definition exists."
-        (is (callable? 'zg.server/words->json))))
+  "Check that the zg.server/words->json definition exists."
+  (testing "if the zg.server/words->json definition exists."
+           (is (callable? 'zg.server/words->json))))

 (deftest test-words->text-existence
-    "Check that the zg.server/words->text definition exists."
-    (testing "if the zg.server/words->text definition exists."
-        (is (callable? 'zg.server/words->text))))
+  "Check that the zg.server/words->text definition exists."
+  (testing "if the zg.server/words->text definition exists."
+           (is (callable? 'zg.server/words->text))))

 (deftest test-words->xml-existence
-    "Check that the zg.server/words->xml definition exists."
-    (testing "if the zg.server/words->xml definition exists."
-        (is (callable? 'zg.server/words->xml))))
+  "Check that the zg.server/words->xml definition exists."
+  (testing "if the zg.server/words->xml definition exists."
+           (is (callable? 'zg.server/words->xml))))

 (deftest test-words->edn-existence
-    "Check that the zg.server/words->edn definition exists."
-    (testing "if the zg.server/words->edn definition exists."
-        (is (callable? 'zg.server/words->edn))))
+  "Check that the zg.server/words->edn definition exists."
+  (testing "if the zg.server/words->edn definition exists."
+           (is (callable? 'zg.server/words->edn))))

 (deftest test-process-wordlist-json-existence
-    "Check that the zg.server/process-wordlist-json definition exists."
-    (testing "if the zg.server/process-wordlist-json definition exists."
-        (is (callable? 'zg.server/process-wordlist-json))))
+  "Check that the zg.server/process-wordlist-json definition exists."
+  (testing "if the zg.server/process-wordlist-json definition exists."
+           (is (callable? 'zg.server/process-wordlist-json))))

 (deftest test-process-wordlist-text-existence
-    "Check that the zg.server/process-wordlist-text definition exists."
-    (testing "if the zg.server/process-wordlist-text definition exists."
-        (is (callable? 'zg.server/process-wordlist-text))))
+  "Check that the zg.server/process-wordlist-text definition exists."
+  (testing "if the zg.server/process-wordlist-text definition exists."
+           (is (callable? 'zg.server/process-wordlist-text))))

 (deftest test-process-wordlist-xml-existence
-    "Check that the zg.server/process-wordlist-xml definition exists."
-    (testing "if the zg.server/process-wordlist-xml definition exists."
-        (is (callable? 'zg.server/process-wordlist-xml))))
+  "Check that the zg.server/process-wordlist-xml definition exists."
+  (testing "if the zg.server/process-wordlist-xml definition exists."
+           (is (callable? 'zg.server/process-wordlist-xml))))

 (deftest test-process-wordlist-edn-existence
-    "Check that the zg.server/process-wordlist-edn definition exists."
-    (testing "if the zg.server/process-wordlist-edn definition exists."
-        (is (callable? 'zg.server/process-wordlist-edn))))
+  "Check that the zg.server/process-wordlist-edn definition exists."
+  (testing "if the zg.server/process-wordlist-edn definition exists."
+           (is (callable? 'zg.server/process-wordlist-edn))))

 (deftest test-return-file-existence
-    "Check that the zg.server/return-file definition exists."
-    (testing "if the zg.server/return-file definition exists."
-        (is (callable? 'zg.server/return-file))))
+  "Check that the zg.server/return-file definition exists."
+  (testing "if the zg.server/return-file definition exists."
+           (is (callable? 'zg.server/return-file))))

 (deftest test-handler-existence
-    "Check that the zg.server/handler definition exists."
-    (testing "if the zg.server/handler definition exists."
-        (is (callable? 'zg.server/handler))))
+  "Check that the zg.server/handler definition exists."
+  (testing "if the zg.server/handler definition exists."
+           (is (callable? 'zg.server/handler))))

 ;
 ; Test for function behaviours
 ;

 (deftest test-get-user-name-not-NPE
-    "Check the function zg.server/get-user-name."
-    (testing "the function zg.server/get-user-name."
-        (are [x y] (= x (get-user-name y))
-            nil nil)))
+  "Check the function zg.server/get-user-name."
+  (testing "the function zg.server/get-user-name."
+           (are [x y] (= x (get-user-name y))
+               nil nil)))

 (deftest test-get-user-name
-    "Check the function zg.server/get-user-name."
-    (testing "the function zg.server/get-user-name."
-        (are [x y] (= x (get-user-name y))
-            "new user" {:params  {"user-name" "new user"}}
-            "new user" {:params  {"user-name" "new user"}
-                        :cookies {"user-name" {:value "old user"}}}
-            "old user" {:cookies {"user-name" {:value "old user"}}})))
+  "Check the function zg.server/get-user-name."
+  (testing "the function zg.server/get-user-name."
+           (are [x y] (= x (get-user-name y))
+                "new user" {:params  {"user-name" "new user"}}
+                "new user" {:params  {"user-name" "new user"}
+                            :cookies {"user-name" {:value "old user"}}}
+                "old user" {:cookies {"user-name" {:value "old user"}}})))

 (deftest test-get-title
-    "Check the function zg.server/get-title."
-    (testing "the function zg.server/get-title."
-        (are [x y] (= x (get-title y))
-            "ZG" {:configuration {:display {:app-name "ZG"}}}
-            nil  {:configuration {:display {:app-name nil}}}
-            nil  {:configuration {:display nil}}
-            nil  {:configuration {:something-else nil}}
-            nil  {:configuration nil}
-            nil  {:something-else nil}
-            nil  nil)))
+  "Check the function zg.server/get-title."
+  (testing "the function zg.server/get-title."
+           (are [x y] (= x (get-title y))
+                "ZG" {:configuration {:display {:app-name "ZG"}}}
+                nil  {:configuration {:display {:app-name nil}}}
+                nil  {:configuration {:display nil}}
+                nil  {:configuration {:something-else nil}}
+                nil  {:configuration nil}
+                nil  {:something-else nil}
+                nil  nil)))

 (deftest test-get-emender-page
-    "Check the function zg.server/get-emender-page."
-    (testing "the function zg.server/get-emender-page."
-        (are [x y] (= x (get-emender-page y))
-            "http://www.emender.org" {:configuration {:display {:emender-page "http://www.emender.org"}}}
-            nil  {:configuration {:display {:emender-page nil}}}
-            nil  {:configuration {:display nil}}
-            nil  {:configuration {:something-else nil}}
-            nil  {:configuration nil}
-            nil  {:something-else nil}
-            nil  nil)))
+  "Check the function zg.server/get-emender-page."
+  (testing
+    "the function zg.server/get-emender-page."
+    (are [x y] (= x (get-emender-page y))
+         "http://www.emender.org" {:configuration {:display {:emender-page "http://www.emender.org"}}}
+         nil  {:configuration {:display {:emender-page nil}}}
+         nil  {:configuration {:display nil}}
+         nil  {:configuration {:something-else nil}}
+         nil  {:configuration nil}
+         nil  {:something-else nil}
+         nil  nil)))

 (deftest test-get-url-prefix
-    "Check the function zg.server/get-url-prefix."
-    (testing "the function zg.server/get-url-prefix."
-        (are [x y] (= x (get-url-prefix y))
-            "http://localhost" {:configuration {:server {:url-prefix "http://localhost"}}}
-            nil  {:configuration {:server {:url-prefix nil}}}
-            nil  {:configuration {:server nil}}
-            nil  {:configuration {:something-else nil}}
-            nil  {:configuration nil}
-            nil  {:something-else nil}
-            nil  nil)))
+  "Check the function zg.server/get-url-prefix."
+  (testing "the function zg.server/get-url-prefix."
+           (are [x y] (= x (get-url-prefix y))
+                "http://localhost" {:configuration {:server {:url-prefix "http://localhost"}}}
+                nil  {:configuration {:server {:url-prefix nil}}}
+                nil  {:configuration {:server nil}}
+                nil  {:configuration {:something-else nil}}
+                nil  {:configuration nil}
+                nil  {:something-else nil}
+                nil  nil)))

 (deftest test-split-words-empty-input
-    "Check the function zg.server/split-words."
-    (testing "the function zg.server/split-words."
-        (is (nil? (split-words nil)))))
-
+  "Check the function zg.server/split-words."
+  (testing "the function zg.server/split-words."
+           (is (nil? (split-words nil)))))
+


hide emoji on unmount chat

hide emoji on unmount chat

--- src/status_im/chat/screen.cljs
+++ src/status_im/chat/screen.cljs
@@ -188,7 +188,8 @@
    show-emoji?       [:chat-ui-props :show-emoji?]
    command?          [:command?]
    layout-height     [:get :layout-height]]
-  {:component-did-mount #(dispatch [:check-autorun])}
+  {:component-did-mount #(dispatch [:check-autorun])
+   :component-will-unmount #(dispatch [:set-chat-ui-props :show-emoji? false])}
   [view {:style    st/chat-view
          :onLayout (fn [event]
                      (let [height (.. event -nativeEvent -layout -height)]


update riemann to work with key-value tags

--- files/alerta.clj
+++ files/alerta.clj
@@ -22,6 +22,11 @@
 		; :debug-body true
                 :throw-entire-message? true})))

+(defn key-value-split
+  "Split on equals, always returning two values."
+  [s]
+  (if (.contains s "=") (clojure.string/split s #"=" 2) [s ""]))
+
 (defn format-alerta-event
   "Formats an event for Alerta."
   [event]
@@ -38,7 +43,7 @@
    :severity (:state event)
    :environment [(get event :environment "INFRA")]
    :service [(get event :grid "Common")]
-   :tags (:tags event)
+   :tags (into {} (map #(key-value-split %) (:tags event)))
    :text (:description event)
    :moreInfo "more info here"
    :rawData event})


good so far

good so far

--- src/epicea/typed/core.clj
+++ src/epicea/typed/core.clj
@@ -4,9 +4,23 @@
             [epicea.utils.defmultiple :refer [defmultiple]]
             [epicea.utils.access :as access] :reload-all))

-(spec/def ::double (spec/or :type (partial = :double)
+(spec/def ::unspecified nil?)
+(spec/def ::bool boolean?)
+(spec/def ::float float?)
+(spec/def ::double double?)
+(spec/def ::long #(instance? java.lang.Long %))
+(spec/def ::int #(instance? java.lang.Integer %))
+(spec/def ::primitive (spec/or
+                       :bool (partial = :bool)
+                       :float (partial = :float)
+                       :long (partial = :long)
+                       :double (partial = :double)
+                       :int (partial = :int)))
+(spec/def ::dynamic (partial = :dynamic))
+
+(spec/def ::number (spec/or :type #(or (= % :number)
+                                       (= % :double))
                             :literal number?))
-(spec/def ::unspecified nil?)
 (spec/def ::count number?)
 (spec/def ::key keyword?)

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

 (spec/def ::vecdata (spec/cat
                      :type (partial = :vecdata)
-                     :values (spec/* ::sized-type)))
+                     :data (spec/* ::sized-type)))

 ;; Compile time tagging
 (spec/def ::tagged (spec/cat
@@ -37,10 +51,10 @@
                     :tag (constantly true)
                     :data ::sized-type))

-(spec/def ::sized-type (spec/or :double ::double
+(spec/def ::sized-type (spec/or :number ::number
                                 :record ::record
                                 :union ::union
-                                :unspecified ::unspecified
+                                :unspecified ::unspecified ;; <-- a primitive building block
                                 :tagged ::tagged
                                 :vec ::vec
                                 :vecdata ::vecdata))
@@ -50,15 +64,21 @@
                    :header (spec/? ::sized-type)
                    :data ::sized-type))

+(spec/def ::type (spec/or :sized-type ::sized-type
+                          :primitive ::primitive
+                          :array ::array
+                          :dynamic ::dynamic))
+
+
 ;; How to specify one:
-;; (value [:record :a :double :b double] [3 [4 9]])
+;; (value [:record :a :number :b double] [3 [4 9]])

-(assert (spec/valid? ::double :double))
-(assert (spec/valid? ::union [:union :double :double]))
+(assert (spec/valid? ::number :number))
+(assert (spec/valid? ::union [:union :number :number]))
 (assert (spec/valid? ::record [:record
-                               :a :double
+                               :a :number
                                :b [:vec nil 3]]))
-(assert (spec/valid? ::tagged [:tag 119 [:vec :double 3]]))
+(assert (spec/valid? ::tagged [:tag 119 [:vec :number 3]]))
 (assert (spec/valid? ::array [:array [:record :a nil :b nil]]))
 (assert (spec/valid? ::array [:array [:record :a nil :b nil] nil]))
 (assert (spec/valid? ::vecdata [:vecdata 3 4 5]))
@@ -82,17 +102,44 @@
 (def size-mul *)
 (def size-max max)

+
+;;;; Compute the size of a ::sized-type
 (defmultiple compute-size get-pair-tag
   (:vec [x] (let [value (get-pair-value x)]
               (size-mul (:count value) (compute-size (:type value)))))
-  (:double [x] 1)
+  (:number [x] 1)
   (:tagged [x] (compute-size (:data (get-pair-value x))))
   (:union [x] (reduce size-max (map compute-size (-> x get-pair-value :alts))))
   (:record [x] (reduce size-add (map (comp compute-size :value)
-                                    (-> x get-pair-value :fields)))))
+                                    (-> x get-pair-value :fields))))
+  (:unspecified [x] nil)
+  (:vecdata [x] (reduce size-add (map compute-size (-> x get-pair-value :data)))))
+

-(assert (= 1 (compute-size (spec/conform ::sized-type [:tag 119 :double]))))
+(assert (= 1 (compute-size (spec/conform ::sized-type [:tag 119 :number]))))
 (assert (= 1 (compute-size (spec/conform ::sized-type 3))))
-(assert (= 3 (compute-size (spec/conform ::sized-type [:vec :double 3]))))
-(assert (= 2 (compute-size (spec/conform ::sized-type [:union :double [:vec :double 2]]))))
-(assert (= 2 (compute-size (spec/conform ::sized-type [:record :a :double :b :double]))))
+(assert (= 3 (compute-size (spec/conform ::sized-type [:vec :number 3]))))
+(assert (= 2 (compute-size (spec/conform ::sized-type [:union :number [:vec :number 2]]))))
+(assert (= 2 (compute-size (spec/conform ::sized-type [:record :a :number :b :number]))))
+(assert (= 3 (compute-size (spec/conform
+                            ::sized-type
+                            [:record :a :number :b :number :c :number]))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Grammar
+(spec/def ::arg-name symbol?)
+
+(spec/def ::arg-decl (spec/cat
+                    :type ::type
+                    :name ::arg-name))
+
+(spec/def ::arg-list (spec/* ::arg-decl))
+
+(spec/def ::statement (constantly true))
+
+(spec/def ::typed-fun (spec/cat
+                       :return-type ::type
+                       :arg-list (spec/spec ::arg-list)
+                       :body (spec/* ::statement)))
+(assert (not=
+         ::spec/invalid
+         (spec/conform ::typed-fun [nil [:double 'a :double 'b] :a :b :c])))


Break a long docstring

Break a long docstring

--- src/refactor_nrepl/util.clj
+++ src/refactor_nrepl/util.clj
@@ -143,9 +143,12 @@
     (cut-sexp trimmed-code sexp-start sexp-end)))

 (defn get-enclosing-sexp
-  "Extracts the sexp enclosing point at LINE and COLUMN in FILE-CONTENT and optionally LEVEL.
+  "Extracts the sexp enclosing point at LINE and COLUMN in FILE-CONTENT,
+  and optionally LEVEL.

-  A string is not treated as a sexp by this function. If LEVEL is provided finds the enclosing sexp up to level. LEVEL defaults to 1 for the immediate enclising sexp.
+  A string is not treated as a sexp by this function. If LEVEL is
+  provided finds the enclosing sexp up to level. LEVEL defaults to 1
+  for the immediate enclising sexp.

   Both line and column are indexed from 0."
   ([file-content line column]


Remove TODO

Remove TODO

--- src/expound/problems.cljc
+++ src/expound/problems.cljc
@@ -238,7 +238,6 @@
             (string/re-quote-replacement s))
      :cljs (string/replace s #"\$" "$$$$")))

-;; TODO - refactor for readability
 (defn highlighted-value
   "Given a problem, returns a pretty printed
    string that highlights the problem value"


as a convenience stringify args to *print-fn*

fixes #575

--- support/src/figwheel/client.cljs
+++ support/src/figwheel/client.cljs
@@ -6,7 +6,7 @@
    [cljs.reader :refer [read-string]]
    [cljs.core.async :refer [put! chan <! map< close! timeout alts!] :as async]
    [figwheel.client.socket :as socket]
-   [figwheel.client.utils :as utils]
+   [figwheel.client.utils :as utils]
    [figwheel.client.heads-up :as heads-up]
    [figwheel.client.file-reloading :as reloading]
    [clojure.string :as string]
@@ -18,14 +18,20 @@

 (def _figwheel-version_ "0.5.12-SNAPSHOT")

-;; exception formatting
+(def js-stringify
+  (if (and (exists? js/JSON) (some? js/JSON.stringify))
+    (fn [x] (str "#js " (js/JSON.stringify x nil " ")))
+    (fn [x] (try (str x) (catch js/Error e "Error: Unable to stringify")))))

 (defn figwheel-repl-print
   ([stream args]
    (socket/send! {:figwheel-event "callback"
                   :callback-name "figwheel-repl-print"
                   :content {:stream stream
-                            :args args}})
+                            :args
+                            (mapv
+                             #(if (string? %) % (js-stringify %))
+                             args)}})
    nil)
   ([args]
    (figwheel-repl-print :out args)))
@@ -49,7 +55,7 @@
 (defn enable-repl-print! []
   (set! *print-newline* false)
   (set-print-fn! repl-out-print-fn)
-  (set-print-err-fn! repl-err-print-fn)
+  (set-print-err-fn! repl-err-print-fn)
   nil)

 (defn autoload? []
@@ -67,7 +73,7 @@
   "Figwheel by default loads code changes as you work. Sometimes you
   just want to work on your code without the ramifications of
   autoloading and simply load your code piecemeal in the REPL. You can
-  turn autoloading on and of with this method.
+  turn autoloading on and of with this method.

   (figwheel.client/set-autoload false)

@@ -83,7 +89,7 @@
 (defn ^:export set-repl-pprint
   "This method gives you the ability to turn the pretty printing of
   the REPL's return value on and off.
-
+
   (figwheel.client/set-repl-pprint false)

   NOTE: This is a persistent setting, meaning that it will persist
@@ -153,7 +159,7 @@
                      (cond
                        (reload-file-state? msg-names opts)
                        (alts! [(reloading/reload-js-files opts msg) (timeout 1000)])
-
+
                        (block-reload-file-state? msg-names opts)
                        (utils/log :warn (str "Figwheel: Not loading code with warnings - " (-> msg :files first :file))))
                      (do
@@ -196,13 +202,13 @@
         (result-handler
          {:status :exception
           :value (pr-str e)
-          :ua-product (get-ua-product)
+          :ua-product (get-ua-product)
           :stacktrace (string/join "\n" (truncate-stack-trace (.-stack e)))
           :base-path base-path }))
       (catch :default e
         (result-handler
          {:status :exception
-          :ua-product (get-ua-product)
+          :ua-product (get-ua-product)
           :value (pr-str e)
           :stacktrace "No stacktrace available."}))
       (finally
@@ -256,32 +262,32 @@
                (:autoload opts))
         (<! (heads-up/flash-loaded))
         (<! (heads-up/clear)))
-
+
       (compile-refail-state? msg-names)
       (do
         (<! (heads-up/clear))
         (<! (heads-up/display-exception (:exception-data msg)))
         (auto-jump-to-error opts (:exception-data msg)))
-
+
       (compile-fail-state? msg-names)
       (do
         (<! (heads-up/display-exception (:exception-data msg)))
         (auto-jump-to-error opts (:exception-data msg)))
-
+
       (warning-append-state? msg-names)
       (heads-up/append-warning-message (:message msg))
-
+
       (rewarning-state? msg-names)
       (do
         (<! (heads-up/clear))
         (<! (heads-up/display-warning (:message msg)))
         (auto-jump-to-error opts (:message msg)))
-
+
       (warning-state? msg-names)
       (do
         (<! (heads-up/display-warning (:message msg)))
         (auto-jump-to-error opts (:message msg)))
-
+
       (css-loaded-state? msg-names)
       (<! (heads-up/flash-loaded))))))

@@ -323,7 +329,7 @@
                   ".  Shutting down Websocket Connection!"
                   "
To fix try:
"
                   "

Reload this page and make sure you are not getting a cached version of the client.
"
-                  "
You may have to clean (delete compiled assets) and rebuild to make sure that the new client code is being used.
"
+                  "
You may have to clean (delete compiled assets) and rebuild to make sure that the new client code is being used.
"
                   "
Also, make sure you have consistent Figwheel dependencies.

"))))))))

 #_((enforce-figwheel-version-plugin {:heads-up-display true}) [{:figwheel-version "yeah"}])
@@ -364,7 +370,7 @@

 (defn default-on-cssload [files]
   (utils/log :debug "Figwheel: loaded CSS files")
-  (utils/log :info (pr-str (map :file files)))
+  (utils/log :info (pr-str (map :file files)))
   files)

 (defonce config-defaults
@@ -375,21 +381,21 @@
    :load-warninged-code false
    :auto-jump-to-source-on-error false
    ;; :on-message identity
-
+
    :on-jsload default-on-jsload
    :before-jsload default-before-load

    :on-cssload default-on-cssload
-
+
    :on-compile-fail #'default-on-compile-fail
    :on-compile-warning #'default-on-compile-warning

    :reload-dependents true
-
+
    :autoload true
-
+
    :debug false
-
+
    :heads-up-display true

    :eval-fn false
@@ -459,7 +465,7 @@
                             plugins'
                             (merge (base-plugins system-options) merge-plugins))]
              (set! utils/*print-debug* (:debug opts))
-             (enable-repl-print!)
+             (enable-repl-print!)
              (add-plugins plugins system-options)
              (reloading/patch-goog-base)
              (doseq [msg (:initial-messages system-options)]


Fixed a formatting issue.

Fixed a formatting issue.

--- src/asid/strings.clj
+++ src/asid/strings.clj
@@ -21,8 +21,8 @@

 (defn resolve-url [rel orig]
   (-> (URI. orig)
-    (.resolve rel)
-    .toString))
+      (.resolve rel)
+      .toString))

 (fact
   (resolve-url "/hello" "http://localhost:8888/hfdf-45fd") => "http://localhost:8888/hello")


Omit axis names in snippets for cljs as `text` does not supported `z` coordinate in p5js. Issue #255.


add TODOs about partial parsing

add TODOs about partial parsing

--- src/babel/writer.clj
+++ src/babel/writer.clj
@@ -91,6 +91,11 @@
                       (log/error "grammar: " (map :rule (:grammar target-language-model)))
                       (log/error "lexicon: " (map (:morph target-language-model)
                                                   (sort (keys (:lexicon target-language-model)))))
+                      ;; TODO: add partial parses for more diagnostics:
+                      ;; need to try parsing same spec, but without the
+                      ;;  {:synsem {:subcat '()}} that makes us try to generate
+                      ;; an entire sentence.
+
                       (throw (Exception. message))))))
         source-language-sentence (engine/generate {:synsem {:sem semantics
                                                             :subcat '()}}
@@ -106,8 +111,11 @@
                                    "; target expression was: '" ((:morph  @target-language-model) target-language-sentence) "'"
                                    "; target rule was: '" (:rule target-language-sentence) "'"
                                    "; target head rule was: '" (:rule (:head target-language-sentence)) "'"
+                                   ;; TODO: add partial parses for more diagnostics:
+                                   ;; need to try parsing same spec, but without the
+                                   ;;  {:synsem {:subcat '()}} that makes us try to generate
+                                   ;; an entire sentence.
                                    )
-
                       ]
                   (if (= true mask-populate-errors)
                     (log/warn message)


sort playlist-items

sort playlist-items

--- src/server/daveconservatoire/server/parser.cljs
+++ src/server/daveconservatoire/server/parser.cljs
@@ -182,7 +182,7 @@
     "e" :lesson.type/exercise
     "p" :lesson.type/playlist))

-(defmethod row-vattribute [:lesson :lesson/playlist-items] [env] (has-many env :playlist-item :playlist-item/lesson-id))
+(defmethod row-vattribute [:lesson :lesson/playlist-items] [env] (has-many env :playlist-item :playlist-item/lesson-id {:sort "sort"}))

 ;; ROOT READS


Writing name with dashes in the title of the about tab

--- src/amindblowingworld/view_index.clj
+++ src/amindblowingworld/view_index.clj
@@ -97,7 +97,7 @@
        [:table#tribesAndSettlements {:class "display" :cellspacing "0" :width "100%"}
         [:thead (table-headers)]
         [:tfoot (table-headers)]]]
-      [:h3 "About AMindBlowingWorld"]
+      [:h3 "About A-Mind-Blowing-World"]
       [:div#aboutDiv
        [:div.longText
         [:p "This application was built while paricipating in the "


fix db supaya ada field reply

fix db supaya ada field reply

--- src/clj/mobile_survey/models/db.clj
+++ src/clj/mobile_survey/models/db.clj
@@ -52,7 +52,7 @@

 (defn get-numbers-for-survey [survey-id]
   (select numbers
-          (fields :number)
+          (fields :number :reply)
           (where {:survey_id survey-id})))

 (defn update-reply! [number survey-id reply]


prefer using higher capacity cells rather than smaller

--- src/cljs/pack_builder/handlers.cljs
+++ src/cljs/pack_builder/handlers.cljs
@@ -44,7 +44,7 @@

 (defn organise-cells [cells s p]
   (let [total-cells (* s p)
-        old-solution (atom (take total-cells (sort-by :capacity cells)))
+        old-solution (atom (take total-cells (sort-by :capacity > cells)))
         old-cost (atom (aget js/Number "MAX_VALUE"))
         average-required (/ (total-capacity @old-solution) s)]
     (doall


Make fns a vector

Make fns a vector

--- src/icfp2014/compiler.clj
+++ src/icfp2014/compiler.clj
@@ -31,7 +31,7 @@
     (macros form)

     (symbol? form)
-    (if (fns form)
+    (if (some #(= (:name %) form) fns)
       [[:ldf form]]
       [[:ld 0 (.indexOf vars form)]])

@@ -61,20 +61,17 @@

 (defn assign-addresses
   [fns]
-  {:pre [(map? fns)
-         (every? symbol? (keys fns))
-         (every? map? (vals fns))]
+  {:pre [(vector? fns)
+         (every? map? fns)]
    :post [(every? (comp integer? :address) %)]}
-  (let [prelude (fns 'prelude)
-        others (vals (sort (dissoc fns 'prelude)))]
-    (loop [funcs (vec (concat [prelude] others))
-           index 0
-           address 0]
-      (if-let [func (get funcs index)]
-        (do (prn func) (let [new-funcs (update-in funcs [index] assoc :address address)
-              address (+ address (:length func))]
-          (recur new-funcs (inc index) address)))
-        funcs))))
+  (loop [funcs fns
+         index 0
+         address 0]
+    (if-let [func (get funcs index)]
+      (let [new-funcs (update-in funcs [index] assoc :address address)
+                           address (+ address (:length func))]
+                       (recur new-funcs (inc index) address))
+      funcs)))

 (defn code->str
   [fn-addrs line]
@@ -99,22 +96,21 @@
         main {:name 'main
               :code code
               :length (count code)}]
-    (assoc fns 'main main)))
+    (conj fns main)))

 (defn generate-prelude
   [fns]
-  (let [others (vals (sort (dissoc fns 'main 'step)))
-        loads  (for [func others]
+  (let [loads  (for [func fns]
                  [:ldf (:name func)])
-        code (concat [[:dum (count others) "; define prelude"]]
+        code (concat [[:dum (count fns) "; define prelude"]]
                      loads
                      [[:ldf 'main]
-                      [:rap (count others)]
+                      [:rap (count fns)]
                       [:rtn]])
         prelude {:name 'prelude
               :code code
               :length (count code)}]
-    (assoc fns 'prelude prelude)))
+    (vec (cons prelude fns))))

 (defn emit-code
   [fns]
@@ -129,7 +125,7 @@
 (defn compile-function
   [[name args & body :as code] fns]
   {:pre [(list? code)]}
-  (let [fns (assoc fns name {})
+  (let [fns (conj fns {:name name})
         [stmt & stmts] (mapcat #(compile-form args fns %) body)
         code (concat [(conj stmt (format "; define %s" name))]
                      stmts
@@ -144,10 +140,10 @@
    :post [(string? %)]}
   (let [prog (java.io.PushbackReader. (clojure.java.io/reader file))]
     (loop [form (read prog false nil)
-           fns {}]
+           fns []]
       (if form
         (let [func (compile-function form fns)]
-          (recur (read prog false nil) (assoc fns (:name func) func)))
+          (recur (read prog false nil) (conj fns func)))
         (-> fns
             (generate-main)
             (generate-prelude)


Add multiple scenarios to report test

Add multiple scenarios to report test


Add tests for format string specifications

--- test/comic_reader/sites_test.clj
+++ test/comic_reader/sites_test.clj
@@ -133,6 +133,17 @@
   (has (not (format-specifiers? "%s%d" ["%s" "%f"])))
   (has (not (format-specifiers? "%sabc%d" ["%d" "%s"]))))

+(defn test-format-strings []
+  (and
+   (has (format-specifiers? (manga-list-format)
+                            ["%s"]))
+   (has (format-specifiers? (manga-url-format)
+                            ["%s"]))
+   (has (format-specifiers? (comic->url-format)
+                            ["%s" "%s"]))
+   (has (format-specifiers? (page-normalize-format)
+                            ["%s" "%s"]))))
+
 (defn test-extract-image-tag [html image-tag]
   (and
    (tu/ensure-dependencies-defined extract-image-tag)
@@ -253,6 +264,7 @@
           (test-regexes)
           (test-enlive-selectors)
           (test-normalize-functions)
+          (test-format-strings)

           (if (has-test-folder?)
             (and


Improved spec implementation (associative)

--- src/bytebuf/spec.clj
+++ src/bytebuf/spec.clj
@@ -1,6 +1,7 @@
 (ns bytebuf.spec
   (:refer-clojure :exclude [type read])
   (:require [bytebuf.types :as types]
+            [bytebuf.proto :as proto :refer [IStaticSize]]
             [bytebuf.buffer :as buffer]))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -10,20 +11,17 @@
 ;; (defprotocol ISpec
 ;;   (type [_] "Get the type of spec."))

-(defprotocol ISpecSize
-  (size [_] [_ data] "Calculate the size for this spec."))
-
 (defprotocol IReadableSpec
-  (read [_ buff] "Read all data from buffer."))
+  (read [_ buff start] "Read all data from buffer."))

 (defprotocol IWritableSpec
-  (write [_ buff data] "Read all data from buffer."))
+  (write [_ buff start data] "Read all data from buffer."))

-(defprotocol IAssocReadableSpec
-  (read-field [_ buff field] "Read one concrete field from buffer."))
+;; (defprotocol IAssocReadableSpec
+;;   (read-field [_ buff field] "Read one concrete field from buffer."))

-(defprotocol IAssocWritableSpec
-  (write-field [_ buff field] "Read one concrete field from buffer."))
+;; (defprotocol IAssocWritableSpec
+;;   (write-field [_ buff field data] "Read one concrete field from buffer."))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Types implementation
@@ -32,38 +30,44 @@
 (defn associative-static-spec
   [data dict types]
   (reify
-    ISpecSize
+    clojure.lang.Counted
+    (count [_]
+      (count types))
+
+    IStaticSize
     (size [_]
-      (reduce #(+ %1 (types/size %2)) 0 types))
-    (size [_ data]
       (reduce #(+ %1 (types/size %2)) 0 types))

     IReadableSpec
-    (read [_ buff]
-      (reduce (fn [acc [name t]]
-                (assoc acc name (types/read t buff)))
-              {}
-              data))
+    (read [_ buff offset]
+      (loop [index offset result {} pairs data]
+        (if-let [[fieldname type] (first pairs)]
+          (let [[readeddata readedbytes] (types/read type buff index)]
+            (recur (+ index readedbytes)
+                   (assoc result fieldname readeddata)
+                   (rest pairs)))
+          [(- index offset) result])))

     IWritableSpec
-    (write [_ buff data']
-      (reduce (fn [buff [fieldname type]]
-                (let [value (get data' fieldname nil)]
-                  (types/write type buff value)
-                  buff))
-              buff data))
+    (write [_ buff offset data']
+      (let [written (reduce (fn [index [fieldname type]]
+                              (let [value (get data' fieldname nil)
+                                    written (types/write type buff index value)]
+                                (+ index written)))
+                            offset data)]
+        (- written offset)))))

-    IAssocReadableSpec
-    (read-field [_ buff field]
-      (let [ftype (get dict field)
-            startpos (reduce (fn [acc [key val]]
-                               (if (= key field)
-                                 (reduced acc)
-                                 (+ acc (types/size val))))
-                             0 data)]
-        ;; Set the buffer position
-        (buffer/seek buff startpos)
-        (types/read ftype buff)))))
+    ;; IAssocReadableSpec
+    ;; (read-field [_ buff field]
+    ;;   (let [ftype (get dict field)
+    ;;         startpos (reduce (fn [acc [key val]]
+    ;;                            (if (= key field)
+    ;;                              (reduced acc)
+    ;;                              (+ acc (types/size val))))
+    ;;                          0 data)]
+    ;;     ;; Set the buffer position
+    ;;     (buffer/seek buff startpos)
+    ;;     (types/read ftype buff)))))

 (defn associative-dynamic-spec
   [])
@@ -71,7 +75,7 @@
 (defn associative-spec
   [params]
   {:pre [(even? (count params))]}
-  (let [data (partition 2 params)
+  (let [data (mapv vec (partition 2 params))
         dict (into {} data)
         types (map second data)]
     (if (every? #(satisfies? types/IStaticType %) types)


removed obsolete println

removed obsolete println

--- src/selectscript/core.clj
+++ src/selectscript/core.clj
@@ -168,7 +168,6 @@
    (let [env (vm:init 100 100 (if debug 1 0)) prog (vm:prog code)]

      (loop [status 0]
-       (println status)
        (if (= status (:YIELD vm:status_codes))
          (println "YIELD: " (vm:rslt env)))
        (if (< status (:OK vm:status_codes))


We don't want to miss me_messages.

We don't want to miss me_messages.

--- src/yetibot/core/adapters/slack.clj
+++ src/yetibot/core/adapters/slack.clj
@@ -72,24 +72,30 @@
         user-model (users/get-user cs (:user e))]
     (handle-raw cs user-model :leave nil)))

+(defn handle-message [event]
+  ; don't listen to yetibot's own messages
+  (when (not= (:id (self)) (:user event))
+    (let [channel (:channel event)
+          cs (chat-source channel)
+          user-model (users/get-user cs (:user event))]
+      (binding [*target* channel
+                yetibot.core.chat/*messaging-fns* messaging-fns]
+        (handle-raw cs
+                    user-model
+                    :message
+                    (:text event))))))
+
 (defn on-message [event]
   (log/info "message" event)
-  (let [subtype (:subtype event)]
+  (if-let [subtype (:subtype event)]
     ; handle the subtype
     (condp = subtype
       "channel_join" (on-channel-join event)
       "channel_leave" (on-channel-leave event)
-      ; don't listen to yetibot's own messages
-      (when (not= (:id (self)) (:user event))
-        (let [channel (:channel event)
-              cs (chat-source channel)
-              user-model (users/get-user cs (:user event))]
-          (binding [*target* channel
-                    yetibot.core.chat/*messaging-fns* messaging-fns]
-            (handle-raw cs
-                        user-model
-                        :message
-                        (:text event))))))))
+      "me_message" (handle-message event)
+      ; do nothing if we don't understand
+      nil)
+    (handle-message event)))

 (defn on-hello [event]
   (log/info "hello" event))


CMR-6745: refresh granule aggregate cash and make test more thorough (#1293)


formatting long lines

formatting long lines

--- src/braid/client/ui/views/login.cljs
+++ src/braid/client/ui/views/login.cljs
@@ -18,27 +18,30 @@

     (fn [_]
       [:div.login
-       [:form {:on-submit (fn [e]
-                            (.preventDefault e)
-                            (set-error! nil)
-                            (cond
-                              (not (seq (@state :email)))
-                              (set-error! "Please enter an email.")
+       [:form {:on-submit
+               (fn [e]
+                 (.preventDefault e)
+                 (set-error! nil)
+                 (cond
+                   (not (seq (@state :email)))
+                   (set-error! "Please enter an email.")

-                              (not (seq (@state :password)))
-                              (set-error! "Please enter a password.")
+                   (not (seq (@state :password)))
+                   (set-error! "Please enter a password.")

-                              :else
-                              (do
-                                (set-loading! true)
-                                (dispatch! :auth
-                                           {:email (@state :email)
-                                            :password (@state :password)
-                                            :on-complete (fn []
-                                                           (set-loading! false))
-                                            :on-error (fn []
-                                                        (set-loading! false)
-                                                        (set-error! "Incorrect email or password. Please try again."))}))))}
+                   :else
+                   (do
+                     (set-loading! true)
+                     (dispatch! :auth
+                                {:email (@state :email)
+                                 :password (@state :password)
+                                 :on-complete (fn []
+                                                (set-loading! false))
+                                 :on-error
+                                 (fn []
+                                   (set-loading! false)
+                                   (set-error! (str "Incorrect email or password. "
+                                                    " Please try again.")))}))))}

         [:fieldset
          [:label "Email"


limit shrinking to visiting a max of 10k nodes

--- src/simple_check/core.clj
+++ src/simple_check/core.clj
@@ -86,7 +86,7 @@
            total-nodes-visited 0
            depth 0
            can-set-new-best? true]
-      (if (empty? nodes)
+      (if (or (empty? nodes) (>= total-nodes-visited 10000))
         (smallest-shrink total-nodes-visited depth f)
         (let [[head & tail] nodes]
           (if (safe-apply-props prop head)


don't automatically abs all item values

don't automatically abs all item values

--- src/clj/clj_money/import/gnucash.clj
+++ src/clj/clj_money/import/gnucash.clj
@@ -42,7 +42,7 @@

 (defn- parse-decimal
   [string-decimal]
-  (when-let [match (re-find #"(\d+)\/(\d+)" string-decimal)]
+  (when-let [match (re-find #"(-?\d+)\/(\d+)" string-decimal)]
     (with-precision 12
       (apply / (->> match
                     rest
@@ -381,11 +381,27 @@
         (:buy actions)                :purchase
         (:split actions)              :split))))

+(defn- abs
+  [^BigDecimal value]
+  (.abs value))
+
+(defn- abs-items
+  ([transaction]
+   (abs-items transaction (constantly true)))
+  ([transaction pred]
+   (update-in transaction
+              [:items]
+              (fn [items]
+                (map #(if (pred %)
+                        (-> %
+                            (update-in [:quantity] abs)
+                            (update-in [:value] abs))
+                        %)
+                     items)))))
+
 (defmethod ^:private refine-trading-transaction :default
   [transaction]
-  transaction)
-
-(defmethod ^:private refine-trading-transaction :none [t] t)
+  (abs-items transaction))

 (def ^:private trade-actions-map
   {:buy :debit
@@ -404,6 +420,7 @@
                             (filter #(= :buy (:action %)))
                             first)]
     (-> transaction
+        abs-items
         (assoc
           :action :buy
           :shares (:quantity commodity-item)
@@ -417,10 +434,11 @@
                             (filter #(= :sell (:action %)))
                             first)]
     (-> transaction
+        abs-items
         (assoc
           :trade-date (:transaction-date transaction)
           :action :sell
-          :shares (:quantity commodity-item)
+          :shares (.abs (:quantity commodity-item))
           :commodity-account-id (:account-id commodity-item))
         (update-in [:items] adjust-trade-actions))))

@@ -433,6 +451,7 @@
                 (filter #(= :buy (:action %)))
                 first)]
     (-> transaction
+        abs-items
         (assoc :action :transfer
                :shares (:quantity to)
                :value (:value to)
@@ -450,7 +469,8 @@
                :split-date (:transaction-date transaction)
                :shares-gained (:quantity split-item)
                :commodity-account-id (:account-id split-item))
-        (update-in [:items] adjust-trade-actions))))
+        (update-in [:items] adjust-trade-actions)
+        (abs-items #(not= :split (:action %))))))

 (defn- process-transaction-item
   [item]


dummy uid generator added to ws ns just for testing purposes

--- src/clj/hellhound/http/websocket.clj
+++ src/clj/hellhound/http/websocket.clj
@@ -153,10 +153,15 @@
            :response
            @(accept-ws context))))

+(defn get-or-create-user-id
+  [context]
+  ;; A dummy uid generator
+  "somestting")
+
 (defn interceptor-factory
   []
   [{:name ::websocket-user-id-interceptor
-    :enter (get-or-create-user-id)}
+    :enter get-or-create-user-id}

    {:name ::websocket-interceptor
     :enter ws}])


math functions

math functions

--- src/clj/morpheus/query/lang/base.clj
+++ src/clj/morpheus/query/lang/base.clj
@@ -35,6 +35,42 @@
 (defn if- [clause a & [b]]
   (if clause a b))

+(defn power-of-2?- [n]
+  (= 0 (bit-and n (- n 1))))
+
+(defn round- ^double [^double x]
+  (Math/floor (+ 0.5 x)))
+
+(defn round?- [^double x]
+  (= x (Math/floor (+ 0.5 x))))
+
+(defn floor- ^double [^double x]
+  (Math/floor x))
+
+(defn ceil- ^double [^double x]
+  (Math/ceil x))
+
+(defn pow- ^double [^double x ^double y]
+  (Math/pow x y))
+
+(defn exp- ^double [^double x]
+  (Math/exp x))
+
+(defn log- ^double [^double x]
+  (Math/log x))
+
+(defn log10- ^double [^double x]
+  (Math/log10 x))
+
+(defn log1p- ^double [^double x]
+  (Math/log1p x))
+
+(defn sqrt- ^double [^double x]
+  (Math/sqrt x))
+
+(defn abs- ^double [^double x]
+  (Math/abs x))
+
 (def op-mapper
   {'= =
    '< <
@@ -59,5 +95,17 @@
    'and and-
    '|| or-
    '&& and-
-   'if if-})
+   'if if-
+   'power-of-2? power-of-2?-
+   'round round-
+   'round? round?-
+   'floor floor-
+   'ceil ceil-
+   'pow pow-
+   'exp exp-
+   'log log-
+   'log10 log10-
+   'log1p log1p-
+   'sqrt sqrt-
+   'abs abs-})


Convert lesson-type-short-to-long-form to map

Signed-off-by: Pang Yan Han <22594c345857f664c61cd411f607c4d40a9d4af9@gmail.com>

--- src/cljs/cljs_nusmods/timetable.cljs
+++ src/cljs/cljs_nusmods/timetable.cljs
@@ -325,21 +325,20 @@
                                    bgColorCssClass
                                    ModulesMap)))))

-(defn- lesson-type-short-to-long-form
-  "Converts a short form lesson type string into its long form"
-  [lessonTypeShortForm]
-  (cond
-    (= lessonTypeShortForm "DL")  "DESIGN LECTURE"
-    (= lessonTypeShortForm "L")   "LECTURE"
-    (= lessonTypeShortForm "LAB") "LABORATORY"
-    (= lessonTypeShortForm "PL")  "PACKAGED LECTURE"
-    (= lessonTypeShortForm "PT")  "PACKAGED TUTORIAL"
-    (= lessonTypeShortForm "R")   "RECITATION"
-    (= lessonTypeShortForm "SEM") "SEMINAR-STYLE MODULE CLASS"
-    (= lessonTypeShortForm "ST")  "SECTIONAL TEACHING"
-    (= lessonTypeShortForm "T")   "TUTORIAL"
-    (= lessonTypeShortForm "T2")  "TUTORIAL TYPE 2"
-    (= lessonTypeShortForm "T3")  "TUTORIAL TYPE 3"))
+(def ^{:doc     "Converts a short form lesson type string to its long form"
+       :private true}
+  Lesson-Type-Short-To-Long-Form
+  {"DL"  "DESIGN LECTURE",
+   "L"   "LECTURE",
+   "LAB" "LABORATORY",
+   "PL"  "PACKAGED LECTURE",
+   "PT"  "PACKAGED TUTORIAL",
+   "R"   "RECITATION",
+   "SEM" "SEMINAR-STYLE MODULE CLASS",
+   "ST"  "SECTIONAL TEACHING",
+   "T"   "TUTORIAL",
+   "T2"  "TUTORIAL TYPE 2",
+   "T3"  "TUTORIAL TYPE 3"})

 (def ^{:doc     "Converts a long form lesson type string to its short form"
        :private true}
@@ -502,7 +501,7 @@
           (map (fn [matchArray]
                  {:moduleCode  (get-module-code-from-match-array
                                  matchArray)
-                  :lessonType  (lesson-type-short-to-long-form
+                  :lessonType  (Lesson-Type-Short-To-Long-Form
                                  (get-lesson-type-from-match-array matchArray))
                   :lessonGroup (get-lesson-group-from-match-array
                                  matchArray)})


[fix] remove duplicates of :hardwallet/verify-pin event

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

--- src/status_im/events.cljs
+++ src/status_im/events.cljs
@@ -1392,11 +1392,6 @@
    (hardwallet/import-account cofx)))

 (handlers/register-handler-fx
- :hardwallet/verify-pin
- (fn [cofx _]
-   (hardwallet/verify-pin cofx)))
-
-(handlers/register-handler-fx
  :hardwallet/generate-mnemonic
  (fn [cofx _]
    (hardwallet/generate-mnemonic cofx)))
@@ -1442,11 +1437,6 @@
  :hardwallet/unpair
  (fn [cofx _]
    (hardwallet/unpair cofx)))
-
-(handlers/register-handler-fx
- :hardwallet/verify-pin
- (fn [cofx _]
-   (hardwallet/verify-pin cofx)))

 (handlers/register-handler-fx
  :keycard-settings.ui/reset-card-pressed


ufo.ping doesn't use utils project

ufo.ping doesn't use utils project

--- src/clj/ufo/ping.clj
+++ src/clj/ufo/ping.clj
@@ -1,8 +1,7 @@
 (ns ufo.ping
   (:require
    [clojure.java.io :as io]
-   [dk.ative.docjure.spreadsheet :as excl]
-   [utils.core :as ut :refer [in? not-empty? dbgv]]))
+   [dk.ative.docjure.spreadsheet :as excl]))

 (defn timed-ping
   "Time an .isReachable ping to a given domain. Doesn't work for hosts in DMZ


[Add] fun make-double-jarray

[Add] fun make-double-jarray

--- src/clj_elm/core.clj
+++ src/clj_elm/core.clj
@@ -75,6 +75,17 @@
           (coll? xss) (coll? (first xss))]
     :post [(= (count (first %)) (count ass)) (= (count %) (count xss))]}
    (pmap (fn [xs_i] (pmap #(a-hidden-layer-output %1 %2 xs_i) ass bs)) xss)))
+
+(defn make-double-jarray
+  ([array2d]
+   {:pre [(coll? array2d) (coll? (first array2d))]}
+   (let [newmat (Matrix. (make-array Double/TYPE (count array2d) (count (first array2d))))]
+     ;; (dorun (print (format "height %d, width %d\n" (.getRowDimension newmat) (.getColumnDimension newmat))))  ;; for debug
+     (dorun
+      (for [x (range (.getRowDimension newmat))
+            y (range (.getColumnDimension newmat))]
+        (.set newmat x y (nth (nth array2d x) y))))
+     newmat)))

 (defn pseudo-inverse-matrix
   ([mat]


[Fix] doc in model-check

[Fix] doc in model-check

--- src/clj_elm/core.clj
+++ src/clj_elm/core.clj
@@ -243,7 +243,7 @@
           (exp-result)))))

 (defn model-check
-  "At first make model from dataset as a train-dataset, then it validate accuracy of model using dataset as a test-dataset."
+  "At first, make model from dataset as a train-dataset, then it validate accuracy of model using dataset as a test-dataset."
   ([dataset L]
    {:pre [(instance? DataSet dataset) (integer? L)]
     :post [(map? %)]}


Added age-combining-function for multi-parent genetic operators, default = max.

--- src/clojush/args.clj
+++ src/clojush/args.clj
@@ -223,6 +223,10 @@
           ;; The number of extra instances of autoconstructive_boolean_rand to include in
           ;; :atom-generators for autoconstruction. If negative then autoconstructive_boolean_rand
           ;; will not be in :atom-generators at all.
+
+          :age-combining-function max
+          ;; For genetic operators that involve multiple parents, the function used to combine
+          ;; the incremented ages of the parents to produce the age of the child.

           ;;----------------------------------------
           ;; Epignenetics
@@ -556,3 +560,4 @@

+


force :none in dev mode so cljs-devtools doesn't complain

:optimzations is only relevant in release mode but the config
still may set it. this doesn't have any effect other than
making cljs-devtools happy. maybe others check this option
as well.

--- src/main/shadow/build.clj
+++ src/main/shadow/build.clj
@@ -252,6 +252,14 @@

           ;; should do all configuration necessary
           (process-stage :configure true)
+
+          ;; :optimizations is ignored in dev mode
+          ;; but cljs-devtools still reads it from the options and complains
+          ;; when it is not equal to :none
+          ;; so we overwrite whatever configure did since dev/release configs are shared
+          (cond->
+            (= :dev mode)
+            (assoc-in [:compiler-options :optimizations] :none))
           ))))


fix: actually get confd template dumped

fix: actually get confd template dumped

--- src/terraboot/cluster.clj
+++ src/terraboot/cluster.clj
@@ -56,7 +56,8 @@
                   :owner "root"}
                  {:path "/etc/confd/conf.d/ssh-authorized-keys.toml"
                   :content (snippet "system-files/ssh-authorized-keys.toml")}
-                 {:path "/etc/confd/conf.d/ssh-authorized-keys.tmpl"}]})
+                 {:path "/etc/confd/conf.d/ssh-authorized-keys.tmpl"
+                  :content (snippet "system-files/ssh-authorized-keys.tmpl")}]})

 (defn mesos-master-user-data [etcd-token]
   (cloud-config (merge-with (comp vec concat)


Extract random-density and set to 15%

Extract random-density and set to 15%

--- src-cljs/game_of_life/draw.cljs
+++ src-cljs/game_of_life/draw.cljs
@@ -7,6 +7,7 @@

 (def current-run-id (atom 0))
 (def board-update-delay 70)
+(def random-density 0.15)

 (def glider #{[1 1] [1 3] [2 3] [2 2] [3 2]})

@@ -38,7 +39,7 @@

 (defn random-cells []
   "Returns a set of randomly-chosen cells within the board dimensions"
-  (let [number-of-cells (* 0.2 board-width-in-cells board-width-in-cells)
+  (let [number-of-cells (* random-density board-width-in-cells board-width-in-cells)
         random-location-fn (fn [] (repeatedly 2 #(rand-int board-width-in-cells)))]
     (set (repeatedly number-of-cells random-location-fn))))


GR - future-fact'd functional test for voting

--- test/objective8/functional/functional_tests.clj
+++ test/objective8/functional/functional_tests.clj
@@ -143,6 +143,16 @@
                       (throw e)))
                => "Functional test answer")

+         (future-fact "Can vote on an answer"
+               (try (wd/to (:question-url @journey-state))
+                    (wait-for-element "textarea#answer")
+                    (wd/text ".vote-container#count") => "0"
+                    (wd/click ".vote-container#up-vote")
+                    (wd/text ".vote-container#count") => "1"
+                 (catch Exception e
+                   (screenshot "Error-Can-vote-on-an-answer")
+                   (throw e))))
+
          (fact "Can invite a writer"
                (try (wd/to (:objective-url @journey-state))
                     (wait-for-title "Functional test headline | Objective[8]")


(PDB-3302) Add puppetdb-query-function integration test

--- test/puppetlabs/puppetdb/integration/simple.clj
+++ test/puppetlabs/puppetdb/integration/simple.clj
@@ -138,6 +138,10 @@
     (fs/copy+ "test-resources/puppetserver/puppet.conf" "target/puppetserver/master-conf/puppet.conf")
     (fs/mkdirs "target/puppetserver/master-code/environments/production/modules")

+    ;; the puppetdb_query function has to be inside puppet itself to work
+    (fs/copy "puppet/lib/puppet/functions/puppetdb_query.rb"
+             "vendor/puppetserver-gems/gems/puppet-4.9.2/lib/puppet/functions/puppetdb_query.rb")
+
     (fs/create puppetdb-conf)
     (ks/spit-ini puppetdb-conf
                  {:main {:server_urls (->> (for [pdb-info pdb-infos]
@@ -207,3 +211,27 @@
       (run-puppet ps "notify { 'hello, world!': }")
       (is (= 1 (count (pql-query pdb2 "nodes {}")))))))

+(deftest ^:integration puppetdb-query-function
+  (with-open [pg (setup-postgres)
+              pdb (run-puppetdb pg {})
+              ps (run-puppet-server [pdb] {})]
+    (testing "Initial agent run, to populate puppetdb with data to query"
+      (run-puppet ps "notify { 'hello, world!': }"))
+
+    (let [test-out-file "/tmp/test_puppetdb_query.txt"]
+      (testing "Agent run with puppedb_query in the manifest"
+        (when (fs/exists? test-out-file)
+          (fs/delete test-out-file))
+
+        (run-puppet ps (str "node default {"
+                            "  $counts = puppetdb_query(['from', 'catalogs',"
+                            "                            ['extract', [['function', 'count']]]])"
+                            "  $count = $counts[0]['count']"
+                            "  file { '" test-out-file "':"
+                            "        ensure  => present,"
+                            "        content => \"${count}\""
+                            "  }"
+                            "}"))
+
+        (testing "should write the correct catalog count to a temp file"
+          (is (= "1" (slurp "/tmp/test_puppetdb_query.txt"))))))))


start the warehouse job

start the warehouse job

--- src/Miscellaneous/warehouse.clj
+++ src/Miscellaneous/warehouse.clj
@@ -1,4 +1,4 @@
-(ns Miscellaneous.shzh
+(ns Miscellaneous.warehouse
   (:refer-clojure :exclude [sort find])
   (:require [clojure.string :as string]
             [incanter.core :as incanter]
@@ -12,15 +12,46 @@
   (:import [com.mongodb MongoOptions ServerAddress WriteConcern];the following two is for mongo use
            org.bson.types.ObjectId))

-;(mg/connect! {:host "192.168.3.53" :port 7017})
+(mg/connect! {:host "192.168.3.53" :port 7017})

-;(mg/set-db! (mg/get-db "test"))
+(mg/set-db! (mg/get-db "test"))

-;(mc/find-maps "star_baidunews_history")
+(declare extract-text)
+
+(defn integrate-text
+  [& {:as source}]
+  (let [m [:tianya :tieba :weibo :douban :youku]
+        s (set (keys source))
+        job (filter s m)]
+    (mapcat #(extract-text % (get source %)) job)))
+
+(integrate-text :tianya 3 :douban 2 :tieba "star_baidutieba_contents")
+
+(defn extract-text
+  [source-key source-address]
+  (cond (= source-key :tianya) (println "This is tianya")
+        (= source-key :tieba) (mc/find-maps source-address)
+        (= source-key :weibo) (println "This is weibo")
+        (= source-key :douban) (println "This is douban")
+        (= source-key :youku) (println "This is youku")))
+
+(defn extract-tianya
+  [source-address]
+  (let [m (mc/find-maps source-address)])
+  (select-keys)
+  )
+
+
+
+
+
+(mc/find-maps "star_baidutieba_contents")

 #_(with-collection "star_baidunews_history"
   find{})
-(mg/connect!)
-(mg/set-db! (mg/get-db "purui"))
-(pmap #(mc/insert-batch "fulltime" %) (partition-all 50 purui/set6))

+
+
+
+
+


Functions to records requests, job events and job results into database

--- src/emender_service/db_interface.clj
+++ src/emender_service/db_interface.clj
@@ -13,3 +13,44 @@
 (ns emender-service.db-interface
     "Namespace that contains configuration of all JDBC sources.")

+(require '[clojure.java.jdbc       :as jdbc])
+
+(require '[emender-service.db-spec :as db-spec])
+
+
+
+(def date-format
+    (new java.text.SimpleDateFormat "yyyy-MM-dd HH:mm:ss"))
+
+(defn format-date
+    [date]
+    (.format date-format date))
+
+(defn format-current-date
+    []
+    (format-date (new java.util.Date)))
+
+(defn record-request-log
+    [uri ipaddress datetime params useragent]
+    (try
+        (jdbc/insert! db-spec/emender-service-db
+                      :requests {:uri uri :ipaddress ipaddress :datetime datetime :params params :useragent useragent})
+        (catch Exception e
+            (println e))))
+
+(defn record-job-event
+    [job-name datetime operation]
+    (try
+        (jdbc/insert! db-spec/emender-service-db
+                      :jobs {:job job-name :datetime datetime :operation operation})
+        (catch Exception e
+            (println e))))
+
+(defn record-job-results
+    [job-name datetime results]
+    (try
+        (jdbc/insert! db-spec/emender-service-db
+                      :results {:job job-name :datetime datetime :results results})
+        (catch Exception e
+            (println e))))
+


fix typo

fix typo

--- src/babel/espanol/grammar.clj
+++ src/babel/espanol/grammar.clj
@@ -343,7 +343,7 @@
                             :synsem {:cat :verb
                                      :infl {:not :past}}})
                    (unifyc c21
-                           root-is-head
+                           root-is-head-root
                            {:head {:phrasal true
                                    :subcat {:1 :top
                                             :2 :top}}


Make searching only sometimes find traps

--- src/cljc/robinson/update.cljc
+++ src/cljc/robinson/update.cljc
@@ -1712,7 +1712,8 @@

 (defn find-trap
   [state x y]
-  (if (rt/is-trap-type? (rw/get-cell-type state x y))
+  (if (and (rt/is-trap-type? (rw/get-cell-type state x y))
+           (< 1 (rr/uniform-int 10)))
     (rw/assoc-cell state  x y :trap-found true)
     state))


Docstring typo.

Docstring typo.

--- src/clojure/parkour/graph.clj
+++ src/clojure/parkour/graph.clj
@@ -286,7 +286,7 @@
 (defn run-job
   "Run `job` and wait synchronously for it to complete.  Kills the job on
 exceptions or JVM shutdown.  Unlike the `Job#waitForCompletion()` method, does
-not swallowing `InterruptedException`."
+not swallow `InterruptedException`."
   [^Job job]
   (let [interval (conf/get-int job "jobclient.completion.poll.interval" 5000)
         jname (.getJobName job)


pursuing to the rabbit hole using clojure

--- src/clojure_learning/core.clj
+++ src/clojure_learning/core.clj
@@ -184,3 +184,51 @@

 ;; In general, programming to abstractions gives us power by letting us use libraries of functions on a data structure regardless of that data structure's implementation.

+;;; Clojure Programming ;;;
+(read-string "this")
+
+[1 2 3]
+
+(pr " this is multiline
+ string")
+
+(#(+ %1 %2 %3 2) 2 3 4)
+
+(def foo "some foo")
+;(foo "this")
+
+(def foo [12 3 "cc" (re-seq #"a|b|c" "abc")])
+(first foo)
+(last foo) #_ ("a" "b" "c")
+(foo 1) ; 3
+(nth foo 1) ; 3
+(.get foo 0) ; 12
+
+; always read from the most inner expression to the most outer -> simpler to get the job done :)
+
+;; destructuring
+(def foo [1 2 3 "four" (fn [](quote 5) )])
+(let[[one two three] foo] (+ one two three) )
+(let[[one & tail] foo] (+ one ((last tail)) )); (last tail) -> fn; ((last tail)) -> (fn): 6
+
+(def aMap {:a "ei" :b "bi"
+           :names ["cc" "dm"]
+           :age [33 27]})
+(let[ {eis :a bis :b ages :age} aMap]
+  (+ (first ages) (second ages)))    ;; last expression from let is returned
+
+; map using "a" & "b" the value corresponding to index 0 and 1 in a map, and KEEP a reference with ":as" to original vector
+(let[{a 0 b 1 :as orig-foo} foo]
+  (conj orig-foo a b))
+
+(def customer {:name "cclaudiu" :age 33 :location "Titan nr 6"})
+(let[ {:keys [name age location]} customer ]
+  (printf "Customer is: %s; age: %d; address: %s" name age location))
+
+(def user-info ["cclaudiu" 2015 :email "claudiu.cosar@sap.com" :company "sap"])
+; print: cclaudiu works at sap and has the email...
+(let[[id _ & tail] user-info
+     {:keys [email company]} (apply hash-map tail)]
+  (str id "works at " company "and has the email " email))
+
+


Provide explicit root

Provide explicit root

--- src/clojurebyexample/core.clj
+++ src/clojurebyexample/core.clj
@@ -8,7 +8,7 @@
   )

 (defn handler [request]
-  (resource-response "toc.html"))
+  (resource-response "toc.html", {:root "output"}))

 (defn -main [& [port]]
   (let [port (Integer. (or port (env :port) 5000))]


Tweaked key names to be more accurate.

Tweaked key names to be more accurate.

--- src/cmr/http/kit/app/core.clj
+++ src/cmr/http/kit/app/core.clj
@@ -11,7 +11,7 @@
   and API routes defined in configuration.

   An example of the plugin routes would be `CMR-Plugin` and
-  `service-bridge-routes`. These are, respectively, the key and value
+  `service-bridge-app`. These are, respectively, the key and value
   entries in a JAR file's MANIFEST.mf for a dep that has declared itself as
   a plugin. They are supplied in configuration, but determine which routes
   are returned by this function.
@@ -21,14 +21,14 @@
   [httpd-component]
   (let [{plugins-site-routes :site
          plugins-api-routes :api} (registry/assembled-routes httpd-component)
-         site-routes-fn (config/site-routes httpd-component)]
+         main-site-routes-fn (config/site-routes httpd-component)]
     (log/trace "plugins-site-routes:" (vec plugins-site-routes))
     (log/trace "plugins-api-routes:" (vec plugins-api-routes))
-    (log/trace "site-routes-fn:" site-routes-fn)
+    (log/trace "main-site-routes-fn:" main-site-routes-fn)
     ;; Note that the following calls don't call the routes, rather they call
     ;; the configuration function which extract the routes from the config
     ;; data. The route functions provided in the configuration data will be
     ;; called by a middleware wrapper.
-    {:site-routes (concat plugins-site-routes (site-routes-fn httpd-component))
+    {:site-routes (concat plugins-site-routes (main-site-routes-fn httpd-component))
      :plugins-api-routes plugins-api-routes
-     :api-routes-fn (config/api-routes httpd-component)}))
+     :main-api-routes-fn (config/api-routes httpd-component)}))


adds functions for creating and opening pails


Let's go back to 7 posts batch.

Let's go back to 7 posts batch.

--- src/oc/storage/config.clj
+++ src/oc/storage/config.clj
@@ -93,4 +93,4 @@

 (defonce inline-comment-count 10)

-(defonce default-activity-limit 5)+(defonce default-activity-limit 7)


Add some extra comments explaining how Oracle tests work :pencil:


title for collaborator voice request

title for collaborator voice request

--- src-cljs/frontend/components/hud.cljs
+++ src-cljs/frontend/components/hud.cljs
@@ -312,7 +312,7 @@

                     [:a.viewer-toggle {;:on-click #(cast! :recording-toggled)
                                        :role "button"
-                                       :title "Enable your voice chat."
+                                       :title "Request voice chat."
                                        :key (str id-str "-not-recording")}
                      (common/icon :sound-mute)])]])


Undoing last commit... Doesn't work for both synth and defsynth forms.

--- src/overtone/sc/synth.clj
+++ src/overtone/sc/synth.clj
@@ -306,8 +306,6 @@
 (defn- control-proxies
   "Returns a list of param name symbols and control proxies"
   [params]
-  (when (not (even? (count params)))
-    (throw (Exception. "Error: odd number of synth parameters.  Note, synth parameters require default values. (e.g. (synth [freq 440] ...))")))
   (mapcat (fn [param] [(symbol (:name param))
                       `(control-proxy ~(:name param) ~(:default param) ~(:rate param))])
           params))


add rotate-players function

add rotate-players function

--- src/clj/wombats/game/frame/player.clj
+++ src/clj/wombats/game/frame/player.clj
@@ -13,6 +13,14 @@
   "Randomizes player ids"
   [players]
   (shuffle (map #(:_id %) players)))
+
+(defn- rotate-players
+  "rotates last player to front of list"
+  ([players] (rotate-players players 1))
+  ([players n]
+   (let [cv (count players)
+         n (mod n cv)]
+     (concat (subvec players n cv) (subvec players 0 n)))))

 (defn- sort-decisions
   "Sorts player decisions based of of a provided execution-order"


Allow shape entities to coexist with texture entities

--- src/play_clj/entities.clj
+++ src/play_clj/entities.clj
@@ -67,17 +67,21 @@
 (defrecord ShapeEntity [object] Entity
   (draw-entity! [{:keys [^ShapeRenderer object type draw! x y z]}
                  {:keys [^Camera camera]}
-                 _]
+                 batch]
     (let [^Matrix4 m (.getTransformMatrix object)
           x (float (or x 0))
           y (float (or y 0))
           z (float (or z 0))]
       (.setTranslation m x y z))
+    (when batch
+      (.end ^SpriteBatch batch))
     (when camera
       (.setProjectionMatrix object (. camera combined)))
     (.begin object type)
     (draw!)
-    (.end object)))
+    (.end object)
+    (when batch
+      (.begin ^SpriteBatch batch))))

 (defrecord BundleEntity [entities] Entity
   (draw-entity! [{:keys [entities] :as entity} screen batch]


fix build report html title

fix build report html title

--- src/main/shadow/cljs/build_report.clj
+++ src/main/shadow/cljs/build_report.clj
@@ -198,14 +198,14 @@
       {:build-modules modules-info
        :build-sources sources-info})))

-(defn generate-html [build-state bundle-info report-file {:keys [inline] :or {inline true} :as opts}]
+(defn generate-html [build-state {:keys [build-id] :as bundle-info} report-file {:keys [inline] :or {inline true} :as opts}]
   (io/make-parents report-file)
   (spit
     report-file
     (html5
       {}
       [:head
-       [:title (format "[%s] Build Report - shadow-cljs" (name (:shadow.build/build-id build-state)))]
+       [:title (format "[%s] Build Report - shadow-cljs" (name build-id))]
        [:meta {:charset "utf-8"}]]
       [:body
        [:div#root]
@@ -258,7 +258,8 @@
               (build/flush))

           bundle-info
-          (extract-report-data state)
+          (-> (extract-report-data state)
+              (assoc :build-id build-id))

           report-file
           (and (seq report-file) (io/file report-file))


Fixed bug which duplicates best-agree comments

--- src/polismath/repness.clj
+++ src/polismath/repness.clj
@@ -233,8 +233,9 @@
           (if (empty? sufficient)
             best-head
             (->> sufficient
-                 ; Remove best agree if in list, since we'll be putting it in manually
-                 (remove #(= best-agree %))
+                 ; Remove best agree if in list, since we'll be putting it in manually; don't need to do this
+                 ; with best, since in any case we'd let it sort itself out
+                 (remove #(= (:id best-agree) (:id %)))
                  (repness-sort) ; sort by our complicated repness metric
                  (concat (if best-agree [best-agree] [])) ; put best agree at front, if possible
                  (take 5) ; take the top 5


Added "Component hierarchy of a Popover" to the Popover Reference page

--- src/re_demo/popovers.cljs
+++ src/re_demo/popovers.cljs
@@ -6,7 +6,7 @@
             [re-com.popover              :refer [popover-content-wrapper-args-desc popover-anchor-wrapper-args-desc popover-border-args-desc
                                                  popover-tooltip-args-desc]]
             [re-demo.popover-dialog-demo :as    popover-dialog-demo]
-            [re-com.util                 :refer [get-element-by-id]]
+            [re-com.util                 :refer [get-element-by-id px]]
             [re-demo.utils               :refer [panel-title title2 args-table github-hyperlink status-text scroll-to-top]]
             [reagent.core                :as    reagent]))

@@ -41,6 +41,92 @@
    " page."])

+(defn popover-component-hierarchy
+  []
+  (let [indent          20
+        table-style     {:style {:border "2px solid lightgrey" :margin-right "10px"}}
+        border          {:border "1px solid lightgrey" :padding "6px 12px"}
+        border-style    {:style border}
+        border-style-nw {:style (merge border {:white-space "nowrap"})}
+        valign          {:vertical-align "top"}
+        valign-style    {:style valign}
+        valign-style-hd {:style (merge valign {:background-color "#e8e8e8"})}
+        indent-text     (fn [level text] [:span {:style {:padding-left (px (* level indent))}} text])
+        highlight-text  (fn [text & [color]] [:span {:style {:font-weight "bold" :color (or color "dodgerblue")}} text])
+        code-text       (fn [text] [:span {:style {:font-size "smaller" :line-height "150%"}} " " [:code {:style {:white-space "nowrap"}} text]])]
+    [v-box
+     :gap      "10px"
+     :children [[title2 "Component hierarchy of a Popover"]
+                [p "A single popover is made up of several sub-components (some being optional based on the arguments provided).
+                The following table shows how these components are arranged (in the form of a component tree).
+                Those highlighted in blue are the public API components."]
+                [:table table-style
+                 [:thead valign-style-hd
+                  [:tr
+                   [:th border-style-nw "Component"]
+                   [:th border-style-nw "Naming class"]
+                   [:th border-style "Key inline styles"]
+                   [:th border-style "Notes"]]]
+                 [:tbody valign-style
+                  [:tr
+                   [:td border-style-nw (indent-text 0 (highlight-text "[popover-anchor-wrapper]"))]
+                   [:td border-style-nw "rc-popover-anchor-wrapper"]
+                   [:td border-style (code-text ":display \"inline-flex\"") (code-text ":flex \"inherit\"")]
+                   [:td border-style "Outer wrapper of the anchor, popover, backdrop, everything."]]
+                  [:tr
+                   [:td border-style-nw (indent-text 1 "[:div]")]
+                   [:td border-style-nw "rc-point-wrapper"]
+                   [:td border-style (code-text ":display \"inline-flex\"") (code-text ":flex \"auto\"") (code-text ":flex-flow \"row/col\"") (code-text ":align-items \"center\"")]
+                   [:td border-style "Wraps the anchor component and the popover-point (which the actual popover points to)."]]
+                  [:tr
+                   [:td border-style-nw (indent-text 2 (highlight-text "[:anchor arg component]"))]
+                   [:td border-style-nw "n/a"]
+                   [:td border-style "n/a"]
+                   [:td border-style "The " (code-text ":anchor") " arg of [popover-anchor-wrapper] is placed here. Could be before or after popover-point based on " (code-text ":position") " arg."]]
+                  [:tr
+                   [:td border-style-nw (indent-text 2 "[:div]")]
+                   [:td border-style-nw "rc-popover-point"]
+                   [:td border-style (code-text ":display \"inline-flex\"") (code-text ":flex \"auto\"") (code-text ":position \"relative\"") (code-text ":z-index 4")]
+                   [:td border-style "The point (width/height 0) which is placed at the center of the relevant side of the anchor, based on " (code-text ":position") " arg."]]
+                  [:tr
+                   [:td border-style-nw (indent-text 3 (highlight-text "[:popover arg component]"))]
+                   [:td border-style-nw "popover-content-wrapper"]
+                   [:td border-style (code-text ":display \"block\"") (code-text ":flex \"inherit\"") (code-text ":position \"fixed\" (when no-clip?)")]
+                   [:td border-style [:span "The " (code-text ":popover") " arg of [popover-anchor-wrapper] is placed here. It should be a [popover-content-wrapper] which wraps the actual content of the popover (specified as " (code-text ":body") " arg below) and the backdrop if required."]]]
+                  [:tr
+                   [:td border-style-nw (indent-text 4 "[backdrop]")]
+                   [:td border-style-nw "rc-backdrop"]
+                   [:td border-style (code-text ":display \"block\"") (code-text ":position \"fixed\"") ]
+                   [:td border-style "The (semi-)transparent backdrop between the popover and the rest of the screen. Calls " (code-text ":on-cancel") " when backdrop is clicked. Optional based on " (code-text ":on-cancel") " arg being set."]]
+                  [:tr
+                   [:td border-style-nw (indent-text 4 "[popover-border]")]
+                   [:td border-style-nw "popover"]
+                   [:td border-style (code-text ":display \"block\"") (code-text ":position \"absolute\"") (code-text ":left/right/top/bottom \"##px\"")]
+                   [:td border-style "Wraps the content of the popover (and title and arrow). Includes the rounded white border and background. Assigned an " (code-text ":id") " of \"popover-###\". "]]
+                  [:tr
+                   [:td border-style-nw (indent-text 5 "[popover-arrow]")]
+                   [:td border-style-nw "popover-arrow"]
+                   [:td border-style (code-text ":display \"block\"") (code-text ":position \"absolute\"") (code-text ":left/right/top/bottom \"##px\"")]
+                   [:td border-style "SVG component."]]
+                  [:tr
+                   [:td border-style-nw (indent-text 5 "[popover-title]")]
+                   [:td border-style-nw "popover-title"]
+                   [:td border-style (code-text ":display \"block\"") (code-text ":flex \"inherit\"")]
+                   [:td border-style "Optional based on " (code-text ":title") " arg. Adds a close button if " (code-text ":on-cancel") " arg is set."]]
+                  [:tr
+                   [:td border-style-nw (indent-text 5 "[:div]")]
+                   [:td border-style-nw "popover-content"]
+                   [:td border-style ""]
+                   [:td border-style "Exists to override the default popover padding."]]
+                  [:tr
+                   [:td border-style-nw (indent-text 6 (highlight-text "[:body arg component]"))]
+                   [:td border-style-nw "n/a"]
+                   [:td border-style "n/a"]
+                   [:td border-style "The " (code-text ":body") " arg of [popover-content-wrapper] is placed here."]]]]
+                [gap :size "0px"]
+                [p "Following are several tables detailing the popover public API..."]]]))
+
+
 (defn arg-lists
   []
   [v-box
@@ -50,6 +136,7 @@
                             "src/re_com/popover.cljs"
                             "src/re_demo/popovers.cljs"]

+              [popover-component-hierarchy]
               [h-box
                :gap      "100px"
                :children [[v-box


Require ? only at the long option name for a command line flag

--- src/de/kotka/gorilla/util.clj
+++ src/de/kotka/gorilla/util.clj
@@ -82,16 +82,11 @@
         (reduce (fn [[opts sopts] spec]
                   (let [lopt  (name (first spec))
                         sopt  (second spec)
+                        sopt  (if (symbol? sopt) (name sopt) nil)
                         [lopt sopt type]
                         (if (.endsWith lopt "?")
-                          [(str-cut lopt 1)
-                           (if (symbol? (second spec))
-                             (-> sopt name (str-cut 1))
-                             nil)
-                           :flag]
-                          [lopt
-                           (if (symbol? sopt) (name sopt) nil)
-                           :option])]
+                          [(str-cut lopt 1) sopt :flag]
+                          [lopt             sopt :option])]
                     (vector (assoc opts lopt type)
                             (assoc sopts sopt lopt))))
                 [{} {}]


CMR-2482: Took out tag and tag-association from the cleanup old revisions job due to force delete issue.

--- metadata-db-app/src/cmr/metadata_db/services/jobs.clj
+++ metadata-db-app/src/cmr/metadata_db/services/jobs.clj
@@ -30,8 +30,6 @@
     (concept-service/delete-old-revisions context provider :collection)
     (concept-service/delete-old-revisions context provider :granule)
     (concept-service/delete-old-revisions context provider :service)
-    (concept-service/delete-old-revisions context provider :tag)
-    (concept-service/delete-old-revisions context provider :tag-association)
     (concept-service/delete-old-revisions context provider :access-group)))

 (def-stateful-job OldRevisionConceptCleanupJob


whitespace

whitespace

--- src/babel/francais/lexicon.cljc
+++ src/babel/francais/lexicon.cljc
@@ -32,8 +32,7 @@
                            :subj {:human true}}}}
    "ajouter" {:synsem {:cat :verb
                      :sem {:pred :add}}}
-
-
+
    "aller" {:français {:future-stem "ir"
                        :present {:1sing "vais"
                                  :2sing "vas"


map against all defaults

map against all defaults

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -673,31 +673,32 @@
   (log/debug (str "tense  (pre): " (strip-refs (get-in tree
                                                        [:synsem :sem :tense]
                                                        ::unset))))
-  (let [result
-        (-> tree
-            (apply-default-if
-             verb-default?
-             {:synsem {:cat :verb
-                       :sem {:tense :present
-                             :aspect :simple}
-                       :infl :present}})
-            (apply-default-if
-             verb-default?
-             {:synsem {:cat :verb
-                       :sem {:tense :present
-                             :aspect :progressive}
-                       :infl :present-progressive}})
-            (apply-default-if
-             verb-default?
-             {:synsem {:cat :verb
-                       :sem {:tense :future}
-                       :infl :future}})
-            (apply-default-if
-             verb-default?
-             {:synsem {:cat :verb
-                       :sem {:tense :conditional}
-                       :infl :conditional}}))]
-    [result]))
+  (let [defaults
+        [{:synsem {:cat :verb
+                   :sem {:tense :present
+                         :aspect :simple}
+                   :infl :present}}
+         {:synsem {:cat :verb
+                   :sem {:tense :present
+                         :aspect :progressive}
+                   :infl :present-progressive}}
+         {:synsem {:cat :verb
+                   :sem {:tense :future}
+                   :infl :future}}
+         {:synsem {:cat :verb
+                   :sem {:tense :conditional}
+                   :infl :conditional}}]]
+    (let [with-defaults
+          (remove #(= :fail %)
+                  (map (fn [default]
+                         (unify tree default))
+                       defaults))]
+      (if (empty? with-defaults)
+        (do
+          (log/warn (str "all defaults failed."))
+          [tree])
+        with-defaults))))
+

 (defn medium []
   (deliver-lexicon)


+:rules; :rule-map

+:rules; :rule-map

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -451,7 +451,8 @@
               (for [[k v] lexicon]
                 (let [filtered-v v]
                   (if (not (empty? filtered-v))
-                    [k filtered-v]))))]
+                    [k filtered-v]))))
+        rules (map #(keyword (get-in % [:rule])) grammar)]
     {:name "medium"
      :language "it"
      :language-keyword :italiano
@@ -460,6 +461,9 @@
                (analyze arg lexicon))
      :enrich enrich
      :grammar grammar
+     :rules rules
+     :rule-map (zipmap rules
+                       grammar)
      :lexicon lexicon
      :index (create-index grammar (flatten (vals lexicon)) head-principle)
      }))


everything zipperized

everything zipperized

--- src/bracketolojy/tournament.clj
+++ src/bracketolojy/tournament.clj
@@ -150,42 +150,32 @@
        (compute-matchup pick-pts-fn upset-pts-fn)
        zip/root))

-(defn- update-child-expected-value
-  "Update the expected value of each team in the field using parent-team-map.  The expected value for each team in the
-  field is the team's average points plus the expected value of the team in the parent-team-map."
-  [parent-team-map node]
-  (update-in
-    node
-    [:data :teams]
-    (partial
-      map
-      #(update-in % [:expected-value] (fnil + 0 0)
-                  (get-in parent-team-map [(:name %) :expected-value])
-                  (:avg-pts %)))))
-
 (defn- update-expected-value
-  "For each child in children, update the expected value of the teams in that child's field.  The expected value for each team
-  in a field is the team's average points plus the expected value of the team in the parent field."
-  [node]
-  (let [parent-team-map (->> (get-in node [:data :teams])
-                             (map #((juxt :name identity) %))
-                             (into {}))]
-    (if (branch? node)
-      (-> (update-in node [:upper] (partial update-child-expected-value parent-team-map))
-          (update-in [:lower] (partial update-child-expected-value parent-team-map)))
-      node)))
+  [parent-node node]
+  (let [parent-team-map (some->> (get-in parent-node [:data :teams])
+                                 (map #((juxt :name identity) %))
+                                 (into {}))]
+    (update-in
+      node
+      [:data :teams]
+      (partial
+        map
+        #(update-in % [:expected-value] (fnil + 0 0)
+                    (get-in parent-team-map [(:name %) :expected-value])
+                    (:avg-pts %))))))

 (defn- compute-expected-value-helper
   "Recursively traverse the zipper, updating each node with the expected value computation."
   [loc]
   (if (zip/end? loc)
     loc
-    (recur (zip/next (zip/edit loc update-expected-value)))))
+    (let [parent-node (some-> (zip/up loc) zip/node)]
+      (recur (zip/next (zip/edit loc (partial update-expected-value parent-node)))))))

 (defn compute-expected-value
   "Compute the expected value for each node in the tournament probabilites tree."
   [tp]
-  (->> (update-child-expected-value nil tp)
+  (->> tp
        (zip/zipper
          branch?
          children


api refacto

api refacto

--- src/ca_recipe/components/ke.clj
+++ src/ca_recipe/components/ke.clj
@@ -1,13 +1,28 @@
 (ns ca-recepie.components.ke)

-;; read
-(defn get-rules [ke])
-(defn find-rules [ke criterial])
+(defprotocol KE
+  (get-rules [ke] "Get full rule set")
+  (transform-rules [ke update-fn]
+                   "Apply transformation function to rule set. Return new KE")
+  (fire-rules [ke request]
+              "Fire the rules against the request and return a response"))

-;;update
-(defn add-rule [ke rule])
-(defn replace-rule [ke old-rule new-role])
-(defn delete-rule [ke rule])
+;; private functions
+(defn- transform-criteria [criteria])

-;;processing
-(defn fire-rules [ke request])
+;; api build over the protocol
+(defn find-rules
+  [ke criteria]
+  (filter (transform-criteria criteria) (get-rules ke)))
+
+(defn add-rule
+  [ke rule]
+  (transform-rules ke #(conj % rule)))
+
+(defn replace-rule
+  [ke old-rule new-rule]
+  (transform-rules ke #(-> % (disj old-rule) (conj new-rule))))
+
+(defn delete-rule
+  [ke rule]
+  (tranform-rules ke #(-> % (disj rule))))


Exercise 1.14

Exercise 1.14


Add another implementation to Exercise 3.50

--- src/sicp/chapter3/5_1.clj
+++ src/sicp/chapter3/5_1.clj
@@ -13,6 +13,12 @@
       (apply proc (map first argstreams))
       (apply stream-map
              (cons proc (map rest argstreams)))))))
+
+(defn stream-map' [proc & argstreams]
+  (lazy-seq
+   (when (seq (first argstreams))
+     (cons (apply proc (map first argstreams))
+           (apply stream-map' proc (map rest argstreams))))))

 ;; Exercise 3.51
 (defn show [x]


simplified sleep logic in requester.

simplified sleep logic in requester.

--- src/fowles/requester.clj
+++ src/fowles/requester.clj
@@ -8,31 +8,30 @@

 (defn- sleep-or-get
   [from-ch to-ch sleep-ch]
-  (loop [i 0
-         just-slept? true]
+  (loop [i 0]

     (if (= i 5)
       ;; We always sleep after every 5 requests.
       (do
         (Thread/sleep 500)
-        (recur 0 true))
+        (recur 0))

       ;; Perhaps sleep, perhaps request.
       (alt!!
        ;; The gatherer tells you to sleep.
        ;; Oblige only if didn't just do it.
-       sleep-ch ([_] (if-not just-slept?
+       sleep-ch ([_] (if (> i 0)
                        (do
                          (println " ---- SLEEPING ----")
                          (Thread/sleep 1000)))
-                   (recur (if just-slept? i 0) true))
+                   (recur 0))

        ;; Grab a URI and do an async-get.  (Don't close.)
        from-ch  ([uri] (if (nil? uri)
-                         (recur i just-slept?)
+                         (recur i)
                          (do
                            (async-get uri to-ch)
-                           (recur (inc i) false))))
+                           (recur (inc i)))))

        :priority true))))


Fix test

Fix test

--- test/yada/schema_test.clj
+++ test/yada/schema_test.clj
@@ -243,7 +243,7 @@
   (testing "no methods, just a response"
     (let [r (resource-coercer {:response "Hello"})]
       (is (not (error? r)))
-      (is (nil? (s/check Methods r)))
+      (is (nil? (s/check Methods (select-keys r [:methods]))))
       (let [f (get-in r [:methods :get :response])]
         (is (= "Hello" (f nil))))))


Add failed media upload error message and url to help site

--- src/hatti/constants.cljs
+++ src/hatti/constants.cljs
@@ -41,3 +41,14 @@
 (def hexbin-cell-width 60)
 (def min-count-color "#f2f5fc")
 (def max-count-color "#08519c")
+
+(def failed-media-upload-error-message
+  "This media file was not uploaded successfully.")
+
+(def failed-media-upload-help-url
+  "knowledge-base/#")
+
+(defn help-base-url
+  "Define a help URL"
+  [suffix]
+  (str "http://help.ona.io/" suffix))


small bug fix

small bug fix

--- src/kondolisp/serial.clj
+++ src/kondolisp/serial.clj
@@ -20,7 +20,7 @@

 (defn set-serial-config [config]
   (dosync
-   (ref-set *serial-config* (merge config *serial-config*))))
+   (ref-set *serial-config* (merge config @*serial-config*))))

 (defn open-serial []
   (let [serial-config @*serial-config*,


Use getFullPathIndex to list wejars assets

listAssets calls getFullPathIndex and filters the values. Calling
getFullPathIndex directly avoids filtering.

--- src/less4clj/webjars.clj
+++ src/less4clj/webjars.clj
@@ -13,7 +13,7 @@
   "Create map of asset path to classpath resource url. Asset path is
   the resource url without webjars part."
   []
-  (->> (.listAssets (WebJarAssetLocator.) "")
+  (->> (vals (.getFullPathIndex (WebJarAssetLocator.)))
        (map (juxt asset-path identity))
        (into {})))


Added function for opening a file chooser dialog.

--- src/fm/simrunner/gui/core.clj
+++ src/fm/simrunner/gui/core.clj
@@ -4,14 +4,16 @@
   "GUI Utilities"

     :author "Frank Mosebach"}
-  (:import
+  (:import
+    (java.io File)
     (java.awt BorderLayout)
     (javax.swing SwingUtilities
                  JFrame
                  JPanel
                  JButton
                  JTextField
-                 JCheckBox)))
+                 JCheckBox
+                 JFileChooser)))

 (defn gui-exec [task]
   (let [promise (promise)]
@@ -84,3 +86,20 @@
         (.setLayout (BorderLayout.)))
     (make-widget :frame frame)))

+(def ^{:private true} default-approve-opts {:text "Ok" :tooltip-text "Ok"})
+
+(defn choose-file
+  [parent & {:keys [title directory approve-opts filters]
+             :or   {title "Choose File" directory (File. ".")}}]
+  (let [{:keys [text tooltip-text]} (merge approve-opts default-approve-opts)
+        file-chooser (doto (JFileChooser. directory)
+                           (.setFileSelectionMode JFileChooser/FILES_ONLY)
+                           (.setMultiSelectionEnabled false)
+                           (.setAcceptAllFileFilterUsed true)
+                           (.setDialogTitle title)
+                           (.setApproveButtonText text)
+                           (.setApproveButtonToolTipText tooltip-text))]
+    (when (= JFileChooser/APPROVE_OPTION
+             (.showDialog file-chooser parent text))
+      (.getSelectedFile file-chooser))))
+