fix exports

fix exports

--- src/clj/ceres/collector.clj
+++ src/clj/ceres/collector.clj
@@ -42,11 +42,19 @@
   []
   (do
     (mc/ensure-index @db "articles" (array-map :ts 1))
-    (mc/ensure-index @db "origins" (array-map :ts 1 :source 1 :tweet 1))
-    (mc/ensure-index @db "published" (array-map :tweet 1 :user 1 :ts 1 :url 1))
-    (mc/ensure-index @db "reactions" (array-map :source 1 :tweet 1))
+    (mc/ensure-index @db "origins" (array-map :ts 1))
+    (mc/ensure-index @db "origins" (array-map :source 1))
+    (mc/ensure-index @db "origins" (array-map :tweet 1))
+    (mc/ensure-index @db "publications" (array-map :tweet 1))
+    (mc/ensure-index @db "publications" (array-map :user 1))
+    (mc/ensure-index @db "publications" (array-map :ts 1))
+    (mc/ensure-index @db "publications" (array-map :url 1))
+    (mc/ensure-index @db "reactions" (array-map :source 1))
+    (mc/ensure-index @db "reactions" (array-map :publication 1))
     (mc/ensure-index @db "urls" (array-map :url 1))
     (mc/ensure-index @db "hashtags" (array-map :text 1))
+    (mc/ensure-index @db "mentions" (array-map :user 1))
+    (mc/ensure-index @db "mentions" (array-map :publication 1))
     (mc/ensure-index @db "users" (array-map :id 1))
     (mc/ensure-index @db "tweets" (array-map :user.screen_name 1))
     (mc/ensure-index @db "tweets" (array-map :id_str 1))
@@ -179,10 +187,10 @@
     :date date}))

-(defn store-published [uid tid url-id type hids ts]
+(defn store-publications [uid tid url-id type hids ts]
   (mc/insert-and-return
    @db
-   "published"
+   "publications"
    {:user uid
     :tweet tid
     :url url-id
@@ -320,7 +328,7 @@
              (take 10)
              (pmap get-url-id)
              #_(pmap #(let [url-id (get-url-id %)]
-                        (store-published (get-uid %)
+                        (store-publications (get-uid %)
                                          (:_id %)
                                          url-id
                                          (get-type % url-id)
@@ -354,6 +362,7 @@
         (->> tweets
              (pmap extract-hashtags)
              flatten
+             (remove nil?)
              (into #{})
              (pmap store-hashtag))))))

@@ -366,84 +375,73 @@
                 (if-not (empty? (:urls entities))
                   :source
                   :unrelated))))
-          (transact-published [{:keys [user _id entities created_at] :as tweet}]
+          (transact-publications [{:keys [user _id entities created_at] :as tweet}]
             (let [uid (:_id (mc/find-one-as-map @db "users" {:id (:id user)}))
                   url-id (if-not (empty? (:urls entities))
                            (:_id (mc/find-one-as-map @db "urls" (:tweet _id)))
                            nil)
                   hids (if-not (empty? (:hashtags entities))
                          (->> (:hashtags entities)
-                              (pmap #(:_id (mc/find-one-as-map @db "hashtags" (:text (:text %)))))
+                              (pmap #(:_id (mc/find-one-as-map @db "hashtags" {:text (:text %)})))
                               (into #{})
                               vec)
                          nil)
                   t-type (dispatch-type tweet)]
-              (store-published uid _id url-id t-type hids created_at)))]
+              (store-publications uid _id url-id t-type hids created_at)))]
     (let [tweets (mc/find-maps @db "tweets"
                                {:created_at {$gt (t/date-time 2014 8 1)
                                              $lt (t/date-time 2014 9 1)}
                                 :user.screen_name {$in news-accounts}})]
       (time
        (doall
-        (pmap transact-published tweets)))))
+        (pmap transact-publications tweets)))))

   ;; export retweets
-  (letfn [(transact-published [{:keys [user _id created_at entities id_str retweeted_status] :as tweet}]
+  (letfn [(transact-publications [{:keys [user _id created_at entities id_str retweeted_status] :as tweet}]
             (let [uid (:_id (mc/find-one-as-map @db "users" {:id (:id user)}))
                   hids (if-not (empty? (:hashtags entities))
                          (->> (:hashtags entities)
-                              (pmap #(:_id (mc/find-one-as-map @db "hashtags" (:text (:text %)))))
+                              (pmap #(:_id (mc/find-one-as-map @db "hashtags" {:text (:text %)})))
                               (into #{})
                               vec)
-                         nil)
-                  user-mentions (if-not (empty (:user_mentions entities))
-                                  (->> (:user_mentions entities)
-                                       (pmap #(:_id (mc/find-one-as-map @db "users" {:id (:id %)}))))
-                                  #{})
-                  pub-id (store-published uid _id nil :retweet hids created_at)]
-              (doall (pmap #(when-not (nil? %) (store-mention % pub-id)) user-mentions))))]
+                         nil)]
+              (store-publications uid _id nil :retweet hids created_at)))]
     (let [retweets (mc/find-maps @db "tweets" {:created_at {$gt (t/date-time 2014 8 1)
                                                             $lt (t/date-time 2014 9 1)}
                                                :retweeted_status {$ne nil}
                                                :user.screen_name {$nin news-accounts}})]
-      (time (doall (pmap transact-published retweets)))))
+      (time (doall (pmap transact-publications retweets)))))

   ;; export replies
-  (letfn [(transact-published [{:keys [user _id created_at entities id_str in_reply_to_status_id_str] :as tweet}]
+  (letfn [(transact-publications [{:keys [user _id created_at entities id_str in_reply_to_status_id_str] :as tweet}]
             (let [uid (:_id (mc/find-one-as-map @db "users" {:id (:id user)}))
                   hids (if-not (empty? (:hashtags entities))
                          (->> (:hashtags entities)
-                              (pmap #(:_id (mc/find-one-as-map @db "hashtags" (:text (:text %)))))
+                              (pmap #(:_id (mc/find-one-as-map @db "hashtags" {:text (:text %)})))
                               (into #{})
                               vec)
-                         nil)
-                  user-mentions (if-not (empty (:user_mentions entities))
-                                  (->> (:user_mentions entities)
-                                       (pmap #(:_id (mc/find-one-as-map @db "users" {:id (:id %)}))))
-                                  #{})
-                  pub-id (store-published uid _id nil :reply hids created_at)
-                  source-tid (:_id (mc/find-one-as-map @db "published" {:tweet (:_id (mc/find-one-as-map @db "tweets" {:id_str in_reply_to_status_id_str}))}))]
-              (doall (pmap #(when-not (nil? %) (store-mention % pub-id)) user-mentions))))]
+                         nil)]
+              (store-publications uid _id nil :reply hids created_at)))]
     (let [retweets (mc/find-maps @db "tweets" {:created_at {$gt (t/date-time 2014 8 1)
                                                             $lt (t/date-time 2014 9 1)}
                                                :in_reply_to_status_id_str {$ne nil}
                                                :user.screen_name {$nin news-accounts}})]
-      (time (doall (pmap transact-published retweets)))))
+      (time (doall (pmap transact-publications retweets)))))

   ;; export shares
-  (letfn [(transact-published [{:keys [user _id created_at entities id_str in_reply_to_status_id_str] :as tweet}]
+  (letfn [(transact-publications [{:keys [user _id created_at entities id_str in_reply_to_status_id_str] :as tweet}]
             (let [uid (:_id (mc/find-one-as-map @db "users" {:id (:id user)}))
                   hids (if-not (empty? (:hashtags entities))
                          (->> (:hashtags entities)
-                              (pmap #(:_id (mc/find-one-as-map @db "hashtags" (:text (:text %)))))
+                              (pmap #(:_id (mc/find-one-as-map @db "hashtags" {:text (:text %)})))
                               (into #{})
                               vec)
                          nil)]
-              (store-published uid _id nil :share hids created_at)))]
+              (store-publications uid _id nil :share hids created_at)))]
     (time
      (doall
       (->> (mc/find-maps @db "origins" {:source nil
@@ -456,7 +454,7 @@
                      :no-share
                      tweet)))
            (remove #{:no-share})
-           (pmap transact-published)))))
+           (pmap transact-publications)))))

   ;; retweet reactions
@@ -467,10 +465,10 @@
       (pmap (fn [{:keys [tweet _id]}]
              (let [{{:keys [id_str]} :retweeted_status} (mc/find-map-by-id @db "tweets" tweet)
                    {stid :_id} (mc/find-one-as-map @db "tweets" {:id_str id_str})
-                   {spid :_id} (if stid (mc/find-one-as-map @db "published" {:tweet stid})
+                   {spid :_id} (if stid (mc/find-one-as-map @db "publications" {:tweet stid})
                                    nil)]
                (store-reaction _id spid)))
-           (mc/find-maps @db "published" {:type :retweet})))
+           (mc/find-maps @db "publications" {:type :retweet})))
      (say/say "Computation completed!")))

@@ -482,10 +480,10 @@
       (pmap (fn [{:keys [tweet _id]}]
              (let [{:keys [in_reply_to_status_id_str]} (mc/find-map-by-id @db "tweets" tweet)
                    {stid :_id} (mc/find-one-as-map @db "tweets" {:id_str in_reply_to_status_id_str})
-                   {spid :_id} (if stid (mc/find-one-as-map @db "published" {:tweet stid})
+                   {spid :_id} (if stid (mc/find-one-as-map @db "publications" {:tweet stid})
                                    nil)]
                (store-reaction _id spid)))
-           (mc/find-maps @db "published" {:type :reply})))
+           (mc/find-maps @db "publications" {:type :reply})))
      (say/say "Computation completed")))

@@ -493,19 +491,19 @@
   (time
    (do
      (say/say "Computation started")
-     (aprint
-      (reduce +
-              (pmap
-               (fn [{:keys [tweet _id]}]
-                 (let [{aid :article} (mc/find-one-as-map @db "origins" {:tweet tweet})
-                       {source-tweet :tweet} (mc/find-one-as-map @db "origins" {:article aid :source {$ne nil}})]
-                   (if source-tweet
-                     1
-                     0)))
-               (mc/find-maps @db "published" {:type :share}))))
+     (doall
+      (pmap
+       (fn [{:keys [tweet _id]}]
+         (let [{aid :article} (mc/find-one-as-map @db "origins" {:tweet tweet})
+               {source-tweet :tweet} (mc/find-one-as-map @db "origins" {:article aid :source {$ne nil}})]
+           (if source-tweet
+             (store-reaction _id source-tweet)
+             nil)))
+       (mc/find-maps @db "publications" {:type :share})))
      (say/say "Computation completed")))

+  ;; store mentions
   (time
    (doall
     (pmap
@@ -518,7 +516,17 @@
                 (store-mention uid _id)
                 nil)))
           user_mentions)))
-     (mc/find-maps @db "published"))))
+     (mc/find-maps @db "publications"))))
+
+
+  (->> (mc/find-maps @db "publications")
+       (map :hashtags)
+       flatten
+       (into #{})
+       second
+       (mc/find-map-by-id @db "hashtags")
+       aprint)
+


line / col data may not correspond to the generated line / col - that we can't assume ordering. made required changes for generating lines. previous segment logic incorrect now - we actually need a second pass.

--- src/clj/cljs/source_map.clj
+++ src/clj/cljs/source_map.clj
@@ -102,17 +102,19 @@
       (let [info (first infos)
             [segv state] (info->segv info state)
             prev-info (:prev-info state)
+            gline (:gline info)
             relsegv (if prev-info
                       (let [prev-segv (prev-info->segv prev-info)]
-                        (if (not= (:gline info) (:gline prev-info))
+                        (if (not= gline (:gline prev-info))
                           (into [(first segv)] (map - (rest segv) (rest prev-segv)))
                           (into [] (map - segv prev-segv))))
                       segv)]
         (recur (next infos)
           (let [lines (:lines state)
-                lines (if (and prev-info (not= (:gline info) (:gline prev-info)))
-                        (conj lines [(base64-vlq/encode relsegv)])
-                        (conj (pop lines) (conj (peek lines) (base64-vlq/encode relsegv))))]
+                lc    (count lines)
+                lines (if (> gline (dec lc))
+                        (conj (into lines (repeat (dec (- gline (dec lc))) [])) [(base64-vlq/encode relsegv)])
+                        (update-in lines [gline] conj (base64-vlq/encode relsegv)))]
             (-> state
                 (assoc :lines lines)
                 (assoc :prev-info


damage function support for Titanium Ribs

--- src/clj/game/core-rules.clj
+++ src/clj/game/core-rules.clj
@@ -110,7 +110,7 @@
   [state side type n {:keys [unpreventable unboostable card] :as args}]
   (swap! state update-in [:damage :defer-damage] dissoc type)
   (trigger-event state side :pre-resolve-damage type card n)
-  (when-not (get-in @state [:damage :damage-replace])
+  (when-not (or (get-in @state [:damage :damage-replace]) (get-in @state [:damage :damage-choose]))
     (let [n (if (get-defer-damage state side type args) 0 n)]
       (let [hand (get-in @state [:runner :hand])]
         (when (< (count hand) n)


fix item key pruning regression

fix item key pruning regression

--- src/cljs_api_gen/result.clj
+++ src/cljs_api_gen/result.clj
@@ -69,7 +69,7 @@
       :name-encode name-encoded)))

 (defn cached-item
-  "After parsing, we "
+  "Data that we should cache from this parsed item."
   [x]
   (-> x
       (select-keys [:ns
@@ -403,22 +403,22 @@
   to change extra details without parsing every version again."
   [item]
   (let [docfile (*docfiles* (:full-name item))
-        docfile-data (prune-map (select-keys docfile
-                                 [:examples
-                                  :known-as
-                                  :display-as
-                                  :summary
-                                  :summary-compiler
-                                  :details
-                                  :details-compiler
-                                  :signature
-                                  :see-also
-                                  :search-terms
-                                  :moved
-                                  :tags
-                                  :md-biblio
-                                  :clj-doc
-                                  :edn-doc]))]
+        docfile-data (select-keys docfile
+                       [:examples
+                        :known-as
+                        :display-as
+                        :summary
+                        :summary-compiler
+                        :details
+                        :details-compiler
+                        :signature
+                        :see-also
+                        :search-terms
+                        :moved
+                        :tags
+                        :md-biblio
+                        :clj-doc
+                        :edn-doc])]
      (-> item
          (assign-display-name)
          (merge docfile-data)
@@ -437,7 +437,7 @@
 (defn update-result-items
   "Update every symbol or namespace item with the given function."
   [result update-item]
-  (let [update-all #(mapmap update-item %)]
+  (let [update-all #(mapmap (comp prune-map update-item) %)]
     (-> result
         (update-in [:symbols] update-all)
         (update-in [:namespaces] update-all))))


minor fix

minor fix

--- src/clojure_fabric/peer.clj
+++ src/clojure_fabric/peer.clj
@@ -60,7 +60,7 @@
   ([event-name]
    (event-listened? *peer* event-name))
   ([peer event-name]
-   (is-event-listened peer event-name nil))
+   (event-listened? peer event-name nil))
   ([peer event-name chain]
    ;; TBD
    ))


OO|RR: Change map data key to allow for separation from table

--- src/hatti/views/map.cljs
+++ src/hatti/views/map.cljs
@@ -253,7 +253,7 @@
     om/IDidMount
     (did-mount [_]
       "did-mount loads geojson on map, and starts the event handling loop."
-      (let [data (:data app-state)
+      (let [{{:keys [data]} :map-page} app-state
             form (om/get-shared owner :flat-form)
             geojson (mu/as-geojson data form)
             rerender! #(mu/re-render-map! (om/get-state owner :leaflet-map)
@@ -266,8 +266,8 @@
     om/IWillReceiveProps
     (will-receive-props [_ next-props]
       "will-recieve-props resets leaflet geojson if the map data has changed."
-      (let [old-data (:data (om/get-props owner))
-            new-data (:data next-props)
+      (let [{{old-data :data} :map-page} (om/get-props owner)
+            {{new-data :data} :map-page} next-props
             old-field (get-in (om/get-props owner) [:map-page :geofield])
             new-field (get-in next-props [:map-page :geofield])]
         (when (or (not= old-field new-field)


Cosmetics

Cosmetics

--- test/clojure/clojurewerkz/cassaforte/cql_test.clj
+++ test/clojure/clojurewerkz/cassaforte/cql_test.clj
@@ -1,19 +1,19 @@
 (ns clojurewerkz.cassaforte.cql-test
   (:refer-clojure :exclude [update])
-  (:require [clojurewerkz.cassaforte.test-helper :as th :refer [*session* with-table]]
-            [clojurewerkz.cassaforte.client      :as client]
-            [clojurewerkz.cassaforte.policies    :as cp]
-            [clojurewerkz.cassaforte.uuids       :as uuids]
-
-            [clj-time.format                     :as tf]
-            [clj-time.coerce                     :as cc]
-            [clj-time.core                       :refer [seconds ago before? date-time] :as tc]
-
-            [clojurewerkz.cassaforte.cql         :refer :all]
-
-            [clojure.test                        :refer :all]
+  (:require [clojurewerkz.cassaforte.test-helper   :as th :refer [*session* with-table]]
+            [clojurewerkz.cassaforte.client        :as client]
+            [clojurewerkz.cassaforte.policies      :as cp]
+            [clojurewerkz.cassaforte.uuids         :as uuids]
+
+            [clj-time.format                       :as tf]
+            [clj-time.coerce                       :as cc]
+            [clj-time.core                         :refer [seconds ago before? date-time] :as tc]
+
+            [clojurewerkz.cassaforte.cql           :refer :all]
+
+            [clojure.test                          :refer :all]
             [clojurewerkz.cassaforte.new-query-api :as new-query-api]
-            [clojurewerkz.cassaforte.query.dsl :refer :all]
+            [clojurewerkz.cassaforte.query.dsl     :refer :all]
             ))


Cosmetics

Cosmetics

--- test/clojure/clojurewerkz/cassaforte/cql_test.clj
+++ test/clojure/clojurewerkz/cassaforte/cql_test.clj
@@ -12,7 +12,6 @@
             [clojurewerkz.cassaforte.cql         :refer :all]
             [clojurewerkz.cassaforte.query       :as query]
             [clojure.test                        :refer :all]))
-

 (use-fixtures :each with-temporary-keyspace)

@@ -62,7 +61,6 @@
                     (where {:username "user1"
                             :post_id "post1"}))
             [0 :body])))))
-

 (deftest test-update-with-compound-key
   (let [t   :events_by_device_id_and_date


Exclude leiningen stuff to save space

Exclude leiningen stuff to save space

--- desktop/project.clj
+++ desktop/project.clj
@@ -5,7 +5,13 @@
                  [com.badlogicgames.gdx/gdx-backend-lwjgl "0.9.9"]
                  [com.badlogicgames.gdx/gdx-platform "0.9.9"
                   :classifier "natives-desktop"]
-                 [nightcode "0.3.0-SNAPSHOT"]
+                 [nightcode "0.3.0-SNAPSHOT"
+                  :exclusions [leiningen
+                               lein-ancient
+                               lein-cljsbuild
+                               lein-droid
+                               lein-fruit
+                               play-clj/lein-template]]
                  [org.clojure/clojure "1.5.1"]
                  [play-clj "0.2.1-SNAPSHOT"]
                  [seesaw "1.4.4"]]


remove extraneous g tag

remove extraneous g tag

--- src-cljs/frontend/components/canvas.cljs
+++ src-cljs/frontend/components/canvas.cljs
@@ -372,14 +372,13 @@
     (render [_]
       (if (and (:tool subscriber)
                (:show-mouse? subscriber))
-        (dom/g nil
-          (common/svg-icon (subscriber-cursor-icon (:tool subscriber))
+        (common/svg-icon (subscriber-cursor-icon (:tool subscriber))
                          {:svg-props {:height 16 :width 16
                                       :class "mouse-tool"
                                       :x (- (first (:mouse-position subscriber)) 8)
                                       :y (- (last (:mouse-position subscriber)) 8)
                                       :key id}
-                          :path-props {:style {:stroke (:color subscriber)}}}))
+                          :path-props {:style {:stroke (:color subscriber)}}})
         (dom/circle #js {:cx 0 :cy 0 :r 0})))))

 (defn cursors [{:keys [client-id]} owner]


Player removal from all players map

Player removal from all players map

--- src/dynasty_league/core.clj
+++ src/dynasty_league/core.clj
@@ -5,7 +5,13 @@
   [& args]
   (println "Hello, World!"))

-(def my-map {:a 1 :b 2 :c 3})
+(def all-players {:a 1 :b 2 :c 3})

-(defn mytest [a]
-    (def my-map (dissoc my-map a)))
+(defn remove-players
+  "Removes players from the original list of players." [players]
+  (apply dissoc all-players players))
+
+(defn calculate-best-player
+  "Chooses the most optimal player to be drafted from the remaining player.
+  Use the remove-players as the argument for this function."
+  [players])


Add `send-html-message` function to mail system namespace.

--- systems/mail/src/containium/systems/mail.clj
+++ systems/mail/src/containium/systems/mail.clj
@@ -7,7 +7,11 @@
   (:require [containium.systems :refer (require-system Startable)]
             [containium.systems.config :as config :refer (Config)]
             [containium.systems.logging :refer (SystemLogger refer-logging)]
-            [postal.core :as postal]))
+            [postal.core :as postal]
+            [clojure.xml :as xml]
+            [clojure.zip :as zip]
+            [clojure.java.io :as io :refer (resource)])
+  (:import [java.io ByteArrayInputStream]))
 (refer-logging)

@@ -47,3 +51,48 @@
             logger (require-system SystemLogger systems)]
         (info logger "Starting Postal system, using config:" config)
         (Postal. logger config)))))
+
+
+(defn- make-inline
+  [html-str src-root src-map]
+  (let [src-root (str src-root (when-not (= (last src-root) \/) "/"))]
+    (loop [loc (zip/xml-zip (xml/parse (ByteArrayInputStream. (.getBytes (.trim html-str)))))
+           contents []]
+      (if (zip/end? loc)
+        (cons {:type "text/html; charset=utf-8"
+               :content (with-out-str (xml/emit-element (zip/node loc)))}
+              contents)
+        (let [node (zip/node loc)]
+          (if (= :img (:tag node))
+            (let [cid (str (gensym "img-"))
+                  src (-> node :attrs :src)
+                  content (or (get src-map src) (resource (str src-root src)))]
+              (recur (zip/next (zip/edit loc assoc-in [:attrs :src] (str "cid:" cid)))
+                     (cond-> contents
+                             content (conj {:type :inline, :content content, :content-id cid}))))
+            (recur (zip/next loc) contents)))))))
+
+
+(defn send-html-message
+  "Use this function to send a HTML mail with the Postal SMTP Mail
+  system. It needs at least the mail system, the from address, the to
+  address, a subject, and the HTML string. The following options are also available:
+
+  :text - You can supply a plain text version of the message, which
+    will be included as an alternative.
+
+  :src-root - The root directory/package in which the image resources
+    can be found on the classpath for inlining. Note that due to a
+    limitation in javax.mail/Postal the actual resource must be
+    unpacked, i.e. not in a JAR.
+
+  :src-map - This is a map holding files for image tags that, taking
+    the 'src' attribute as key. This map overrides the default lookup
+    when inlining. Note that the values in this map must support being
+    passed to clojure.java.io/file."
+  [mail-system from to subject html & {:keys [text src-root src-map]}]
+  (let [html-contents (make-inline html src-root src-map)
+        contents (remove nil? [:alternative
+                               (when text {:type "text/plain" :content text})
+                               (cons :related html-contents)])]
+    (send-message mail-system from to subject contents)))


friend-list: added first async test

friend-list: added first async test

--- examples/friend-list/test/unit/controller.cljs
+++ examples/friend-list/test/unit/controller.cljs
@@ -1,9 +1,12 @@
 (ns unit.controller
   (:require
     [friend-list.core :as friend-list]
-    [cljs.test :refer-macros [deftest is]]
-    [clj-fakes.core :as f :include-macros true])
+    [middleware.routing :as routing]
+    [cljs.test :refer-macros [deftest is testing async]]
+    [clj-fakes.core :as f :include-macros true]
+    [clj-fakes.context :as fc :include-macros true])
   (:require-macros [reagent.ratom :refer [reaction]]))
+

 (deftest
   on-navigation-updates-query-and-searches
@@ -45,4 +48,57 @@

       ; assert
       (is (f/was-not-called dispatch-action))
-      (is (f/was-not-called dispatch-signal)))))+      (is (f/was-not-called dispatch-signal)))))
+
+(defn with-fakes-async
+  "Helper for defining async tests with fakes.
+  f - test body, the function of args [ctx done];
+  ctx - fakes context;
+  done - is a function which performs clj-fakes self-tests and finishes the async test."
+  [f]
+  (async done
+    (let [ctx (fc/context)
+          done #(try
+                 ; TODO: do not self-test if test has already caught some exceptions
+                 ; TODO: unpatch vars?
+                 (fc/self-test-unchecked-fakes ctx)
+                 (fc/self-test-unused-fakes ctx)
+
+                 ; hack to "notify" test harness about self-test exception
+                 (catch :default e
+                   (is nil e))
+
+                 (finally
+                   (done)))]
+      (f ctx done))))
+
+(deftest
+  on-input-updates-query-and-will-eventually-update-token-and-search
+  (with-fakes-async
+    (fn [ctx done]
+      (let [search (fc/fake ctx [[:_new-token f/any?] #(%2 :_found-friends)])
+            history (fc/reify-nice-fake ctx routing/HistoryProtocol
+                                        (set-token :recorded-fake))
+            {:keys [control]} (friend-list/new-spec history search)
+            dispatch-signal (fc/recorded-fake ctx)
+            dispatch-action (fc/recorded-fake ctx)
+            expected-debounce-interval 300]
+        ; act
+        (control :_model [:on-input :_new-token] dispatch-signal dispatch-action)
+
+        ; assert
+        (is (fc/was-called-once ctx dispatch-action [[:set-query :_new-token]]))
+
+        (.setTimeout js/window
+                     #(testing "just before debounce"
+                       (is (fc/method-was-not-called ctx routing/set-token history))
+                       (is (fc/was-not-called ctx dispatch-signal)))
+                     (dec expected-debounce-interval))
+
+        (.setTimeout js/window
+                     #(do
+                       (testing "just after debounce"
+                         (is (fc/method-was-called-once ctx routing/set-token history [:_new-token]))
+                         (is (fc/was-called-once ctx dispatch-signal [[:on-search-success :_new-token :_found-friends]])))
+                       (done))
+                     (inc expected-debounce-interval))))))


better ws in an assoc

better ws in an assoc

--- test-cljs/frontend/controllers/test_api.cljs
+++ test-cljs/frontend/controllers/test_api.cljs
@@ -91,8 +91,8 @@
               (assoc-in dummy-state
                         state/project-envvars-path
                         {"a" 1})
-               :inputs {:new-env-var-name "" :new-env-var-value ""}
-               :flash-notification {:number 1 :message "Environment variable added successfully."})
+              :inputs {:new-env-var-name "" :new-env-var-value ""}
+              :flash-notification {:number 1 :message "Environment variable added successfully."})
              (test-fn {:resp {:name "a" :value 1}
                        :context {:project-id dummy-project-id}}
                       dummy-state))))
@@ -101,8 +101,8 @@
               (assoc-in dummy-state
                         state/project-envvars-path
                         {"a" 1})
-               :inputs {:new-env-var-name "" :new-env-var-value ""}
-               :flash-notification {:number 1 :message "Environment variable added successfully."})
+              :inputs {:new-env-var-name "" :new-env-var-value ""}
+              :flash-notification {:number 1 :message "Environment variable added successfully."})
              (test-fn {:resp {:name "a" :value 1}
                        :context {:project-id dummy-project-id}}
                       (assoc-in dummy-state


[#231] Refactor the form definition creation code

* The `SurveyDAO.loadFullForm()` function was at some point modified to include questions as well, therefore the extra code that also retrieved questions in the API is redundant and should be removed.

--- api/src/clojure/org/akvo/flow_api/datastore/survey.clj
+++ api/src/clojure/org/akvo/flow_api/datastore/survey.clj
@@ -52,8 +52,9 @@
      (when (= type* "CADDISFLY")
        {:caddisfly-resource-uuid (.getCaddisflyResourceUuid question)}))))

-(defn question-group-definition [question-group questions]
-  (let [qs (sort-by :order (map ->question questions))]
+(defn question-group-definition [question-group]
+  (let [questions (.values (.getQuestionMap question-group))
+        qs (sort-by :order (map ->question questions))]
     {:id (str (ds/id question-group))
      :name (.getName question-group)
      :repeatable (boolean (.getRepeatable question-group))
@@ -67,16 +68,12 @@
   ([form-id {:keys [include-survey-id?]}]
    (let [form-dao (com.gallatinsystems.survey.dao.SurveyDAO.)
          ;; Includes question groups, but contrary to docstring does not contain questions
-         form (.loadFullForm form-dao form-id)
-         question-dao (com.gallatinsystems.survey.dao.QuestionDao.)
-         questions (group-by #(.getQuestionGroupId %)
-                             (.listQuestionsBySurvey question-dao form-id))]
+         form (.loadFullForm form-dao form-id)]
      (cond->
          {:id (str form-id)
           :name (.getName form)
           :question-groups (mapv (fn [question-group]
-                                   (question-group-definition question-group
-                                                              (get questions (ds/id question-group))))
+                                   (question-group-definition question-group))
                                  (.values (.getQuestionGroupMap form)))
           :created-at (ds/created-at form)
           :modified-at (ds/modified-at form)}


:bug: Fixes color picker when SVG contained special characters

--- frontend/src/app/main/ui/workspace/viewport.cljs
+++ frontend/src/app/main/ui/workspace/viewport.cljs
@@ -237,12 +237,14 @@
                svg-node (mf/ref-val svg-ref)]
            (timers/schedule 100
             #(let [xml (.serializeToString (js/XMLSerializer.) svg-node)
-                   content (str "data:image/svg+xml;base64," (js/btoa xml))
-                   img (js/Image.)]
-               (obj/set! img  "onload"
-                         (fn []
-                           (.drawImage canvas-context img 0 0)))
-               (obj/set! img "src" content))))
+                   img-src (str "data:image/svg+xml;base64,"
+                                (-> xml js/encodeURIComponent js/unescape js/btoa))
+                   img (js/Image.)
+                   on-error (fn [err] (.error js/console "ERROR" err))
+                   on-load (fn [] (.drawImage canvas-context img 0 0))]
+               (.addEventListener img "error" on-error)
+               (.addEventListener img "load" on-load)
+               (obj/set! img "src" img-src))))
          (catch :default e (.error js/console e)))))

     [:*


Remove dead code from shapes selection ns.

--- frontend/src/uxbox/main/ui/shapes/selection.cljs
+++ frontend/src/uxbox/main/ui/shapes/selection.cljs
@@ -50,88 +50,74 @@

 ;; --- Resize Implementation

-(defn- rotate
-  [shape]
-  (let [{:keys [x1 y1 width height rotation]} (-> (geom/shape->rect-shape shape)
-                                                  (assoc :type :rect)
-                                                  (geom/size))
-        x-center (+ x1 (/ width 2))
-        y-center (+ y1 (/ height 2))
-        mt (-> (gmt/matrix)
-               (gmt/translate  x-center y-center)
-               (gmt/rotate rotation)
-               (gmt/translate (- x-center) (- y-center)))]
-    (geom/transform shape mt)))
-
 (defn- start-resize
   [vid ids shape]
   (letfn [(gen-matrix [shape {scalex :x scaley :y}]
-            (let [shape shape #_(rotate shape)]
-              (case vid
-                :top-left
-                (-> (gmt/matrix)
-                    (gmt/translate (+ (:x2 shape))
-                                   (+ (:y2 shape)))
-                    (gmt/scale scalex scaley)
-                    (gmt/translate (- (:x2 shape))
-                                   (- (:y2 shape))))
-
-                :top-right
-                (-> (gmt/matrix)
-                    (gmt/translate (+ (:x1 shape))
-                                   (+ (:y2 shape)))
-                    (gmt/scale scalex scaley)
-                    (gmt/translate (- (:x1 shape))
-                                   (- (:y2 shape))))
-
-                :top
-                (-> (gmt/matrix)
-                    (gmt/translate (+ (:x1 shape))
-                                   (+ (:y2 shape)))
-                    (gmt/scale scalex scaley)
-                    (gmt/translate (- (:x1 shape))
-                                   (- (:y2 shape))))
-
-                :bottom-left
-                (-> (gmt/matrix)
-                    (gmt/translate (+ (:x2 shape))
-                                   (+ (:y1 shape)))
-                    (gmt/scale scalex scaley)
-                    (gmt/translate (- (:x2 shape))
-                                   (- (:y1 shape))))
-
-                :bottom-right
-                (-> (gmt/matrix)
-                    (gmt/translate (+ (:x1 shape))
-                                   (+ (:y1 shape)))
-                    (gmt/scale scalex scaley)
-                    (gmt/translate (- (:x1 shape))
-                                   (- (:y1 shape))))
-
-                :bottom
-                (-> (gmt/matrix)
-                    (gmt/translate (+ (:x1 shape))
-                                   (+ (:y1 shape)))
-                    (gmt/scale scalex scaley)
-                    (gmt/translate (- (:x1 shape))
-                                   (- (:y1 shape))))
-
-                :right
-                (-> (gmt/matrix)
-                    (gmt/translate (+ (:x1 shape))
-                                   (+ (:y1 shape)))
-                    (gmt/scale scalex scaley)
-                    (gmt/translate (- (:x1 shape))
-                                   (- (:y1 shape))))
-
-                :left
-                (-> (gmt/matrix)
-                    (gmt/translate (+ (:x2 shape))
-                                   (+ (:y1 shape)))
-                    (gmt/scale scalex scaley)
-                    (gmt/translate (- (:x2 shape))
-                                   (- (:y1 shape))))
-                )))
+            (case vid
+              :top-left
+              (-> (gmt/matrix)
+                  (gmt/translate (+ (:x2 shape))
+                                 (+ (:y2 shape)))
+                  (gmt/scale scalex scaley)
+                  (gmt/translate (- (:x2 shape))
+                                 (- (:y2 shape))))
+
+              :top-right
+              (-> (gmt/matrix)
+                  (gmt/translate (+ (:x1 shape))
+                                 (+ (:y2 shape)))
+                  (gmt/scale scalex scaley)
+                  (gmt/translate (- (:x1 shape))
+                                 (- (:y2 shape))))
+
+              :top
+              (-> (gmt/matrix)
+                  (gmt/translate (+ (:x1 shape))
+                                 (+ (:y2 shape)))
+                  (gmt/scale scalex scaley)
+                  (gmt/translate (- (:x1 shape))
+                                 (- (:y2 shape))))
+
+              :bottom-left
+              (-> (gmt/matrix)
+                  (gmt/translate (+ (:x2 shape))
+                                 (+ (:y1 shape)))
+                  (gmt/scale scalex scaley)
+                  (gmt/translate (- (:x2 shape))
+                                 (- (:y1 shape))))
+
+              :bottom-right
+              (-> (gmt/matrix)
+                  (gmt/translate (+ (:x1 shape))
+                                 (+ (:y1 shape)))
+                  (gmt/scale scalex scaley)
+                  (gmt/translate (- (:x1 shape))
+                                 (- (:y1 shape))))
+
+              :bottom
+              (-> (gmt/matrix)
+                  (gmt/translate (+ (:x1 shape))
+                                 (+ (:y1 shape)))
+                  (gmt/scale scalex scaley)
+                  (gmt/translate (- (:x1 shape))
+                                 (- (:y1 shape))))
+
+              :right
+              (-> (gmt/matrix)
+                  (gmt/translate (+ (:x1 shape))
+                                 (+ (:y1 shape)))
+                  (gmt/scale scalex scaley)
+                  (gmt/translate (- (:x1 shape))
+                                 (- (:y1 shape))))
+
+              :left
+              (-> (gmt/matrix)
+                  (gmt/translate (+ (:x2 shape))
+                                 (+ (:y1 shape)))
+                  (gmt/scale scalex scaley)
+                  (gmt/translate (- (:x2 shape))
+                                 (- (:y1 shape))))
+              ))

           (calculate-ratio [orig-shape {:keys [width height] :as shape}]
             (let [result {:x (/ width (:width orig-shape))
@@ -237,14 +223,6 @@

 ;; --- Controls (Component)

-(defn selection-rect
-  [{:keys [x1 y1 x2 y2 width height rotation] :as shape}]
-  {:x x1
-   :y y1
-   :rotation rotation
-   :width width
-   :height height})
-
 (mx/defc controls
   {:mixins [mx/static]}
   [{:keys [x1 y1 width height] :as shape} zoom on-mouse-down]


CMR-5106-2 Addresses PR comments.

CMR-5106-2 Addresses PR comments.

--- search-app/src/cmr/search/services/acls/granule_acls.clj
+++ search-app/src/cmr/search/services/acls/granule_acls.clj
@@ -164,7 +164,8 @@
                                       q/->CollectionQueryCondition)
             temporal-cond (some-> temporal temporal->query-condition q/->CollectionQueryCondition)]

-        (gc/and-conds (remove nil? [(or concept-ids-cond colls-in-prov-cond)
+        (gc/and-conds (remove nil? [concept-ids-cond
+                                    colls-in-prov-cond
                                     access-value-cond
                                     temporal-cond])))
       ;; No other collection info provided so every collection in provider is possible


CMR-4418: Fixed typo.

CMR-4418: Fixed typo.

--- indexer-app/src/cmr/indexer/services/index_service.clj
+++ indexer-app/src/cmr/indexer/services/index_service.clj
@@ -524,7 +524,7 @@
        context
        index
        (concept-mapping-types :variable)
-       {:term {(query-field->elastic-field :provider-id :collection) provider-id}}))))
+       {:term {(query-field->elastic-field :provider-id :variable) provider-id}}))))

 (defn publish-provider-event
   "Put a provider event on the message queue."


Hide the resource class for non-docker executor

This is only currently supported for docker executor.

--- src-cljs/frontend/components/pages/build/head.cljs
+++ src-cljs/frontend/components/pages/build/head.cljs
@@ -239,7 +239,8 @@
                                                     :stop (or (:queued_at build) (:stop_time build))})
                 " waiting for builds to finish"))))

-          (when-let [resource_class (:resource_class picard)]
+          (when-let [resource_class (and (= "docker" (get-in picard [:build_agent :properties :executor]))
+                                         (:resource_class picard))]
             (summary-item/summary-item
               [:span "Resources:"]
               [:span


CMR-1246: Remove unused :reset state from message-queue-history

--- dev-system/src/cmr/dev_system/queue_broker_wrapper.clj
+++ dev-system/src/cmr/dev_system/queue_broker_wrapper.clj
@@ -14,11 +14,9 @@

 (def ^:const ^:private valid-action-types
   "A set of the valid action types for a message queue:
-  :reset - Clear out all of the messages. TODO: This is currently not used and may be removed.
   :enqueue - Message has been added to the queue.
   :process - Message has been processed."
-  #{:reset
-    :enqueue
+  #{:enqueue
     :process})

 (defn- append-to-message-queue-history
@@ -36,19 +34,15 @@
   :message {:id 1 :concept-id \"C1-PROV1\" :revision-id 1 :state :initial}}
   :messages [{:id 1 :concept-id \"C1-PROV1\" :revision-id 1 :state :initial}]}"
   [message-queue-history-value action-type message resulting-state]
-  {:pre [(valid-action-types action-type)]}
-  (let [message-with-state (when (seq message) (assoc message :state resulting-state))
-        messages (case action-type
-                   :reset []
-                   (:enqueue :process)
-                   (when (seq message)
-                     (conj
-                       ;; Messages are unique based on id - if the action is to change the state
-                       ;; of a message we already know about, we replace the original message
-                       ;; with the new one in our list of messages.
-                       (remove #(= (:id message) (:id %))
-                               (:messages (last message-queue-history-value)))
-                       message-with-state)))
+  {:pre [(valid-action-types action-type) message]}
+  (let [message-with-state (assoc message :state resulting-state)
+        messages (conj
+                   ;; Messages are unique based on id - if the action is to change the state
+                   ;; of a message we already know about, we replace the original message
+                   ;; with the new one in our list of messages.
+                   (remove #(= (:id message) (:id %))
+                           (:messages (last message-queue-history-value)))
+                   message-with-state)
         new-action (util/remove-nil-keys {:action-type action-type
                                           :message message-with-state})]
     (conj message-queue-history-value {:action new-action :messages messages})))


Доработка компонента отображения таблиц-панелей

--- radiolamp-6P3S/src/r6p3s/ui/panel_with_table.cljs
+++ radiolamp-6P3S/src/r6p3s/ui/panel_with_table.cljs
@@ -7,29 +7,39 @@

+
 (defn render [{:keys [cols rows
                       striped? bordered? hover? responsive?]
-               :or   {cols        [] rows []
+               :or   {cols        []
+                      rows        []
                       striped?    true
                       bordered?   true
                       hover?      true
                       responsive? true}
                :as   options}]
-  (panel/render
-   (assoc options
-          :after-body
-          (table/render
-           {:hover?      hover?
-            :bordered?   bordered?
-            :striped?    striped?
-            :responsive? responsive?
-            :thead       (->> cols
-                              (map #(dom/th nil %))
-                              thead-tr/render)
-            :tbody       (->> rows
-                              (map (fn [row]
-                                     (apply
-                                      dom/tr nil
-                                      (vec (map #(dom/td nil %) row)))))
-                              (apply dom/tbody nil))
-            }))))
+  (let [empty-cols? (empty? cols)
+        t-width (when empty-cols?
+                  (when-let [c (first rows)]
+                    (str (quot 100 (count c)) "%")))]
+    (panel/render
+     (assoc options
+            :after-body
+            (table/render
+             {:hover?      hover?
+              :bordered?   bordered?
+              :striped?    striped?
+              :responsive? responsive?
+              :thead       (->> cols
+                                (map #(dom/th #js {:width t-width} %))
+                                thead-tr/render)
+              :tbody       (->> rows
+                                (map (fn [row]
+                                       (apply
+                                        dom/tr nil
+                                        (vec (map #(dom/td
+                                                    (when empty-cols?
+                                                      #js {:width t-width})
+                                                    %)
+                                                  row)))))
+                                (apply dom/tbody nil))
+              })))))


implement part 1

implement part 1

--- 2016/day-17/src/day_17/core.clj
+++ 2016/day-17/src/day_17/core.clj
@@ -76,4 +76,6 @@
 (defn -main
   "I don't do a whole lot ... yet."
   [& args]
-  (println "Hello, World!"))
+  (->>
+    (shortest-path "dmypynyp")
+    println))


fix unneeded prefix form in :require

fix unneeded prefix form in :require

--- src/metabase/api/common.clj
+++ src/metabase/api/common.clj
@@ -2,7 +2,7 @@
   "Dynamic variables and utility functions/macros for writing API functions."
   (:require [compojure.core :refer [defroutes]]
             [medley.core :refer :all]
-            (metabase.api.common [internal :refer :all])
+            [metabase.api.common.internal :refer :all]
             [metabase.db :refer [sel-fn]])
   (:import com.metabase.corvus.api.ApiException))


move (parse) and (generate) to the top

move (parse) and (generate) to the top

also use engine/generate-all, not engine/generate

--- src/babel/francais/workbook.clj
+++ src/babel/francais/workbook.clj
@@ -24,22 +24,6 @@
    [dag_unify.core :refer [fail-path-between get-in remove-false strip-refs unify]]
    [hiccup.core :refer [html]]))

-(defn analyze
-  ([surface-form]
-   (morph/analyze surface-form (:lexicon medium)))
-  ([surface-form model]
-   (morph/analyze surface-form (:lexicon model))))
-
-(defn generate
-  ([spec]
-   (let [result (engine/generate spec medium)]
-     (conj {:surface (fo result)}
-            result)))
-  ([spec model]
-   (let [result (engine/generate spec model)]
-     (conj {:surface (fo result)}
-           result))))
-
 (defn parse
   ([string]
    (map #(conj {:surface (fo %)}
@@ -55,6 +39,21 @@
                      (:lexicon model)
                      (:lookup model)
                      (:grammar model)))))
+(defn analyze
+  ([surface-form]
+   (morph/analyze surface-form (:lexicon medium)))
+  ([surface-form model]
+   (morph/analyze surface-form (:lexicon model))))
+
+(defn generate
+  ([spec]
+   (let [result (first (take 1 (engine/generate-all spec medium)))]
+     (conj {:surface (fo result)}
+           result)))
+  ([spec model]
+   (let [result (first (take 1 (engine/generate-all spec model)))]
+     (conj {:surface (fo result)}
+           result))))

 (defn tokenize [string]
   (parse/toks string


cleanup

cleanup

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -468,13 +468,4 @@
      :index (create-index grammar (flatten (vals lexicon)) head-principle)
      }))

-(defn toks [surface]
-  (parse/toks surface (:lexicon small) (:lookup small)))
-
-(defn parse [surface]
-  (parse/parse surface
-               (:lexicon medium)
-               (:lookup medium)
-               (:grammar medium)))
-
 (log/info "Italiano grammars defined (small, medium).")


+TODO

+TODO

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -708,6 +708,8 @@
   (let [;;lexicon @lexicon
         lexicon (babel.italiano.lexicon/edn2lexicon (clojure.java.io/resource "babel/italiano/lexicon.edn"))
         parse-lexicon
+        ;; TODO: remove this do-nothing filtering and
+        ;; replace with comment like "if you want to filter, then do: `(into {}..)`".
         (into {}
               (for [[k vals] lexicon]
                 (let [filtered-vals


exclude cities from the small lexicon

exclude cities from the small lexicon

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -592,7 +592,8 @@
                         (filter #(and
                                   (not (= true (get-in % [:top])))
                                   (or (= (get-in % [:synsem :cat]) :verb)
-                                      (= (get-in % [:synsem :propernoun]) true)
+                                      (and (= (get-in % [:synsem :propernoun]) true)
+                                           (= (get-in % [:synsem :sem :city] false) false)) ;; exclude cities from the small grammar.
                                       (= (get-in % [:synsem :pronoun]) true)))
                                 v)]
                   (if (not (empty? filtered-v))


s/def/defonce/

s/def/defonce/

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -75,7 +75,7 @@
      :head {:synsem {:cat head-cat}
             :italiano {:cat head-cat}}}))

-(def head-first
+(defonce head-first
   (let [head-italian (atom :top)
         comp-italian (atom :top)]
     (unify
@@ -86,7 +86,7 @@
       :comp {:italiano comp-italian}
       :italiano {:a head-italian
                  :b comp-italian}})))
-(def head-last
+(defonce head-last
   (let [head-italian (atom :top)
         comp-italian (atom :top)
         head-cat (atom :top)
@@ -101,22 +101,22 @@
                  :b head-italian}})))

 ;; -- BEGIN SCHEMA DEFINITIONS
-(def c10
+(defonce c10
   (unify
    ug/c10
    head-last))

-(def c21
+(defonce c21
   (unify
    ug/c21 head-last))

-(def h11
+(defonce h11
   (unify
    ug/h11
    head-first))

 ;; <TODO: move most of the content to babel.ug as the above examples (c10,c21,h11) do.>
-(def c11-comp-subcat-1
+(defonce c11-comp-subcat-1
   (let [subcat (atom :top)]
     (unify
      {:head {:synsem {:subcat {:1 subcat}}}
@@ -130,7 +130,7 @@
       :first :head
       :comment "c11-comp-subcat-1"})))

-(def h11-comp-subcat-1
+(defonce h11-comp-subcat-1
   (let [subcat (atom :top)]
     (unify
      {:head {:synsem {:subcat {:1 subcat}}}
@@ -144,7 +144,7 @@
       :first :comp
       :comment "h11-comp-subcat-1"})))

-(def h10
+(defonce h10
   (unify
    subcat-1-principle
    head-principle
@@ -153,7 +153,7 @@
     :schema-symbol 'h10 ;; used by over-each-parent to know where to put children.
     :first :head}))

-(def h21
+(defonce h21
   (unify
    subcat-2-principle
    head-principle
@@ -163,7 +163,7 @@
     :first :head}))

 ;; h21a is a specialization of h21. it's used for vp-aux to prevent over-generation.
-(def h21a
+(defonce h21a
   (merge
    (unify
     h21
@@ -171,7 +171,7 @@
    {:comment "h21a"
     :schema-symbol 'h21a}))

-(def h22
+(defonce h22
   (unify
    subcat-2-2-principle
    head-principle
@@ -180,7 +180,7 @@
     :schema-symbol 'h22 ;; used by over-each-parent to know where to put children.
     :first :head}))

-(def h32
+(defonce h32
   (unify
    subcat-5-principle
    head-principle
@@ -189,7 +189,7 @@
     :schema-symbol 'h32 ;; used by over-each-parent to know where to put children.
     :first :head}))

-(def c00
+(defonce c00
   (unify-check
    head-last
    {:comment "c00"
@@ -198,7 +198,7 @@
     :comp {:synsem {:subcat '()}}
     :head {:synsem {:subcat '()}}}))

-(def h00
+(defonce h00
   (unify-check
    head-first
    {:comment "h00"
@@ -210,13 +210,13 @@
 ;; </TODO: move most of the content to babel.ug>
 ;; -- END SCHEMA DEFINITIONS

-(def vp-non-pronoun
+(defonce vp-non-pronoun
   {:comp {:synsem {:pronoun false}}})

-(def modified {:modified true})
-(def unmodified {:modified false})
-
-(def grammar (list (unify h21
+(defonce modified {:modified true})
+(defonce unmodified {:modified false})
+
+(defonce grammar (list (unify h21
                            {:rule "adjective-phrase"
                             :synsem {:cat :adjective}})


adding builder macros to create closures fn

--- moebius/src/moebius/core.clj
+++ moebius/src/moebius/core.clj
@@ -248,6 +248,23 @@
                          ~@body)))))))

+(defmacro -def-moebius-builder [type fname docstring args &
+                                [[afn params & body] :as forms]]
+  (let [p# (count params)
+        wrapper (if (= 2 p#) :stateful :stateless)]
+    (if (not (<= 1 p# 2))
+      (throw (IllegalArgumentException.
+              (str "Invalid number of parameters for function: "
+                   name ". It can be either [event] or [state event]")))
+      (let [attrs (merge (meta fname)
+                         {:doc docstring
+                          :arglists [`'~params]})
+            fsym (with-meta fname attrs)]
+        `(defn ~fsym ~args
+           (moebius-fn (str '~fname) ~docstring ~type ~wrapper
+                       ~@forms))))))
+
+

 (defmacro defenrich
   "handy macro to define an enrichment function"
@@ -256,6 +273,15 @@
   [name & args]
   (let [[docstring params & body] (if (string? (first args)) args (cons "" args))]
     `(-def-moebius-function :enrichment ~name ~docstring ~params ~@body)))
+
+
+
+(defmacro defenrich*
+  "handy macro to define an enrichment function which closes over a configuration"
+  ^{:arglists '([name docstring? [cfg] & body])}
+  [name & args]
+  (let [[docstring params & body] (if (string? (first args)) args (cons "" args))]
+    `(-def-moebius-builder :enrichment ~name ~docstring ~params ~@body)))

@@ -277,6 +303,15 @@

+(defmacro defcorrelate*
+  "handy macro to define an correlation function which closes over a configuration"
+  ^{:arglists '([name docstring? [cfg] & body])}
+  [name & args]
+  (let [[docstring params & body] (if (string? (first args)) args (cons "" args))]
+    `(-def-moebius-builder :correlation ~name ~docstring ~params ~@body)))
+
+
+
 (defn as-correlate
   ([name statefulness f]
    (moebius-fn name "" :correlation statefulness f))
@@ -292,6 +327,15 @@
   [name & args]
   (let [[docstring params & body] (if (string? (first args)) args (cons "" args))]
     `(-def-moebius-function :filtering ~name ~docstring ~params ~@body)))
+
+
+
+(defmacro deffilter*
+  "handy macro to define an filtering function which closes over a configuration"
+  ^{:arglists '([name docstring? [cfg] & body])}
+  [name & args]
+  (let [[docstring params & body] (if (string? (first args)) args (cons "" args))]
+    `(-def-moebius-builder :filtering ~name ~docstring ~params ~@body)))


Set clicks to pass-through search-icon

Set clicks to pass-through search-icon

--- src/braid/ui/styles/header.cljs
+++ src/braid/ui/styles/header.cljs
@@ -176,7 +176,8 @@
            :cursor "pointer"}]

          [:&.search:after
-          {:color "#ccc"}
+          {:color "#ccc"
+           :pointer-events "none"}
           (mixins/fontawesome \uf002)]

          [:&.clear:after


minor refactor

minor refactor

--- exercise3/src/de/haw/vs/clock.clj
+++ exercise3/src/de/haw/vs/clock.clj
@@ -14,8 +14,11 @@
 (defn remaining-slots [frame-size slot-count]
   (- slot-count (current-slot frame-size slot-count)))

+(defn remaining-time-until-end [duration]
+  (- duration (mod (current-time) duration)))
+
 (defn wait-until-slot-end [slot-duration]
-  (Thread/sleep (- slot-duration (mod (current-time) slot-duration))))
+  (Thread/sleep (remaining-time-until-end slot-duration)))

 (defn ms-until-slot-middle [frame-size slot-count slot-number]
   (let [duration-per-slot (/ frame-size slot-count)]


Fix lumo build configuration merge, close #11 (#12)

--- serverless-cljs-plugin/serverless_lumo/build.cljs
+++ serverless-cljs-plugin/serverless_lumo/build.cljs
@@ -116,9 +116,16 @@
     (when-let [args lumo.core/*command-line-args*] ;; for lumo <= 1.7.0
       args)))

+(defn- merge-maps [x y]
+  (merge-with
+   (fn [x y]
+     (if (map? x)
+       (merge-maps x y)
+       y))
+   x y))
+
 (defn ^:export -main [& args]
-  (let [opts (cli-options (cmd-line-args))
-        conf (read-conf!)]
-    (build! opts (merge-with merge default-config (read-conf!)))))
+  (let [opts (cli-options (cmd-line-args))]
+    (build! opts (merge-maps default-config (read-conf!)))))

 (set! *main-cli-fn* -main)


Handy until tools.namespace works inside immutant

--- modules/core/src/main/clojure/immutant/dev.clj
+++ modules/core/src/main/clojure/immutant/dev.clj
@@ -120,3 +120,10 @@
    (-> (current-project)
        (update-in [:dependencies] #(set (concat % (remove string? deps))))
        (update-in [:source-paths] #(concat % (filter string? deps))))))
+
+(defn remove-lib
+  "Borrowed from tools.namespace"
+  [lib]
+  (remove-ns lib)
+  (dosync (alter @#'clojure.core/*loaded-libs* disj lib)))
+


fix for cvs ability on gravedigger

fix for cvs ability on gravedigger

--- src/clj/game/cards-upgrades.clj
+++ src/clj/game/cards-upgrades.clj
@@ -102,7 +102,7 @@
                         :yes-ability {:msg (msg "purge viruses")
                                       :effect (effect (purge))}}}
     :abilities [{:label "[Trash]: Purge virus counters"
-                 :msg "purge viruses" :effect (effect (purge) (trash card))}]}
+                 :msg "purge viruses" :effect (effect (trash card) (purge))}]}

    "Dedicated Technician Team"
    {:recurring 2}


[REFACTOR] Add `get-short-url` function

[REFACTOR] Add `get-short-url` function

containing the code which makes the ajax call to obtain a short url for
the current module selection.

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

--- src/cljs/cljs_nusmods/main.cljs
+++ src/cljs/cljs_nusmods/main.cljs
@@ -401,6 +401,29 @@
         (initialize-exhibit3 (aget js/window "MODULES")
                              (aget js/window "AUXMODULES")))))

+(defn- get-short-url
+  "Tries to obtain a short url and sets the result in the #url-shortener
+   <input>"
+  [$urlShortenerInput localStorage]
+  (ajax "/shorten"
+        {:data     {:url (js/encodeURI
+                           (aget js/document "URL"))}
+         :dataType "json"
+
+         :success
+         (fn [data]
+           (if (= (aget data "status") 200)
+               (let [shortUrl (aget data "shortUrl")]
+                 (.val $urlShortenerInput shortUrl)
+                 (.setItem localStorage localStorageKey
+                           shortUrl))
+               (.val $urlShortenerInput
+                     (aget data "message"))))
+
+         :error    (fn [jqXHR textStatus errorThrown]
+                     (.val $urlShortenerInput
+                           "an error occurred"))}))
+
 (defn- short-url-setup
   "Setup url shortening"
   []
@@ -431,24 +454,7 @@
                          (.getItem localStorage localStorageKey))]
                 (if mbShortUrl
                     (.val $urlShortenerInput mbShortUrl)
-                    (ajax "/shorten"
-                          {:data     {:url (js/encodeURI
-                                             (aget js/document "URL"))}
-                           :dataType "json"
-
-                           :success
-                           (fn [data]
-                             (if (= (aget data "status") 200)
-                                 (let [shortUrl (aget data "shortUrl")]
-                                   (.val $urlShortenerInput shortUrl)
-                                   (.setItem localStorage localStorageKey
-                                             shortUrl))
-                                 (.val $urlShortenerInput
-                                       (aget data "message"))))
-
-                           :error    (fn [jqXHR textStatus errorThrown]
-                                       (.val $urlShortenerInput
-                                             "an error occurred"))})))))))
+                    (get-short-url $urlShortenerInput localStorage)))))))

 ; Main entry point of the program
 (defn ^:export init [acad-year sem]


Bring cursors down the tree

Bring cursors down the tree

--- src/cljs/clojure_rest/core.cljs
+++ src/cljs/clojure_rest/core.cljs
@@ -35,15 +35,18 @@
   })

 (defn filter-by-status
+  "Filter card by status"
   [status cards]
-  (filter #(= status (:status %)) cards))
+  (filter #(= status (-> % deref :status)) cards))

 (defn filter-by-title
-  "Keep only cards that contains the searched string inside their title"
-  [title cards]
-  (if (empty? title)
-    cards
-    (filter #(utils/str-contains (-> % second :title) title) cards)))
+  "Return the id of the cards that contains the searched string inside their title"
+  [filter cards]
+  (->>
+    (if (empty? filter) cards
+     (filter #(utils/str-contains (-> % second :title) filter) cards))
+    (map first)
+  ))

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

@@ -114,11 +117,13 @@
 (defn render-card
   ; TODO - Try to avoid the update-card! use and use messages / cursors
   ; * Fix the filter on top of the board to provide cursors down?
-  [card]
-  (let [show-details (::show-details card)
+  [card-cursor]
+  (let [card (deref card-cursor)
+        show-details (::show-details card)
         toggle-details #(update-card! (update-in card [::show-details] not))
         title-style (if show-details :div.card__title--is-open :div.card__title)
         details-style (when-not show-details {:style {:display "none"}})]
+    ;(js/alert (str card))
     [:div.card
      [:div {:style (card-side-color card)}]
      [title-style {:on-click toggle-details} (:title card)]
@@ -133,8 +138,8 @@
   [status cards]
   [:div.list
    [:h1 (status->str status)]
-   (for [c (filter-by-status status (map second cards))]
-     ^{:key (:card-id c)} [render-card c])
+   (for [c (filter-by-status status cards)]
+     ^{:key (:card-id @c)} [render-card c])
   ])

 (defn render-board
@@ -154,18 +159,17 @@

 (defn render-app
   []
-  ; TODO - Try to go deeper with a cursor
-  ; Solution 1: Try to filter, providing a list of cursors instead
-  ; Solution 2: Do not make such a big tree of functions
+  ; TODO - Do not make such a big tree of functions
   ; - The DOM needs to be that deep
   ; - But you can create the card at the top
   ; - And then you can assemble them (group-by or filter)
   (let [filter (r/cursor app-state [:filter])
-        cards (reaction (filter-by-title @filter (:cards @app-state)))]
+        card-ids (filter-by-title @filter (:cards @app-state))
+        card-cursors (map #(r/cursor app-state [:cards %1]) card-ids)]
     [:div
      ; TODO - Try to add a button to show details to all tickets
      (render-filter filter)
-     [render-board @cards]]
+     [render-board card-cursors]]
   ))

 (def fetch-and-render-app


using ns-qualified keywords for storing router info in maps

--- src/cljc/ow/starbuck/message_router.cljc
+++ src/cljc/ow/starbuck/message_router.cljc
@@ -3,10 +3,10 @@
             [ow.starbuck.core :refer [defcomponentrecord] :as oc]))

 (defn- printable-msg [msg]
-  (select-keys msg #{:route :comp :starbuck/route-count}))
+  (select-keys msg #{::route ::component ::transition-count ::max-transitions}))

-(defn- inc-route-count [msg]
-  (update msg :starbuck/route-count
+(defn- inc-transition-count [msg]
+  (update msg ::transition-count
           #(inc (or % 0))))

 (defn- next->fns [m]
@@ -28,11 +28,11 @@
 (defn- goto-next [transition msgs]
   (if-let [nextfs (next->fns transition)]
     (->> (map #(map (fn [nextf]
-                      (assoc % :comp (nextf %)))
+                      (assoc % ::component (nextf %)))
                     nextfs)
               msgs)
          (apply concat)
-         (remove #(nil? (:comp %))))
+         (remove #(nil? (::component %))))
     (do (warn "next component undefined in transition" {:transition transition
                                                         :msgs (mapv printable-msg msgs)})
         [])))
@@ -47,7 +47,7 @@
   (reduce (fn [s [key eventhandler]]
             (if-let [nextfs (next->fns eventhandler)]
               (if (contains? msg key)
-                (let [evmsgs (map #(assoc msg :comp (% msg))
+                (let [evmsgs (map #(assoc msg ::component (% msg))
                                   nextfs)]
                   (-> (update s :abort? #(or % (:abort? eventhandler)))
                       (update :evmsgs #(concat % evmsgs))))
@@ -59,12 +59,21 @@
            :evmsgs []}
           eventhandlers))

-(defn advance [msg ruleset]
+(defn message [route map & {:keys [max-transitions]
+                            :or {max-transitions 100}}]
+  "Creates a new routable message."
+  (assoc map
+         ::route route
+         ::component nil
+         ::transition-count 0
+         ::max-transitions max-transitions))
+
+(defn advance [ruleset msg]
   "Takes a message, runs it against ruleset and returns a sequence of routed messages."
   (debug "routing starting with" (printable-msg msg))
-  (if (< (or (:starbuck/route-count msg) 0) 100)
-    (let [route (get-in ruleset [:routes (:route msg)])
-          trans (get-in route [:transitions (:comp msg)])
+  (if (< (::transition-count msg) 100)
+    (let [route (get-in ruleset [:routes (::route msg)])
+          trans (get-in route [:transitions (::component msg)])
           transs (if (sequential? trans)
                    trans
                    [trans])
@@ -74,10 +83,10 @@
           resmsgs (if abort?
                     evmsgs
                     (concat evmsgs (->> (goto-next-and-transform transs [msg])
-                                        (map inc-route-count))))]
+                                        (map inc-transition-count))))]
       (debug "routing ending with" (mapv printable-msg resmsgs))
       resmsgs)
-    (do (warn "dropping message due to high route-count")
+    (do (warn "dropping message due to high transition-count")
         [])))

@@ -92,3 +101,26 @@
                        :ch-in ch-in
                        :ch-out ch-out
                        :ruleset ruleset}))
+
+
+
+(comment
+
+  (def ruleset1
+    ;;; you can have many routes
+    {:routes
+
+     ;;; defining a route :book-flight
+     {:book-flight
+
+      ;;; routes define transitions from one "component" to other "component(s)"
+      {:transitions {nil :auth-checker
+
+                     :auth-checker {:next :overbooked-checker}
+
+                     :overbooked-checker {:next (fn [msg] :booker)}
+
+                     :booker {:transform (fn [msg] (assoc msg :checked true))
+                              :next [:invoice-generator (fn [msg] :notifier)]}}}}})
+
+  )


Factor out repeated map access with destructuring

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -31,14 +31,15 @@
    [:a {:href "/#"}]])

 (defn manga-site [site]
-  ^{:key (:id site)}
-  [:li
-   [:input {:type "button"
-            :value (:name site)
-            :on-click #(.log js/console
-                             (str "You clicked the "
-                                  (:id site)
-                                  " button!"))}]])
+  (let [{:keys [id name]} site]
+   ^{:key id}
+     [:li
+      [:input {:type "button"
+               :value name
+               :on-click #(.log js/console
+                                (str "You clicked the "
+                                     id
+                                     " button!"))}]]))

 (defn site-list []
   (let [site-list (rf/subscribe [:site-list])]


Add IDisplayName for Om-i instrumentation

--- src/cljs/dato/debug/components/core.cljs
+++ src/cljs/dato/debug/components/core.cljs
@@ -71,6 +71,9 @@

 (defn history-com [data owner opts]
   (reify
+    om/IDisplayName
+    (display-name [_]
+      "DatoDebuggerContainer")
     om/IWillMount
     (will-mount [_]
       (om/set-state! owner [:current-save-slot] 0)


Update links.

Update links.

--- src/clojure/buddy/core/sign.clj
+++ src/clojure/buddy/core/sign.clj
@@ -13,9 +13,10 @@
 ;; limitations under the License.

 ;; Links to rfcs:
-;; - http://tools.ietf.org/html/draft-ietf-jose-json-web-encryption-24
 ;; - http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-19
 ;; - http://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-24
+;; - http://tools.ietf.org/html/draft-ietf-jose-json-web-signature-24
+;; - http://tools.ietf.org/html/draft-ietf-jose-json-web-encryption-24

 (ns buddy.core.sign
   "Basic crypto primitives that used for more high


redirect to login if unauthorized creation of topic

--- src/clojurelive_web/actions.clj
+++ src/clojurelive_web/actions.clj
@@ -40,18 +40,22 @@
   (topic/newest 0 25))

 (defn new-link [req]
-  (let [topic (first (topic/create (:clojurelive/username (:session req))
-                                   {:title (:title (:params req))
-                                    :content (:content (:params req))
-                                    :type "link"}))]
-    (ring-response/redirect (str "/t/" (:uuid topic)) :see-other)))
+  (if (empty? (:clojurelive/username (:session req)))
+    (ring-response/redirect "/login")
+    (let [topic (first (topic/create (:clojurelive/username (:session req))
+                                     {:title (:title (:params req))
+                                      :content (:content (:params req))
+                                      :type "link"}))]
+      (ring-response/redirect (str "/t/" (:uuid topic)) :see-other))))

 (defn new-text [req]
-  (let [topic (first (topic/create (:clojurelive/username (:session req))
-                                   {:title (:title (:params req))
-                                    :content (:content (:params req))
-                                    :type "text"}))]
-    (ring-response/redirect (str "/t/" (:uuid topic)) :see-other)))
+  (if (empty? (:clojurelive/username (:session req)))
+    (ring-response/redirect "/login")
+    (let [topic (first (topic/create (:clojurelive/username (:session req))
+                                     {:title (:title (:params req))
+                                      :content (:content (:params req))
+                                      :type "text"}))]
+      (ring-response/redirect (str "/t/" (:uuid topic)) :see-other))))

 (defn send-reset-password-email [req]
   (let [email (:email (:params req))


Explore core.async different behavior in clj and cljs

--- src/snergly/algorithms.cljc
+++ src/snergly/algorithms.cljc
@@ -255,6 +255,37 @@
       ((algorithm-functions alg-name) grid result-chan false)
       (async/<!! result-chan))))

+;; This is here just to demonstrate the way that core.async works differently
+;; between Clojure and ClojureScript.  I wanted to ensure that in the Clojure
+;; version I was using the go-loops in the same way as in ClojureScript when
+;; doing animation.
+;;
+;; In the current ClojureScript version, all of the algorithms work fine when
+;; not animating, just computing the final maze and rendering it.
+;;
+;; But when animating, only aldous-broder and sidewinder work properly, and
+;; those are the ones that only have a single go-loop in the algorithm.  The
+;; others use two go-loops on the same channel, and they don't animate; for
+;; some reason, they only report the finished grid.
+;;
+;; For a while, I was failing to close result-chan at the end of most
+;; algorithms, and then I got a different symptom: they would all animate just
+;; fine for small grids, but for large grids, all but aldous-broder and
+;; sidewinder would give the following error:
+;;
+;; > Uncaught Error: Assert failed: No more than 1024 pending puts are allowed
+;; >   on a single channel. Consider using a windowed buffer.
+;;
+(defn synchronous-algorithm-slow [alg-name]
+  (fn [grid]
+    (let [result-chan (async/chan)]
+      ((algorithm-functions alg-name) grid result-chan true)
+      (async/<!! (go-loop [prev-grid nil]
+                          (let [new-grid (async/<! result-chan)]
+                            (if new-grid
+                              (recur new-grid)
+                              prev-grid)))))))
+
 (defn algorithm-fn [name options]
   (let [algorithm (synchronous-algorithm name)
         analyze-distances (fn [maze] (find-distances maze (:distances options)))


Replace murmur3 with blake2b-256.

Replace murmur3 with blake2b-256.

For avoid posible invalid cache hits due to
the murmur3 colisions.

--- src/uxbox/util/response.clj
+++ src/uxbox/util/response.clj
@@ -15,17 +15,21 @@
   negotiation that is coming to catacumba."
   (:require [catacumba.impl.handlers :as ch]
             [catacumba.impl.context :as ctx]
+            [buddy.core.hash :as hash]
             [buddy.core.codecs :as codecs]
+            [buddy.core.codecs.base64 :as b64]
             [uxbox.util.transit :as t])
   (:import ratpack.handling.Context
            ratpack.http.Response
            ratpack.http.Request
            ratpack.http.Headers
-           ratpack.http.MutableHeaders
-           clojure.lang.Murmur3))
+           ratpack.http.MutableHeaders))

-;; TODO: consider replacing murmu3 with blake2b for avoid posible false positives
-(def digest (comp str #(Murmur3/hashUnencodedChars ^String %) codecs/bytes->str))
+(defn digest
+  [^bytes data]
+  (-> (hash/blake2b-256 data)
+      (b64/encode true)
+      (codecs/bytes->str)))

 (defn- etag-match?
   [^Request request ^String new-tag]


Make plugin help get picked up by help task.

--- src/leiningen/plugin.clj
+++ src/leiningen/plugin.clj
@@ -7,7 +7,8 @@
                               extract-jar
                               get-default-uberjar-name)]
         [clojure.java.io :only (file)])
-  (:require [leiningen.install])
+  (:require [leiningen.install]
+            [clojure.string :as string])
   (:import [java.util.zip ZipOutputStream]
            [java.io File FileOutputStream]))

@@ -52,6 +53,7 @@
     (.delete (file plugins-path
                (plugin-standalone-filename group name version)))))

+;; TODO: move subtask documentation support to help namespace.
 (defn- formatted-docstring [command docstring padding]
   (apply str
     (replace
@@ -77,25 +79,21 @@
         [(str (:name (meta subtask))) (:doc (meta subtask))])
       [#'help #'install #'uninstall])))

-(defn help
-  "Show plugin subtasks"
-  []
+(defn help []
   (let [help-map (get-help-map)
         longest-key-length (apply max (map count (keys help-map)))]
-    (println (str "Plugin tasks available:\n"))
-    (doall (map
-             (fn [[k v]] (println (formatted-help k v longest-key-length)))
-             help-map))
-    (println)))
+    (string/join "\n" (concat
+                       ["Manage user-level plugins.\n"
+                        "Subtasks available:\n"]
+                       (for [[subtask doc] help-map]
+                         (formatted-help subtask doc longest-key-length))))))

-
-(defn plugin
-  ([] (help))
-  ([_] (help))
-  ([_ _] (help))
+(defn ^{:help-arglists '([subtask project-name version])} plugin
+  ([] (println (help)))
+  ([_] (plugin))
+  ([_ _] (plugin))
   ([subtask project-name version]
     (case subtask
       "install" (install project-name version)
       "uninstall" (uninstall project-name version)
       (help))))
-


Removed with-swing-threads from message-box

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

--- src/conexp/contrib/gui/util.clj
+++ src/conexp/contrib/gui/util.clj
@@ -63,11 +63,9 @@
 (defn message-box
   "Pops up a swing message box."
   ([text title]
-     (with-swing-threads
-       (JOptionPane/showMessageDialog nil (str text) (str title) 0)))
+     (JOptionPane/showMessageDialog nil (str text) (str title) 0))
   ([text]
-     (with-swing-threads
-       (JOptionPane/showMessageDialog nil (str text) "Info" 0))))
+     (JOptionPane/showMessageDialog nil (str text) "Info" 0)))

 (defn get-resource
   "Returns the resource res if found, nil otherwise."


Don't sort before computing minimal intersection sets

since it does not seem to buy anything.

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

--- src/conexp/fca/implications.clj
+++ src/conexp/fca/implications.clj
@@ -225,12 +225,7 @@
   non-empty intersection with all sets in set-sqn and are minimal with
   this property."
   [base-set set-sqn]
-  (let [cards    (map-by-fn (fn [x]
-                              (count (set-of X | X set-sqn :when (contains? X x))))
-                            base-set),
-        elements (sort (fn [x y]
-                         (>= (cards x) (cards y)))
-                       base-set),
+  (let [elements (seq base-set),
         result   (atom []),
         search   (fn search [rest-sets current rest-elements]
                    (cond


Reduce overdraw in bottom bar

Reduce overdraw in bottom bar

--- src/status_im/ui/components/bottom_bar/styles.cljs
+++ src/status_im/ui/components/bottom_bar/styles.cljs
@@ -2,7 +2,7 @@
   (:require [status-im.ui.components.colors :as colors]
             [status-im.utils.platform :as platform]
             [status-im.ui.components.animation :as animation])
-  (:require-macros [status-im.utils.styles :refer [defnstyle]]))
+  (:require-macros [status-im.utils.styles :refer [defnstyle defstyle]]))

 (def tabs-height
   (cond
@@ -79,14 +79,14 @@
   {:color     (if active? colors/blue colors/gray)
    :font-size 11})

-(def new-tabs-container
-  {:height           tabs-height
-   :align-self       :stretch
-   :background-color :white
-   :shadow-radius    4
-   :shadow-offset    {:width 0 :height -5}
-   :shadow-opacity   0.3
-   :shadow-color     "rgba(0, 9, 26, 0.12)"})
+(defstyle new-tabs-container
+  {:height     tabs-height
+   :align-self :stretch
+   :ios        {:background-color :white
+                :shadow-radius    4
+                :shadow-offset    {:width 0 :height -5}
+                :shadow-opacity   0.3
+                :shadow-color     "rgba(0, 9, 26, 0.12)"}})

 (def tabs
   {:height         tabs-height


fixing action tests adding provided nil

fixing action tests adding provided nil

--- test/celestial/integration/persistency/actions.clj
+++ test/celestial/integration/persistency/actions.clj
@@ -8,17 +8,18 @@
   [celestial.persistency.actions :as a])
  (:use midje.sweet))

+(def redis-deploy-provided (assoc redis-deploy :provided nil))
 (with-state-changes [(before :facts (clear-all))]
   (fact "basic actions usage" :integration :redis :actions
     (p/add-type redis-type)
     (let [id (a/add-action redis-deploy)]
-      (a/get-action id) => redis-deploy
+      (a/get-action id) => redis-deploy-provided
       (a/get-action-index :operates-on "redis") => [(str id)]
-      (a/find-action-for "deploy" "redis") => redis-deploy))
+      (a/find-action-for "deploy" "redis") =>  redis-deploy-provided))

   (fact "duplicated actions" :integration :redis :actions
     (p/add-type redis-type)
     (let [id (a/add-action redis-deploy)]
-      (a/get-action id) => redis-deploy
+      (a/get-action id) => redis-deploy-provided
       (a/add-action redis-deploy) =>
          (throws ExceptionInfo (is-type? :celestial.persistency.actions/duplicated-action)))))


Sort ns

Sort ns

--- src/mokkameister/web.clj
+++ src/mokkameister/web.clj
@@ -1,13 +1,13 @@
 (ns mokkameister.web
-  (:require [compojure.core :refer [defroutes GET PUT POST DELETE ANY]]
+  (:require [cheshire.core :as json]
+            [clojure.pprint :refer [pprint]]
+            [compojure.core :refer [defroutes GET PUT POST DELETE ANY]]
+            [environ.core :refer [env]]
+            [mokkameister.slack :as slack]
+            [mokkameister.util :refer [parse-int]]
             [ring.adapter.jetty :as jetty]
-            [ring.middleware.stacktrace :refer [wrap-stacktrace]]
             [ring.middleware.defaults :refer [wrap-defaults api-defaults]]
-            [environ.core :refer [env]]
-            [clojure.pprint :refer [pprint]]
-            [cheshire.core :as json]
-            [mokkameister.slack :as slack]
-            [mokkameister.util :refer [parse-int]]))
+            [ring.middleware.stacktrace :refer [wrap-stacktrace]]))

 (defn- coffee-message-starting [user minutes]
   (format "God nyhendnad folket! %s starta nett kaffitraktaren, kaffi om %d minuttar!" user minutes))


Fix destructuring thinko for projects.

Fix destructuring thinko for projects.

--- src/kixi/hecuba/amon.clj
+++ src/kixi/hecuba/amon.clj
@@ -197,7 +197,7 @@
         coll)))

   :post!
-  (fn [request]
+  (fn [{request :request}]
     {:project-id (upsert! commander :project (decode-body request))})

   :handle-created


use real field names

use real field names

--- pigpen-cascading/src/main/clojure/pigpen/cascading.clj
+++ pigpen-cascading/src/main/clojure/pigpen/cascading.clj
@@ -111,12 +111,11 @@
                                                            (BufferJoin.))})))

 (defmethod command->flowdef :join
-  [{:keys [id keys ancestors] :as c} flowdef]
+  [{:keys [id keys fields ancestors]} flowdef]
   (update-in flowdef [:pipes] (partial merge {id (CoGroup. (str id)
                                                            (into-array Pipe (map (:pipes flowdef) ancestors))
                                                            (into-array (map #(Fields. (into-array (map str %))) keys))
-                                                           ; TODO: use real field names
-                                                           (Fields. (into-array ["k" "v" "k2" "v2"])))})))
+                                                           (Fields. (into-array (map str fields))))})))

 (defmethod command->flowdef :projection-flat
   [{:keys [code alias pipe field-projections]} flowdef]


Improve release start output

Improve release start output

--- src/leiningen/pallet_release/release.clj
+++ src/leiningen/pallet_release/release.clj
@@ -70,11 +70,15 @@
   {:pre [(map? project)]}
   (lein/clean project)
   (lein/test project)
+  (println)
+  (print "travis… ")
   (travis/enable project)
+  (println)
   (git/release-start new-version)
   (update-release-notes old-version new-version)
   (lein/update-versions project old-version new-version)
   (spit ".pallet-release" new-version)
+  (println)
   (println (release-notes new-version))
   (println
    "\nCheck project.clj, ReleaseNotes and README (finish will commit these)"))


Remove apikey requirement

Remove apikey requirement

--- src/saa.clj
+++ src/saa.clj
@@ -76,10 +76,6 @@
         cliopts (:options climap)
         measurement (str "mts-1-1-" (:measurement cliopts))
         filename (str "/tmp/weatherdata-" (:location cliopts) ".xml")
-        ;; datauri (str "http://data.fmi.fi/fmi-apikey/"
-        ;;              (apikey (config))
-        ;;              "/wfs?request=getFeature&storedquery_id=fmi::forecast::hirlam::surface::point::timevaluepair&place="
-        ;;              (:location cliopts))
         datauri (str "http://opendata.fmi.fi/wfs?request=getFeature&storedquery_id=fmi::forecast::hirlam::surface::point::timevaluepair&place="
                      (:location cliopts))
         initfile (when (or ; fetch the XML if a cached copy doesn't exist or is over 15 mins old


use underscore to signal unused arguments

--- src/main/clojure/naojure/motion_calc.clj
+++ src/main/clojure/naojure/motion_calc.clj
@@ -20,10 +20,10 @@
 (defn head-centre [angle]
   {:joints {"HeadPitch" angle}})

-(defn head-stiff [ignored]
+(defn head-stiff [_]
   {:stiffness {"Head" 1.0}})

-(defn head-relax [ignored]
+(defn head-relax [_]
   {:stiffness {"Head" 0.0}})

@@ -83,22 +83,22 @@
 (defn arms-back [angle1 angle2]
   (combine-joint-fns angle1 angle2 arms-left-back arms-right-back))

-(defn arms-left-stiff [& ignored]
+(defn arms-left-stiff [& _]
   {:stiffness {"LArm" 1.0}})

-(defn arms-right-stiff [& ignored]
+(defn arms-right-stiff [& _]
   {:stiffness {"RArm" 1.0}})

-(defn arms-stiff [& ignored]
+(defn arms-stiff [& _]
   (combine-stiffness-fns arms-left-stiff arms-right-stiff))

-(defn arms-left-relax [& ignored]
+(defn arms-left-relax [& _]
   {:stiffness {"LArm" 0.0}})

-(defn arms-right-relax [& ignored]
+(defn arms-right-relax [& _]
   {:stiffness {"RArm" 0.0}})

-(defn arms-relax [& ignored]
+(defn arms-relax [& _]
   (combine-stiffness-fns arms-left-relax arms-right-relax))

@@ -265,22 +265,22 @@
   [angle1 angle2]
   {:joints {"RHipPitch" angle1}})

-(defn legs-left-stiff  [& ignored]
+(defn legs-left-stiff  [& _]
   {:stiffness {"LLeg" 1.0}})

-(defn legs-right-stiff  [& ignored]
+(defn legs-right-stiff  [& _]
   {:stiffness {"RLeg" 1.0}})

-(defn legs-stiff [& ignored]
+(defn legs-stiff [& _]
   (combine-stiffness-fns legs-left-stiff legs-right-stiff))

-(defn legs-left-relax  [& ignored]
+(defn legs-left-relax  [& _]
   {:stiffness {"LLeg" 0.0}})

-(defn legs-right-relax  [& ignored]
+(defn legs-right-relax  [& _]
   {:stiffness {"RLeg" 0.0}})

-(defn legs-relax [& ignored]
+(defn legs-relax [& _]
   (combine-stiffness-fns legs-left-stiff legs-right-stiff))

 ;; knees


Use new sanitize-name function.

Use new sanitize-name function.

This allows function specifications to be more flexibly translated from
natural string values (with capitalization and spaces) to good keywords.
It enables more frequent use of simple string/keyword specs.

--- src/afterglow/channels.clj
+++ src/afterglow/channels.clj
@@ -1,7 +1,8 @@
 (ns afterglow.channels
   "Functions for modeling DMX channels"
   {:author "James Elliott"}
-  (:require [com.evocomputing.colors :as colors]))
+  (:require [afterglow.fixtures.qxf :refer [sanitize-name]]
+            [com.evocomputing.colors :as colors]))

 (defn channel
   "Creates a minimal channel specification, containing just the
@@ -146,8 +147,8 @@
         (string? spec)
         {:start start
          :range :fixed
-         :type (keyword spec)
-         :label (clojure.string/capitalize (name spec))}
+         :type (keyword (sanitize-name spec))
+         :label spec}

         (nil? spec)
         {:start start
@@ -197,7 +198,7 @@
       (map #(expand-function-spec [%1 %2]) start spec)
       (map-indexed (fn [index start]
                      (cond (string? spec)
-                           (expand-function-spec [start (str spec "-" (inc index))])
+                           (expand-function-spec [start (str spec " " (inc index))])

                            (keyword? spec)
                            (expand-function-spec [start (keyword (str (name spec) "-" (inc index)))])


add some more config specs

add some more config specs

--- src/main/shadow/cljs/devtools/config.clj
+++ src/main/shadow/cljs/devtools/config.clj
@@ -25,13 +25,29 @@
 (s/def ::dependencies
   (s/coll-of ::dependency :kind vector?))

+(s/def ::aliases
+  (s/coll-of keyword? :kind vector?))
+
+(s/def ::deps-map
+  (s/and
+    (s/map-of keyword? any?)
+    (s/keys
+      ::opts-un
+      [::aliases])))
+
+(s/def ::deps
+  (s/or
+    :boolean boolean?
+    :map ::deps-map))
+
 (s/def ::config
   (s/keys
     :req-un
     [::builds]
     :opt-un
     [::source-paths
-     ::dependencies]
+     ::dependencies
+     ::deps]
     ))

 (defn builds->map [builds]
@@ -118,6 +134,14 @@
     config
     ))

+(comment
+  ;; ok
+  (s/valid? ::config '{:builds {} :deps {:aliases [:a :b :c]}})
+  (s/valid? ::config '{:builds {} :deps true})
+  (s/valid? ::config '{:builds {} :deps false})
+  ;; not
+  (s/valid? ::config '{:builds {} :deps {foo {:mvn/version "1.2.3"}}}))
+
 (defn get-build
   ([id]
    (get-build (load-cljs-edn!) id))


Fixed a minor issue in the Calendar component

The key that was set on the 'week' part of the calendar did not create
keys that were unique enough, this can be seen when switching to March
2017, in which there are 2 occurences of weeks beginning on the 26th
(one in Feb, the other in Mar).
This included the month in the key as well to circumvent this.

--- src/main/untangled/components/ui/component/calendar.cljs
+++ src/main/untangled/components/ui/component/calendar.cljs
@@ -211,7 +211,8 @@
                                                     (dom/th #js {:key label :className "o-day-name"} (tr-unsafe label)))))
                                (dom/tbody nil
                                           (for [week weeks]
-                                            (dom/tr #js {:key (.getDate (first week)) :className "week"}
+                                            (dom/tr #js {:key (str (.getDate (first week)) "-" (.getMonth (first week)))
+                                                         :className "week"}
                                                     (for [day week]
                                                       (dom/td #js {
                                                                    :key       (str "d" (.getMonth day) "-" (.getDate day))


Fix create link of drafts board in org response.

--- src/oc/storage/representations/board.clj
+++ src/oc/storage/representations/board.clj
@@ -70,11 +70,12 @@
   (let [board-slug (:slug board)
         options (if (zero? draft-count) {} {:count draft-count})
         is-draft-board? (= board-slug "drafts")
-        links [(self-link org-slug board-slug :recently-posted options)
-               (when-not is-draft-board?
-                 (self-link org-slug board-slug :recent-activity options))]
-        full-links (if (or (= :author (:access-level board))
-                           is-draft-board?)
+        links (remove nil?
+               [(self-link org-slug board-slug :recently-posted options)
+                (when-not is-draft-board?
+                   (self-link org-slug board-slug :recent-activity options))])
+        full-links (if (and (= :author (:access-level board))
+                            (not is-draft-board?))
           ;; Author gets create link
           (conj links (create-entry-link org-slug board-slug))
           ;; No create link


explore button opens channels page

explore button opens channels page

--- src/chat/client/views.cljs
+++ src/chat/client/views.cljs
@@ -64,7 +64,8 @@

         (dom/div #js {:className "header"}
           (dom/div #js {:className "users" :title "Users"} 10)
-          (dom/div #js {:className "tags" :title "Explore"})
+          (dom/div #js {:className "tags" :title "Explore"
+                        :onClick (fn [e] (store/set-page! {:type :channels}))})
           (dom/div #js {:className "help" :title "Help"})

           (om/build search-bar-view (data :page)))